fix(products): fix breadcrumbs and product filtering (backport from main)
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled

This commit is contained in:
2026-02-24 16:04:21 +01:00
parent 915eb61613
commit 5397309103
43805 changed files with 4324295 additions and 3 deletions

View File

@@ -0,0 +1,3 @@
export declare const decode: (base64: string) => ArrayBuffer | number[];
export declare const polyUint16Array: (buffer: number[]) => number[];
export declare const polyUint32Array: (buffer: number[]) => number[];

View File

@@ -0,0 +1,14 @@
import { formatAdminURL } from 'payload/shared';
export const handleBackToDashboard = ({
adminRoute,
router,
serverURL
}) => {
const redirectRoute = formatAdminURL({
adminRoute,
path: '',
serverURL
});
router.push(redirectRoute);
};
//# sourceMappingURL=handleBackToDashboard.js.map

View File

@@ -0,0 +1,12 @@
import { consoleLoggingIntegrationShim, loggerShim } from '@sentry-internal/integration-shims';
import { feedbackAsyncIntegration } from './feedbackAsync';
export * from './index.bundle.base';
export { consoleLoggingIntegrationShim as consoleLoggingIntegration, loggerShim as logger };
export { getActiveSpan, getRootSpan, startSpan, startInactiveSpan, startSpanManual, startNewTrace, withActiveSpan, getSpanDescendants, setMeasurement, } from '@sentry/core';
export { browserTracingIntegration, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, } from './tracing/browserTracingIntegration';
export { setActiveSpanInBrowser } from './tracing/setActiveSpan';
export { reportPageLoaded } from './tracing/reportPageLoaded';
export { getFeedback, sendFeedback } from '@sentry-internal/feedback';
export { feedbackAsyncIntegration as feedbackAsyncIntegration, feedbackAsyncIntegration as feedbackIntegration };
export { replayIntegration, getReplay } from '@sentry-internal/replay';
//# sourceMappingURL=index.bundle.tracing.replay.feedback.d.ts.map

View File

@@ -0,0 +1,62 @@
/**
* The localize function argument callback which allows to convert raw value to
* the actual type.
*
* @param value - The value to convert
*
* @returns The converted value
*/
/**
* The map of localized values for each width.
*/
/**
* The index type of the locale unit value. It types conversion of units of
* values that don't start at 0 (i.e. quarters).
*/
/**
* Converts the unit value to the tuple of values.
*/
/**
* The tuple of localized era values. The first element represents BC,
* the second element represents AD.
*/
/**
* The tuple of localized quarter values. The first element represents Q1.
*/
/**
* The tuple of localized day values. The first element represents Sunday.
*/
/**
* The tuple of localized month values. The first element represents January.
*/
export function buildLocalizeFn(args) {
return (value, options) => {
const context = options?.context ? String(options.context) : "standalone";
let valuesArray;
if (context === "formatting" && args.formattingValues) {
const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
const width = options?.width ? String(options.width) : defaultWidth;
valuesArray =
args.formattingValues[width] || args.formattingValues[defaultWidth];
} else {
const defaultWidth = args.defaultWidth;
const width = options?.width ? String(options.width) : args.defaultWidth;
valuesArray = args.values[width] || args.values[defaultWidth];
}
const index = args.argumentCallback ? args.argumentCallback(value) : value;
// @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
return valuesArray[index];
};
}

View File

@@ -0,0 +1,8 @@
"use strict";
exports.eachWeekOfIntervalWithOptions = void 0;
var _index = require("../eachWeekOfInterval.js");
var _index2 = require("./_lib/convertToFP.js"); // This file is generated automatically by `scripts/build/fp.ts`. Please, don't change it.
const eachWeekOfIntervalWithOptions = (exports.eachWeekOfIntervalWithOptions =
(0, _index2.convertToFP)(_index.eachWeekOfInterval, 2));

View File

@@ -0,0 +1,530 @@
(() => {
var _window$dateFns;function _typeof(o) {"@babel/helpers - typeof";return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {return typeof o;} : function (o) {return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;}, _typeof(o);}function ownKeys(e, r) {var t = Object.keys(e);if (Object.getOwnPropertySymbols) {var o = Object.getOwnPropertySymbols(e);r && (o = o.filter(function (r) {return Object.getOwnPropertyDescriptor(e, r).enumerable;})), t.push.apply(t, o);}return t;}function _objectSpread(e) {for (var r = 1; r < arguments.length; r++) {var t = null != arguments[r] ? arguments[r] : {};r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {_defineProperty(e, r, t[r]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));});}return e;}function _defineProperty(obj, key, value) {key = _toPropertyKey(key);if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _toPropertyKey(t) {var i = _toPrimitive(t, "string");return "symbol" == _typeof(i) ? i : String(i);}function _toPrimitive(t, r) {if ("object" != _typeof(t) || !t) return t;var e = t[Symbol.toPrimitive];if (void 0 !== e) {var i = e.call(t, r || "default");if ("object" != _typeof(i)) return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return ("string" === r ? String : Number)(t);}var __defProp = Object.defineProperty;
var __export = function __export(target, all) {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: function set(newValue) {return all[name] = function () {return newValue;};}
});
};
// lib/locale/en-US/_lib/formatDistance.js
var formatDistanceLocale = {
lessThanXSeconds: {
one: "less than a second",
other: "less than {{count}} seconds"
},
xSeconds: {
one: "1 second",
other: "{{count}} seconds"
},
halfAMinute: "half a minute",
lessThanXMinutes: {
one: "less than a minute",
other: "less than {{count}} minutes"
},
xMinutes: {
one: "1 minute",
other: "{{count}} minutes"
},
aboutXHours: {
one: "about 1 hour",
other: "about {{count}} hours"
},
xHours: {
one: "1 hour",
other: "{{count}} hours"
},
xDays: {
one: "1 day",
other: "{{count}} days"
},
aboutXWeeks: {
one: "about 1 week",
other: "about {{count}} weeks"
},
xWeeks: {
one: "1 week",
other: "{{count}} weeks"
},
aboutXMonths: {
one: "about 1 month",
other: "about {{count}} months"
},
xMonths: {
one: "1 month",
other: "{{count}} months"
},
aboutXYears: {
one: "about 1 year",
other: "about {{count}} years"
},
xYears: {
one: "1 year",
other: "{{count}} years"
},
overXYears: {
one: "over 1 year",
other: "over {{count}} years"
},
almostXYears: {
one: "almost 1 year",
other: "almost {{count}} years"
}
};
var formatDistance = function formatDistance(token, count, options) {
var result;
var tokenValue = formatDistanceLocale[token];
if (typeof tokenValue === "string") {
result = tokenValue;
} else if (count === 1) {
result = tokenValue.one;
} else {
result = tokenValue.other.replace("{{count}}", count.toString());
}
if (options !== null && options !== void 0 && options.addSuffix) {
if (options.comparison && options.comparison > 0) {
return "in " + result;
} else {
return result + " ago";
}
}
return result;
};
// lib/locale/en-US/_lib/formatRelative.js
var formatRelativeLocale = {
lastWeek: "'last' eeee 'at' p",
yesterday: "'yesterday at' p",
today: "'today at' p",
tomorrow: "'tomorrow at' p",
nextWeek: "eeee 'at' p",
other: "P"
};
var formatRelative = function formatRelative(token, _date, _baseDate, _options) {return formatRelativeLocale[token];};
// lib/locale/_lib/buildLocalizeFn.js
function buildLocalizeFn(args) {
return function (value, options) {
var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone";
var valuesArray;
if (context === "formatting" && args.formattingValues) {
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
} else {
var _defaultWidth = args.defaultWidth;
var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
valuesArray = args.values[_width] || args.values[_defaultWidth];
}
var index = args.argumentCallback ? args.argumentCallback(value) : value;
return valuesArray[index];
};
}
// lib/locale/en-US/_lib/localize.js
var eraValues = {
narrow: ["B", "A"],
abbreviated: ["BC", "AD"],
wide: ["Before Christ", "Anno Domini"]
};
var quarterValues = {
narrow: ["1", "2", "3", "4"],
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
};
var monthValues = {
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
abbreviated: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"],
wide: [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"]
};
var dayValues = {
narrow: ["S", "M", "T", "W", "T", "F", "S"],
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
wide: [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"]
};
var dayPeriodValues = {
narrow: {
am: "a",
pm: "p",
midnight: "mi",
noon: "n",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
},
abbreviated: {
am: "AM",
pm: "PM",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
},
wide: {
am: "a.m.",
pm: "p.m.",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
}
};
var formattingDayPeriodValues = {
narrow: {
am: "a",
pm: "p",
midnight: "mi",
noon: "n",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night"
},
abbreviated: {
am: "AM",
pm: "PM",
midnight: "midnight",
noon: "noon",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night"
},
wide: {
am: "a.m.",
pm: "p.m.",
midnight: "midnight",
noon: "noon",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night"
}
};
var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
var number = Number(dirtyNumber);
var rem100 = number % 100;
if (rem100 > 20 || rem100 < 10) {
switch (rem100 % 10) {
case 1:
return number + "st";
case 2:
return number + "nd";
case 3:
return number + "rd";
}
}
return number + "th";
};
var localize = {
ordinalNumber: ordinalNumber,
era: buildLocalizeFn({
values: eraValues,
defaultWidth: "wide"
}),
quarter: buildLocalizeFn({
values: quarterValues,
defaultWidth: "wide",
argumentCallback: function argumentCallback(quarter) {return quarter - 1;}
}),
month: buildLocalizeFn({
values: monthValues,
defaultWidth: "wide"
}),
day: buildLocalizeFn({
values: dayValues,
defaultWidth: "wide"
}),
dayPeriod: buildLocalizeFn({
values: dayPeriodValues,
defaultWidth: "wide",
formattingValues: formattingDayPeriodValues,
defaultFormattingWidth: "wide"
})
};
// lib/locale/_lib/buildMatchFn.js
function buildMatchFn(args) {
return function (string) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var width = options.width;
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
var matchResult = string.match(matchPattern);
if (!matchResult) {
return null;
}
var matchedString = matchResult[0];
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {return pattern.test(matchedString);}) : findKey(parsePatterns, function (pattern) {return pattern.test(matchedString);});
var value;
value = args.valueCallback ? args.valueCallback(key) : key;
value = options.valueCallback ? options.valueCallback(value) : value;
var rest = string.slice(matchedString.length);
return { value: value, rest: rest };
};
}
function findKey(object, predicate) {
for (var key in object) {
if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
return key;
}
}
return;
}
function findIndex(array, predicate) {
for (var key = 0; key < array.length; key++) {
if (predicate(array[key])) {
return key;
}
}
return;
}
// lib/locale/_lib/buildMatchPatternFn.js
function buildMatchPatternFn(args) {
return function (string) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var matchResult = string.match(args.matchPattern);
if (!matchResult)
return null;
var matchedString = matchResult[0];
var parseResult = string.match(args.parsePattern);
if (!parseResult)
return null;
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
value = options.valueCallback ? options.valueCallback(value) : value;
var rest = string.slice(matchedString.length);
return { value: value, rest: rest };
};
}
// lib/locale/en-US/_lib/match.js
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
var parseOrdinalNumberPattern = /\d+/i;
var matchEraPatterns = {
narrow: /^(b|a)/i,
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
wide: /^(before christ|before common era|anno domini|common era)/i
};
var parseEraPatterns = {
any: [/^b/i, /^(a|c)/i]
};
var matchQuarterPatterns = {
narrow: /^[1234]/i,
abbreviated: /^q[1234]/i,
wide: /^[1234](th|st|nd|rd)? quarter/i
};
var parseQuarterPatterns = {
any: [/1/i, /2/i, /3/i, /4/i]
};
var matchMonthPatterns = {
narrow: /^[jfmasond]/i,
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
};
var parseMonthPatterns = {
narrow: [
/^j/i,
/^f/i,
/^m/i,
/^a/i,
/^m/i,
/^j/i,
/^j/i,
/^a/i,
/^s/i,
/^o/i,
/^n/i,
/^d/i],
any: [
/^ja/i,
/^f/i,
/^mar/i,
/^ap/i,
/^may/i,
/^jun/i,
/^jul/i,
/^au/i,
/^s/i,
/^o/i,
/^n/i,
/^d/i]
};
var matchDayPatterns = {
narrow: /^[smtwf]/i,
short: /^(su|mo|tu|we|th|fr|sa)/i,
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
};
var parseDayPatterns = {
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
};
var matchDayPeriodPatterns = {
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
};
var parseDayPeriodPatterns = {
any: {
am: /^a/i,
pm: /^p/i,
midnight: /^mi/i,
noon: /^no/i,
morning: /morning/i,
afternoon: /afternoon/i,
evening: /evening/i,
night: /night/i
}
};
var match = {
ordinalNumber: buildMatchPatternFn({
matchPattern: matchOrdinalNumberPattern,
parsePattern: parseOrdinalNumberPattern,
valueCallback: function valueCallback(value) {return parseInt(value, 10);}
}),
era: buildMatchFn({
matchPatterns: matchEraPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseEraPatterns,
defaultParseWidth: "any"
}),
quarter: buildMatchFn({
matchPatterns: matchQuarterPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseQuarterPatterns,
defaultParseWidth: "any",
valueCallback: function valueCallback(index) {return index + 1;}
}),
month: buildMatchFn({
matchPatterns: matchMonthPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseMonthPatterns,
defaultParseWidth: "any"
}),
day: buildMatchFn({
matchPatterns: matchDayPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseDayPatterns,
defaultParseWidth: "any"
}),
dayPeriod: buildMatchFn({
matchPatterns: matchDayPeriodPatterns,
defaultMatchWidth: "any",
parsePatterns: parseDayPeriodPatterns,
defaultParseWidth: "any"
})
};
// lib/locale/_lib/buildFormatLongFn.js
function buildFormatLongFn(args) {
return function () {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var width = options.width ? String(options.width) : args.defaultWidth;
var format = args.formats[width] || args.formats[args.defaultWidth];
return format;
};
}
// lib/locale/en-GB/_lib/formatLong.js
var dateFormats = {
full: "EEEE, d MMMM yyyy",
long: "d MMMM yyyy",
medium: "d MMM yyyy",
short: "dd/MM/yyyy"
};
var timeFormats = {
full: "HH:mm:ss zzzz",
long: "HH:mm:ss z",
medium: "HH:mm:ss",
short: "HH:mm"
};
var dateTimeFormats = {
full: "{{date}} 'at' {{time}}",
long: "{{date}} 'at' {{time}}",
medium: "{{date}}, {{time}}",
short: "{{date}}, {{time}}"
};
var formatLong = {
date: buildFormatLongFn({
formats: dateFormats,
defaultWidth: "full"
}),
time: buildFormatLongFn({
formats: timeFormats,
defaultWidth: "full"
}),
dateTime: buildFormatLongFn({
formats: dateTimeFormats,
defaultWidth: "full"
})
};
// lib/locale/en-IE.js
var enIE = {
code: "en-IE",
formatDistance: formatDistance,
formatLong: formatLong,
formatRelative: formatRelative,
localize: localize,
match: match,
options: {
weekStartsOn: 1,
firstWeekContainsDate: 4
}
};
// lib/locale/en-IE/cdn.js
window.dateFns = _objectSpread(_objectSpread({},
window.dateFns), {}, {
locale: _objectSpread(_objectSpread({}, (_window$dateFns =
window.dateFns) === null || _window$dateFns === void 0 ? void 0 : _window$dateFns.locale), {}, {
enIE: enIE }) });
//# debugId=FC88A45FCE1FC04764756E2164756E21
//# sourceMappingURL=cdn.js.map
})();

View File

@@ -0,0 +1,18 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
*/
"use strict";
const RuntimeModule = require("../RuntimeModule");
class HelperRuntimeModule extends RuntimeModule {
/**
* @param {string} name a readable name
*/
constructor(name) {
super(name);
}
}
module.exports = HelperRuntimeModule;

View File

@@ -0,0 +1,23 @@
{
"name": "@formatjs/icu-messageformat-parser",
"version": "3.5.1",
"license": "MIT",
"type": "module",
"types": "index.d.ts",
"exports": {
".": "./index.js",
"./no-parser.js": "./no-parser.js",
"./printer.js": "./printer.js",
"./manipulator.js": "./manipulator.js"
},
"dependencies": {
"tslib": "^2.8.1",
"@formatjs/icu-skeleton-parser": "2.1.1",
"@formatjs/ecma402-abstract": "3.1.1"
},
"repository": {
"type": "git",
"url": "https://github.com/formatjs/formatjs.git",
"directory": "packages/icu-messageformat-parser"
}
}

View File

@@ -0,0 +1,7 @@
/**
* Performantly generate a unique, 30-char string by combining a version
* number, the current timestamp with a 13-digit number integer.
* @return {string}
*/
export declare const generateUniqueID: () => string;
//# sourceMappingURL=generateUniqueID.d.ts.map

View File

@@ -0,0 +1,22 @@
/**
* @license lucide-react v0.441.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const NotebookText = createLucideIcon("NotebookText", [
["path", { d: "M2 6h4", key: "aawbzj" }],
["path", { d: "M2 10h4", key: "l0bgd4" }],
["path", { d: "M2 14h4", key: "1gsvsf" }],
["path", { d: "M2 18h4", key: "1bu2t1" }],
["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", key: "1nb95v" }],
["path", { d: "M9.5 8h5", key: "11mslq" }],
["path", { d: "M9.5 12H16", key: "ktog6x" }],
["path", { d: "M9.5 16H14", key: "p1seyn" }]
]);
export { NotebookText as default };
//# sourceMappingURL=notebook-text.js.map

View File

@@ -0,0 +1,59 @@
import type { Integration } from '@sentry/core';
import type { AnrIntegrationOptions } from './common';
export declare const base64WorkerScript = "###AnrWorkerScript###";
type AnrInternal = {
startWorker: () => void;
stopWorker: () => void;
};
type AnrReturn = (options?: Partial<AnrIntegrationOptions>) => Integration & AnrInternal;
/**
* Application Not Responding (ANR) integration for Node.js applications.
*
* @deprecated The ANR integration has been deprecated. Use `eventLoopBlockIntegration` from `@sentry/node-native` instead.
*
* Detects when the Node.js main thread event loop is blocked for more than the configured
* threshold (5 seconds by default) and reports these as Sentry events.
*
* ANR detection uses a worker thread to monitor the event loop in the main app thread.
* The main app thread sends a heartbeat message to the ANR worker thread every 50ms by default.
* If the ANR worker does not receive a heartbeat message for the configured threshold duration,
* it triggers an ANR event.
*
* - Node.js 16.17.0 or higher
* - Only supported in the Node.js runtime (not browsers)
* - Not supported for Node.js clusters
*
* Overhead should be minimal:
* - Main thread: Only polling the ANR worker over IPC every 50ms
* - Worker thread: Consumes around 10-20 MB of RAM
* - When ANR detected: Brief pause in debugger to capture stack trace (negligible compared to the blocking)
*
* @example
* ```javascript
* Sentry.init({
* dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
* integrations: [
* Sentry.anrIntegration({
* anrThreshold: 5000,
* captureStackTrace: true,
* pollInterval: 50,
* }),
* ],
* });
* ```
*/
export declare const anrIntegration: AnrReturn;
/**
* @see {@link disableBlockDetectionForCallback}
*
* @deprecated The ANR integration has been deprecated. Use `eventLoopBlockIntegration` from `@sentry/node-native` instead.
*/
export declare function disableAnrDetectionForCallback<T>(callback: () => T): T;
/**
* @see {@link disableBlockDetectionForCallback}
*
* @deprecated The ANR integration has been deprecated. Use `eventLoopBlockIntegration` from `@sentry/node-native` instead.
*/
export declare function disableAnrDetectionForCallback<T>(callback: () => Promise<T>): Promise<T>;
export {};
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/afterRead/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAKnG,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,UAAU,IAAI;IAChD,UAAU,EAAE,IAAI,GAAG,yBAAyB,CAAA;IAC5C,OAAO,EAAE,cAAc,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,CAAC,CAAA;IACN,KAAK,EAAE,OAAO,CAAA;IACd,cAAc,EAAE,mBAAmB,CAAA;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,MAAM,EAAE,IAAI,GAAG,qBAAqB,CAAA;IACpC,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,GAAG,EAAE,cAAc,CAAA;IACnB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED;;;;;;;;GAQG;AAEH,wBAAsB,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAoFxF"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/FolderView/Breadcrumbs/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGtD,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,cAAc,CAAA;AAIrB,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,WAAW,EAAE;QACpB,EAAE,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;QAC1B,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAA;QAC9B,OAAO,EAAE,MAAM,IAAI,CAAA;KACpB,EAAE,CAAA;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AACD,wBAAgB,iBAAiB,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,KAAK,qBAuBlE;AAED,wBAAgB,mBAAmB,CAAC,EAClC,EAAE,EACF,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,GAAG,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,qBAqB/B"}

View File

@@ -0,0 +1,29 @@
import { APIError } from '../../../errors/index.js';
import { deepCopyObjectSimple } from '../../../index.js';
import { createLocalReq } from '../../../utilities/createLocalReq.js';
import { updateOperation } from '../update.js';
export async function updateGlobalLocal(payload, options) {
const { slug: globalSlug, data, depth, draft, overrideAccess = true, overrideLock, populate, publishAllLocales, publishSpecificLocale, select, showHiddenFields, unpublishAllLocales } = options;
const globalConfig = payload.globals.config.find((config)=>config.slug === globalSlug);
if (!globalConfig) {
throw new APIError(`The global with slug ${String(globalSlug)} can't be found.`);
}
return updateOperation({
slug: globalSlug,
data: deepCopyObjectSimple(data),
depth,
draft,
globalConfig,
overrideAccess,
overrideLock,
populate,
publishAllLocales,
publishSpecificLocale: publishSpecificLocale,
req: await createLocalReq(options, payload),
select,
showHiddenFields,
unpublishAllLocales
});
}
//# sourceMappingURL=update.js.map

View File

@@ -0,0 +1,25 @@
import type { I18nClient, TFunction } from '@payloadcms/translations';
import type { Field } from '../../fields/config/types.js';
import type { ClientFieldWithOptionalType, ServerComponentProps } from './Field.js';
export type DescriptionFunction = (args: {
i18n: I18nClient;
t: TFunction;
}) => string;
export type FieldDescriptionClientComponent<TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType> = React.ComponentType<FieldDescriptionClientProps<TFieldClient>>;
export type FieldDescriptionServerComponent<TFieldServer extends Field = Field, TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType> = React.ComponentType<FieldDescriptionServerProps<TFieldServer, TFieldClient>>;
export type StaticDescription = Record<string, string> | string;
export type Description = DescriptionFunction | StaticDescription;
export type GenericDescriptionProps = {
readonly className?: string;
readonly description?: StaticDescription;
readonly marginPlacement?: 'bottom' | 'top';
readonly path: string;
};
export type FieldDescriptionServerProps<TFieldServer extends Field = Field, TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType> = {
clientField: TFieldClient;
readonly field: TFieldServer;
} & GenericDescriptionProps & ServerComponentProps;
export type FieldDescriptionClientProps<TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType> = {
field: TFieldClient;
} & GenericDescriptionProps;
//# sourceMappingURL=Description.d.ts.map

View File

@@ -0,0 +1,94 @@
import { entityKind, is } from "../../entity.js";
import { PgDialect } from "../dialect.js";
import { SelectionProxyHandler } from "../../selection-proxy.js";
import { WithSubquery } from "../../subquery.js";
import { PgSelectBuilder } from "./select.js";
class QueryBuilder {
static [entityKind] = "PgQueryBuilder";
dialect;
dialectConfig;
constructor(dialect) {
this.dialect = is(dialect, PgDialect) ? dialect : void 0;
this.dialectConfig = is(dialect, PgDialect) ? void 0 : dialect;
}
$with = (alias, selection) => {
const queryBuilder = this;
const as = (qb) => {
if (typeof qb === "function") {
qb = qb(queryBuilder);
}
return new Proxy(
new WithSubquery(
qb.getSQL(),
selection ?? ("getSelectedFields" in qb ? qb.getSelectedFields() ?? {} : {}),
alias,
true
),
new SelectionProxyHandler({ alias, sqlAliasedBehavior: "alias", sqlBehavior: "error" })
);
};
return { as };
};
with(...queries) {
const self = this;
function select(fields) {
return new PgSelectBuilder({
fields: fields ?? void 0,
session: void 0,
dialect: self.getDialect(),
withList: queries
});
}
function selectDistinct(fields) {
return new PgSelectBuilder({
fields: fields ?? void 0,
session: void 0,
dialect: self.getDialect(),
distinct: true
});
}
function selectDistinctOn(on, fields) {
return new PgSelectBuilder({
fields: fields ?? void 0,
session: void 0,
dialect: self.getDialect(),
distinct: { on }
});
}
return { select, selectDistinct, selectDistinctOn };
}
select(fields) {
return new PgSelectBuilder({
fields: fields ?? void 0,
session: void 0,
dialect: this.getDialect()
});
}
selectDistinct(fields) {
return new PgSelectBuilder({
fields: fields ?? void 0,
session: void 0,
dialect: this.getDialect(),
distinct: true
});
}
selectDistinctOn(on, fields) {
return new PgSelectBuilder({
fields: fields ?? void 0,
session: void 0,
dialect: this.getDialect(),
distinct: { on }
});
}
// Lazy load dialect to avoid circular dependency
getDialect() {
if (!this.dialect) {
this.dialect = new PgDialect(this.dialectConfig);
}
return this.dialect;
}
}
export {
QueryBuilder
};
//# sourceMappingURL=query-builder.js.map

View File

@@ -0,0 +1,9 @@
// This file is generated automatically by `scripts/build/fp.ts`. Please, don't change it.
import { intervalToDuration as fn } from "../intervalToDuration.js";
import { convertToFP } from "./_lib/convertToFP.js";
export const intervalToDurationWithOptions = convertToFP(fn, 2);
// Fallback for modularized imports:
export default intervalToDurationWithOptions;

View File

@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.441.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const BatteryLow = createLucideIcon("BatteryLow", [
["rect", { width: "16", height: "10", x: "2", y: "7", rx: "2", ry: "2", key: "1w10f2" }],
["line", { x1: "22", x2: "22", y1: "11", y2: "13", key: "4dh1rd" }],
["line", { x1: "6", x2: "6", y1: "11", y2: "13", key: "1wd6dw" }]
]);
export { BatteryLow as default };
//# sourceMappingURL=battery-low.js.map

View File

@@ -0,0 +1,11 @@
export const transformNumbers = ({ baseRow, data, numbers })=>{
data.forEach((val, i)=>{
numbers.push({
...baseRow,
number: val,
order: i + 1
});
});
};
//# sourceMappingURL=numbers.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/gel-core/roles.ts"],"sourcesContent":["import { entityKind } from '~/entity.ts';\n\nexport interface GelRoleConfig {\n\tcreateDb?: boolean;\n\tcreateRole?: boolean;\n\tinherit?: boolean;\n}\n\nexport class GelRole implements GelRoleConfig {\n\tstatic readonly [entityKind]: string = 'GelRole';\n\n\t/** @internal */\n\t_existing?: boolean;\n\n\t/** @internal */\n\treadonly createDb: GelRoleConfig['createDb'];\n\t/** @internal */\n\treadonly createRole: GelRoleConfig['createRole'];\n\t/** @internal */\n\treadonly inherit: GelRoleConfig['inherit'];\n\n\tconstructor(\n\t\treadonly name: string,\n\t\tconfig?: GelRoleConfig,\n\t) {\n\t\tif (config) {\n\t\t\tthis.createDb = config.createDb;\n\t\t\tthis.createRole = config.createRole;\n\t\t\tthis.inherit = config.inherit;\n\t\t}\n\t}\n\n\texisting(): this {\n\t\tthis._existing = true;\n\t\treturn this;\n\t}\n}\n\nexport function gelRole(name: string, config?: GelRoleConfig) {\n\treturn new GelRole(name, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA2B;AAQpB,MAAM,QAAiC;AAAA,EAa7C,YACU,MACT,QACC;AAFQ;AAGT,QAAI,QAAQ;AACX,WAAK,WAAW,OAAO;AACvB,WAAK,aAAa,OAAO;AACzB,WAAK,UAAU,OAAO;AAAA,IACvB;AAAA,EACD;AAAA,EArBA,QAAiB,wBAAU,IAAY;AAAA;AAAA,EAGvC;AAAA;AAAA,EAGS;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EAaT,WAAiB;AAChB,SAAK,YAAY;AACjB,WAAO;AAAA,EACR;AACD;AAEO,SAAS,QAAQ,MAAc,QAAwB;AAC7D,SAAO,IAAI,QAAQ,MAAM,MAAM;AAChC;","names":[]}

View File

