fix(products): fix breadcrumbs and product filtering (backport from main)
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
@@ -0,0 +1 @@
{"version":3,"file":"ipAddress.d.ts","sourceRoot":"","sources":["../../../src/utils/ipAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAMhD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE;IAAE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAOrF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,GAAG,IAAI,CAapF"}
@@ -0,0 +1,2 @@
function _temporalUndefined() {}
export { _temporalUndefined as default };
@@ -0,0 +1,503 @@
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);}(function (_window$dateFns) {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/ko/_lib/formatDistance.mjs
var formatDistanceLocale = {
lessThanXSeconds: {
one: "1\uCD08 \uBBF8\uB9CC",
other: "{{count}}\uCD08 \uBBF8\uB9CC"
},
xSeconds: {
one: "1\uCD08",
other: "{{count}}\uCD08"
},
halfAMinute: "30\uCD08",
lessThanXMinutes: {
one: "1\uBD84 \uBBF8\uB9CC",
other: "{{count}}\uBD84 \uBBF8\uB9CC"
},
xMinutes: {
one: "1\uBD84",
other: "{{count}}\uBD84"
},
aboutXHours: {
one: "\uC57D 1\uC2DC\uAC04",
other: "\uC57D {{count}}\uC2DC\uAC04"
},
xHours: {
one: "1\uC2DC\uAC04",
other: "{{count}}\uC2DC\uAC04"
},
xDays: {
one: "1\uC77C",
other: "{{count}}\uC77C"
},
aboutXWeeks: {
one: "\uC57D 1\uC8FC",
other: "\uC57D {{count}}\uC8FC"
},
xWeeks: {
one: "1\uC8FC",
other: "{{count}}\uC8FC"
},
aboutXMonths: {
one: "\uC57D 1\uAC1C\uC6D4",
other: "\uC57D {{count}}\uAC1C\uC6D4"
},
xMonths: {
one: "1\uAC1C\uC6D4",
other: "{{count}}\uAC1C\uC6D4"
},
aboutXYears: {
one: "\uC57D 1\uB144",
other: "\uC57D {{count}}\uB144"
},
xYears: {
one: "1\uB144",
other: "{{count}}\uB144"
},
overXYears: {
one: "1\uB144 \uC774\uC0C1",
other: "{{count}}\uB144 \uC774\uC0C1"
},
almostXYears: {
one: "\uAC70\uC758 1\uB144",
other: "\uAC70\uC758 {{count}}\uB144"
}
};
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 result + " \uD6C4";
} else {
return result + " \uC804";
}
}
return result;
};
// lib/locale/_lib/buildFormatLongFn.mjs
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/ko/_lib/formatLong.mjs
var dateFormats = {
full: "y\uB144 M\uC6D4 d\uC77C EEEE",
long: "y\uB144 M\uC6D4 d\uC77C",
medium: "y.MM.dd",
short: "y.MM.dd"
};
var timeFormats = {
full: "a H\uC2DC mm\uBD84 ss\uCD08 zzzz",
long: "a H:mm:ss z",
medium: "HH:mm:ss",
short: "HH:mm"
};
var dateTimeFormats = {
full: "{{date}} {{time}}",
long: "{{date}} {{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/ko/_lib/formatRelative.mjs
var formatRelativeLocale = {
lastWeek: "'\uC9C0\uB09C' eeee p",
yesterday: "'\uC5B4\uC81C' p",
today: "'\uC624\uB298' p",
tomorrow: "'\uB0B4\uC77C' p",
nextWeek: "'\uB2E4\uC74C' eeee p",
other: "P"
};
var formatRelative = function formatRelative(token, _date, _baseDate, _options) {return formatRelativeLocale[token];};
// lib/locale/_lib/buildLocalizeFn.mjs
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/ko/_lib/localize.mjs
var eraValues = {
narrow: ["BC", "AD"],
abbreviated: ["BC", "AD"],
wide: ["\uAE30\uC6D0\uC804", "\uC11C\uAE30"]
};
var quarterValues = {
narrow: ["1", "2", "3", "4"],
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
wide: ["1\uBD84\uAE30", "2\uBD84\uAE30", "3\uBD84\uAE30", "4\uBD84\uAE30"]
};
var monthValues = {
narrow: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
abbreviated: [
"1\uC6D4",
"2\uC6D4",
"3\uC6D4",
"4\uC6D4",
"5\uC6D4",
"6\uC6D4",
"7\uC6D4",
"8\uC6D4",
"9\uC6D4",
"10\uC6D4",
"11\uC6D4",
"12\uC6D4"],
wide: [
"1\uC6D4",
"2\uC6D4",
"3\uC6D4",
"4\uC6D4",
"5\uC6D4",
"6\uC6D4",
"7\uC6D4",
"8\uC6D4",
"9\uC6D4",
"10\uC6D4",
"11\uC6D4",
"12\uC6D4"]
};
var dayValues = {
narrow: ["\uC77C", "\uC6D4", "\uD654", "\uC218", "\uBAA9", "\uAE08", "\uD1A0"],
short: ["\uC77C", "\uC6D4", "\uD654", "\uC218", "\uBAA9", "\uAE08", "\uD1A0"],
abbreviated: ["\uC77C", "\uC6D4", "\uD654", "\uC218", "\uBAA9", "\uAE08", "\uD1A0"],
wide: ["\uC77C\uC694\uC77C", "\uC6D4\uC694\uC77C", "\uD654\uC694\uC77C", "\uC218\uC694\uC77C", "\uBAA9\uC694\uC77C", "\uAE08\uC694\uC77C", "\uD1A0\uC694\uC77C"]
};
var dayPeriodValues = {
narrow: {
am: "\uC624\uC804",
pm: "\uC624\uD6C4",
midnight: "\uC790\uC815",
noon: "\uC815\uC624",
morning: "\uC544\uCE68",
afternoon: "\uC624\uD6C4",
evening: "\uC800\uB141",
night: "\uBC24"
},
abbreviated: {
am: "\uC624\uC804",
pm: "\uC624\uD6C4",
midnight: "\uC790\uC815",
noon: "\uC815\uC624",
morning: "\uC544\uCE68",
afternoon: "\uC624\uD6C4",
evening: "\uC800\uB141",
night: "\uBC24"
},
wide: {
am: "\uC624\uC804",
pm: "\uC624\uD6C4",
midnight: "\uC790\uC815",
noon: "\uC815\uC624",
morning: "\uC544\uCE68",
afternoon: "\uC624\uD6C4",
evening: "\uC800\uB141",
night: "\uBC24"
}
};
var formattingDayPeriodValues = {
narrow: {
am: "\uC624\uC804",
pm: "\uC624\uD6C4",
midnight: "\uC790\uC815",
noon: "\uC815\uC624",
morning: "\uC544\uCE68",
afternoon: "\uC624\uD6C4",
evening: "\uC800\uB141",
night: "\uBC24"
},
abbreviated: {
am: "\uC624\uC804",
pm: "\uC624\uD6C4",
midnight: "\uC790\uC815",
noon: "\uC815\uC624",
morning: "\uC544\uCE68",
afternoon: "\uC624\uD6C4",
evening: "\uC800\uB141",
night: "\uBC24"
},
wide: {
am: "\uC624\uC804",
pm: "\uC624\uD6C4",
midnight: "\uC790\uC815",
noon: "\uC815\uC624",
morning: "\uC544\uCE68",
afternoon: "\uC624\uD6C4",
evening: "\uC800\uB141",
night: "\uBC24"
}
};
var ordinalNumber = function ordinalNumber(dirtyNumber, options) {
var number = Number(dirtyNumber);
var unit = String(options === null || options === void 0 ? void 0 : options.unit);
switch (unit) {
case "minute":
case "second":
return String(number);
case "date":
return number + "\uC77C";
default:
return number + "\uBC88\uC9F8";
}
};
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.mjs
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 };
};
}
var findKey = function findKey(object, predicate) {
for (var key in object) {
if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
return key;
}
}
return;
};
var findIndex = function findIndex(array, predicate) {
for (var key = 0; key < array.length; key++) {
if (predicate(array[key])) {
return key;
}
}
return;
};
// lib/locale/_lib/buildMatchPatternFn.mjs
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/ko/_lib/match.mjs
var matchOrdinalNumberPattern = /^(\d+)(일|번째)?/i;
var parseOrdinalNumberPattern = /\d+/i;
var matchEraPatterns = {
narrow: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
wide: /^(기원전|서기)/i
};
var parseEraPatterns = {
any: [/^(bc|기원전)/i, /^(ad|서기)/i]
};
var matchQuarterPatterns = {
narrow: /^[1234]/i,
abbreviated: /^q[1234]/i,
wide: /^[1234]사?분기/i
};
var parseQuarterPatterns = {
any: [/1/i, /2/i, /3/i, /4/i]
};
var matchMonthPatterns = {
narrow: /^(1[012]|[123456789])/,
abbreviated: /^(1[012]|[123456789])월/i,
wide: /^(1[012]|[123456789])월/i
};
var parseMonthPatterns = {
any: [
/^1월?$/,
/^2/,
/^3/,
/^4/,
/^5/,
/^6/,
/^7/,
/^8/,
/^9/,
/^10/,
/^11/,
/^12/]
};
var matchDayPatterns = {
narrow: /^[일월화수목금토]/,
short: /^[일월화수목금토]/,
abbreviated: /^[일월화수목금토]/,
wide: /^[일월화수목금토]요일/
};
var parseDayPatterns = {
any: [/^일/, /^월/, /^화/, /^수/, /^목/, /^금/, /^토/]
};
var matchDayPeriodPatterns = {
any: /^(am|pm|오전|오후|자정|정오|아침|저녁|밤)/i
};
var parseDayPeriodPatterns = {
any: {
am: /^(am|오전)/i,
pm: /^(pm|오후)/i,
midnight: /^자정/i,
noon: /^정오/i,
morning: /^아침/i,
afternoon: /^오후/i,
evening: /^저녁/i,
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/ko.mjs
var ko = {
code: "ko",
formatDistance: formatDistance,
formatLong: formatLong,
formatRelative: formatRelative,
localize: localize,
match: match,
options: {
weekStartsOn: 0,
firstWeekContainsDate: 1
}
};
// lib/locale/ko/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), {}, {
ko: ko }) });
//# debugId=2E30D90C1FD3460164756e2164756e21
})();
//# sourceMappingURL=cdn.js.map
@@ -0,0 +1,29 @@
/**
* 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('./LexicalList.dev.mjs') : import('./LexicalList.prod.mjs'));
export const $createListItemNode = mod.$createListItemNode;
export const $createListNode = mod.$createListNode;
export const $getListDepth = mod.$getListDepth;
export const $handleListInsertParagraph = mod.$handleListInsertParagraph;
export const $insertList = mod.$insertList;
export const $isListItemNode = mod.$isListItemNode;
export const $isListNode = mod.$isListNode;
export const $removeList = mod.$removeList;
export const INSERT_CHECK_LIST_COMMAND = mod.INSERT_CHECK_LIST_COMMAND;
export const INSERT_ORDERED_LIST_COMMAND = mod.INSERT_ORDERED_LIST_COMMAND;
export const INSERT_UNORDERED_LIST_COMMAND = mod.INSERT_UNORDERED_LIST_COMMAND;
export const ListItemNode = mod.ListItemNode;
export const ListNode = mod.ListNode;
export const REMOVE_LIST_COMMAND = mod.REMOVE_LIST_COMMAND;
export const UPDATE_LIST_START_COMMAND = mod.UPDATE_LIST_START_COMMAND;
export const insertList = mod.insertList;
export const registerCheckList = mod.registerCheckList;
export const registerList = mod.registerList;
export const registerListStrictIndentTransform = mod.registerListStrictIndentTransform;
export const removeList = mod.removeList;
@@ -0,0 +1 @@
{"version":3,"file":"request.js","names":["result: { response: unknown; message: string; errors: any; data?: any }"],"sources":["../../src/utils/request.ts"],"sourcesContent":["import type { FetchInterface } from '../index.js';\nimport { extractData } from './extract-data.js';\n\n/**\n * Request helper providing default settings\n *\n * @param url The request URL\n * @param options The request options\n *\n * @returns The API result if successful\n */\nexport const request = async <Output = any>(\n\turl: string,\n\toptions: RequestInit,\n\tfetcher: FetchInterface = globalThis.fetch,\n): Promise<Output> => {\n\toptions.headers =\n\t\ttypeof options.headers === 'object' && !Array.isArray(options.headers)\n\t\t\t? (options.headers as Record<string, string>)\n\t\t\t: {};\n\n\treturn fetcher(url, options).then((response) => {\n\t\treturn extractData(response).catch((reason) => {\n\t\t\tconst result: { response: unknown; message: string; errors: any; data?: any } = {\n\t\t\t\tmessage: '',\n\t\t\t\terrors: reason && typeof reason === 'object' && 'errors' in reason ? reason.errors : reason,\n\t\t\t\tresponse,\n\t\t\t};\n\n\t\t\tif (reason && typeof reason === 'object' && 'data' in reason) result.data = reason.data;\n\n\t\t\tif (Array.isArray(result.errors) && result.errors[0]?.message) {\n\t\t\t\tresult.message = result.errors[0].message;\n\t\t\t}\n\n\t\t\treturn Promise.reject(result);\n\t\t});\n\t});\n};\n"],"mappings":"gDAWA,MAAa,EAAU,MACtB,EACA,EACA,EAA0B,WAAW,SAErC,EAAQ,QACP,OAAO,EAAQ,SAAY,UAAY,CAAC,MAAM,QAAQ,EAAQ,QAAQ,CAClE,EAAQ,QACT,EAAE,CAEC,EAAQ,EAAK,EAAQ,CAAC,KAAM,GAC3B,EAAY,EAAS,CAAC,MAAO,GAAW,CAC9C,IAAMA,EAA0E,CAC/E,QAAS,GACT,OAAQ,GAAU,OAAO,GAAW,UAAY,WAAY,EAAS,EAAO,OAAS,EACrF,WACA,CAQD,OANI,GAAU,OAAO,GAAW,UAAY,SAAU,IAAQ,EAAO,KAAO,EAAO,MAE/E,MAAM,QAAQ,EAAO,OAAO,EAAI,EAAO,OAAO,IAAI,UACrD,EAAO,QAAU,EAAO,OAAO,GAAG,SAG5B,QAAQ,OAAO,EAAO,EAC5B,CACD"}
@@ -0,0 +1,30 @@
var eq = require('./eq');
/**
* The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
* support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @returns {Array} Returns the new duplicate free array.
*/
function baseSortedUniq(array, iteratee) {
var index = -1,
length = array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
if (!index || !eq(computed, seen)) {
var seen = computed;
result[resIndex++] = value === 0 ? 0 : value;
}
}
return result;
}
module.exports = baseSortedUniq;
@@ -0,0 +1,39 @@
@import '../../../scss/styles.scss';
@layer payload-default {
.popup-button {
height: 100%;
color: currentColor;
padding: 0;
font-size: inherit;
line-height: inherit;
font-family: inherit;
border: 0;
cursor: pointer;
display: inline-flex;
&--background {
background: transparent;
}
&--size-xsmall {
padding: base(0.1);
}
&--size-small {
padding: base(0.2);
}
&--size-medium {
padding: base(0.3);
}
&--size-large {
padding: base(0.4);
}
&--disabled {
cursor: not-allowed;
}
}
}
@@ -0,0 +1,27 @@
/**
* @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 HousePlug = createLucideIcon("HousePlug", [
["path", { d: "M10 12V8.964", key: "1vll13" }],
["path", { d: "M14 12V8.964", key: "1x3qvg" }],
[
"path",
{ d: "M15 12a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-2a1 1 0 0 1 1-1z", key: "ppykja" }
],
[
"path",
{
d: "M8.5 21H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2h-5a2 2 0 0 1-2-2v-2",
key: "1gvg2z"
}
]
]);
export { HousePlug as default };
//# sourceMappingURL=house-plug.js.map
@@ -0,0 +1,2 @@
const e=(e,t=!1)=>()=>({method:`POST`,path:`/schema/diff`,params:t?{force:t}:{},body:JSON.stringify(e)});exports.schemaDiff=e;
//# sourceMappingURL=diff.cjs.map
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _classCheckPrivateStaticAccess;
var _assertClassBrand = require("assertClassBrand");
function _classCheckPrivateStaticAccess(receiver, classConstructor, returnValue) {
return _assertClassBrand(classConstructor, receiver, returnValue);
}
//# sourceMappingURL=classCheckPrivateStaticAccess.js.map
@@ -0,0 +1 @@
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './alias.ts';\nexport * from './column-builder.ts';\nexport * from './column.ts';\nexport * from './entity.ts';\nexport * from './errors.ts';\nexport * from './logger.ts';\nexport * from './operations.ts';\nexport * from './query-promise.ts';\nexport * from './relations.ts';\nexport * from './sql/index.ts';\nexport * from './subquery.ts';\nexport * from './table.ts';\nexport * from './utils.ts';\nexport * from './view-common.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,33 @@
var baseUpdate = require('./_baseUpdate'),
castFunction = require('./_castFunction');
/**
* This method is like `_.update` except that it accepts `customizer` which is
* invoked to produce the objects of `path`. If `customizer` returns `undefined`
* path creation is handled by the method instead. The `customizer` is invoked
* with three arguments: (nsValue, key, nsObject).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.6.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
* @param {Function} updater The function to produce the updated value.
* @param {Function} [customizer] The function to customize assigned values.
* @returns {Object} Returns `object`.
* @example
*
* var object = {};
*
* _.updateWith(object, '[0][1]', _.constant('a'), Object);
* // => { '0': { '1': 'a' } }
*/
function updateWith(object, path, updater, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined;
return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
}
module.exports = updateWith;
@@ -0,0 +1,51 @@
import { GraphQLScalarType, Kind } from 'graphql';
import { createGraphQLError } from '../error.js';
const validateTimeZone = (str, ast) => {
if (!(Intl === null || Intl === void 0 ? void 0 : Intl.DateTimeFormat().resolvedOptions().timeZone)) {
throw createGraphQLError('Time zones are not available in this environment', ast
? {
nodes: ast,
}
: undefined);
}
try {
Intl.DateTimeFormat(undefined, { timeZone: str });
return str;
}
catch (ex) {
if (ex instanceof RangeError) {
throw createGraphQLError(`Value is not a valid IANA time zone: ${str}`, ast
? {
nodes: ast,
}
: undefined);
}
else {
throw createGraphQLError('Could not validate time zone.', ast
? {
nodes: ast,
}
: undefined);
}
}
};
export const GraphQLTimeZone = /*#__PURE__*/ new GraphQLScalarType({
name: 'TimeZone',
description: 'A field whose value exists in the standard IANA Time Zone Database: https://www.iana.org/time-zones',
serialize: validateTimeZone,
parseValue: validateTimeZone,
parseLiteral(ast) {
if (ast.kind !== Kind.STRING) {
throw createGraphQLError(`Can only sanitize time zone strings, but got: ${ast.kind}`);
}
return validateTimeZone(ast.value);
},
extensions: {
codegenScalarType: 'string',
jsonSchema: {
title: 'TimeZone',
type: 'string',
pattern: '^(?:[A-Za-z0-9_]|(?:%[0-9A-Fa-f]{2}))+',
},
},
});
@@ -0,0 +1,12 @@
import { entityKind } from "../entity.js";
import { PgDatabase } from "../pg-core/db.js";
import { PgDialect } from "../pg-core/dialect.js";
import type { DrizzleConfig } from "../utils.js";
import { type PgRemoteQueryResultHKT } from "./session.js";
export declare class PgRemoteDatabase<TSchema extends Record<string, unknown> = Record<string, never>> extends PgDatabase<PgRemoteQueryResultHKT, TSchema> {
static readonly [entityKind]: string;
}
export type RemoteCallback = (sql: string, params: any[], method: 'all' | 'execute', typings?: any[]) => Promise<{
rows: any[];
}>;
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(callback: RemoteCallback, config?: DrizzleConfig<TSchema>, _dialect?: () => PgDialect): PgRemoteDatabase<TSchema>;
@@ -0,0 +1,75 @@
# pg-types
This is the code that turns all the raw text from postgres into JavaScript types for [node-postgres](https://github.com/brianc/node-postgres.git)
## use
This module is consumed and exported from the root `pg` object of node-postgres. To access it, do the following:
```js
var types = require('pg').types
```
Generally what you'll want to do is override how a specific data-type is parsed and turned into a JavaScript type. By default the PostgreSQL backend server returns everything as strings. Every data type corresponds to a unique `OID` within the server, and these `OIDs` are sent back with the query response. So, you need to match a particluar `OID` to a function you'd like to use to take the raw text input and produce a valid JavaScript object as a result. `null` values are never parsed.
Let's do something I commonly like to do on projects: return 64-bit integers `(int8)` as JavaScript integers. Because JavaScript doesn't have support for 64-bit integers node-postgres cannot confidently parse `int8` data type results as numbers because if you have a _huge_ number it will overflow and the result you'd get back from node-postgres would not be the result in the datbase. That would be a __very bad thing__ so node-postgres just returns `int8` results as strings and leaves the parsing up to you. Let's say that you know you don't and wont ever have numbers greater than `int4` in your database, but you're tired of recieving results from the `COUNT(*)` function as strings (because that function returns `int8`). You would do this:
```js
var types = require('pg').types
types.setTypeParser(20, function(val) {
return parseInt(val)
})
```
__boom__: now you get numbers instead of strings.
Just as another example -- not saying this is a good idea -- let's say you want to return all dates from your database as [moment](http://momentjs.com/docs/) objects. Okay, do this:
```js
var types = require('pg').types
var moment = require('moment')
var parseFn = function(val) {
return val === null ? null : moment(val)
}
types.setTypeParser(types.builtins.TIMESTAMPTZ, parseFn)
types.setTypeParser(types.builtins.TIMESTAMP, parseFn)
```
_note: I've never done that with my dates, and I'm not 100% sure moment can parse all the date strings returned from postgres. It's just an example!_
If you're thinking "gee, this seems pretty handy, but how can I get a list of all the OIDs in the database and what they correspond to?!?!?!" worry not:
```bash
$ psql -c "select typname, oid, typarray from pg_type order by oid"
```
If you want to find out the OID of a specific type:
```bash
$ psql -c "select typname, oid, typarray from pg_type where typname = 'daterange' order by oid"
```
:smile:
## license
The MIT License (MIT)
Copyright (c) 2014 Brian M. Carlson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -0,0 +1,31 @@
/**
* @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 Rat = createLucideIcon("Rat", [
[
"path",
{
d: "M17 5c0-1.7-1.3-3-3-3s-3 1.3-3 3c0 .8.3 1.5.8 2H11c-3.9 0-7 3.1-7 7c0 2.2 1.8 4 4 4",
key: "1wq71c"
}
],
[
"path",
{
d: "M16.8 3.9c.3-.3.6-.5 1-.7 1.5-.6 3.3.1 3.9 1.6.6 1.5-.1 3.3-1.6 3.9l1.6 2.8c.2.3.2.7.2 1-.2.8-.9 1.2-1.7 1.1 0 0-1.6-.3-2.7-.6H17c-1.7 0-3 1.3-3 3",
key: "1crdmb"
}
],
["path", { d: "M13.2 18a3 3 0 0 0-2.2-5", key: "1ol3lk" }],
["path", { d: "M13 22H4a2 2 0 0 1 0-4h12", key: "bt3f23" }],
["path", { d: "M16 9h.01", key: "1bdo4e" }]
]);
export { Rat as default };
//# sourceMappingURL=rat.js.map
@@ -0,0 +1,624 @@
import { IntegrationIndex } from './integration';
import { Scope } from './scope';
import { Breadcrumb, BreadcrumbHint, FetchBreadcrumbHint, XhrBreadcrumbHint } from './types-hoist/breadcrumb';
import { CheckIn, MonitorConfig } from './types-hoist/checkin';
import { EventDropReason, Outcome } from './types-hoist/clientreport';
import { DataCategory } from './types-hoist/datacategory';
import { DsnComponents } from './types-hoist/dsn';
import { DynamicSamplingContext, Envelope } from './types-hoist/envelope';
import { Event, EventHint } from './types-hoist/event';
import { EventProcessor } from './types-hoist/eventprocessor';
import { FeedbackEvent } from './types-hoist/feedback';
import { Integration } from './types-hoist/integration';
import { Log } from './types-hoist/log';
import { Metric } from './types-hoist/metric';
import { ClientOptions } from './types-hoist/options';
import { ParameterizedString } from './types-hoist/parameterize';
import { RequestEventData } from './types-hoist/request';
import { SdkMetadata } from './types-hoist/sdkmetadata';
import { Session, SessionAggregates } from './types-hoist/session';
import { SeverityLevel } from './types-hoist/severity';
import { Span, SpanAttributes, SpanContextData } from './types-hoist/span';
import { StartSpanOptions } from './types-hoist/startSpanOptions';
import { Transport, TransportMakeRequestResponse } from './types-hoist/transport';
/**
* Base implementation for all JavaScript SDK clients.
*
* Call the constructor with the corresponding options
* specific to the client subclass. To access these options later, use
* {@link Client.getOptions}.
*
* If a Dsn is specified in the options, it will be parsed and stored. Use
* {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is
* invalid, the constructor will throw a {@link SentryException}. Note that
* without a valid Dsn, the SDK will not send any events to Sentry.
*
* Before sending an event, it is passed through
* {@link Client._prepareEvent} to add SDK information and scope data
* (breadcrumbs and context). To add more custom information, override this
* method and extend the resulting prepared event.
*
* To issue automatically created events (e.g. via instrumentation), use
* {@link Client.captureEvent}. It will prepare the event and pass it through
* the callback lifecycle. To issue auto-breadcrumbs, use
* {@link Client.addBreadcrumb}.
*
* @example
* class NodeClient extends Client<NodeOptions> {
* public constructor(options: NodeOptions) {
* super(options);
* }
*
* // ...
* }
*/
export declare abstract class Client<O extends ClientOptions = ClientOptions> {
/** Options passed to the SDK. */
protected readonly _options: O;
/** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */
protected readonly _dsn?: DsnComponents;
protected readonly _transport?: Transport;
/** Array of set up integrations. */
protected _integrations: IntegrationIndex;
/** Number of calls being processed */
protected _numProcessing: number;
protected _eventProcessors: EventProcessor[];
/** Holds flushable */
private _outcomes;
private _hooks;
private _promiseBuffer;
/**
* Initializes this client instance.
*
* @param options Options for the client.
*/
protected constructor(options: O);
/**
* Captures an exception event and sends it to Sentry.
*
* Unlike `captureException` exported from every SDK, this method requires that you pass it the current scope.
*/
captureException(exception: unknown, hint?: EventHint, scope?: Scope): string;
/**
* Captures a message event and sends it to Sentry.
*
* Unlike `captureMessage` exported from every SDK, this method requires that you pass it the current scope.
*/
captureMessage(message: ParameterizedString, level?: SeverityLevel, hint?: EventHint, currentScope?: Scope): string;
/**
* Captures a manually created event and sends it to Sentry.
*
* Unlike `captureEvent` exported from every SDK, this method requires that you pass it the current scope.
*/
captureEvent(event: Event, hint?: EventHint, currentScope?: Scope): string;
/**
* Captures a session.
*/
captureSession(session: Session): void;
/**
* Create a cron monitor check in and send it to Sentry. This method is not available on all clients.
*
* @param checkIn An object that describes a check in.
* @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want
* to create a monitor automatically when sending a check in.
* @param scope An optional scope containing event metadata.
* @returns A string representing the id of the check in.
*/
captureCheckIn?(checkIn: CheckIn, monitorConfig?: MonitorConfig, scope?: Scope): string;
/**
* Get the current Dsn.
*/
getDsn(): DsnComponents | undefined;
/**
* Get the current options.
*/
getOptions(): O;
/**
* Get the SDK metadata.
* @see SdkMetadata
*/
getSdkMetadata(): SdkMetadata | undefined;
/**
* Returns the transport that is used by the client.
* Please note that the transport gets lazy initialized so it will only be there once the first event has been sent.
*/
getTransport(): Transport | undefined;
/**
* Wait for all events to be sent or the timeout to expire, whichever comes first.
*
* @param timeout Maximum time in ms the client should wait for events to be flushed. Omitting this parameter will
* cause the client to wait until all events are sent before resolving the promise.
* @returns A promise that will resolve with `true` if all events are sent before the timeout, or `false` if there are
* still events in the queue when the timeout is reached.
*/
flush(timeout?: number): PromiseLike<boolean>;
/**
* Flush the event queue and set the client to `enabled = false`. See {@link Client.flush}.
*
* @param {number} timeout Maximum time in ms the client should wait before shutting down. Omitting this parameter will cause
* the client to wait until all events are sent before disabling itself.
* @returns {Promise<boolean>} A promise which resolves to `true` if the flush completes successfully before the timeout, or `false` if
* it doesn't.
*/
close(timeout?: number): PromiseLike<boolean>;
/**
* Get all installed event processors.
*/
getEventProcessors(): EventProcessor[];
/**
* Adds an event processor that applies to any event processed by this client.
*/
addEventProcessor(eventProcessor: EventProcessor): void;
/**
* Initialize this client.
* Call this after the client was set on a scope.
*/
init(): void;
/**
* Gets an installed integration by its name.
*
* @returns {Integration|undefined} The installed integration or `undefined` if no integration with that `name` was installed.
*/
getIntegrationByName<T extends Integration = Integration>(integrationName: string): T | undefined;
/**
* Add an integration to the client.
* This can be used to e.g. lazy load integrations.
* In most cases, this should not be necessary,
* and you're better off just passing the integrations via `integrations: []` at initialization time.
* However, if you find the need to conditionally load & add an integration, you can use `addIntegration` to do so.
*/
addIntegration(integration: Integration): void;
/**
* Send a fully prepared event to Sentry.
*/
sendEvent(event: Event, hint?: EventHint): void;
/**
* Send a session or session aggregrates to Sentry.
*/
sendSession(session: Session | SessionAggregates): void;
/**
* Record on the client that an event got dropped (ie, an event that will not be sent to Sentry).
*/
recordDroppedEvent(reason: EventDropReason, category: DataCategory, count?: number): void;
/**
* Register a callback for whenever a span is started.
* Receives the span as argument.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'spanStart', callback: (span: Span) => void): () => void;
/**
* Register a callback before span sampling runs. Receives a `samplingDecision` object argument with a `decision`
* property that can be used to make a sampling decision that will be enforced, before any span sampling runs.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'beforeSampling', callback: (samplingData: {
spanAttributes: SpanAttributes;
spanName: string;
parentSampled?: boolean;
parentSampleRate?: number;
parentContext?: SpanContextData;
}, samplingDecision: {
decision: boolean;
}) => void): void;
/**
* Register a callback for after a span is ended.
* NOTE: The span cannot be mutated anymore in this callback.
* Receives the span as argument.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'spanEnd', callback: (span: Span) => void): () => void;
/**
* Register a callback for when an idle span is allowed to auto-finish.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'idleSpanEnableAutoFinish', callback: (span: Span) => void): () => void;
/**
* Register a callback for transaction start and finish.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'beforeEnvelope', callback: (envelope: Envelope) => void): () => void;
/**
* Register a callback that runs when stack frame metadata should be applied to an event.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'applyFrameMetadata', callback: (event: Event) => void): () => void;
/**
* Register a callback for before sending an event.
* This is called right before an event is sent and should not be used to mutate the event.
* Receives an Event & EventHint as arguments.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'beforeSendEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;
/**
* Register a callback for before sending a session or session aggregrates..
* Receives the session/aggregate as second argument.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'beforeSendSession', callback: (session: Session | SessionAggregates) => void): () => void;
/**
* Register a callback for preprocessing an event,
* before it is passed to (global) event processors.
* Receives an Event & EventHint as arguments.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'preprocessEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;
/**
* Register a callback for postprocessing an event,
* after it was passed to (global) event processors, before it is being sent.
* Receives an Event & EventHint as arguments.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'postprocessEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;
/**
* Register a callback for when an event has been sent.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'afterSendEvent', callback: (event: Event, sendResponse: TransportMakeRequestResponse) => void): () => void;
/**
* Register a callback before a breadcrumb is added.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'beforeAddBreadcrumb', callback: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void): () => void;
/**
* Register a callback when a DSC (Dynamic Sampling Context) is created.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext, rootSpan?: Span) => void): () => void;
/**
* Register a callback when a Feedback event has been prepared.
* This should be used to mutate the event. The options argument can hint
* about what kind of mutation it expects.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'beforeSendFeedback', callback: (feedback: FeedbackEvent, options?: {
includeReplay?: boolean;
}) => void): () => void;
/**
* Register a callback when the feedback widget is opened in a user's browser
*/
on(hook: 'openFeedbackWidget', callback: () => void): () => void;
/**
* A hook for the browser tracing integrations to trigger a span start for a page load.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'startPageLoadSpan', callback: (options: StartSpanOptions, traceOptions?: {
sentryTrace?: string | undefined;
baggage?: string | undefined;
}) => void): () => void;
/**
* A hook for the browser tracing integrations to trigger the end of a page load span.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'endPageloadSpan', callback: () => void): () => void;
/**
* A hook for the browser tracing integrations to trigger after the pageload span was started.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'afterStartPageLoadSpan', callback: (span: Span) => void): () => void;
/**
* A hook for triggering right before a navigation span is started.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'beforeStartNavigationSpan', callback: (options: StartSpanOptions, navigationOptions?: {
isRedirect?: boolean;
}) => void): () => void;
/**
* A hook for browser tracing integrations to trigger a span for a navigation.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'startNavigationSpan', callback: (options: StartSpanOptions, navigationOptions?: {
isRedirect?: boolean;
}) => void): () => void;
/**
* A hook for GraphQL client integration to enhance a span with request data.
* @returns A function that, when executed, removes the registered callback.
*/
on(hook: 'beforeOutgoingRequestSpan', callback: (span: Span, hint: XhrBreadcrumbHint | FetchBreadcrumbHint) => void): () => void;
/**
* A hook for GraphQL client integration to enhance a breadcrumb with request data.
* @returns A function that, when executed, removes the registered callback.
*/
on(hook: 'beforeOutgoingRequestBreadcrumb', callback: (breadcrumb: Breadcrumb, hint: XhrBreadcrumbHint | FetchBreadcrumbHint) => void): () => void;
/**
* A hook that is called when the client is flushing
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'flush', callback: () => void): () => void;
/**
* A hook that is called when the client is closing
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'close', callback: () => void): () => void;
/**
* A hook that is called before a log is captured. This hooks runs before `beforeSendLog` is fired.
*
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'beforeCaptureLog', callback: (log: Log) => void): () => void;
/**
* A hook that is called after a log is captured
*
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'afterCaptureLog', callback: (log: Log) => void): () => void;
/**
* A hook that is called when the client is flushing logs
*
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'flushLogs', callback: () => void): () => void;
/**
* A hook that is called after capturing a metric. This hooks runs after `beforeSendMetric` is fired.
*
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'afterCaptureMetric', callback: (metric: Metric) => void): () => void;
/**
* A hook that is called when the client is flushing metrics
*
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'flushMetrics', callback: () => void): () => void;
/**
* A hook that is called when a metric is processed before it is captured and before the `beforeSendMetric` callback is fired.
*
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'processMetric', callback: (metric: Metric) => void): () => void;
/**
* A hook that is called when a http server request is started.
* This hook is called after request isolation, but before the request is processed.
*
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'httpServerRequest', callback: (request: unknown, response: unknown, normalizedRequest: RequestEventData) => void): () => void;
/**
* A hook that is called when the UI Profiler should start profiling.
*
* This hook is called when running `Sentry.uiProfiler.startProfiler()`.
*
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'startUIProfiler', callback: () => void): () => void;
/**
* A hook that is called when the UI Profiler should stop profiling.
*
* This hook is called when running `Sentry.uiProfiler.stopProfiler()`.
*
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
on(hook: 'stopUIProfiler', callback: () => void): () => void;
/** Fire a hook whenever a span starts. */
emit(hook: 'spanStart', span: Span): void;
/** A hook that is called every time before a span is sampled. */
emit(hook: 'beforeSampling', samplingData: {
spanAttributes: SpanAttributes;
spanName: string;
parentSampled?: boolean;
parentSampleRate?: number;
parentContext?: SpanContextData;
}, samplingDecision: {
decision: boolean;
}): void;
/** Fire a hook whenever a span ends. */
emit(hook: 'spanEnd', span: Span): void;
/**
* Fire a hook indicating that an idle span is allowed to auto finish.
*/
emit(hook: 'idleSpanEnableAutoFinish', span: Span): void;
/**
* Fire a hook event for envelope creation and sending. Expects to be given an envelope as the
* second argument.
*/
emit(hook: 'beforeEnvelope', envelope: Envelope): void;
/**
* Fire a hook indicating that stack frame metadata should be applied to the event passed to the hook.
*/
emit(hook: 'applyFrameMetadata', event: Event): void;
/**
* Fire a hook event before sending an event.
* This is called right before an event is sent and should not be used to mutate the event.
* Expects to be given an Event & EventHint as the second/third argument.
*/
emit(hook: 'beforeSendEvent', event: Event, hint?: EventHint): void;
/**
* Fire a hook event before sending a session/aggregates.
* Expects to be given the prepared session/aggregates as second argument.
*/
emit(hook: 'beforeSendSession', session: Session | SessionAggregates): void;
/**
* Fire a hook event to process events before they are passed to (global) event processors.
* Expects to be given an Event & EventHint as the second/third argument.
*/
emit(hook: 'preprocessEvent', event: Event, hint?: EventHint): void;
/**
* Fire a hook event to process a user on an event before it is sent to Sentry, after all other processors have run.
* Expects to be given an Event & EventHint as the second/third argument.
*/
emit(hook: 'postprocessEvent', event: Event, hint?: EventHint): void;
/**
* Fire a hook event after sending an event. Expects to be given an Event as the
* second argument.
*/
emit(hook: 'afterSendEvent', event: Event, sendResponse: TransportMakeRequestResponse): void;
/**
* Fire a hook for when a breadcrumb is added. Expects the breadcrumb as second argument.
*/
emit(hook: 'beforeAddBreadcrumb', breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void;
/**
* Fire a hook for when a DSC (Dynamic Sampling Context) is created. Expects the DSC as second argument.
*/
emit(hook: 'createDsc', dsc: DynamicSamplingContext, rootSpan?: Span): void;
/**
* Fire a hook event for after preparing a feedback event. Events to be given
* a feedback event as the second argument, and an optional options object as
* third argument.
*/
emit(hook: 'beforeSendFeedback', feedback: FeedbackEvent, options?: {
includeReplay?: boolean;
}): void;
/**
* Fire a hook event for when the feedback widget is opened in a user's browser
*/
emit(hook: 'openFeedbackWidget'): void;
/**
* Emit a hook event for browser tracing integrations to trigger a span start for a page load.
*/
emit(hook: 'startPageLoadSpan', options: StartSpanOptions, traceOptions?: {
sentryTrace?: string | undefined;
baggage?: string | undefined;
}): void;
/**
* Emit a hook event for browser tracing integrations to trigger the end of a page load span.
*/
emit(hook: 'endPageloadSpan'): void;
/**
* Emit a hook event for browser tracing integrations to trigger aafter the pageload span was started.
*/
emit(hook: 'afterStartPageLoadSpan', span: Span): void;
/**
* Emit a hook event for triggering right before a navigation span is started.
*/
emit(hook: 'beforeStartNavigationSpan', options: StartSpanOptions, navigationOptions?: {
isRedirect?: boolean;
}): void;
/**
* Emit a hook event for browser tracing integrations to trigger a span for a navigation.
*/
emit(hook: 'startNavigationSpan', options: StartSpanOptions, navigationOptions?: {
isRedirect?: boolean;
}): void;
/**
* Emit a hook event for GraphQL client integration to enhance a span with request data.
*/
emit(hook: 'beforeOutgoingRequestSpan', span: Span, hint: XhrBreadcrumbHint | FetchBreadcrumbHint): void;
/**
* Emit a hook event for GraphQL client integration to enhance a breadcrumb with request data.
*/
emit(hook: 'beforeOutgoingRequestBreadcrumb', breadcrumb: Breadcrumb, hint: XhrBreadcrumbHint | FetchBreadcrumbHint): void;
/**
* Emit a hook event for client flush
*/
emit(hook: 'flush'): void;
/**
* Emit a hook event for client close
*/
emit(hook: 'close'): void;
/**
* Emit a hook event for client before capturing a log. This hooks runs before `beforeSendLog` is fired.
*/
emit(hook: 'beforeCaptureLog', log: Log): void;
/**
* Emit a hook event for client after capturing a log.
*/
emit(hook: 'afterCaptureLog', log: Log): void;
/**
* Emit a hook event for client flush logs
*/
emit(hook: 'flushLogs'): void;
/**
* Emit a hook event for client after capturing a metric.
*/
emit(hook: 'afterCaptureMetric', metric: Metric): void;
/**
* Emit a hook event for client flush metrics
*/
emit(hook: 'flushMetrics'): void;
/**
*
* Emit a hook event for client to process a metric before it is captured.
* This hook is called before the `beforeSendMetric` callback is fired.
*/
emit(hook: 'processMetric', metric: Metric): void;
/**
* Emit a hook event for client when a http server request is started.
* This hook is called after request isolation, but before the request is processed.
*/
emit(hook: 'httpServerRequest', request: unknown, response: unknown, normalizedRequest: RequestEventData): void;
/**
* Emit a hook event for starting the UI Profiler.
*/
emit(hook: 'startUIProfiler'): void;
/**
* Emit a hook event for stopping the UI Profiler.
*/
emit(hook: 'stopUIProfiler'): void;
/**
* Send an envelope to Sentry.
*/
sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse>;
/** Setup integrations for this client. */
protected _setupIntegrations(): void;
/** Updates existing session based on the provided event */
protected _updateSessionFromEvent(session: Session, event: Event): void;
/**
* Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying
* "no" (resolving to `false`) in order to give the client a chance to potentially finish first.
*
* @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not
* passing anything) will make the promise wait as long as it takes for processing to finish before resolving to
* `true`.
* @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and
* `false` otherwise
*/
protected _isClientDoneProcessing(timeout?: number): Promise<boolean>;
/** Determines whether this SDK is enabled and a transport is present. */
protected _isEnabled(): boolean;
/**
* Adds common information to events.
*
* The information includes release and environment from `options`,
* breadcrumbs and context (extra, tags and user) from the scope.
*
* Information that is already present in the event is never overwritten. For
* nested objects, such as the context, keys are merged.
*
* @param event The original event.
* @param hint May contain additional information about the original exception.
* @param currentScope A scope containing event metadata.
* @returns A new event with more information.
*/
protected _prepareEvent(event: Event, hint: EventHint, currentScope: Scope, isolationScope: Scope): PromiseLike<Event | null>;
/**
* Processes the event and logs an error in case of rejection
* @param event
* @param hint
* @param scope
*/
protected _captureEvent(event: Event, hint?: EventHint, currentScope?: Scope, isolationScope?: Scope): PromiseLike<string | undefined>;
/**
* Processes an event (either error or message) and sends it to Sentry.
*
* This also adds breadcrumbs and context information to the event. However,
* platform specific meta data (such as the User's IP address) must be added
* by the SDK implementor.
*
*
* @param event The event to send to Sentry.
* @param hint May contain additional information about the original exception.
* @param currentScope A scope containing event metadata.
* @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
*/
protected _processEvent(event: Event, hint: EventHint, currentScope: Scope, isolationScope: Scope): PromiseLike<Event>;
/**
* Occupies the client with processing and event
*/
protected _process<T>(taskProducer: () => PromiseLike<T>, dataCategory: DataCategory): void;
/**
* Clears outcomes on this client and returns them.
*/
protected _clearOutcomes(): Outcome[];
/**
* Sends client reports as an envelope.
*/
protected _flushOutcomes(): void;
/**
* Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
*/
abstract eventFromException(_exception: unknown, _hint?: EventHint): PromiseLike<Event>;
/**
* Creates an {@link Event} from primitive inputs to `captureMessage`.
*/
abstract eventFromMessage(_message: ParameterizedString, _level?: SeverityLevel, _hint?: EventHint): PromiseLike<Event>;
}
//# sourceMappingURL=client.d.ts.map
@@ -0,0 +1,95 @@
import type { BuildColumns, BuildExtraConfigColumns } from "../column-builder.cjs";
import { entityKind } from "../entity.cjs";
import { Table, type TableConfig as TableConfigBase, type UpdateTableConfig } from "../table.cjs";
import type { CheckBuilder } from "./checks.cjs";
import { type PgColumnsBuilders } from "./columns/all.cjs";
import type { PgColumn, PgColumnBuilderBase } from "./columns/common.cjs";
import type { ForeignKeyBuilder } from "./foreign-keys.cjs";
import type { AnyIndexBuilder } from "./indexes.cjs";
import type { PgPolicy } from "./policies.cjs";
import type { PrimaryKeyBuilder } from "./primary-keys.cjs";
import type { UniqueConstraintBuilder } from "./unique-constraint.cjs";
export type PgTableExtraConfigValue = AnyIndexBuilder | CheckBuilder | ForeignKeyBuilder | PrimaryKeyBuilder | UniqueConstraintBuilder | PgPolicy;
export type PgTableExtraConfig = Record<string, PgTableExtraConfigValue>;
export type TableConfig = TableConfigBase<PgColumn>;
export declare class PgTable<T extends TableConfig = TableConfig> extends Table<T> {
static readonly [entityKind]: string;
}
export type AnyPgTable<TPartial extends Partial<TableConfig> = {}> = PgTable<UpdateTableConfig<TableConfig, TPartial>>;
export type PgTableWithColumns<T extends TableConfig> = PgTable<T> & {
[Key in keyof T['columns']]: T['columns'][Key];
} & {
enableRLS: () => Omit<PgTableWithColumns<T>, 'enableRLS'>;
};
export interface PgTableFn<TSchema extends string | undefined = undefined> {
<TTableName extends string, TColumnsMap extends Record<string, PgColumnBuilderBase>>(name: TTableName, columns: TColumnsMap, extraConfig?: (self: BuildExtraConfigColumns<TTableName, TColumnsMap, 'pg'>) => PgTableExtraConfigValue[]): PgTableWithColumns<{
name: TTableName;
schema: TSchema;
columns: BuildColumns<TTableName, TColumnsMap, 'pg'>;
dialect: 'pg';
}>;
<TTableName extends string, TColumnsMap extends Record<string, PgColumnBuilderBase>>(name: TTableName, columns: (columnTypes: PgColumnsBuilders) => TColumnsMap, extraConfig?: (self: BuildExtraConfigColumns<TTableName, TColumnsMap, 'pg'>) => PgTableExtraConfigValue[]): PgTableWithColumns<{
name: TTableName;
schema: TSchema;
columns: BuildColumns<TTableName, TColumnsMap, 'pg'>;
dialect: 'pg';
}>;
/**
* @deprecated The third parameter of pgTable is changing and will only accept an array instead of an object
*
* @example
* Deprecated version:
* ```ts
* export const users = pgTable("users", {
* id: integer(),
* }, (t) => ({
* idx: index('custom_name').on(t.id)
* }));
* ```
*
* New API:
* ```ts
* export const users = pgTable("users", {
* id: integer(),
* }, (t) => [
* index('custom_name').on(t.id)
* ]);
* ```
*/
<TTableName extends string, TColumnsMap extends Record<string, PgColumnBuilderBase>>(name: TTableName, columns: TColumnsMap, extraConfig: (self: BuildExtraConfigColumns<TTableName, TColumnsMap, 'pg'>) => PgTableExtraConfig): PgTableWithColumns<{
name: TTableName;
schema: TSchema;
columns: BuildColumns<TTableName, TColumnsMap, 'pg'>;
dialect: 'pg';
}>;
/**
* @deprecated The third parameter of pgTable is changing and will only accept an array instead of an object
*
* @example
* Deprecated version:
* ```ts
* export const users = pgTable("users", {
* id: integer(),
* }, (t) => ({
* idx: index('custom_name').on(t.id)
* }));
* ```
*
* New API:
* ```ts
* export const users = pgTable("users", {
* id: integer(),
* }, (t) => [
* index('custom_name').on(t.id)
* ]);
* ```
*/
<TTableName extends string, TColumnsMap extends Record<string, PgColumnBuilderBase>>(name: TTableName, columns: (columnTypes: PgColumnsBuilders) => TColumnsMap, extraConfig: (self: BuildExtraConfigColumns<TTableName, TColumnsMap, 'pg'>) => PgTableExtraConfig): PgTableWithColumns<{
name: TTableName;
schema: TSchema;
columns: BuildColumns<TTableName, TColumnsMap, 'pg'>;
dialect: 'pg';
}>;
}
export declare const pgTable: PgTableFn;
export declare function pgTableCreator(customizeTableName: (name: string) => string): PgTableFn;
@@ -0,0 +1,16 @@
/**
* @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 Ear = createLucideIcon("Ear", [
["path", { d: "M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0", key: "1dfaln" }],
["path", { d: "M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4", key: "1qnva7" }]
]);
export { Ear as default };
//# sourceMappingURL=ear.js.map
@@ -0,0 +1 @@
{"version":3,"file":"parseRangeHeader.d.ts","sourceRoot":"","sources":["../../src/uploads/parseRangeHeader.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GACrC;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAA;AAEpC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,WAAW,GACZ,EAAE;IACD,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,IAAI,GAAG,MAAM,CAAA;CAC3B,GAAG,gBAAgB,CAgCnB"}
@@ -0,0 +1,18 @@
export type ViewHierarchyWindow = {
alpha: number;
height: number;
type: string;
visible: boolean;
width: number;
x: number;
y: number;
z?: number;
children?: ViewHierarchyWindow[];
depth?: number;
identifier?: string;
} & Record<string, string | number | boolean>;
export type ViewHierarchyData = {
rendering_system: string;
windows: ViewHierarchyWindow[];
};
//# sourceMappingURL=view-hierarchy.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"pause.js","sources":["../../../src/icons/pause.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Pause\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB4PSIxNCIgeT0iNCIgd2lkdGg9IjQiIGhlaWdodD0iMTYiIHJ4PSIxIiAvPgogIDxyZWN0IHg9IjYiIHk9IjQiIHdpZHRoPSI0IiBoZWlnaHQ9IjE2IiByeD0iMSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/pause\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 Pause = createLucideIcon('Pause', [\n ['rect', { x: '14', y: '4', width: '4', height: '16', rx: '1', key: 'zuxfzm' }],\n ['rect', { x: '6', y: '4', width: '4', height: '16', rx: '1', key: '1okwgv' }],\n]);\n\nexport default Pause;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,iBAAiB,OAAS,CAAA,CAAA,CAAA;AAAA,CAAA,CACtC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAG,MAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,QAAQ,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAG,KAAK,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,QAAQ,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC/E,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,43 @@
/**
* 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 type { LexicalEditor } from 'lexical';
import * as React from 'react';
export type ContentEditableElementProps = {
editor: LexicalEditor;
ariaActiveDescendant?: React.AriaAttributes['aria-activedescendant'];
ariaAutoComplete?: React.AriaAttributes['aria-autocomplete'];
ariaControls?: React.AriaAttributes['aria-controls'];
ariaDescribedBy?: React.AriaAttributes['aria-describedby'];
ariaErrorMessage?: React.AriaAttributes['aria-errormessage'];
ariaExpanded?: React.AriaAttributes['aria-expanded'];
ariaInvalid?: React.AriaAttributes['aria-invalid'];
ariaLabel?: React.AriaAttributes['aria-label'];
ariaLabelledBy?: React.AriaAttributes['aria-labelledby'];
ariaMultiline?: React.AriaAttributes['aria-multiline'];
ariaOwns?: React.AriaAttributes['aria-owns'];
ariaRequired?: React.AriaAttributes['aria-required'];
autoCapitalize?: HTMLDivElement['autocapitalize'];
'data-testid'?: string | null | undefined;
} & Omit<React.AllHTMLAttributes<HTMLDivElement>, 'placeholder'>;
export declare const ContentEditableElement: React.ForwardRefExoticComponent<{
editor: LexicalEditor;
ariaActiveDescendant?: React.AriaAttributes['aria-activedescendant'];
ariaAutoComplete?: React.AriaAttributes['aria-autocomplete'];
ariaControls?: React.AriaAttributes['aria-controls'];
ariaDescribedBy?: React.AriaAttributes['aria-describedby'];
ariaErrorMessage?: React.AriaAttributes['aria-errormessage'];
ariaExpanded?: React.AriaAttributes['aria-expanded'];
ariaInvalid?: React.AriaAttributes['aria-invalid'];
ariaLabel?: React.AriaAttributes['aria-label'];
ariaLabelledBy?: React.AriaAttributes['aria-labelledby'];
ariaMultiline?: React.AriaAttributes['aria-multiline'];
ariaOwns?: React.AriaAttributes['aria-owns'];
ariaRequired?: React.AriaAttributes['aria-required'];
autoCapitalize?: string | undefined;
'data-testid'?: string | null | undefined;
} & Omit<React.AllHTMLAttributes<HTMLDivElement>, "placeholder"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,60 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const node_path = require('node:path');
const core = require('@sentry/core');
/** normalizes Windows paths */
function normalizeWindowsPath(path) {
return path
.replace(/^[A-Z]:/, '') // remove Windows-style prefix
.replace(/\\/g, '/'); // replace all `\` instances with `/`
}
/** Creates a function that gets the module name from a filename */
function createGetModuleFromFilename(
basePath = process.argv[1] ? core.dirname(process.argv[1]) : process.cwd(),
isWindows = node_path.sep === '\\',
) {
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
return (filename) => {
if (!filename) {
return;
}
const normalizedFilename = isWindows ? normalizeWindowsPath(filename) : filename;
// eslint-disable-next-line prefer-const
let { dir, base: file, ext } = node_path.posix.parse(normalizedFilename);
if (ext === '.js' || ext === '.mjs' || ext === '.cjs') {
file = file.slice(0, ext.length * -1);
}
// The file name might be URI-encoded which we want to decode to
// the original file name.
const decodedFile = decodeURIComponent(file);
if (!dir) {
// No dirname whatsoever
dir = '.';
}
const n = dir.lastIndexOf('/node_modules');
if (n > -1) {
return `${dir.slice(n + 14).replace(/\//g, '.')}:${decodedFile}`;
}
// Let's see if it's a part of the main module
// To be a part of main module, it has to share the same base
if (dir.startsWith(normalizedBase)) {
const moduleName = dir.slice(normalizedBase.length + 1).replace(/\//g, '.');
return moduleName ? `${moduleName}:${decodedFile}` : decodedFile;
}
return decodedFile;
};
}
exports.createGetModuleFromFilename = createGetModuleFromFilename;
//# sourceMappingURL=module.js.map
@@ -0,0 +1,24 @@
"use strict";
exports.hoursToSeconds = hoursToSeconds;
var _index = require("./constants.cjs");
/**
* @name hoursToSeconds
* @category Conversion Helpers
* @summary Convert hours to seconds.
*
* @description
* Convert a number of hours to a full number of seconds.
*
* @param hours - The number of hours to be converted
*
* @returns The number of hours converted in seconds
*
* @example
* // Convert 2 hours to seconds:
* const result = hoursToSeconds(2)
* //=> 7200
*/
function hoursToSeconds(hours) {
return Math.trunc(hours * _index.secondsInHour);
}
@@ -0,0 +1,21 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _addEventListener = _interopRequireDefault(require("./addEventListener"));
var _removeEventListener = _interopRequireDefault(require("./removeEventListener"));
function listen(node, eventName, handler, options) {
(0, _addEventListener.default)(node, eventName, handler, options);
return function () {
(0, _removeEventListener.default)(node, eventName, handler, options);
};
}
var _default = listen;
exports.default = _default;
module.exports = exports["default"];
@@ -0,0 +1,26 @@
import { toDate } from "./toDate.js";
/**
* @name isPast
* @category Common Helpers
* @summary Is the given date in the past?
* @pure false
*
* @description
* Is the given date in the past?
*
* @param date - The date to check
*
* @returns The date is in the past
*
* @example
* // If today is 6 October 2014, is 2 July 2014 in the past?
* const result = isPast(new Date(2014, 6, 2))
* //=> true
*/
export function isPast(date) {
return +toDate(date) < Date.now();
}
// Fallback for modularized imports:
export default isPast;
@@ -0,0 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ export { };
//# sourceMappingURL=RichText.js.map
@@ -0,0 +1,5 @@
import REGEX from './regex.js';
function validate(uuid) {
return typeof uuid === 'string' && REGEX.test(uuid);
}
export default validate;
@@ -0,0 +1,6 @@
export declare const intlFormat: import("./types.js").FPFn3<
string,
import("../intlFormat.js").IntlFormatLocaleOptions,
Intl.DateTimeFormatOptions,
string | number | Date
>;
@@ -0,0 +1,59 @@
import { type QueryResult, type QueryResultRow, type VercelClient, VercelPool, type VercelPoolClient } from '@vercel/postgres';
import type { Cache } from "../cache/core/cache.js";
import type { WithCacheConfig } from "../cache/core/types.js";
import { entityKind } from "../entity.js";
import { type Logger } from "../logger.js";
import { type PgDialect, PgTransaction } from "../pg-core/index.js";
import type { SelectedFieldsOrdered } from "../pg-core/query-builders/select.types.js";
import type { PgQueryResultHKT, PgTransactionConfig, PreparedQueryConfig } from "../pg-core/session.js";
import { PgPreparedQuery, PgSession } from "../pg-core/session.js";
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.js";
import { type Query, type SQL } from "../sql/sql.js";
import { type Assume } from "../utils.js";
export type VercelPgClient = VercelPool | VercelClient | VercelPoolClient;
export declare class VercelPgPreparedQuery<T extends PreparedQueryConfig> extends PgPreparedQuery<T> {
private client;
private params;
private logger;
private fields;
private _isResponseInArrayMode;
private customResultMapper?;
static readonly [entityKind]: string;
private rawQuery;
private queryConfig;
constructor(client: VercelPgClient, queryString: string, params: unknown[], logger: Logger, cache: Cache, queryMetadata: {
type: 'select' | 'update' | 'delete' | 'insert';
tables: string[];
} | undefined, cacheConfig: WithCacheConfig | undefined, fields: SelectedFieldsOrdered | undefined, name: string | undefined, _isResponseInArrayMode: boolean, customResultMapper?: ((rows: unknown[][]) => T["execute"]) | undefined);
execute(placeholderValues?: Record<string, unknown> | undefined): Promise<T['execute']>;
all(placeholderValues?: Record<string, unknown> | undefined): Promise<T['all']>;
values(placeholderValues?: Record<string, unknown> | undefined): Promise<T['values']>;
}
export interface VercelPgSessionOptions {
logger?: Logger;
cache?: Cache;
}
export declare class VercelPgSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgSession<VercelPgQueryResultHKT, TFullSchema, TSchema> {
private client;
private schema;
private options;
static readonly [entityKind]: string;
private logger;
private cache;
constructor(client: VercelPgClient, dialect: PgDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: VercelPgSessionOptions);
prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, name: string | undefined, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][]) => T['execute'], queryMetadata?: {
type: 'select' | 'update' | 'delete' | 'insert';
tables: string[];
}, cacheConfig?: WithCacheConfig): PgPreparedQuery<T>;
query(query: string, params: unknown[]): Promise<QueryResult>;
queryObjects<T extends QueryResultRow>(query: string, params: unknown[]): Promise<QueryResult<T>>;
count(sql: SQL): Promise<number>;
transaction<T>(transaction: (tx: VercelPgTransaction<TFullSchema, TSchema>) => Promise<T>, config?: PgTransactionConfig | undefined): Promise<T>;
}
export declare class VercelPgTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgTransaction<VercelPgQueryResultHKT, TFullSchema, TSchema> {
static readonly [entityKind]: string;
transaction<T>(transaction: (tx: VercelPgTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
}
export interface VercelPgQueryResultHKT extends PgQueryResultHKT {
type: QueryResult<Assume<this['row'], QueryResultRow>>;
}
@@ -0,0 +1,399 @@
import { createReadStream } from 'node:fs';
import { createInterface } from 'node:readline';
import { LRUMap, defineIntegration, debug, snipLine } from '@sentry/core';
import { DEBUG_BUILD } from '../debug-build.js';
const LRU_FILE_CONTENTS_CACHE = new LRUMap(10);
const LRU_FILE_CONTENTS_FS_READ_FAILED = new LRUMap(20);
const DEFAULT_LINES_OF_CONTEXT = 7;
const INTEGRATION_NAME = 'ContextLines';
// Determines the upper bound of lineno/colno that we will attempt to read. Large colno values are likely to be
// minified code while large lineno values are likely to be bundled code.
// Exported for testing purposes.
const MAX_CONTEXTLINES_COLNO = 1000;
const MAX_CONTEXTLINES_LINENO = 10000;
/**
* Get or init map value
*/
function emplace(map, key, contents) {
const value = map.get(key);
if (value === undefined) {
map.set(key, contents);
return contents;
}
return value;
}
/**
* Determines if context lines should be skipped for a file.
* - .min.(mjs|cjs|js) files are and not useful since they dont point to the original source
* - node: prefixed modules are part of the runtime and cannot be resolved to a file
* - data: skip json, wasm and inline js https://nodejs.org/api/esm.html#data-imports
*/
function shouldSkipContextLinesForFile(path) {
// Test the most common prefix and extension first. These are the ones we
// are most likely to see in user applications and are the ones we can break out of first.
if (path.startsWith('node:')) return true;
if (path.endsWith('.min.js')) return true;
if (path.endsWith('.min.cjs')) return true;
if (path.endsWith('.min.mjs')) return true;
if (path.startsWith('data:')) return true;
return false;
}
/**
* Determines if we should skip contextlines based off the max lineno and colno values.
*/
function shouldSkipContextLinesForFrame(frame) {
if (frame.lineno !== undefined && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
if (frame.colno !== undefined && frame.colno > MAX_CONTEXTLINES_COLNO) return true;
return false;
}
/**
* Checks if we have all the contents that we need in the cache.
*/
function rangeExistsInContentCache(file, range) {
const contents = LRU_FILE_CONTENTS_CACHE.get(file);
if (contents === undefined) return false;
for (let i = range[0]; i <= range[1]; i++) {
if (contents[i] === undefined) {
return false;
}
}
return true;
}
/**
* Creates contiguous ranges of lines to read from a file. In the case where context lines overlap,
* the ranges are merged to create a single range.
*/
function makeLineReaderRanges(lines, linecontext) {
if (!lines.length) {
return [];
}
let i = 0;
const line = lines[0];
if (typeof line !== 'number') {
return [];
}
let current = makeContextRange(line, linecontext);
const out = [];
// eslint-disable-next-line no-constant-condition
while (true) {
if (i === lines.length - 1) {
out.push(current);
break;
}
// If the next line falls into the current range, extend the current range to lineno + linecontext.
const next = lines[i + 1];
if (typeof next !== 'number') {
break;
}
if (next <= current[1]) {
current[1] = next + linecontext;
} else {
out.push(current);
current = makeContextRange(next, linecontext);
}
i++;
}
return out;
}
/**
* Extracts lines from a file and stores them in a cache.
*/
function getContextLinesFromFile(path, ranges, output) {
return new Promise((resolve, _reject) => {
// It is important *not* to have any async code between createInterface and the 'line' event listener
// as it will cause the 'line' event to
// be emitted before the listener is attached.
const stream = createReadStream(path);
const lineReaded = createInterface({
input: stream,
});
// We need to explicitly destroy the stream to prevent memory leaks,
// removing the listeners on the readline interface is not enough.
// See: https://github.com/nodejs/node/issues/9002 and https://github.com/getsentry/sentry-javascript/issues/14892
function destroyStreamAndResolve() {
stream.destroy();
resolve();
}
// Init at zero and increment at the start of the loop because lines are 1 indexed.
let lineNumber = 0;
let currentRangeIndex = 0;
const range = ranges[currentRangeIndex];
if (range === undefined) {
// We should never reach this point, but if we do, we should resolve the promise to prevent it from hanging.
destroyStreamAndResolve();
return;
}
let rangeStart = range[0];
let rangeEnd = range[1];
// We use this inside Promise.all, so we need to resolve the promise even if there is an error
// to prevent Promise.all from short circuiting the rest.
function onStreamError(e) {
// Mark file path as failed to read and prevent multiple read attempts.
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path, 1);
DEBUG_BUILD && debug.error(`Failed to read file: ${path}. Error: ${e}`);
lineReaded.close();
lineReaded.removeAllListeners();
destroyStreamAndResolve();
}
// We need to handle the error event to prevent the process from crashing in < Node 16
// https://github.com/nodejs/node/pull/31603
stream.on('error', onStreamError);
lineReaded.on('error', onStreamError);
lineReaded.on('close', destroyStreamAndResolve);
lineReaded.on('line', line => {
lineNumber++;
if (lineNumber < rangeStart) return;
// !Warning: This mutates the cache by storing the snipped line into the cache.
output[lineNumber] = snipLine(line, 0);
if (lineNumber >= rangeEnd) {
if (currentRangeIndex === ranges.length - 1) {
// We need to close the file stream and remove listeners, else the reader will continue to run our listener;
lineReaded.close();
lineReaded.removeAllListeners();
return;
}
currentRangeIndex++;
const range = ranges[currentRangeIndex];
if (range === undefined) {
// This should never happen as it means we have a bug in the context.
lineReaded.close();
lineReaded.removeAllListeners();
return;
}
rangeStart = range[0];
rangeEnd = range[1];
}
});
});
}
/**
* Adds surrounding (context) lines of the line that an exception occurred on to the event.
* This is done by reading the file line by line and extracting the lines. The extracted lines are stored in
* a cache to prevent multiple reads of the same file. Failures to read a file are similarly cached to prevent multiple
* failing reads from happening.
*/
/* eslint-disable complexity */
async function addSourceContext(event, contextLines) {
// keep a lookup map of which files we've already enqueued to read,
// so we don't enqueue the same file multiple times which would cause multiple i/o reads
const filesToLines = {};
if (contextLines > 0 && event.exception?.values) {
for (const exception of event.exception.values) {
if (!exception.stacktrace?.frames?.length) {
continue;
}
// Maps preserve insertion order, so we iterate in reverse, starting at the
// outermost frame and closer to where the exception has occurred (poor mans priority)
for (let i = exception.stacktrace.frames.length - 1; i >= 0; i--) {
const frame = exception.stacktrace.frames[i];
const filename = frame?.filename;
if (
!frame ||
typeof filename !== 'string' ||
typeof frame.lineno !== 'number' ||
shouldSkipContextLinesForFile(filename) ||
shouldSkipContextLinesForFrame(frame)
) {
continue;
}
const filesToLinesOutput = filesToLines[filename];
if (!filesToLinesOutput) filesToLines[filename] = [];
// @ts-expect-error this is defined above
filesToLines[filename].push(frame.lineno);
}
}
}
const files = Object.keys(filesToLines);
if (files.length == 0) {
return event;
}
const readlinePromises = [];
for (const file of files) {
// If we failed to read this before, dont try reading it again.
if (LRU_FILE_CONTENTS_FS_READ_FAILED.get(file)) {
continue;
}
const filesToLineRanges = filesToLines[file];
if (!filesToLineRanges) {
continue;
}
// Sort ranges so that they are sorted by line increasing order and match how the file is read.
filesToLineRanges.sort((a, b) => a - b);
// Check if the contents are already in the cache and if we can avoid reading the file again.
const ranges = makeLineReaderRanges(filesToLineRanges, contextLines);
if (ranges.every(r => rangeExistsInContentCache(file, r))) {
continue;
}
const cache = emplace(LRU_FILE_CONTENTS_CACHE, file, {});
readlinePromises.push(getContextLinesFromFile(file, ranges, cache));
}
// The promise rejections are caught in order to prevent them from short circuiting Promise.all
await Promise.all(readlinePromises).catch(() => {
DEBUG_BUILD && debug.log('Failed to read one or more source files and resolve context lines');
});
// Perform the same loop as above, but this time we can assume all files are in the cache
// and attempt to add source context to frames.
if (contextLines > 0 && event.exception?.values) {
for (const exception of event.exception.values) {
if (exception.stacktrace?.frames && exception.stacktrace.frames.length > 0) {
addSourceContextToFrames(exception.stacktrace.frames, contextLines, LRU_FILE_CONTENTS_CACHE);
}
}
}
return event;
}
/* eslint-enable complexity */
/** Adds context lines to frames */
function addSourceContextToFrames(
frames,
contextLines,
cache,
) {
for (const frame of frames) {
// Only add context if we have a filename and it hasn't already been added
if (frame.filename && frame.context_line === undefined && typeof frame.lineno === 'number') {
const contents = cache.get(frame.filename);
if (contents === undefined) {
continue;
}
addContextToFrame(frame.lineno, frame, contextLines, contents);
}
}
}
/**
* Clears the context lines from a frame, used to reset a frame to its original state
* if we fail to resolve all context lines for it.
*/
function clearLineContext(frame) {
delete frame.pre_context;
delete frame.context_line;
delete frame.post_context;
}
/**
* Resolves context lines before and after the given line number and appends them to the frame;
*/
function addContextToFrame(
lineno,
frame,
contextLines,
contents,
) {
// When there is no line number in the frame, attaching context is nonsensical and will even break grouping.
// We already check for lineno before calling this, but since StackFrame lineno ism optional, we check it again.
if (frame.lineno === undefined || contents === undefined) {
DEBUG_BUILD && debug.error('Cannot resolve context for frame with no lineno or file contents');
return;
}
frame.pre_context = [];
for (let i = makeRangeStart(lineno, contextLines); i < lineno; i++) {
// We always expect the start context as line numbers cannot be negative. If we dont find a line, then
// something went wrong somewhere. Clear the context and return without adding any linecontext.
const line = contents[i];
if (line === undefined) {
clearLineContext(frame);
DEBUG_BUILD && debug.error(`Could not find line ${i} in file ${frame.filename}`);
return;
}
frame.pre_context.push(line);
}
// We should always have the context line. If we dont, something went wrong, so we clear the context and return
// without adding any linecontext.
if (contents[lineno] === undefined) {
clearLineContext(frame);
DEBUG_BUILD && debug.error(`Could not find line ${lineno} in file ${frame.filename}`);
return;
}
frame.context_line = contents[lineno];
const end = makeRangeEnd(lineno, contextLines);
frame.post_context = [];
for (let i = lineno + 1; i <= end; i++) {
// Since we dont track when the file ends, we cant clear the context if we dont find a line as it could
// just be that we reached the end of the file.
const line = contents[i];
if (line === undefined) {
break;
}
frame.post_context.push(line);
}
}
// Helper functions for generating line context ranges. They take a line number and the number of lines of context to
// include before and after the line and generate an inclusive range of indices.
// Compute inclusive end context range
function makeRangeStart(line, linecontext) {
return Math.max(1, line - linecontext);
}
// Compute inclusive start context range
function makeRangeEnd(line, linecontext) {
return line + linecontext;
}
// Determine start and end indices for context range (inclusive);
function makeContextRange(line, linecontext) {
return [makeRangeStart(line, linecontext), makeRangeEnd(line, linecontext)];
}
/** Exported only for tests, as a type-safe variant. */
const _contextLinesIntegration = ((options = {}) => {
const contextLines = options.frameContextLines !== undefined ? options.frameContextLines : DEFAULT_LINES_OF_CONTEXT;
return {
name: INTEGRATION_NAME,
processEvent(event) {
return addSourceContext(event, contextLines);
},
};
}) ;
/**
* Capture the lines before and after the frame's context.
*/
const contextLinesIntegration = defineIntegration(_contextLinesIntegration);
export { MAX_CONTEXTLINES_COLNO, MAX_CONTEXTLINES_LINENO, _contextLinesIntegration, addContextToFrame, contextLinesIntegration };
//# sourceMappingURL=contextlines.js.map
@@ -0,0 +1,334 @@
import { getAsyncContextStrategy } from '../asyncContext/index.js';
import { getMainCarrier } from '../carrier.js';
import { getCurrentScope } from '../currentScopes.js';
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '../semanticAttributes.js';
import { SPAN_STATUS_UNSET, SPAN_STATUS_OK } from '../tracing/spanstatus.js';
import { getCapturedScopesOnSpan } from '../tracing/utils.js';
import { addNonEnumerableProperty } from './object.js';
import { generateSpanId } from './propagationContext.js';
import { timestampInSeconds } from './time.js';
import { generateSentryTraceHeader, generateTraceparentHeader } from './tracing.js';
import { consoleSandbox } from './debug-logger.js';
import { _getSpanForScope } from './spanOnScope.js';
// These are aligned with OpenTelemetry trace flags
const TRACE_FLAG_NONE = 0x0;
const TRACE_FLAG_SAMPLED = 0x1;
let hasShownSpanDropWarning = false;
/**
* Convert a span to a trace context, which can be sent as the `trace` context in an event.
* By default, this will only include trace_id, span_id & parent_span_id.
* If `includeAllData` is true, it will also include data, op, status & origin.
*/
function spanToTransactionTraceContext(span) {
const { spanId: span_id, traceId: trace_id } = span.spanContext();
const { data, op, parent_span_id, status, origin, links } = spanToJSON(span);
return {
parent_span_id,
span_id,
trace_id,
data,
op,
status,
origin,
links,
};
}
/**
* Convert a span to a trace context, which can be sent as the `trace` context in a non-transaction event.
*/
function spanToTraceContext(span) {
const { spanId, traceId: trace_id, isRemote } = span.spanContext();
// If the span is remote, we use a random/virtual span as span_id to the trace context,
// and the remote span as parent_span_id
const parent_span_id = isRemote ? spanId : spanToJSON(span).parent_span_id;
const scope = getCapturedScopesOnSpan(span).scope;
const span_id = isRemote ? scope?.getPropagationContext().propagationSpanId || generateSpanId() : spanId;
return {
parent_span_id,
span_id,
trace_id,
};
}
/**
* Convert a Span to a Sentry trace header.
*/
function spanToTraceHeader(span) {
const { traceId, spanId } = span.spanContext();
const sampled = spanIsSampled(span);
return generateSentryTraceHeader(traceId, spanId, sampled);
}
/**
* Convert a Span to a W3C traceparent header.
*/
function spanToTraceparentHeader(span) {
const { traceId, spanId } = span.spanContext();
const sampled = spanIsSampled(span);
return generateTraceparentHeader(traceId, spanId, sampled);
}
/**
* Converts the span links array to a flattened version to be sent within an envelope.
*
* If the links array is empty, it returns `undefined` so the empty value can be dropped before it's sent.
*/
function convertSpanLinksForEnvelope(links) {
if (links && links.length > 0) {
return links.map(({ context: { spanId, traceId, traceFlags, ...restContext }, attributes }) => ({
span_id: spanId,
trace_id: traceId,
sampled: traceFlags === TRACE_FLAG_SAMPLED,
attributes,
...restContext,
}));
} else {
return undefined;
}
}
/**
* Convert a span time input into a timestamp in seconds.
*/
function spanTimeInputToSeconds(input) {
if (typeof input === 'number') {
return ensureTimestampInSeconds(input);
}
if (Array.isArray(input)) {
// See {@link HrTime} for the array-based time format
return input[0] + input[1] / 1e9;
}
if (input instanceof Date) {
return ensureTimestampInSeconds(input.getTime());
}
return timestampInSeconds();
}
/**
* Converts a timestamp to second, if it was in milliseconds, or keeps it as second.
*/
function ensureTimestampInSeconds(timestamp) {
const isMs = timestamp > 9999999999;
return isMs ? timestamp / 1000 : timestamp;
}
/**
* Convert a span to a JSON representation.
*/
// Note: Because of this, we currently have a circular type dependency (which we opted out of in package.json).
// This is not avoidable as we need `spanToJSON` in `spanUtils.ts`, which in turn is needed by `span.ts` for backwards compatibility.
// And `spanToJSON` needs the Span class from `span.ts` to check here.
function spanToJSON(span) {
if (spanIsSentrySpan(span)) {
return span.getSpanJSON();
}
const { spanId: span_id, traceId: trace_id } = span.spanContext();
// Handle a span from @opentelemetry/sdk-base-trace's `Span` class
if (spanIsOpenTelemetrySdkTraceBaseSpan(span)) {
const { attributes, startTime, name, endTime, status, links } = span;
// In preparation for the next major of OpenTelemetry, we want to support
// looking up the parent span id according to the new API
// In OTel v1, the parent span id is accessed as `parentSpanId`
// In OTel v2, the parent span id is accessed as `spanId` on the `parentSpanContext`
const parentSpanId =
'parentSpanId' in span
? span.parentSpanId
: 'parentSpanContext' in span
? (span.parentSpanContext )?.spanId
: undefined;
return {
span_id,
trace_id,
data: attributes,
description: name,
parent_span_id: parentSpanId,
start_timestamp: spanTimeInputToSeconds(startTime),
// This is [0,0] by default in OTEL, in which case we want to interpret this as no end time
timestamp: spanTimeInputToSeconds(endTime) || undefined,
status: getStatusMessage(status),
op: attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP],
origin: attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] ,
links: convertSpanLinksForEnvelope(links),
};
}
// Finally, at least we have `spanContext()`....
// This should not actually happen in reality, but we need to handle it for type safety.
return {
span_id,
trace_id,
start_timestamp: 0,
data: {},
};
}
function spanIsOpenTelemetrySdkTraceBaseSpan(span) {
const castSpan = span ;
return !!castSpan.attributes && !!castSpan.startTime && !!castSpan.name && !!castSpan.endTime && !!castSpan.status;
}
/** Exported only for tests. */
/**
* Sadly, due to circular dependency checks we cannot actually import the Span class here and check for instanceof.
* :( So instead we approximate this by checking if it has the `getSpanJSON` method.
*/
function spanIsSentrySpan(span) {
return typeof (span ).getSpanJSON === 'function';
}
/**
* Returns true if a span is sampled.
* In most cases, you should just use `span.isRecording()` instead.
* However, this has a slightly different semantic, as it also returns false if the span is finished.
* So in the case where this distinction is important, use this method.
*/
function spanIsSampled(span) {
// We align our trace flags with the ones OpenTelemetry use
// So we also check for sampled the same way they do.
const { traceFlags } = span.spanContext();
return traceFlags === TRACE_FLAG_SAMPLED;
}
/** Get the status message to use for a JSON representation of a span. */
function getStatusMessage(status) {
if (!status || status.code === SPAN_STATUS_UNSET) {
return undefined;
}
if (status.code === SPAN_STATUS_OK) {
return 'ok';
}
return status.message || 'internal_error';
}
const CHILD_SPANS_FIELD = '_sentryChildSpans';
const ROOT_SPAN_FIELD = '_sentryRootSpan';
/**
* Adds an opaque child span reference to a span.
*/
function addChildSpanToSpan(span, childSpan) {
// We store the root span reference on the child span
// We need this for `getRootSpan()` to work
const rootSpan = span[ROOT_SPAN_FIELD] || span;
addNonEnumerableProperty(childSpan , ROOT_SPAN_FIELD, rootSpan);
// We store a list of child spans on the parent span
// We need this for `getSpanDescendants()` to work
if (span[CHILD_SPANS_FIELD]) {
span[CHILD_SPANS_FIELD].add(childSpan);
} else {
addNonEnumerableProperty(span, CHILD_SPANS_FIELD, new Set([childSpan]));
}
}
/** This is only used internally by Idle Spans. */
function removeChildSpanFromSpan(span, childSpan) {
if (span[CHILD_SPANS_FIELD]) {
span[CHILD_SPANS_FIELD].delete(childSpan);
}
}
/**
* Returns an array of the given span and all of its descendants.
*/
function getSpanDescendants(span) {
const resultSet = new Set();
function addSpanChildren(span) {
// This exit condition is required to not infinitely loop in case of a circular dependency.
if (resultSet.has(span)) {
return;
// We want to ignore unsampled spans (e.g. non recording spans)
} else if (spanIsSampled(span)) {
resultSet.add(span);
const childSpans = span[CHILD_SPANS_FIELD] ? Array.from(span[CHILD_SPANS_FIELD]) : [];
for (const childSpan of childSpans) {
addSpanChildren(childSpan);
}
}
}
addSpanChildren(span);
return Array.from(resultSet);
}
/**
* Returns the root span of a given span.
*/
function getRootSpan(span) {
return span[ROOT_SPAN_FIELD] || span;
}
/**
* Returns the currently active span.
*/
function getActiveSpan() {
const carrier = getMainCarrier();
const acs = getAsyncContextStrategy(carrier);
if (acs.getActiveSpan) {
return acs.getActiveSpan();
}
return _getSpanForScope(getCurrentScope());
}
/**
* Logs a warning once if `beforeSendSpan` is used to drop spans.
*/
function showSpanDropWarning() {
if (!hasShownSpanDropWarning) {
consoleSandbox(() => {
// eslint-disable-next-line no-console
console.warn(
'[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.',
);
});
hasShownSpanDropWarning = true;
}
}
/**
* Updates the name of the given span and ensures that the span name is not
* overwritten by the Sentry SDK.
*
* Use this function instead of `span.updateName()` if you want to make sure that
* your name is kept. For some spans, for example root `http.server` spans the
* Sentry SDK would otherwise overwrite the span name with a high-quality name
* it infers when the span ends.
*
* Use this function in server code or when your span is started on the server
* and on the client (browser). If you only update a span name on the client,
* you can also use `span.updateName()` the SDK does not overwrite the name.
*
* @param span - The span to update the name of.
* @param name - The name to set on the span.
*/
function updateSpanName(span, name) {
span.updateName(name);
span.setAttributes({
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom',
[SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]: name,
});
}
export { TRACE_FLAG_NONE, TRACE_FLAG_SAMPLED, addChildSpanToSpan, convertSpanLinksForEnvelope, getActiveSpan, getRootSpan, getSpanDescendants, getStatusMessage, removeChildSpanFromSpan, showSpanDropWarning, spanIsSampled, spanTimeInputToSeconds, spanToJSON, spanToTraceContext, spanToTraceHeader, spanToTraceparentHeader, spanToTransactionTraceContext, updateSpanName };
//# sourceMappingURL=spanUtils.js.map
@@ -0,0 +1,4 @@
export declare const getWeekYear: import("./types.js").FPFn1<
number,
string | number | Date
>;
@@ -0,0 +1,41 @@
"use strict";
exports.formatLong = void 0;
var _index = require("../../_lib/buildFormatLongFn.js");
const dateFormats = {
full: "EEEE, dd. MMMM y",
long: "dd. MMMM y",
medium: "d. MMM y",
short: "d. MM. yy",
};
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",
}),
});
@@ -0,0 +1,16 @@
/**
* 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
*/
import type {Transformer} from '@lexical/markdown';
declare export var DEFAULT_TRANSFORMERS: Array<Transformer>;
declare export function MarkdownShortcutPlugin({
transformers?: Array<Transformer>,
}): React.Node;
@@ -0,0 +1,128 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var session_exports = {};
__export(session_exports, {
PgProxyTransaction: () => PgProxyTransaction,
PgRemoteSession: () => PgRemoteSession,
PreparedQuery: () => PreparedQuery
});
module.exports = __toCommonJS(session_exports);
var import_cache = require("../cache/core/cache.cjs");
var import_entity = require("../entity.cjs");
var import_logger = require("../logger.cjs");
var import_pg_core = require("../pg-core/index.cjs");
var import_session = require("../pg-core/session.cjs");
var import_sql = require("../sql/sql.cjs");
var import_tracing = require("../tracing.cjs");
var import_utils = require("../utils.cjs");
class PgRemoteSession extends import_session.PgSession {
constructor(client, dialect, schema, options = {}) {
super(dialect);
this.client = client;
this.schema = schema;
this.logger = options.logger ?? new import_logger.NoopLogger();
this.cache = options.cache ?? new import_cache.NoopCache();
}
static [import_entity.entityKind] = "PgRemoteSession";
logger;
cache;
prepareQuery(query, fields, name, isResponseInArrayMode, customResultMapper, queryMetadata, cacheConfig) {
return new PreparedQuery(
this.client,
query.sql,
query.params,
query.typings,
this.logger,
this.cache,
queryMetadata,
cacheConfig,
fields,
isResponseInArrayMode,
customResultMapper
);
}
async transaction(_transaction, _config) {
throw new Error("Transactions are not supported by the Postgres Proxy driver");
}
}
class PgProxyTransaction extends import_pg_core.PgTransaction {
static [import_entity.entityKind] = "PgProxyTransaction";
async transaction(_transaction) {
throw new Error("Transactions are not supported by the Postgres Proxy driver");
}
}
class PreparedQuery extends import_session.PgPreparedQuery {
constructor(client, queryString, params, typings, logger, cache, queryMetadata, cacheConfig, fields, _isResponseInArrayMode, customResultMapper) {
super({ sql: queryString, params }, cache, queryMetadata, cacheConfig);
this.client = client;
this.queryString = queryString;
this.params = params;
this.typings = typings;
this.logger = logger;
this.fields = fields;
this._isResponseInArrayMode = _isResponseInArrayMode;
this.customResultMapper = customResultMapper;
}
static [import_entity.entityKind] = "PgProxyPreparedQuery";
async execute(placeholderValues = {}) {
return import_tracing.tracer.startActiveSpan("drizzle.execute", async (span) => {
const params = (0, import_sql.fillPlaceholders)(this.params, placeholderValues);
const { fields, client, queryString, joinsNotNullableMap, customResultMapper, logger, typings } = this;
span?.setAttributes({
"drizzle.query.text": queryString,
"drizzle.query.params": JSON.stringify(params)
});
logger.logQuery(queryString, params);
if (!fields && !customResultMapper) {
return import_tracing.tracer.startActiveSpan("drizzle.driver.execute", async () => {
const { rows: rows2 } = await this.queryWithCache(queryString, params, async () => {
return await client(queryString, params, "execute", typings);
});
return rows2;
});
}
const rows = await import_tracing.tracer.startActiveSpan("drizzle.driver.execute", async () => {
span?.setAttributes({
"drizzle.query.text": queryString,
"drizzle.query.params": JSON.stringify(params)
});
const { rows: rows2 } = await this.queryWithCache(queryString, params, async () => {
return await client(queryString, params, "all", typings);
});
return rows2;
});
return import_tracing.tracer.startActiveSpan("drizzle.mapResponse", () => {
return customResultMapper ? customResultMapper(rows) : rows.map((row) => (0, import_utils.mapResultRow)(fields, row, joinsNotNullableMap));
});
});
}
async all() {
}
/** @internal */
isResponseInArrayMode() {
return this._isResponseInArrayMode;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
PgProxyTransaction,
PgRemoteSession,
PreparedQuery
});
//# sourceMappingURL=session.cjs.map
@@ -0,0 +1,36 @@
import type { ContextOptions, DateArg } from "./types.js";
/**
* The {@link setSeconds} function options.
*/
export interface SetSecondsOptions<DateType extends Date = Date>
extends ContextOptions<DateType> {}
/**
* @name setSeconds
* @category Second Helpers
* @summary Set the seconds to the given date, with context support.
*
* @description
* Set the seconds to the given date, with an optional context for time zone specification.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
*
* @param date - The date to be changed
* @param seconds - The seconds of the new date
* @param options - An object with options
*
* @returns The new date with the seconds set
*
* @example
* // Set 45 seconds to 1 September 2014 11:30:40:
* const result = setSeconds(new Date(2014, 8, 1, 11, 30, 40), 45)
* //=> Mon Sep 01 2014 11:30:45
*/
export declare function setSeconds<
DateType extends Date,
ResultDate extends Date = DateType,
>(
date: DateArg<DateType>,
seconds: number,
options?: SetSecondsOptions<ResultDate>,
): ResultDate;
@@ -0,0 +1,2 @@
export declare const INTEGRATION_NAME = "VercelAI";
//# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1,25 @@
/**
* @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 Palette = createLucideIcon("Palette", [
["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }],
["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
[
"path",
{
d: "M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",
key: "12rzf8"
}
]
]);
export { Palette as default };
//# sourceMappingURL=palette.js.map
@@ -0,0 +1,109 @@
import { expect, test } from "vitest";
import * as z from "zod/v4";
test("string format methods", () => {
const a = z.email().min(10);
const b = z.email().max(10);
const c = z.email().length(10);
const d = z.email().uppercase();
const e = z.email().lowercase();
// Positive and negative cases for `a`
expect(a.safeParse("longemail@example.com").success).toBe(true); // Positive
expect(a.safeParse("ort@e.co").success).toBe(false); // Negative
// Positive and negative cases for `b`
expect(b.safeParse("sho@e.co").success).toBe(true); // Positive
expect(b.safeParse("longemail@example.com").success).toBe(false); // Negative
// Positive and negative cases for `c`
expect(c.safeParse("56780@e.co").success).toBe(true); // Positive
expect(c.safeParse("shoasdfasdfrt@e.co").success).toBe(false); // Negative
// Positive and negative cases for `d`
expect(d.safeParse("EMAIL@EXAMPLE.COM").success).toBe(true); // Positive
expect(d.safeParse("email@example.com").success).toBe(false); // Negative
// Positive and negative cases for `e`
expect(e.safeParse("email@example.com").success).toBe(true); // Positive
expect(e.safeParse("EMAIL@EXAMPLE.COM").success).toBe(false); // Negative
});
test("z.stringFormat", () => {
const ccRegex = /^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u;
const a = z
.stringFormat("creditCard", (val) => ccRegex.test(val), {
error: `Invalid credit card number`,
})
.refine((_) => false, "Also bad");
expect(a.safeParse("asdf")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "invalid_format",
"format": "creditCard",
"path": [],
"message": "Invalid credit card number"
},
{
"code": "custom",
"path": [],
"message": "Also bad"
}
]],
"success": false,
}
`);
expect(a.safeParse("1234-5678-9012-3456")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "custom",
"path": [],
"message": "Also bad"
}
]],
"success": false,
}
`);
expect(a.def.pattern).toMatchInlineSnapshot(`undefined`);
const b = z
.stringFormat("creditCard", ccRegex, {
abort: true,
error: `Invalid credit card number`,
})
.refine((_) => false, "Also bad");
expect(b.safeParse("asdf")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "invalid_format",
"format": "creditCard",
"path": [],
"message": "Invalid credit card number"
}
]],
"success": false,
}
`);
expect(b.safeParse("1234-5678-9012-3456")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "custom",
"path": [],
"message": "Also bad"
}
]],
"success": false,
}
`);
expect(b.def.pattern).toMatchInlineSnapshot(
`/\\^\\(\\?:\\\\d\\{14,19\\}\\|\\\\d\\{4\\}\\(\\?: \\\\d\\{3,6\\}\\)\\{2,4\\}\\|\\\\d\\{4\\}\\(\\?:-\\\\d\\{3,6\\}\\)\\{2,4\\}\\)\\$/u`
);
});
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/CodeEditor/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyB,MAAM,OAAO,CAAA;AAE7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAMvC,YAAY,EAAE,KAAK,EAAE,CAAA;AAErB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAMtC,CAAA"}
@@ -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{registerList as t,ListNode as r,ListItemNode as o,registerListStrictIndentTransform as e}from"@lexical/list";import{useLexicalComposerContext as i}from"@lexical/react/LexicalComposerContext";import{useEffect as n}from"react";function s({hasStrictIndent:s=!1}){const[c]=i();return n((()=>{if(!c.hasNodes([r,o]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")}),[c]),n((()=>{if(s)return e(c)}),[c,s]),function(r){n((()=>t(r)),[r])}(c),null}export{s as ListPlugin};
@@ -0,0 +1,30 @@
import { APIError } from '../../../errors/index.js';
import { createLocalReq } from '../../../utilities/createLocalReq.js';
import { findByIDOperation } from '../findByID.js';
export async function findByIDLocal(payload, options) {
const { id, collection: collectionSlug, currentDepth, data, depth, disableErrors = false, draft = false, flattenLocales, includeLockStatus, joins, overrideAccess = true, populate, select, showHiddenFields, trash = false } = options;
const collection = payload.collections[collectionSlug];
if (!collection) {
throw new APIError(`The collection with slug ${String(collectionSlug)} can't be found. Find By ID Operation.`);
}
return findByIDOperation({
id,
collection,
currentDepth,
data,
depth,
disableErrors,
draft,
flattenLocales,
includeLockStatus,
joins,
overrideAccess,
populate,
req: await createLocalReq(options, payload),
select,
showHiddenFields,
trash
});
}
//# sourceMappingURL=findByID.js.map
@@ -0,0 +1,36 @@
import { entityKind } from "./entity.js";
class ConsoleLogWriter {
static [entityKind] = "ConsoleLogWriter";
write(message) {
console.log(message);
}
}
class DefaultLogger {
static [entityKind] = "DefaultLogger";
writer;
constructor(config) {
this.writer = config?.writer ?? new ConsoleLogWriter();
}
logQuery(query, params) {
const stringifiedParams = params.map((p) => {
try {
return JSON.stringify(p);
} catch {
return String(p);
}
});
const paramsStr = stringifiedParams.length ? ` -- params: [${stringifiedParams.join(", ")}]` : "";
this.writer.write(`Query: ${query}${paramsStr}`);
}
}
class NoopLogger {
static [entityKind] = "NoopLogger";
logQuery() {
}
}
export {
ConsoleLogWriter,
DefaultLogger,
NoopLogger
};
//# sourceMappingURL=logger.js.map
@@ -0,0 +1,42 @@
// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
function checkErrors(a: z.ZodTypeAny, bad: any) {
let expected: any;
try {
a.parse(bad);
} catch (error) {
expected = (error as z.ZodError).formErrors;
}
try {
a.optional().parse(bad);
} catch (error) {
expect((error as z.ZodError).formErrors).toEqual(expected);
}
}
test("Should have error messages appropriate for the underlying type", () => {
checkErrors(z.string().min(2), 1);
z.string().min(2).optional().parse(undefined);
checkErrors(z.number().gte(2), 1);
z.number().gte(2).optional().parse(undefined);
checkErrors(z.boolean(), "");
z.boolean().optional().parse(undefined);
checkErrors(z.undefined(), null);
z.undefined().optional().parse(undefined);
checkErrors(z.null(), {});
z.null().optional().parse(undefined);
checkErrors(z.object({}), 1);
z.object({}).optional().parse(undefined);
checkErrors(z.tuple([]), 1);
z.tuple([]).optional().parse(undefined);
checkErrors(z.unknown(), 1);
z.unknown().optional().parse(undefined);
});
test("unwrap", () => {
const unwrapped = z.string().optional().unwrap();
expect(unwrapped).toBeInstanceOf(z.ZodString);
});
@@ -0,0 +1,7 @@
// Use strict: true for new features. This overrides options only for this directory.
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"strict": true
}
}
@@ -0,0 +1,51 @@
/**
* Created by Ivo Meißner on 28.07.17.
*/
import type { DocumentNode, FieldNode, FragmentDefinitionNode, GraphQLCompositeType, GraphQLDirective, GraphQLField, GraphQLSchema, GraphQLUnionType, InlineFragmentNode, OperationDefinitionNode } from 'graphql';
import { GraphQLError, GraphQLInterfaceType, GraphQLObjectType, ValidationContext } from 'graphql';
export type ComplexityEstimatorArgs = {
args: {
[key: string]: any;
};
childComplexity: number;
context?: Record<string, any>;
field: GraphQLField<any, any>;
node: FieldNode;
type: GraphQLCompositeType;
};
export type ComplexityEstimator = (options: ComplexityEstimatorArgs) => number | void;
export type Complexity = any;
export interface QueryComplexityOptions {
context?: Record<string, any>;
createError?: (max: number, actual: number) => GraphQLError;
estimators: Array<ComplexityEstimator>;
maximumComplexity: number;
onComplete?: (complexity: number) => void;
operationName?: string;
variables?: Record<string, any>;
}
export declare function getComplexity(options: {
context?: Record<string, any>;
estimators: ComplexityEstimator[];
operationName?: string;
query: DocumentNode;
schema: GraphQLSchema;
variables?: Record<string, any>;
}): number;
export declare class QueryComplexity {
complexity: number;
context: ValidationContext;
estimators: Array<ComplexityEstimator>;
includeDirectiveDef: GraphQLDirective;
OperationDefinition: Record<string, any>;
options: QueryComplexityOptions;
requestContext?: Record<string, any>;
skipDirectiveDef: GraphQLDirective;
variableValues: Record<string, any>;
constructor(context: ValidationContext, options: QueryComplexityOptions);
createError(): GraphQLError;
nodeComplexity(node: FieldNode | FragmentDefinitionNode | InlineFragmentNode | OperationDefinitionNode, typeDef: GraphQLInterfaceType | GraphQLObjectType | GraphQLUnionType): number;
onOperationDefinitionEnter(operation: OperationDefinitionNode): void;
onOperationDefinitionLeave(operation: OperationDefinitionNode): GraphQLError | void;
}
//# sourceMappingURL=QueryComplexity.d.ts.map
@@ -0,0 +1,100 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const http = require('node:http');
const core = require('@sentry/core');
const INTEGRATION_NAME = 'Spotlight';
const _spotlightIntegration = ((options = {}) => {
const _options = {
sidecarUrl: options.sidecarUrl || 'http://localhost:8969/stream',
};
return {
name: INTEGRATION_NAME,
setup(client) {
try {
if (process.env.NODE_ENV && process.env.NODE_ENV !== 'development') {
core.debug.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?");
}
} catch {
// ignore
}
connectToSpotlight(client, _options);
},
};
}) ;
/**
* Use this integration to send errors and transactions to Spotlight.
*
* Learn more about spotlight at https://spotlightjs.com
*
* Important: This integration only works with Node 18 or newer.
*/
const spotlightIntegration = core.defineIntegration(_spotlightIntegration);
function connectToSpotlight(client, options) {
const spotlightUrl = parseSidecarUrl(options.sidecarUrl);
if (!spotlightUrl) {
return;
}
let failedRequests = 0;
client.on('beforeEnvelope', (envelope) => {
if (failedRequests > 3) {
core.debug.warn('[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests');
return;
}
const serializedEnvelope = core.serializeEnvelope(envelope);
core.suppressTracing(() => {
const req = http.request(
{
method: 'POST',
path: spotlightUrl.pathname,
hostname: spotlightUrl.hostname,
port: spotlightUrl.port,
headers: {
'Content-Type': 'application/x-sentry-envelope',
},
},
res => {
if (res.statusCode && res.statusCode >= 200 && res.statusCode < 400) {
// Reset failed requests counter on success
failedRequests = 0;
}
res.on('data', () => {
// Drain socket
});
res.on('end', () => {
// Drain socket
});
res.setEncoding('utf8');
},
);
req.on('error', () => {
failedRequests++;
core.debug.warn('[Spotlight] Failed to send envelope to Spotlight Sidecar');
});
req.write(serializedEnvelope);
req.end();
});
});
}
function parseSidecarUrl(url) {
try {
return new URL(`${url}`);
} catch {
core.debug.warn(`[Spotlight] Invalid sidecar URL: ${url}`);
return undefined;
}
}
exports.INTEGRATION_NAME = INTEGRATION_NAME;
exports.spotlightIntegration = spotlightIntegration;
//# sourceMappingURL=spotlight.js.map
@@ -0,0 +1 @@
{"version":3,"file":"battery.js","sources":["../../../src/icons/battery.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Battery\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTYiIGhlaWdodD0iMTAiIHg9IjIiIHk9IjciIHJ4PSIyIiByeT0iMiIgLz4KICA8bGluZSB4MT0iMjIiIHgyPSIyMiIgeTE9IjExIiB5Mj0iMTMiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/battery\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 Battery = createLucideIcon('Battery', [\n ['rect', { width: '16', height: '10', x: '2', y: '7', rx: '2', ry: '2', key: '1w10f2' }],\n ['line', { x1: '22', x2: '22', y1: '11', y2: '13', key: '4dh1rd' }],\n]);\n\nexport default Battery;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,iBAAiB,SAAW,CAAA,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,KAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAQ,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,EAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,KAAK,CAAI,CAAA,CAAA,CAAA,GAAA,CAAK,CAAA,CAAA,EAAI,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAU,CAAA,CAAA;AAAA,CACvF,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACpE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,53 @@
import { Builtin } from "../built-in";
import { IsAny } from "../is-any";
import { IsNever } from "../is-never";
import { CreateTypeOptions } from "../create-type-options";
import { ValueOf } from "../value-of";
type Pathable = string | number;
type NonRecursiveType = Builtin | Promise<unknown> | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown>;
type DefaultRecursivePathsOptions = {
depth: [];
};
/**
* @param depth This option counts the number of recursive calls in
* `RecursivePathsOptions['depth']['length']`. Used in combination with
* `PathsOptions['depth']`
*/
type RecursivePathsOptions = {
depth: any[];
};
/**
* @param depth By default, the depth option is set to 7. It should cover the
* majority of use cases. If by any chance it doesn't fit you, feel free to
* increase the value. However, this may increase the chance of getting
* `Type instantiation is excessively deep and possibly infinite` error.
*
* @param anyArrayIndexAccessor By default there is no wildcard access to
* array indices - usage must be intentionally configured.
*/
type DefaultPathsOptions = {
depth: 7;
anyArrayIndexAccessor: `${number}`;
};
/**
* @param depth This option restricts the depth of the paths lookup and removes `Type
* instantiation is excessively deep and possibly infinite` errors for
* potentially infinite types.
*
* @param anyArrayIndexAccessor This wildcard will satisfy any array index if defined.
*/
type PathsOptions = {
depth: number;
anyArrayIndexAccessor: string;
};
type Append<Tuple extends any[]> = [...Tuple, 0];
type RecursivePaths<Type, UserOptions extends Required<PathsOptions>, CallOptions extends RecursivePathsOptions> = IsNever<keyof Type> extends true ? never : NonNullable<ValueOf<{
[Key in keyof Type]: Key extends Pathable ? `${AnyArrayIndexAccessorOrKey<Key, UserOptions>}` | (CallOptions["depth"]["length"] extends UserOptions["depth"] ? never : Type[Key] extends infer Value ? Value extends Value ? HasParsablePath<Value> extends true ? RecursivePaths<Value, UserOptions, {
depth: Append<CallOptions["depth"]>;
}> extends infer Rest ? IsNever<Rest> extends true ? never : Rest extends Pathable ? `${AnyArrayIndexAccessorOrKey<Key, UserOptions>}.${Rest}` : never : never : never : never : never) : never;
}>>;
type HasParsablePath<Type> = Type extends NonRecursiveType ? false : IsAny<Type> extends true ? false : Type extends object ? true : false;
type UnsafePaths<Type, Options extends Required<PathsOptions>> = Type extends Type ? HasParsablePath<Type> extends true ? RecursivePaths<Type, Options, DefaultRecursivePathsOptions> : never : never;
type AnyArrayIndexAccessorOrKey<Key extends Pathable, UserOptions extends Required<PathsOptions>> = Key extends number ? Key | UserOptions["anyArrayIndexAccessor"] : Key;
export type Paths<Type, OverridePathOptions extends Partial<PathsOptions> = {}> = UnsafePaths<Type, CreateTypeOptions<PathsOptions, OverridePathOptions, DefaultPathsOptions>>;
export {};
@@ -0,0 +1 @@
{"version":3,"file":"types.js","names":[],"sources":["../../../src/elements/CodeEditor/types.ts"],"sourcesContent":["import type { EditorProps } from '@monaco-editor/react'\n\nexport type Props = {\n maxHeight?: number\n /**\n * @default 56 (3 lines)\n */\n minHeight?: number\n readOnly?: boolean\n recalculatedHeightAt?: number\n} & EditorProps\n"],"mappings":"AAEA","ignoreList":[]}
@@ -0,0 +1,223 @@
const ANSI_BACKGROUND_OFFSET = 10;
const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
const styles = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
overline: [53, 55],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29],
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
// Bright color
blackBright: [90, 39],
gray: [90, 39], // Alias of `blackBright`
grey: [90, 39], // Alias of `blackBright`
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39],
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgGray: [100, 49], // Alias of `bgBlackBright`
bgGrey: [100, 49], // Alias of `bgBlackBright`
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49],
},
};
export const modifierNames = Object.keys(styles.modifier);
export const foregroundColorNames = Object.keys(styles.color);
export const backgroundColorNames = Object.keys(styles.bgColor);
export const colorNames = [...foregroundColorNames, ...backgroundColorNames];
function assembleStyles() {
const codes = new Map();
for (const [groupName, group] of Object.entries(styles)) {
for (const [styleName, style] of Object.entries(group)) {
styles[styleName] = {
open: `\u001B[${style[0]}m`,
close: `\u001B[${style[1]}m`,
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false,
});
}
Object.defineProperty(styles, 'codes', {
value: codes,
enumerable: false,
});
styles.color.close = '\u001B[39m';
styles.bgColor.close = '\u001B[49m';
styles.color.ansi = wrapAnsi16();
styles.color.ansi256 = wrapAnsi256();
styles.color.ansi16m = wrapAnsi16m();
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
Object.defineProperties(styles, {
rgbToAnsi256: {
value(red, green, blue) {
// We use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (red === green && green === blue) {
if (red < 8) {
return 16;
}
if (red > 248) {
return 231;
}
return Math.round(((red - 8) / 247) * 24) + 232;
}
return 16
+ (36 * Math.round(red / 255 * 5))
+ (6 * Math.round(green / 255 * 5))
+ Math.round(blue / 255 * 5);
},
enumerable: false,
},
hexToRgb: {
value(hex) {
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
if (!matches) {
return [0, 0, 0];
}
let [colorString] = matches;
if (colorString.length === 3) {
colorString = [...colorString].map(character => character + character).join('');
}
const integer = Number.parseInt(colorString, 16);
return [
/* eslint-disable no-bitwise */
(integer >> 16) & 0xFF,
(integer >> 8) & 0xFF,
integer & 0xFF,
/* eslint-enable no-bitwise */
];
},
enumerable: false,
},
hexToAnsi256: {
value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
enumerable: false,
},
ansi256ToAnsi: {
value(code) {
if (code < 8) {
return 30 + code;
}
if (code < 16) {
return 90 + (code - 8);
}
let red;
let green;
let blue;
if (code >= 232) {
red = (((code - 232) * 10) + 8) / 255;
green = red;
blue = red;
} else {
code -= 16;
const remainder = code % 36;
red = Math.floor(code / 36) / 5;
green = Math.floor(remainder / 6) / 5;
blue = (remainder % 6) / 5;
}
const value = Math.max(red, green, blue) * 2;
if (value === 0) {
return 30;
}
// eslint-disable-next-line no-bitwise
let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
if (value === 2) {
result += 60;
}
return result;
},
enumerable: false,
},
rgbToAnsi: {
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
enumerable: false,
},
hexToAnsi: {
value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
enumerable: false,
},
});
return styles;
}
const ansiStyles = assembleStyles();
export default ansiStyles;
@@ -0,0 +1 @@
{"version":3,"file":"git-pull-request-create.js","sources":["../../../src/icons/git-pull-request-create.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name GitPullRequestCreate\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSI2IiBjeT0iNiIgcj0iMyIgLz4KICA8cGF0aCBkPSJNNiA5djEyIiAvPgogIDxwYXRoIGQ9Ik0xMyA2aDNhMiAyIDAgMCAxIDIgMnYzIiAvPgogIDxwYXRoIGQ9Ik0xOCAxNXY2IiAvPgogIDxwYXRoIGQ9Ik0yMSAxOGgtNiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/git-pull-request-create\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 GitPullRequestCreate = createLucideIcon('GitPullRequestCreate', [\n ['circle', { cx: '6', cy: '6', r: '3', key: '1lh9wr' }],\n ['path', { d: 'M6 9v12', key: '1sc30k' }],\n ['path', { d: 'M13 6h3a2 2 0 0 1 2 2v3', key: '1jb6z3' }],\n ['path', { d: 'M18 15v6', key: '9wciyi' }],\n ['path', { d: 'M21 18h-6', key: '139f0c' }],\n]);\n\nexport default GitPullRequestCreate;\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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuB,iBAAiB,sBAAwB,CAAA,CAAA,CAAA;AAAA,CACpE,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,EAAK,CAAI,CAAA,CAAA,CAAA,GAAA,CAAK,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACtD,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,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,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,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;;"}
@@ -0,0 +1,381 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const currentScopes = require('../../currentScopes.js');
const _exports = require('../../exports.js');
const semanticAttributes = require('../../semanticAttributes.js');
const spanstatus = require('../spanstatus.js');
const trace = require('../trace.js');
const handleCallbackErrors = require('../../utils/handleCallbackErrors.js');
const genAiAttributes = require('../ai/gen-ai-attributes.js');
const messageTruncation = require('../ai/messageTruncation.js');
const utils$1 = require('../ai/utils.js');
const constants = require('./constants.js');
const streaming = require('./streaming.js');
const utils = require('./utils.js');
/**
* Extract model from parameters or chat context object
* For chat instances, the model is available on the chat object as 'model' (older versions) or 'modelVersion' (newer versions)
*/
function extractModel(params, context) {
if ('model' in params && typeof params.model === 'string') {
return params.model;
}
// Try to get model from chat context object (chat instance has model property)
if (context && typeof context === 'object') {
const contextObj = context ;
// Check for 'model' property (older versions, and streaming)
if ('model' in contextObj && typeof contextObj.model === 'string') {
return contextObj.model;
}
// Check for 'modelVersion' property (newer versions)
if ('modelVersion' in contextObj && typeof contextObj.modelVersion === 'string') {
return contextObj.modelVersion;
}
}
return 'unknown';
}
/**
* Extract generation config parameters
*/
function extractConfigAttributes(config) {
const attributes = {};
if ('temperature' in config && typeof config.temperature === 'number') {
attributes[genAiAttributes.GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE] = config.temperature;
}
if ('topP' in config && typeof config.topP === 'number') {
attributes[genAiAttributes.GEN_AI_REQUEST_TOP_P_ATTRIBUTE] = config.topP;
}
if ('topK' in config && typeof config.topK === 'number') {
attributes[genAiAttributes.GEN_AI_REQUEST_TOP_K_ATTRIBUTE] = config.topK;
}
if ('maxOutputTokens' in config && typeof config.maxOutputTokens === 'number') {
attributes[genAiAttributes.GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE] = config.maxOutputTokens;
}
if ('frequencyPenalty' in config && typeof config.frequencyPenalty === 'number') {
attributes[genAiAttributes.GEN_AI_REQUEST_FREQUENCY_PENALTY_ATTRIBUTE] = config.frequencyPenalty;
}
if ('presencePenalty' in config && typeof config.presencePenalty === 'number') {
attributes[genAiAttributes.GEN_AI_REQUEST_PRESENCE_PENALTY_ATTRIBUTE] = config.presencePenalty;
}
return attributes;
}
/**
* Extract request attributes from method arguments
* Builds the base attributes for span creation including system info, model, and config
*/
function extractRequestAttributes(
methodPath,
params,
context,
) {
const attributes = {
[genAiAttributes.GEN_AI_SYSTEM_ATTRIBUTE]: constants.GOOGLE_GENAI_SYSTEM_NAME,
[genAiAttributes.GEN_AI_OPERATION_NAME_ATTRIBUTE]: utils$1.getFinalOperationName(methodPath),
[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.google_genai',
};
if (params) {
attributes[genAiAttributes.GEN_AI_REQUEST_MODEL_ATTRIBUTE] = extractModel(params, context);
// Extract generation config parameters
if ('config' in params && typeof params.config === 'object' && params.config) {
const config = params.config ;
Object.assign(attributes, extractConfigAttributes(config));
// Extract available tools from config
if ('tools' in config && Array.isArray(config.tools)) {
const functionDeclarations = config.tools.flatMap(
(tool) => tool.functionDeclarations,
);
attributes[genAiAttributes.GEN_AI_REQUEST_AVAILABLE_TOOLS_ATTRIBUTE] = JSON.stringify(functionDeclarations);
}
}
} else {
attributes[genAiAttributes.GEN_AI_REQUEST_MODEL_ATTRIBUTE] = extractModel({}, context);
}
return attributes;
}
/**
* Add private request attributes to spans.
* This is only recorded if recordInputs is true.
* Handles different parameter formats for different Google GenAI methods.
*/
function addPrivateRequestAttributes(span, params) {
const messages = [];
// config.systemInstruction: ContentUnion
if (
'config' in params &&
params.config &&
typeof params.config === 'object' &&
'systemInstruction' in params.config &&
params.config.systemInstruction
) {
messages.push(...utils.contentUnionToMessages(params.config.systemInstruction , 'system'));
}
// For chats.create: history contains the conversation history
if ('history' in params) {
messages.push(...utils.contentUnionToMessages(params.history , 'user'));
}
// For models.generateContent: ContentListUnion
if ('contents' in params) {
messages.push(...utils.contentUnionToMessages(params.contents , 'user'));
}
// For chat.sendMessage: message can be PartListUnion
if ('message' in params) {
messages.push(...utils.contentUnionToMessages(params.message , 'user'));
}
if (Array.isArray(messages) && messages.length) {
const { systemInstructions, filteredMessages } = utils$1.extractSystemInstructions(messages);
if (systemInstructions) {
span.setAttribute(genAiAttributes.GEN_AI_SYSTEM_INSTRUCTIONS_ATTRIBUTE, systemInstructions);
}
const filteredLength = Array.isArray(filteredMessages) ? filteredMessages.length : 0;
span.setAttributes({
[genAiAttributes.GEN_AI_INPUT_MESSAGES_ORIGINAL_LENGTH_ATTRIBUTE]: filteredLength,
[genAiAttributes.GEN_AI_INPUT_MESSAGES_ATTRIBUTE]: JSON.stringify(messageTruncation.truncateGenAiMessages(filteredMessages )),
});
}
}
/**
* Add response attributes from the Google GenAI response
* @see https://github.com/googleapis/js-genai/blob/v1.19.0/src/types.ts#L2313
*/
function addResponseAttributes(span, response, recordOutputs) {
if (!response || typeof response !== 'object') return;
if (response.modelVersion) {
span.setAttribute(genAiAttributes.GEN_AI_RESPONSE_MODEL_ATTRIBUTE, response.modelVersion);
}
// Add usage metadata if present
if (response.usageMetadata && typeof response.usageMetadata === 'object') {
const usage = response.usageMetadata;
if (typeof usage.promptTokenCount === 'number') {
span.setAttributes({
[genAiAttributes.GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]: usage.promptTokenCount,
});
}
if (typeof usage.candidatesTokenCount === 'number') {
span.setAttributes({
[genAiAttributes.GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: usage.candidatesTokenCount,
});
}
if (typeof usage.totalTokenCount === 'number') {
span.setAttributes({
[genAiAttributes.GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: usage.totalTokenCount,
});
}
}
// Add response text if recordOutputs is enabled
if (recordOutputs && Array.isArray(response.candidates) && response.candidates.length > 0) {
const responseTexts = response.candidates
.map((candidate) => {
if (candidate.content?.parts && Array.isArray(candidate.content.parts)) {
return candidate.content.parts
.map((part) => (typeof part.text === 'string' ? part.text : ''))
.filter((text) => text.length > 0)
.join('');
}
return '';
})
.filter((text) => text.length > 0);
if (responseTexts.length > 0) {
span.setAttributes({
[genAiAttributes.GEN_AI_RESPONSE_TEXT_ATTRIBUTE]: responseTexts.join(''),
});
}
}
// Add tool calls if recordOutputs is enabled
if (recordOutputs && response.functionCalls) {
const functionCalls = response.functionCalls;
if (Array.isArray(functionCalls) && functionCalls.length > 0) {
span.setAttributes({
[genAiAttributes.GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE]: JSON.stringify(functionCalls),
});
}
}
}
/**
* Instrument any async or synchronous genai method with Sentry spans
* Handles operations like models.generateContent and chat.sendMessage and chats.create
* @see https://docs.sentry.io/platforms/javascript/guides/node/tracing/instrumentation/ai-agents-module/#manual-instrumentation
*/
function instrumentMethod(
originalMethod,
methodPath,
context,
options,
) {
const isSyncCreate = methodPath === constants.CHATS_CREATE_METHOD;
return new Proxy(originalMethod, {
apply(target, _, args) {
const params = args[0] ;
const requestAttributes = extractRequestAttributes(methodPath, params, context);
const model = requestAttributes[genAiAttributes.GEN_AI_REQUEST_MODEL_ATTRIBUTE] ?? 'unknown';
const operationName = utils$1.getFinalOperationName(methodPath);
// Check if this is a streaming method
if (utils.isStreamingMethod(methodPath)) {
// Use startSpanManual for streaming methods to control span lifecycle
return trace.startSpanManual(
{
name: `${operationName} ${model} stream-response`,
op: utils$1.getSpanOperation(methodPath),
attributes: requestAttributes,
},
async (span) => {
try {
if (options.recordInputs && params) {
addPrivateRequestAttributes(span, params);
}
const stream = await target.apply(context, args);
return streaming.instrumentStream(stream, span, Boolean(options.recordOutputs)) ;
} catch (error) {
span.setStatus({ code: spanstatus.SPAN_STATUS_ERROR, message: 'internal_error' });
_exports.captureException(error, {
mechanism: {
handled: false,
type: 'auto.ai.google_genai',
data: { function: methodPath },
},
});
span.end();
throw error;
}
},
);
}
// Single span for both sync and async operations
return trace.startSpan(
{
name: isSyncCreate ? `${operationName} ${model} create` : `${operationName} ${model}`,
op: utils$1.getSpanOperation(methodPath),
attributes: requestAttributes,
},
(span) => {
if (options.recordInputs && params) {
addPrivateRequestAttributes(span, params);
}
return handleCallbackErrors.handleCallbackErrors(
() => target.apply(context, args),
error => {
_exports.captureException(error, {
mechanism: { handled: false, type: 'auto.ai.google_genai', data: { function: methodPath } },
});
},
() => {},
result => {
// Only add response attributes for content-producing methods, not for chats.create
if (!isSyncCreate) {
addResponseAttributes(span, result, options.recordOutputs);
}
},
);
},
);
},
}) ;
}
/**
* Create a deep proxy for Google GenAI client instrumentation
* Recursively instruments methods and handles special cases like chats.create
*/
function createDeepProxy(target, currentPath = '', options) {
return new Proxy(target, {
get: (t, prop, receiver) => {
const value = Reflect.get(t, prop, receiver);
const methodPath = utils$1.buildMethodPath(currentPath, String(prop));
if (typeof value === 'function' && utils.shouldInstrument(methodPath)) {
// Special case: chats.create is synchronous but needs both instrumentation AND result proxying
if (methodPath === constants.CHATS_CREATE_METHOD) {
const instrumentedMethod = instrumentMethod(value , methodPath, t, options);
return function instrumentedAndProxiedCreate(...args) {
const result = instrumentedMethod(...args);
// If the result is an object (like a chat instance), proxy it too
if (result && typeof result === 'object') {
return createDeepProxy(result, constants.CHAT_PATH, options);
}
return result;
};
}
return instrumentMethod(value , methodPath, t, options);
}
if (typeof value === 'function') {
// Bind non-instrumented functions to preserve the original `this` context
return value.bind(t);
}
if (value && typeof value === 'object') {
return createDeepProxy(value, methodPath, options);
}
return value;
},
});
}
/**
* Instrument a Google GenAI client with Sentry tracing
* Can be used across Node.js, Cloudflare Workers, and Vercel Edge
*
* @template T - The type of the client that extends client object
* @param client - The Google GenAI client to instrument
* @param options - Optional configuration for recording inputs and outputs
* @returns The instrumented client with the same type as the input
*
* @example
* ```typescript
* import { GoogleGenAI } from '@google/genai';
* import { instrumentGoogleGenAIClient } from '@sentry/core';
*
* const genAI = new GoogleGenAI({ apiKey: process.env.GOOGLE_GENAI_API_KEY });
* const instrumentedClient = instrumentGoogleGenAIClient(genAI);
*
* // Now both chats.create and sendMessage will be instrumented
* const chat = instrumentedClient.chats.create({ model: 'gemini-1.5-pro' });
* const response = await chat.sendMessage({ message: 'Hello' });
* ```
*/
function instrumentGoogleGenAIClient(client, options) {
const sendDefaultPii = Boolean(currentScopes.getClient()?.getOptions().sendDefaultPii);
const _options = {
recordInputs: sendDefaultPii,
recordOutputs: sendDefaultPii,
...options,
};
return createDeepProxy(client, '', _options);
}
exports.extractModel = extractModel;
exports.instrumentGoogleGenAIClient = instrumentGoogleGenAIClient;
//# sourceMappingURL=index.js.map
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _v = _interopRequireDefault(require("./v35.js"));
var _sha = _interopRequireDefault(require("./sha1.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const v5 = (0, _v.default)('v5', 0x50, _sha.default);
var _default = v5;
exports.default = _default;
@@ -0,0 +1,13 @@
import type { Locale } from "./types.js";
/**
* @category Locales
* @summary Spanish locale.
* @language Spanish
* @iso-639-2 spa
* @author Juan Angosto [@juanangosto](https://github.com/juanangosto)
* @author Guillermo Grau [@guigrpa](https://github.com/guigrpa)
* @author Fernando Agüero [@fjaguero](https://github.com/fjaguero)
* @author Gastón Haro [@harogaston](https://github.com/harogaston)
* @author Yago Carballo [@YagoCarballo](https://github.com/YagoCarballo)
*/
export declare const es: Locale;
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,qDAA2D;AAAlD,yHAAA,sBAAsB,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { TediousInstrumentation } from './instrumentation';\nexport type { TediousInstrumentationConfig } from './types';\n"]}
@@ -0,0 +1,12 @@
import Errors from './errors'
export default MockErrors
declare namespace MockErrors {
/** The request does not match any registered mock dispatches. */
export class MockNotMatchedError extends Errors.UndiciError {
constructor(message?: string);
name: 'MockNotMatchedError';
code: 'UND_MOCK_ERR_MOCK_NOT_MATCHED';
}
}
@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CacheStorage = void 0;
var CacheStorage = /** @class */ (function () {
function CacheStorage() {
}
return CacheStorage;
}());
exports.CacheStorage = CacheStorage;
//# sourceMappingURL=cache-storage.js.map
@@ -0,0 +1,24 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/**
* Parse a sample rate from a given value.
* This will either return a boolean or number sample rate, if the sample rate is valid (between 0 and 1).
* If a string is passed, we try to convert it to a number.
*
* Any invalid sample rate will return `undefined`.
*/
function parseSampleRate(sampleRate) {
if (typeof sampleRate === 'boolean') {
return Number(sampleRate);
}
const rate = typeof sampleRate === 'string' ? parseFloat(sampleRate) : sampleRate;
if (typeof rate !== 'number' || isNaN(rate) || rate < 0 || rate > 1) {
return undefined;
}
return rate;
}
exports.parseSampleRate = parseSampleRate;
//# sourceMappingURL=parseSampleRate.js.map
@@ -0,0 +1,93 @@
"use strict";
const color = require('kleur');
const Prompt = require('./prompt');
const _require = require('../util'),
style = _require.style,
clear = _require.clear;
const _require2 = require('sisteransi'),
erase = _require2.erase,
cursor = _require2.cursor;
/**
* ConfirmPrompt Base Element
* @param {Object} opts Options
* @param {String} opts.message Message
* @param {Boolean} [opts.initial] Default value (true/false)
* @param {Stream} [opts.stdin] The Readable stream to listen to
* @param {Stream} [opts.stdout] The Writable stream to write readline data to
* @param {String} [opts.yes] The "Yes" label
* @param {String} [opts.yesOption] The "Yes" option when choosing between yes/no
* @param {String} [opts.no] The "No" label
* @param {String} [opts.noOption] The "No" option when choosing between yes/no
*/
class ConfirmPrompt extends Prompt {
constructor(opts = {}) {
super(opts);
this.msg = opts.message;
this.value = opts.initial;
this.initialValue = !!opts.initial;
this.yesMsg = opts.yes || 'yes';
this.yesOption = opts.yesOption || '(Y/n)';
this.noMsg = opts.no || 'no';
this.noOption = opts.noOption || '(y/N)';
this.render();
}
reset() {
this.value = this.initialValue;
this.fire();
this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = true;
this.fire();
this.render();
this.out.write('\n');
this.close();
}
submit() {
this.value = this.value || false;
this.done = true;
this.aborted = false;
this.fire();
this.render();
this.out.write('\n');
this.close();
}
_(c, key) {
if (c.toLowerCase() === 'y') {
this.value = true;
return this.submit();
}
if (c.toLowerCase() === 'n') {
this.value = false;
return this.submit();
}
return this.bell();
}
render() {
if (this.closed) return;
if (this.firstRender) this.out.write(cursor.hide);else this.out.write(clear(this.outputText, this.out.columns));
super.render();
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.done ? this.value ? this.yesMsg : this.noMsg : color.gray(this.initialValue ? this.yesOption : this.noOption)].join(' ');
this.out.write(erase.line + cursor.to(0) + this.outputText);
}
}
module.exports = ConfirmPrompt;
@@ -0,0 +1,5 @@
import type { AddAliasToSelection } from "../query-builders/select.types.js";
import type { ColumnsSelection } from "../sql/sql.js";
import type { Subquery, WithSubquery } from "../subquery.js";
export type SubqueryWithSelection<TSelection extends ColumnsSelection, TAlias extends string> = Subquery<TAlias, AddAliasToSelection<TSelection, TAlias, 'gel'>> & AddAliasToSelection<TSelection, TAlias, 'gel'>;
export type WithSubqueryWithSelection<TSelection extends ColumnsSelection, TAlias extends string> = WithSubquery<TAlias, AddAliasToSelection<TSelection, TAlias, 'gel'>> & AddAliasToSelection<TSelection, TAlias, 'gel'>;
@@ -0,0 +1,49 @@
import type {
Interval,
LocalizedOptions,
StepOptions,
WeekOptions,
} from "./types.js";
/**
* The {@link eachWeekOfInterval} function options.
*/
export interface EachWeekOfIntervalOptions
extends StepOptions,
WeekOptions,
LocalizedOptions<"options"> {}
/**
* @name eachWeekOfInterval
* @category Interval Helpers
* @summary Return the array of weeks within the specified time interval.
*
* @description
* Return the array of weeks within the specified time interval.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param interval - The interval.
* @param options - An object with options.
*
* @returns The array with starts of weeks from the week of the interval start to the week of the interval end
*
* @example
* // Each week within interval 6 October 2014 - 23 November 2014:
* const result = eachWeekOfInterval({
* start: new Date(2014, 9, 6),
* end: new Date(2014, 10, 23)
* })
* //=> [
* // Sun Oct 05 2014 00:00:00,
* // Sun Oct 12 2014 00:00:00,
* // Sun Oct 19 2014 00:00:00,
* // Sun Oct 26 2014 00:00:00,
* // Sun Nov 02 2014 00:00:00,
* // Sun Nov 09 2014 00:00:00,
* // Sun Nov 16 2014 00:00:00,
* // Sun Nov 23 2014 00:00:00
* // ]
*/
export declare function eachWeekOfInterval<DateType extends Date>(
interval: Interval<DateType>,
options?: EachWeekOfIntervalOptions,
): DateType[];
@@ -0,0 +1,5 @@
export interface TokenSummary {
inputTokens: number;
outputTokens: number;
}
//# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,59 @@
import { Integration } from '@sentry/core';
/**
* Telemetry configuration.
*/
export type TelemetrySettings = {
/**
* Enable or disable telemetry. Disabled by default while experimental.
*/
isEnabled?: boolean;
/**
* Enable or disable input recording. Enabled by default.
*
* You might want to disable input recording to avoid recording sensitive
* information, to reduce data transfers, or to increase performance.
*/
recordInputs?: boolean;
/**
* Enable or disable output recording. Enabled by default.
*
* You might want to disable output recording to avoid recording sensitive
* information, to reduce data transfers, or to increase performance.
*/
recordOutputs?: boolean;
/**
* Identifier for this function. Used to group telemetry data by function.
*/
functionId?: string;
/**
* Additional information to include in the telemetry data.
*/
metadata?: Record<string, AttributeValue>;
};
/**
* Attribute values may be any non-nullish primitive value except an object.
*
* null or undefined attribute values are invalid and will result in undefined behavior.
*/
export declare type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
export interface VercelAiOptions {
/**
* Enable or disable input recording. Enabled if `sendDefaultPii` is `true`
* or if you set `isEnabled` to `true` in your ai SDK method telemetry settings
*/
recordInputs?: boolean;
/**
* Enable or disable output recording. Enabled if `sendDefaultPii` is `true`
* or if you set `isEnabled` to `true` in your ai SDK method telemetry settings
*/
recordOutputs?: boolean;
/**
* By default, the instrumentation will register span processors only when the ai package is used.
* If you want to register the span processors even when the ai package usage cannot be detected, you can set `force` to `true`.
*/
force?: boolean;
}
export interface VercelAiIntegration extends Integration {
options: VercelAiOptions;
}
//# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,177 @@
const rxParseJson = /position\s(\d+)(?: \(line \d+ column \d+\))?$/
export function parseJson(s: string, pos: number): unknown {
let endPos: number | undefined
parseJson.message = undefined
let matches: RegExpExecArray | null
if (pos) s = s.slice(pos)
try {
parseJson.position = pos + s.length
return JSON.parse(s)
} catch (e) {
matches = rxParseJson.exec((e as Error).message)
if (!matches) {
parseJson.message = "unexpected end"
return undefined
}
endPos = +matches[1]
const c = s[endPos]
s = s.slice(0, endPos)
parseJson.position = pos + endPos
try {
return JSON.parse(s)
} catch (e1) {
parseJson.message = `unexpected token ${c}`
return undefined
}
}
}
parseJson.message = undefined as string | undefined
parseJson.position = 0 as number
parseJson.code = 'require("ajv/dist/runtime/parseJson").parseJson'
export function parseJsonNumber(s: string, pos: number, maxDigits?: number): number | undefined {
let numStr = ""
let c: string
parseJsonNumber.message = undefined
if (s[pos] === "-") {
numStr += "-"
pos++
}
if (s[pos] === "0") {
numStr += "0"
pos++
} else {
if (!parseDigits(maxDigits)) {
errorMessage()
return undefined
}
}
if (maxDigits) {
parseJsonNumber.position = pos
return +numStr
}
if (s[pos] === ".") {
numStr += "."
pos++
if (!parseDigits()) {
errorMessage()
return undefined
}
}
if (((c = s[pos]), c === "e" || c === "E")) {
numStr += "e"
pos++
if (((c = s[pos]), c === "+" || c === "-")) {
numStr += c
pos++
}
if (!parseDigits()) {
errorMessage()
return undefined
}
}
parseJsonNumber.position = pos
return +numStr
function parseDigits(maxLen?: number): boolean {
let digit = false
while (((c = s[pos]), c >= "0" && c <= "9" && (maxLen === undefined || maxLen-- > 0))) {
digit = true
numStr += c
pos++
}
return digit
}
function errorMessage(): void {
parseJsonNumber.position = pos
parseJsonNumber.message = pos < s.length ? `unexpected token ${s[pos]}` : "unexpected end"
}
}
parseJsonNumber.message = undefined as string | undefined
parseJsonNumber.position = 0 as number
parseJsonNumber.code = 'require("ajv/dist/runtime/parseJson").parseJsonNumber'
const escapedChars: {[X in string]?: string} = {
b: "\b",
f: "\f",
n: "\n",
r: "\r",
t: "\t",
'"': '"',
"/": "/",
"\\": "\\",
}
const CODE_A: number = "a".charCodeAt(0)
const CODE_0: number = "0".charCodeAt(0)
export function parseJsonString(s: string, pos: number): string | undefined {
let str = ""
let c: string | undefined
parseJsonString.message = undefined
// eslint-disable-next-line no-constant-condition, @typescript-eslint/no-unnecessary-condition
while (true) {
c = s[pos++]
if (c === '"') break
if (c === "\\") {
c = s[pos]
if (c in escapedChars) {
str += escapedChars[c]
pos++
} else if (c === "u") {
pos++
let count = 4
let code = 0
while (count--) {
code <<= 4
c = s[pos]
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (c === undefined) {
errorMessage("unexpected end")
return undefined
}
c = c.toLowerCase()
if (c >= "a" && c <= "f") {
code += c.charCodeAt(0) - CODE_A + 10
} else if (c >= "0" && c <= "9") {
code += c.charCodeAt(0) - CODE_0
} else {
errorMessage(`unexpected token ${c}`)
return undefined
}
pos++
}
str += String.fromCharCode(code)
} else {
errorMessage(`unexpected token ${c}`)
return undefined
}
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
} else if (c === undefined) {
errorMessage("unexpected end")
return undefined
} else {
if (c.charCodeAt(0) >= 0x20) {
str += c
} else {
errorMessage(`unexpected token ${c}`)
return undefined
}
}
}
parseJsonString.position = pos
return str
function errorMessage(msg: string): void {
parseJsonString.position = pos
parseJsonString.message = msg
}
}
parseJsonString.message = undefined as string | undefined
parseJsonString.position = 0 as number
parseJsonString.code = 'require("ajv/dist/runtime/parseJson").parseJsonString'
@@ -0,0 +1,10 @@
import { status as httpStatus } from 'http-status';
import { APIError } from './APIError.js';
export class QueryError extends APIError {
constructor(results){
const message = `The following path${results.length === 1 ? '' : 's'} cannot be queried:`;
super(`${message} ${results.map((err)=>err.path).join(', ')}`, httpStatus.BAD_REQUEST, results);
}
}
//# sourceMappingURL=QueryError.js.map
@@ -0,0 +1,216 @@
'use strict'
/**
* @typedef {import('../../types/dispatcher.d.ts').default.DispatchHandler} DispatchHandler
*/
/**
* Handler that buffers response data and notifies multiple waiting handlers.
* Used for request deduplication.
*
* @implements {DispatchHandler}
*/
class DeduplicationHandler {
/**
* @type {DispatchHandler}
*/
#primaryHandler
/**
* @type {DispatchHandler[]}
*/
#waitingHandlers = []
/**
* @type {Buffer[]}
*/
#chunks = []
/**
* @type {number}
*/
#statusCode = 0
/**
* @type {Record<string, string | string[]>}
*/
#headers = {}
/**
* @type {string}
*/
#statusMessage = ''
/**
* @type {boolean}
*/
#aborted = false
/**
* @type {import('../../types/dispatcher.d.ts').default.DispatchController | null}
*/
#controller = null
/**
* @type {(() => void) | null}
*/
#onComplete = null
/**
* @param {DispatchHandler} primaryHandler The primary handler
* @param {() => void} onComplete Callback when request completes
*/
constructor (primaryHandler, onComplete) {
this.#primaryHandler = primaryHandler
this.#onComplete = onComplete
}
/**
* Add a waiting handler that will receive the buffered response
* @param {DispatchHandler} handler
*/
addWaitingHandler (handler) {
this.#waitingHandlers.push(handler)
}
/**
* @param {() => void} abort
* @param {any} context
*/
onRequestStart (controller, context) {
this.#controller = controller
this.#primaryHandler.onRequestStart?.(controller, context)
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
* @param {number} statusCode
* @param {import('../../types/header.d.ts').IncomingHttpHeaders} headers
* @param {Socket} socket
*/
onRequestUpgrade (controller, statusCode, headers, socket) {
this.#primaryHandler.onRequestUpgrade?.(controller, statusCode, headers, socket)
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
* @param {number} statusCode
* @param {Record<string, string | string[]>} headers
* @param {string} statusMessage
*/
onResponseStart (controller, statusCode, headers, statusMessage) {
this.#statusCode = statusCode
this.#headers = headers
this.#statusMessage = statusMessage
this.#primaryHandler.onResponseStart?.(controller, statusCode, headers, statusMessage)
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
* @param {Buffer} chunk
*/
onResponseData (controller, chunk) {
// Buffer the chunk for waiting handlers
this.#chunks.push(Buffer.from(chunk))
this.#primaryHandler.onResponseData?.(controller, chunk)
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
* @param {object} trailers
*/
onResponseEnd (controller, trailers) {
this.#primaryHandler.onResponseEnd?.(controller, trailers)
this.#notifyWaitingHandlers()
this.#onComplete?.()
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
* @param {Error} err
*/
onResponseError (controller, err) {
this.#aborted = true
this.#primaryHandler.onResponseError?.(controller, err)
this.#notifyWaitingHandlersError(err)
this.#onComplete?.()
}
/**
* Notify all waiting handlers with the buffered response
*/
#notifyWaitingHandlers () {
const body = Buffer.concat(this.#chunks)
for (const handler of this.#waitingHandlers) {
// Create a simple controller for each waiting handler
const waitingController = {
resume () {},
pause () {},
get paused () { return false },
get aborted () { return false },
get reason () { return null },
abort () {}
}
try {
handler.onRequestStart?.(waitingController, null)
if (waitingController.aborted) {
continue
}
handler.onResponseStart?.(
waitingController,
this.#statusCode,
this.#headers,
this.#statusMessage
)
if (waitingController.aborted) {
continue
}
if (body.length > 0) {
handler.onResponseData?.(waitingController, body)
}
handler.onResponseEnd?.(waitingController, {})
} catch {
// Ignore errors from waiting handlers
}
}
this.#waitingHandlers = []
this.#chunks = []
}
/**
* Notify all waiting handlers of an error
* @param {Error} err
*/
#notifyWaitingHandlersError (err) {
for (const handler of this.#waitingHandlers) {
const waitingController = {
resume () {},
pause () {},
get paused () { return false },
get aborted () { return true },
get reason () { return err },
abort () {}
}
try {
handler.onRequestStart?.(waitingController, null)
handler.onResponseError?.(waitingController, err)
} catch {
// Ignore errors from waiting handlers
}
}
this.#waitingHandlers = []
this.#chunks = []
}
}
module.exports = DeduplicationHandler
@@ -0,0 +1,32 @@
"use strict";
exports.lastDayOfQuarter = lastDayOfQuarter;
var _index = require("./toDate.js");
/**
* @name lastDayOfQuarter
* @category Quarter Helpers
* @summary Return the last day of a year quarter for the given date.
*
* @description
* Return the last day of a year quarter for the given date.
* The result will be in the local timezone.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The original date
*
* @returns The last day of a quarter
*
* @example
* // The last day of a quarter for 2 September 2014 11:55:00:
* const result = lastDayOfQuarter(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Sep 30 2014 00:00:00
*/
function lastDayOfQuarter(date) {
const _date = (0, _index.toDate)(date);
const currentMonth = _date.getMonth();
const month = currentMonth - (currentMonth % 3) + 3;
_date.setMonth(month, 0);
_date.setHours(0, 0, 0, 0);
return _date;
}
@@ -0,0 +1,28 @@
import { formatDistance } from "./en-US/_lib/formatDistance.js";
import { formatLong } from "./en-AU/_lib/formatLong.js";
import { formatRelative } from "./en-US/_lib/formatRelative.js";
import { localize } from "./en-US/_lib/localize.js";
import { match } from "./en-US/_lib/match.js";
/**
* @category Locales
* @summary English locale (Australia).
* @language English
* @iso-639-2 eng
* @author Julien Malige [@JulienMalige](https://github.com/JulienMalige)
*/
export const enAU = {
code: "en-AU",
formatDistance: formatDistance,
formatLong: formatLong,
formatRelative: formatRelative,
localize: localize,
match: match,
options: {
weekStartsOn: 1 /* Monday */,
firstWeekContainsDate: 4,
},
};
// Fallback for modularized imports:
export default enAU;
@@ -0,0 +1,24 @@
var assignValue = require('./_assignValue'),
baseZipObject = require('./_baseZipObject');
/**
* This method is like `_.fromPairs` except that it accepts two arrays,
* one of property identifiers and one of corresponding values.
*
* @static
* @memberOf _
* @since 0.4.0
* @category Array
* @param {Array} [props=[]] The property identifiers.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
*
* _.zipObject(['a', 'b'], [1, 2]);
* // => { 'a': 1, 'b': 2 }
*/
function zipObject(props, values) {
return baseZipObject(props || [], values || [], assignValue);
}
module.exports = zipObject;
@@ -0,0 +1,10 @@
"use strict";
exports.yearsToDays = void 0;
var _index = require("../yearsToDays.cjs");
var _index2 = require("./_lib/convertToFP.cjs"); // This file is generated automatically by `scripts/build/fp.ts`. Please, don't change it.
const yearsToDays = (exports.yearsToDays = (0, _index2.convertToFP)(
_index.yearsToDays,
1,
));
@@ -0,0 +1 @@
{"version":3,"file":"chevron-first.js","sources":["../../../src/icons/chevron-first.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ChevronFirst\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTcgMTgtNi02IDYtNiIgLz4KICA8cGF0aCBkPSJNNyA2djEyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/chevron-first\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 ChevronFirst = createLucideIcon('ChevronFirst', [\n ['path', { d: 'm17 18-6-6 6-6', key: '1yerx2' }],\n ['path', { d: 'M7 6v12', key: '1p53r6' }],\n]);\n\nexport default ChevronFirst;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,iBAAiB,cAAgB,CAAA,CAAA,CAAA;AAAA,CAAA,CACpD,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,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,5 @@
# `@lexical/overflow`
[![See API Documentation](https://lexical.dev/img/see-api-documentation.svg)](https://lexical.dev/docs/api/modules/lexical_overflow)
This package contains selection overflow helpers and nodes for Lexical.
@@ -0,0 +1,202 @@
'use client';
import { c as _c } from "react/compiler-runtime";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React from 'react';
import { DraggableSortableItem } from '../../../elements/DraggableSortable/DraggableSortableItem/index.js';
import { DraggableSortable } from '../../../elements/DraggableSortable/index.js';
import { DragHandleIcon } from '../../../icons/DragHandle/index.js';
import { RelationshipContent } from '../RelationshipContent/index.js';
import { UploadCard } from '../UploadCard/index.js';
const baseClass = 'upload upload--has-many';
import { getBestFitFromSizes, isImage } from 'payload/shared';
import './index.scss';
export function UploadComponentHasMany(props) {
const $ = _c(29);
const {
className,
displayPreview,
fileDocs,
isSortable,
onRemove,
onReorder,
readonly,
reloadDoc,
serverURL,
showCollectionSlug: t0
} = props;
const showCollectionSlug = t0 === undefined ? false : t0;
let t1;
if ($[0] !== fileDocs || $[1] !== onReorder) {
t1 = (moveFromIndex, moveToIndex) => {
if (moveFromIndex === moveToIndex) {
return;
}
const updatedArray = [...fileDocs];
const [item] = updatedArray.splice(moveFromIndex, 1);
updatedArray.splice(moveToIndex, 0, item);
onReorder(updatedArray);
};
$[0] = fileDocs;
$[1] = onReorder;
$[2] = t1;
} else {
t1 = $[2];
}
const moveRow = t1;
let t2;
if ($[3] !== fileDocs || $[4] !== onRemove) {
t2 = index => {
const updatedArray_0 = [...(fileDocs || [])];
updatedArray_0.splice(index, 1);
onRemove(updatedArray_0.length === 0 ? [] : updatedArray_0);
};
$[3] = fileDocs;
$[4] = onRemove;
$[5] = t2;
} else {
t2 = $[5];
}
const removeItem = t2;
let t3;
if ($[6] !== className) {
t3 = [baseClass, className].filter(Boolean);
$[6] = className;
$[7] = t3;
} else {
t3 = $[7];
}
const t4 = t3.join(" ");
let t5;
if ($[8] !== displayPreview || $[9] !== fileDocs || $[10] !== isSortable || $[11] !== moveRow || $[12] !== readonly || $[13] !== reloadDoc || $[14] !== removeItem || $[15] !== serverURL || $[16] !== showCollectionSlug || $[17] !== t4) {
let t6;
if ($[19] !== moveRow) {
t6 = t7 => {
const {
moveFromIndex: moveFromIndex_0,
moveToIndex: moveToIndex_0
} = t7;
return moveRow(moveFromIndex_0, moveToIndex_0);
};
$[19] = moveRow;
$[20] = t6;
} else {
t6 = $[20];
}
let t7;
if ($[21] !== displayPreview || $[22] !== isSortable || $[23] !== readonly || $[24] !== reloadDoc || $[25] !== removeItem || $[26] !== serverURL || $[27] !== showCollectionSlug) {
t7 = (t8, index_0) => {
const {
relationTo,
value: value_0
} = t8;
const id = String(value_0.id);
let src;
let thumbnailSrc;
if (value_0.url) {
try {
src = new URL(value_0.url, serverURL).toString();
} catch {
src = `${serverURL}${value_0.url}`;
}
}
if (value_0.thumbnailURL) {
try {
thumbnailSrc = new URL(value_0.thumbnailURL, serverURL).toString();
} catch {
thumbnailSrc = `${serverURL}${value_0.thumbnailURL}`;
}
}
if (isImage(value_0.mimeType)) {
thumbnailSrc = getBestFitFromSizes({
sizes: value_0.sizes,
thumbnailURL: thumbnailSrc,
url: src,
width: value_0.width
});
}
return _jsx(DraggableSortableItem, {
disabled: !isSortable || readonly,
id,
children: draggableSortableItemProps => _jsx("div", {
className: [`${baseClass}__dragItem`, draggableSortableItemProps && isSortable && `${baseClass}--has-drag-handle`].filter(Boolean).join(" "),
ref: draggableSortableItemProps.setNodeRef,
style: {
transform: draggableSortableItemProps.transform,
transition: draggableSortableItemProps.transition,
zIndex: draggableSortableItemProps.isDragging ? 1 : undefined
},
children: _jsxs(UploadCard, {
size: "small",
children: [draggableSortableItemProps && _jsx("div", {
className: `${baseClass}__drag`,
...draggableSortableItemProps.attributes,
...draggableSortableItemProps.listeners,
children: _jsx(DragHandleIcon, {})
}), _jsx(RelationshipContent, {
allowEdit: !readonly,
allowRemove: !readonly,
alt: value_0?.alt || value_0?.filename,
byteSize: value_0.filesize,
collectionSlug: relationTo,
displayPreview,
filename: value_0.filename,
id,
mimeType: value_0?.mimeType,
onRemove: () => removeItem(index_0),
reloadDoc,
showCollectionSlug,
src,
thumbnailSrc,
updatedAt: value_0.updatedAt,
withMeta: false,
x: value_0?.width,
y: value_0?.height
})]
})
})
}, id);
};
$[21] = displayPreview;
$[22] = isSortable;
$[23] = readonly;
$[24] = reloadDoc;
$[25] = removeItem;
$[26] = serverURL;
$[27] = showCollectionSlug;
$[28] = t7;
} else {
t7 = $[28];
}
t5 = _jsx("div", {
className: t4,
children: _jsx(DraggableSortable, {
className: `${baseClass}__draggable-rows`,
ids: fileDocs?.map(_temp),
onDragEnd: t6,
children: fileDocs.map(t7)
})
});
$[8] = displayPreview;
$[9] = fileDocs;
$[10] = isSortable;
$[11] = moveRow;
$[12] = readonly;
$[13] = reloadDoc;
$[14] = removeItem;
$[15] = serverURL;
$[16] = showCollectionSlug;
$[17] = t4;
$[18] = t5;
} else {
t5 = $[18];
}
return t5;
}
function _temp(t0) {
const {
value
} = t0;
return String(value.id);
}
//# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
import type { ObjMap, ReadOnlyObjMap } from './ObjMap';
/**
* Creates an object map with the same keys as `map` and values generated by
* running each value of `map` thru `fn`.
*/
export declare function mapValue<T, V>(
map: ReadOnlyObjMap<T>,
fn: (value: T, key: string) => V,
): ObjMap<V>;
@@ -0,0 +1,9 @@
export const timestamp = (label)=>{
if (!process.env.PAYLOAD_TIME) {
process.env.PAYLOAD_TIME = String(new Date().getTime());
}
const now = new Date();
console.log(`[${now.getTime() - Number(process.env.PAYLOAD_TIME)}ms] ${label}`);
};
//# sourceMappingURL=timestamp.js.map
@@ -0,0 +1 @@
{"version":3,"file":"deepProperties.js","sourceRoot":"","sources":["../../src/definitions/deepProperties.ts"],"names":[],"mappings":";;AAEA,mCAAqC;AAErC,SAAwB,MAAM,CAAC,IAAwB;IACrD,OAAO;QACL,OAAO,EAAE,gBAAgB;QACzB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,UAAU,MAAoC;YACnD,MAAM,KAAK,GAAG,EAAE,CAAA;YAChB,KAAK,MAAM,OAAO,IAAI,MAAM;gBAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;YAC7E,OAAO,EAAC,KAAK,EAAC,CAAA;QAChB,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAC;YACvD,oBAAoB,EAAE,IAAA,qBAAa,EAAC,IAAI,CAAC;SAC1C;KACF,CAAA;AACH,CAAC;AAhBD,yBAgBC;AAED,SAAS,SAAS,CAAC,WAAmB,EAAE,MAAoB;IAC1D,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACvC,MAAM,UAAU,GAAiB,EAAE,CAAA;IACnC,IAAI,aAAa,GAAiB,UAAU,CAAA;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,IAAI,OAAO,GAAW,QAAQ,CAAC,CAAC,CAAC,CAAA;QACjC,MAAM,MAAM,GAAG,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAA;QACxC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAA;QACtC,MAAM,UAAU,GAA2B,CAAC,aAAa,CAAC,UAAU,GAAG,EAAE,CAAC,CAAA;QAC1E,IAAI,KAAiC,CAAA;QACrC,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YAC1B,IAAI,KAAK,GAAG,CAAC,OAAO,CAAA;YACpB,KAAK,GAAG,aAAa,CAAC,KAAK,GAAG,EAAE,CAAA;YAChC,aAAa,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YACxC,OAAO,KAAK,EAAE;gBAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;SAC/B;aAAM;YACL,aAAa,CAAC,IAAI,GAAG,QAAQ,CAAA;SAC9B;QACD,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;QACpC,UAAU,CAAC,OAAO,CAAC,GAAG,aAAa,CAAA;QACnC,IAAI,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;KACrC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AACpD,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"}
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/versions/migrations/localizeStatus/mongo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,cAAc;;;CAG1B,CAAA;AAED,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1,48 @@
import { sql } from 'drizzle-orm';
import { buildVersionGlobalFields } from 'payload';
import { hasDraftsEnabled } from 'payload/shared';
import toSnakeCase from 'to-snake-case';
import { upsertRow } from './upsertRow/index.js';
import { getTransaction } from './utilities/getTransaction.js';
export async function createGlobalVersion({ autosave, createdAt, globalSlug, publishedLocale, req, returning, select, snapshot, updatedAt, versionData }) {
const global = this.payload.globals.config.find(({ slug })=>slug === globalSlug);
const tableName = this.tableNameMap.get(`_${toSnakeCase(global.slug)}${this.versionsSuffix}`);
const db = await getTransaction(this, req);
const result = await upsertRow({
adapter: this,
data: {
autosave,
createdAt,
latest: true,
publishedLocale,
snapshot,
updatedAt,
version: versionData
},
db,
fields: buildVersionGlobalFields(this.payload.config, global, true),
globalSlug,
ignoreResult: returning === false ? 'idOnly' : false,
operation: 'create',
req,
select,
tableName
});
const table = this.tables[tableName];
if (hasDraftsEnabled(global)) {
await this.execute({
db,
sql: sql`
UPDATE ${table}
SET latest = false
WHERE ${table.id} != ${result.id};
`
});
}
if (returning === false) {
return null;
}
return result;
}
//# sourceMappingURL=createGlobalVersion.js.map
@@ -0,0 +1,124 @@
export type Task<T> = () => Promise<T>;
export type FunctionReturning<T> = () => T;
export type ExtractCommentsOptions =
import("./index.js").ExtractCommentsOptions;
export type ExtractCommentsFunction =
import("./index.js").ExtractCommentsFunction;
export type ExtractCommentsCondition =
import("./index.js").ExtractCommentsCondition;
export type Input = import("./index.js").Input;
export type MinimizedResult = import("./index.js").MinimizedResult;
export type CustomOptions = import("./index.js").CustomOptions;
export type RawSourceMap = import("./index.js").RawSourceMap;
export type PredefinedOptions<T> = import("./index.js").PredefinedOptions<T>;
export type ExtractedComments = Array<string>;
/**
* @param {Input} input input
* @param {RawSourceMap=} sourceMap source map
* @param {CustomOptions=} minimizerOptions options
* @returns {Promise<MinimizedResult>} minimized result
*/
export function esbuildMinify(
input: Input,
sourceMap?: RawSourceMap | undefined,
minimizerOptions?: CustomOptions | undefined,
): Promise<MinimizedResult>;
export namespace esbuildMinify {
/**
* @returns {string | undefined} the minimizer version
*/
function getMinimizerVersion(): string | undefined;
/**
* @returns {boolean | undefined} true if worker thread is supported, false otherwise
*/
function supportsWorkerThreads(): boolean | undefined;
}
/**
* @template T
* @typedef {() => T} FunctionReturning
*/
/**
* @template T
* @param {FunctionReturning<T>} fn memorized function
* @returns {FunctionReturning<T>} new function
*/
export function memoize<T>(fn: FunctionReturning<T>): FunctionReturning<T>;
/**
* @param {Input} input input
* @param {RawSourceMap=} sourceMap source map
* @param {CustomOptions=} minimizerOptions options
* @returns {Promise<MinimizedResult>} minimized result
*/
export function swcMinify(
input: Input,
sourceMap?: RawSourceMap | undefined,
minimizerOptions?: CustomOptions | undefined,
): Promise<MinimizedResult>;
export namespace swcMinify {
/**
* @returns {string | undefined} the minimizer version
*/
function getMinimizerVersion(): string | undefined;
/**
* @returns {boolean | undefined} true if worker thread is supported, false otherwise
*/
function supportsWorkerThreads(): boolean | undefined;
}
/**
* @param {Input} input input
* @param {RawSourceMap=} sourceMap source map
* @param {CustomOptions=} minimizerOptions options
* @param {ExtractCommentsOptions=} extractComments extract comments option
* @returns {Promise<MinimizedResult>} minimized result
*/
export function terserMinify(
input: Input,
sourceMap?: RawSourceMap | undefined,
minimizerOptions?: CustomOptions | undefined,
extractComments?: ExtractCommentsOptions | undefined,
): Promise<MinimizedResult>;
export namespace terserMinify {
/**
* @returns {string | undefined} the minimizer version
*/
function getMinimizerVersion(): string | undefined;
/**
* @returns {boolean | undefined} true if worker thread is supported, false otherwise
*/
function supportsWorkerThreads(): boolean | undefined;
}
/**
* @template T
* @typedef {() => Promise<T>} Task
*/
/**
* Run tasks with limited concurrency.
* @template T
* @param {number} limit Limit of tasks that run at once.
* @param {Task<T>[]} tasks List of tasks to run.
* @returns {Promise<T[]>} A promise that fulfills to an array of the results
*/
export function throttleAll<T>(limit: number, tasks: Task<T>[]): Promise<T[]>;
/**
* @param {Input} input input
* @param {RawSourceMap=} sourceMap source map
* @param {CustomOptions=} minimizerOptions options
* @param {ExtractCommentsOptions=} extractComments extract comments option
* @returns {Promise<MinimizedResult>} minimized result
*/
export function uglifyJsMinify(
input: Input,
sourceMap?: RawSourceMap | undefined,
minimizerOptions?: CustomOptions | undefined,
extractComments?: ExtractCommentsOptions | undefined,
): Promise<MinimizedResult>;
export namespace uglifyJsMinify {
/**
* @returns {string | undefined} the minimizer version
*/
function getMinimizerVersion(): string | undefined;
/**
* @returns {boolean | undefined} true if worker thread is supported, false otherwise
*/
function supportsWorkerThreads(): boolean | undefined;
}
@@ -0,0 +1,8 @@
export declare const clamp: import("./types.js").FPFn2<
Date,
import("../fp.js").Interval<
import("../fp.js").DateArg<Date>,
import("../fp.js").DateArg<Date>
>,
import("../fp.js").DateArg<Date>
>;
@@ -0,0 +1,6 @@
import * as CSS from 'csstype';
import { CamelProperty, HyphenProperty, Property } from './types';
declare function style(node: HTMLElement, property: Partial<Record<Property, string>>): void;
declare function style<T extends HyphenProperty>(node: HTMLElement, property: T): CSS.PropertiesHyphen[T];
declare function style<T extends CamelProperty>(node: HTMLElement, property: T): CSS.Properties[T];
export default style;
@@ -0,0 +1,572 @@
/*
@license
Rollup.js v4.58.0
Fri, 20 Feb 2026 12:44:20 GMT - commit 33f39c1f205ea2eadaf4b589e493453e2baa3662
https://github.com/rollup/rollup
Released under the MIT License.
*/
'use strict';
const promises = require('node:fs/promises');
const path = require('node:path');
const process$1 = require('node:process');
const node_url = require('node:url');
const rollup = require('./rollup.js');
const parseAst_js = require('./parseAst.js');
const getLogFilter_js = require('../getLogFilter.js');
function batchWarnings(command) {
const silent = !!command.silent;
const logFilter = generateLogFilter(command);
let count = 0;
const deferredWarnings = new Map();
let warningOccurred = false;
const add = (warning) => {
count += 1;
warningOccurred = true;
if (silent)
return;
if (warning.code in deferredHandlers) {
rollup.getOrCreate(deferredWarnings, warning.code, rollup.getNewArray).push(warning);
}
else if (warning.code in immediateHandlers) {
immediateHandlers[warning.code](warning);
}
else {
title(warning.message);
defaultBody(warning);
}
};
return {
add,
get count() {
return count;
},
flush() {
if (count === 0 || silent)
return;
const codes = [...deferredWarnings.keys()].sort((a, b) => deferredWarnings.get(b).length - deferredWarnings.get(a).length);
for (const code of codes) {
deferredHandlers[code](deferredWarnings.get(code));
}
deferredWarnings.clear();
count = 0;
},
log(level, log) {
if (!logFilter(log))
return;
switch (level) {
case parseAst_js.LOGLEVEL_WARN: {
return add(log);
}
case parseAst_js.LOGLEVEL_DEBUG: {
if (!silent) {
rollup.stderr(rollup.bold(rollup.pc.blue(log.message)));
defaultBody(log);
}
return;
}
default: {
if (!silent) {
rollup.stderr(rollup.bold(rollup.pc.cyan(log.message)));
defaultBody(log);
}
}
}
},
get warningOccurred() {
return warningOccurred;
}
};
}
const immediateHandlers = {
MISSING_NODE_BUILTINS(warning) {
title(`Missing shims for Node.js built-ins`);
rollup.stderr(`Creating a browser bundle that depends on ${parseAst_js.printQuotedStringList(warning.ids)}. You might need to include https://github.com/FredKSchott/rollup-plugin-polyfill-node`);
},
UNKNOWN_OPTION(warning) {
title(`You have passed an unrecognized option`);
rollup.stderr(warning.message);
}
};
const deferredHandlers = {
CIRCULAR_DEPENDENCY(warnings) {
title(`Circular dependenc${warnings.length > 1 ? 'ies' : 'y'}`);
const displayed = warnings.length > 5 ? warnings.slice(0, 3) : warnings;
for (const warning of displayed) {
rollup.stderr(warning.ids.map(parseAst_js.relativeId).join(' -> '));
}
if (warnings.length > displayed.length) {
rollup.stderr(`...and ${warnings.length - displayed.length} more`);
}
},
EMPTY_BUNDLE(warnings) {
title(`Generated${warnings.length === 1 ? ' an' : ''} empty ${warnings.length > 1 ? 'chunks' : 'chunk'}`);
rollup.stderr(parseAst_js.printQuotedStringList(warnings.map(warning => warning.names[0])));
},
EVAL(warnings) {
title('Use of eval is strongly discouraged');
info(parseAst_js.getRollupUrl(parseAst_js.URL_AVOIDING_EVAL));
showTruncatedWarnings(warnings);
},
MISSING_EXPORT(warnings) {
title('Missing exports');
info(parseAst_js.getRollupUrl(parseAst_js.URL_NAME_IS_NOT_EXPORTED));
for (const warning of warnings) {
rollup.stderr(rollup.bold(parseAst_js.relativeId(warning.id)));
rollup.stderr(`${warning.binding} is not exported by ${parseAst_js.relativeId(warning.exporter)}`);
rollup.stderr(rollup.gray(warning.frame));
}
},
MISSING_GLOBAL_NAME(warnings) {
title(`Missing global variable ${warnings.length > 1 ? 'names' : 'name'}`);
info(parseAst_js.getRollupUrl(parseAst_js.URL_OUTPUT_GLOBALS));
rollup.stderr(`Use "output.globals" to specify browser global variable names corresponding to external modules:`);
for (const warning of warnings) {
rollup.stderr(`${rollup.bold(warning.id)} (guessing "${warning.names[0]}")`);
}
},
MIXED_EXPORTS(warnings) {
title('Mixing named and default exports');
info(parseAst_js.getRollupUrl(parseAst_js.URL_OUTPUT_EXPORTS));
rollup.stderr(rollup.bold('The following entry modules are using named and default exports together:'));
warnings.sort((a, b) => (a.id < b.id ? -1 : 1));
const displayedWarnings = warnings.length > 5 ? warnings.slice(0, 3) : warnings;
for (const warning of displayedWarnings) {
rollup.stderr(parseAst_js.relativeId(warning.id));
}
if (displayedWarnings.length < warnings.length) {
rollup.stderr(`...and ${warnings.length - displayedWarnings.length} other entry modules`);
}
rollup.stderr(`\nConsumers of your bundle will have to use chunk.default to access their default export, which may not be what you want. Use \`output.exports: "named"\` to disable this warning.`);
},
NAMESPACE_CONFLICT(warnings) {
title(`Conflicting re-exports`);
for (const warning of warnings) {
rollup.stderr(`"${rollup.bold(parseAst_js.relativeId(warning.reexporter))}" re-exports "${warning.binding}" from both "${parseAst_js.relativeId(warning.ids[0])}" and "${parseAst_js.relativeId(warning.ids[1])}" (will be ignored).`);
}
},
PLUGIN_WARNING(warnings) {
const nestedByPlugin = nest(warnings, 'plugin');
for (const { items } of nestedByPlugin) {
const nestedByMessage = nest(items, 'message');
let lastUrl = '';
for (const { key: message, items } of nestedByMessage) {
title(message);
for (const warning of items) {
if (warning.url && warning.url !== lastUrl)
info((lastUrl = warning.url));
const loc = formatLocation(warning);
if (loc) {
rollup.stderr(rollup.bold(loc));
}
if (warning.frame)
info(warning.frame);
}
}
}
},
SOURCEMAP_BROKEN(warnings) {
title(`Broken sourcemap`);
info(parseAst_js.getRollupUrl(parseAst_js.URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT));
const plugins = [...new Set(warnings.map(({ plugin }) => plugin).filter(Boolean))];
rollup.stderr(`Plugins that transform code (such as ${parseAst_js.printQuotedStringList(plugins)}) should generate accompanying sourcemaps.`);
},
THIS_IS_UNDEFINED(warnings) {
title('"this" has been rewritten to "undefined"');
info(parseAst_js.getRollupUrl(parseAst_js.URL_THIS_IS_UNDEFINED));
showTruncatedWarnings(warnings);
},
UNRESOLVED_IMPORT(warnings) {
title('Unresolved dependencies');
info(parseAst_js.getRollupUrl(parseAst_js.URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY));
const dependencies = new Map();
for (const warning of warnings) {
rollup.getOrCreate(dependencies, parseAst_js.relativeId(warning.exporter), rollup.getNewArray).push(parseAst_js.relativeId(warning.id));
}
for (const [dependency, importers] of dependencies) {
rollup.stderr(`${rollup.bold(dependency)} (imported by ${parseAst_js.printQuotedStringList(importers)})`);
}
},
UNUSED_EXTERNAL_IMPORT(warnings) {
title('Unused external imports');
for (const warning of warnings) {
rollup.stderr(warning.names +
' imported from external module "' +
warning.exporter +
'" but never used in ' +
parseAst_js.printQuotedStringList(warning.ids.map(parseAst_js.relativeId)) +
'.');
}
}
};
function defaultBody(log) {
if (log.url) {
info(log.url);
}
const loc = formatLocation(log);
if (loc) {
rollup.stderr(rollup.bold(loc));
}
if (log.frame)
info(log.frame);
}
function title(string_) {
rollup.stderr(rollup.bold(rollup.yellow(`(!) ${string_}`)));
}
function info(url) {
rollup.stderr(rollup.gray(url));
}
function nest(array, property) {
const nested = [];
const lookup = new Map();
for (const item of array) {
const key = item[property];
rollup.getOrCreate(lookup, key, () => {
const items = {
items: [],
key
};
nested.push(items);
return items;
}).items.push(item);
}
return nested;
}
function showTruncatedWarnings(warnings) {
const nestedByModule = nest(warnings, 'id');
const displayedByModule = nestedByModule.length > 5 ? nestedByModule.slice(0, 3) : nestedByModule;
for (const { key: id, items } of displayedByModule) {
rollup.stderr(rollup.bold(parseAst_js.relativeId(id)));
rollup.stderr(rollup.gray(items[0].frame));
if (items.length > 1) {
rollup.stderr(`...and ${items.length - 1} other ${items.length > 2 ? 'occurrences' : 'occurrence'}`);
}
}
if (nestedByModule.length > displayedByModule.length) {
rollup.stderr(`\n...and ${nestedByModule.length - displayedByModule.length} other files`);
}
}
function generateLogFilter(command) {
const filters = rollup.ensureArray(command.filterLogs).flatMap(filter => String(filter).split(','));
if (process.env.ROLLUP_FILTER_LOGS) {
filters.push(...process.env.ROLLUP_FILTER_LOGS.split(','));
}
return getLogFilter_js.getLogFilter(filters);
}
function formatLocation(log) {
const id = log.loc?.file || log.id;
if (!id)
return null;
return log.loc ? `${id}:${log.loc.line}:${log.loc.column}` : id;
}
const stdinName = '-';
let stdinResult = null;
function stdinPlugin(argument) {
const suffix = typeof argument == 'string' && argument.length > 0 ? '.' + argument : '';
return {
load(id) {
if (id === stdinName || id.startsWith(stdinName + '.')) {
return stdinResult || (stdinResult = readStdin());
}
},
name: 'stdin',
resolveId(id) {
if (id === stdinName) {
return id + suffix;
}
}
};
}
function readStdin() {
return new Promise((resolve, reject) => {
const chunks = [];
process$1.stdin.setEncoding('utf8');
process$1.stdin
.on('data', chunk => chunks.push(chunk))
.on('end', () => {
const result = chunks.join('');
resolve(result);
})
.on('error', error => {
reject(error);
});
});
}
function waitForInputPlugin() {
return {
async buildStart(options) {
const inputSpecifiers = Array.isArray(options.input)
? options.input
: Object.keys(options.input);
let lastAwaitedSpecifier = null;
checkSpecifiers: while (true) {
for (const specifier of inputSpecifiers) {
if ((await this.resolve(specifier)) === null) {
if (lastAwaitedSpecifier !== specifier) {
rollup.stderr(`waiting for input ${rollup.bold(specifier)}...`);
lastAwaitedSpecifier = specifier;
}
await new Promise(resolve => setTimeout(resolve, 500));
continue checkSpecifiers;
}
}
break;
}
},
name: 'wait-for-input'
};
}
async function addCommandPluginsToInputOptions(inputOptions, command) {
if (command.stdin !== false) {
inputOptions.plugins.push(stdinPlugin(command.stdin));
}
if (command.waitForBundleInput === true) {
inputOptions.plugins.push(waitForInputPlugin());
}
await addPluginsFromCommandOption(command.plugin, inputOptions);
}
async function addPluginsFromCommandOption(commandPlugin, inputOptions) {
if (commandPlugin) {
const plugins = await rollup.normalizePluginOption(commandPlugin);
for (const plugin of plugins) {
if (/[={}]/.test(plugin)) {
// -p plugin=value
// -p "{transform(c,i){...}}"
await loadAndRegisterPlugin(inputOptions, plugin);
}
else {
// split out plugins joined by commas
// -p node-resolve,commonjs,buble
for (const p of plugin.split(',')) {
await loadAndRegisterPlugin(inputOptions, p);
}
}
}
}
}
async function loadAndRegisterPlugin(inputOptions, pluginText) {
let plugin = null;
let pluginArgument = undefined;
if (pluginText[0] === '{') {
// -p "{transform(c,i){...}}"
plugin = new Function('return ' + pluginText);
}
else {
const match = pluginText.match(/^([\w./:@\\^{|}-]+)(=(.*))?$/);
if (match) {
// -p plugin
// -p plugin=arg
pluginText = match[1];
pluginArgument = new Function('return ' + match[3])();
}
else {
throw new Error(`Invalid --plugin argument format: ${JSON.stringify(pluginText)}`);
}
if (!/^\.|^rollup-plugin-|[/@\\]/.test(pluginText)) {
// Try using plugin prefix variations first if applicable.
// Prefix order is significant - left has higher precedence.
for (const prefix of ['@rollup/plugin-', 'rollup-plugin-']) {
try {
plugin = await requireOrImport(prefix + pluginText);
break;
}
catch {
// if this does not work, we try requiring the actual name below
}
}
}
if (!plugin) {
try {
if (pluginText[0] == '.')
pluginText = path.resolve(pluginText);
// Windows absolute paths must be specified as file:// protocol URL
// Note that we do not have coverage for Windows-only code paths
else if (/^[A-Za-z]:\\/.test(pluginText)) {
pluginText = node_url.pathToFileURL(path.resolve(pluginText)).href;
}
plugin = await requireOrImport(pluginText);
}
catch (error) {
throw new Error(`Cannot load plugin "${pluginText}": ${error.message}.`, { cause: error });
}
}
}
// some plugins do not use `module.exports` for their entry point,
// in which case we try the named default export and the plugin name
if (typeof plugin === 'object') {
plugin = plugin.default || plugin[getCamelizedPluginBaseName(pluginText)];
}
if (!plugin) {
throw new Error(`Cannot find entry for plugin "${pluginText}". The plugin needs to export a function either as "default" or "${getCamelizedPluginBaseName(pluginText)}" for Rollup to recognize it.`);
}
inputOptions.plugins.push(typeof plugin === 'function' ? plugin.call(plugin, pluginArgument) : plugin);
}
function getCamelizedPluginBaseName(pluginText) {
return (pluginText.match(/(@rollup\/plugin-|rollup-plugin-)(.+)$/)?.[2] || pluginText)
.split(/[/\\]/)
.slice(-1)[0]
.split('.')[0]
.split('-')
.map((part, index) => (index === 0 || !part ? part : part[0].toUpperCase() + part.slice(1)))
.join('');
}
async function requireOrImport(pluginPath) {
try {
// eslint-disable-next-line @typescript-eslint/no-require-imports
return require(pluginPath);
}
catch {
return import(pluginPath);
}
}
const loadConfigFile = async (fileName, commandOptions = {}, watchMode = false) => {
const configs = await getConfigList(getDefaultFromCjs(await getConfigFileExport(fileName, commandOptions, watchMode)), commandOptions);
const warnings = batchWarnings(commandOptions);
try {
const normalizedConfigs = [];
for (const config of configs) {
const options = await rollup.mergeOptions(config, watchMode, commandOptions, warnings.log);
await addCommandPluginsToInputOptions(options, commandOptions);
normalizedConfigs.push(options);
}
return { options: normalizedConfigs, warnings };
}
catch (error_) {
warnings.flush();
throw error_;
}
};
async function getConfigFileExport(fileName, commandOptions, watchMode) {
if (commandOptions.configPlugin || commandOptions.bundleConfigAsCjs) {
try {
return await loadTranspiledConfigFile(fileName, commandOptions);
}
catch (error_) {
if (error_.message.includes('not defined in ES module scope')) {
return parseAst_js.error(parseAst_js.logCannotBundleConfigAsEsm(error_));
}
throw error_;
}
}
let cannotLoadEsm = false;
const handleWarning = (warning) => {
if (warning.message?.includes('To load an ES module') ||
warning.message?.includes('Failed to load the ES module')) {
cannotLoadEsm = true;
}
};
process$1.on('warning', handleWarning);
try {
const fileUrl = node_url.pathToFileURL(fileName);
if (watchMode) {
// We are adding the current date to allow reloads in watch mode
fileUrl.search = `?${Date.now()}`;
}
return (await import(fileUrl.href)).default;
}
catch (error_) {
if (cannotLoadEsm) {
return parseAst_js.error(parseAst_js.logCannotLoadConfigAsCjs(error_));
}
if (error_.message.includes('not defined in ES module scope')) {
return parseAst_js.error(parseAst_js.logCannotLoadConfigAsEsm(error_));
}
throw error_;
}
finally {
process$1.off('warning', handleWarning);
}
}
function getDefaultFromCjs(namespace) {
return namespace.default || namespace;
}
function getConfigImportAttributesKey(input) {
if (input === 'assert' || input === 'with')
return input;
return;
}
async function loadTranspiledConfigFile(fileName, commandOptions) {
const { bundleConfigAsCjs, configPlugin, configImportAttributesKey, silent } = commandOptions;
const warnings = batchWarnings(commandOptions);
const inputOptions = {
// Do *not* specify external callback here - instead, perform the externality check it via fallback-plugin just below this comment.
// This allows config plugin to first decide whether some import is external or not, and only then trigger the check in fallback-plugin.
// Since the check is ultra-simple during this stage of transforming the config file itself, it should be fallback instead of primary check.
// That way, e.g. importing workspace packages will work as expected - the workspace package will be bundled.
input: fileName,
onwarn: warnings.add,
plugins: [],
treeshake: false
};
await addPluginsFromCommandOption(configPlugin, inputOptions);
// Add plugin as *last* item after addPluginsFromCommandOption is complete.
// This plugin will trigger for imports not resolved by config plugin, and mark all non-relative imports as external.
inputOptions.plugins.push({
name: 'external-fallback',
resolveId: source => {
const looksLikeExternal = (source[0] !== '.' && !path.isAbsolute(source)) || source.slice(-5) === '.json';
return looksLikeExternal ? false : null;
}
});
const bundle = await rollup.rollup(inputOptions);
const { output: [{ code }] } = await bundle.generate({
exports: 'named',
format: bundleConfigAsCjs ? 'cjs' : 'es',
importAttributesKey: getConfigImportAttributesKey(configImportAttributesKey),
plugins: [
{
name: 'transpile-import-meta',
resolveImportMeta(property, { moduleId }) {
if (property === 'url') {
return `'${node_url.pathToFileURL(moduleId).href}'`;
}
if (property == 'filename') {
return `'${moduleId}'`;
}
if (property == 'dirname') {
return `'${path.dirname(moduleId)}'`;
}
if (property == null) {
return `{url:'${node_url.pathToFileURL(moduleId).href}', filename: '${moduleId}', dirname: '${path.dirname(moduleId)}'}`;
}
}
}
]
});
if (!silent && warnings.count > 0) {
rollup.stderr(rollup.bold(`loaded ${parseAst_js.relativeId(fileName)} with warnings`));
warnings.flush();
}
return loadConfigFromWrittenFile(path.join(path.dirname(fileName), `rollup.config-${Date.now()}.${bundleConfigAsCjs ? 'cjs' : 'mjs'}`), code);
}
async function loadConfigFromWrittenFile(bundledFileName, bundledCode) {
await promises.writeFile(bundledFileName, bundledCode);
try {
return (await import(node_url.pathToFileURL(bundledFileName).href)).default;
}
finally {
promises.unlink(bundledFileName).catch(error => console.warn(error?.message || error));
}
}
async function getConfigList(configFileExport, commandOptions) {
const config = await (typeof configFileExport === 'function'
? configFileExport(commandOptions)
: configFileExport);
if (Object.keys(config).length === 0) {
return parseAst_js.error(parseAst_js.logMissingConfig());
}
return Array.isArray(config) ? config : [config];
}
exports.addCommandPluginsToInputOptions = addCommandPluginsToInputOptions;
exports.batchWarnings = batchWarnings;
exports.loadConfigFile = loadConfigFile;
exports.stdinName = stdinName;
//# sourceMappingURL=loadConfigFile.js.map
@@ -0,0 +1,16 @@
/**
* Maps a log severity level to a log severity number.
*
* @see LogSeverityLevel
*/
const SEVERITY_TEXT_TO_SEVERITY_NUMBER = {
trace: 1,
debug: 5,
info: 9,
warn: 13,
error: 17,
fatal: 21,
};
export { SEVERITY_TEXT_TO_SEVERITY_NUMBER };
//# sourceMappingURL=constants.js.map
@@ -0,0 +1,5 @@
export declare const getHoursWithOptions: import("./types.js").FPFn2<
number,
import("../getHours.js").GetHoursOptions | undefined,
string | number | Date
>;
@@ -0,0 +1,121 @@
# OpenTelemetry redis Instrumentation for Node.js
[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]
This module provides automatic instrumentation for the [`redis`](https://github.com/NodeRedis/node_redis) module versions `>=2.6.0 <6`, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle.
If total installation size is not constrained, it is recommended to use the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle with [@opentelemetry/sdk-node](`https://www.npmjs.com/package/@opentelemetry/sdk-node`) for the most seamless instrumentation experience.
Compatible with OpenTelemetry JS API and SDK `1.0+`.
## Installation
```bash
npm install --save @opentelemetry/instrumentation-redis
```
### Supported Versions
- [`redis`](https://www.npmjs.com/package/redis) versions `>=2.6.0 <6`
## Usage
OpenTelemetry Redis Instrumentation allows the user to automatically collect trace data and export them to the backend of choice, to give observability to distributed systems when working with [redis](https://www.npmjs.com/package/redis).
To load a specific instrumentation (**redis** in this case), specify it in the registerInstrumentations' configuration
```javascript
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { RedisInstrumentation } = require('@opentelemetry/instrumentation-redis');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const provider = new NodeTracerProvider();
provider.register();
registerInstrumentations({
instrumentations: [
new RedisInstrumentation(),
],
})
```
See [examples/redis](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/examples/redis) for a short example.
### Redis Instrumentation Options
Redis instrumentation has a few options available to choose from. You can set the following:
| Options | Type | Description |
|-------------------------|---------------------------------------------------|----------------------------------------------------------------------------------------------------------------|
| `dbStatementSerializer` | `DbStatementSerializer` (function) | Redis instrumentation will serialize the command to the `db.statement` attribute using the specified function. |
| `responseHook` | `RedisResponseCustomAttributeFunction` (function) | Function for adding custom attributes on db response. Receives params: `span, moduleVersion, cmdName, cmdArgs` |
| `requireParentSpan` | `boolean` | Require parent to create redis span, default when unset is false. |
#### Custom `db.statement` Serializer
The instrumentation serializes the command into a Span attribute called `db.statement`. The standard serialization format attempts to be as informative as possible while avoiding the export of potentially sensitive data. The number of serialized arguments depends on the specific command, see the configuration
list in `@opentelemetry/redis-common`.
It is also possible to define a custom serialization function. The function
will receive the command name and arguments and must return a string.
Here is a simple example to serialize the command name and all command arguments.
Notice that it might capture sensitive data and big payloads:
```javascript
const { RedisInstrumentation } = require('@opentelemetry/instrumentation-redis');
const redisInstrumentation = new RedisInstrumentation({
dbStatementSerializer: function (cmdName, cmdArgs) {
return [cmdName, ...cmdArgs].join(" ");
},
});
```
## Semantic Conventions
This package uses `@opentelemetry/semantic-conventions` version `1.22+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md) ("old" conventions).
It also supports the new stable semantic conventions introduced in [Version 1.33.0]
By default, old semantic conventions are used. Use the `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable to control which version to emit.
Attributes collected:
### Old Semantic Conventions (default)
| Attribute | Short Description |
|------------------------|--------------------------------------------------------------|
| `db.connection_string` | URL to Redis server address, of the form `redis://host:port` |
| `db.statement` | Executed Redis statement |
| `db.system` | Database identifier; always `redis` |
| `net.peer.name` | Hostname or IP of the connected Redis server |
| `net.peer.port` | Port of the connected Redis server |
### Stable Semantic Conventions (v1.33.0)
| Attribute | Short Description |
|---------------------------|--------------------------------------------------------|
| `db.operation.name` | Redis command name |
| `db.operation.batch.size` | Number of commands in a Redis `MULTI/EXEC` transaction |
| `db.query.text` | The database query being executed |
| `db.system.name` | Database identifier; always `redis` |
| `server.address` | Hostname or IP of the connected Redis server |
| `server.port` | Port of the connected Redis server |
## Useful links
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
## License
Apache 2.0 - See [LICENSE][license-url] for more information.
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-redis
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-redis.svg
@@ -0,0 +1,12 @@
import type {CodeKeywordDefinition} from "../../types"
import {validateTuple} from "./items"
const def: CodeKeywordDefinition = {
keyword: "prefixItems",
type: "array",
schemaType: ["array"],
before: "uniqueItems",
code: (cxt) => validateTuple(cxt, "items"),
}
export default def

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