@@ -0,0 +1 @@
{"version":3,"file":"arrow-up-z-a.js","sources":["../../../src/icons/arrow-up-z-a.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ArrowUpZA\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMyA4IDQtNCA0IDQiIC8+CiAgPHBhdGggZD0iTTcgNHYxNiIgLz4KICA8cGF0aCBkPSJNMTUgNGg1bC01IDZoNSIgLz4KICA8cGF0aCBkPSJNMTUgMjB2LTMuNWEyLjUgMi41IDAgMCAxIDUgMFYyMCIgLz4KICA8cGF0aCBkPSJNMjAgMThoLTUiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/arrow-up-z-a\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst ArrowUpZA = createLucideIcon('ArrowUpZA', [\n ['path', { d: 'm3 8 4-4 4 4', key: '11wl7u' }],\n ['path', { d: 'M7 4v16', key: '1glfcx' }],\n ['path', { d: 'M15 4h5l-5 6h5', key: '8asdl1' }],\n ['path', { d: 'M15 20v-3.5a2.5 2.5 0 0 1 5 0V20', key: 'r6l5cz' }],\n ['path', { d: 'M20 18h-5', key: '18j1r2' }],\n]);\n\nexport default ArrowUpZA;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,iBAAiB,WAAa,CAAA,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC7C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC/C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAoC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACjE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC5C,CAAC,CAAA,CAAA;;"}

View File

@@ -0,0 +1,15 @@
const checkStringStartsWith = (token) => (key) => typeof key === "string" && key.startsWith(token);
const isCSSVariableName =
/*@__PURE__*/ checkStringStartsWith("--");
const startsAsVariableToken =
/*@__PURE__*/ checkStringStartsWith("var(--");
const isCSSVariableToken = (value) => {
const startsWithToken = startsAsVariableToken(value);
if (!startsWithToken)
return false;
// Ensure any comments are stripped from the value as this can harm performance of the regex.
return singleCssVariableRegex.test(value.split("/*")[0].trim());
};
const singleCssVariableRegex = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;
export { isCSSVariableName, isCSSVariableToken };

View File

@@ -0,0 +1,143 @@
'use strict';
function createMultipartBuffers(boundary, sizes) {
const bufs = [];
for (let i = 0; i < sizes.length; ++i) {
const mb = sizes[i] * 1024 * 1024;
bufs.push(Buffer.from([
`--${boundary}`,
`content-disposition: form-data; name="field${i + 1}"`,
'',
'0'.repeat(mb),
'',
].join('\r\n')));
}
bufs.push(Buffer.from([
`--${boundary}--`,
'',
].join('\r\n')));
return bufs;
}
const boundary = '-----------------------------168072824752491622650073';
const buffers = createMultipartBuffers(boundary, (new Array(100)).fill(1));
const calls = {
partBegin: 0,
headerField: 0,
headerValue: 0,
headerEnd: 0,
headersEnd: 0,
partData: 0,
partEnd: 0,
end: 0,
};
const moduleName = process.argv[2];
switch (moduleName) {
case 'busboy': {
const busboy = require('busboy');
const parser = busboy({
limits: {
fieldSizeLimit: Infinity,
},
headers: {
'content-type': `multipart/form-data; boundary=${boundary}`,
},
});
parser.on('field', (name, val, info) => {
++calls.partBegin;
++calls.partData;
++calls.partEnd;
}).on('close', () => {
++calls.end;
console.timeEnd(moduleName);
});
console.time(moduleName);
for (const buf of buffers)
parser.write(buf);
break;
}
case 'formidable': {
const { MultipartParser } = require('formidable');
const parser = new MultipartParser();
parser.initWithBoundary(boundary);
parser.on('data', ({ name }) => {
++calls[name];
if (name === 'end')
console.timeEnd(moduleName);
});
console.time(moduleName);
for (const buf of buffers)
parser.write(buf);
break;
}
case 'multiparty': {
const { Readable } = require('stream');
const { Form } = require('multiparty');
const form = new Form({
maxFieldsSize: Infinity,
maxFields: Infinity,
maxFilesSize: Infinity,
autoFields: false,
autoFiles: false,
});
const req = new Readable({ read: () => {} });
req.headers = {
'content-type': `multipart/form-data; boundary=${boundary}`,
};
function hijack(name, fn) {
const oldFn = form[name];
form[name] = function() {
fn();
return oldFn.apply(this, arguments);
};
}
hijack('onParseHeaderField', () => {
++calls.headerField;
});
hijack('onParseHeaderValue', () => {
++calls.headerValue;
});
hijack('onParsePartBegin', () => {
++calls.partBegin;
});
hijack('onParsePartData', () => {
++calls.partData;
});
hijack('onParsePartEnd', () => {
++calls.partEnd;
});
form.on('close', () => {
++calls.end;
console.timeEnd(moduleName);
}).on('part', (p) => p.resume());
console.time(moduleName);
form.parse(req);
for (const buf of buffers)
req.push(buf);
req.push(null);
break;
}
default:
if (moduleName === undefined)
console.error('Missing parser module name');
else
console.error(`Invalid parser module name: ${moduleName}`);
process.exit(1);
}

View File

@@ -0,0 +1,29 @@
import { formatDistance } from "./mk/_lib/formatDistance.js";
import { formatLong } from "./mk/_lib/formatLong.js";
import { formatRelative } from "./mk/_lib/formatRelative.js";
import { localize } from "./mk/_lib/localize.js";
import { match } from "./mk/_lib/match.js";
/**
* @category Locales
* @summary Macedonian locale.
* @language Macedonian
* @iso-639-2 mkd
* @author Petar Vlahu [@vlahupetar](https://github.com/vlahupetar)
* @author Altrim Beqiri [@altrim](https://github.com/altrim)
*/
export const mk = {
code: "mk",
formatDistance: formatDistance,
formatLong: formatLong,
formatRelative: formatRelative,
localize: localize,
match: match,
options: {
weekStartsOn: 1 /* Monday */,
firstWeekContainsDate: 4,
},
};
// Fallback for modularized imports:
export default mk;

View File

@@ -0,0 +1,28 @@
import { formatDistance } from "./te/_lib/formatDistance.js";
import { formatLong } from "./te/_lib/formatLong.js";
import { formatRelative } from "./te/_lib/formatRelative.js";
import { localize } from "./te/_lib/localize.js";
import { match } from "./te/_lib/match.js";
/**
* @category Locales
* @summary Telugu locale
* @language Telugu
* @iso-639-2 tel
* @author Kranthi Lakum [@kranthilakum](https://github.com/kranthilakum)
*/
export const te = {
code: "te",
formatDistance: formatDistance,
formatLong: formatLong,
formatRelative: formatRelative,
localize: localize,
match: match,
options: {
weekStartsOn: 0 /* Sunday */,
firstWeekContainsDate: 1,
},
};
// Fallback for modularized imports:
export default te;

View File

@@ -0,0 +1,35 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const WebpackError = require("./WebpackError");
/** @typedef {import("./Module")} Module */
class CodeGenerationError extends WebpackError {
/**
* Create a new CodeGenerationError
* @param {Module} module related module
* @param {Error} error Original error
*/
constructor(module, error) {
super();
/** @type {string} */
this.name = "CodeGenerationError";
/** @type {Module} */
this.module = module;
/** @type {Error} */
this.error = error;
/** @type {string} */
this.message = error.message;
/** @type {string} */
this.details = error.stack;
}
}
/** @type {typeof CodeGenerationError} */
module.exports = CodeGenerationError;

View File

@@ -0,0 +1 @@
export default !!(typeof window !== 'undefined' && window.document && window.document.createElement);

View File

@@ -0,0 +1,101 @@
const formatDistanceLocale = {
lessThanXSeconds: {
one: "1초 미만",
other: "{{count}}초 미만",
},
xSeconds: {
one: "1초",
other: "{{count}}초",
},
halfAMinute: "30초",
lessThanXMinutes: {
one: "1분 미만",
other: "{{count}}분 미만",
},
xMinutes: {
one: "1분",
other: "{{count}}분",
},
aboutXHours: {
one: "약 1시간",
other: "약 {{count}}시간",
},
xHours: {
one: "1시간",
other: "{{count}}시간",
},
xDays: {
one: "1일",
other: "{{count}}일",
},
aboutXWeeks: {
one: "약 1주",
other: "약 {{count}}주",
},
xWeeks: {
one: "1주",
other: "{{count}}주",
},
aboutXMonths: {
one: "약 1개월",
other: "약 {{count}}개월",
},
xMonths: {
one: "1개월",
other: "{{count}}개월",
},
aboutXYears: {
one: "약 1년",
other: "약 {{count}}년",
},
xYears: {
one: "1년",
other: "{{count}}년",
},
overXYears: {
one: "1년 이상",
other: "{{count}}년 이상",
},
almostXYears: {
one: "거의 1년",
other: "거의 {{count}}년",
},
};
export const formatDistance = (token, count, options) => {
let result;
const tokenValue = formatDistanceLocale[token];
if (typeof tokenValue === "string") {
result = tokenValue;
} else if (count === 1) {
result = tokenValue.one;
} else {
result = tokenValue.other.replace("{{count}}", count.toString());
}
if (options?.addSuffix) {
if (options.comparison && options.comparison > 0) {
return result + " 후";
} else {
return result + " 전";
}
}
return result;
};

View File

@@ -0,0 +1,9 @@
import { AnyArray } from "../any-array";
import { Builtin } from "../built-in";
import { IsTuple } from "../is-tuple";
import { IsUnknown } from "../is-unknown";
export type DeepReadonly<Type> = Type extends Exclude<Builtin, Error> ? Type : Type extends Map<infer Keys, infer Values> ? ReadonlyMap<DeepReadonly<Keys>, DeepReadonly<Values>> : Type extends ReadonlyMap<infer Keys, infer Values> ? ReadonlyMap<DeepReadonly<Keys>, DeepReadonly<Values>> : Type extends WeakMap<infer Keys, infer Values> ? WeakMap<DeepReadonly<Keys>, DeepReadonly<Values>> : Type extends Set<infer Values> ? ReadonlySet<DeepReadonly<Values>> : Type extends ReadonlySet<infer Values> ? ReadonlySet<DeepReadonly<Values>> : Type extends WeakSet<infer Values> ? WeakSet<DeepReadonly<Values>> : Type extends Promise<infer Value> ? Promise<DeepReadonly<Value>> : Type extends AnyArray<infer Values> ? Type extends IsTuple<Type> ? {
readonly [Key in keyof Type]: DeepReadonly<Type[Key]>;
} : ReadonlyArray<DeepReadonly<Values>> : Type extends {} ? {
readonly [Key in keyof Type]: DeepReadonly<Type[Key]>;
} : IsUnknown<Type> extends true ? unknown : Readonly<Type>;

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/asModal/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;;;;;;;;;;;AACZ,OAAc,EACZ,MAAM,EACN,SAAS,EACT,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAE1F,OAAO,EAAE,eAAe,EAAkB,MAAK,YAAY,CAAC;AAE5D,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAE1C,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,cAA2B,EAC3B,WAAoB,EACP,EAAE;IACf,MAAM,SAAS,GAAgB,CAAC,KAAK,EAAE,EAAE;QACvC,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC9C,MAAM,gBAAgB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAmB,IAAI,CAAC,CAAC;QAEzD,MAAM,EACJ,UAAU,EACV,WAAW,EAAE,sBAAsB,EACnC,YAAY,EACZ,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,SAAS,EACV,GAAG,KAAK,CAAC;QAEV,MAAM,EACJ,SAAS,EACT,WAAW,EAAE,GAAG,GAAG,QAAQ,EAC3B,IAAI,EAAE,YAAY,GAAG,EAAE,EACvB,WAAW,GAAG,IAAI,EAClB,cAAc,GAAG,IAAI;QACrB,mBAAmB;QACnB,mBAAmB;QACnB,qBAAqB;QACrB,WAAW,EAAE,oBAAoB,EACjC,OAAO,EACP,UAAU,EACV,SAAS,EACT,MAAM,EACN,SAAS,EACT,QAAQ,EACR,UAAU,EACV,SAAS,GAAG,IAAI,EAChB,gBAAgB,GAAG,EAAE,KAEnB,KAAK,EADJ,IAAI,UACL,KAAK,EApBH,4MAoBL,CAAQ,CAAC;QAEV,MAAM,gBAAgB,GAAG,oBAAoB,IAAI,sBAAsB,CAAC;QACxE,MAAM,IAAI,GAAG,WAAW,IAAI,YAAY,CAAC;QAEzC,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;QAE3D,SAAS,CAAC,GAAG,EAAE;YACb,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC;gBAEtC,IAAI,gBAAgB,CAAC,OAAO,KAAK,KAAK,IAAI,YAAY,EAAE,CAAC;oBACvD,MAAM,OAAO,GAAG,eAAe,CAAC,YAAY,kCACvC,gBAAgB,KACnB,aAAa,EAAE,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,aAAa,KAAI,YAAY,EAC9D,iBAAiB,EAAE,OAAO,gBAAgB,CAAC,iBAAiB,KAAK,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,IACxH,CAAC;oBACH,OAAO,CAAC,OAAO,CAAC,CAAC;oBACjB,gBAAgB,CAAC,OAAO,GAAG,IAAI,CAAC;gBAClC,CAAC;YACH,CAAC;QACH,CAAC,EAAE;YACD,SAAS;YACT,OAAO;YACP,gBAAgB;SACjB,CAAC,CAAA;QAEF,SAAS,CAAC,GAAG,EAAE;YACb,UAAU,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,SAAS,CAAC,GAAG,EAAE;YACb,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,MAAM;oBAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;;oBACvB,IAAI,CAAC,UAAU,EAAE,CAAC;YACzB,CAAC;YACD,OAAO,GAAG,EAAE;gBACV,IAAI,IAAI;oBAAE,IAAI,CAAC,UAAU,EAAE,CAAC;YAC9B,CAAC,CAAA;QACH,CAAC,EAAE;YACD,MAAM;YACN,IAAI;SACL,CAAC,CAAA;QAEF,SAAS,CAAC,GAAG,EAAE;YACb,IAAI,MAAM;gBAAE,cAAc,CAAC,WAAW,CAAC,CAAC;QAC1C,CAAC,EAAE;YACD,MAAM;YACN,WAAW;YACX,cAAc;SACf,CAAC,CAAC;QAEH,SAAS,CAAC,GAAG,EAAE;YACb,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC;YAEtC,IAAI,YAAY,EAAE,CAAC;gBACjB,IAAI,MAAM,IAAI,cAAc,EAAE,CAAC;oBAC7B,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;gBACxC,CAAC;qBAAM,CAAC;oBACN,iBAAiB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;gBACzC,CAAC;YACH,CAAC;YAED,OAAO,GAAG,EAAE;gBACV,IAAI,YAAY,EAAE,CAAC;oBACjB,iBAAiB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;gBACzC,CAAC;YACH,CAAC,CAAA;QACH,CAAC,EAAE;YACD,MAAM;YACN,cAAc;YACd,iBAAiB;SAClB,CAAC,CAAC;QAEH,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QAEnD,SAAS,CAAC,GAAG,EAAE;YACb,IAAI,CAAC,MAAM;gBAAE,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;;gBACzD,YAAY,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC,EAAE;YACD,MAAM;YACN,SAAS;SACV,CAAC,CAAC;QAEH,SAAS,CAAC,GAAG,EAAE;YACb,IAAI,UAAU,EAAE,CAAC;gBACf,SAAS,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;QACH,CAAC,EAAE;YACD,IAAI;YACJ,UAAU;YACV,SAAS;SACV,CAAC,CAAC;QAEH,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;YACzB,MAAM,SAAS,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,gBAAgB,KAAK,aAAa,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC;YAE7F,MAAM,aAAa,GAAG;gBACpB,SAAS;gBACT,GAAG,SAAS,UAAU,IAAI,EAAE;gBAC5B,SAAS;aACV,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAE5B,MAAM,gBAAgB,mBACpB,IAAI,EAAE,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAC7C,IAAI,EAAE,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,CAAC,CAAC,SAAS,EACxD,YAAY,EAAE,IAAI,EAClB,YAAY,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,IACtD,IAAI,CACR,CAAC;YAEF,OAAO,QAAQ,CAAC,YAAY,CAC1B,KAAC,aAAa,IAEV,OAAO,EAAE,QAAQ;gBACjB,OAAO,EAAE,SAAS;gBAClB,EAAE,EAAE,MAAM;gBACV,UAAU,EAAE,yBAAyB,CAAC,SAAS,CAAC;gBAChD,MAAM,EAAE,IAAI;gBACZ,OAAO;gBACP,UAAU;gBACV,SAAS;gBACT,MAAM;gBACN,SAAS;gBACT,QAAQ,YAGV,KAAC,GAAG,kBAEA,GAAG,EAAE,QAAQ;oBACb,EAAE,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,KAAI,IAAI;oBACpB,SAAS,EAAE,aAAa,IACrB,gBAAgB,cAGrB,KAAC,cAAc,oBAER,KAAK,IACR,MAAM;wBACN,KAAK,IAEP,IACE,GACQ,EAChB,YAAY,CAAC,OAAO,CACrB,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../src/utilities/buildFieldSchemaMap/traverseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAKjF,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,eAAe,CAAA;IACvB,MAAM,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,EAAE,CAAA;IAC9B,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,cAAc,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,cAAc,4EAOxB,IAAI,SAoIN,CAAA"}

View File

@@ -0,0 +1,116 @@
import { setISODay } from "../../../setISODay.mjs";
import { Parser } from "../Parser.mjs";
import { mapValue, parseNDigits } from "../utils.mjs";
// ISO day of week
export class ISODayParser extends Parser {
priority = 90;
parse(dateString, token, match) {
const valueCallback = (value) => {
if (value === 0) {
return 7;
}
return value;
};
switch (token) {
// 2
case "i":
case "ii": // 02
return parseNDigits(token.length, dateString);
// 2nd
case "io":
return match.ordinalNumber(dateString, { unit: "day" });
// Tue
case "iii":
return mapValue(
match.day(dateString, {
width: "abbreviated",
context: "formatting",
}) ||
match.day(dateString, {
width: "short",
context: "formatting",
}) ||
match.day(dateString, {
width: "narrow",
context: "formatting",
}),
valueCallback,
);
// T
case "iiiii":
return mapValue(
match.day(dateString, {
width: "narrow",
context: "formatting",
}),
valueCallback,
);
// Tu
case "iiiiii":
return mapValue(
match.day(dateString, {
width: "short",
context: "formatting",
}) ||
match.day(dateString, {
width: "narrow",
context: "formatting",
}),
valueCallback,
);
// Tuesday
case "iiii":
default:
return mapValue(
match.day(dateString, {
width: "wide",
context: "formatting",
}) ||
match.day(dateString, {
width: "abbreviated",
context: "formatting",
}) ||
match.day(dateString, {
width: "short",
context: "formatting",
}) ||
match.day(dateString, {
width: "narrow",
context: "formatting",
}),
valueCallback,
);
}
}
validate(_date, value) {
return value >= 1 && value <= 7;
}
set(date, _flags, value) {
date = setISODay(date, value);
date.setHours(0, 0, 0, 0);
return date;
}
incompatibleTokens = [
"y",
"Y",
"u",
"q",
"Q",
"M",
"L",
"w",
"d",
"D",
"E",
"e",
"c",
"t",
"T",
];
}

View File

@@ -0,0 +1,21 @@
/**
* @license lucide-react v0.441.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var defaultAttributes = {
xmlns: "http://www.w3.org/2000/svg",
width: 24,
height: 24,
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: 2,
strokeLinecap: "round",
strokeLinejoin: "round"
};
export { defaultAttributes as default };
//# sourceMappingURL=defaultAttributes.js.map

View File

@@ -0,0 +1,22 @@
/**
* @name monthsToYears
* @category Conversion Helpers
* @summary Convert number of months to years.
*
* @description
* Convert a number of months to a full number of years.
*
* @param months - The number of months to be converted
*
* @returns The number of months converted in years
*
* @example
* // Convert 36 months to years:
* const result = monthsToYears(36)
* //=> 3
*
* // It uses floor rounding:
* const result = monthsToYears(40)
* //=> 3
*/
export declare function monthsToYears(months: number): number;

View File

@@ -0,0 +1,677 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
// eslint-disable-next-line n/prefer-global/process
const { nextTick } = require("process");
/** @typedef {import("./Resolver").FileSystem} FileSystem */
/** @typedef {import("./Resolver").PathLike} PathLike */
/** @typedef {import("./Resolver").PathOrFileDescriptor} PathOrFileDescriptor */
/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */
/** @typedef {FileSystem & SyncFileSystem} BaseFileSystem */
/**
* @template T
* @typedef {import("./Resolver").FileSystemCallback<T>} FileSystemCallback<T>
*/
/**
* @param {string} path path
* @returns {string} dirname
*/
const dirname = (path) => {
let idx = path.length - 1;
while (idx >= 0) {
const char = path.charCodeAt(idx);
// slash or backslash
if (char === 47 || char === 92) break;
idx--;
}
if (idx < 0) return "";
return path.slice(0, idx);
};
/**
* @template T
* @param {FileSystemCallback<T>[]} callbacks callbacks
* @param {Error | null} err error
* @param {T} result result
*/
const runCallbacks = (callbacks, err, result) => {
if (callbacks.length === 1) {
callbacks[0](err, result);
callbacks.length = 0;
return;
}
let error;
for (const callback of callbacks) {
try {
callback(err, result);
} catch (err) {
if (!error) error = err;
}
}
callbacks.length = 0;
if (error) throw error;
};
// eslint-disable-next-line jsdoc/reject-function-type
/** @typedef {Function} EXPECTED_FUNCTION */
// eslint-disable-next-line jsdoc/reject-any-type
/** @typedef {any} EXPECTED_ANY */
class OperationMergerBackend {
/**
* @param {EXPECTED_FUNCTION | undefined} provider async method in filesystem
* @param {EXPECTED_FUNCTION | undefined} syncProvider sync method in filesystem
* @param {BaseFileSystem} providerContext call context for the provider methods
*/
constructor(provider, syncProvider, providerContext) {
this._provider = provider;
this._syncProvider = syncProvider;
this._providerContext = providerContext;
this._activeAsyncOperations = new Map();
this.provide = this._provider
? // Comment to align jsdoc
/**
* @param {PathLike | PathOrFileDescriptor} path path
* @param {object | FileSystemCallback<EXPECTED_ANY> | undefined} options options
* @param {FileSystemCallback<EXPECTED_ANY>=} callback callback
* @returns {EXPECTED_ANY} result
*/
(path, options, callback) => {
if (typeof options === "function") {
callback =
/** @type {FileSystemCallback<EXPECTED_ANY>} */
(options);
options = undefined;
}
if (
typeof path !== "string" &&
!Buffer.isBuffer(path) &&
!(path instanceof URL) &&
typeof path !== "number"
) {
/** @type {EXPECTED_FUNCTION} */
(callback)(
new TypeError("path must be a string, Buffer, URL or number"),
);
return;
}
if (options) {
return /** @type {EXPECTED_FUNCTION} */ (this._provider).call(
this._providerContext,
path,
options,
callback,
);
}
let callbacks = this._activeAsyncOperations.get(path);
if (callbacks) {
callbacks.push(callback);
return;
}
this._activeAsyncOperations.set(path, (callbacks = [callback]));
/** @type {EXPECTED_FUNCTION} */
(provider)(
path,
/**
* @param {Error} err error
* @param {EXPECTED_ANY} result result
*/
(err, result) => {
this._activeAsyncOperations.delete(path);
runCallbacks(callbacks, err, result);
},
);
}
: null;
this.provideSync = this._syncProvider
? // Comment to align jsdoc
/**
* @param {PathLike | PathOrFileDescriptor} path path
* @param {object=} options options
* @returns {EXPECTED_ANY} result
*/
(path, options) =>
/** @type {EXPECTED_FUNCTION} */ (this._syncProvider).call(
this._providerContext,
path,
options,
)
: null;
}
purge() {}
purgeParent() {}
}
/*
IDLE:
insert data: goto SYNC
SYNC:
before provide: run ticks
event loop tick: goto ASYNC_ACTIVE
ASYNC:
timeout: run tick, goto ASYNC_PASSIVE
ASYNC_PASSIVE:
before provide: run ticks
IDLE --[insert data]--> SYNC --[event loop tick]--> ASYNC_ACTIVE --[interval tick]-> ASYNC_PASSIVE
^ |
+---------[insert data]-------+
*/
const STORAGE_MODE_IDLE = 0;
const STORAGE_MODE_SYNC = 1;
const STORAGE_MODE_ASYNC = 2;
/**
* @callback Provide
* @param {PathLike | PathOrFileDescriptor} path path
* @param {EXPECTED_ANY} options options
* @param {FileSystemCallback<EXPECTED_ANY>} callback callback
* @returns {void}
*/
class CacheBackend {
/**
* @param {number} duration max cache duration of items
* @param {EXPECTED_FUNCTION | undefined} provider async method
* @param {EXPECTED_FUNCTION | undefined} syncProvider sync method
* @param {BaseFileSystem} providerContext call context for the provider methods
*/
constructor(duration, provider, syncProvider, providerContext) {
this._duration = duration;
this._provider = provider;
this._syncProvider = syncProvider;
this._providerContext = providerContext;
/** @type {Map<string, FileSystemCallback<EXPECTED_ANY>[]>} */
this._activeAsyncOperations = new Map();
/** @type {Map<string, { err: Error | null, result?: EXPECTED_ANY, level: Set<string> }>} */
this._data = new Map();
/** @type {Set<string>[]} */
this._levels = [];
for (let i = 0; i < 10; i++) this._levels.push(new Set());
for (let i = 5000; i < duration; i += 500) this._levels.push(new Set());
this._currentLevel = 0;
this._tickInterval = Math.floor(duration / this._levels.length);
/** @type {STORAGE_MODE_IDLE | STORAGE_MODE_SYNC | STORAGE_MODE_ASYNC} */
this._mode = STORAGE_MODE_IDLE;
/** @type {NodeJS.Timeout | undefined} */
this._timeout = undefined;
/** @type {number | undefined} */
this._nextDecay = undefined;
// eslint-disable-next-line no-warning-comments
// @ts-ignore
this.provide = provider ? this.provide.bind(this) : null;
// eslint-disable-next-line no-warning-comments
// @ts-ignore
this.provideSync = syncProvider ? this.provideSync.bind(this) : null;
}
/**
* @param {PathLike | PathOrFileDescriptor} path path
* @param {EXPECTED_ANY} options options
* @param {FileSystemCallback<EXPECTED_ANY>} callback callback
* @returns {void}
*/
provide(path, options, callback) {
if (typeof options === "function") {
callback = options;
options = undefined;
}
if (
typeof path !== "string" &&
!Buffer.isBuffer(path) &&
!(path instanceof URL) &&
typeof path !== "number"
) {
callback(new TypeError("path must be a string, Buffer, URL or number"));
return;
}
const strPath = typeof path !== "string" ? path.toString() : path;
if (options) {
return /** @type {EXPECTED_FUNCTION} */ (this._provider).call(
this._providerContext,
path,
options,
callback,
);
}
// When in sync mode we can move to async mode
if (this._mode === STORAGE_MODE_SYNC) {
this._enterAsyncMode();
}
// Check in cache
const cacheEntry = this._data.get(strPath);
if (cacheEntry !== undefined) {
if (cacheEntry.err) return nextTick(callback, cacheEntry.err);
return nextTick(callback, null, cacheEntry.result);
}
// Check if there is already the same operation running
let callbacks = this._activeAsyncOperations.get(strPath);
if (callbacks !== undefined) {
callbacks.push(callback);
return;
}
this._activeAsyncOperations.set(strPath, (callbacks = [callback]));
// Run the operation
/** @type {EXPECTED_FUNCTION} */
(this._provider).call(
this._providerContext,
path,
/**
* @param {Error | null} err error
* @param {EXPECTED_ANY=} result result
*/
(err, result) => {
this._activeAsyncOperations.delete(strPath);
this._storeResult(strPath, err, result);
// Enter async mode if not yet done
this._enterAsyncMode();
runCallbacks(
/** @type {FileSystemCallback<EXPECTED_ANY>[]} */ (callbacks),
err,
result,
);
},
);
}
/**
* @param {PathLike | PathOrFileDescriptor} path path
* @param {EXPECTED_ANY} options options
* @returns {EXPECTED_ANY} result
*/
provideSync(path, options) {
if (
typeof path !== "string" &&
!Buffer.isBuffer(path) &&
!(path instanceof URL) &&
typeof path !== "number"
) {
throw new TypeError("path must be a string");
}
const strPath = typeof path !== "string" ? path.toString() : path;
if (options) {
return /** @type {EXPECTED_FUNCTION} */ (this._syncProvider).call(
this._providerContext,
path,
options,
);
}
// In sync mode we may have to decay some cache items
if (this._mode === STORAGE_MODE_SYNC) {
this._runDecays();
}
// Check in cache
const cacheEntry = this._data.get(strPath);
if (cacheEntry !== undefined) {
if (cacheEntry.err) throw cacheEntry.err;
return cacheEntry.result;
}
// Get all active async operations
// This sync operation will also complete them
const callbacks = this._activeAsyncOperations.get(strPath);
this._activeAsyncOperations.delete(strPath);
// Run the operation
// When in idle mode, we will enter sync mode
let result;
try {
result = /** @type {EXPECTED_FUNCTION} */ (this._syncProvider).call(
this._providerContext,
path,
);
} catch (err) {
this._storeResult(strPath, /** @type {Error} */ (err), undefined);
this._enterSyncModeWhenIdle();
if (callbacks) {
runCallbacks(callbacks, /** @type {Error} */ (err), undefined);
}
throw err;
}
this._storeResult(strPath, null, result);
this._enterSyncModeWhenIdle();
if (callbacks) {
runCallbacks(callbacks, null, result);
}
return result;
}
/**
* @param {(string | Buffer | URL | number | (string | URL | Buffer | number)[] | Set<string | URL | Buffer | number>)=} what what to purge
*/
purge(what) {
if (!what) {
if (this._mode !== STORAGE_MODE_IDLE) {
this._data.clear();
for (const level of this._levels) {
level.clear();
}
this._enterIdleMode();
}
} else if (
typeof what === "string" ||
Buffer.isBuffer(what) ||
what instanceof URL ||
typeof what === "number"
) {
const strWhat = typeof what !== "string" ? what.toString() : what;
for (const [key, data] of this._data) {
if (key.startsWith(strWhat)) {
this._data.delete(key);
data.level.delete(key);
}
}
if (this._data.size === 0) {
this._enterIdleMode();
}
} else {
for (const [key, data] of this._data) {
for (const item of what) {
const strItem = typeof item !== "string" ? item.toString() : item;
if (key.startsWith(strItem)) {
this._data.delete(key);
data.level.delete(key);
break;
}
}
}
if (this._data.size === 0) {
this._enterIdleMode();
}
}
}
/**
* @param {(string | Buffer | URL | number | (string | URL | Buffer | number)[] | Set<string | URL | Buffer | number>)=} what what to purge
*/
purgeParent(what) {
if (!what) {
this.purge();
} else if (
typeof what === "string" ||
Buffer.isBuffer(what) ||
what instanceof URL ||
typeof what === "number"
) {
const strWhat = typeof what !== "string" ? what.toString() : what;
this.purge(dirname(strWhat));
} else {
const set = new Set();
for (const item of what) {
const strItem = typeof item !== "string" ? item.toString() : item;
set.add(dirname(strItem));
}
this.purge(set);
}
}
/**
* @param {string} path path
* @param {Error | null} err error
* @param {EXPECTED_ANY} result result
*/
_storeResult(path, err, result) {
if (this._data.has(path)) return;
const level = this._levels[this._currentLevel];
this._data.set(path, { err, result, level });
level.add(path);
}
_decayLevel() {
const nextLevel = (this._currentLevel + 1) % this._levels.length;
const decay = this._levels[nextLevel];
this._currentLevel = nextLevel;
for (const item of decay) {
this._data.delete(item);
}
decay.clear();
if (this._data.size === 0) {
this._enterIdleMode();
} else {
/** @type {number} */
(this._nextDecay) += this._tickInterval;
}
}
_runDecays() {
while (
/** @type {number} */ (this._nextDecay) <= Date.now() &&
this._mode !== STORAGE_MODE_IDLE
) {
this._decayLevel();
}
}
_enterAsyncMode() {
let timeout = 0;
switch (this._mode) {
case STORAGE_MODE_ASYNC:
return;
case STORAGE_MODE_IDLE:
this._nextDecay = Date.now() + this._tickInterval;
timeout = this._tickInterval;
break;
case STORAGE_MODE_SYNC:
this._runDecays();
// _runDecays may change the mode
if (
/** @type {STORAGE_MODE_IDLE | STORAGE_MODE_SYNC | STORAGE_MODE_ASYNC} */
(this._mode) === STORAGE_MODE_IDLE
) {
return;
}
timeout = Math.max(
0,
/** @type {number} */ (this._nextDecay) - Date.now(),
);
break;
}
this._mode = STORAGE_MODE_ASYNC;
const ref = setTimeout(() => {
this._mode = STORAGE_MODE_SYNC;
this._runDecays();
}, timeout);
if (ref.unref) ref.unref();
this._timeout = ref;
}
_enterSyncModeWhenIdle() {
if (this._mode === STORAGE_MODE_IDLE) {
this._mode = STORAGE_MODE_SYNC;
this._nextDecay = Date.now() + this._tickInterval;
}
}
_enterIdleMode() {
this._mode = STORAGE_MODE_IDLE;
this._nextDecay = undefined;
if (this._timeout) clearTimeout(this._timeout);
}
}
/**
* @template {EXPECTED_FUNCTION} Provider
* @template {EXPECTED_FUNCTION} AsyncProvider
* @template FileSystem
* @param {number} duration duration in ms files are cached
* @param {Provider | undefined} provider provider
* @param {AsyncProvider | undefined} syncProvider sync provider
* @param {BaseFileSystem} providerContext provider context
* @returns {OperationMergerBackend | CacheBackend} backend
*/
const createBackend = (duration, provider, syncProvider, providerContext) => {
if (duration > 0) {
return new CacheBackend(duration, provider, syncProvider, providerContext);
}
return new OperationMergerBackend(provider, syncProvider, providerContext);
};
module.exports = class CachedInputFileSystem {
/**
* @param {BaseFileSystem} fileSystem file system
* @param {number} duration duration in ms files are cached
*/
constructor(fileSystem, duration) {
this.fileSystem = fileSystem;
this._lstatBackend = createBackend(
duration,
this.fileSystem.lstat,
this.fileSystem.lstatSync,
this.fileSystem,
);
const lstat = this._lstatBackend.provide;
this.lstat = /** @type {FileSystem["lstat"]} */ (lstat);
const lstatSync = this._lstatBackend.provideSync;
this.lstatSync = /** @type {SyncFileSystem["lstatSync"]} */ (lstatSync);
this._statBackend = createBackend(
duration,
this.fileSystem.stat,
this.fileSystem.statSync,
this.fileSystem,
);
const stat = this._statBackend.provide;
this.stat = /** @type {FileSystem["stat"]} */ (stat);
const statSync = this._statBackend.provideSync;
this.statSync = /** @type {SyncFileSystem["statSync"]} */ (statSync);
this._readdirBackend = createBackend(
duration,
this.fileSystem.readdir,
this.fileSystem.readdirSync,
this.fileSystem,
);
const readdir = this._readdirBackend.provide;
this.readdir = /** @type {FileSystem["readdir"]} */ (readdir);
const readdirSync = this._readdirBackend.provideSync;
this.readdirSync = /** @type {SyncFileSystem["readdirSync"]} */ (
readdirSync
);
this._readFileBackend = createBackend(
duration,
this.fileSystem.readFile,
this.fileSystem.readFileSync,
this.fileSystem,
);
const readFile = this._readFileBackend.provide;
this.readFile = /** @type {FileSystem["readFile"]} */ (readFile);
const readFileSync = this._readFileBackend.provideSync;
this.readFileSync = /** @type {SyncFileSystem["readFileSync"]} */ (
readFileSync
);
this._readJsonBackend = createBackend(
duration,
// prettier-ignore
this.fileSystem.readJson ||
(this.readFile &&
(
/**
* @param {string} path path
* @param {FileSystemCallback<EXPECTED_ANY>} callback callback
*/
(path, callback) => {
this.readFile(path, (err, buffer) => {
if (err) return callback(err);
if (!buffer || buffer.length === 0)
{return callback(new Error("No file content"));}
let data;
try {
data = JSON.parse(buffer.toString("utf8"));
} catch (err_) {
return callback(/** @type {Error} */ (err_));
}
callback(null, data);
});
})
),
// prettier-ignore
this.fileSystem.readJsonSync ||
(this.readFileSync &&
(
/**
* @param {string} path path
* @returns {EXPECTED_ANY} result
*/
(path) => {
const buffer = this.readFileSync(path);
const data = JSON.parse(buffer.toString("utf8"));
return data;
}
)),
this.fileSystem,
);
const readJson = this._readJsonBackend.provide;
this.readJson = /** @type {FileSystem["readJson"]} */ (readJson);
const readJsonSync = this._readJsonBackend.provideSync;
this.readJsonSync = /** @type {SyncFileSystem["readJsonSync"]} */ (
readJsonSync
);
this._readlinkBackend = createBackend(
duration,
this.fileSystem.readlink,
this.fileSystem.readlinkSync,
this.fileSystem,
);
const readlink = this._readlinkBackend.provide;
this.readlink = /** @type {FileSystem["readlink"]} */ (readlink);
const readlinkSync = this._readlinkBackend.provideSync;
this.readlinkSync = /** @type {SyncFileSystem["readlinkSync"]} */ (
readlinkSync
);
this._realpathBackend = createBackend(
duration,
this.fileSystem.realpath,
this.fileSystem.realpathSync,
this.fileSystem,
);
const realpath = this._realpathBackend.provide;
this.realpath = /** @type {FileSystem["realpath"]} */ (realpath);
const realpathSync = this._realpathBackend.provideSync;
this.realpathSync = /** @type {SyncFileSystem["realpathSync"]} */ (
realpathSync
);
}
/**
* @param {(string | Buffer | URL | number | (string | URL | Buffer | number)[] | Set<string | URL | Buffer | number>)=} what what to purge
*/
purge(what) {
this._statBackend.purge(what);
this._lstatBackend.purge(what);
this._readdirBackend.purgeParent(what);
this._readFileBackend.purge(what);
this._readlinkBackend.purge(what);
this._readJsonBackend.purge(what);
this._realpathBackend.purge(what);
}
};

View File

@@ -0,0 +1,9 @@
import React from 'react';
import './index.scss';
type Props = {
readonly children: React.ReactNode;
readonly className?: string;
};
export declare function DrawerContentContainer({ children, className }: Props): React.JSX.Element;
export {};
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
Prism.languages.metafont={comment:{pattern:/%.*/,greedy:!0},string:{pattern:/"[^\r\n"]*"/,greedy:!0},number:/\d*\.?\d+/,boolean:/\b(?:false|true)\b/,punctuation:[/[,;()]/,{pattern:/(^|[^{}])(?:\{|\})(?![{}])/,lookbehind:!0},{pattern:/(^|[^[])\[(?!\[)/,lookbehind:!0},{pattern:/(^|[^\]])\](?!\])/,lookbehind:!0}],constant:[{pattern:/(^|[^!?])\?\?\?(?![!?])/,lookbehind:!0},{pattern:/(^|[^/*\\])(?:\\|\\\\)(?![/*\\])/,lookbehind:!0},/\b(?:_|blankpicture|bp|cc|cm|dd|ditto|down|eps|epsilon|fullcircle|halfcircle|identity|in|infinity|left|mm|nullpen|nullpicture|origin|pc|penrazor|penspeck|pensquare|penstroke|proof|pt|quartercircle|relax|right|smoke|unitpixel|unitsquare|up)\b/],quantity:{pattern:/\b(?:autorounding|blacker|boundarychar|charcode|chardp|chardx|chardy|charext|charht|charic|charwd|currentwindow|day|designsize|displaying|fillin|fontmaking|granularity|hppp|join_radius|month|o_correction|pausing|pen_(?:bot|lft|rt|top)|pixels_per_inch|proofing|showstopping|smoothing|time|tolerance|tracingcapsules|tracingchoices|tracingcommands|tracingedges|tracingequations|tracingmacros|tracingonline|tracingoutput|tracingpens|tracingrestores|tracingspecs|tracingstats|tracingtitles|turningcheck|vppp|warningcheck|xoffset|year|yoffset)\b/,alias:"keyword"},command:{pattern:/\b(?:addto|batchmode|charlist|cull|display|errhelp|errmessage|errorstopmode|everyjob|extensible|fontdimen|headerbyte|inner|interim|let|ligtable|message|newinternal|nonstopmode|numspecial|openwindow|outer|randomseed|save|scrollmode|shipout|show|showdependencies|showstats|showtoken|showvariable|special)\b/,alias:"builtin"},operator:[{pattern:/(^|[^>=<:|])(?:<|<=|=|=:|\|=:|\|=:>|=:\|>|=:\||\|=:\||\|=:\|>|\|=:\|>>|>|>=|:|:=|<>|::|\|\|:)(?![>=<:|])/,lookbehind:!0},{pattern:/(^|[^+-])(?:\+|\+\+|-{1,3}|\+-\+)(?![+-])/,lookbehind:!0},{pattern:/(^|[^/*\\])(?:\*|\*\*|\/)(?![/*\\])/,lookbehind:!0},{pattern:/(^|[^.])(?:\.{2,3})(?!\.)/,lookbehind:!0},{pattern:/(^|[^@#&$])&(?![@#&$])/,lookbehind:!0},/\b(?:and|not|or)\b/],macro:{pattern:/\b(?:abs|beginchar|bot|byte|capsule_def|ceiling|change_width|clear_pen_memory|clearit|clearpen|clearxy|counterclockwise|cullit|cutdraw|cutoff|decr|define_blacker_pixels|define_corrected_pixels|define_good_x_pixels|define_good_y_pixels|define_horizontal_corrected_pixels|define_pixels|define_whole_blacker_pixels|define_whole_pixels|define_whole_vertical_blacker_pixels|define_whole_vertical_pixels|dir|direction|directionpoint|div|dotprod|downto|draw|drawdot|endchar|erase|fill|filldraw|fix_units|flex|font_coding_scheme|font_extra_space|font_identifier|font_normal_shrink|font_normal_space|font_normal_stretch|font_quad|font_size|font_slant|font_x_height|gfcorners|gobble|gobbled|good\.(?:bot|lft|rt|top|x|y)|grayfont|hide|hround|imagerules|incr|interact|interpath|intersectionpoint|inverse|italcorr|killtext|labelfont|labels|lft|loggingall|lowres_fix|makegrid|makelabel(?:\.(?:bot|lft|rt|top)(?:\.nodot)?)?|max|min|mod|mode_def|mode_setup|nodisplays|notransforms|numtok|openit|penlabels|penpos|pickup|proofoffset|proofrule|proofrulethickness|range|reflectedabout|rotatedabout|rotatedaround|round|rt|savepen|screenchars|screenrule|screenstrokes|shipit|showit|slantfont|softjoin|solve|stop|superellipse|tensepath|thru|titlefont|top|tracingall|tracingnone|undraw|undrawdot|unfill|unfilldraw|upto|vround)\b/,alias:"function"},builtin:/\b(?:ASCII|angle|char|cosd|decimal|directiontime|floor|hex|intersectiontimes|jobname|known|length|makepath|makepen|mexp|mlog|normaldeviate|oct|odd|pencircle|penoffset|point|postcontrol|precontrol|reverse|rotated|sind|sqrt|str|subpath|substring|totalweight|turningnumber|uniformdeviate|unknown|xpart|xxpart|xypart|ypart|yxpart|yypart)\b/,keyword:/\b(?:also|at|atleast|begingroup|charexists|contour|controls|curl|cycle|def|delimiters|doublepath|dropping|dump|else|elseif|end|enddef|endfor|endgroup|endinput|exitif|exitunless|expandafter|fi|for|forever|forsuffixes|from|if|input|inwindow|keeping|kern|of|primarydef|quote|readstring|scaled|scantokens|secondarydef|shifted|skipto|slanted|step|tension|tertiarydef|to|transformed|until|vardef|withpen|withweight|xscaled|yscaled|zscaled)\b/,type:{pattern:/\b(?:boolean|expr|numeric|pair|path|pen|picture|primary|secondary|string|suffix|tertiary|text|transform)\b/,alias:"property"},variable:{pattern:/(^|[^@#&$])(?:@#|#@|#|@)(?![@#&$])|\b(?:aspect_ratio|currentpen|currentpicture|currenttransform|d|extra_beginchar|extra_endchar|extra_setup|h|localfont|mag|mode|screen_cols|screen_rows|w|whatever|x|y|z)\b/,lookbehind:!0}};

View File

@@ -0,0 +1,6 @@
import type { Decimal } from "decimal.js";
import { type NumberFormatInternal, type NumberFormatPart } from "../types/number.js";
/**
* https://tc39.es/ecma402/#sec-partitionnumberpattern
*/
export declare function PartitionNumberPattern(internalSlots: NumberFormatInternal, _x: Decimal): NumberFormatPart[];

View File

@@ -0,0 +1,117 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import { BaseSelection, LexicalEditor, LexicalNode } from 'lexical';
export interface LexicalClipboardData {
'text/html'?: string | undefined;
'application/x-lexical-editor'?: string | undefined;
'text/plain': string;
}
/**
* Returns the *currently selected* Lexical content as an HTML string, relying on the
* logic defined in the exportDOM methods on the LexicalNode classes. Note that
* this will not return the HTML content of the entire editor (unless all the content is included
* in the current selection).
*
* @param editor - LexicalEditor instance to get HTML content from
* @param selection - The selection to use (default is $getSelection())
* @returns a string of HTML content
*/
export declare function $getHtmlContent(editor: LexicalEditor, selection?: BaseSelection | null): string;
/**
* Returns the *currently selected* Lexical content as a JSON string, relying on the
* logic defined in the exportJSON methods on the LexicalNode classes. Note that
* this will not return the JSON content of the entire editor (unless all the content is included
* in the current selection).
*
* @param editor - LexicalEditor instance to get the JSON content from
* @param selection - The selection to use (default is $getSelection())
* @returns
*/
export declare function $getLexicalContent(editor: LexicalEditor, selection?: BaseSelection | null): null | string;
/**
* Attempts to insert content of the mime-types text/plain or text/uri-list from
* the provided DataTransfer object into the editor at the provided selection.
* text/uri-list is only used if text/plain is not also provided.
*
* @param dataTransfer an object conforming to the [DataTransfer interface] (https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface)
* @param selection the selection to use as the insertion point for the content in the DataTransfer object
*/
export declare function $insertDataTransferForPlainText(dataTransfer: DataTransfer, selection: BaseSelection): void;
/**
* Attempts to insert content of the mime-types application/x-lexical-editor, text/html,
* text/plain, or text/uri-list (in descending order of priority) from the provided DataTransfer
* object into the editor at the provided selection.
*
* @param dataTransfer an object conforming to the [DataTransfer interface] (https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface)
* @param selection the selection to use as the insertion point for the content in the DataTransfer object
* @param editor the LexicalEditor the content is being inserted into.
*/
export declare function $insertDataTransferForRichText(dataTransfer: DataTransfer, selection: BaseSelection, editor: LexicalEditor): void;
/**
* Inserts Lexical nodes into the editor using different strategies depending on
* some simple selection-based heuristics. If you're looking for a generic way to
* to insert nodes into the editor at a specific selection point, you probably want
* {@link lexical.$insertNodes}
*
* @param editor LexicalEditor instance to insert the nodes into.
* @param nodes The nodes to insert.
* @param selection The selection to insert the nodes into.
*/
export declare function $insertGeneratedNodes(editor: LexicalEditor, nodes: Array<LexicalNode>, selection: BaseSelection): void;
export interface BaseSerializedNode {
children?: Array<BaseSerializedNode>;
type: string;
version: number;
}
/**
* Gets the Lexical JSON of the nodes inside the provided Selection.
*
* @param editor LexicalEditor to get the JSON content from.
* @param selection Selection to get the JSON content from.
* @returns an object with the editor namespace and a list of serializable nodes as JavaScript objects.
*/
export declare function $generateJSONFromSelectedNodes<SerializedNode extends BaseSerializedNode>(editor: LexicalEditor, selection: BaseSelection | null): {
namespace: string;
nodes: Array<SerializedNode>;
};
/**
* This method takes an array of objects conforming to the BaseSerializedNode interface and returns
* an Array containing instances of the corresponding LexicalNode classes registered on the editor.
* Normally, you'd get an Array of BaseSerialized nodes from {@link $generateJSONFromSelectedNodes}
*
* @param serializedNodes an Array of objects conforming to the BaseSerializedNode interface.
* @returns an Array of Lexical Node objects.
*/
export declare function $generateNodesFromSerializedNodes(serializedNodes: Array<BaseSerializedNode>): Array<LexicalNode>;
/**
* Copies the content of the current selection to the clipboard in
* text/plain, text/html, and application/x-lexical-editor (Lexical JSON)
* formats.
*
* @param editor the LexicalEditor instance to copy content from
* @param event the native browser ClipboardEvent to add the content to.
* @returns
*/
export declare function copyToClipboard(editor: LexicalEditor, event: null | ClipboardEvent, data?: LexicalClipboardData): Promise<boolean>;
/**
* Serialize the content of the current selection to strings in
* text/plain, text/html, and application/x-lexical-editor (Lexical JSON)
* formats (as available).
*
* @param selection the selection to serialize (defaults to $getSelection())
* @returns LexicalClipboardData
*/
export declare function $getClipboardDataFromSelection(selection?: BaseSelection | null): LexicalClipboardData;
/**
* Call setData on the given clipboardData for each MIME type present
* in the given data (from {@link $getClipboardDataFromSelection})
*
* @param clipboardData the event.clipboardData to populate from data
* @param data The lexical data
*/
export declare function setLexicalClipboardDataTransfer(clipboardData: DataTransfer, data: LexicalClipboardData): void;

View File

@@ -0,0 +1 @@
{"version":3,"file":"book-copy.js","sources":["../../../src/icons/book-copy.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name BookCopy\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMiAxNlY0YTIgMiAwIDAgMSAyLTJoMTEiIC8+CiAgPHBhdGggZD0iTTIyIDE4SDExYTIgMiAwIDEgMCAwIDRoMTAuNWEuNS41IDAgMCAwIC41LS41di0xNWEuNS41IDAgMCAwLS41LS41SDExYTIgMiAwIDAgMC0yIDJ2MTIiIC8+CiAgPHBhdGggZD0iTTUgMTRINGEyIDIgMCAxIDAgMCA0aDEiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/book-copy\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst BookCopy = createLucideIcon('BookCopy', [\n ['path', { d: 'M2 16V4a2 2 0 0 1 2-2h11', key: 'spzkk5' }],\n [\n 'path',\n {\n d: 'M22 18H11a2 2 0 1 0 0 4h10.5a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5H11a2 2 0 0 0-2 2v12',\n key: '1wz07i',\n },\n ],\n ['path', { d: 'M5 14H4a2 2 0 1 0 0 4h1', key: '16gqf9' }],\n]);\n\nexport default BookCopy;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAAA,CAC5C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CACzD,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1D,CAAC,CAAA,CAAA;;"}

View File

@@ -0,0 +1,21 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.MySQLInstrumentation = void 0;
var instrumentation_1 = require("./instrumentation");
Object.defineProperty(exports, "MySQLInstrumentation", { enumerable: true, get: function () { return instrumentation_1.MySQLInstrumentation; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,13 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
*/
/**
* LexicalSelectionAlwaysOnDisplay
*/
declare export function SelectionAlwaysOnDisplay(): null;

View File

@@ -0,0 +1,721 @@
/**
* The `node:sqlite` module facilitates working with SQLite databases.
* To access it:
*
* ```js
* import sqlite from 'node:sqlite';
* ```
*
* This module is only available under the `node:` scheme. The following will not
* work:
*
* ```js
* import sqlite from 'sqlite';
* ```
*
* The following example shows the basic usage of the `node:sqlite` module to open
* an in-memory database, write data to the database, and then read the data back.
*
* ```js
* import { DatabaseSync } from 'node:sqlite';
* const database = new DatabaseSync(':memory:');
*
* // Execute SQL statements from strings.
* database.exec(`
* CREATE TABLE data(
* key INTEGER PRIMARY KEY,
* value TEXT
* ) STRICT
* `);
* // Create a prepared statement to insert data into the database.
* const insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)');
* // Execute the prepared statement with bound values.
* insert.run(1, 'hello');
* insert.run(2, 'world');
* // Create a prepared statement to read data from the database.
* const query = database.prepare('SELECT * FROM data ORDER BY key');
* // Execute the prepared statement and log the result set.
* console.log(query.all());
* // Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ]
* ```
* @since v22.5.0
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/sqlite.js)
*/
declare module "node:sqlite" {
import { PathLike } from "node:fs";
type SQLInputValue = null | number | bigint | string | NodeJS.ArrayBufferView;
type SQLOutputValue = null | number | bigint | string | NodeJS.NonSharedUint8Array;
interface DatabaseSyncOptions {
/**
* If `true`, the database is opened by the constructor. When
* this value is `false`, the database must be opened via the `open()` method.
* @since v22.5.0
* @default true
*/
open?: boolean | undefined;
/**
* If `true`, foreign key constraints
* are enabled. This is recommended but can be disabled for compatibility with
* legacy database schemas. The enforcement of foreign key constraints can be
* enabled and disabled after opening the database using
* [`PRAGMA foreign_keys`](https://www.sqlite.org/pragma.html#pragma_foreign_keys).
* @since v22.10.0
* @default true
*/
enableForeignKeyConstraints?: boolean | undefined;
/**
* If `true`, SQLite will accept
* [double-quoted string literals](https://www.sqlite.org/quirks.html#dblquote).
* This is not recommended but can be
* enabled for compatibility with legacy database schemas.
* @since v22.10.0
* @default false
*/
enableDoubleQuotedStringLiterals?: boolean | undefined;
/**
* If `true`, the database is opened in read-only mode.
* If the database does not exist, opening it will fail.
* @since v22.12.0
* @default false
*/
readOnly?: boolean | undefined;
/**
* If `true`, the `loadExtension` SQL function
* and the `loadExtension()` method are enabled.
* You can call `enableLoadExtension(false)` later to disable this feature.
* @since v22.13.0
* @default false
*/
allowExtension?: boolean | undefined;
/**
* The [busy timeout](https://sqlite.org/c3ref/busy_timeout.html) in milliseconds. This is the maximum amount of
* time that SQLite will wait for a database lock to be released before
* returning an error.
* @since v22.16.0
* @default 0
*/
timeout?: number | undefined;
/**
* If `true`, integer fields are read as JavaScript `BigInt` values. If `false`,
* integer fields are read as JavaScript numbers.
* @since v22.18.0
* @default false
*/
readBigInts?: boolean | undefined;
/**
* If `true`, query results are returned as arrays instead of objects.
* @since v22.18.0
* @default false
*/
returnArrays?: boolean | undefined;
/**
* If `true`, allows binding named parameters without the prefix
* character (e.g., `foo` instead of `:foo`).
* @since v22.18.0
* @default true
*/
allowBareNamedParameters?: boolean | undefined;
/**
* If `true`, unknown named parameters are ignored when binding.
* If `false`, an exception is thrown for unknown named parameters.
* @since v22.18.0
* @default false
*/
allowUnknownNamedParameters?: boolean | undefined;
}
interface CreateSessionOptions {
/**
* A specific table to track changes for. By default, changes to all tables are tracked.
* @since v22.12.0
*/
table?: string | undefined;
/**
* Name of the database to track. This is useful when multiple databases have been added using
* [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html).
* @since v22.12.0
* @default 'main'
*/
db?: string | undefined;
}
interface ApplyChangesetOptions {
/**
* Skip changes that, when targeted table name is supplied to this function, return a truthy value.
* By default, all changes are attempted.
* @since v22.12.0
*/
filter?: ((tableName: string) => boolean) | undefined;
/**
* A function that determines how to handle conflicts. The function receives one argument,
* which can be one of the following values:
*
* * `SQLITE_CHANGESET_DATA`: A `DELETE` or `UPDATE` change does not contain the expected "before" values.
* * `SQLITE_CHANGESET_NOTFOUND`: A row matching the primary key of the `DELETE` or `UPDATE` change does not exist.
* * `SQLITE_CHANGESET_CONFLICT`: An `INSERT` change results in a duplicate primary key.
* * `SQLITE_CHANGESET_FOREIGN_KEY`: Applying a change would result in a foreign key violation.
* * `SQLITE_CHANGESET_CONSTRAINT`: Applying a change results in a `UNIQUE`, `CHECK`, or `NOT NULL` constraint
* violation.
*
* The function should return one of the following values:
*
* * `SQLITE_CHANGESET_OMIT`: Omit conflicting changes.
* * `SQLITE_CHANGESET_REPLACE`: Replace existing values with conflicting changes (only valid with
`SQLITE_CHANGESET_DATA` or `SQLITE_CHANGESET_CONFLICT` conflicts).
* * `SQLITE_CHANGESET_ABORT`: Abort on conflict and roll back the database.
*
* When an error is thrown in the conflict handler or when any other value is returned from the handler,
* applying the changeset is aborted and the database is rolled back.
*
* **Default**: A function that returns `SQLITE_CHANGESET_ABORT`.
* @since v22.12.0
*/
onConflict?: ((conflictType: number) => number) | undefined;
}
interface FunctionOptions {
/**
* If `true`, the [`SQLITE_DETERMINISTIC`](https://www.sqlite.org/c3ref/c_deterministic.html) flag is
* set on the created function.
* @default false
*/
deterministic?: boolean | undefined;
/**
* If `true`, the [`SQLITE_DIRECTONLY`](https://www.sqlite.org/c3ref/c_directonly.html) flag is set on
* the created function.
* @default false
*/
directOnly?: boolean | undefined;
/**
* If `true`, integer arguments to `function`
* are converted to `BigInt`s. If `false`, integer arguments are passed as
* JavaScript numbers.
* @default false
*/
useBigIntArguments?: boolean | undefined;
/**
* If `true`, `function` may be invoked with any number of
* arguments (between zero and
* [`SQLITE_MAX_FUNCTION_ARG`](https://www.sqlite.org/limits.html#max_function_arg)). If `false`,
* `function` must be invoked with exactly `function.length` arguments.
* @default false
*/
varargs?: boolean | undefined;
}
interface AggregateOptions<T extends SQLInputValue = SQLInputValue> extends FunctionOptions {
/**
* The identity value for the aggregation function. This value is used when the aggregation
* function is initialized. When a `Function` is passed the identity will be its return value.
*/
start: T | (() => T);
/**
* The function to call for each row in the aggregation. The
* function receives the current state and the row value. The return value of
* this function should be the new state.
*/
step: (accumulator: T, ...args: SQLOutputValue[]) => T;
/**
* The function to call to get the result of the
* aggregation. The function receives the final state and should return the
* result of the aggregation.
*/
result?: ((accumulator: T) => SQLInputValue) | undefined;
/**
* When this function is provided, the `aggregate` method will work as a window function.
* The function receives the current state and the dropped row value. The return value of this function should be the
* new state.
*/
inverse?: ((accumulator: T, ...args: SQLOutputValue[]) => T) | undefined;
}
/**
* This class represents a single [connection](https://www.sqlite.org/c3ref/sqlite3.html) to a SQLite database. All APIs
* exposed by this class execute synchronously.
* @since v22.5.0
*/
class DatabaseSync implements Disposable {
/**
* Constructs a new `DatabaseSync` instance.
* @param path The path of the database.
* A SQLite database can be stored in a file or completely [in memory](https://www.sqlite.org/inmemorydb.html).
* To use a file-backed database, the path should be a file path.
* To use an in-memory database, the path should be the special name `':memory:'`.
* @param options Configuration options for the database connection.
*/
constructor(path: PathLike, options?: DatabaseSyncOptions);
/**
* Registers a new aggregate function with the SQLite database. This method is a wrapper around
* [`sqlite3_create_window_function()`](https://www.sqlite.org/c3ref/create_function.html).
*
* When used as a window function, the `result` function will be called multiple times.
*
* ```js
* import { DatabaseSync } from 'node:sqlite';
*
* const db = new DatabaseSync(':memory:');
* db.exec(`
* CREATE TABLE t3(x, y);
* INSERT INTO t3 VALUES ('a', 4),
* ('b', 5),
* ('c', 3),
* ('d', 8),
* ('e', 1);
* `);
*
* db.aggregate('sumint', {
* start: 0,
* step: (acc, value) => acc + value,
* });
*
* db.prepare('SELECT sumint(y) as total FROM t3').get(); // { total: 21 }
* ```
* @since v22.16.0
* @param name The name of the SQLite function to create.
* @param options Function configuration settings.
*/
aggregate(name: string, options: AggregateOptions): void;
aggregate<T extends SQLInputValue>(name: string, options: AggregateOptions<T>): void;
/**
* Closes the database connection. An exception is thrown if the database is not
* open. This method is a wrapper around [`sqlite3_close_v2()`](https://www.sqlite.org/c3ref/close.html).
* @since v22.5.0
*/
close(): void;
/**
* Loads a shared library into the database connection. This method is a wrapper
* around [`sqlite3_load_extension()`](https://www.sqlite.org/c3ref/load_extension.html). It is required to enable the
* `allowExtension` option when constructing the `DatabaseSync` instance.
* @since v22.13.0
* @param path The path to the shared library to load.
*/
loadExtension(path: string): void;
/**
* Enables or disables the `loadExtension` SQL function, and the `loadExtension()`
* method. When `allowExtension` is `false` when constructing, you cannot enable
* loading extensions for security reasons.
* @since v22.13.0
* @param allow Whether to allow loading extensions.
*/
enableLoadExtension(allow: boolean): void;
/**
* This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html)
* @since v22.16.0
* @param dbName Name of the database. This can be `'main'` (the default primary database) or any other
* database that has been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html) **Default:** `'main'`.
* @returns The location of the database file. When using an in-memory database,
* this method returns null.
*/
location(dbName?: string): string | null;
/**
* This method allows one or more SQL statements to be executed without returning
* any results. This method is useful when executing SQL statements read from a
* file. This method is a wrapper around [`sqlite3_exec()`](https://www.sqlite.org/c3ref/exec.html).
* @since v22.5.0
* @param sql A SQL string to execute.
*/
exec(sql: string): void;
/**
* This method is used to create SQLite user-defined functions. This method is a
* wrapper around [`sqlite3_create_function_v2()`](https://www.sqlite.org/c3ref/create_function.html).
* @since v22.13.0
* @param name The name of the SQLite function to create.
* @param options Optional configuration settings for the function.
* @param func The JavaScript function to call when the SQLite
* function is invoked. The return value of this function should be a valid
* SQLite data type: see
* [Type conversion between JavaScript and SQLite](https://nodejs.org/docs/latest-v22.x/api/sqlite.html#type-conversion-between-javascript-and-sqlite).
* The result defaults to `NULL` if the return value is `undefined`.
*/
function(
name: string,
options: FunctionOptions,
func: (...args: SQLOutputValue[]) => SQLInputValue,
): void;
function(name: string, func: (...args: SQLOutputValue[]) => SQLInputValue): void;
/**
* Whether the database is currently open or not.
* @since v22.15.0
*/
readonly isOpen: boolean;
/**
* Whether the database is currently within a transaction. This method
* is a wrapper around [`sqlite3_get_autocommit()`](https://sqlite.org/c3ref/get_autocommit.html).
* @since v22.16.0
*/
readonly isTransaction: boolean;
/**
* Opens the database specified in the `path` argument of the `DatabaseSync`constructor. This method should only be used when the database is not opened via
* the constructor. An exception is thrown if the database is already open.
* @since v22.5.0
*/
open(): void;
/**
* Compiles a SQL statement into a [prepared statement](https://www.sqlite.org/c3ref/stmt.html). This method is a wrapper
* around [`sqlite3_prepare_v2()`](https://www.sqlite.org/c3ref/prepare.html).
* @since v22.5.0
* @param sql A SQL string to compile to a prepared statement.
* @return The prepared statement.
*/
prepare(sql: string): StatementSync;
/**
* Creates and attaches a session to the database. This method is a wrapper around
* [`sqlite3session_create()`](https://www.sqlite.org/session/sqlite3session_create.html) and
* [`sqlite3session_attach()`](https://www.sqlite.org/session/sqlite3session_attach.html).
* @param options The configuration options for the session.
* @returns A session handle.
* @since v22.12.0
*/
createSession(options?: CreateSessionOptions): Session;
/**
* An exception is thrown if the database is not
* open. This method is a wrapper around
* [`sqlite3changeset_apply()`](https://www.sqlite.org/session/sqlite3changeset_apply.html).
*
* ```js
* const sourceDb = new DatabaseSync(':memory:');
* const targetDb = new DatabaseSync(':memory:');
*
* sourceDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');
* targetDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');
*
* const session = sourceDb.createSession();
*
* const insert = sourceDb.prepare('INSERT INTO data (key, value) VALUES (?, ?)');
* insert.run(1, 'hello');
* insert.run(2, 'world');
*
* const changeset = session.changeset();
* targetDb.applyChangeset(changeset);
* // Now that the changeset has been applied, targetDb contains the same data as sourceDb.
* ```
* @param changeset A binary changeset or patchset.
* @param options The configuration options for how the changes will be applied.
* @returns Whether the changeset was applied successfully without being aborted.
* @since v22.12.0
*/
applyChangeset(changeset: Uint8Array, options?: ApplyChangesetOptions): boolean;
/**
* Closes the database connection. If the database connection is already closed
* then this is a no-op.
* @since v22.15.0
* @experimental
*/
[Symbol.dispose](): void;
}
/**
* @since v22.12.0
*/
interface Session {
/**
* Retrieves a changeset containing all changes since the changeset was created. Can be called multiple times.
* An exception is thrown if the database or the session is not open. This method is a wrapper around
* [`sqlite3session_changeset()`](https://www.sqlite.org/session/sqlite3session_changeset.html).
* @returns Binary changeset that can be applied to other databases.
* @since v22.12.0
*/
changeset(): NodeJS.NonSharedUint8Array;
/**
* Similar to the method above, but generates a more compact patchset. See
* [Changesets and Patchsets](https://www.sqlite.org/sessionintro.html#changesets_and_patchsets)
* in the documentation of SQLite. An exception is thrown if the database or the session is not open. This method is a
* wrapper around
* [`sqlite3session_patchset()`](https://www.sqlite.org/session/sqlite3session_patchset.html).
* @returns Binary patchset that can be applied to other databases.
* @since v22.12.0
*/
patchset(): NodeJS.NonSharedUint8Array;
/**
* Closes the session. An exception is thrown if the database or the session is not open. This method is a
* wrapper around
* [`sqlite3session_delete()`](https://www.sqlite.org/session/sqlite3session_delete.html).
*/
close(): void;
}
interface StatementColumnMetadata {
/**
* The unaliased name of the column in the origin
* table, or `null` if the column is the result of an expression or subquery.
* This property is the result of [`sqlite3_column_origin_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
*/
column: string | null;
/**
* The unaliased name of the origin database, or
* `null` if the column is the result of an expression or subquery. This
* property is the result of [`sqlite3_column_database_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
*/
database: string | null;
/**
* The name assigned to the column in the result set of a
* `SELECT` statement. This property is the result of
* [`sqlite3_column_name()`](https://www.sqlite.org/c3ref/column_name.html).
*/
name: string;
/**
* The unaliased name of the origin table, or `null` if
* the column is the result of an expression or subquery. This property is the
* result of [`sqlite3_column_table_name()`](https://www.sqlite.org/c3ref/column_database_name.html).
*/
table: string | null;
/**
* The declared data type of the column, or `null` if the
* column is the result of an expression or subquery. This property is the
* result of [`sqlite3_column_decltype()`](https://www.sqlite.org/c3ref/column_decltype.html).
*/
type: string | null;
}
interface StatementResultingChanges {
/**
* The number of rows modified, inserted, or deleted by the most recently completed `INSERT`, `UPDATE`, or `DELETE` statement.
* This field is either a number or a `BigInt` depending on the prepared statement's configuration.
* This property is the result of [`sqlite3_changes64()`](https://www.sqlite.org/c3ref/changes.html).
*/
changes: number | bigint;
/**
* The most recently inserted rowid.
* This field is either a number or a `BigInt` depending on the prepared statement's configuration.
* This property is the result of [`sqlite3_last_insert_rowid()`](https://www.sqlite.org/c3ref/last_insert_rowid.html).
*/
lastInsertRowid: number | bigint;
}
/**
* This class represents a single [prepared statement](https://www.sqlite.org/c3ref/stmt.html). This class cannot be
* instantiated via its constructor. Instead, instances are created via the`database.prepare()` method. All APIs exposed by this class execute
* synchronously.
*
* A prepared statement is an efficient binary representation of the SQL used to
* create it. Prepared statements are parameterizable, and can be invoked multiple
* times with different bound values. Parameters also offer protection against [SQL injection](https://en.wikipedia.org/wiki/SQL_injection) attacks. For these reasons, prepared statements are
* preferred
* over hand-crafted SQL strings when handling user input.
* @since v22.5.0
*/
class StatementSync {
private constructor();
/**
* This method executes a prepared statement and returns all results as an array of
* objects. If the prepared statement does not return any results, this method
* returns an empty array. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using
* the values in `namedParameters` and `anonymousParameters`.
* @since v22.5.0
* @param namedParameters An optional object used to bind named parameters. The keys of this object are used to configure the mapping.
* @param anonymousParameters Zero or more values to bind to anonymous parameters.
* @return An array of objects. Each object corresponds to a row returned by executing the prepared statement. The keys and values of each object correspond to the column names and values of
* the row.
*/
all(...anonymousParameters: SQLInputValue[]): Record<string, SQLOutputValue>[];
all(
namedParameters: Record<string, SQLInputValue>,
...anonymousParameters: SQLInputValue[]
): Record<string, SQLOutputValue>[];
/**
* This method is used to retrieve information about the columns returned by the
* prepared statement.
* @since v22.16.0
* @returns An array of objects. Each object corresponds to a column
* in the prepared statement, and contains the following properties:
*/
columns(): StatementColumnMetadata[];
/**
* The source SQL text of the prepared statement with parameter
* placeholders replaced by the values that were used during the most recent
* execution of this prepared statement. This property is a wrapper around
* [`sqlite3_expanded_sql()`](https://www.sqlite.org/c3ref/expanded_sql.html).
* @since v22.5.0
*/
readonly expandedSQL: string;
/**
* This method executes a prepared statement and returns the first result as an
* object. If the prepared statement does not return any results, this method
* returns `undefined`. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the
* values in `namedParameters` and `anonymousParameters`.
* @since v22.5.0
* @param namedParameters An optional object used to bind named parameters. The keys of this object are used to configure the mapping.
* @param anonymousParameters Zero or more values to bind to anonymous parameters.
* @return An object corresponding to the first row returned by executing the prepared statement. The keys and values of the object correspond to the column names and values of the row. If no
* rows were returned from the database then this method returns `undefined`.
*/
get(...anonymousParameters: SQLInputValue[]): Record<string, SQLOutputValue> | undefined;
get(
namedParameters: Record<string, SQLInputValue>,
...anonymousParameters: SQLInputValue[]
): Record<string, SQLOutputValue> | undefined;
/**
* This method executes a prepared statement and returns an iterator of
* objects. If the prepared statement does not return any results, this method
* returns an empty iterator. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using
* the values in `namedParameters` and `anonymousParameters`.
* @since v22.13.0
* @param namedParameters An optional object used to bind named parameters.
* The keys of this object are used to configure the mapping.
* @param anonymousParameters Zero or more values to bind to anonymous parameters.
* @returns An iterable iterator of objects. Each object corresponds to a row
* returned by executing the prepared statement. The keys and values of each
* object correspond to the column names and values of the row.
*/
iterate(...anonymousParameters: SQLInputValue[]): NodeJS.Iterator<Record<string, SQLOutputValue>>;
iterate(
namedParameters: Record<string, SQLInputValue>,
...anonymousParameters: SQLInputValue[]
): NodeJS.Iterator<Record<string, SQLOutputValue>>;
/**
* This method executes a prepared statement and returns an object summarizing the
* resulting changes. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the
* values in `namedParameters` and `anonymousParameters`.
* @since v22.5.0
* @param namedParameters An optional object used to bind named parameters. The keys of this object are used to configure the mapping.
* @param anonymousParameters Zero or more values to bind to anonymous parameters.
*/
run(...anonymousParameters: SQLInputValue[]): StatementResultingChanges;
run(
namedParameters: Record<string, SQLInputValue>,
...anonymousParameters: SQLInputValue[]
): StatementResultingChanges;
/**
* The names of SQLite parameters begin with a prefix character. By default,`node:sqlite` requires that this prefix character is present when binding
* parameters. However, with the exception of dollar sign character, these
* prefix characters also require extra quoting when used in object keys.
*
* To improve ergonomics, this method can be used to also allow bare named
* parameters, which do not require the prefix character in JavaScript code. There
* are several caveats to be aware of when enabling bare named parameters:
*
* * The prefix character is still required in SQL.
* * The prefix character is still allowed in JavaScript. In fact, prefixed names
* will have slightly better binding performance.
* * Using ambiguous named parameters, such as `$k` and `@k`, in the same prepared
* statement will result in an exception as it cannot be determined how to bind
* a bare name.
* @since v22.5.0
* @param enabled Enables or disables support for binding named parameters without the prefix character.
*/
setAllowBareNamedParameters(enabled: boolean): void;
/**
* By default, if an unknown name is encountered while binding parameters, an
* exception is thrown. This method allows unknown named parameters to be ignored.
* @since v22.15.0
* @param enabled Enables or disables support for unknown named parameters.
*/
setAllowUnknownNamedParameters(enabled: boolean): void;
/**
* When enabled, query results returned by the `all()`, `get()`, and `iterate()` methods will be returned as arrays instead
* of objects.
* @since v22.16.0
* @param enabled Enables or disables the return of query results as arrays.
*/
setReturnArrays(enabled: boolean): void;
/**
* When reading from the database, SQLite `INTEGER`s are mapped to JavaScript
* numbers by default. However, SQLite `INTEGER`s can store values larger than
* JavaScript numbers are capable of representing. In such cases, this method can
* be used to read `INTEGER` data using JavaScript `BigInt`s. This method has no
* impact on database write operations where numbers and `BigInt`s are both
* supported at all times.
* @since v22.5.0
* @param enabled Enables or disables the use of `BigInt`s when reading `INTEGER` fields from the database.
*/
setReadBigInts(enabled: boolean): void;
/**
* The source SQL text of the prepared statement. This property is a
* wrapper around [`sqlite3_sql()`](https://www.sqlite.org/c3ref/expanded_sql.html).
* @since v22.5.0
*/
readonly sourceSQL: string;
}
interface BackupOptions {
/**
* Name of the source database. This can be `'main'` (the default primary database) or any other
* database that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)
* @default 'main'
*/
source?: string | undefined;
/**
* Name of the target database. This can be `'main'` (the default primary database) or any other
* database that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)
* @default 'main'
*/
target?: string | undefined;
/**
* Number of pages to be transmitted in each batch of the backup.
* @default 100
*/
rate?: number | undefined;
/**
* Callback function that will be called with the number of pages copied and the total number of
* pages.
*/
progress?: ((progressInfo: BackupProgressInfo) => void) | undefined;
}
interface BackupProgressInfo {
totalPages: number;
remainingPages: number;
}
/**
* This method makes a database backup. This method abstracts the
* [`sqlite3_backup_init()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupinit),
* [`sqlite3_backup_step()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep)
* and [`sqlite3_backup_finish()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupfinish) functions.
*
* The backed-up database can be used normally during the backup process. Mutations coming from the same connection - same
* `DatabaseSync` - object will be reflected in the backup right away. However, mutations from other connections will cause
* the backup process to restart.
*
* ```js
* import { backup, DatabaseSync } from 'node:sqlite';
*
* const sourceDb = new DatabaseSync('source.db');
* const totalPagesTransferred = await backup(sourceDb, 'backup.db', {
* rate: 1, // Copy one page at a time.
* progress: ({ totalPages, remainingPages }) => {
* console.log('Backup in progress', { totalPages, remainingPages });
* },
* });
*
* console.log('Backup completed', totalPagesTransferred);
* ```
* @since v22.16.0
* @param sourceDb The database to backup. The source database must be open.
* @param path The path where the backup will be created. If the file already exists,
* the contents will be overwritten.
* @param options Optional configuration for the backup. The
* following properties are supported:
* @returns A promise that resolves when the backup is completed and rejects if an error occurs.
*/
function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise<void>;
/**
* @since v22.13.0
*/
namespace constants {
/**
* The conflict handler is invoked with this constant when processing a DELETE or UPDATE change if a row with the required PRIMARY KEY fields is present in the database, but one or more other (non primary-key) fields modified by the update do not contain the expected "before" values.
* @since v22.14.0
*/
const SQLITE_CHANGESET_DATA: number;
/**
* The conflict handler is invoked with this constant when processing a DELETE or UPDATE change if a row with the required PRIMARY KEY fields is not present in the database.
* @since v22.14.0
*/
const SQLITE_CHANGESET_NOTFOUND: number;
/**
* This constant is passed to the conflict handler while processing an INSERT change if the operation would result in duplicate primary key values.
* @since v22.14.0
*/
const SQLITE_CHANGESET_CONFLICT: number;
/**
* If foreign key handling is enabled, and applying a changeset leaves the database in a state containing foreign key violations, the conflict handler is invoked with this constant exactly once before the changeset is committed. If the conflict handler returns `SQLITE_CHANGESET_OMIT`, the changes, including those that caused the foreign key constraint violation, are committed. Or, if it returns `SQLITE_CHANGESET_ABORT`, the changeset is rolled back.
* @since v22.14.0
*/
const SQLITE_CHANGESET_FOREIGN_KEY: number;
/**
* Conflicting changes are omitted.
* @since v22.12.0
*/
const SQLITE_CHANGESET_OMIT: number;
/**
* Conflicting changes replace existing values. Note that this value can only be returned when the type of conflict is either `SQLITE_CHANGESET_DATA` or `SQLITE_CHANGESET_CONFLICT`.
* @since v22.12.0
*/
const SQLITE_CHANGESET_REPLACE: number;
/**
* Abort when a change encounters a conflict and roll back database.
* @since v22.12.0
*/
const SQLITE_CHANGESET_ABORT: number;
}
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yBAAyB;AACzB,2CAAkC;AAIzB,oFAJA,eAAG,OAIA;AAFZ,6CAAoC;AAA3B,kGAAA,GAAG,OAAA;AACZ,0CAAwB;AAGxB,kBAAe,eAAG,CAAC;AAEnB,+BAA+B;AAC/B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE;IACpE,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;CACxE"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"carrier.js","sources":["../../src/carrier.ts"],"sourcesContent":["import type { AsyncContextStack } from './asyncContext/stackStrategy';\nimport type { AsyncContextStrategy } from './asyncContext/types';\nimport type { Client } from './client';\nimport type { Scope } from './scope';\nimport type { SerializedLog } from './types-hoist/log';\nimport type { SerializedMetric } from './types-hoist/metric';\nimport { SDK_VERSION } from './utils/version';\nimport { GLOBAL_OBJ } from './utils/worldwide';\n\n/**\n * An object that contains globally accessible properties and maintains a scope stack.\n * @hidden\n */\nexport interface Carrier {\n __SENTRY__?: VersionedCarrier;\n}\n\ntype VersionedCarrier = {\n version?: string;\n} & Record<Exclude<string, 'version'>, SentryCarrier>;\n\nexport interface SentryCarrier {\n acs?: AsyncContextStrategy;\n stack?: AsyncContextStack;\n\n globalScope?: Scope;\n defaultIsolationScope?: Scope;\n defaultCurrentScope?: Scope;\n loggerSettings?: { enabled: boolean };\n /**\n * A map of Sentry clients to their log buffers.\n * This is used to store logs that are sent to Sentry.\n */\n clientToLogBufferMap?: WeakMap<Client, Array<SerializedLog>>;\n\n /**\n * A map of Sentry clients to their metric buffers.\n * This is used to store metrics that are sent to Sentry.\n */\n clientToMetricBufferMap?: WeakMap<Client, Array<SerializedMetric>>;\n\n /** Overwrites TextEncoder used in `@sentry/core`, need for `react-native@0.73` and older */\n encodePolyfill?: (input: string) => Uint8Array;\n /** Overwrites TextDecoder used in `@sentry/core`, need for `react-native@0.73` and older */\n decodePolyfill?: (input: Uint8Array) => string;\n}\n\n/**\n * Returns the global shim registry.\n *\n * FIXME: This function is problematic, because despite always returning a valid Carrier,\n * it has an optional `__SENTRY__` property, which then in turn requires us to always perform an unnecessary check\n * at the call-site. We always access the carrier through this function, so we can guarantee that `__SENTRY__` is there.\n **/\nexport function getMainCarrier(): Carrier {\n // This ensures a Sentry carrier exists\n getSentryCarrier(GLOBAL_OBJ);\n return GLOBAL_OBJ;\n}\n\n/** Will either get the existing sentry carrier, or create a new one. */\nexport function getSentryCarrier(carrier: Carrier): SentryCarrier {\n const __SENTRY__ = (carrier.__SENTRY__ = carrier.__SENTRY__ || {});\n\n // For now: First SDK that sets the .version property wins\n __SENTRY__.version = __SENTRY__.version || SDK_VERSION;\n\n // Intentionally populating and returning the version of \"this\" SDK instance\n // rather than what's set in .version so that \"this\" SDK always gets its carrier\n return (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});\n}\n\n/**\n * Returns a global singleton contained in the global `__SENTRY__[]` object.\n *\n * If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory\n * function and added to the `__SENTRY__` object.\n *\n * @param name name of the global singleton on __SENTRY__\n * @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`\n * @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `GLOBAL_OBJ`'s return value\n * @returns the singleton\n */\nexport function getGlobalSingleton<Prop extends keyof SentryCarrier>(\n name: Prop,\n creator: () => NonNullable<SentryCarrier[Prop]>,\n obj = GLOBAL_OBJ,\n): NonNullable<SentryCarrier[Prop]> {\n const __SENTRY__ = (obj.__SENTRY__ = obj.__SENTRY__ || {});\n const carrier = (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});\n // Note: We do not want to set `carrier.version` here, as this may be called before any `init` is called, e.g. for the default scopes\n return carrier[name] || (carrier[name] = creator());\n}\n"],"names":["GLOBAL_OBJ","SDK_VERSION"],"mappings":";;;;;AASA;AACA;AACA;AACA;;AAmCA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,GAAY;AAC1C;AACA,EAAE,gBAAgB,CAACA,oBAAU,CAAC;AAC9B,EAAE,OAAOA,oBAAU;AACnB;;AAEA;AACO,SAAS,gBAAgB,CAAC,OAAO,EAA0B;AAClE,EAAE,MAAM,UAAA,IAAc,OAAO,CAAC,UAAA,GAAa,OAAO,CAAC,UAAA,IAAc,EAAE,CAAC;;AAEpE;AACA,EAAE,UAAU,CAAC,OAAA,GAAU,UAAU,CAAC,OAAA,IAAWC,mBAAW;;AAExD;AACA;AACA,EAAE,QAAQ,UAAU,CAACA,mBAAW,CAAA,GAAI,UAAU,CAACA,mBAAW,CAAA,IAAK,EAAE;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB;AAClC,EAAE,IAAI;AACN,EAAE,OAAO;AACT,EAAE,GAAA,GAAMD,oBAAU;AAClB,EAAoC;AACpC,EAAE,MAAM,UAAA,IAAc,GAAG,CAAC,UAAA,GAAa,GAAG,CAAC,UAAA,IAAc,EAAE,CAAC;AAC5D,EAAE,MAAM,OAAA,IAAW,UAAU,CAACC,mBAAW,CAAA,GAAI,UAAU,CAACA,mBAAW,CAAA,IAAK,EAAE,CAAC;AAC3E;AACA,EAAE,OAAO,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,IAAI,CAAA,GAAI,OAAO,EAAE,CAAC;AACrD;;;;;;"}

View File

@@ -0,0 +1,2 @@
import { extendAllWith } from "../fp";
export = extendAllWith;

View File

@@ -0,0 +1,23 @@
import { Breadcrumb, FetchBreadcrumbData } from '@sentry/core';
import { FetchHint } from '@sentry-internal/browser-utils';
import { ReplayContainer, ReplayNetworkOptions, ReplayNetworkRequestOrResponse } from '../../types';
/**
* Capture a fetch breadcrumb to a replay.
* This adds additional data (where appropriate).
*/
export declare function captureFetchBreadcrumbToReplay(breadcrumb: Breadcrumb & {
data: FetchBreadcrumbData;
}, hint: Partial<FetchHint>, options: ReplayNetworkOptions & {
replay: ReplayContainer;
}): Promise<void>;
/**
* Enrich a breadcrumb with additional data.
* This has to be sync & mutate the given breadcrumb,
* as the breadcrumb is afterwards consumed by other handlers.
*/
export declare function enrichFetchBreadcrumb(breadcrumb: Breadcrumb & {
data: FetchBreadcrumbData;
}, hint: Partial<FetchHint>): void;
/** Exported only for tests. */
export declare function _getResponseInfo(captureDetails: boolean, { networkCaptureBodies, networkResponseHeaders, }: Pick<ReplayNetworkOptions, 'networkCaptureBodies' | 'networkResponseHeaders'>, response: Response | undefined, responseBodySize?: number): Promise<ReplayNetworkRequestOrResponse | undefined>;
//# sourceMappingURL=fetchUtils.d.ts.map

View File

@@ -0,0 +1,528 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
'use strict';
var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
var richText = require('@lexical/rich-text');
var utils = require('@lexical/utils');
var lexical = require('lexical');
var react = require('react');
var reactDom = require('react-dom');
var jsxRuntime = require('react/jsx-runtime');
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
class Point {
constructor(x, y) {
this._x = x;
this._y = y;
}
get x() {
return this._x;
}
get y() {
return this._y;
}
equals({
x,
y
}) {
return this.x === x && this.y === y;
}
calcDeltaXTo({
x
}) {
return this.x - x;
}
calcDeltaYTo({
y
}) {
return this.y - y;
}
calcHorizontalDistanceTo(point) {
return Math.abs(this.calcDeltaXTo(point));
}
calcVerticalDistance(point) {
return Math.abs(this.calcDeltaYTo(point));
}
calcDistanceTo(point) {
return Math.sqrt(Math.pow(this.calcDeltaXTo(point), 2) + Math.pow(this.calcDeltaYTo(point), 2));
}
}
function isPoint(x) {
return x instanceof Point;
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
class Rectangle {
constructor(left, top, right, bottom) {
const [physicTop, physicBottom] = top <= bottom ? [top, bottom] : [bottom, top];
const [physicLeft, physicRight] = left <= right ? [left, right] : [right, left];
this._top = physicTop;
this._right = physicRight;
this._left = physicLeft;
this._bottom = physicBottom;
}
get top() {
return this._top;
}
get right() {
return this._right;
}
get bottom() {
return this._bottom;
}
get left() {
return this._left;
}
get width() {
return Math.abs(this._left - this._right);
}
get height() {
return Math.abs(this._bottom - this._top);
}
equals({
top,
left,
bottom,
right
}) {
return top === this._top && bottom === this._bottom && left === this._left && right === this._right;
}
contains(target) {
if (isPoint(target)) {
const {
x,
y
} = target;
const isOnTopSide = y < this._top;
const isOnBottomSide = y > this._bottom;
const isOnLeftSide = x < this._left;
const isOnRightSide = x > this._right;
const result = !isOnTopSide && !isOnBottomSide && !isOnLeftSide && !isOnRightSide;
return {
reason: {
isOnBottomSide,
isOnLeftSide,
isOnRightSide,
isOnTopSide
},
result
};
} else {
const {
top,
left,
bottom,
right
} = target;
return top >= this._top && top <= this._bottom && bottom >= this._top && bottom <= this._bottom && left >= this._left && left <= this._right && right >= this._left && right <= this._right;
}
}
intersectsWith(rect) {
const {
left: x1,
top: y1,
width: w1,
height: h1
} = rect;
const {
left: x2,
top: y2,
width: w2,
height: h2
} = this;
const maxX = x1 + w1 >= x2 + w2 ? x1 + w1 : x2 + w2;
const maxY = y1 + h1 >= y2 + h2 ? y1 + h1 : y2 + h2;
const minX = x1 <= x2 ? x1 : x2;
const minY = y1 <= y2 ? y1 : y2;
return maxX - minX <= w1 + w2 && maxY - minY <= h1 + h2;
}
generateNewRect({
left = this.left,
top = this.top,
right = this.right,
bottom = this.bottom
}) {
return new Rectangle(left, top, right, bottom);
}
static fromLTRB(left, top, right, bottom) {
return new Rectangle(left, top, right, bottom);
}
static fromLWTH(left, width, top, height) {
return new Rectangle(left, top, left + width, top + height);
}
static fromPoints(startPoint, endPoint) {
const {
y: top,
x: left
} = startPoint;
const {
y: bottom,
x: right
} = endPoint;
return Rectangle.fromLTRB(left, top, right, bottom);
}
static fromDOM(dom) {
const {
top,
width,
left,
height
} = dom.getBoundingClientRect();
return Rectangle.fromLWTH(left, width, top, height);
}
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
const SPACE = 4;
const TARGET_LINE_HALF_HEIGHT = 2;
const DRAG_DATA_FORMAT = 'application/x-lexical-drag-block';
const TEXT_BOX_HORIZONTAL_PADDING = 28;
const Downward = 1;
const Upward = -1;
const Indeterminate = 0;
let prevIndex = Infinity;
function getCurrentIndex(keysLength) {
if (keysLength === 0) {
return Infinity;
}
if (prevIndex >= 0 && prevIndex < keysLength) {
return prevIndex;
}
return Math.floor(keysLength / 2);
}
function getTopLevelNodeKeys(editor) {
return editor.getEditorState().read(() => lexical.$getRoot().getChildrenKeys());
}
function getCollapsedMargins(elem) {
const getMargin = (element, margin) => element ? parseFloat(window.getComputedStyle(element)[margin]) : 0;
const {
marginTop,
marginBottom
} = window.getComputedStyle(elem);
const prevElemSiblingMarginBottom = getMargin(elem.previousElementSibling, 'marginBottom');
const nextElemSiblingMarginTop = getMargin(elem.nextElementSibling, 'marginTop');
const collapsedTopMargin = Math.max(parseFloat(marginTop), prevElemSiblingMarginBottom);
const collapsedBottomMargin = Math.max(parseFloat(marginBottom), nextElemSiblingMarginTop);
return {
marginBottom: collapsedBottomMargin,
marginTop: collapsedTopMargin
};
}
function getBlockElement(anchorElem, editor, event, useEdgeAsDefault = false) {
const anchorElementRect = anchorElem.getBoundingClientRect();
const topLevelNodeKeys = getTopLevelNodeKeys(editor);
let blockElem = null;
editor.getEditorState().read(() => {
if (useEdgeAsDefault) {
const [firstNode, lastNode] = [editor.getElementByKey(topLevelNodeKeys[0]), editor.getElementByKey(topLevelNodeKeys[topLevelNodeKeys.length - 1])];
const [firstNodeRect, lastNodeRect] = [firstNode != null ? firstNode.getBoundingClientRect() : undefined, lastNode != null ? lastNode.getBoundingClientRect() : undefined];
if (firstNodeRect && lastNodeRect) {
const firstNodeZoom = utils.calculateZoomLevel(firstNode);
const lastNodeZoom = utils.calculateZoomLevel(lastNode);
if (event.y / firstNodeZoom < firstNodeRect.top) {
blockElem = firstNode;
} else if (event.y / lastNodeZoom > lastNodeRect.bottom) {
blockElem = lastNode;
}
if (blockElem) {
return;
}
}
}
let index = getCurrentIndex(topLevelNodeKeys.length);
let direction = Indeterminate;
while (index >= 0 && index < topLevelNodeKeys.length) {
const key = topLevelNodeKeys[index];
const elem = editor.getElementByKey(key);
if (elem === null) {
break;
}
const zoom = utils.calculateZoomLevel(elem);
const point = new Point(event.x / zoom, event.y / zoom);
const domRect = Rectangle.fromDOM(elem);
const {
marginTop,
marginBottom
} = getCollapsedMargins(elem);
const rect = domRect.generateNewRect({
bottom: domRect.bottom + marginBottom,
left: anchorElementRect.left,
right: anchorElementRect.right,
top: domRect.top - marginTop
});
const {
result,
reason: {
isOnTopSide,
isOnBottomSide
}
} = rect.contains(point);
if (result) {
blockElem = elem;
prevIndex = index;
break;
}
if (direction === Indeterminate) {
if (isOnTopSide) {
direction = Upward;
} else if (isOnBottomSide) {
direction = Downward;
} else {
// stop search block element
direction = Infinity;
}
}
index += direction;
}
});
return blockElem;
}
function setMenuPosition(targetElem, floatingElem, anchorElem) {
if (!targetElem) {
floatingElem.style.opacity = '0';
floatingElem.style.transform = 'translate(-10000px, -10000px)';
return;
}
const targetRect = targetElem.getBoundingClientRect();
const targetStyle = window.getComputedStyle(targetElem);
const floatingElemRect = floatingElem.getBoundingClientRect();
const anchorElementRect = anchorElem.getBoundingClientRect();
// top left
let targetCalculateHeight = parseInt(targetStyle.lineHeight, 10);
if (isNaN(targetCalculateHeight)) {
// middle
targetCalculateHeight = targetRect.bottom - targetRect.top;
}
const top = targetRect.top + (targetCalculateHeight - floatingElemRect.height) / 2 - anchorElementRect.top + anchorElem.scrollTop;
const left = SPACE;
floatingElem.style.opacity = '1';
floatingElem.style.transform = `translate(${left}px, ${top}px)`;
}
function setDragImage(dataTransfer, draggableBlockElem) {
const {
transform
} = draggableBlockElem.style;
// Remove dragImage borders
draggableBlockElem.style.transform = 'translateZ(0)';
dataTransfer.setDragImage(draggableBlockElem, 0, 0);
setTimeout(() => {
draggableBlockElem.style.transform = transform;
});
}
function setTargetLine(targetLineElem, targetBlockElem, mouseY, anchorElem) {
const {
top: targetBlockElemTop,
height: targetBlockElemHeight
} = targetBlockElem.getBoundingClientRect();
const {
top: anchorTop,
width: anchorWidth
} = anchorElem.getBoundingClientRect();
const {
marginTop,
marginBottom
} = getCollapsedMargins(targetBlockElem);
let lineTop = targetBlockElemTop;
if (mouseY >= targetBlockElemTop) {
lineTop += targetBlockElemHeight + marginBottom / 2;
} else {
lineTop -= marginTop / 2;
}
const top = lineTop - anchorTop - TARGET_LINE_HALF_HEIGHT + anchorElem.scrollTop;
const left = TEXT_BOX_HORIZONTAL_PADDING - SPACE;
targetLineElem.style.transform = `translate(${left}px, ${top}px)`;
targetLineElem.style.width = `${anchorWidth - (TEXT_BOX_HORIZONTAL_PADDING - SPACE) * 2}px`;
targetLineElem.style.opacity = '.4';
}
function hideTargetLine(targetLineElem) {
if (targetLineElem) {
targetLineElem.style.opacity = '0';
targetLineElem.style.transform = 'translate(-10000px, -10000px)';
}
}
function useDraggableBlockMenu(editor, anchorElem, menuRef, targetLineRef, isEditable, menuComponent, targetLineComponent, isOnMenu, onElementChanged) {
const scrollerElem = anchorElem.parentElement;
const isDraggingBlockRef = react.useRef(false);
const [draggableBlockElem, setDraggableBlockElemState] = react.useState(null);
const setDraggableBlockElem = react.useCallback(elem => {
setDraggableBlockElemState(elem);
if (onElementChanged) {
onElementChanged(elem);
}
}, [onElementChanged]);
react.useEffect(() => {
function onMouseMove(event) {
const target = event.target;
if (!utils.isHTMLElement(target)) {
setDraggableBlockElem(null);
return;
}
if (isOnMenu(target)) {
return;
}
const _draggableBlockElem = getBlockElement(anchorElem, editor, event);
setDraggableBlockElem(_draggableBlockElem);
}
function onMouseLeave() {
setDraggableBlockElem(null);
}
if (scrollerElem != null) {
scrollerElem.addEventListener('mousemove', onMouseMove);
scrollerElem.addEventListener('mouseleave', onMouseLeave);
}
return () => {
if (scrollerElem != null) {
scrollerElem.removeEventListener('mousemove', onMouseMove);
scrollerElem.removeEventListener('mouseleave', onMouseLeave);
}
};
}, [scrollerElem, anchorElem, editor, isOnMenu, setDraggableBlockElem]);
react.useEffect(() => {
if (menuRef.current) {
setMenuPosition(draggableBlockElem, menuRef.current, anchorElem);
}
}, [anchorElem, draggableBlockElem, menuRef]);
react.useEffect(() => {
function onDragover(event) {
if (!isDraggingBlockRef.current) {
return false;
}
const [isFileTransfer] = richText.eventFiles(event);
if (isFileTransfer) {
return false;
}
const {
pageY,
target
} = event;
if (!utils.isHTMLElement(target)) {
return false;
}
const targetBlockElem = getBlockElement(anchorElem, editor, event, true);
const targetLineElem = targetLineRef.current;
if (targetBlockElem === null || targetLineElem === null) {
return false;
}
setTargetLine(targetLineElem, targetBlockElem, pageY / utils.calculateZoomLevel(target), anchorElem);
// Prevent default event to be able to trigger onDrop events
event.preventDefault();
return true;
}
function $onDrop(event) {
if (!isDraggingBlockRef.current) {
return false;
}
const [isFileTransfer] = richText.eventFiles(event);
if (isFileTransfer) {
return false;
}
const {
target,
dataTransfer,
pageY
} = event;
const dragData = dataTransfer != null ? dataTransfer.getData(DRAG_DATA_FORMAT) : '';
const draggedNode = lexical.$getNodeByKey(dragData);
if (!draggedNode) {
return false;
}
if (!utils.isHTMLElement(target)) {
return false;
}
const targetBlockElem = getBlockElement(anchorElem, editor, event, true);
if (!targetBlockElem) {
return false;
}
const targetNode = lexical.$getNearestNodeFromDOMNode(targetBlockElem);
if (!targetNode) {
return false;
}
if (targetNode === draggedNode) {
return true;
}
const targetBlockElemTop = targetBlockElem.getBoundingClientRect().top;
if (pageY / utils.calculateZoomLevel(target) >= targetBlockElemTop) {
targetNode.insertAfter(draggedNode);
} else {
targetNode.insertBefore(draggedNode);
}
setDraggableBlockElem(null);
return true;
}
return utils.mergeRegister(editor.registerCommand(lexical.DRAGOVER_COMMAND, event => {
return onDragover(event);
}, lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical.DROP_COMMAND, event => {
return $onDrop(event);
}, lexical.COMMAND_PRIORITY_HIGH));
}, [anchorElem, editor, targetLineRef, setDraggableBlockElem]);
function onDragStart(event) {
const dataTransfer = event.dataTransfer;
if (!dataTransfer || !draggableBlockElem) {
return;
}
setDragImage(dataTransfer, draggableBlockElem);
let nodeKey = '';
editor.update(() => {
const node = lexical.$getNearestNodeFromDOMNode(draggableBlockElem);
if (node) {
nodeKey = node.getKey();
}
});
isDraggingBlockRef.current = true;
dataTransfer.setData(DRAG_DATA_FORMAT, nodeKey);
}
function onDragEnd() {
isDraggingBlockRef.current = false;
hideTargetLine(targetLineRef.current);
}
return /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
draggable: true,
onDragStart: onDragStart,
onDragEnd: onDragEnd,
children: isEditable && menuComponent
}), targetLineComponent]
}), anchorElem);
}
function DraggableBlockPlugin_EXPERIMENTAL({
anchorElem = document.body,
menuRef,
targetLineRef,
menuComponent,
targetLineComponent,
isOnMenu,
onElementChanged
}) {
const [editor] = LexicalComposerContext.useLexicalComposerContext();
return useDraggableBlockMenu(editor, anchorElem, menuRef, targetLineRef, editor._editable, menuComponent, targetLineComponent, isOnMenu, onElementChanged);
}
exports.DraggableBlockPlugin_EXPERIMENTAL = DraggableBlockPlugin_EXPERIMENTAL;

View File

@@ -0,0 +1,11 @@
import { ITypeDescriptor } from '../ITypeDescriptor';
import { Context } from '../../core/context';
export declare type Color = number;
export declare const color: ITypeDescriptor<Color>;
export declare const isTransparent: (color: Color) => boolean;
export declare const asString: (color: Color) => string;
export declare const pack: (r: number, g: number, b: number, a: number) => Color;
export declare const parseColor: (context: Context, value: string) => Color;
export declare const COLORS: {
[key: string]: Color;
};

View File

@@ -0,0 +1,146 @@
import { getBreadcrumbLogLevelFromHttpStatusCode, addBreadcrumb, getClient, shouldPropagateTraceForUrl, getTraceData, debug, isError, parseUrl, getSanitizedUrlString } from '@sentry/core';
import { DEBUG_BUILD } from '../debug-build.js';
import { mergeBaggageHeaders } from './baggage.js';
const LOG_PREFIX = '@sentry/instrumentation-http';
/** Add a breadcrumb for outgoing requests. */
function addRequestBreadcrumb(request, response) {
const data = getBreadcrumbData(request);
const statusCode = response?.statusCode;
const level = getBreadcrumbLogLevelFromHttpStatusCode(statusCode);
addBreadcrumb(
{
category: 'http',
data: {
status_code: statusCode,
...data,
},
type: 'http',
level,
},
{
event: 'response',
request,
response,
},
);
}
/**
* Add trace propagation headers to an outgoing request.
* This must be called _before_ the request is sent!
*/
// eslint-disable-next-line complexity
function addTracePropagationHeadersToOutgoingRequest(
request,
propagationDecisionMap,
) {
const url = getRequestUrl(request);
const { tracePropagationTargets, propagateTraceparent } = getClient()?.getOptions() || {};
const headersToAdd = shouldPropagateTraceForUrl(url, tracePropagationTargets, propagationDecisionMap)
? getTraceData({ propagateTraceparent })
: undefined;
if (!headersToAdd) {
return;
}
const { 'sentry-trace': sentryTrace, baggage, traceparent } = headersToAdd;
if (sentryTrace && !request.getHeader('sentry-trace')) {
try {
request.setHeader('sentry-trace', sentryTrace);
DEBUG_BUILD && debug.log(LOG_PREFIX, 'Added sentry-trace header to outgoing request');
} catch (error) {
DEBUG_BUILD &&
debug.error(
LOG_PREFIX,
'Failed to add sentry-trace header to outgoing request:',
isError(error) ? error.message : 'Unknown error',
);
}
}
if (traceparent && !request.getHeader('traceparent')) {
try {
request.setHeader('traceparent', traceparent);
DEBUG_BUILD && debug.log(LOG_PREFIX, 'Added traceparent header to outgoing request');
} catch (error) {
DEBUG_BUILD &&
debug.error(
LOG_PREFIX,
'Failed to add traceparent header to outgoing request:',
isError(error) ? error.message : 'Unknown error',
);
}
}
if (baggage) {
const newBaggage = mergeBaggageHeaders(request.getHeader('baggage'), baggage);
if (newBaggage) {
try {
request.setHeader('baggage', newBaggage);
DEBUG_BUILD && debug.log(LOG_PREFIX, 'Added baggage header to outgoing request');
} catch (error) {
DEBUG_BUILD &&
debug.error(
LOG_PREFIX,
'Failed to add baggage header to outgoing request:',
isError(error) ? error.message : 'Unknown error',
);
}
}
}
}
function getBreadcrumbData(request) {
try {
// `request.host` does not contain the port, but the host header does
const host = request.getHeader('host') || request.host;
const url = new URL(request.path, `${request.protocol}//${host}`);
const parsedUrl = parseUrl(url.toString());
const data = {
url: getSanitizedUrlString(parsedUrl),
'http.method': request.method || 'GET',
};
if (parsedUrl.search) {
data['http.query'] = parsedUrl.search;
}
if (parsedUrl.hash) {
data['http.fragment'] = parsedUrl.hash;
}
return data;
} catch {
return {};
}
}
/** Convert an outgoing request to request options. */
function getRequestOptions(request) {
return {
method: request.method,
protocol: request.protocol,
host: request.host,
hostname: request.host,
path: request.path,
headers: request.getHeaders(),
};
}
function getRequestUrl(request) {
const hostname = request.getHeader('host') || request.host;
const protocol = request.protocol;
const path = request.path;
return `${protocol}//${hostname}${path}`;
}
export { addRequestBreadcrumb, addTracePropagationHeadersToOutgoingRequest, getRequestOptions };
//# sourceMappingURL=outgoingHttpRequest.js.map

View File

@@ -0,0 +1,10 @@
export declare const UNICODE_EXTENSION_SEQUENCE_REGEX: RegExp;
export declare function invariant(condition: boolean, message: string, Err?: any): asserts condition;
export declare function findMatchingDistance(desired: string, supported: string): number;
interface LocaleMatchingResult {
distances: Record<string, Record<string, number>>;
matchedSupportedLocale?: string;
matchedDesiredLocale?: string;
}
export declare function findBestMatch(requestedLocales: readonly string[], supportedLocales: readonly string[], threshold?: number): LocaleMatchingResult;
export {};

View File

@@ -0,0 +1,7 @@
import type { AnySQLiteSelect } from "../sqlite-core/index.js";
import { SQLiteRelationalQuery } from "../sqlite-core/query-builders/query.js";
export declare const useLiveQuery: <T extends Pick<AnySQLiteSelect, "_" | "then"> | SQLiteRelationalQuery<"sync", unknown>>(query: T, deps?: unknown[]) => {
readonly data: Awaited<T>;
readonly error: Error | undefined;
readonly updatedAt: Date | undefined;
};

View File

@@ -0,0 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
const mod = await (process.env.NODE_ENV !== 'production' ? import('./LexicalCheckListPlugin.dev.mjs') : import('./LexicalCheckListPlugin.prod.mjs'));
export const CheckListPlugin = mod.CheckListPlugin;

View File

@@ -0,0 +1,942 @@
'use strict';
// lib/types/utils.ts
var decoder = new TextDecoder();
var toUTF8String = (input, start = 0, end = input.length) => decoder.decode(input.slice(start, end));
var toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce((memo, i) => memo + `0${i.toString(16)}`.slice(-2), "");
var getView = (input, offset) => new DataView(input.buffer, input.byteOffset + offset);
var readInt16LE = (input, offset = 0) => getView(input, offset).getInt16(0, true);
var readUInt16BE = (input, offset = 0) => getView(input, offset).getUint16(0, false);
var readUInt16LE = (input, offset = 0) => getView(input, offset).getUint16(0, true);
var readUInt24LE = (input, offset = 0) => {
const view = getView(input, offset);
return view.getUint16(0, true) + (view.getUint8(2) << 16);
};
var readInt32LE = (input, offset = 0) => getView(input, offset).getInt32(0, true);
var readUInt32BE = (input, offset = 0) => getView(input, offset).getUint32(0, false);
var readUInt32LE = (input, offset = 0) => getView(input, offset).getUint32(0, true);
var readUInt64 = (input, offset, isBigEndian) => getView(input, offset).getBigUint64(0, !isBigEndian);
var methods = {
readUInt16BE,
readUInt16LE,
readUInt32BE,
readUInt32LE
};
function readUInt(input, bits, offset = 0, isBigEndian = false) {
const endian = isBigEndian ? "BE" : "LE";
const methodName = `readUInt${bits}${endian}`;
return methods[methodName](input, offset);
}
function readBox(input, offset) {
if (input.length - offset < 4) return;
const boxSize = readUInt32BE(input, offset);
if (input.length - offset < boxSize) return;
return {
name: toUTF8String(input, 4 + offset, 8 + offset),
offset,
size: boxSize
};
}
function findBox(input, boxName, currentOffset) {
while (currentOffset < input.length) {
const box = readBox(input, currentOffset);
if (!box) break;
if (box.name === boxName) return box;
currentOffset += box.size > 0 ? box.size : 8;
}
}
// lib/types/bmp.ts
var BMP = {
validate: (input) => toUTF8String(input, 0, 2) === "BM",
calculate: (input) => ({
height: Math.abs(readInt32LE(input, 22)),
width: readUInt32LE(input, 18)
})
};
// lib/types/ico.ts
var TYPE_ICON = 1;
var SIZE_HEADER = 2 + 2 + 2;
var SIZE_IMAGE_ENTRY = 1 + 1 + 1 + 1 + 2 + 2 + 4 + 4;
function getSizeFromOffset(input, offset) {
const value = input[offset];
return value === 0 ? 256 : value;
}
function getImageSize(input, imageIndex) {
const offset = SIZE_HEADER + imageIndex * SIZE_IMAGE_ENTRY;
return {
height: getSizeFromOffset(input, offset + 1),
width: getSizeFromOffset(input, offset)
};
}
var ICO = {
validate(input) {
const reserved = readUInt16LE(input, 0);
const imageCount = readUInt16LE(input, 4);
if (reserved !== 0 || imageCount === 0) return false;
const imageType = readUInt16LE(input, 2);
return imageType === TYPE_ICON;
},
calculate(input) {
const nbImages = readUInt16LE(input, 4);
const imageSize = getImageSize(input, 0);
if (nbImages === 1) return imageSize;
const images = [];
for (let imageIndex = 0; imageIndex < nbImages; imageIndex += 1) {
images.push(getImageSize(input, imageIndex));
}
return {
width: imageSize.width,
height: imageSize.height,
images
};
}
};
// lib/types/cur.ts
var TYPE_CURSOR = 2;
var CUR = {
validate(input) {
const reserved = readUInt16LE(input, 0);
const imageCount = readUInt16LE(input, 4);
if (reserved !== 0 || imageCount === 0) return false;
const imageType = readUInt16LE(input, 2);
return imageType === TYPE_CURSOR;
},
calculate: (input) => ICO.calculate(input)
};
// lib/types/dds.ts
var DDS = {
validate: (input) => readUInt32LE(input, 0) === 542327876,
calculate: (input) => ({
height: readUInt32LE(input, 12),
width: readUInt32LE(input, 16)
})
};
// lib/types/gif.ts
var gifRegexp = /^GIF8[79]a/;
var GIF = {
validate: (input) => gifRegexp.test(toUTF8String(input, 0, 6)),
calculate: (input) => ({
height: readUInt16LE(input, 8),
width: readUInt16LE(input, 6)
})
};
// lib/types/heif.ts
var brandMap = {
avif: "avif",
mif1: "heif",
msf1: "heif",
// heif-sequence
heic: "heic",
heix: "heic",
hevc: "heic",
// heic-sequence
hevx: "heic"
// heic-sequence
};
var HEIF = {
validate(input) {
const boxType = toUTF8String(input, 4, 8);
if (boxType !== "ftyp") return false;
const ftypBox = findBox(input, "ftyp", 0);
if (!ftypBox) return false;
const brand = toUTF8String(input, ftypBox.offset + 8, ftypBox.offset + 12);
return brand in brandMap;
},
calculate(input) {
const metaBox = findBox(input, "meta", 0);
const iprpBox = metaBox && findBox(input, "iprp", metaBox.offset + 12);
const ipcoBox = iprpBox && findBox(input, "ipco", iprpBox.offset + 8);
if (!ipcoBox) {
throw new TypeError("Invalid HEIF, no ipco box found");
}
const type = toUTF8String(input, 8, 12);
const images = [];
let currentOffset = ipcoBox.offset + 8;
while (currentOffset < ipcoBox.offset + ipcoBox.size) {
const ispeBox = findBox(input, "ispe", currentOffset);
if (!ispeBox) break;
const rawWidth = readUInt32BE(input, ispeBox.offset + 12);
const rawHeight = readUInt32BE(input, ispeBox.offset + 16);
const clapBox = findBox(input, "clap", currentOffset);
let width = rawWidth;
let height = rawHeight;
if (clapBox && clapBox.offset < ipcoBox.offset + ipcoBox.size) {
const cropRight = readUInt32BE(input, clapBox.offset + 12);
width = rawWidth - cropRight;
}
images.push({ height, width });
currentOffset = ispeBox.offset + ispeBox.size;
}
if (images.length === 0) {
throw new TypeError("Invalid HEIF, no sizes found");
}
return {
width: images[0].width,
height: images[0].height,
type,
...images.length > 1 ? { images } : {}
};
}
};
// lib/types/icns.ts
var SIZE_HEADER2 = 4 + 4;
var FILE_LENGTH_OFFSET = 4;
var ENTRY_LENGTH_OFFSET = 4;
var ICON_TYPE_SIZE = {
ICON: 32,
"ICN#": 32,
// m => 16 x 16
"icm#": 16,
icm4: 16,
icm8: 16,
// s => 16 x 16
"ics#": 16,
ics4: 16,
ics8: 16,
is32: 16,
s8mk: 16,
icp4: 16,
// l => 32 x 32
icl4: 32,
icl8: 32,
il32: 32,
l8mk: 32,
icp5: 32,
ic11: 32,
// h => 48 x 48
ich4: 48,
ich8: 48,
ih32: 48,
h8mk: 48,
// . => 64 x 64
icp6: 64,
ic12: 32,
// t => 128 x 128
it32: 128,
t8mk: 128,
ic07: 128,
// . => 256 x 256
ic08: 256,
ic13: 256,
// . => 512 x 512
ic09: 512,
ic14: 512,
// . => 1024 x 1024
ic10: 1024
};
function readImageHeader(input, imageOffset) {
const imageLengthOffset = imageOffset + ENTRY_LENGTH_OFFSET;
return [
toUTF8String(input, imageOffset, imageLengthOffset),
readUInt32BE(input, imageLengthOffset)
];
}
function getImageSize2(type) {
const size = ICON_TYPE_SIZE[type];
return { width: size, height: size, type };
}
var ICNS = {
validate: (input) => toUTF8String(input, 0, 4) === "icns",
calculate(input) {
const inputLength = input.length;
const fileLength = readUInt32BE(input, FILE_LENGTH_OFFSET);
let imageOffset = SIZE_HEADER2;
const images = [];
while (imageOffset < fileLength && imageOffset < inputLength) {
const imageHeader = readImageHeader(input, imageOffset);
const imageSize = getImageSize2(imageHeader[0]);
images.push(imageSize);
imageOffset += imageHeader[1];
}
if (images.length === 0) {
throw new TypeError("Invalid ICNS, no sizes found");
}
return {
width: images[0].width,
height: images[0].height,
...images.length > 1 ? { images } : {}
};
}
};
// lib/types/j2c.ts
var J2C = {
// TODO: this doesn't seem right. SIZ marker doesn't have to be right after the SOC
validate: (input) => readUInt32BE(input, 0) === 4283432785,
calculate: (input) => ({
height: readUInt32BE(input, 12),
width: readUInt32BE(input, 8)
})
};
// lib/types/jp2.ts
var JP2 = {
validate(input) {
const boxType = toUTF8String(input, 4, 8);
if (boxType !== "jP ") return false;
const ftypBox = findBox(input, "ftyp", 0);
if (!ftypBox) return false;
const brand = toUTF8String(input, ftypBox.offset + 8, ftypBox.offset + 12);
return brand === "jp2 ";
},
calculate(input) {
const jp2hBox = findBox(input, "jp2h", 0);
const ihdrBox = jp2hBox && findBox(input, "ihdr", jp2hBox.offset + 8);
if (ihdrBox) {
return {
height: readUInt32BE(input, ihdrBox.offset + 8),
width: readUInt32BE(input, ihdrBox.offset + 12)
};
}
throw new TypeError("Unsupported JPEG 2000 format");
}
};
// lib/types/jpg.ts
var EXIF_MARKER = "45786966";
var APP1_DATA_SIZE_BYTES = 2;
var EXIF_HEADER_BYTES = 6;
var TIFF_BYTE_ALIGN_BYTES = 2;
var BIG_ENDIAN_BYTE_ALIGN = "4d4d";
var LITTLE_ENDIAN_BYTE_ALIGN = "4949";
var IDF_ENTRY_BYTES = 12;
var NUM_DIRECTORY_ENTRIES_BYTES = 2;
function isEXIF(input) {
return toHexString(input, 2, 6) === EXIF_MARKER;
}
function extractSize(input, index) {
return {
height: readUInt16BE(input, index),
width: readUInt16BE(input, index + 2)
};
}
function extractOrientation(exifBlock, isBigEndian) {
const idfOffset = 8;
const offset = EXIF_HEADER_BYTES + idfOffset;
const idfDirectoryEntries = readUInt(exifBlock, 16, offset, isBigEndian);
for (let directoryEntryNumber = 0; directoryEntryNumber < idfDirectoryEntries; directoryEntryNumber++) {
const start = offset + NUM_DIRECTORY_ENTRIES_BYTES + directoryEntryNumber * IDF_ENTRY_BYTES;
const end = start + IDF_ENTRY_BYTES;
if (start > exifBlock.length) {
return;
}
const block = exifBlock.slice(start, end);
const tagNumber = readUInt(block, 16, 0, isBigEndian);
if (tagNumber === 274) {
const dataFormat = readUInt(block, 16, 2, isBigEndian);
if (dataFormat !== 3) {
return;
}
const numberOfComponents = readUInt(block, 32, 4, isBigEndian);
if (numberOfComponents !== 1) {
return;
}
return readUInt(block, 16, 8, isBigEndian);
}
}
}
function validateExifBlock(input, index) {
const exifBlock = input.slice(APP1_DATA_SIZE_BYTES, index);
const byteAlign = toHexString(
exifBlock,
EXIF_HEADER_BYTES,
EXIF_HEADER_BYTES + TIFF_BYTE_ALIGN_BYTES
);
const isBigEndian = byteAlign === BIG_ENDIAN_BYTE_ALIGN;
const isLittleEndian = byteAlign === LITTLE_ENDIAN_BYTE_ALIGN;
if (isBigEndian || isLittleEndian) {
return extractOrientation(exifBlock, isBigEndian);
}
}
function validateInput(input, index) {
if (index > input.length) {
throw new TypeError("Corrupt JPG, exceeded buffer limits");
}
}
var JPG = {
validate: (input) => toHexString(input, 0, 2) === "ffd8",
calculate(_input) {
let input = _input.slice(4);
let orientation;
let next;
while (input.length) {
const i = readUInt16BE(input, 0);
validateInput(input, i);
if (input[i] !== 255) {
input = input.slice(1);
continue;
}
if (isEXIF(input)) {
orientation = validateExifBlock(input, i);
}
next = input[i + 1];
if (next === 192 || next === 193 || next === 194) {
const size = extractSize(input, i + 5);
if (!orientation) {
return size;
}
return {
height: size.height,
orientation,
width: size.width
};
}
input = input.slice(i + 2);
}
throw new TypeError("Invalid JPG, no size found");
}
};
// lib/utils/bit-reader.ts
var BitReader = class {
constructor(input, endianness) {
this.input = input;
this.endianness = endianness;
// Skip the first 16 bits (2 bytes) of signature
this.byteOffset = 2;
this.bitOffset = 0;
}
/** Reads a specified number of bits, and move the offset */
getBits(length = 1) {
let result = 0;
let bitsRead = 0;
while (bitsRead < length) {
if (this.byteOffset >= this.input.length) {
throw new Error("Reached end of input");
}
const currentByte = this.input[this.byteOffset];
const bitsLeft = 8 - this.bitOffset;
const bitsToRead = Math.min(length - bitsRead, bitsLeft);
if (this.endianness === "little-endian") {
const mask = (1 << bitsToRead) - 1;
const bits = currentByte >> this.bitOffset & mask;
result |= bits << bitsRead;
} else {
const mask = (1 << bitsToRead) - 1 << 8 - this.bitOffset - bitsToRead;
const bits = (currentByte & mask) >> 8 - this.bitOffset - bitsToRead;
result = result << bitsToRead | bits;
}
bitsRead += bitsToRead;
this.bitOffset += bitsToRead;
if (this.bitOffset === 8) {
this.byteOffset++;
this.bitOffset = 0;
}
}
return result;
}
};
// lib/types/jxl-stream.ts
function calculateImageDimension(reader, isSmallImage) {
if (isSmallImage) {
return 8 * (1 + reader.getBits(5));
}
const sizeClass = reader.getBits(2);
const extraBits = [9, 13, 18, 30][sizeClass];
return 1 + reader.getBits(extraBits);
}
function calculateImageWidth(reader, isSmallImage, widthMode, height) {
if (isSmallImage && widthMode === 0) {
return 8 * (1 + reader.getBits(5));
}
if (widthMode === 0) {
return calculateImageDimension(reader, false);
}
const aspectRatios = [1, 1.2, 4 / 3, 1.5, 16 / 9, 5 / 4, 2];
return Math.floor(height * aspectRatios[widthMode - 1]);
}
var JXLStream = {
validate: (input) => {
return toHexString(input, 0, 2) === "ff0a";
},
calculate(input) {
const reader = new BitReader(input, "little-endian");
const isSmallImage = reader.getBits(1) === 1;
const height = calculateImageDimension(reader, isSmallImage);
const widthMode = reader.getBits(3);
const width = calculateImageWidth(reader, isSmallImage, widthMode, height);
return { width, height };
}
};
// lib/types/jxl.ts
function extractCodestream(input) {
const jxlcBox = findBox(input, "jxlc", 0);
if (jxlcBox) {
return input.slice(jxlcBox.offset + 8, jxlcBox.offset + jxlcBox.size);
}
const partialStreams = extractPartialStreams(input);
if (partialStreams.length > 0) {
return concatenateCodestreams(partialStreams);
}
return void 0;
}
function extractPartialStreams(input) {
const partialStreams = [];
let offset = 0;
while (offset < input.length) {
const jxlpBox = findBox(input, "jxlp", offset);
if (!jxlpBox) break;
partialStreams.push(
input.slice(jxlpBox.offset + 12, jxlpBox.offset + jxlpBox.size)
);
offset = jxlpBox.offset + jxlpBox.size;
}
return partialStreams;
}
function concatenateCodestreams(partialCodestreams) {
const totalLength = partialCodestreams.reduce(
(acc, curr) => acc + curr.length,
0
);
const codestream = new Uint8Array(totalLength);
let position = 0;
for (const partial of partialCodestreams) {
codestream.set(partial, position);
position += partial.length;
}
return codestream;
}
var JXL = {
validate: (input) => {
const boxType = toUTF8String(input, 4, 8);
if (boxType !== "JXL ") return false;
const ftypBox = findBox(input, "ftyp", 0);
if (!ftypBox) return false;
const brand = toUTF8String(input, ftypBox.offset + 8, ftypBox.offset + 12);
return brand === "jxl ";
},
calculate(input) {
const codestream = extractCodestream(input);
if (codestream) return JXLStream.calculate(codestream);
throw new Error("No codestream found in JXL container");
}
};
// lib/types/ktx.ts
var KTX = {
validate: (input) => {
const signature = toUTF8String(input, 1, 7);
return ["KTX 11", "KTX 20"].includes(signature);
},
calculate: (input) => {
const type = input[5] === 49 ? "ktx" : "ktx2";
const offset = type === "ktx" ? 36 : 20;
return {
height: readUInt32LE(input, offset + 4),
width: readUInt32LE(input, offset),
type
};
}
};
// lib/types/png.ts
var pngSignature = "PNG\r\n\n";
var pngImageHeaderChunkName = "IHDR";
var pngFriedChunkName = "CgBI";
var PNG = {
validate(input) {
if (pngSignature === toUTF8String(input, 1, 8)) {
let chunkName = toUTF8String(input, 12, 16);
if (chunkName === pngFriedChunkName) {
chunkName = toUTF8String(input, 28, 32);
}
if (chunkName !== pngImageHeaderChunkName) {
throw new TypeError("Invalid PNG");
}
return true;
}
return false;
},
calculate(input) {
if (toUTF8String(input, 12, 16) === pngFriedChunkName) {
return {
height: readUInt32BE(input, 36),
width: readUInt32BE(input, 32)
};
}
return {
height: readUInt32BE(input, 20),
width: readUInt32BE(input, 16)
};
}
};
// lib/types/pnm.ts
var PNMTypes = {
P1: "pbm/ascii",
P2: "pgm/ascii",
P3: "ppm/ascii",
P4: "pbm",
P5: "pgm",
P6: "ppm",
P7: "pam",
PF: "pfm"
};
var handlers = {
default: (lines) => {
let dimensions = [];
while (lines.length > 0) {
const line = lines.shift();
if (line[0] === "#") {
continue;
}
dimensions = line.split(" ");
break;
}
if (dimensions.length === 2) {
return {
height: Number.parseInt(dimensions[1], 10),
width: Number.parseInt(dimensions[0], 10)
};
}
throw new TypeError("Invalid PNM");
},
pam: (lines) => {
const size = {};
while (lines.length > 0) {
const line = lines.shift();
if (line.length > 16 || line.charCodeAt(0) > 128) {
continue;
}
const [key, value] = line.split(" ");
if (key && value) {
size[key.toLowerCase()] = Number.parseInt(value, 10);
}
if (size.height && size.width) {
break;
}
}
if (size.height && size.width) {
return {
height: size.height,
width: size.width
};
}
throw new TypeError("Invalid PAM");
}
};
var PNM = {
validate: (input) => toUTF8String(input, 0, 2) in PNMTypes,
calculate(input) {
const signature = toUTF8String(input, 0, 2);
const type = PNMTypes[signature];
const lines = toUTF8String(input, 3).split(/[\r\n]+/);
const handler = handlers[type] || handlers.default;
return handler(lines);
}
};
// lib/types/psd.ts
var PSD = {
validate: (input) => toUTF8String(input, 0, 4) === "8BPS",
calculate: (input) => ({
height: readUInt32BE(input, 14),
width: readUInt32BE(input, 18)
})
};
// lib/types/svg.ts
var svgReg = /<svg\s([^>"']|"[^"]*"|'[^']*')*>/;
var extractorRegExps = {
height: /\sheight=(['"])([^%]+?)\1/,
root: svgReg,
viewbox: /\sviewBox=(['"])(.+?)\1/i,
width: /\swidth=(['"])([^%]+?)\1/
};
var INCH_CM = 2.54;
var units = {
in: 96,
cm: 96 / INCH_CM,
em: 16,
ex: 8,
m: 96 / INCH_CM * 100,
mm: 96 / INCH_CM / 10,
pc: 96 / 72 / 12,
pt: 96 / 72,
px: 1
};
var unitsReg = new RegExp(
`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`
);
function parseLength(len) {
const m = unitsReg.exec(len);
if (!m) {
return void 0;
}
return Math.round(Number(m[1]) * (units[m[2]] || 1));
}
function parseViewbox(viewbox) {
const bounds = viewbox.split(" ");
return {
height: parseLength(bounds[3]),
width: parseLength(bounds[2])
};
}
function parseAttributes(root) {
const width = root.match(extractorRegExps.width);
const height = root.match(extractorRegExps.height);
const viewbox = root.match(extractorRegExps.viewbox);
return {
height: height && parseLength(height[2]),
viewbox: viewbox && parseViewbox(viewbox[2]),
width: width && parseLength(width[2])
};
}
function calculateByDimensions(attrs) {
return {
height: attrs.height,
width: attrs.width
};
}
function calculateByViewbox(attrs, viewbox) {
const ratio = viewbox.width / viewbox.height;
if (attrs.width) {
return {
height: Math.floor(attrs.width / ratio),
width: attrs.width
};
}
if (attrs.height) {
return {
height: attrs.height,
width: Math.floor(attrs.height * ratio)
};
}
return {
height: viewbox.height,
width: viewbox.width
};
}
var SVG = {
// Scan only the first kilo-byte to speed up the check on larger files
validate: (input) => svgReg.test(toUTF8String(input, 0, 1e3)),
calculate(input) {
const root = toUTF8String(input).match(extractorRegExps.root);
if (root) {
const attrs = parseAttributes(root[0]);
if (attrs.width && attrs.height) {
return calculateByDimensions(attrs);
}
if (attrs.viewbox) {
return calculateByViewbox(attrs, attrs.viewbox);
}
}
throw new TypeError("Invalid SVG");
}
};
// lib/types/tga.ts
var TGA = {
validate(input) {
return readUInt16LE(input, 0) === 0 && readUInt16LE(input, 4) === 0;
},
calculate(input) {
return {
height: readUInt16LE(input, 14),
width: readUInt16LE(input, 12)
};
}
};
// lib/types/tiff.ts
var CONSTANTS = {
TAG: {
WIDTH: 256,
HEIGHT: 257,
COMPRESSION: 259
},
TYPE: {
SHORT: 3,
LONG: 4,
LONG8: 16
},
ENTRY_SIZE: {
STANDARD: 12,
BIG: 20
},
COUNT_SIZE: {
STANDARD: 2,
BIG: 8
}
};
function readIFD(input, { isBigEndian, isBigTiff }) {
const ifdOffset = isBigTiff ? Number(readUInt64(input, 8, isBigEndian)) : readUInt(input, 32, 4, isBigEndian);
const entryCountSize = isBigTiff ? CONSTANTS.COUNT_SIZE.BIG : CONSTANTS.COUNT_SIZE.STANDARD;
return input.slice(ifdOffset + entryCountSize);
}
function readTagValue(input, type, offset, isBigEndian) {
switch (type) {
case CONSTANTS.TYPE.SHORT:
return readUInt(input, 16, offset, isBigEndian);
case CONSTANTS.TYPE.LONG:
return readUInt(input, 32, offset, isBigEndian);
case CONSTANTS.TYPE.LONG8: {
const value = Number(readUInt64(input, offset, isBigEndian));
if (value > Number.MAX_SAFE_INTEGER) {
throw new TypeError("Value too large");
}
return value;
}
default:
return 0;
}
}
function nextTag(input, isBigTiff) {
const entrySize = isBigTiff ? CONSTANTS.ENTRY_SIZE.BIG : CONSTANTS.ENTRY_SIZE.STANDARD;
if (input.length > entrySize) {
return input.slice(entrySize);
}
}
function extractTags(input, { isBigEndian, isBigTiff }) {
const tags = {};
let temp = input;
while (temp?.length) {
const code = readUInt(temp, 16, 0, isBigEndian);
const type = readUInt(temp, 16, 2, isBigEndian);
const length = isBigTiff ? Number(readUInt64(temp, 4, isBigEndian)) : readUInt(temp, 32, 4, isBigEndian);
if (code === 0) break;
if (length === 1 && (type === CONSTANTS.TYPE.SHORT || type === CONSTANTS.TYPE.LONG || isBigTiff && type === CONSTANTS.TYPE.LONG8)) {
const valueOffset = isBigTiff ? 12 : 8;
tags[code] = readTagValue(temp, type, valueOffset, isBigEndian);
}
temp = nextTag(temp, isBigTiff);
}
return tags;
}
function determineFormat(input) {
const signature = toUTF8String(input, 0, 2);
const version = readUInt(input, 16, 2, signature === "MM");
return {
isBigEndian: signature === "MM",
isBigTiff: version === 43
};
}
function validateBigTIFFHeader(input, isBigEndian) {
const byteSize = readUInt(input, 16, 4, isBigEndian);
const reserved = readUInt(input, 16, 6, isBigEndian);
if (byteSize !== 8 || reserved !== 0) {
throw new TypeError("Invalid BigTIFF header");
}
}
var signatures = /* @__PURE__ */ new Set([
"49492a00",
// Little Endian
"4d4d002a",
// Big Endian
"49492b00",
// BigTIFF Little Endian
"4d4d002b"
// BigTIFF Big Endian
]);
var TIFF = {
validate: (input) => {
const signature = toHexString(input, 0, 4);
return signatures.has(signature);
},
calculate(input) {
const format = determineFormat(input);
if (format.isBigTiff) {
validateBigTIFFHeader(input, format.isBigEndian);
}
const ifdBuffer = readIFD(input, format);
const tags = extractTags(ifdBuffer, format);
const info = {
height: tags[CONSTANTS.TAG.HEIGHT],
width: tags[CONSTANTS.TAG.WIDTH],
type: format.isBigTiff ? "bigtiff" : "tiff"
};
if (tags[CONSTANTS.TAG.COMPRESSION]) {
info.compression = tags[CONSTANTS.TAG.COMPRESSION];
}
if (!info.width || !info.height) {
throw new TypeError("Invalid Tiff. Missing tags");
}
return info;
}
};
// lib/types/webp.ts
function calculateExtended(input) {
return {
height: 1 + readUInt24LE(input, 7),
width: 1 + readUInt24LE(input, 4)
};
}
function calculateLossless(input) {
return {
height: 1 + ((input[4] & 15) << 10 | input[3] << 2 | (input[2] & 192) >> 6),
width: 1 + ((input[2] & 63) << 8 | input[1])
};
}
function calculateLossy(input) {
return {
height: readInt16LE(input, 8) & 16383,
width: readInt16LE(input, 6) & 16383
};
}
var WEBP = {
validate(input) {
const riffHeader = "RIFF" === toUTF8String(input, 0, 4);
const webpHeader = "WEBP" === toUTF8String(input, 8, 12);
const vp8Header = "VP8" === toUTF8String(input, 12, 15);
return riffHeader && webpHeader && vp8Header;
},
calculate(_input) {
const chunkHeader = toUTF8String(_input, 12, 16);
const input = _input.slice(20, 30);
if (chunkHeader === "VP8X") {
const extendedHeader = input[0];
const validStart = (extendedHeader & 192) === 0;
const validEnd = (extendedHeader & 1) === 0;
if (validStart && validEnd) {
return calculateExtended(input);
}
throw new TypeError("Invalid WebP");
}
if (chunkHeader === "VP8 " && input[0] !== 47) {
return calculateLossy(input);
}
const signature = toHexString(input, 3, 6);
if (chunkHeader === "VP8L" && signature !== "9d012a") {
return calculateLossless(input);
}
throw new TypeError("Invalid WebP");
}
};
// lib/types/index.ts
var typeHandlers = /* @__PURE__ */ new Map([
["bmp", BMP],
["cur", CUR],
["dds", DDS],
["gif", GIF],
["heif", HEIF],
["icns", ICNS],
["ico", ICO],
["j2c", J2C],
["jp2", JP2],
["jpg", JPG],
["jxl", JXL],
["jxl-stream", JXLStream],
["ktx", KTX],
["png", PNG],
["pnm", PNM],
["psd", PSD],
["svg", SVG],
["tga", TGA],
["tiff", TIFF],
["webp", WEBP]
]);
var types = Array.from(typeHandlers.keys());
exports.typeHandlers = typeHandlers;
exports.types = types;

View File

@@ -0,0 +1,49 @@
Prism.languages.aql = {
'comment': /\/\/.*|\/\*[\s\S]*?\*\//,
'property': {
pattern: /([{,]\s*)(?:(?!\d)\w+|(["'´`])(?:(?!\2)[^\\\r\n]|\\.)*\2)(?=\s*:)/,
lookbehind: true,
greedy: true
},
'string': {
pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\.)*\1/,
greedy: true
},
'identifier': {
pattern: /([´`])(?:(?!\1)[^\\\r\n]|\\.)*\1/,
greedy: true
},
'variable': /@@?\w+/,
'keyword': [
{
pattern: /(\bWITH\s+)COUNT(?=\s+INTO\b)/i,
lookbehind: true
},
/\b(?:AGGREGATE|ALL|AND|ANY|ASC|COLLECT|DESC|DISTINCT|FILTER|FOR|GRAPH|IN|INBOUND|INSERT|INTO|K_PATHS|K_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WINDOW|WITH)\b/i,
// pseudo keywords get a lookbehind to avoid false positives
{
pattern: /(^|[^\w.[])(?:KEEP|PRUNE|SEARCH|TO)\b/i,
lookbehind: true
},
{
pattern: /(^|[^\w.[])(?:CURRENT|NEW|OLD)\b/,
lookbehind: true
},
{
pattern: /\bOPTIONS(?=\s*\{)/i
}
],
'function': /\b(?!\d)\w+(?=\s*\()/,
'boolean': /\b(?:false|true)\b/i,
'range': {
pattern: /\.\./,
alias: 'operator'
},
'number': [
/\b0b[01]+/i,
/\b0x[0-9a-f]+/i,
/(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i
],
'operator': /\*{2,}|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/,
'punctuation': /::|[?.:,;()[\]{}]/
};

View File

@@ -0,0 +1,2 @@
const e=require(`../../utils/throw-if-empty.cjs`),t=e=>()=>({path:`/shares`,params:e??{},method:`GET`}),n=(t,n)=>()=>(e.throwIfEmpty(String(t),`Key cannot be empty`),{path:`/shares/${t}`,params:n??{},method:`GET`});exports.readShare=n,exports.readShares=t;
//# sourceMappingURL=shares.cjs.map

View File

@@ -0,0 +1,3 @@
export { wrapTracer, SugaredTracer } from './trace/SugaredTracer';
export { SugaredSpanOptions } from './trace/SugaredOptions';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,15 @@
export const downSQL: " // Test predefined migration DOWN from payload package\n payload.logger.info('Test migration DOWN from payload package executed')";
/**
* Test predefined migration for testing plugin-style module specifier imports.
* This is used in integration tests to verify that external packages (without @payloadcms/db-* prefix)
* can export predefined migrations via their package.json exports.
*
* This tests the second code path in getPredefinedMigration.ts (lines 56-72)
*
* NOTE: This is a .js file (not .ts) because Node.js with --no-experimental-strip-types
* cannot import .ts files via module specifiers. Absolute file paths work because Vitest's
* loader intercepts file:// URLs, but module specifiers are resolved by Node.js first.
*/
export const imports: "";
export const upSQL: " // Test predefined migration from payload/__testing__/predefinedMigration\n payload.logger.info('Test migration UP from payload package executed')";
//# sourceMappingURL=predefinedMigration.d.ts.map

View File

@@ -0,0 +1,79 @@
import type { ScopeValueSets, NameValue, ValueScope, ValueScopeName } from "./scope";
import { _Code, Code, Name } from "./code";
import { Scope } from "./scope";
export { _, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code } from "./code";
export { Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds } from "./scope";
export type SafeExpr = Code | number | boolean | null;
export type Block = Code | (() => void);
export declare const operators: {
GT: _Code;
GTE: _Code;
LT: _Code;
LTE: _Code;
EQ: _Code;
NEQ: _Code;
NOT: _Code;
OR: _Code;
AND: _Code;
ADD: _Code;
};
export interface CodeGenOptions {
es5?: boolean;
lines?: boolean;
ownProperties?: boolean;
}
export declare class CodeGen {
readonly _scope: Scope;
readonly _extScope: ValueScope;
readonly _values: ScopeValueSets;
private readonly _nodes;
private readonly _blockStarts;
private readonly _constants;
private readonly opts;
constructor(extScope: ValueScope, opts?: CodeGenOptions);
toString(): string;
name(prefix: string): Name;
scopeName(prefix: string): ValueScopeName;
scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name;
getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined;
scopeRefs(scopeName: Name): Code;
scopeCode(): Code;
private _def;
const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name;
let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name;
var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name;
assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen;
add(lhs: Code, rhs: SafeExpr): CodeGen;
code(c: Block | SafeExpr): CodeGen;
object(...keyValues: [Name | string, SafeExpr | string][]): _Code;
if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen;
elseIf(condition: Code | boolean): CodeGen;
else(): CodeGen;
endIf(): CodeGen;
private _for;
for(iteration: Code, forBody?: Block): CodeGen;
forRange(nameOrPrefix: Name | string, from: SafeExpr, to: SafeExpr, forBody: (index: Name) => void, varKind?: Code): CodeGen;
forOf(nameOrPrefix: Name | string, iterable: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen;
forIn(nameOrPrefix: Name | string, obj: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen;
endFor(): CodeGen;
label(label: Name): CodeGen;
break(label?: Code): CodeGen;
return(value: Block | SafeExpr): CodeGen;
try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen;
throw(error: Code): CodeGen;
block(body?: Block, nodeCount?: number): CodeGen;
endBlock(nodeCount?: number): CodeGen;
func(name: Name, args?: Code, async?: boolean, funcBody?: Block): CodeGen;
endFunc(): CodeGen;
optimize(n?: number): void;
private _leafNode;
private _blockNode;
private _endBlockNode;
private _elseNode;
private get _root();
private get _currNode();
private set _currNode(value);
}
export declare function not<T extends Code | SafeExpr>(x: T): T;
export declare function and(...args: Code[]): Code;
export declare function or(...args: Code[]): Code;

View File

@@ -0,0 +1,23 @@
/**
* @license lucide-react v0.441.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const OctagonPause = createLucideIcon("OctagonPause", [
["path", { d: "M10 15V9", key: "1lckn7" }],
["path", { d: "M14 15V9", key: "1muqhk" }],
[
"path",
{
d: "M2.586 16.872A2 2 0 0 1 2 15.458V8.542a2 2 0 0 1 .586-1.414l4.542-4.542A2 2 0 0 1 8.542 2h6.916a2 2 0 0 1 1.414.586l4.542 4.542A2 2 0 0 1 22 8.542v6.916a2 2 0 0 1-.586 1.414l-4.542 4.542a2 2 0 0 1-1.414.586H8.542a2 2 0 0 1-1.414-.586z",
key: "1e17ew"
}
]
]);
export { OctagonPause as default };
//# sourceMappingURL=octagon-pause.js.map

View File

@@ -0,0 +1,41 @@
"use strict";
exports.formatLong = void 0;
var _index = require("../../_lib/buildFormatLongFn.cjs");
const dateFormats = {
full: "EEEE d MMMM y",
long: "d MMMM y",
medium: "d MMM y",
short: "dd.MM.y",
};
const timeFormats = {
full: "HH:mm:ss zzzz",
long: "HH:mm:ss z",
medium: "HH:mm:ss",
short: "HH:mm",
};
const dateTimeFormats = {
full: "{{date}} {{time}}",
long: "{{date}} {{time}}",
medium: "{{date}} {{time}}",
short: "{{date}} {{time}}",
};
const formatLong = (exports.formatLong = {
date: (0, _index.buildFormatLongFn)({
formats: dateFormats,
defaultWidth: "full",
}),
time: (0, _index.buildFormatLongFn)({
formats: timeFormats,
defaultWidth: "full",
}),
dateTime: (0, _index.buildFormatLongFn)({
formats: dateTimeFormats,
defaultWidth: "full",
}),
});

View File

@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('valueOf', require('../valueOf'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;

View File

@@ -0,0 +1 @@
{"version":3,"file":"wrapApiHandlerWithSentry.d.ts","sourceRoot":"","sources":["../../../src/edge/wrapApiHandlerWithSentry.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,gBAAgB,EACjE,OAAO,EAAE,CAAC,EACV,kBAAkB,EAAE,MAAM,GACzB,CAAC,GAAG,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CA+EtD"}

View File

@@ -0,0 +1,32 @@
import type { ClientBlock, ClientField, Labels, Row, SanitizedFieldPermissions } from 'payload';
import React from 'react';
import type { UseDraggableSortableReturn } from '../../elements/DraggableSortable/useDraggableSortable/types.js';
type BlocksFieldProps = {
addRow: (rowIndex: number, blockType: string) => Promise<void> | void;
block: ClientBlock;
blocks: (ClientBlock | string)[] | ClientBlock[];
copyRow: (rowIndex: number) => void;
duplicateRow: (rowIndex: number) => void;
errorCount: number;
fields: ClientField[];
hasMaxRows?: boolean;
isLoading?: boolean;
isSortable?: boolean;
Label?: React.ReactNode;
labels: Labels;
moveRow: (fromIndex: number, toIndex: number) => void;
parentPath: string;
pasteRow: (rowIndex: number) => void;
path: string;
permissions: SanitizedFieldPermissions;
readOnly: boolean;
removeRow: (rowIndex: number) => void;
row: Row;
rowCount: number;
rowIndex: number;
schemaPath: string;
setCollapse: (id: string, collapsed: boolean) => void;
} & UseDraggableSortableReturn;
export declare const BlockRow: React.FC<BlocksFieldProps>;
export {};
//# sourceMappingURL=BlockRow.d.ts.map

View File

@@ -0,0 +1,8 @@
"use strict";
function _overload_yield(value, /** 0: await 1: delegate */ kind) {
this.v = value;
this.k = kind;
}
exports._ = _overload_yield;

View File

@@ -0,0 +1,29 @@
/// <reference types="node" />
/**
* This is not the set of all possible signals.
*
* It IS, however, the set of all signals that trigger
* an exit on either Linux or BSD systems. Linux is a
* superset of the signal names supported on BSD, and
* the unknown signals just fail to register, so we can
* catch that easily enough.
*
* Windows signals are a different set, since there are
* signals that terminate Windows processes, but don't
* terminate (or don't even exist) on Posix systems.
*
* Don't bother with SIGKILL. It's uncatchable, which
* means that we can't fire any callbacks anyway.
*
* If a user does happen to register a handler on a non-
* fatal signal like SIGWINCH or something, and then
* exit, it'll end up firing `process.emit('exit')`, so
* the handler will be fired anyway.
*
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
* artificially, inherently leave the process in a
* state from which it is not safe to try and enter JS
* listeners.
*/
export declare const signals: NodeJS.Signals[];
//# sourceMappingURL=signals.d.ts.map

View File

@@ -0,0 +1,16 @@
/**
*
* @deprecated use getObjectDotNotation from `'payload/shared'` instead of `'payload'`
*
* @example
*
* ```ts
* import { getObjectDotNotation } from 'payload/shared'
*
* const obj = { a: { b: { c: 42 } } }
* const value = getObjectDotNotation<number>(obj, 'a.b.c', 0) // value is 42
* const defaultValue = getObjectDotNotation<number>(obj, 'a.b.x', 0) // defaultValue is 0
* ```
*/
export declare const getObjectDotNotation: <T>(obj: Record<string, unknown>, path: string, defaultValue?: T) => T;
//# sourceMappingURL=getObjectDotNotation.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"rotate-ccw-square.js","sources":["../../../src/icons/rotate-ccw-square.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name RotateCcwSquare\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjAgOVY3YTIgMiAwIDAgMC0yLTJoLTYiIC8+CiAgPHBhdGggZD0ibTE1IDItMyAzIDMgMyIgLz4KICA8cGF0aCBkPSJNMjAgMTN2NWEyIDIgMCAwIDEtMiAySDZhMiAyIDAgMCAxLTItMlY3YTIgMiAwIDAgMSAyLTJoMiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/rotate-ccw-square\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst RotateCcwSquare = createLucideIcon('RotateCcwSquare', [\n ['path', { d: 'M20 9V7a2 2 0 0 0-2-2h-6', key: '19z8uc' }],\n ['path', { d: 'm15 2-3 3 3 3', key: '177bxs' }],\n ['path', { d: 'M20 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2', key: 'd36hnl' }],\n]);\n\nexport default RotateCcwSquare;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB,iBAAiB,iBAAmB,CAAA,CAAA,CAAA;AAAA,CAAA,CAC1D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3F,CAAC,CAAA,CAAA;;"}

View File

@@ -0,0 +1,25 @@
{
"name": "picocolors",
"version": "1.1.1",
"main": "./picocolors.js",
"types": "./picocolors.d.ts",
"browser": {
"./picocolors.js": "./picocolors.browser.js"
},
"sideEffects": false,
"description": "The tiniest and the fastest library for terminal output formatting with ANSI colors",
"files": [
"picocolors.*",
"types.d.ts"
],
"keywords": [
"terminal",
"colors",
"formatting",
"cli",
"console"
],
"author": "Alexey Raspopov",
"repository": "alexeyraspopov/picocolors",
"license": "ISC"
}

View File

@@ -0,0 +1,9 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{HeadingNode as e,$isHeadingNode as n}from"@lexical/rich-text";import{$getNextRightPreorderNode as r}from"@lexical/utils";import{$getRoot as o,$isElementNode as i,$getNodeByKey as s,TextNode as f}from"lexical";import{useState as c,useEffect as l}from"react";function u(t){return[t.getKey(),t.getTextContent(),t.getTag()]}function a(t,e,n){if(null===e)return n;const r=u(e);let o=[];if(null===t){if(n.length>0&&n[0][0]===e.__key)return n;o=[r,...n]}else for(let i=0;i<n.length;i++){const s=n[i][0];if(o.push(n[i]),s===t.getKey()&&s!==e.getKey()){if(i+1<n.length&&n[i+1][0]===e.__key)return n;o.push(r)}}return o}function g(t,e){const n=[];for(const r of e)r[0]!==t&&n.push(r);return n}function d(t,e){const n=[];for(const r of e)r[0]===t.getKey()?n.push(u(t)):n.push(r);return n}function p(t,e,n){const r=[],o=u(e);t||r.push(o);for(const i of n)i[0]!==e.getKey()&&(r.push(i),t&&i[0]===t.getKey()&&r.push(o));return r}function h(t){let e=r(t);for(;null!==e&&!n(e);)e=r(e);return e}function m({children:r}){const[u,m]=c([]),[y]=t();return l((()=>{let t=[];y.getEditorState().read((()=>{const e=r=>{for(const o of r.getChildren())n(o)?t.push([o.getKey(),o.getTextContent(),o.getTag()]):i(o)&&e(o)};e(o()),m(t)}));const r=y.registerUpdateListener((({editorState:e,dirtyElements:r})=>{e.read((()=>{const e=r=>{for(const o of r.getChildren())if(n(o)){const e=h(o);t=p(e,o,t),m(t)}else i(o)&&e(o)};o().getChildren().forEach((t=>{i(t)&&r.get(t.__key)&&e(t)}))}))})),c=y.registerMutationListener(e,(e=>{y.getEditorState().read((()=>{for(const[n,r]of e)if("created"===r){const e=s(n);if(null!==e){const n=h(e);t=a(n,e,t)}}else if("destroyed"===r)t=g(n,t);else if("updated"===r){const e=s(n);if(null!==e){const n=h(e);t=p(n,e,t)}}m(t)}))}),{skipInitialization:!0}),l=y.registerMutationListener(f,(e=>{y.getEditorState().read((()=>{for(const[r,o]of e)if("updated"===o){const e=s(r);if(null!==e){const r=e.getParentOrThrow();n(r)&&(t=d(r,t),m(t))}}}))}),{skipInitialization:!0});return()=>{c(),l(),r()}}),[y]),r(u,y)}export{m as TableOfContentsPlugin};

View File

@@ -0,0 +1,134 @@
"use strict";
exports.match = void 0;
var _index = require("../../_lib/buildMatchFn.cjs");
var _index2 = require("../../_lib/buildMatchPatternFn.cjs");
const matchOrdinalNumberPattern = /^(\d+)\.?/i;
const parseOrdinalNumberPattern = /\d+/i;
const matchEraPatterns = {
narrow: /^(f\.? ?Kr\.?|fvt\.?|e\.? ?Kr\.?|evt\.?)/i,
abbreviated: /^(f\.? ?Kr\.?|fvt\.?|e\.? ?Kr\.?|evt\.?)/i,
wide: /^(før Kristus|før vår tid|etter Kristus|vår tid)/i,
};
const parseEraPatterns = {
any: [/^f/i, /^e/i],
};
const matchQuarterPatterns = {
narrow: /^[1234]/i,
abbreviated: /^q[1234]/i,
wide: /^[1234](\.)? kvartal/i,
};
const parseQuarterPatterns = {
any: [/1/i, /2/i, /3/i, /4/i],
};
const matchMonthPatterns = {
narrow: /^[jfmasond]/i,
abbreviated: /^(jan|feb|mars?|apr|mai|juni?|juli?|aug|sep|okt|nov|des)\.?/i,
wide: /^(januar|februar|mars|april|mai|juni|juli|august|september|oktober|november|desember)/i,
};
const parseMonthPatterns = {
narrow: [
/^j/i,
/^f/i,
/^m/i,
/^a/i,
/^m/i,
/^j/i,
/^j/i,
/^a/i,
/^s/i,
/^o/i,
/^n/i,
/^d/i,
],
any: [
/^ja/i,
/^f/i,
/^mar/i,
/^ap/i,
/^mai/i,
/^jun/i,
/^jul/i,
/^aug/i,
/^s/i,
/^o/i,
/^n/i,
/^d/i,
],
};
const matchDayPatterns = {
narrow: /^[smtofl]/i,
short: /^(su|må|ty|on|to|fr|la)/i,
abbreviated: /^(sun|mån|tys|ons|tor|fre|laur)/i,
wide: /^(sundag|måndag|tysdag|onsdag|torsdag|fredag|laurdag)/i,
};
const parseDayPatterns = {
any: [/^s/i, /^m/i, /^ty/i, /^o/i, /^to/i, /^f/i, /^l/i],
};
const matchDayPeriodPatterns = {
narrow: /^(midnatt|middag|(på) (morgonen|ettermiddagen|kvelden|natta)|[ap])/i,
any: /^([ap]\.?\s?m\.?|midnatt|middag|(på) (morgonen|ettermiddagen|kvelden|natta))/i,
};
const parseDayPeriodPatterns = {
any: {
am: /^a(\.?\s?m\.?)?$/i,
pm: /^p(\.?\s?m\.?)?$/i,
midnight: /^midn/i,
noon: /^midd/i,
morning: /morgon/i,
afternoon: /ettermiddag/i,
evening: /kveld/i,
night: /natt/i,
},
};
const match = (exports.match = {
ordinalNumber: (0, _index2.buildMatchPatternFn)({
matchPattern: matchOrdinalNumberPattern,
parsePattern: parseOrdinalNumberPattern,
valueCallback: (value) => parseInt(value, 10),
}),
era: (0, _index.buildMatchFn)({
matchPatterns: matchEraPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseEraPatterns,
defaultParseWidth: "any",
}),
quarter: (0, _index.buildMatchFn)({
matchPatterns: matchQuarterPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseQuarterPatterns,
defaultParseWidth: "any",
valueCallback: (index) => index + 1,
}),
month: (0, _index.buildMatchFn)({
matchPatterns: matchMonthPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseMonthPatterns,
defaultParseWidth: "any",
}),
day: (0, _index.buildMatchFn)({
matchPatterns: matchDayPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseDayPatterns,
defaultParseWidth: "any",
}),
dayPeriod: (0, _index.buildMatchFn)({
matchPatterns: matchDayPeriodPatterns,
defaultMatchWidth: "any",
parsePatterns: parseDayPeriodPatterns,
defaultParseWidth: "any",
}),
});

View File

@@ -0,0 +1 @@
{"version":3,"file":"getFallbackValue.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/beforeValidate/getFallbackValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAK/D,wBAAsB,gBAAgB,CAAC,EACrC,KAAK,EACL,GAAG,EACH,UAAU,GACX,EAAE;IACD,KAAK,EAAE,kBAAkB,CAAA;IACzB,GAAG,EAAE,cAAc,CAAA;IACnB,UAAU,EAAE,UAAU,CAAA;CACvB,GAAG,OAAO,CAAC,SAAS,CAAC,CAgBrB"}

View File

@@ -0,0 +1,276 @@
import assert from 'assert'
import { serialize } from './serializer'
import BufferList from './testing/buffer-list'
describe('serializer', () => {
it('builds startup message', function () {
const actual = serialize.startup({
user: 'brian',
database: 'bang',
})
assert.deepEqual(
actual,
new BufferList()
.addInt16(3)
.addInt16(0)
.addCString('user')
.addCString('brian')
.addCString('database')
.addCString('bang')
.addCString('client_encoding')
.addCString('UTF8')
.addCString('')
.join(true)
)
})
it('builds password message', function () {
const actual = serialize.password('!')
assert.deepEqual(actual, new BufferList().addCString('!').join(true, 'p'))
})
it('builds request ssl message', function () {
const actual = serialize.requestSsl()
const expected = new BufferList().addInt32(80877103).join(true)
assert.deepEqual(actual, expected)
})
it('builds SASLInitialResponseMessage message', function () {
const actual = serialize.sendSASLInitialResponseMessage('mech', 'data')
assert.deepEqual(actual, new BufferList().addCString('mech').addInt32(4).addString('data').join(true, 'p'))
})
it('builds SCRAMClientFinalMessage message', function () {
const actual = serialize.sendSCRAMClientFinalMessage('data')
assert.deepEqual(actual, new BufferList().addString('data').join(true, 'p'))
})
it('builds query message', function () {
const txt = 'select * from boom'
const actual = serialize.query(txt)
assert.deepEqual(actual, new BufferList().addCString(txt).join(true, 'Q'))
})
describe('parse message', () => {
it('builds parse message', function () {
const actual = serialize.parse({ text: '!' })
const expected = new BufferList().addCString('').addCString('!').addInt16(0).join(true, 'P')
assert.deepEqual(actual, expected)
})
it('builds parse message with named query', function () {
const actual = serialize.parse({
name: 'boom',
text: 'select * from boom',
types: [],
})
const expected = new BufferList().addCString('boom').addCString('select * from boom').addInt16(0).join(true, 'P')
assert.deepEqual(actual, expected)
})
it('with multiple parameters', function () {
const actual = serialize.parse({
name: 'force',
text: 'select * from bang where name = $1',
types: [1, 2, 3, 4],
})
const expected = new BufferList()
.addCString('force')
.addCString('select * from bang where name = $1')
.addInt16(4)
.addInt32(1)
.addInt32(2)
.addInt32(3)
.addInt32(4)
.join(true, 'P')
assert.deepEqual(actual, expected)
})
})
describe('bind messages', function () {
it('with no values', function () {
const actual = serialize.bind()
const expectedBuffer = new BufferList()
.addCString('')
.addCString('')
.addInt16(0)
.addInt16(0)
.addInt16(1)
.addInt16(0)
.join(true, 'B')
assert.deepEqual(actual, expectedBuffer)
})
it('with named statement, portal, and values', function () {
const actual = serialize.bind({
portal: 'bang',
statement: 'woo',
values: ['1', 'hi', null, 'zing'],
})
const expectedBuffer = new BufferList()
.addCString('bang') // portal name
.addCString('woo') // statement name
.addInt16(4)
.addInt16(0)
.addInt16(0)
.addInt16(0)
.addInt16(0)
.addInt16(4)
.addInt32(1)
.add(Buffer.from('1'))
.addInt32(2)
.add(Buffer.from('hi'))
.addInt32(-1)
.addInt32(4)
.add(Buffer.from('zing'))
.addInt16(1)
.addInt16(0)
.join(true, 'B')
assert.deepEqual(actual, expectedBuffer)
})
})
it('with custom valueMapper', function () {
const actual = serialize.bind({
portal: 'bang',
statement: 'woo',
values: ['1', 'hi', null, 'zing'],
valueMapper: () => null,
})
const expectedBuffer = new BufferList()
.addCString('bang') // portal name
.addCString('woo') // statement name
.addInt16(4)
.addInt16(0)
.addInt16(0)
.addInt16(0)
.addInt16(0)
.addInt16(4)
.addInt32(-1)
.addInt32(-1)
.addInt32(-1)
.addInt32(-1)
.addInt16(1)
.addInt16(0)
.join(true, 'B')
assert.deepEqual(actual, expectedBuffer)
})
it('with named statement, portal, and buffer value', function () {
const actual = serialize.bind({
portal: 'bang',
statement: 'woo',
values: ['1', 'hi', null, Buffer.from('zing', 'utf8')],
})
const expectedBuffer = new BufferList()
.addCString('bang') // portal name
.addCString('woo') // statement name
.addInt16(4) // value count
.addInt16(0) // string
.addInt16(0) // string
.addInt16(0) // string
.addInt16(1) // binary
.addInt16(4)
.addInt32(1)
.add(Buffer.from('1'))
.addInt32(2)
.add(Buffer.from('hi'))
.addInt32(-1)
.addInt32(4)
.add(Buffer.from('zing', 'utf-8'))
.addInt16(1)
.addInt16(0)
.join(true, 'B')
assert.deepEqual(actual, expectedBuffer)
})
describe('builds execute message', function () {
it('for unamed portal with no row limit', function () {
const actual = serialize.execute()
const expectedBuffer = new BufferList().addCString('').addInt32(0).join(true, 'E')
assert.deepEqual(actual, expectedBuffer)
})
it('for named portal with row limit', function () {
const actual = serialize.execute({
portal: 'my favorite portal',
rows: 100,
})
const expectedBuffer = new BufferList().addCString('my favorite portal').addInt32(100).join(true, 'E')
assert.deepEqual(actual, expectedBuffer)
})
})
it('builds flush command', function () {
const actual = serialize.flush()
const expected = new BufferList().join(true, 'H')
assert.deepEqual(actual, expected)
})
it('builds sync command', function () {
const actual = serialize.sync()
const expected = new BufferList().join(true, 'S')
assert.deepEqual(actual, expected)
})
it('builds end command', function () {
const actual = serialize.end()
const expected = Buffer.from([0x58, 0, 0, 0, 4])
assert.deepEqual(actual, expected)
})
describe('builds describe command', function () {
it('describe statement', function () {
const actual = serialize.describe({ type: 'S', name: 'bang' })
const expected = new BufferList().addChar('S').addCString('bang').join(true, 'D')
assert.deepEqual(actual, expected)
})
it('describe unnamed portal', function () {
const actual = serialize.describe({ type: 'P' })
const expected = new BufferList().addChar('P').addCString('').join(true, 'D')
assert.deepEqual(actual, expected)
})
})
describe('builds close command', function () {
it('describe statement', function () {
const actual = serialize.close({ type: 'S', name: 'bang' })
const expected = new BufferList().addChar('S').addCString('bang').join(true, 'C')
assert.deepEqual(actual, expected)
})
it('describe unnamed portal', function () {
const actual = serialize.close({ type: 'P' })
const expected = new BufferList().addChar('P').addCString('').join(true, 'C')
assert.deepEqual(actual, expected)
})
})
describe('copy messages', function () {
it('builds copyFromChunk', () => {
const actual = serialize.copyData(Buffer.from([1, 2, 3]))
const expected = new BufferList().add(Buffer.from([1, 2, 3])).join(true, 'd')
assert.deepEqual(actual, expected)
})
it('builds copy fail', () => {
const actual = serialize.copyFail('err!')
const expected = new BufferList().addCString('err!').join(true, 'f')
assert.deepEqual(actual, expected)
})
it('builds copy done', () => {
const actual = serialize.copyDone()
const expected = new BufferList().join(true, 'c')
assert.deepEqual(actual, expected)
})
})
it('builds cancel message', () => {
const actual = serialize.cancel(3, 4)
const expected = new BufferList().addInt16(1234).addInt16(5678).addInt32(3).addInt32(4).join(true)
assert.deepEqual(actual, expected)
})
})

View File

@@ -0,0 +1,10 @@
"use strict";
exports.setQuarter = void 0;
var _index = require("../setQuarter.cjs");
var _index2 = require("./_lib/convertToFP.cjs"); // This file is generated automatically by `scripts/build/fp.ts`. Please, don't change it.
const setQuarter = (exports.setQuarter = (0, _index2.convertToFP)(
_index.setQuarter,
2,
));

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"1":"A B","2":"F zC","8":"K D E"},B:{"1":"C L M G N O P Q H R S T","2":"0 1 2 3 4 5 6 7 8 U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB I"},C:{"1":"9 J bB K D E F A B C L M G N O P cB AB BB CB DB EB FB GB HB IB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B WC 6B XC 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC MC NC Q H R YC S 4C 5C","2":"0 1 2 3 4 5 6 7 8 T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB I ZC aC OC 1C 2C 3C","4":"VC","8":"0C"},D:{"1":"9 J bB K D E F A B C L M G N O P cB AB BB CB DB EB FB GB HB IB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B WC 6B XC 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC MC NC Q H R S T","2":"0 1 2 3 4 5 6 7 8 U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB I ZC aC OC"},E:{"1":"J bB K D E F A B C L M 7C 8C 9C AD cC PC QC BD CD","2":"G DD dC eC RC ED SC fC gC hC iC jC FD TC kC lC mC nC oC GD UC pC qC rC sC HD tC uC vC wC ID","8":"6C bC"},F:{"1":"9 B C G N O P cB AB BB CB DB EB FB GB HB IB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC MD PC xC ND QC","2":"0 1 2 3 4 5 6 7 8 F IC JC KC LC MC NC Q H R YC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z JD","8":"KD LD"},G:{"1":"E bC OD yC PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD eD fD gD","2":"hD dC eC RC iD SC fC gC hC iC jC jD TC kC lC mC nC oC kD UC pC qC rC sC lD tC uC vC wC"},H:{"2":"mD"},I:{"1":"VC J nD oD pD qD yC rD sD","2":"I"},J:{"1":"D A"},K:{"1":"B C PC xC QC","2":"A H"},L:{"2":"I"},M:{"2":"OC"},N:{"1":"A B"},O:{"1":"RC"},P:{"1":"9 J AB BB CB DB EB FB GB HB IB tD uD vD wD xD cC yD zD 0D 1D 2D SC TC UC 3D"},Q:{"1":"4D"},R:{"2":"5D"},S:{"1":"6D","2":"7D"}},B:7,C:"Offline web applications",D:true};

View File

@@ -0,0 +1,129 @@
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.mjs";
const eraValues = {
narrow: ["o.Kr.", "m.Kr."],
abbreviated: ["o.Kr.", "m.Kr."],
wide: ["ovdal Kristusa", "maŋŋel Kristusa"],
};
const quarterValues = {
narrow: ["1", "2", "3", "4"],
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
wide: ["1. kvartála", "2. kvartála", "3. kvartála", "4. kvartála"],
};
const monthValues = {
narrow: ["O", "G", "N", "C", "M", "G", "S", "B", "Č", "G", "S", "J"],
abbreviated: [
"ođđa",
"guov",
"njuk",
"cuo",
"mies",
"geas",
"suoi",
"borg",
"čakč",
"golg",
"skáb",
"juov",
],
wide: [
"ođđajagemánnu",
"guovvamánnu",
"njukčamánnu",
"cuoŋománnu",
"miessemánnu",
"geassemánnu",
"suoidnemánnu",
"borgemánnu",
"čakčamánnu",
"golggotmánnu",
"skábmamánnu",
"juovlamánnu",
],
};
const dayValues = {
narrow: ["S", "V", "M", "G", "D", "B", "L"],
short: ["sotn", "vuos", "maŋ", "gask", "duor", "bear", "láv"],
abbreviated: ["sotn", "vuos", "maŋ", "gask", "duor", "bear", "láv"],
wide: [
"sotnabeaivi",
"vuossárga",
"maŋŋebárga",
"gaskavahkku",
"duorastat",
"bearjadat",
"lávvardat",
],
};
const dayPeriodValues = {
narrow: {
am: "a",
pm: "p",
midnight: "gaskaidja",
noon: "gaskabeaivi",
morning: "iđđes",
afternoon: "maŋŋel gaska.",
evening: "eahkes",
night: "ihkku",
},
abbreviated: {
am: "a.m.",
pm: "p.m.",
midnight: "gaskaidja",
noon: "gaskabeaivvi",
morning: "iđđes",
afternoon: "maŋŋel gaskabea.",
evening: "eahkes",
night: "ihkku",
},
wide: {
am: "a.m.",
pm: "p.m.",
midnight: "gaskaidja",
noon: "gaskabeavvi",
morning: "iđđes",
afternoon: "maŋŋel gaskabeaivvi",
evening: "eahkes",
night: "ihkku",
},
};
const ordinalNumber = (dirtyNumber, _options) => {
const number = Number(dirtyNumber);
return number + ".";
};
export const localize = {
ordinalNumber,
era: buildLocalizeFn({
values: eraValues,
defaultWidth: "wide",
}),
quarter: buildLocalizeFn({
values: quarterValues,
defaultWidth: "wide",
argumentCallback: (quarter) => quarter - 1,
}),
month: buildLocalizeFn({
values: monthValues,
defaultWidth: "wide",
}),
day: buildLocalizeFn({
values: dayValues,
defaultWidth: "wide",
}),
dayPeriod: buildLocalizeFn({
values: dayPeriodValues,
defaultWidth: "wide",
}),
};

View File

@@ -0,0 +1,116 @@
import * as util from "../core/util.js";
const error = () => {
const Sizable = {
string: { unit: "caractères", verb: "avoir" },
file: { unit: "octets", verb: "avoir" },
array: { unit: "éléments", verb: "avoir" },
set: { unit: "éléments", verb: "avoir" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const parsedType = (data) => {
const t = typeof data;
switch (t) {
case "number": {
return Number.isNaN(data) ? "NaN" : "nombre";
}
case "object": {
if (Array.isArray(data)) {
return "tableau";
}
if (data === null) {
return "null";
}
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
return data.constructor.name;
}
}
}
return t;
};
const Nouns = {
regex: "entrée",
email: "adresse e-mail",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "date et heure ISO",
date: "date ISO",
time: "heure ISO",
duration: "durée ISO",
ipv4: "adresse IPv4",
ipv6: "adresse IPv6",
cidrv4: "plage IPv4",
cidrv6: "plage IPv6",
base64: "chaîne encodée en base64",
base64url: "chaîne encodée en base64url",
json_string: "chaîne JSON",
e164: "numéro E.164",
jwt: "JWT",
template_literal: "entrée",
};
return (issue) => {
switch (issue.code) {
case "invalid_type":
return `Entrée invalide : ${issue.expected} attendu, ${parsedType(issue.input)} reçu`;
case "invalid_value":
if (issue.values.length === 1)
return `Entrée invalide : ${util.stringifyPrimitive(issue.values[0])} attendu`;
return `Option invalide : une valeur parmi ${util.joinValues(issue.values, "|")} attendue`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Trop grand : ${issue.origin ?? "valeur"} doit ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "élément(s)"}`;
return `Trop grand : ${issue.origin ?? "valeur"} doit être ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Trop petit : ${issue.origin} doit ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
}
return `Trop petit : ${issue.origin} doit être ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `Chaîne invalide : doit commencer par "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Chaîne invalide : doit inclure "${_issue.includes}"`;
if (_issue.format === "regex")
return `Chaîne invalide : doit correspondre au modèle ${_issue.pattern}`;
return `${Nouns[_issue.format] ?? issue.format} invalide`;
}
case "not_multiple_of":
return `Nombre invalide : doit être un multiple de ${issue.divisor}`;
case "unrecognized_keys":
return `Clé${issue.keys.length > 1 ? "s" : ""} non reconnue${issue.keys.length > 1 ? "s" : ""} : ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Clé invalide dans ${issue.origin}`;
case "invalid_union":
return "Entrée invalide";
case "invalid_element":
return `Valeur invalide dans ${issue.origin}`;
default:
return `Entrée invalide`;
}
};
};
export default function () {
return {
localeError: error(),
};
}

View File

@@ -0,0 +1,20 @@
/**
* @license lucide-react v0.441.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const AlarmClock = createLucideIcon("AlarmClock", [
["circle", { cx: "12", cy: "13", r: "8", key: "3y4lt7" }],
["path", { d: "M12 9v4l2 2", key: "1c63tq" }],
["path", { d: "M5 3 2 6", key: "18tl5t" }],
["path", { d: "m22 6-3-3", key: "1opdir" }],
["path", { d: "M6.38 18.7 4 21", key: "17xu3x" }],
["path", { d: "M17.64 18.67 20 21", key: "kv2oe2" }]
]);
export { AlarmClock as default };
//# sourceMappingURL=alarm-clock.js.map

View File

@@ -0,0 +1,58 @@
import type { Cache } from "./cache/core/cache.cjs";
import type { AnyColumn } from "./column.cjs";
import type { Logger } from "./logger.cjs";
import { Param, SQL, View } from "./sql/sql.cjs";
import { Table } from "./table.cjs";
export declare function haveSameKeys(left: Record<string, unknown>, right: Record<string, unknown>): boolean;
export type UpdateSet = Record<string, SQL | Param | AnyColumn | null | undefined>;
export type OneOrMany<T> = T | T[];
export type Update<T, TUpdate> = {
[K in Exclude<keyof T, keyof TUpdate>]: T[K];
} & TUpdate;
export type Simplify<T> = {
[K in keyof T]: T[K];
} & {};
export type SimplifyMappedType<T> = [T] extends [unknown] ? T : never;
export type ShallowRecord<K extends keyof any, T> = SimplifyMappedType<{
[P in K]: T;
}>;
export type Assume<T, U> = T extends U ? T : U;
export type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
export interface DrizzleTypeError<T extends string> {
$drizzleTypeError: T;
}
export type ValueOrArray<T> = T | T[];
export type Or<T1, T2> = T1 extends true ? true : T2 extends true ? true : false;
export type IfThenElse<If, Then, Else> = If extends true ? Then : Else;
export type PromiseOf<T> = T extends Promise<infer U> ? U : T;
export type Writable<T> = {
-readonly [P in keyof T]: T[P];
};
export type NonArray<T> = T extends any[] ? never : T;
export declare function getTableColumns<T extends Table>(table: T): T['_']['columns'];
export declare function getViewSelectedFields<T extends View>(view: T): T['_']['selectedFields'];
export type ColumnsWithTable<TTableName extends string, TForeignTableName extends string, TColumns extends AnyColumn<{
tableName: TTableName;
}>[]> = {
[Key in keyof TColumns]: AnyColumn<{
tableName: TForeignTableName;
}>;
};
export type Casing = 'snake_case' | 'camelCase';
export interface DrizzleConfig<TSchema extends Record<string, unknown> = Record<string, never>> {
logger?: boolean | Logger;
schema?: TSchema;
casing?: Casing;
cache?: Cache;
}
export type ValidateShape<T, ValidShape, TResult = T> = T extends ValidShape ? Exclude<keyof T, keyof ValidShape> extends never ? TResult : DrizzleTypeError<`Invalid key(s): ${Exclude<(keyof T) & (string | number | bigint | boolean | null | undefined), keyof ValidShape>}`> : never;
export type KnownKeysOnly<T, U> = {
[K in keyof T]: K extends keyof U ? T[K] : never;
};
export type IsAny<T> = 0 extends (1 & T) ? true : false;
export type IfNotImported<T, Y, N> = unknown extends T ? Y : N;
export type ImportTypeError<TPackageName extends string> = `Please install \`${TPackageName}\` to allow Drizzle ORM to connect to the database`;
export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Keys extends any ? Required<Pick<T, Keys>> & Partial<Omit<T, Keys>> : never;
export declare function isConfig(data: any): boolean;
export type NeonAuthToken = string | (() => string | Promise<string>);
export declare const textDecoder: TextDecoder | null;

View File

@@ -0,0 +1,84 @@
import { numericPatterns } from "../constants.mjs";
import { Parser } from "../Parser.mjs";
import { mapValue, parseNDigits, parseNumericPattern } from "../utils.mjs";
export class StandAloneMonthParser extends Parser {
priority = 110;
parse(dateString, token, match) {
const valueCallback = (value) => value - 1;
switch (token) {
// 1, 2, ..., 12
case "L":
return mapValue(
parseNumericPattern(numericPatterns.month, dateString),
valueCallback,
);
// 01, 02, ..., 12
case "LL":
return mapValue(parseNDigits(2, dateString), valueCallback);
// 1st, 2nd, ..., 12th
case "Lo":
return mapValue(
match.ordinalNumber(dateString, {
unit: "month",
}),
valueCallback,
);
// Jan, Feb, ..., Dec
case "LLL":
return (
match.month(dateString, {
width: "abbreviated",
context: "standalone",
}) ||
match.month(dateString, { width: "narrow", context: "standalone" })
);
// J, F, ..., D
case "LLLLL":
return match.month(dateString, {
width: "narrow",
context: "standalone",
});
// January, February, ..., December
case "LLLL":
default:
return (
match.month(dateString, { width: "wide", context: "standalone" }) ||
match.month(dateString, {
width: "abbreviated",
context: "standalone",
}) ||
match.month(dateString, { width: "narrow", context: "standalone" })
);
}
}
validate(_date, value) {
return value >= 0 && value <= 11;
}
set(date, _flags, value) {
date.setMonth(value, 1);
date.setHours(0, 0, 0, 0);
return date;
}
incompatibleTokens = [
"Y",
"R",
"q",
"Q",
"M",
"w",
"I",
"D",
"i",
"e",
"c",
"t",
"T",
];
}

View File

@@ -0,0 +1,311 @@
import { captureException } from '../../exports.js';
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes.js';
import { SPAN_STATUS_ERROR } from '../spanstatus.js';
import { startSpanManual } from '../trace.js';
import { GEN_AI_TOOL_OUTPUT_ATTRIBUTE, GEN_AI_REQUEST_MODEL_ATTRIBUTE, GEN_AI_OPERATION_NAME_ATTRIBUTE, GEN_AI_TOOL_NAME_ATTRIBUTE, GEN_AI_TOOL_INPUT_ATTRIBUTE } from '../ai/gen-ai-attributes.js';
import { LANGCHAIN_ORIGIN } from './constants.js';
import { extractLlmResponseAttributes, getInvocationParams, extractChatModelRequestAttributes, extractLLMRequestAttributes } from './utils.js';
/**
* Creates a Sentry callback handler for LangChain
* Returns a plain object that LangChain will call via duck-typing
*
* This is a stateful handler that tracks spans across multiple LangChain executions.
*/
function createLangChainCallbackHandler(options = {}) {
const recordInputs = options.recordInputs ?? false;
const recordOutputs = options.recordOutputs ?? false;
// Internal state - single instance tracks all spans
const spanMap = new Map();
/**
* Exit a span and clean up
*/
const exitSpan = (runId) => {
const span = spanMap.get(runId);
if (span?.isRecording()) {
span.end();
spanMap.delete(runId);
}
};
/**
* Handler for LLM Start
* This handler will be called by LangChain's callback handler when an LLM event is detected.
*/
const handler = {
// Required LangChain BaseCallbackHandler properties
lc_serializable: false,
lc_namespace: ['langchain_core', 'callbacks', 'sentry'],
lc_secrets: undefined,
lc_attributes: undefined,
lc_aliases: undefined,
lc_serializable_keys: undefined,
lc_id: ['langchain_core', 'callbacks', 'sentry'],
lc_kwargs: {},
name: 'SentryCallbackHandler',
// BaseCallbackHandlerInput boolean flags
ignoreLLM: false,
ignoreChain: false,
ignoreAgent: false,
ignoreRetriever: false,
ignoreCustomEvent: false,
raiseError: false,
awaitHandlers: true,
handleLLMStart(
llm,
prompts,
runId,
_parentRunId,
_extraParams,
tags,
metadata,
_runName,
) {
const invocationParams = getInvocationParams(tags);
const attributes = extractLLMRequestAttributes(
llm ,
prompts,
recordInputs,
invocationParams,
metadata,
);
const modelName = attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE];
const operationName = attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE];
startSpanManual(
{
name: `${operationName} ${modelName}`,
op: 'gen_ai.chat',
attributes: {
...attributes,
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat',
},
},
span => {
spanMap.set(runId, span);
return span;
},
);
},
// Chat Model Start Handler
handleChatModelStart(
llm,
messages,
runId,
_parentRunId,
_extraParams,
tags,
metadata,
_runName,
) {
const invocationParams = getInvocationParams(tags);
const attributes = extractChatModelRequestAttributes(
llm ,
messages ,
recordInputs,
invocationParams,
metadata,
);
const modelName = attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE];
const operationName = attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE];
startSpanManual(
{
name: `${operationName} ${modelName}`,
op: 'gen_ai.chat',
attributes: {
...attributes,
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat',
},
},
span => {
spanMap.set(runId, span);
return span;
},
);
},
// LLM End Handler - note: handleLLMEnd with capital LLM (used by both LLMs and chat models!)
handleLLMEnd(
output,
runId,
_parentRunId,
_tags,
_extraParams,
) {
const span = spanMap.get(runId);
if (span?.isRecording()) {
const attributes = extractLlmResponseAttributes(output , recordOutputs);
if (attributes) {
span.setAttributes(attributes);
}
exitSpan(runId);
}
},
// LLM Error Handler - note: handleLLMError with capital LLM
handleLLMError(error, runId) {
const span = spanMap.get(runId);
if (span?.isRecording()) {
span.setStatus({ code: SPAN_STATUS_ERROR, message: 'llm_error' });
exitSpan(runId);
}
captureException(error, {
mechanism: {
handled: false,
type: `${LANGCHAIN_ORIGIN}.llm_error_handler`,
},
});
},
// Chain Start Handler
handleChainStart(chain, inputs, runId, _parentRunId) {
const chainName = chain.name || 'unknown_chain';
const attributes = {
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.langchain',
'langchain.chain.name': chainName,
};
// Add inputs if recordInputs is enabled
if (recordInputs) {
attributes['langchain.chain.inputs'] = JSON.stringify(inputs);
}
startSpanManual(
{
name: `chain ${chainName}`,
op: 'gen_ai.invoke_agent',
attributes: {
...attributes,
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.invoke_agent',
},
},
span => {
spanMap.set(runId, span);
return span;
},
);
},
// Chain End Handler
handleChainEnd(outputs, runId) {
const span = spanMap.get(runId);
if (span?.isRecording()) {
// Add outputs if recordOutputs is enabled
if (recordOutputs) {
span.setAttributes({
'langchain.chain.outputs': JSON.stringify(outputs),
});
}
exitSpan(runId);
}
},
// Chain Error Handler
handleChainError(error, runId) {
const span = spanMap.get(runId);
if (span?.isRecording()) {
span.setStatus({ code: SPAN_STATUS_ERROR, message: 'chain_error' });
exitSpan(runId);
}
captureException(error, {
mechanism: {
handled: false,
type: `${LANGCHAIN_ORIGIN}.chain_error_handler`,
},
});
},
// Tool Start Handler
handleToolStart(tool, input, runId, _parentRunId) {
const toolName = tool.name || 'unknown_tool';
const attributes = {
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGCHAIN_ORIGIN,
[GEN_AI_TOOL_NAME_ATTRIBUTE]: toolName,
};
// Add input if recordInputs is enabled
if (recordInputs) {
attributes[GEN_AI_TOOL_INPUT_ATTRIBUTE] = input;
}
startSpanManual(
{
name: `execute_tool ${toolName}`,
op: 'gen_ai.execute_tool',
attributes: {
...attributes,
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.execute_tool',
},
},
span => {
spanMap.set(runId, span);
return span;
},
);
},
// Tool End Handler
handleToolEnd(output, runId) {
const span = spanMap.get(runId);
if (span?.isRecording()) {
// Add output if recordOutputs is enabled
if (recordOutputs) {
span.setAttributes({
[GEN_AI_TOOL_OUTPUT_ATTRIBUTE]: JSON.stringify(output),
});
}
exitSpan(runId);
}
},
// Tool Error Handler
handleToolError(error, runId) {
const span = spanMap.get(runId);
if (span?.isRecording()) {
span.setStatus({ code: SPAN_STATUS_ERROR, message: 'tool_error' });
exitSpan(runId);
}
captureException(error, {
mechanism: {
handled: false,
type: `${LANGCHAIN_ORIGIN}.tool_error_handler`,
},
});
},
// LangChain BaseCallbackHandler required methods
copy() {
return handler;
},
toJSON() {
return {
lc: 1,
type: 'not_implemented',
id: handler.lc_id,
};
},
toJSONNotImplemented() {
return {
lc: 1,
type: 'not_implemented',
id: handler.lc_id,
};
},
};
return handler;
}
export { createLangChainCallbackHandler };
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"taskTypes.d.ts","sourceRoot":"","sources":["../../../../src/queues/config/types/taskTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,GAAG,EACH,YAAY,EACZ,cAAc,EACd,WAAW,EACX,SAAS,EACV,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE7E,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AACD,MAAM,MAAM,iBAAiB,CAC3B,sBAAsB,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,eAAe,IAEvE;IACE;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAA;CAChB,GACD;IACE,MAAM,EAAE,sBAAsB,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,GAC3D,SAAS,CAAC,OAAO,CAAC,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CAAC,GACpD,sBAAsB,SAAS,eAAe,GAC5C,sBAAsB,CAAC,QAAQ,CAAC,GAChC,KAAK,CAAA;IACX,KAAK,CAAC,EAAE,WAAW,CAAA;CACpB,CAAA;AAEL,MAAM,MAAM,eAAe,CACzB,sBAAsB,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,eAAe,EACzE,aAAa,SAAS,MAAM,SAAS,CAAC,WAAW,CAAC,GAAG,MAAM,IACzD;IACF;;OAEG;IACH,UAAU,EAAE,qBAAqB,CAAA;IACjC,KAAK,EAAE,sBAAsB,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,GAC1D,SAAS,CAAC,OAAO,CAAC,CAAC,sBAAsB,CAAC,CAAC,OAAO,CAAC,GACnD,sBAAsB,SAAS,eAAe,GAC5C,sBAAsB,CAAC,OAAO,CAAC,GAC/B,KAAK,CAAA;IACX,GAAG,EAAE,GAAG,CAAC,aAAa,CAAC,CAAA;IACvB,GAAG,EAAE,cAAc,CAAA;IACnB,KAAK,EAAE,gBAAgB,CAAA;CACxB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,CAAC,cAAc,SAAS,KAAK,GAAG,MAAM,GAAG,KAAK,IAAI;IAClF,GAAG,EAAE,GAAG,CAAC,cAAc,CAAC,CAAA;IACxB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,WAAW,CACrB,sBAAsB,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,eAAe,EACzE,aAAa,SAAS,MAAM,SAAS,CAAC,WAAW,CAAC,GAAG,MAAM,IACzD,CACF,IAAI,EAAE,eAAe,CAAC,sBAAsB,EAAE,aAAa,CAAC,KACzD,YAAY,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,CAAC,CAAA;AAE5D;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;AAGtD,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AAE1F,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;AAE5F,MAAM,MAAM,kBAAkB,GAAG;KAC9B,SAAS,IAAI,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG;QACvC,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAA;KAC3C;CACF,CAAA;AAGD,MAAM,MAAM,mBAAmB,CAAC,SAAS,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,IAAI;IAC5E,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,IAAI,CACxE,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,KACtC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAA;AAEnC,MAAM,MAAM,gBAAgB,GAAG;KAC5B,SAAS,IAAI,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,eAAe,CAAC,SAAS,CAAC;CACpE,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,CAAC,UAAU,SAAS,MAAM,EAAE,WAAW,SAAS,MAAM,EACxF,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE;IACR,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAA;IAE1C,IAAI,EAAE,CAAC,IAAI,EAAE;QACX,UAAU,EAAE,qBAAqB,CAAA;QACjC,KAAK,EAAE,UAAU,CAAA;QACjB,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAA;QACb,GAAG,EAAE,cAAc,CAAA;QACnB,KAAK,EAAE,gBAAgB,CAAA;KACxB,KAAK,YAAY,CACd;QACE;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB;;WAEG;QACH,KAAK,EAAE,QAAQ,CAAA;KAChB,GACD;QACE,MAAM,EAAE,WAAW,CAAA;QACnB,KAAK,CAAC,EAAE,WAAW,CAAA;KACpB,CACJ,CAAA;CACF,KACE,OAAO,CAAC,WAAW,CAAC,CAAA;AAEzB,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,GAAG,CAAA;IACR,GAAG,EAAE,cAAc,CAAA;IACnB,UAAU,EAAE,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAA;CAC5C,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,IAAI,EAAE;IAAE,UAAU,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CAAE,GAAG,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,KAClF,YAAY,CAAC,OAAO,CAAC,CAAA;AAC1B,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,gBAAgB,KAAK,YAAY,CAAC,IAAI,CAAC,CAAA;AAE3E,MAAM,MAAM,WAAW,GAAG;IACxB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,OAAO,CAAC,EAAE;QACR;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAA;QACd;;;;;;;;;;;;;;;;;;;;;WAqBG;QACH,IAAI,EAAE,aAAa,GAAG,OAAO,CAAA;KAC9B,CAAA;IACD;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,eAAe,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,UAAU,CACpB,sBAAsB,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,eAAe,GAAG,QAAQ,IAClF;IACF;;;;;OAKG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAC7B,sBAAsB,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,GACnD,SAAS,CAAC,OAAO,CAAC,CAAC,sBAAsB,CAAC,CAAC,OAAO,CAAC,GACnD,sBAAsB,SAAS,eAAe,GAC5C,sBAAsB,CAAC,OAAO,CAAC,GAC/B,MAAM,CACb,CAAA;IACD;;;;;;;OAOG;IACH,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC,sBAAsB,CAAC,CAAA;IACrD;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,EAAE,CAAA;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,EAAE,CAAA;IACtB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAA;IAC1C;;OAEG;IACH,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAA;IAC3B;;OAEG;IACH,IAAI,EAAE,sBAAsB,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,sBAAsB,GAAG,MAAM,CAAA;CAChG,CAAA"}

View File

@@ -0,0 +1,108 @@
import type { ColumnBuilderBaseConfig, ColumnDataType, HasDefault, IsPrimaryKey, MakeColumnConfig, NotNull } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import type { OnConflict } from "../utils.cjs";
import { type Equal, type Or } from "../../utils.cjs";
import type { AnySQLiteTable } from "../table.cjs";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.cjs";
export interface PrimaryKeyConfig {
autoIncrement?: boolean;
onConflict?: OnConflict;
}
export declare abstract class SQLiteBaseIntegerBuilder<T extends ColumnBuilderBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object> extends SQLiteColumnBuilder<T, TRuntimeConfig & {
autoIncrement: boolean;
}, {}, {
primaryKeyHasDefault: true;
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], dataType: T['dataType'], columnType: T['columnType']);
primaryKey(config?: PrimaryKeyConfig): IsPrimaryKey<HasDefault<NotNull<this>>>;
}
export declare abstract class SQLiteBaseInteger<T extends ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object> extends SQLiteColumn<T, TRuntimeConfig & {
autoIncrement: boolean;
}> {
static readonly [entityKind]: string;
readonly autoIncrement: boolean;
getSQLType(): string;
}
export type SQLiteIntegerBuilderInitial<TName extends string> = SQLiteIntegerBuilder<{
name: TName;
dataType: 'number';
columnType: 'SQLiteInteger';
data: number;
driverParam: number;
enumValues: undefined;
}>;
export declare class SQLiteIntegerBuilder<T extends ColumnBuilderBaseConfig<'number', 'SQLiteInteger'>> extends SQLiteBaseIntegerBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
build<TTableName extends string>(table: AnySQLiteTable<{
name: TTableName;
}>): SQLiteInteger<MakeColumnConfig<T, TTableName>>;
}
export declare class SQLiteInteger<T extends ColumnBaseConfig<'number', 'SQLiteInteger'>> extends SQLiteBaseInteger<T> {
static readonly [entityKind]: string;
}
export type SQLiteTimestampBuilderInitial<TName extends string> = SQLiteTimestampBuilder<{
name: TName;
dataType: 'date';
columnType: 'SQLiteTimestamp';
data: Date;
driverParam: number;
enumValues: undefined;
}>;
export declare class SQLiteTimestampBuilder<T extends ColumnBuilderBaseConfig<'date', 'SQLiteTimestamp'>> extends SQLiteBaseIntegerBuilder<T, {
mode: 'timestamp' | 'timestamp_ms';
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], mode: 'timestamp' | 'timestamp_ms');
/**
* @deprecated Use `default()` with your own expression instead.
*
* Adds `DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer))` to the column, which is the current epoch timestamp in milliseconds.
*/
defaultNow(): HasDefault<this>;
build<TTableName extends string>(table: AnySQLiteTable<{
name: TTableName;
}>): SQLiteTimestamp<MakeColumnConfig<T, TTableName>>;
}
export declare class SQLiteTimestamp<T extends ColumnBaseConfig<'date', 'SQLiteTimestamp'>> extends SQLiteBaseInteger<T, {
mode: 'timestamp' | 'timestamp_ms';
}> {
static readonly [entityKind]: string;
readonly mode: 'timestamp' | 'timestamp_ms';
mapFromDriverValue(value: number): Date;
mapToDriverValue(value: Date): number;
}
export type SQLiteBooleanBuilderInitial<TName extends string> = SQLiteBooleanBuilder<{
name: TName;
dataType: 'boolean';
columnType: 'SQLiteBoolean';
data: boolean;
driverParam: number;
enumValues: undefined;
}>;
export declare class SQLiteBooleanBuilder<T extends ColumnBuilderBaseConfig<'boolean', 'SQLiteBoolean'>> extends SQLiteBaseIntegerBuilder<T, {
mode: 'boolean';
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], mode: 'boolean');
build<TTableName extends string>(table: AnySQLiteTable<{
name: TTableName;
}>): SQLiteBoolean<MakeColumnConfig<T, TTableName>>;
}
export declare class SQLiteBoolean<T extends ColumnBaseConfig<'boolean', 'SQLiteBoolean'>> extends SQLiteBaseInteger<T, {
mode: 'boolean';
}> {
static readonly [entityKind]: string;
readonly mode: 'boolean';
mapFromDriverValue(value: number): boolean;
mapToDriverValue(value: boolean): number;
}
export interface IntegerConfig<TMode extends 'number' | 'timestamp' | 'timestamp_ms' | 'boolean' = 'number' | 'timestamp' | 'timestamp_ms' | 'boolean'> {
mode: TMode;
}
export declare function integer(): SQLiteIntegerBuilderInitial<''>;
export declare function integer<TMode extends IntegerConfig['mode']>(config?: IntegerConfig<TMode>): Or<Equal<TMode, 'timestamp'>, Equal<TMode, 'timestamp_ms'>> extends true ? SQLiteTimestampBuilderInitial<''> : Equal<TMode, 'boolean'> extends true ? SQLiteBooleanBuilderInitial<''> : SQLiteIntegerBuilderInitial<''>;
export declare function integer<TName extends string, TMode extends IntegerConfig['mode']>(name: TName, config?: IntegerConfig<TMode>): Or<Equal<TMode, 'timestamp'>, Equal<TMode, 'timestamp_ms'>> extends true ? SQLiteTimestampBuilderInitial<TName> : Equal<TMode, 'boolean'> extends true ? SQLiteBooleanBuilderInitial<TName> : SQLiteIntegerBuilderInitial<TName>;
export declare const int: typeof integer;

View File

@@ -0,0 +1,18 @@
/**
* @license lucide-react v0.441.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const SignalHigh = createLucideIcon("SignalHigh", [
["path", { d: "M2 20h.01", key: "4haj6o" }],
["path", { d: "M7 20v-4", key: "j294jx" }],
["path", { d: "M12 20v-8", key: "i3yub9" }],
["path", { d: "M17 20V8", key: "1tkaf5" }]
]);
export { SignalHigh as default };
//# sourceMappingURL=signal-high.js.map

View File

@@ -0,0 +1,159 @@
import { SPAN_STATUS_ERROR } from '../../tracing/spanstatus.js';
import { MCP_PROTOCOL_VERSION_ATTRIBUTE } from './attributes.js';
import { extractToolResultAttributes, extractPromptResultAttributes } from './resultExtraction.js';
import { extractSessionDataFromInitializeResponse, buildServerAttributesFromInfo } from './sessionExtraction.js';
/**
* Request-span correlation system for MCP server instrumentation
*
* Handles mapping requestId to span data for correlation with handler execution.
*
* Uses sessionId as the primary key for stateful transports. This handles the wrapper
* transport pattern (e.g., NodeStreamableHTTPServerTransport wrapping WebStandardStreamableHTTPServerTransport)
* where onmessage and send may receive different `this` values but share the same sessionId.
*
* Falls back to WeakMap by transport instance for stateless transports (no sessionId).
*/
/**
* Session-scoped correlation for stateful transports (with sessionId)
* @internal Using sessionId as key handles wrapper transport patterns where
* different transport objects share the same logical session
*/
const sessionToSpanMap = new Map();
/**
* Transport-scoped correlation fallback for stateless transports (no sessionId)
* @internal WeakMap allows automatic cleanup when transport is garbage collected
*/
const statelessSpanMap = new WeakMap();
/**
* Gets or creates the span map for a transport, using sessionId when available
* @internal
* @param transport - MCP transport instance
* @returns Span map for the transport/session
*/
function getOrCreateSpanMap(transport) {
const sessionId = transport.sessionId;
if (sessionId) {
// Stateful transport - use sessionId as key (handles wrapper pattern)
let spanMap = sessionToSpanMap.get(sessionId);
if (!spanMap) {
spanMap = new Map();
sessionToSpanMap.set(sessionId, spanMap);
}
return spanMap;
}
// Stateless fallback - use transport instance as key
let spanMap = statelessSpanMap.get(transport);
if (!spanMap) {
spanMap = new Map();
statelessSpanMap.set(transport, spanMap);
}
return spanMap;
}
/**
* Stores span context for later correlation with handler execution
* @param transport - MCP transport instance
* @param requestId - Request identifier
* @param span - Active span to correlate
* @param method - MCP method name
*/
function storeSpanForRequest(transport, requestId, span, method) {
const spanMap = getOrCreateSpanMap(transport);
spanMap.set(requestId, {
span,
method,
// eslint-disable-next-line @sentry-internal/sdk/no-unsafe-random-apis
startTime: Date.now(),
});
}
/**
* Completes span with results and cleans up correlation
* @param transport - MCP transport instance
* @param requestId - Request identifier
* @param result - Execution result for attribute extraction
* @param options - Resolved MCP options
*/
function completeSpanWithResults(
transport,
requestId,
result,
options,
) {
const spanMap = getOrCreateSpanMap(transport);
const spanData = spanMap.get(requestId);
if (spanData) {
const { span, method } = spanData;
if (method === 'initialize') {
const sessionData = extractSessionDataFromInitializeResponse(result);
const serverAttributes = buildServerAttributesFromInfo(sessionData.serverInfo);
const initAttributes = {
...serverAttributes,
};
if (sessionData.protocolVersion) {
initAttributes[MCP_PROTOCOL_VERSION_ATTRIBUTE] = sessionData.protocolVersion;
}
span.setAttributes(initAttributes);
} else if (method === 'tools/call') {
const toolAttributes = extractToolResultAttributes(result, options.recordOutputs);
span.setAttributes(toolAttributes);
} else if (method === 'prompts/get') {
const promptAttributes = extractPromptResultAttributes(result, options.recordOutputs);
span.setAttributes(promptAttributes);
}
span.end();
spanMap.delete(requestId);
}
}
/**
* Cleans up pending spans for a specific transport (when that transport closes)
* @param transport - MCP transport instance
*/
function cleanupPendingSpansForTransport(transport) {
const sessionId = transport.sessionId;
// Try sessionId-based cleanup first (for stateful transports)
if (sessionId) {
const spanMap = sessionToSpanMap.get(sessionId);
if (spanMap) {
for (const [, spanData] of spanMap) {
spanData.span.setStatus({
code: SPAN_STATUS_ERROR,
message: 'cancelled',
});
spanData.span.end();
}
sessionToSpanMap.delete(sessionId);
}
return;
}
// Fallback to transport-based cleanup (for stateless transports)
const spanMap = statelessSpanMap.get(transport);
if (spanMap) {
for (const [, spanData] of spanMap) {
spanData.span.setStatus({
code: SPAN_STATUS_ERROR,
message: 'cancelled',
});
spanData.span.end();
}
spanMap.clear();
// Note: WeakMap entries are automatically cleaned up when transport is GC'd
}
}
export { cleanupPendingSpansForTransport, completeSpanWithResults, storeSpanForRequest };
//# sourceMappingURL=correlation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"singleton.js","names":[],"sources":["../../../../src/rest/commands/update/singleton.ts"],"sourcesContent":["import type {\n\tApplyQueryFields,\n\tCollectionType,\n\tNestedPartial,\n\tQuery,\n\tSingletonCollections,\n} from '../../../types/index.js';\nimport type { RestCommand } from '../../types.js';\nimport { throwIfCoreCollection, throwIfEmpty } from '../../utils/index.js';\n\nexport type UpdateSingletonOutput<\n\tSchema,\n\tCollection extends SingletonCollections<Schema>,\n\tTQuery extends Query<Schema, Schema[Collection]>,\n> = ApplyQueryFields<Schema, CollectionType<Schema, Collection>, TQuery['fields']>;\n\n/**\n * Update a singleton item\n *\n * @param collection The collection of the items\n * @param query The query parameters\n *\n * @returns An array of up to limit item objects. If no items are available, data will be an empty array.\n * @throws Will throw if collection is a core collection\n * @throws Will throw if collection is empty\n */\nexport const updateSingleton =\n\t<\n\t\tSchema,\n\t\tCollection extends SingletonCollections<Schema>,\n\t\tconst TQuery extends Query<Schema, Schema[Collection]>,\n\t\tItem = Schema[Collection],\n\t>(\n\t\tcollection: Collection,\n\t\titem: NestedPartial<Item>,\n\t\tquery?: TQuery,\n\t): RestCommand<UpdateSingletonOutput<Schema, Collection, TQuery>, Schema> =>\n\t() => {\n\t\tthrowIfEmpty(String(collection), 'Collection cannot be empty');\n\t\tthrowIfCoreCollection(collection, 'Cannot use updateSingleton for core collections');\n\n\t\treturn {\n\t\t\tpath: `/items/${collection as string}`,\n\t\t\tparams: query ?? {},\n\t\t\tbody: JSON.stringify(item),\n\t\t\tmethod: 'PATCH',\n\t\t};\n\t};\n"],"mappings":"0IA0BA,MAAa,GAOX,EACA,EACA,SAGA,EAAa,OAAO,EAAW,CAAE,6BAA6B,CAC9D,EAAsB,EAAY,kDAAkD,CAE7E,CACN,KAAM,UAAU,IAChB,OAAQ,GAAS,EAAE,CACnB,KAAM,KAAK,UAAU,EAAK,CAC1B,OAAQ,QACR"}

Some files were not shown because too many files have changed in this diff Show More