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

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

View File

@@ -0,0 +1 @@
{"version":3,"file":"tr.d.ts","sourceRoot":"","sources":["../../src/languages/tr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtE,eAAO,MAAM,cAAc,EAAE,yBA+nB5B,CAAA;AAED,eAAO,MAAM,EAAE,EAAE,QAGhB,CAAA"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"kafka.js","sources":["../../../../src/integrations/tracing/kafka.ts"],"sourcesContent":["import { KafkaJsInstrumentation } from '@opentelemetry/instrumentation-kafkajs';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Kafka';\n\nexport const instrumentKafka = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new KafkaJsInstrumentation({\n consumerHook(span) {\n addOriginToSpan(span, 'auto.kafkajs.otel.consumer');\n },\n producerHook(span) {\n addOriginToSpan(span, 'auto.kafkajs.otel.producer');\n },\n }),\n);\n\nconst _kafkaIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKafka();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [kafkajs](https://www.npmjs.com/package/kafkajs) library.\n *\n * For more information, see the [`kafkaIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/kafka/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.kafkaIntegration()],\n * });\n */\nexport const kafkaIntegration = defineIntegration(_kafkaIntegration);\n"],"names":["generateInstrumentOnce","KafkaJsInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,OAAO;;AAEzB,MAAM,eAAA,GAAkBA,+BAAsB;AACrD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,6CAAsB,CAAC;AAC/B,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,wBAAe,CAAC,IAAI,EAAE,4BAA4B,CAAC;AAC3D,MAAM,CAAC;AACP,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQA,wBAAe,CAAC,IAAI,EAAE,4BAA4B,CAAC;AAC3D,MAAM,CAAC;AACP,KAAK,CAAC;AACN;;AAEA,MAAM,iBAAA,IAAqB,MAAM;AACjC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,eAAe,EAAE;AACvB,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,gBAAA,GAAmBC,sBAAiB,CAAC,iBAAiB;;;;;"}

View File

@@ -0,0 +1,215 @@
import {_, nil, Code, Name} from "./code"
interface NameGroup {
prefix: string
index: number
}
export interface NameValue {
ref: ValueReference // this is the reference to any value that can be referred to from generated code via `globals` var in the closure
key?: unknown // any key to identify a global to avoid duplicates, if not passed ref is used
code?: Code // this is the code creating the value needed for standalone code wit_out closure - can be a primitive value, function or import (`require`)
}
export type ValueReference = unknown // possibly make CodeGen parameterized type on this type
class ValueError extends Error {
readonly value?: NameValue
constructor(name: ValueScopeName) {
super(`CodeGen: "code" for ${name} not defined`)
this.value = name.value
}
}
interface ScopeOptions {
prefixes?: Set<string>
parent?: Scope
}
interface ValueScopeOptions extends ScopeOptions {
scope: ScopeStore
es5?: boolean
lines?: boolean
}
export type ScopeStore = Record<string, ValueReference[] | undefined>
type ScopeValues = {
[Prefix in string]?: Map<unknown, ValueScopeName>
}
export type ScopeValueSets = {
[Prefix in string]?: Set<ValueScopeName>
}
export enum UsedValueState {
Started,
Completed,
}
export type UsedScopeValues = {
[Prefix in string]?: Map<ValueScopeName, UsedValueState | undefined>
}
export const varKinds = {
const: new Name("const"),
let: new Name("let"),
var: new Name("var"),
}
export class Scope {
protected readonly _names: {[Prefix in string]?: NameGroup} = {}
protected readonly _prefixes?: Set<string>
protected readonly _parent?: Scope
constructor({prefixes, parent}: ScopeOptions = {}) {
this._prefixes = prefixes
this._parent = parent
}
toName(nameOrPrefix: Name | string): Name {
return nameOrPrefix instanceof Name ? nameOrPrefix : this.name(nameOrPrefix)
}
name(prefix: string): Name {
return new Name(this._newName(prefix))
}
protected _newName(prefix: string): string {
const ng = this._names[prefix] || this._nameGroup(prefix)
return `${prefix}${ng.index++}`
}
private _nameGroup(prefix: string): NameGroup {
if (this._parent?._prefixes?.has(prefix) || (this._prefixes && !this._prefixes.has(prefix))) {
throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`)
}
return (this._names[prefix] = {prefix, index: 0})
}
}
interface ScopePath {
property: string
itemIndex: number
}
export class ValueScopeName extends Name {
readonly prefix: string
value?: NameValue
scopePath?: Code
constructor(prefix: string, nameStr: string) {
super(nameStr)
this.prefix = prefix
}
setValue(value: NameValue, {property, itemIndex}: ScopePath): void {
this.value = value
this.scopePath = _`.${new Name(property)}[${itemIndex}]`
}
}
interface VSOptions extends ValueScopeOptions {
_n: Code
}
const line = _`\n`
export class ValueScope extends Scope {
protected readonly _values: ScopeValues = {}
protected readonly _scope: ScopeStore
readonly opts: VSOptions
constructor(opts: ValueScopeOptions) {
super(opts)
this._scope = opts.scope
this.opts = {...opts, _n: opts.lines ? line : nil}
}
get(): ScopeStore {
return this._scope
}
name(prefix: string): ValueScopeName {
return new ValueScopeName(prefix, this._newName(prefix))
}
value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName {
if (value.ref === undefined) throw new Error("CodeGen: ref must be passed in value")
const name = this.toName(nameOrPrefix) as ValueScopeName
const {prefix} = name
const valueKey = value.key ?? value.ref
let vs = this._values[prefix]
if (vs) {
const _name = vs.get(valueKey)
if (_name) return _name
} else {
vs = this._values[prefix] = new Map()
}
vs.set(valueKey, name)
const s = this._scope[prefix] || (this._scope[prefix] = [])
const itemIndex = s.length
s[itemIndex] = value.ref
name.setValue(value, {property: prefix, itemIndex})
return name
}
getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined {
const vs = this._values[prefix]
if (!vs) return
return vs.get(keyOrRef)
}
scopeRefs(scopeName: Name, values: ScopeValues | ScopeValueSets = this._values): Code {
return this._reduceValues(values, (name: ValueScopeName) => {
if (name.scopePath === undefined) throw new Error(`CodeGen: name "${name}" has no value`)
return _`${scopeName}${name.scopePath}`
})
}
scopeCode(
values: ScopeValues | ScopeValueSets = this._values,
usedValues?: UsedScopeValues,
getCode?: (n: ValueScopeName) => Code | undefined
): Code {
return this._reduceValues(
values,
(name: ValueScopeName) => {
if (name.value === undefined) throw new Error(`CodeGen: name "${name}" has no value`)
return name.value.code
},
usedValues,
getCode
)
}
private _reduceValues(
values: ScopeValues | ScopeValueSets,
valueCode: (n: ValueScopeName) => Code | undefined,
usedValues: UsedScopeValues = {},
getCode?: (n: ValueScopeName) => Code | undefined
): Code {
let code: Code = nil
for (const prefix in values) {
const vs = values[prefix]
if (!vs) continue
const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map())
vs.forEach((name: ValueScopeName) => {
if (nameSet.has(name)) return
nameSet.set(name, UsedValueState.Started)
let c = valueCode(name)
if (c) {
const def = this.opts.es5 ? varKinds.var : varKinds.const
code = _`${code}${def} ${name} = ${c};${this.opts._n}`
} else if ((c = getCode?.(name))) {
code = _`${code}${c}${this.opts._n}`
} else {
throw new ValueError(name)
}
nameSet.set(name, UsedValueState.Completed)
})
}
return code
}
}

View File

@@ -0,0 +1,34 @@
import { GraphQLError } from '../../error/GraphQLError.mjs';
/**
* Unique fragment names
*
* A GraphQL document is only valid if all defined fragments have unique names.
*
* See https://spec.graphql.org/draft/#sec-Fragment-Name-Uniqueness
*/
export function UniqueFragmentNamesRule(context) {
const knownFragmentNames = Object.create(null);
return {
OperationDefinition: () => false,
FragmentDefinition(node) {
const fragmentName = node.name.value;
if (knownFragmentNames[fragmentName]) {
context.reportError(
new GraphQLError(
`There can be only one fragment named "${fragmentName}".`,
{
nodes: [knownFragmentNames[fragmentName], node.name],
},
),
);
} else {
knownFragmentNames[fragmentName] = node.name;
}
return false;
},
};
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"de.d.ts","sourceRoot":"","sources":["../../src/languages/de.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtE,eAAO,MAAM,cAAc,EAAE,yBAyoB5B,CAAA;AAED,eAAO,MAAM,EAAE,EAAE,QAGhB,CAAA"}

View File

@@ -0,0 +1,184 @@
'use client';
import { c as _c } from "react/compiler-runtime";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { getTranslation } from '@payloadcms/translations';
import React from 'react';
import { ReactSelect } from '../../elements/ReactSelect/index.js';
import { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js';
import { FieldDescription } from '../../fields/FieldDescription/index.js';
import { FieldError } from '../../fields/FieldError/index.js';
import { FieldLabel } from '../../fields/FieldLabel/index.js';
import { useTranslation } from '../../providers/Translation/index.js';
import { fieldBaseClass } from '../shared/index.js';
import './index.scss';
export const SelectInput = props => {
const $ = _c(37);
const {
id,
AfterInput,
BeforeInput,
className,
Description,
description,
Error,
filterOption,
hasMany: t0,
isClearable: t1,
isSortable: t2,
label,
Label,
localized,
onChange,
onInputChange,
options,
path,
placeholder,
readOnly,
required,
showError,
style,
value
} = props;
const hasMany = t0 === undefined ? false : t0;
const isClearable = t1 === undefined ? true : t1;
const isSortable = t2 === undefined ? true : t2;
const {
i18n
} = useTranslation();
let t3;
if ($[0] !== AfterInput || $[1] !== BeforeInput || $[2] !== Description || $[3] !== Error || $[4] !== Label || $[5] !== className || $[6] !== description || $[7] !== filterOption || $[8] !== hasMany || $[9] !== i18n || $[10] !== id || $[11] !== isClearable || $[12] !== isSortable || $[13] !== label || $[14] !== localized || $[15] !== onChange || $[16] !== onInputChange || $[17] !== options || $[18] !== path || $[19] !== placeholder || $[20] !== readOnly || $[21] !== required || $[22] !== showError || $[23] !== style || $[24] !== value) {
let valueToRender;
if (hasMany && Array.isArray(value)) {
let t4;
if ($[26] !== i18n || $[27] !== options) {
t4 = val => {
const matchingOption = options.find(option => option.value === val);
return {
label: matchingOption ? getTranslation(matchingOption.label, i18n) : val,
value: matchingOption?.value ?? val
};
};
$[26] = i18n;
$[27] = options;
$[28] = t4;
} else {
t4 = $[28];
}
valueToRender = value.map(t4);
} else {
if (value) {
let t4;
if ($[29] !== value) {
t4 = option_0 => option_0.value === value;
$[29] = value;
$[30] = t4;
} else {
t4 = $[30];
}
const matchingOption_0 = options.find(t4);
valueToRender = {
label: matchingOption_0 ? getTranslation(matchingOption_0.label, i18n) : value,
value: matchingOption_0?.value ?? value
};
} else {
valueToRender = null;
}
}
const t4 = showError && "error";
const t5 = readOnly && "read-only";
let t6;
if ($[31] !== className || $[32] !== t4 || $[33] !== t5) {
t6 = [fieldBaseClass, "select", className, t4, t5].filter(Boolean);
$[31] = className;
$[32] = t4;
$[33] = t5;
$[34] = t6;
} else {
t6 = $[34];
}
let t7;
if ($[35] !== i18n) {
t7 = option_1 => ({
...option_1,
label: getTranslation(option_1.label, i18n)
});
$[35] = i18n;
$[36] = t7;
} else {
t7 = $[36];
}
t3 = _jsxs("div", {
className: t6.join(" "),
id: `field-${path.replace(/\./g, "__")}`,
style,
children: [_jsx(RenderCustomComponent, {
CustomComponent: Label,
Fallback: _jsx(FieldLabel, {
label,
localized,
path,
required
})
}), _jsxs("div", {
className: `${fieldBaseClass}__wrap`,
children: [_jsx(RenderCustomComponent, {
CustomComponent: Error,
Fallback: _jsx(FieldError, {
path,
showError
})
}), BeforeInput, _jsx(ReactSelect, {
disabled: readOnly,
filterOption,
id,
isClearable,
isMulti: hasMany,
isSortable,
onChange,
onInputChange,
options: options.map(t7),
placeholder,
showError,
value: valueToRender
}), AfterInput]
}), _jsx(RenderCustomComponent, {
CustomComponent: Description,
Fallback: _jsx(FieldDescription, {
description,
path
})
})]
});
$[0] = AfterInput;
$[1] = BeforeInput;
$[2] = Description;
$[3] = Error;
$[4] = Label;
$[5] = className;
$[6] = description;
$[7] = filterOption;
$[8] = hasMany;
$[9] = i18n;
$[10] = id;
$[11] = isClearable;
$[12] = isSortable;
$[13] = label;
$[14] = localized;
$[15] = onChange;
$[16] = onInputChange;
$[17] = options;
$[18] = path;
$[19] = placeholder;
$[20] = readOnly;
$[21] = required;
$[22] = showError;
$[23] = style;
$[24] = value;
$[25] = t3;
} else {
t3 = $[25];
}
return t3;
};
//# sourceMappingURL=Input.js.map

View File

@@ -0,0 +1,15 @@
import { KoaLayerType, KoaInstrumentationConfig } from './types';
import { KoaContext, KoaMiddleware } from './internal-types';
import { Attributes } from '@opentelemetry/api';
export declare const getMiddlewareMetadata: (context: KoaContext, layer: KoaMiddleware, isRouter: boolean, layerPath?: string | RegExp) => {
attributes: Attributes;
name: string;
};
/**
* Check whether the given request is ignored by configuration
* @param [list] List of ignore patterns
* @param [onException] callback for doing something when an exception has
* occurred
*/
export declare const isLayerIgnored: (type: KoaLayerType, config?: KoaInstrumentationConfig) => boolean;
//# sourceMappingURL=utils.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"pseudo-elements.js","sourceRoot":"","sources":["../../../../src/dom/replaced-elements/pseudo-elements.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,19 @@
/**
* @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 TextSearch = createLucideIcon("TextSearch", [
["path", { d: "M21 6H3", key: "1jwq7v" }],
["path", { d: "M10 12H3", key: "1ulcyk" }],
["path", { d: "M10 18H3", key: "13769t" }],
["circle", { cx: "17", cy: "15", r: "3", key: "1upz2a" }],
["path", { d: "m21 19-1.9-1.9", key: "dwi7p8" }]
]);
export { TextSearch as default };
//# sourceMappingURL=text-search.js.map

View File

@@ -0,0 +1,21 @@
// src/index.ts
export * from "@react-email/body";
export * from "@react-email/button";
export * from "@react-email/code-block";
export * from "@react-email/code-inline";
export * from "@react-email/column";
export * from "@react-email/container";
export * from "@react-email/font";
export * from "@react-email/head";
export * from "@react-email/heading";
export * from "@react-email/hr";
export * from "@react-email/html";
export * from "@react-email/img";
export * from "@react-email/link";
export * from "@react-email/markdown";
export * from "@react-email/preview";
export * from "@react-email/render";
export * from "@react-email/row";
export * from "@react-email/section";
export * from "@react-email/tailwind";
export * from "@react-email/text";

View File

@@ -0,0 +1,33 @@
import type { ContextOptions, DateArg } from "./types.js";
/**
* The {@link subDays} function options.
*/
export interface SubDaysOptions<DateType extends Date = Date>
extends ContextOptions<DateType> {}
/**
* @name subDays
* @category Day Helpers
* @summary Subtract the specified number of days from the given date.
*
* @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 amount - The amount of days to be subtracted.
* @param options - An object with options
*
* @returns The new date with the days subtracted
*
* @example
* // Subtract 10 days from 1 September 2014:
* const result = subDays(new Date(2014, 8, 1), 10)
* //=> Fri Aug 22 2014 00:00:00
*/
export declare function subDays<
DateType extends Date,
ResultDate extends Date = DateType,
>(
date: DateArg<DateType>,
amount: number,
options?: SubDaysOptions<ResultDate> | undefined,
): ResultDate;

View File

@@ -0,0 +1,906 @@
/**
* AI SDK Telemetry Attributes
* Based on https://ai-sdk.dev/docs/ai-sdk-core/telemetry#collected-data
*/
/**
* Common attribute for operation name across all functions and spans
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#collected-data
*/
export declare const OPERATION_NAME_ATTRIBUTE = "operation.name";
/**
* Common attribute for AI operation ID across all functions and spans
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#collected-data
*/
export declare const AI_OPERATION_ID_ATTRIBUTE = "ai.operationId";
/**
* `generateText` function - `ai.generateText` span
* `streamText` function - `ai.streamText` span
*
* The prompt that was used when calling the function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function
*/
export declare const AI_PROMPT_ATTRIBUTE = "ai.prompt";
/**
* `generateObject` function - `ai.generateObject` span
* `streamObject` function - `ai.streamObject` span
*
* The JSON schema version of the schema that was passed into the function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function
*/
export declare const AI_SCHEMA_ATTRIBUTE = "ai.schema";
/**
* `generateObject` function - `ai.generateObject` span
* `streamObject` function - `ai.streamObject` span
*
* The name of the schema that was passed into the function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function
*/
export declare const AI_SCHEMA_NAME_ATTRIBUTE = "ai.schema.name";
/**
* `generateObject` function - `ai.generateObject` span
* `streamObject` function - `ai.streamObject` span
*
* The description of the schema that was passed into the function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function
*/
export declare const AI_SCHEMA_DESCRIPTION_ATTRIBUTE = "ai.schema.description";
/**
* `generateObject` function - `ai.generateObject` span
* `streamObject` function - `ai.streamObject` span
*
* The object that was generated (stringified JSON)
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function
*/
export declare const AI_RESPONSE_OBJECT_ATTRIBUTE = "ai.response.object";
/**
* `generateObject` function - `ai.generateObject` span
* `streamObject` function - `ai.streamObject` span
*
* The object generation mode, e.g. `json`
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function
*/
export declare const AI_SETTINGS_MODE_ATTRIBUTE = "ai.settings.mode";
/**
* `generateObject` function - `ai.generateObject` span
* `streamObject` function - `ai.streamObject` span
*
* The output type that was used, e.g. `object` or `no-schema`
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function
*/
export declare const AI_SETTINGS_OUTPUT_ATTRIBUTE = "ai.settings.output";
/**
* `embed` function - `ai.embed.doEmbed` span
* `embedMany` function - `ai.embedMany` span
*
* The values that were passed into the function (array)
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embedmany-function
*/
export declare const AI_VALUES_ATTRIBUTE = "ai.values";
/**
* `embed` function - `ai.embed.doEmbed` span
* `embedMany` function - `ai.embedMany` span
*
* An array of JSON-stringified embeddings
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embedmany-function
*/
export declare const AI_EMBEDDINGS_ATTRIBUTE = "ai.embeddings";
/**
* `generateText` function - `ai.generateText` span
*
* The text that was generated
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function
*/
export declare const AI_RESPONSE_TEXT_ATTRIBUTE = "ai.response.text";
/**
* `generateText` function - `ai.generateText` span
*
* The tool calls that were made as part of the generation (stringified JSON)
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function
*/
export declare const AI_RESPONSE_TOOL_CALLS_ATTRIBUTE = "ai.response.toolCalls";
/**
* `generateText` function - `ai.generateText` span
*
* The reason why the generation finished
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function
*/
export declare const AI_RESPONSE_FINISH_REASON_ATTRIBUTE = "ai.response.finishReason";
/**
* `generateText` function - `ai.generateText` span
*
* The maximum number of steps that were set
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function
*/
export declare const AI_SETTINGS_MAX_STEPS_ATTRIBUTE = "ai.settings.maxSteps";
/**
* `generateText` function - `ai.generateText.doGenerate` span
*
* The format of the prompt
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function
*/
export declare const AI_PROMPT_FORMAT_ATTRIBUTE = "ai.prompt.format";
/**
* `generateText` function - `ai.generateText.doGenerate` span
*
* The messages that were passed into the provider
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function
*/
export declare const AI_PROMPT_MESSAGES_ATTRIBUTE = "ai.prompt.messages";
/**
* `generateText` function - `ai.generateText.doGenerate` span
*
* Array of stringified tool definitions
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function
*/
export declare const AI_PROMPT_TOOLS_ATTRIBUTE = "ai.prompt.tools";
/**
* `generateText` function - `ai.generateText.doGenerate` span
*
* The stringified tool choice setting (JSON)
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function
*/
export declare const AI_PROMPT_TOOL_CHOICE_ATTRIBUTE = "ai.prompt.toolChoice";
/**
* `streamText` function - `ai.streamText.doStream` span
*
* The time it took to receive the first chunk in milliseconds
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function
*/
export declare const AI_RESPONSE_MS_TO_FIRST_CHUNK_ATTRIBUTE = "ai.response.msToFirstChunk";
/**
* `streamText` function - `ai.streamText.doStream` span
*
* The time it took to receive the finish part of the LLM stream in milliseconds
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function
*/
export declare const AI_RESPONSE_MS_TO_FINISH_ATTRIBUTE = "ai.response.msToFinish";
/**
* `streamText` function - `ai.streamText.doStream` span
*
* The average completion tokens per second
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function
*/
export declare const AI_RESPONSE_AVG_COMPLETION_TOKENS_PER_SECOND_ATTRIBUTE = "ai.response.avgCompletionTokensPerSecond";
/**
* `embed` function - `ai.embed` span
*
* The value that was passed into the `embed` function
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function
*/
export declare const AI_VALUE_ATTRIBUTE = "ai.value";
/**
* `embed` function - `ai.embed` span
*
* A JSON-stringified embedding
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function
*/
export declare const AI_EMBEDDING_ATTRIBUTE = "ai.embedding";
/**
* Basic LLM span information
* Multiple spans
*
* The functionId that was set through `telemetry.functionId`
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information
*/
export declare const RESOURCE_NAME_ATTRIBUTE = "resource.name";
/**
* Basic LLM span information
* Multiple spans
*
* The id of the model
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information
*/
export declare const AI_MODEL_ID_ATTRIBUTE = "ai.model.id";
/**
* Basic LLM span information
* Multiple spans
*
* The provider of the model
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information
*/
export declare const AI_MODEL_PROVIDER_ATTRIBUTE = "ai.model.provider";
/**
* Basic LLM span information
* Multiple spans
*
* The request headers that were passed in through `headers`
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information
*/
export declare const AI_REQUEST_HEADERS_ATTRIBUTE = "ai.request.headers";
/**
* Basic LLM span information
* Multiple spans
*
* Provider specific metadata returned with the generation response
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information
*/
export declare const AI_RESPONSE_PROVIDER_METADATA_ATTRIBUTE = "ai.response.providerMetadata";
/**
* Basic LLM span information
* Multiple spans
*
* The maximum number of retries that were set
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information
*/
export declare const AI_SETTINGS_MAX_RETRIES_ATTRIBUTE = "ai.settings.maxRetries";
/**
* Basic LLM span information
* Multiple spans
*
* The number of cached input tokens that were used
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information
*/
export declare const AI_USAGE_CACHED_INPUT_TOKENS_ATTRIBUTE = "ai.usage.cachedInputTokens";
/**
* Basic LLM span information
* Multiple spans
*
* The functionId that was set through `telemetry.functionId`
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information
*/
export declare const AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE = "ai.telemetry.functionId";
/**
* Basic LLM span information
* Multiple spans
*
* The metadata that was passed in through `telemetry.metadata`
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information
*/
export declare const AI_TELEMETRY_METADATA_ATTRIBUTE = "ai.telemetry.metadata";
/**
* Basic LLM span information
* Multiple spans
*
* The number of completion tokens that were used
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information
*/
export declare const AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE = "ai.usage.completionTokens";
/**
* Basic LLM span information
* Multiple spans
*
* The number of prompt tokens that were used
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information
*/
export declare const AI_USAGE_PROMPT_TOKENS_ATTRIBUTE = "ai.usage.promptTokens";
/**
* Call LLM span information
* Individual LLM call spans
*
* The model that was used to generate the response
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const AI_RESPONSE_MODEL_ATTRIBUTE = "ai.response.model";
/**
* Call LLM span information
* Individual LLM call spans
*
* The id of the response
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const AI_RESPONSE_ID_ATTRIBUTE = "ai.response.id";
/**
* Call LLM span information
* Individual LLM call spans
*
* The timestamp of the response
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const AI_RESPONSE_TIMESTAMP_ATTRIBUTE = "ai.response.timestamp";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The provider that was used
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_SYSTEM_ATTRIBUTE = "gen_ai.system";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The model that was requested
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_REQUEST_MODEL_ATTRIBUTE = "gen_ai.request.model";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The temperature that was set
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE = "gen_ai.request.temperature";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The maximum number of tokens that were set
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE = "gen_ai.request.max_tokens";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The frequency penalty that was set
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_REQUEST_FREQUENCY_PENALTY_ATTRIBUTE = "gen_ai.request.frequency_penalty";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The presence penalty that was set
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_REQUEST_PRESENCE_PENALTY_ATTRIBUTE = "gen_ai.request.presence_penalty";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The topK parameter value that was set
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_REQUEST_TOP_K_ATTRIBUTE = "gen_ai.request.top_k";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The topP parameter value that was set
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_REQUEST_TOP_P_ATTRIBUTE = "gen_ai.request.top_p";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The stop sequences
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_REQUEST_STOP_SEQUENCES_ATTRIBUTE = "gen_ai.request.stop_sequences";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The finish reasons that were returned by the provider
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE = "gen_ai.response.finish_reasons";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The model that was used to generate the response
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_RESPONSE_MODEL_ATTRIBUTE = "gen_ai.response.model";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The id of the response
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_RESPONSE_ID_ATTRIBUTE = "gen_ai.response.id";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The number of prompt tokens that were used
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE = "gen_ai.usage.input_tokens";
/**
* Semantic Conventions for GenAI operations
* Individual LLM call spans
*
* The number of completion tokens that were used
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information
*/
export declare const GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE = "gen_ai.usage.output_tokens";
/**
* Basic embedding span information
* Embedding spans
*
* The number of tokens that were used
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-embedding-span-information
*/
export declare const AI_USAGE_TOKENS_ATTRIBUTE = "ai.usage.tokens";
/**
* Tool call spans
* `ai.toolCall` span
*
* The name of the tool
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans
*/
export declare const AI_TOOL_CALL_NAME_ATTRIBUTE = "ai.toolCall.name";
/**
* Tool call spans
* `ai.toolCall` span
*
* The id of the tool call
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans
*/
export declare const AI_TOOL_CALL_ID_ATTRIBUTE = "ai.toolCall.id";
/**
* Tool call spans
* `ai.toolCall` span
*
* The parameters of the tool call
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans
*/
export declare const AI_TOOL_CALL_ARGS_ATTRIBUTE = "ai.toolCall.args";
/**
* Tool call spans
* `ai.toolCall` span
*
* The result of the tool call
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans
*/
export declare const AI_TOOL_CALL_RESULT_ATTRIBUTE = "ai.toolCall.result";
/**
* Attributes collected for `ai.generateText` span
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function
*/
export declare const AI_GENERATE_TEXT_SPAN_ATTRIBUTES: {
readonly OPERATION_NAME: "operation.name";
readonly AI_OPERATION_ID: "ai.operationId";
readonly AI_PROMPT: "ai.prompt";
readonly AI_RESPONSE_TEXT: "ai.response.text";
readonly AI_RESPONSE_TOOL_CALLS: "ai.response.toolCalls";
readonly AI_RESPONSE_FINISH_REASON: "ai.response.finishReason";
readonly AI_SETTINGS_MAX_STEPS: "ai.settings.maxSteps";
readonly RESOURCE_NAME: "resource.name";
readonly AI_MODEL_ID: "ai.model.id";
readonly AI_MODEL_PROVIDER: "ai.model.provider";
readonly AI_REQUEST_HEADERS: "ai.request.headers";
readonly AI_SETTINGS_MAX_RETRIES: "ai.settings.maxRetries";
readonly AI_TELEMETRY_FUNCTION_ID: "ai.telemetry.functionId";
readonly AI_TELEMETRY_METADATA: "ai.telemetry.metadata";
readonly AI_USAGE_COMPLETION_TOKENS: "ai.usage.completionTokens";
readonly AI_USAGE_PROMPT_TOKENS: "ai.usage.promptTokens";
};
/**
* Attributes collected for `ai.generateText.doGenerate` span
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function
*/
export declare const AI_GENERATE_TEXT_DO_GENERATE_SPAN_ATTRIBUTES: {
readonly OPERATION_NAME: "operation.name";
readonly AI_OPERATION_ID: "ai.operationId";
readonly AI_PROMPT_FORMAT: "ai.prompt.format";
readonly AI_PROMPT_MESSAGES: "ai.prompt.messages";
readonly AI_PROMPT_TOOLS: "ai.prompt.tools";
readonly AI_PROMPT_TOOL_CHOICE: "ai.prompt.toolChoice";
readonly RESOURCE_NAME: "resource.name";
readonly AI_MODEL_ID: "ai.model.id";
readonly AI_MODEL_PROVIDER: "ai.model.provider";
readonly AI_REQUEST_HEADERS: "ai.request.headers";
readonly AI_SETTINGS_MAX_RETRIES: "ai.settings.maxRetries";
readonly AI_TELEMETRY_FUNCTION_ID: "ai.telemetry.functionId";
readonly AI_TELEMETRY_METADATA: "ai.telemetry.metadata";
readonly AI_USAGE_COMPLETION_TOKENS: "ai.usage.completionTokens";
readonly AI_USAGE_PROMPT_TOKENS: "ai.usage.promptTokens";
readonly AI_RESPONSE_MODEL: "ai.response.model";
readonly AI_RESPONSE_ID: "ai.response.id";
readonly AI_RESPONSE_TIMESTAMP: "ai.response.timestamp";
readonly GEN_AI_SYSTEM: "gen_ai.system";
readonly GEN_AI_REQUEST_MODEL: "gen_ai.request.model";
readonly GEN_AI_REQUEST_TEMPERATURE: "gen_ai.request.temperature";
readonly GEN_AI_REQUEST_MAX_TOKENS: "gen_ai.request.max_tokens";
readonly GEN_AI_REQUEST_FREQUENCY_PENALTY: "gen_ai.request.frequency_penalty";
readonly GEN_AI_REQUEST_PRESENCE_PENALTY: "gen_ai.request.presence_penalty";
readonly GEN_AI_REQUEST_TOP_K: "gen_ai.request.top_k";
readonly GEN_AI_REQUEST_TOP_P: "gen_ai.request.top_p";
readonly GEN_AI_REQUEST_STOP_SEQUENCES: "gen_ai.request.stop_sequences";
readonly GEN_AI_RESPONSE_FINISH_REASONS: "gen_ai.response.finish_reasons";
readonly GEN_AI_RESPONSE_MODEL: "gen_ai.response.model";
readonly GEN_AI_RESPONSE_ID: "gen_ai.response.id";
readonly GEN_AI_USAGE_INPUT_TOKENS: "gen_ai.usage.input_tokens";
readonly GEN_AI_USAGE_OUTPUT_TOKENS: "gen_ai.usage.output_tokens";
};
/**
* Attributes collected for `ai.streamText` span
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function
*/
export declare const AI_STREAM_TEXT_SPAN_ATTRIBUTES: {
readonly OPERATION_NAME: "operation.name";
readonly AI_OPERATION_ID: "ai.operationId";
readonly AI_PROMPT: "ai.prompt";
readonly RESOURCE_NAME: "resource.name";
readonly AI_MODEL_ID: "ai.model.id";
readonly AI_MODEL_PROVIDER: "ai.model.provider";
readonly AI_REQUEST_HEADERS: "ai.request.headers";
readonly AI_SETTINGS_MAX_RETRIES: "ai.settings.maxRetries";
readonly AI_TELEMETRY_FUNCTION_ID: "ai.telemetry.functionId";
readonly AI_TELEMETRY_METADATA: "ai.telemetry.metadata";
readonly AI_USAGE_COMPLETION_TOKENS: "ai.usage.completionTokens";
readonly AI_USAGE_PROMPT_TOKENS: "ai.usage.promptTokens";
};
/**
* Attributes collected for `ai.streamText.doStream` span
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function
*/
export declare const AI_STREAM_TEXT_DO_STREAM_SPAN_ATTRIBUTES: {
readonly OPERATION_NAME: "operation.name";
readonly AI_OPERATION_ID: "ai.operationId";
readonly AI_RESPONSE_MS_TO_FIRST_CHUNK: "ai.response.msToFirstChunk";
readonly AI_RESPONSE_MS_TO_FINISH: "ai.response.msToFinish";
readonly AI_RESPONSE_AVG_COMPLETION_TOKENS_PER_SECOND: "ai.response.avgCompletionTokensPerSecond";
readonly RESOURCE_NAME: "resource.name";
readonly AI_MODEL_ID: "ai.model.id";
readonly AI_MODEL_PROVIDER: "ai.model.provider";
readonly AI_REQUEST_HEADERS: "ai.request.headers";
readonly AI_SETTINGS_MAX_RETRIES: "ai.settings.maxRetries";
readonly AI_TELEMETRY_FUNCTION_ID: "ai.telemetry.functionId";
readonly AI_TELEMETRY_METADATA: "ai.telemetry.metadata";
readonly AI_USAGE_COMPLETION_TOKENS: "ai.usage.completionTokens";
readonly AI_USAGE_PROMPT_TOKENS: "ai.usage.promptTokens";
readonly AI_RESPONSE_MODEL: "ai.response.model";
readonly AI_RESPONSE_ID: "ai.response.id";
readonly AI_RESPONSE_TIMESTAMP: "ai.response.timestamp";
readonly GEN_AI_SYSTEM: "gen_ai.system";
readonly GEN_AI_REQUEST_MODEL: "gen_ai.request.model";
readonly GEN_AI_REQUEST_TEMPERATURE: "gen_ai.request.temperature";
readonly GEN_AI_REQUEST_MAX_TOKENS: "gen_ai.request.max_tokens";
readonly GEN_AI_REQUEST_FREQUENCY_PENALTY: "gen_ai.request.frequency_penalty";
readonly GEN_AI_REQUEST_PRESENCE_PENALTY: "gen_ai.request.presence_penalty";
readonly GEN_AI_REQUEST_TOP_K: "gen_ai.request.top_k";
readonly GEN_AI_REQUEST_TOP_P: "gen_ai.request.top_p";
readonly GEN_AI_REQUEST_STOP_SEQUENCES: "gen_ai.request.stop_sequences";
readonly GEN_AI_RESPONSE_FINISH_REASONS: "gen_ai.response.finish_reasons";
readonly GEN_AI_RESPONSE_MODEL: "gen_ai.response.model";
readonly GEN_AI_RESPONSE_ID: "gen_ai.response.id";
readonly GEN_AI_USAGE_INPUT_TOKENS: "gen_ai.usage.input_tokens";
readonly GEN_AI_USAGE_OUTPUT_TOKENS: "gen_ai.usage.output_tokens";
};
/**
* Attributes collected for `ai.generateObject` span
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function
*/
export declare const AI_GENERATE_OBJECT_SPAN_ATTRIBUTES: {
readonly OPERATION_NAME: "operation.name";
readonly AI_OPERATION_ID: "ai.operationId";
readonly AI_SCHEMA: "ai.schema";
readonly AI_SCHEMA_NAME: "ai.schema.name";
readonly AI_SCHEMA_DESCRIPTION: "ai.schema.description";
readonly AI_RESPONSE_OBJECT: "ai.response.object";
readonly AI_SETTINGS_MODE: "ai.settings.mode";
readonly AI_SETTINGS_OUTPUT: "ai.settings.output";
readonly RESOURCE_NAME: "resource.name";
readonly AI_MODEL_ID: "ai.model.id";
readonly AI_MODEL_PROVIDER: "ai.model.provider";
readonly AI_REQUEST_HEADERS: "ai.request.headers";
readonly AI_SETTINGS_MAX_RETRIES: "ai.settings.maxRetries";
readonly AI_TELEMETRY_FUNCTION_ID: "ai.telemetry.functionId";
readonly AI_TELEMETRY_METADATA: "ai.telemetry.metadata";
readonly AI_USAGE_COMPLETION_TOKENS: "ai.usage.completionTokens";
readonly AI_USAGE_PROMPT_TOKENS: "ai.usage.promptTokens";
};
/**
* Attributes collected for `ai.streamObject` span
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function
*/
export declare const AI_STREAM_OBJECT_SPAN_ATTRIBUTES: {
readonly OPERATION_NAME: "operation.name";
readonly AI_OPERATION_ID: "ai.operationId";
readonly AI_SCHEMA: "ai.schema";
readonly AI_SCHEMA_NAME: "ai.schema.name";
readonly AI_SCHEMA_DESCRIPTION: "ai.schema.description";
readonly AI_RESPONSE_OBJECT: "ai.response.object";
readonly AI_SETTINGS_MODE: "ai.settings.mode";
readonly AI_SETTINGS_OUTPUT: "ai.settings.output";
readonly RESOURCE_NAME: "resource.name";
readonly AI_MODEL_ID: "ai.model.id";
readonly AI_MODEL_PROVIDER: "ai.model.provider";
readonly AI_REQUEST_HEADERS: "ai.request.headers";
readonly AI_SETTINGS_MAX_RETRIES: "ai.settings.maxRetries";
readonly AI_TELEMETRY_FUNCTION_ID: "ai.telemetry.functionId";
readonly AI_TELEMETRY_METADATA: "ai.telemetry.metadata";
readonly AI_USAGE_COMPLETION_TOKENS: "ai.usage.completionTokens";
readonly AI_USAGE_PROMPT_TOKENS: "ai.usage.promptTokens";
};
/**
* Attributes collected for `ai.embed` span
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function
*/
export declare const AI_EMBED_SPAN_ATTRIBUTES: {
readonly OPERATION_NAME: "operation.name";
readonly AI_OPERATION_ID: "ai.operationId";
readonly AI_VALUE: "ai.value";
readonly AI_EMBEDDING: "ai.embedding";
readonly RESOURCE_NAME: "resource.name";
readonly AI_MODEL_ID: "ai.model.id";
readonly AI_MODEL_PROVIDER: "ai.model.provider";
readonly AI_REQUEST_HEADERS: "ai.request.headers";
readonly AI_SETTINGS_MAX_RETRIES: "ai.settings.maxRetries";
readonly AI_TELEMETRY_FUNCTION_ID: "ai.telemetry.functionId";
readonly AI_TELEMETRY_METADATA: "ai.telemetry.metadata";
readonly AI_USAGE_TOKENS: "ai.usage.tokens";
};
/**
* Attributes collected for `ai.embed.doEmbed` span
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function
*/
export declare const AI_EMBED_DO_EMBED_SPAN_ATTRIBUTES: {
readonly OPERATION_NAME: "operation.name";
readonly AI_OPERATION_ID: "ai.operationId";
readonly AI_VALUES: "ai.values";
readonly AI_EMBEDDINGS: "ai.embeddings";
readonly RESOURCE_NAME: "resource.name";
readonly AI_MODEL_ID: "ai.model.id";
readonly AI_MODEL_PROVIDER: "ai.model.provider";
readonly AI_REQUEST_HEADERS: "ai.request.headers";
readonly AI_SETTINGS_MAX_RETRIES: "ai.settings.maxRetries";
readonly AI_TELEMETRY_FUNCTION_ID: "ai.telemetry.functionId";
readonly AI_TELEMETRY_METADATA: "ai.telemetry.metadata";
readonly AI_USAGE_TOKENS: "ai.usage.tokens";
};
/**
* Attributes collected for `ai.embedMany` span
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embedmany-function
*/
export declare const AI_EMBED_MANY_SPAN_ATTRIBUTES: {
readonly OPERATION_NAME: "operation.name";
readonly AI_OPERATION_ID: "ai.operationId";
readonly AI_VALUES: "ai.values";
readonly AI_EMBEDDINGS: "ai.embeddings";
readonly RESOURCE_NAME: "resource.name";
readonly AI_MODEL_ID: "ai.model.id";
readonly AI_MODEL_PROVIDER: "ai.model.provider";
readonly AI_REQUEST_HEADERS: "ai.request.headers";
readonly AI_SETTINGS_MAX_RETRIES: "ai.settings.maxRetries";
readonly AI_TELEMETRY_FUNCTION_ID: "ai.telemetry.functionId";
readonly AI_TELEMETRY_METADATA: "ai.telemetry.metadata";
readonly AI_USAGE_TOKENS: "ai.usage.tokens";
};
/**
* Attributes collected for `ai.toolCall` span
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans
*/
export declare const AI_TOOL_CALL_SPAN_ATTRIBUTES: {
readonly OPERATION_NAME: "operation.name";
readonly AI_OPERATION_ID: "ai.operationId";
readonly AI_TOOL_CALL_NAME: "ai.toolCall.name";
readonly AI_TOOL_CALL_ID: "ai.toolCall.id";
readonly AI_TOOL_CALL_ARGS: "ai.toolCall.args";
readonly AI_TOOL_CALL_RESULT: "ai.toolCall.result";
readonly RESOURCE_NAME: "resource.name";
readonly AI_MODEL_ID: "ai.model.id";
readonly AI_MODEL_PROVIDER: "ai.model.provider";
readonly AI_REQUEST_HEADERS: "ai.request.headers";
readonly AI_SETTINGS_MAX_RETRIES: "ai.settings.maxRetries";
readonly AI_TELEMETRY_FUNCTION_ID: "ai.telemetry.functionId";
readonly AI_TELEMETRY_METADATA: "ai.telemetry.metadata";
};
/**
* OpenAI Provider Metadata
* @see https://ai-sdk.dev/providers/ai-sdk-providers/openai
* @see https://github.com/vercel/ai/blob/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/openai/src/openai-chat-language-model.ts#L397-L416
* @see https://github.com/vercel/ai/blob/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/openai/src/responses/openai-responses-language-model.ts#L377C7-L384
*/
export interface OpenAiProviderMetadata {
/**
* The number of predicted output tokens that were accepted.
* @see https://ai-sdk.dev/providers/ai-sdk-providers/openai#predicted-outputs
*/
acceptedPredictionTokens?: number;
/**
* The number of predicted output tokens that were rejected.
* @see https://ai-sdk.dev/providers/ai-sdk-providers/openai#predicted-outputs
*/
rejectedPredictionTokens?: number;
/**
* The number of reasoning tokens that the model generated.
* @see https://ai-sdk.dev/providers/ai-sdk-providers/openai#responses-models
*/
reasoningTokens?: number;
/**
* The number of prompt tokens that were a cache hit.
* @see https://ai-sdk.dev/providers/ai-sdk-providers/openai#responses-models
*/
cachedPromptTokens?: number;
/**
* @see https://ai-sdk.dev/providers/ai-sdk-providers/openai#responses-models
*
* The ID of the response. Can be used to continue a conversation.
*/
responseId?: string;
}
/**
* Anthropic Provider Metadata
* @see https://ai-sdk.dev/providers/ai-sdk-providers/anthropic
* @see https://github.com/vercel/ai/blob/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/anthropic/src/anthropic-messages-language-model.ts#L346-L352
*/
interface AnthropicProviderMetadata {
/**
* The number of tokens that were used to create the cache.
* @see https://ai-sdk.dev/providers/ai-sdk-providers/anthropic#cache-control
*/
cacheCreationInputTokens?: number;
/**
* The number of tokens that were read from the cache.
* @see https://ai-sdk.dev/providers/ai-sdk-providers/anthropic#cache-control
*/
cacheReadInputTokens?: number;
/**
* Usage metrics for the Anthropic model.
*/
usage?: {
input_tokens: number;
cache_creation_input_tokens?: number;
cache_read_input_tokens?: number;
cache_creation?: {
ephemeral_5m_input_tokens?: number;
ephemeral_1h_input_tokens?: number;
};
output_tokens?: number;
service_tier?: string;
};
}
/**
* Amazon Bedrock Provider Metadata
* @see https://ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock
* @see https://github.com/vercel/ai/blob/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/amazon-bedrock/src/bedrock-chat-language-model.ts#L263-L280
*/
interface AmazonBedrockProviderMetadata {
/**
* @see https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseTrace.html
*/
trace?: {
/**
* The guardrail trace object.
* @see https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_GuardrailTraceAssessment.html
*
* This was purposely left as unknown as it's a complex object. This can be typed in the future
* if the SDK decides to support bedrock in a more advanced way.
*/
guardrail?: unknown;
/**
* The request's prompt router.
* @see https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_PromptRouterTrace.html
*/
promptRouter?: {
/**
* The ID of the invoked model.
*/
invokedModelId?: string;
};
};
usage?: {
/**
* The number of tokens that were read from the cache.
* @see https://ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock#cache-points
*/
cacheReadInputTokens?: number;
/**
* The number of tokens that were written to the cache.
* @see https://ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock#cache-points
*/
cacheWriteInputTokens?: number;
};
}
/**
* Google Generative AI Provider Metadata
* @see https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai
*/
export interface GoogleGenerativeAIProviderMetadata {
/**
* @see https://github.com/vercel/ai/blob/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/google/src/google-generative-ai-prompt.ts#L28-L30
*/
groundingMetadata: null | {
/**
* Array of search queries used to retrieve information
* @example ["What's the weather in Chicago this weekend?"]
*
* @see https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai#search-grounding
*/
webSearchQueries: string[] | null;
/**
* Contains the main search result content used as an entry point
* The `renderedContent` field contains the formatted content
* @see https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai#search-grounding
*/
searchEntryPoint?: {
renderedContent: string;
} | null;
/**
* Contains details about how specific response parts are supported by search results
* @see https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai#search-grounding
*/
groundingSupports: Array<{
/**
* Information about the grounded text segment.
*/
segment: {
/**
* The start index of the text segment.
*/
startIndex?: number | null;
/**
* The end index of the text segment.
*/
endIndex?: number | null;
/**
* The actual text segment.
*/
text?: string | null;
};
/**
* References to supporting search result chunks.
*/
groundingChunkIndices?: number[] | null;
/**
* Confidence scores (0-1) for each supporting chunk.
*/
confidenceScores?: number[] | null;
}> | null;
};
/**
* @see https://github.com/vercel/ai/blob/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/google/src/google-generative-ai-language-model.ts#L620-L627
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/configure-safety-filters
*/
safetyRatings?: null | unknown;
}
/**
* DeepSeek Provider Metadata
* @see https://ai-sdk.dev/providers/ai-sdk-providers/deepseek
*/
interface DeepSeekProviderMetadata {
/**
* The number of tokens that were cache hits.
* @see https://ai-sdk.dev/providers/ai-sdk-providers/deepseek#cache-token-usage
*/
promptCacheHitTokens?: number;
/**
* The number of tokens that were cache misses.
* @see https://ai-sdk.dev/providers/ai-sdk-providers/deepseek#cache-token-usage
*/
promptCacheMissTokens?: number;
}
/**
* Perplexity Provider Metadata
* @see https://ai-sdk.dev/providers/ai-sdk-providers/perplexity
*/
interface PerplexityProviderMetadata {
/**
* Object containing citationTokens and numSearchQueries metrics
*/
usage?: {
citationTokens?: number;
numSearchQueries?: number;
};
/**
* Array of image URLs when return_images is enabled.
*
* You can enable image responses by setting return_images: true in the provider options.
* This feature is only available to Perplexity Tier-2 users and above.
*/
images?: Array<{
imageUrl?: string;
originUrl?: string;
height?: number;
width?: number;
}>;
}
export interface ProviderMetadata {
openai?: OpenAiProviderMetadata;
azure?: OpenAiProviderMetadata;
anthropic?: AnthropicProviderMetadata;
bedrock?: AmazonBedrockProviderMetadata;
google?: GoogleGenerativeAIProviderMetadata;
vertex?: GoogleGenerativeAIProviderMetadata;
deepseek?: DeepSeekProviderMetadata;
perplexity?: PerplexityProviderMetadata;
}
export {};
//# sourceMappingURL=vercel-ai-attributes.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"createVersion.d.ts","sourceRoot":"","sources":["../src/createVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAO7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAKhD,wBAAsB,aAAa,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EACnE,IAAI,EAAE,cAAc,EACpB,EACE,QAAQ,EACR,cAAc,EACd,SAAS,EACT,MAAM,EACN,eAAe,EACf,GAAG,EACH,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,GACZ,EAAE,iBAAiB,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CA8D7B"}

View File

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

View File

@@ -0,0 +1,13 @@
function _class_apply_descriptor_set(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) {
// This should only throw in strict mode, but class bodies are
// always strict and private fields can only be used inside
// class bodies.
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
export { _class_apply_descriptor_set as _ };

View File

@@ -0,0 +1 @@
{"version":3,"file":"spade.js","sources":["../../../src/icons/spade.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Spade\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNSA5Yy0xLjUgMS41LTMgMy4yLTMgNS41QTUuNSA1LjUgMCAwIDAgNy41IDIwYzEuOCAwIDMtLjUgNC41LTIgMS41IDEuNSAyLjcgMiA0LjUgMmE1LjUgNS41IDAgMCAwIDUuNS01LjVjMC0yLjMtMS41LTQtMy01LjVsLTctNy03IDdaIiAvPgogIDxwYXRoIGQ9Ik0xMiAxOHY0IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/spade\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 Spade = createLucideIcon('Spade', [\n [\n 'path',\n {\n d: 'M5 9c-1.5 1.5-3 3.2-3 5.5A5.5 5.5 0 0 0 7.5 20c1.8 0 3-.5 4.5-2 1.5 1.5 2.7 2 4.5 2a5.5 5.5 0 0 0 5.5-5.5c0-2.3-1.5-4-3-5.5l-7-7-7 7Z',\n key: '40bo9n',\n },\n ],\n ['path', { d: 'M12 18v4', key: 'jadmvz' }],\n]);\n\nexport default Spade;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,iBAAiB,OAAS,CAAA,CAAA,CAAA;AAAA,CACtC,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/utilities/getSafeRedirect.spec.ts"],"sourcesContent":["import { describe, it, expect } from 'vitest'\nimport { getSafeRedirect } from './getSafeRedirect'\n\nconst fallback = '/admin' // default fallback if the input is unsafe or invalid\n\ndescribe('getSafeRedirect', () => {\n // Valid - safe redirect paths\n it.each([['/dashboard'], ['/admin/settings'], ['/projects?id=123'], ['/hello-world']])(\n 'should allow safe relative path: %s',\n (input) => {\n // If the input is a clean relative path, it should be returned as-is\n expect(getSafeRedirect({ redirectTo: input, fallbackTo: fallback })).toBe(input)\n },\n )\n\n // Invalid types or empty inputs\n it.each(['', null, undefined, 123, {}, []])(\n 'should fallback on invalid or non-string input: %s',\n (input) => {\n // If the input is not a valid string, it should return the fallback\n expect(getSafeRedirect({ redirectTo: input as any, fallbackTo: fallback })).toBe(fallback)\n },\n )\n\n // Unsafe redirect patterns\n it.each([\n '//example.com', // protocol-relative URL\n '/javascript:alert(1)', // JavaScript scheme\n '/JavaScript:alert(1)', // case-insensitive JavaScript\n '/http://unknown.com', // disguised external redirect\n '/https://unknown.com', // disguised external redirect\n '/%2Funknown.com', // encoded slash — could resolve to //\n '/\\\\/unknown.com', // escaped slash\n '/\\\\\\\\unknown.com', // double escaped slashes\n '/\\\\unknown.com', // single escaped slash\n '%2F%2Funknown.com', // fully encoded protocol-relative path\n '%2Fjavascript:alert(1)', // encoded JavaScript scheme\n ])('should block unsafe redirect: %s', (input) => {\n // All of these should return the fallback because theyre unsafe\n expect(getSafeRedirect({ redirectTo: input, fallbackTo: fallback })).toBe(fallback)\n })\n\n // Input with extra spaces should still be properly handled\n it('should trim whitespace before evaluating', () => {\n // A valid path with surrounding spaces should still be accepted\n expect(getSafeRedirect({ redirectTo: ' /dashboard ', fallbackTo: fallback })).toBe(\n '/dashboard',\n )\n\n // An unsafe path with spaces should still be rejected\n expect(getSafeRedirect({ redirectTo: ' //example.com ', fallbackTo: fallback })).toBe(\n fallback,\n )\n })\n\n // If decoding the input fails (e.g., invalid percent encoding), it should not crash\n it('should return fallback on invalid encoding', () => {\n expect(getSafeRedirect({ redirectTo: '%E0%A4%A', fallbackTo: fallback })).toBe(fallback)\n })\n})\n"],"names":["describe","it","expect","getSafeRedirect","fallback","each","input","redirectTo","fallbackTo","toBe","undefined"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ,SAAQ;AAC7C,SAASC,eAAe,QAAQ,oBAAmB;AAEnD,MAAMC,WAAW,SAAS,qDAAqD;;AAE/EJ,SAAS,mBAAmB;IAC1B,8BAA8B;IAC9BC,GAAGI,IAAI,CAAC;QAAC;YAAC;SAAa;QAAE;YAAC;SAAkB;QAAE;YAAC;SAAmB;QAAE;YAAC;SAAe;KAAC,EACnF,uCACA,CAACC;QACC,qEAAqE;QACrEJ,OAAOC,gBAAgB;YAAEI,YAAYD;YAAOE,YAAYJ;QAAS,IAAIK,IAAI,CAACH;IAC5E;IAGF,gCAAgC;IAChCL,GAAGI,IAAI,CAAC;QAAC;QAAI;QAAMK;QAAW;QAAK,CAAC;QAAG,EAAE;KAAC,EACxC,sDACA,CAACJ;QACC,oEAAoE;QACpEJ,OAAOC,gBAAgB;YAAEI,YAAYD;YAAcE,YAAYJ;QAAS,IAAIK,IAAI,CAACL;IACnF;IAGF,2BAA2B;IAC3BH,GAAGI,IAAI,CAAC;QACN;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD,EAAE,oCAAoC,CAACC;QACtC,iEAAiE;QACjEJ,OAAOC,gBAAgB;YAAEI,YAAYD;YAAOE,YAAYJ;QAAS,IAAIK,IAAI,CAACL;IAC5E;IAEA,2DAA2D;IAC3DH,GAAG,4CAA4C;QAC7C,gEAAgE;QAChEC,OAAOC,gBAAgB;YAAEI,YAAY;YAAoBC,YAAYJ;QAAS,IAAIK,IAAI,CACpF;QAGF,sDAAsD;QACtDP,OAAOC,gBAAgB;YAAEI,YAAY;YAAuBC,YAAYJ;QAAS,IAAIK,IAAI,CACvFL;IAEJ;IAEA,oFAAoF;IACpFH,GAAG,8CAA8C;QAC/CC,OAAOC,gBAAgB;YAAEI,YAAY;YAAYC,YAAYJ;QAAS,IAAIK,IAAI,CAACL;IACjF;AACF"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/ReactSelect/ValueContainer/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAGvD,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,CAoBrE,CAAA"}

View File

@@ -0,0 +1,5 @@
export declare const addDays: import("./types.js").FPFn2<
Date,
number,
import("../fp.js").DateArg<Date>
>;

View File

@@ -0,0 +1,19 @@
import type { TypeWithID } from 'payload';
import type { Documents } from './index.js';
type RequestDocuments = {
docs: {
relationTo: string;
value: number | string;
}[];
type: 'REQUEST';
};
type AddLoadedDocuments = {
docs: TypeWithID[];
idsToLoad: (number | string)[];
relationTo: string;
type: 'ADD_LOADED';
};
type Action = AddLoadedDocuments | RequestDocuments;
export declare function reducer(state: Documents, action: Action): Documents;
export {};
//# sourceMappingURL=reducer.d.ts.map

View File

@@ -0,0 +1,224 @@
/**
* Return array of browsers by selection queries.
*
* ```js
* browserslist('IE >= 10, IE 8') //=> ['ie 11', 'ie 10', 'ie 8']
* ```
*
* @param queries Browser queries.
* @param opts Options.
* @returns Array with browser names in Can I Use.
*/
declare function browserslist(
queries?: string | readonly string[] | null,
opts?: browserslist.Options
): string[]
declare namespace browserslist {
interface Query {
compose: 'or' | 'and'
type: string
query: string
not?: true
}
interface Options {
/**
* Path to processed file. It will be used to find config files.
*/
path?: string | false
/**
* Processing environment. It will be used to take right queries
* from config file.
*/
env?: string
/**
* Custom browser usage statistics for "> 1% in my stats" query.
*/
stats?: Stats | string
/**
* Path to config file with queries.
*/
config?: string
/**
* Do not throw on unknown version in direct query.
*/
ignoreUnknownVersions?: boolean
/**
* Throw an error if env is not found.
*/
throwOnMissing?: boolean
/**
* Disable security checks for extend query.
*/
dangerousExtend?: boolean
/**
* Alias mobile browsers to the desktop version when Can I Use
* doesnt have data about the specified version.
*/
mobileToDesktop?: boolean
}
type Config = {
defaults: string[]
[section: string]: string[] | undefined
}
interface Stats {
[browser: string]: {
[version: string]: number
}
}
/**
* Browser names aliases.
*/
let aliases: {
[alias: string]: string | undefined
}
/**
* Aliases to work with joined versions like `ios_saf 7.0-7.1`.
*/
let versionAliases: {
[browser: string]:
| {
[version: string]: string | undefined
}
| undefined
}
/**
* Can I Use only provides a few versions for some browsers (e.g. `and_chr`).
*
* Fallback to a similar browser for unknown versions.
*/
let desktopNames: {
[browser: string]: string | undefined
}
let data: {
[browser: string]:
| {
name: string
versions: string[]
released: string[]
releaseDate: {
[version: string]: number | undefined | null
}
}
| undefined
}
let nodeVersions: string[]
interface Usage {
[version: string]: number
}
let usage: {
global?: Usage
custom?: Usage | null
[country: string]: Usage | undefined | null
}
let cache: {
[feature: string]: {
[name: string]: {
[version: string]: string
}
}
}
/**
* Default browsers query
*/
let defaults: readonly string[]
/**
* Which statistics should be used. Country code or custom statistics.
* Pass `"my stats"` to load statistics from `Browserslist` files.
*/
type StatsOptions = string | 'my stats' | Stats | { dataByBrowser: Stats }
/**
* Return browsers market coverage.
*
* ```js
* browserslist.coverage(browserslist('> 1% in US'), 'US') //=> 83.1
* ```
*
* @param browsers Browsers names in Can I Use.
* @param stats Which statistics should be used.
* @returns Total market coverage for all selected browsers.
*/
function coverage(browsers: readonly string[], stats?: StatsOptions): number
/**
* Get queries AST to analyze the config content.
*
* @param queries Browser queries.
* @param opts Options.
* @returns An array of the data of each query in the config.
*/
function parse(
queries?: string | readonly string[] | null,
opts?: browserslist.Options
): Query[]
/**
* Return queries for specific file inside the project.
*
* ```js
* browserslist.loadConfig({
* file: process.cwd()
* }) ?? browserslist.defaults
* ```
*/
function loadConfig(options: LoadConfigOptions): string[] | undefined
function clearCaches(): void
function parseConfig(string: string): Config
function readConfig(file: string): Config
function findConfig(...pathSegments: string[]): Config | undefined
function findConfigFile(...pathSegments: string[]): string | undefined
interface LoadConfigOptions {
/**
* Path to config file
* */
config?: string
/**
* Path to file inside the project to find Browserslist config
* in closest folder
*/
path?: string
/**
* Environment to choose part of config.
*/
env?: string
}
}
declare global {
namespace NodeJS {
interface ProcessEnv {
BROWSERSLIST?: string
BROWSERSLIST_CONFIG?: string
BROWSERSLIST_DANGEROUS_EXTEND?: string
BROWSERSLIST_DISABLE_CACHE?: string
BROWSERSLIST_ENV?: string
BROWSERSLIST_IGNORE_OLD_DATA?: string
BROWSERSLIST_STATS?: string
BROWSERSLIST_ROOT_PATH?: string
}
}
}
export = browserslist

View File

@@ -0,0 +1 @@
{"version":3,"file":"EditMenuItems.d.ts","sourceRoot":"","sources":["../../../src/admin/elements/EditMenuItems.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,MAAM,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAEzC,MAAM,MAAM,4BAA4B,GAAG,EAAE,GAAG,WAAW,CAAA;AAE3D,MAAM,MAAM,wBAAwB,GAAG,wBAAwB,GAAG,4BAA4B,CAAA"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing/langgraph/instrumentation.ts"],"sourcesContent":["import {\n InstrumentationBase,\n type InstrumentationConfig,\n type InstrumentationModuleDefinition,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n} from '@opentelemetry/instrumentation';\nimport type { CompiledGraph, LangGraphOptions } from '@sentry/core';\nimport { getClient, instrumentStateGraphCompile, SDK_VERSION } from '@sentry/core';\n\nconst supportedVersions = ['>=0.0.0 <2.0.0'];\n\ntype LangGraphInstrumentationOptions = InstrumentationConfig & LangGraphOptions;\n\n/**\n * Represents the patched shape of the LangGraph module export.\n */\ninterface PatchedModuleExports {\n [key: string]: unknown;\n StateGraph?: abstract new (...args: unknown[]) => unknown;\n}\n\n/**\n * Sentry LangGraph instrumentation using OpenTelemetry.\n */\nexport class SentryLangGraphInstrumentation extends InstrumentationBase<LangGraphInstrumentationOptions> {\n public constructor(config: LangGraphInstrumentationOptions = {}) {\n super('@sentry/instrumentation-langgraph', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation by defining the modules to be patched.\n */\n public init(): InstrumentationModuleDefinition {\n const module = new InstrumentationNodeModuleDefinition(\n '@langchain/langgraph',\n supportedVersions,\n this._patch.bind(this),\n exports => exports,\n [\n new InstrumentationNodeModuleFile(\n /**\n * In CJS, LangGraph packages re-export from dist/index.cjs files.\n * Patching only the root module sometimes misses the real implementation or\n * gets overwritten when that file is loaded. We add a file-level patch so that\n * _patch runs again on the concrete implementation\n */\n '@langchain/langgraph/dist/index.cjs',\n supportedVersions,\n this._patch.bind(this),\n exports => exports,\n ),\n ],\n );\n return module;\n }\n\n /**\n * Core patch logic applying instrumentation to the LangGraph module.\n */\n private _patch(exports: PatchedModuleExports): PatchedModuleExports | void {\n const client = getClient();\n const defaultPii = Boolean(client?.getOptions().sendDefaultPii);\n\n const config = this.getConfig();\n const recordInputs = config.recordInputs ?? defaultPii;\n const recordOutputs = config.recordOutputs ?? defaultPii;\n\n const options: LangGraphOptions = {\n recordInputs,\n recordOutputs,\n };\n\n // Patch StateGraph.compile to instrument both compile() and invoke()\n if (exports.StateGraph && typeof exports.StateGraph === 'function') {\n const StateGraph = exports.StateGraph as {\n prototype: Record<string, unknown>;\n };\n\n StateGraph.prototype.compile = instrumentStateGraphCompile(\n StateGraph.prototype.compile as (...args: unknown[]) => CompiledGraph,\n options,\n );\n }\n\n return exports;\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","exports","InstrumentationNodeModuleFile","getClient","instrumentStateGraphCompile"],"mappings":";;;;;AAUA,MAAM,iBAAA,GAAoB,CAAC,gBAAgB,CAAC;;AAY5C;AACA;AACA;AACO,MAAM,8BAAA,SAAuCA,mCAAmB,CAAkC;AACzG,GAAS,WAAW,CAAC,MAAM,GAAoC,EAAE,EAAE;AACnE,IAAI,KAAK,CAAC,mCAAmC,EAAEC,gBAAW,EAAE,MAAM,CAAC;AACnE,EAAE;;AAEF;AACA;AACA;AACA,GAAS,IAAI,GAAoC;AACjD,IAAI,MAAM,MAAA,GAAS,IAAIC,mDAAmC;AAC1D,MAAM,sBAAsB;AAC5B,MAAM,iBAAiB;AACvB,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;AAC5B,MAAMC,SAAA,IAAWA,SAAO;AACxB,MAAM;AACN,QAAQ,IAAIC,6CAA6B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,qCAAqC;AAC/C,UAAU,iBAAiB;AAC3B,UAAU,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;AAChC,UAAUD,SAAA,IAAWA,SAAO;AAC5B,SAAS;AACT,OAAO;AACP,KAAK;AACL,IAAI,OAAO,MAAM;AACjB,EAAE;;AAEF;AACA;AACA;AACA,GAAU,MAAM,CAACA,SAAO,EAAqD;AAC7E,IAAI,MAAM,MAAA,GAASE,cAAS,EAAE;AAC9B,IAAI,MAAM,UAAA,GAAa,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,cAAc,CAAC;;AAEnE,IAAI,MAAM,MAAA,GAAS,IAAI,CAAC,SAAS,EAAE;AACnC,IAAI,MAAM,YAAA,GAAe,MAAM,CAAC,YAAA,IAAgB,UAAU;AAC1D,IAAI,MAAM,aAAA,GAAgB,MAAM,CAAC,aAAA,IAAiB,UAAU;;AAE5D,IAAI,MAAM,OAAO,GAAqB;AACtC,MAAM,YAAY;AAClB,MAAM,aAAa;AACnB,KAAK;;AAEL;AACA,IAAI,IAAIF,SAAO,CAAC,UAAA,IAAc,OAAOA,SAAO,CAAC,UAAA,KAAe,UAAU,EAAE;AACxE,MAAM,MAAM,UAAA,GAAaA,SAAO,CAAC;;AAE3B;;AAEN,MAAM,UAAU,CAAC,SAAS,CAAC,OAAA,GAAUG,gCAA2B;AAChE,QAAQ,UAAU,CAAC,SAAS,CAAC,OAAA;AAC7B,QAAQ,OAAO;AACf,OAAO;AACP,IAAI;;AAEJ,IAAI,OAAOH,SAAO;AAClB,EAAE;AACF;;;;"}

View File

@@ -0,0 +1,118 @@
'use strict'
const tap = require('tap')
const { sink, once } = require('./helper')
const pino = require('../')
tap.test('log method hook', t => {
t.test('gets invoked', async t => {
t.plan(8)
const stream = sink()
const logger = pino({
hooks: {
logMethod (args, method, level) {
t.type(args, Array)
t.type(level, 'number')
t.equal(args.length, 3)
t.equal(level, this.levels.values.info)
t.same(args, ['a', 'b', 'c'])
t.type(method, Function)
t.equal(method.name, 'LOG')
method.apply(this, [args.join('-')])
}
}
}, stream)
const o = once(stream, 'data')
logger.info('a', 'b', 'c')
t.match(await o, { msg: 'a-b-c' })
})
t.test('fatal method invokes hook', async t => {
t.plan(2)
const stream = sink()
const logger = pino({
hooks: {
logMethod (args, method) {
t.pass()
method.apply(this, [args.join('-')])
}
}
}, stream)
const o = once(stream, 'data')
logger.fatal('a')
t.match(await o, { msg: 'a' })
})
t.test('children get the hook', async t => {
t.plan(4)
const stream = sink()
const root = pino({
hooks: {
logMethod (args, method) {
t.pass()
method.apply(this, [args.join('-')])
}
}
}, stream)
const child = root.child({ child: 'one' })
const grandchild = child.child({ child: 'two' })
let o = once(stream, 'data')
child.info('a', 'b')
t.match(await o, { msg: 'a-b' })
o = once(stream, 'data')
grandchild.info('c', 'd')
t.match(await o, { msg: 'c-d' })
})
t.test('get log level', async t => {
t.plan(3)
const stream = sink()
const logger = pino({
hooks: {
logMethod (args, method, level) {
t.type(level, 'number')
t.equal(level, this.levels.values.error)
method.apply(this, [args.join('-')])
}
}
}, stream)
const o = once(stream, 'data')
logger.error('a')
t.match(await o, { msg: 'a' })
})
t.end()
})
tap.test('streamWrite hook', t => {
t.test('gets invoked', async t => {
t.plan(1)
const stream = sink()
const logger = pino({
hooks: {
streamWrite (s) {
return s.replaceAll('redact-me', 'XXX')
}
}
}, stream)
const o = once(stream, 'data')
logger.info('hide redact-me in this string')
t.match(await o, { msg: 'hide XXX in this string' })
})
t.end()
})

View File

@@ -0,0 +1 @@
{"version":3,"file":"getFromImportMap.d.ts","sourceRoot":"","sources":["../../../../src/bin/generateImportMap/utilities/getFromImportMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAI5C,eAAO,MAAM,gBAAgB,GAAI,OAAO,QAAQ;IAC9C,SAAS,EAAE,SAAS,CAAA;IACpB,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,KAAG,OAuBH,CAAA"}

View File

@@ -0,0 +1,784 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ import { spawn } from 'child_process';
import crypto from 'crypto';
import { fileURLToPath } from 'node:url';
import path from 'path';
import WebSocket from 'ws';
import { forgotPasswordLocal } from './auth/operations/local/forgotPassword.js';
import { loginLocal } from './auth/operations/local/login.js';
import { resetPasswordLocal } from './auth/operations/local/resetPassword.js';
import { unlockLocal } from './auth/operations/local/unlock.js';
import { verifyEmailLocal } from './auth/operations/local/verifyEmail.js';
import { countLocal } from './collections/operations/local/count.js';
import { createLocal } from './collections/operations/local/create.js';
import { deleteLocal } from './collections/operations/local/delete.js';
import { duplicateLocal } from './collections/operations/local/duplicate.js';
import { findLocal } from './collections/operations/local/find.js';
import { findByIDLocal } from './collections/operations/local/findByID.js';
import { findDistinct as findDistinctLocal } from './collections/operations/local/findDistinct.js';
import { findVersionByIDLocal } from './collections/operations/local/findVersionByID.js';
import { findVersionsLocal } from './collections/operations/local/findVersions.js';
import { restoreVersionLocal } from './collections/operations/local/restoreVersion.js';
import { updateLocal } from './collections/operations/local/update.js';
import { countGlobalVersionsLocal } from './globals/operations/local/countVersions.js';
import { findOneGlobalLocal } from './globals/operations/local/findOne.js';
import { findGlobalVersionByIDLocal } from './globals/operations/local/findVersionByID.js';
import { findGlobalVersionsLocal } from './globals/operations/local/findVersions.js';
import { restoreGlobalVersionLocal } from './globals/operations/local/restoreVersion.js';
import { updateGlobalLocal } from './globals/operations/local/update.js';
export { EntityType } from './admin/views/dashboard.js';
import { Cron } from 'croner';
import { decrypt, encrypt } from './auth/crypto.js';
import { authLocal } from './auth/operations/local/auth.js';
import { APIKeyAuthentication } from './auth/strategies/apiKey.js';
import { JWTAuthentication } from './auth/strategies/jwt.js';
import { generateImportMap } from './bin/generateImportMap/index.js';
import { checkPayloadDependencies } from './checkPayloadDependencies.js';
import { countVersionsLocal } from './collections/operations/local/countVersions.js';
import { consoleEmailAdapter } from './email/consoleEmailAdapter.js';
import { fieldAffectsData } from './fields/config/types.js';
import { getJobsLocalAPI } from './queues/localAPI.js';
import { _internal_jobSystemGlobals } from './queues/utilities/getCurrentDate.js';
import { formatAdminURL } from './utilities/formatAdminURL.js';
import { isNextBuild } from './utilities/isNextBuild.js';
import { getLogger } from './utilities/logger.js';
import { serverInit as serverInitTelemetry } from './utilities/telemetry/events/serverInit.js';
import { traverseFields } from './utilities/traverseFields.js';
/**
* Export of all base fields that could potentially be
* useful as users wish to extend built-in fields with custom logic
*/ export { accountLockFields as baseAccountLockFields } from './auth/baseFields/accountLock.js';
export { apiKeyFields as baseAPIKeyFields } from './auth/baseFields/apiKey.js';
export { baseAuthFields } from './auth/baseFields/auth.js';
export { emailFieldConfig as baseEmailField } from './auth/baseFields/email.js';
export { sessionsFieldConfig as baseSessionsField } from './auth/baseFields/sessions.js';
export { usernameFieldConfig as baseUsernameField } from './auth/baseFields/username.js';
export { verificationFields as baseVerificationFields } from './auth/baseFields/verification.js';
export { executeAccess } from './auth/executeAccess.js';
export { executeAuthStrategies } from './auth/executeAuthStrategies.js';
export { extractAccessFromPermission } from './auth/extractAccessFromPermission.js';
export { getAccessResults } from './auth/getAccessResults.js';
export { getFieldsToSign } from './auth/getFieldsToSign.js';
export { getLoginOptions } from './auth/getLoginOptions.js';
export * from './auth/index.js';
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
let checkedDependencies = false;
/**
* @description Payload
*/ export class BasePayload {
/**
* @description Authorization and Authentication using headers and cookies to run auth user strategies
* @returns permissions: Permissions
* @returns user: User
*/ auth = async (options)=>{
return authLocal(this, options);
};
authStrategies;
blocks = {};
collections = {};
config;
/**
* @description Performs count operation
* @param options
* @returns count of documents satisfying query
*/ count = async (options)=>{
return countLocal(this, options);
};
/**
* @description Performs countGlobalVersions operation
* @param options
* @returns count of global document versions satisfying query
*/ countGlobalVersions = async (options)=>{
return countGlobalVersionsLocal(this, options);
};
/**
* @description Performs countVersions operation
* @param options
* @returns count of document versions satisfying query
*/ countVersions = async (options)=>{
return countVersionsLocal(this, options);
};
/**
* @description Performs create operation
* @param options
* @returns created document
*/ create = async (options)=>{
return createLocal(this, options);
};
crons = [];
db;
decrypt = decrypt;
destroy = async ()=>{
if (this.crons.length) {
// Remove all crons from the list before stopping them
const cronsToStop = this.crons.splice(0, this.crons.length);
await Promise.all(cronsToStop.map((cron)=>cron.stop()));
}
if (this.db?.destroy && typeof this.db.destroy === 'function') {
await this.db.destroy();
}
};
duplicate = async (options)=>{
return duplicateLocal(this, options);
};
email;
// TODO: re-implement or remove?
// errorHandler: ErrorHandler
encrypt = encrypt;
extensions;
/**
* @description Find documents with criteria
* @param options
* @returns documents satisfying query
*/ find = async (options)=>{
return findLocal(this, options);
};
/**
* @description Find document by ID
* @param options
* @returns document with specified ID
*/ findByID = async (options)=>{
return findByIDLocal(this, options);
};
/**
* @description Find distinct field values
* @param options
* @returns result with distinct field values
*/ findDistinct = async (options)=>{
return findDistinctLocal(this, options);
};
findGlobal = async (options)=>{
return findOneGlobalLocal(this, options);
};
/**
* @description Find global version by ID
* @param options
* @returns global version with specified ID
*/ findGlobalVersionByID = async (options)=>{
return findGlobalVersionByIDLocal(this, options);
};
/**
* @description Find global versions with criteria
* @param options
* @returns versions satisfying query
*/ findGlobalVersions = async (options)=>{
return findGlobalVersionsLocal(this, options);
};
/**
* @description Find version by ID
* @param options
* @returns version with specified ID
*/ findVersionByID = async (options)=>{
return findVersionByIDLocal(this, options);
};
/**
* @description Find versions with criteria
* @param options
* @returns versions satisfying query
*/ findVersions = async (options)=>{
return findVersionsLocal(this, options);
};
forgotPassword = async (options)=>{
return forgotPasswordLocal(this, options);
};
getAdminURL = ()=>formatAdminURL({
adminRoute: this.config.routes.admin,
path: '',
serverURL: this.config.serverURL
});
getAPIURL = ()=>formatAdminURL({
apiRoute: this.config.routes.api,
path: '',
serverURL: this.config.serverURL
});
globals;
importMap;
jobs = getJobsLocalAPI(this);
/**
* Key Value storage
*/ kv;
logger;
login = async (options)=>{
return loginLocal(this, options);
};
resetPassword = async (options)=>{
return resetPasswordLocal(this, options);
};
/**
* @description Restore global version by ID
* @param options
* @returns version with specified ID
*/ restoreGlobalVersion = async (options)=>{
return restoreGlobalVersionLocal(this, options);
};
/**
* @description Restore version by ID
* @param options
* @returns version with specified ID
*/ restoreVersion = async (options)=>{
return restoreVersionLocal(this, options);
};
schema;
secret;
sendEmail;
types;
unlock = async (options)=>{
return unlockLocal(this, options);
};
updateGlobal = async (options)=>{
return updateGlobalLocal(this, options);
};
validationRules;
verifyEmail = async (options)=>{
return verifyEmailLocal(this, options);
};
versions = {};
async _initializeCrons() {
if (this.config.jobs.enabled && this.config.jobs.autoRun && !isNextBuild()) {
const DEFAULT_CRON = '* * * * *';
const DEFAULT_LIMIT = 10;
const cronJobs = typeof this.config.jobs.autoRun === 'function' ? await this.config.jobs.autoRun(this) : this.config.jobs.autoRun;
await Promise.all(cronJobs.map((cronConfig)=>{
const jobAutorunCron = new Cron(cronConfig.cron ?? DEFAULT_CRON, async ()=>{
if (_internal_jobSystemGlobals.shouldAutoSchedule && !cronConfig.disableScheduling && this.config.jobs.scheduling) {
await this.jobs.handleSchedules({
allQueues: cronConfig.allQueues,
queue: cronConfig.queue
});
}
if (!_internal_jobSystemGlobals.shouldAutoRun) {
return;
}
if (typeof this.config.jobs.shouldAutoRun === 'function') {
const shouldAutoRun = await this.config.jobs.shouldAutoRun(this);
if (!shouldAutoRun) {
jobAutorunCron.stop();
return;
}
}
await this.jobs.run({
allQueues: cronConfig.allQueues,
limit: cronConfig.limit ?? DEFAULT_LIMIT,
queue: cronConfig.queue,
silent: cronConfig.silent
});
}, {
// Do not run consecutive crons if previous crons still ongoing
protect: true
});
this.crons.push(jobAutorunCron);
}));
}
}
async bin({ args, cwd, log }) {
return new Promise((resolve, reject)=>{
const spawned = spawn('node', [
path.resolve(dirname, '../bin.js'),
...args
], {
cwd,
stdio: log || log === undefined ? 'inherit' : 'ignore'
});
spawned.on('exit', (code)=>{
resolve({
code: code
});
});
spawned.on('error', (error)=>{
reject(error);
});
});
}
delete(options) {
return deleteLocal(this, options);
}
/**
* @description Initializes Payload
* @param options
*/ async init(options) {
if (process.env.NODE_ENV !== 'production' && process.env.PAYLOAD_DISABLE_DEPENDENCY_CHECKER !== 'true' && !checkedDependencies) {
checkedDependencies = true;
void checkPayloadDependencies();
}
this.importMap = options.importMap;
if (!options?.config) {
throw new Error('Error: the payload config is required to initialize payload.');
}
this.config = await options.config;
this.logger = getLogger('payload', this.config.logger);
if (!this.config.secret) {
throw new Error('Error: missing secret key. A secret key is needed to secure Payload.');
}
this.secret = crypto.createHash('sha256').update(this.config.secret).digest('hex').slice(0, 32);
this.globals = {
config: this.config.globals
};
for (const collection of this.config.collections){
let customIDType = undefined;
const findCustomID = ({ field })=>{
if ([
'array',
'blocks',
'group'
].includes(field.type) || field.type === 'tab' && 'name' in field) {
return true;
}
if (!fieldAffectsData(field)) {
return;
}
if (field.name === 'id') {
customIDType = field.type;
return true;
}
};
traverseFields({
callback: findCustomID,
config: this.config,
fields: collection.fields,
parentIsLocalized: false
});
this.collections[collection.slug] = {
config: collection,
customIDType
};
}
this.blocks = this.config.blocks.reduce((blocks, block)=>{
blocks[block.slug] = block;
return blocks;
}, {});
// Generate types on startup
if (process.env.NODE_ENV !== 'production' && this.config.typescript.autoGenerate !== false) {
// We cannot run it directly here, as generate-types imports json-schema-to-typescript, which breaks on turbopack.
// see: https://github.com/vercel/next.js/issues/66723
void this.bin({
args: [
'generate:types'
],
log: false
});
}
this.db = this.config.db.init({
payload: this
});
this.db.payload = this;
this.kv = this.config.kv.init({
payload: this
});
if (this.db?.init) {
await this.db.init();
}
if (!options.disableDBConnect && this.db.connect) {
await this.db.connect();
}
// Load email adapter
if (this.config.email instanceof Promise) {
const awaitedAdapter = await this.config.email;
this.email = awaitedAdapter({
payload: this
});
} else if (this.config.email) {
this.email = this.config.email({
payload: this
});
} else {
if (process.env.NEXT_PHASE !== 'phase-production-build') {
this.logger.warn(`No email adapter provided. Email will be written to console. More info at https://payloadcms.com/docs/email/overview.`);
}
this.email = consoleEmailAdapter({
payload: this
});
}
// Warn if image resizing is enabled but sharp is not installed
if (!this.config.sharp && this.config.collections.some((c)=>c.upload.imageSizes || c.upload.formatOptions)) {
this.logger.warn(`Image resizing is enabled for one or more collections, but sharp not installed. Please install 'sharp' and pass into the config.`);
}
// Warn if user is deploying to Vercel, and any upload collection is missing a storage adapter
if (process.env.VERCEL) {
const uploadCollWithoutAdapter = this.config.collections.filter((c)=>c.upload && c.upload.adapter === undefined);
if (uploadCollWithoutAdapter.length) {
const slugs = uploadCollWithoutAdapter.map((c)=>c.slug).join(', ');
this.logger.warn(`Collections with uploads enabled require a storage adapter when deploying to Vercel. Collection(s) without storage adapters: ${slugs}. See https://payloadcms.com/docs/upload/storage-adapters for more info.`);
}
}
this.sendEmail = this.email['sendEmail'];
serverInitTelemetry(this);
// 1. loop over collections, if collection has auth strategy, initialize and push to array
let jwtStrategyEnabled = false;
this.authStrategies = this.config.collections.reduce((authStrategies, collection)=>{
if (collection?.auth) {
if (collection.auth.strategies.length > 0) {
authStrategies.push(...collection.auth.strategies);
}
// 2. if api key enabled, push api key strategy into the array
if (collection.auth?.useAPIKey) {
authStrategies.push({
name: `${collection.slug}-api-key`,
authenticate: APIKeyAuthentication(collection)
});
}
// 3. if localStrategy flag is true
if (!collection.auth.disableLocalStrategy && !jwtStrategyEnabled) {
jwtStrategyEnabled = true;
}
}
return authStrategies;
}, []);
// 4. if enabled, push jwt strategy into authStrategies last
if (jwtStrategyEnabled) {
this.authStrategies.push({
name: 'local-jwt',
authenticate: JWTAuthentication
});
}
try {
if (!options.disableOnInit) {
if (typeof options.onInit === 'function') {
await options.onInit(this);
}
if (typeof this.config.onInit === 'function') {
await this.config.onInit(this);
}
}
} catch (error) {
this.logger.error({
err: error
}, 'Error running onInit function');
throw error;
}
if (options.cron) {
await this._initializeCrons();
}
return this;
}
update(options) {
return updateLocal(this, options);
}
}
const initialized = new BasePayload();
// eslint-disable-next-line no-restricted-exports
export default initialized;
export const reload = async (config, payload, skipImportMapGeneration, options)=>{
if (typeof payload.db.destroy === 'function') {
// Only destroy db, as we then later only call payload.db.init and not payload.init
await payload.db.destroy();
}
payload.config = config;
payload.collections = config.collections.reduce((collections, collection)=>{
collections[collection.slug] = {
config: collection,
customIDType: payload.collections[collection.slug]?.customIDType
};
return collections;
}, {});
payload.blocks = config.blocks.reduce((blocks, block)=>{
blocks[block.slug] = block;
return blocks;
}, {});
payload.globals = {
config: config.globals
};
// TODO: support HMR for other props in the future (see payload/src/index init()) that may change on Payload singleton
// Generate types
if (config.typescript.autoGenerate !== false) {
// We cannot run it directly here, as generate-types imports json-schema-to-typescript, which breaks on turbopack.
// see: https://github.com/vercel/next.js/issues/66723
void payload.bin({
args: [
'generate:types'
],
log: false
});
}
// Generate import map
if (skipImportMapGeneration !== true && config.admin?.importMap?.autoGenerate !== false) {
// This may run outside of the admin panel, e.g. in the user's frontend, where we don't have an import map file.
// We don't want to throw an error in this case, as it would break the user's frontend.
// => just skip it => ignoreResolveError: true
await generateImportMap(config, {
ignoreResolveError: true,
log: true
});
}
if (payload.db?.init) {
await payload.db.init();
}
if (!options?.disableDBConnect && payload.db.connect) {
await payload.db.connect({
hotReload: true
});
}
;
global._payload_clientConfigs = {};
global._payload_schemaMap = null;
global._payload_clientSchemaMap = null;
global._payload_doNotCacheClientConfig = true // This will help refreshing the client config cache more reliably. If you remove this, please test HMR + client config refreshing (do new fields appear in the document?)
;
global._payload_doNotCacheSchemaMap = true;
global._payload_doNotCacheClientSchemaMap = true;
};
let _cached = global._payload;
if (!_cached) {
_cached = global._payload = new Map();
}
/**
* Get a payload instance.
* This function is a wrapper around new BasePayload().init() that adds the following functionality on top of that:
*
* - smartly caches Payload instance on the module scope. That way, we prevent unnecessarily initializing Payload over and over again
* when calling getPayload multiple times or from multiple locations.
* - adds HMR support and reloads the payload instance when the config changes.
*/ export const getPayload = async (options)=>{
if (!options?.config) {
throw new Error('Error: the payload config is required for getPayload to work.');
}
let alreadyCachedSameConfig = false;
let cached = _cached.get(options.key ?? 'default');
if (!cached) {
cached = {
initializedCrons: Boolean(options.cron),
payload: null,
promise: null,
reload: false,
ws: null
};
_cached.set(options.key ?? 'default', cached);
} else {
alreadyCachedSameConfig = true;
}
if (alreadyCachedSameConfig) {
// alreadyCachedSameConfig => already called onInit once, but same config => no need to call onInit again.
// calling onInit again would only make sense if a different config was passed.
options.disableOnInit = true;
}
if (cached.payload) {
if (options.cron && !cached.initializedCrons) {
// getPayload called with crons enabled, but existing cached version does not have crons initialized. => Initialize crons in existing cached version
cached.initializedCrons = true;
await cached.payload._initializeCrons();
}
if (cached.reload === true) {
let resolve;
// getPayload is called multiple times, in parallel. However, we only want to run `await reload` once. By immediately setting cached.reload to a promise,
// we can ensure that all subsequent calls will wait for the first reload to finish. So if we set it here, the 2nd call of getPayload
// will reach `if (cached.reload instanceof Promise) {` which then waits for the first reload to finish.
cached.reload = new Promise((res)=>resolve = res);
const config = await options.config;
// Reload the payload instance after a config change (triggered by HMR in development).
// The second parameter (false) forces import map regeneration rather than deciding based on options.importMap.
//
// Why we always regenerate import map: getPayload() may be called from multiple sources (admin panel, frontend, etc.)
// that share the same cache but may pass different importMap values. Since call order is unpredictable,
// we cannot rely on options.importMap to determine if regeneration is needed.
//
// Example scenario: If the frontend calls getPayload() without importMap first, followed by the admin
// panel calling it with importMap, we'd incorrectly skip generation for the admin panel's needs.
// By always regenerating on reload, we ensure the import map stays in sync with the updated config.
await reload(config, cached.payload, false, options);
resolve();
cached.reload = false;
}
if (cached.reload instanceof Promise) {
await cached.reload;
}
if (options?.importMap) {
cached.payload.importMap = options.importMap;
}
return cached.payload;
}
try {
if (!cached.promise) {
// no need to await options.config here, as it's already awaited in the BasePayload.init
cached.promise = new BasePayload().init(options);
}
cached.payload = await cached.promise;
if (!cached.ws && process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test' && process.env.DISABLE_PAYLOAD_HMR !== 'true') {
try {
const port = process.env.PORT || '3000';
const hasHTTPS = process.env.USE_HTTPS === 'true' || process.argv.includes('--experimental-https');
const protocol = hasHTTPS ? 'wss' : 'ws';
const path = '/_next/webpack-hmr';
// The __NEXT_ASSET_PREFIX env variable is set for both assetPrefix and basePath (tested in Next.js 15.1.6)
const prefix = process.env.__NEXT_ASSET_PREFIX ?? '';
cached.ws = new WebSocket(process.env.PAYLOAD_HMR_URL_OVERRIDE ?? `${protocol}://localhost:${port}${prefix}${path}`);
cached.ws.onmessage = (event)=>{
if (cached.reload instanceof Promise) {
// If there is an in-progress reload in the same getPayload
// cache instance, do not set reload to true again, which would
// trigger another reload.
// Instead, wait for the in-progress reload to finish.
return;
}
if (typeof event.data === 'string') {
const data = JSON.parse(event.data);
if (// On Next.js 15, we need to check for data.action. On Next.js 16, we need to check for data.type.
data.type === 'serverComponentChanges' || data.action === 'serverComponentChanges') {
cached.reload = true;
}
}
};
cached.ws.onerror = (_)=>{
// swallow any websocket connection error
};
} catch (_) {
// swallow e
}
}
} catch (e) {
cached.promise = null;
e.payloadInitError = true;
throw e;
}
if (options?.importMap) {
cached.payload.importMap = options.importMap;
}
return cached.payload;
};
export { jwtSign } from './auth/jwt.js';
export { accessOperation } from './auth/operations/access.js';
export { forgotPasswordOperation } from './auth/operations/forgotPassword.js';
export { initOperation } from './auth/operations/init.js';
export { checkLoginPermission } from './auth/operations/login.js';
export { loginOperation } from './auth/operations/login.js';
export { logoutOperation } from './auth/operations/logout.js';
export { meOperation } from './auth/operations/me.js';
export { refreshOperation } from './auth/operations/refresh.js';
export { registerFirstUserOperation } from './auth/operations/registerFirstUser.js';
export { resetPasswordOperation } from './auth/operations/resetPassword.js';
export { unlockOperation } from './auth/operations/unlock.js';
export { verifyEmailOperation } from './auth/operations/verifyEmail.js';
export { JWTAuthentication } from './auth/strategies/jwt.js';
export { incrementLoginAttempts } from './auth/strategies/local/incrementLoginAttempts.js';
export { resetLoginAttempts } from './auth/strategies/local/resetLoginAttempts.js';
export { generateImportMap } from './bin/generateImportMap/index.js';
export { genImportMapIterateFields } from './bin/generateImportMap/iterateFields.js';
export { migrate as migrateCLI } from './bin/migrate.js';
export { createClientCollectionConfig, createClientCollectionConfigs } from './collections/config/client.js';
export { createDataloaderCacheKey, getDataLoader } from './collections/dataloader.js';
export { countOperation } from './collections/operations/count.js';
export { createOperation } from './collections/operations/create.js';
export { deleteOperation } from './collections/operations/delete.js';
export { deleteByIDOperation } from './collections/operations/deleteByID.js';
export { docAccessOperation } from './collections/operations/docAccess.js';
export { duplicateOperation } from './collections/operations/duplicate.js';
export { findOperation } from './collections/operations/find.js';
export { findByIDOperation } from './collections/operations/findByID.js';
export { findVersionByIDOperation } from './collections/operations/findVersionByID.js';
export { findVersionsOperation } from './collections/operations/findVersions.js';
export { restoreVersionOperation } from './collections/operations/restoreVersion.js';
export { updateOperation } from './collections/operations/update.js';
export { updateByIDOperation } from './collections/operations/updateByID.js';
export { buildConfig } from './config/build.js';
export { createClientConfig, createUnauthenticatedClientConfig, serverOnlyAdminConfigProperties, serverOnlyConfigProperties } from './config/client.js';
export { defaults } from './config/defaults.js';
export { sanitizeConfig } from './config/sanitize.js';
export { combineQueries } from './database/combineQueries.js';
export { createDatabaseAdapter } from './database/createDatabaseAdapter.js';
export { defaultBeginTransaction } from './database/defaultBeginTransaction.js';
export { flattenWhereToOperators } from './database/flattenWhereToOperators.js';
export { getLocalizedPaths } from './database/getLocalizedPaths.js';
export { createMigration } from './database/migrations/createMigration.js';
export { findMigrationDir } from './database/migrations/findMigrationDir.js';
export { getMigrations } from './database/migrations/getMigrations.js';
export { getPredefinedMigration } from './database/migrations/getPredefinedMigration.js';
export { migrate } from './database/migrations/migrate.js';
export { migrateDown } from './database/migrations/migrateDown.js';
export { migrateRefresh } from './database/migrations/migrateRefresh.js';
export { migrateReset } from './database/migrations/migrateReset.js';
export { migrateStatus } from './database/migrations/migrateStatus.js';
export { migrationsCollection } from './database/migrations/migrationsCollection.js';
export { migrationTemplate } from './database/migrations/migrationTemplate.js';
export { readMigrationFiles } from './database/migrations/readMigrationFiles.js';
export { writeMigrationIndex } from './database/migrations/writeMigrationIndex.js';
export { validateQueryPaths } from './database/queryValidation/validateQueryPaths.js';
export { validateSearchParam } from './database/queryValidation/validateSearchParams.js';
export { APIError, APIErrorName, AuthenticationError, DuplicateCollection, DuplicateFieldName, DuplicateGlobal, ErrorDeletingFile, FileRetrievalError, FileUploadError, Forbidden, InvalidConfiguration, InvalidFieldName, InvalidFieldRelationship, Locked, LockedAuth, MissingCollectionLabel, MissingEditorProp, MissingFieldInputOptions, MissingFieldType, MissingFile, NotFound, QueryError, UnauthorizedError, UnverifiedEmail, ValidationError, ValidationErrorName } from './errors/index.js';
export { baseBlockFields } from './fields/baseFields/baseBlockFields.js';
export { baseIDField } from './fields/baseFields/baseIDField.js';
export { slugField } from './fields/baseFields/slug/index.js';
export { createClientField, createClientFields } from './fields/config/client.js';
export { sanitizeFields } from './fields/config/sanitize.js';
export { getDefaultValue } from './fields/getDefaultValue.js';
export { traverseFields as afterChangeTraverseFields } from './fields/hooks/afterChange/traverseFields.js';
export { promise as afterReadPromise } from './fields/hooks/afterRead/promise.js';
export { traverseFields as afterReadTraverseFields } from './fields/hooks/afterRead/traverseFields.js';
export { traverseFields as beforeChangeTraverseFields } from './fields/hooks/beforeChange/traverseFields.js';
export { traverseFields as beforeValidateTraverseFields } from './fields/hooks/beforeValidate/traverseFields.js';
export { sortableFieldTypes } from './fields/sortableFieldTypes.js';
export { validateBlocksFilterOptions, validations } from './fields/validations.js';
export { getFolderData } from './folders/utils/getFolderData.js';
export { createClientGlobalConfig, createClientGlobalConfigs } from './globals/config/client.js';
export { docAccessOperation as docAccessOperationGlobal } from './globals/operations/docAccess.js';
export { findOneOperation } from './globals/operations/findOne.js';
export { findVersionByIDOperation as findVersionByIDOperationGlobal } from './globals/operations/findVersionByID.js';
export { findVersionsOperation as findVersionsOperationGlobal } from './globals/operations/findVersions.js';
export { restoreVersionOperation as restoreVersionOperationGlobal } from './globals/operations/restoreVersion.js';
export { updateOperation as updateOperationGlobal } from './globals/operations/update.js';
export * from './kv/adapters/DatabaseKVAdapter.js';
export * from './kv/adapters/InMemoryKVAdapter.js';
export * from './kv/index.js';
export { jobAfterRead } from './queues/config/collection.js';
export { JobCancelledError } from './queues/errors/index.js';
export { countRunnableOrActiveJobsForQueue } from './queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.js';
export { importHandlerPath } from './queues/operations/runJobs/runJob/importHandlerPath.js';
export { _internal_jobSystemGlobals, _internal_resetJobSystemGlobals, getCurrentDate } from './queues/utilities/getCurrentDate.js';
export { getLocalI18n } from './translations/getLocalI18n.js';
export * from './types/index.js';
export { getFileByPath } from './uploads/getFileByPath.js';
export { _internal_safeFetchGlobal } from './uploads/safeFetch.js';
export { addDataAndFileToRequest } from './utilities/addDataAndFileToRequest.js';
export { addLocalesToRequestFromData, sanitizeLocales } from './utilities/addLocalesToRequest.js';
export { canAccessAdmin } from './utilities/canAccessAdmin.js';
export { commitTransaction } from './utilities/commitTransaction.js';
export { configToJSONSchema, entityToJSONSchema, fieldsToJSONSchema, withNullableJSONSchemaType } from './utilities/configToJSONSchema.js';
export { createArrayFromCommaDelineated } from './utilities/createArrayFromCommaDelineated.js';
export { createLocalReq } from './utilities/createLocalReq.js';
export { createPayloadRequest } from './utilities/createPayloadRequest.js';
export { deepCopyObject, deepCopyObjectComplex, deepCopyObjectSimple } from './utilities/deepCopyObject.js';
export { deepMerge, deepMergeWithCombinedArrays, deepMergeWithReactComponents, deepMergeWithSourceArrays } from './utilities/deepMerge.js';
export { checkDependencies } from './utilities/dependencies/dependencyChecker.js';
export { getDependencies } from './utilities/dependencies/getDependencies.js';
export { dynamicImport } from './utilities/dynamicImport.js';
export { findUp, findUpSync, pathExistsAndIsAccessible, pathExistsAndIsAccessibleSync } from './utilities/findUp.js';
export { flattenAllFields } from './utilities/flattenAllFields.js';
export { flattenTopLevelFields } from './utilities/flattenTopLevelFields.js';
export { formatErrors } from './utilities/formatErrors.js';
export { formatLabels, formatNames, toWords } from './utilities/formatLabels.js';
export { getBlockSelect } from './utilities/getBlockSelect.js';
export { getCollectionIDFieldTypes } from './utilities/getCollectionIDFieldTypes.js';
export { getFieldByPath } from './utilities/getFieldByPath.js';
export { getObjectDotNotation } from './utilities/getObjectDotNotation.js';
export { getRequestLanguage } from './utilities/getRequestLanguage.js';
export { handleEndpoints } from './utilities/handleEndpoints.js';
export { headersWithCors } from './utilities/headersWithCors.js';
export { initTransaction } from './utilities/initTransaction.js';
export { isEntityHidden } from './utilities/isEntityHidden.js';
export { isolateObjectProperty } from './utilities/isolateObjectProperty.js';
export { isPlainObject } from './utilities/isPlainObject.js';
export { isValidID } from './utilities/isValidID.js';
export { killTransaction } from './utilities/killTransaction.js';
export { logError } from './utilities/logError.js';
export { defaultLoggerOptions } from './utilities/logger.js';
export { mapAsync } from './utilities/mapAsync.js';
export { mergeHeaders } from './utilities/mergeHeaders.js';
export { parseDocumentID } from './utilities/parseDocumentID.js';
export { sanitizeFallbackLocale } from './utilities/sanitizeFallbackLocale.js';
export { sanitizeJoinParams } from './utilities/sanitizeJoinParams.js';
export { sanitizePopulateParam } from './utilities/sanitizePopulateParam.js';
export { sanitizeSelectParam } from './utilities/sanitizeSelectParam.js';
export { stripUnselectedFields } from './utilities/stripUnselectedFields.js';
export { traverseFields } from './utilities/traverseFields.js';
export { buildVersionCollectionFields } from './versions/buildCollectionFields.js';
export { buildVersionGlobalFields } from './versions/buildGlobalFields.js';
export { buildVersionCompoundIndexes } from './versions/buildVersionCompoundIndexes.js';
export { versionDefaults } from './versions/defaults.js';
export { deleteCollectionVersions } from './versions/deleteCollectionVersions.js';
export { appendVersionToQueryKey } from './versions/drafts/appendVersionToQueryKey.js';
export { getQueryDraftsSort } from './versions/drafts/getQueryDraftsSort.js';
export { enforceMaxVersions } from './versions/enforceMaxVersions.js';
export { getLatestCollectionVersion } from './versions/getLatestCollectionVersion.js';
export { getLatestGlobalVersion } from './versions/getLatestGlobalVersion.js';
export { localizeStatus } from './versions/migrations/localizeStatus/index.js';
export { saveVersion } from './versions/saveVersion.js';
export { deepMergeSimple } from '@payloadcms/translations/utilities';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,23 @@
/**
* @license lucide-react v0.441.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const FileSymlink = createLucideIcon("FileSymlink", [
["path", { d: "m10 18 3-3-3-3", key: "18f6ys" }],
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
[
"path",
{
d: "M4 11V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",
key: "50q2rw"
}
]
]);
export { FileSymlink as default };
//# sourceMappingURL=file-symlink.js.map

View File

@@ -0,0 +1,145 @@
"use strict";
exports.match = void 0;
var _index = require("../../_lib/buildMatchPatternFn.cjs");
var _index2 = require("../../_lib/buildMatchFn.cjs");
const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
const parseOrdinalNumberPattern = /\d+/i;
const matchEraPatterns = {
narrow: /[قب]/,
abbreviated: /[قب]\.م\./,
wide: /(قبل|بعد) الميلاد/,
};
const parseEraPatterns = {
any: [/قبل/, /بعد/],
};
const matchQuarterPatterns = {
narrow: /^[1234]/i,
abbreviated: /ر[1234]/,
wide: /الربع (الأول|الثاني|الثالث|الرابع)/,
};
const parseQuarterPatterns = {
any: [/1/i, /2/i, /3/i, /4/i],
};
const matchMonthPatterns = {
narrow: /^[جفمأسند]/,
abbreviated:
/^(جانفي|فيفري|مارس|أفريل|ماي|جوان|جويلية|أوت|سبتمبر|أكتوبر|نوفمبر|ديسمبر)/,
wide: /^(جانفي|فيفري|مارس|أفريل|ماي|جوان|جويلية|أوت|سبتمبر|أكتوبر|نوفمبر|ديسمبر)/,
};
const parseMonthPatterns = {
narrow: [
/^ج/i,
/^ف/i,
/^م/i,
/^أ/i,
/^م/i,
/^ج/i,
/^ج/i,
/^أ/i,
/^س/i,
/^أ/i,
/^ن/i,
/^د/i,
],
any: [
/^جانفي/i,
/^فيفري/i,
/^مارس/i,
/^أفريل/i,
/^ماي/i,
/^جوان/i,
/^جويلية/i,
/^أوت/i,
/^سبتمبر/i,
/^أكتوبر/i,
/^نوفمبر/i,
/^ديسمبر/i,
],
};
const matchDayPatterns = {
narrow: /^[حنثرخجس]/i,
short: /^(أحد|اثنين|ثلاثاء|أربعاء|خميس|جمعة|سبت)/i,
abbreviated: /^(أحد|اثنين|ثلاثاء|أربعاء|خميس|جمعة|سبت)/i,
wide: /^(الأحد|الاثنين|الثلاثاء|الأربعاء|الخميس|الجمعة|السبت)/i,
};
const parseDayPatterns = {
narrow: [/^ح/i, /^ن/i, /^ث/i, /^ر/i, /^خ/i, /^ج/i, /^س/i],
wide: [
/^الأحد/i,
/^الاثنين/i,
/^الثلاثاء/i,
/^الأربعاء/i,
/^الخميس/i,
/^الجمعة/i,
/^السبت/i,
],
any: [/^أح/i, /^اث/i, /^ث/i, /^أر/i, /^خ/i, /^ج/i, /^س/i],
};
const matchDayPeriodPatterns = {
narrow: /^(ص|ع|ن ل|ل|(في|مع) (صباح|قايلة|عشية|ليل))/,
any: /^([صع]|نص الليل|قايلة|(في|مع) (صباح|قايلة|عشية|ليل))/,
};
const parseDayPeriodPatterns = {
any: {
am: /^ص/,
pm: /^ع/,
midnight: /نص الليل/,
noon: /قايلة/,
afternoon: /بعد القايلة/,
morning: /صباح/,
evening: /عشية/,
night: /ليل/,
},
};
const match = (exports.match = {
ordinalNumber: (0, _index.buildMatchPatternFn)({
matchPattern: matchOrdinalNumberPattern,
parsePattern: parseOrdinalNumberPattern,
valueCallback: (value) => parseInt(value, 10),
}),
era: (0, _index2.buildMatchFn)({
matchPatterns: matchEraPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseEraPatterns,
defaultParseWidth: "any",
}),
quarter: (0, _index2.buildMatchFn)({
matchPatterns: matchQuarterPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseQuarterPatterns,
defaultParseWidth: "any",
valueCallback: (index) => index + 1,
}),
month: (0, _index2.buildMatchFn)({
matchPatterns: matchMonthPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseMonthPatterns,
defaultParseWidth: "any",
}),
day: (0, _index2.buildMatchFn)({
matchPatterns: matchDayPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseDayPatterns,
defaultParseWidth: "any",
}),
dayPeriod: (0, _index2.buildMatchFn)({
matchPatterns: matchDayPeriodPatterns,
defaultMatchWidth: "any",
parsePatterns: parseDayPeriodPatterns,
defaultParseWidth: "any",
}),
});

View File

@@ -0,0 +1,3 @@
import type { Collection } from 'payload';
export declare function forgotPassword(collection: Collection): any;
//# sourceMappingURL=forgotPassword.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"formatAdminURL.js","names":["formatAdminURL"],"sources":["../../src/utilities/formatAdminURL.ts"],"sourcesContent":["/** Will read the `routes.admin` config and appropriately handle `\"/\"` admin paths */\nexport { formatAdminURL } from 'payload/shared'\n"],"mappings":"AAAA,qFACA,SAASA,cAAc,QAAQ","ignoreList":[]}

View File

@@ -0,0 +1,34 @@
import { JOSEError, JWKSTimeout } from '../util/errors.js';
const fetchJwks = async (url, timeout, options) => {
let controller;
let id;
let timedOut = false;
if (typeof AbortController === 'function') {
controller = new AbortController();
id = setTimeout(() => {
timedOut = true;
controller.abort();
}, timeout);
}
const response = await fetch(url.href, {
signal: controller ? controller.signal : undefined,
redirect: 'manual',
headers: options.headers,
}).catch((err) => {
if (timedOut)
throw new JWKSTimeout();
throw err;
});
if (id !== undefined)
clearTimeout(id);
if (response.status !== 200) {
throw new JOSEError('Expected 200 OK from the JSON Web Key Set HTTP response');
}
try {
return await response.json();
}
catch {
throw new JOSEError('Failed to parse the JSON Web Key Set HTTP response as JSON');
}
};
export default fetchJwks;

View File

@@ -0,0 +1 @@
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}export function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}export default clsx;

View File

@@ -0,0 +1,54 @@
{
"name": "ansi-styles",
"version": "6.2.3",
"description": "ANSI escape codes for styling strings in the terminal",
"license": "MIT",
"repository": "chalk/ansi-styles",
"funding": "https://github.com/chalk/ansi-styles?sponsor=1",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=12"
},
"scripts": {
"test": "xo && ava && tsd",
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"devDependencies": {
"ava": "^6.1.3",
"svg-term-cli": "^2.1.1",
"tsd": "^0.31.1",
"xo": "^0.58.0"
}
}

View File

@@ -0,0 +1,30 @@
import { formatDistance } from "./de/_lib/formatDistance.mjs";
import { formatLong } from "./de/_lib/formatLong.mjs";
import { formatRelative } from "./de/_lib/formatRelative.mjs";
import { match } from "./de/_lib/match.mjs";
// difference to 'de' locale
import { localize } from "./de-AT/_lib/localize.mjs";
/**
* @category Locales
* @summary German locale (Austria).
* @language German
* @iso-639-2 deu
* @author Christoph Tobias Stenglein [@cstenglein](https://github.com/cstenglein)
*/
export const deAT = {
code: "de-AT",
formatDistance: formatDistance,
formatLong: formatLong,
formatRelative: formatRelative,
localize: localize,
match: match,
options: {
weekStartsOn: 1 /* Monday */,
firstWeekContainsDate: 4,
},
};
// Fallback for modularized imports:
export default deAT;

View File

@@ -0,0 +1 @@
{"version":3,"file":"debug-build.d.ts","sourceRoot":"","sources":["../../../../src/util/debug-build.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,WAAW,SAAkB,CAAC"}

View File

@@ -0,0 +1,65 @@
import type { BuildColumns } from "../column-builder.js";
import { entityKind } from "../entity.js";
import type { TypedQueryBuilder } from "../query-builders/query-builder.js";
import type { AddAliasToSelection } from "../query-builders/select.types.js";
import type { ColumnsSelection, SQL } from "../sql/sql.js";
import type { SingleStoreColumnBuilderBase } from "./columns/index.js";
import { QueryBuilder } from "./query-builders/query-builder.js";
import type { SelectedFields } from "./query-builders/select.types.js";
import { SingleStoreViewBase } from "./view-base.js";
import { SingleStoreViewConfig } from "./view-common.js";
export interface ViewBuilderConfig {
algorithm?: 'undefined' | 'merge' | 'temptable';
definer?: string;
sqlSecurity?: 'definer' | 'invoker';
withCheckOption?: 'cascaded' | 'local';
}
export declare class ViewBuilderCore<TConfig extends {
name: string;
columns?: unknown;
}> {
protected name: TConfig['name'];
protected schema: string | undefined;
static readonly [entityKind]: string;
readonly _: {
readonly name: TConfig['name'];
readonly columns: TConfig['columns'];
};
constructor(name: TConfig['name'], schema: string | undefined);
protected config: ViewBuilderConfig;
algorithm(algorithm: Exclude<ViewBuilderConfig['algorithm'], undefined>): this;
definer(definer: Exclude<ViewBuilderConfig['definer'], undefined>): this;
sqlSecurity(sqlSecurity: Exclude<ViewBuilderConfig['sqlSecurity'], undefined>): this;
withCheckOption(withCheckOption?: Exclude<ViewBuilderConfig['withCheckOption'], undefined>): this;
}
export declare class ViewBuilder<TName extends string = string> extends ViewBuilderCore<{
name: TName;
}> {
static readonly [entityKind]: string;
as<TSelectedFields extends SelectedFields>(qb: TypedQueryBuilder<TSelectedFields> | ((qb: QueryBuilder) => TypedQueryBuilder<TSelectedFields>)): SingleStoreViewWithSelection<TName, false, AddAliasToSelection<TSelectedFields, TName, 'singlestore'>>;
}
export declare class ManualViewBuilder<TName extends string = string, TColumns extends Record<string, SingleStoreColumnBuilderBase> = Record<string, SingleStoreColumnBuilderBase>> extends ViewBuilderCore<{
name: TName;
columns: TColumns;
}> {
static readonly [entityKind]: string;
private columns;
constructor(name: TName, columns: TColumns, schema: string | undefined);
existing(): SingleStoreViewWithSelection<TName, true, BuildColumns<TName, TColumns, 'singlestore'>>;
as(query: SQL): SingleStoreViewWithSelection<TName, false, BuildColumns<TName, TColumns, 'singlestore'>>;
}
export declare class SingleStoreView<TName extends string = string, TExisting extends boolean = boolean, TSelectedFields extends ColumnsSelection = ColumnsSelection> extends SingleStoreViewBase<TName, TExisting, TSelectedFields> {
static readonly [entityKind]: string;
protected $SingleStoreViewBrand: 'SingleStoreView';
[SingleStoreViewConfig]: ViewBuilderConfig | undefined;
constructor({ singlestoreConfig, config }: {
singlestoreConfig: ViewBuilderConfig | undefined;
config: {
name: TName;
schema: string | undefined;
selectedFields: SelectedFields;
query: SQL | undefined;
};
});
}
export type SingleStoreViewWithSelection<TName extends string, TExisting extends boolean, TSelectedFields extends ColumnsSelection> = SingleStoreView<TName, TExisting, TSelectedFields> & TSelectedFields;

View File

@@ -0,0 +1,167 @@
# Directus JavaScript SDK
## Features
- **TypeScript first:** The SDK provides a robust and type-safe development experience.
- **Modular architecture:** The SDK is split into separate modules, giving you granular control over which features to
include and which can be pruned at build-time.
- **Lightweight and dependency-free:** It does not require external libraries, ensuring a lighter bundle and streamlined
experience.
## Composable Client
The client is split up in separate features you can mix and match to compose a client with only the features you need or
want.
```ts
const client = createDirectus<Schema>('https://api.directus.io');
```
This client is currently an empty wrapper without any functionality. Before you can do anything with it you'll need to
add some features. The following composables are available/in progress:
- `rest()` REST request functions
- adds `.request(...)` on the client
- `graphql()` GraphQL request functions
- adds `.query(...)` on the client
- `staticToken()` authentication functions
- adds `.getToken()` and `.setToken()` on the client
- `authenticate()` authentication functions
- adds `.login({ email, password })`, `.logout()`, `.refresh()` on the client
- adds `.getToken()` and `.setToken()` on the client
- `realtime()` websocket connectivity
- adds `.subscribe(...)`, `.sendMessage(...)`, `.onWebsocket('message', (message) => {})` on the client
For this example we'll build a client including `rest` and `graphql`:
```ts
const client = createDirectus<Schema>('https://api.directus.io').with(rest()).with(graphql());
// do a REST request
const restResult = await client.request(readItems('articles'));
// do a GraphQL request
const gqlResult = await client.query<OutputType>(`
query {
articles {
id
title
author {
first_name
}
}
}
`);
```
## Authentication
```ts
const client = createDirectus<Schema>('https://api.directus.io').with(rest()).with(authentication('json'));
await client.login('admin@example.com', 'd1r3ctu5');
// do authenticated requests
```
```ts
const client = createDirectus<Schema>('https://api.directus.io').with(rest()).with(staticToken('super-secure-token'));
// do authenticated requests
```
## Real-Time
The `realtime()` extension allows you to work with a Directus REST WebSocket.
Subscribing to updates:
```ts
const client = createDirectus<Schema>('https://api.directus.io').with(
realtime({
authMode: 'public',
}),
);
const { subscription, unsubscribe } = await client.subscribe('test', {
query: { fields: ['*'] },
});
for await (const item of subscription) {
console.log('subscription', { item });
}
// unsubscribe()
```
Receive/Send messages:
```ts
const client = createDirectus<Schema>('https://api.directus.io').with(
realtime({
authMode: 'public',
}),
);
const stop = client.onWebSocket('message', (message) => {
if ('type' in message && message['type'] === 'pong') {
console.log('PONG received');
stop();
}
});
client.sendMessage({ type: 'ping' });
```
## Build Your Schema
```ts
// The main schema type containing all collections available
interface MySchema {
collection_a: CollectionA[]; // regular collections are array types
collection_b: CollectionB[];
collection_c: CollectionC; // this is a singleton
// junction collections are collections too
collection_a_b_m2m: CollectionAB_Many[];
collection_a_b_m2a: CollectionAB_Any[];
}
// collection A
interface CollectionA {
id: number;
status: string;
// relations
m2o: number | CollectionB;
o2m: number[] | CollectionB[];
m2m: number[] | CollectionAB_Many[];
m2a: number[] | CollectionAB_Any[];
}
// Many-to-Many junction table
interface CollectionAB_Many {
id: number;
collection_a_id: CollectionA;
collection_b_id: CollectionB;
}
// Many-to-Any junction table
interface CollectionAB_Any {
id: number;
collection_a_id: CollectionA;
collection: 'collection_b' | 'collection_c';
item: string | CollectionB | CollectionC;
}
// collection B
interface CollectionB {
id: number;
value: string;
}
// singleton collection
interface CollectionC {
id: number;
app_settings: string;
something: string;
}
```

View File

@@ -0,0 +1,12 @@
/**
* Converts seconds to milliseconds
*
* @param seconds - Time in seconds.
* @return milliseconds - Converted time in milliseconds.
*/
/*#__NO_SIDE_EFFECTS__*/
const secondsToMilliseconds = (seconds) => seconds * 1000;
/*#__NO_SIDE_EFFECTS__*/
const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
export { millisecondsToSeconds, secondsToMilliseconds };

View File

@@ -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 Clock12 = createLucideIcon("Clock12", [
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
["polyline", { points: "12 6 12 12", key: "1fub01" }]
]);
export { Clock12 as default };
//# sourceMappingURL=clock-12.js.map

View File

@@ -0,0 +1 @@
module.exports={C:{"30":0.00964,"40":0.01928,"44":0.01928,"56":0.15427,"57":0.02411,"60":0.00482,"61":0.01446,"63":0.00482,"66":0.04821,"67":0.01446,"72":0.01446,"75":0.00482,"78":0.01928,"96":0.00964,"98":0.00482,"112":0.00482,"114":0.00964,"115":0.56888,"121":0.01446,"123":0.00482,"126":0.03857,"127":0.02893,"128":0.02411,"129":0.00482,"130":0.01446,"134":0.17838,"136":0.07232,"138":0.01928,"139":0.00964,"140":0.16874,"141":0.00964,"142":0.02893,"143":0.08196,"144":0.26033,"145":2.69976,"146":1.75484,"147":0.05785,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 31 32 33 34 35 36 37 38 39 41 42 43 45 46 47 48 49 50 51 52 53 54 55 58 59 62 64 65 68 69 70 71 73 74 76 77 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 97 99 100 101 102 103 104 105 106 107 108 109 110 111 113 116 117 118 119 120 122 124 125 131 132 133 135 137 148 149 3.5 3.6"},D:{"43":0.01446,"55":0.01446,"58":0.00964,"59":0.01446,"64":0.02411,"67":0.00964,"69":0.00482,"70":0.00964,"71":0.00482,"74":0.01446,"76":0.02411,"78":0.02411,"79":0.01928,"80":0.00964,"84":0.08196,"85":0.00482,"86":0.00482,"87":0.01446,"92":0.01928,"95":0.00964,"96":0.00482,"103":0.03857,"105":0.00482,"106":0.00964,"107":0.01446,"109":0.56888,"111":0.00482,"112":0.00964,"113":0.00964,"114":0.03375,"115":0.00964,"116":0.23141,"119":0.03857,"120":0.05303,"121":0.00482,"122":0.03375,"123":0.01928,"124":0.03857,"125":0.15427,"126":0.02411,"127":0.06749,"128":0.08196,"129":0.01446,"130":0.20248,"131":0.13017,"132":0.03375,"133":0.02411,"134":0.05785,"135":0.06749,"136":0.08678,"137":0.13499,"138":0.43871,"139":0.25551,"140":0.40496,"141":0.67976,"142":11.31007,"143":7.74253,"144":0.03375,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 44 45 46 47 48 49 50 51 52 53 54 56 57 60 61 62 63 65 66 68 72 73 75 77 81 83 88 89 90 91 93 94 97 98 99 100 101 102 104 108 110 117 118 145 146"},F:{"36":0.00964,"91":0.05785,"92":0.00482,"93":0.08196,"95":0.02411,"118":0.04821,"122":0.00482,"123":0.03375,"124":0.58334,"125":0.07232,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 119 120 121 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"12":0.02411,"13":0.00482,"14":0.00482,"15":0.00964,"16":0.01446,"17":0.00482,"18":0.02411,"84":0.00964,"89":0.01446,"90":0.00482,"92":0.06267,"100":0.01446,"109":0.00964,"113":0.01446,"117":0.08678,"118":0.00964,"120":0.00482,"122":0.03375,"124":0.00482,"127":0.00482,"128":0.00964,"129":0.00964,"131":0.03375,"132":0.00964,"133":0.00482,"135":0.02893,"136":0.1157,"137":0.05785,"138":0.09642,"139":0.04339,"140":0.08678,"141":0.20248,"142":3.87608,"143":4.98974,_:"79 80 81 83 85 86 87 88 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 110 111 112 114 115 116 119 121 123 125 126 130 134"},E:{_:"0 4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 12.1 15.4 15.5 16.0 16.2 17.4 26.3","10.1":0.02411,"11.1":0.02893,"13.1":0.02893,"14.1":0.02411,"15.1":0.00482,"15.2-15.3":0.00482,"15.6":0.03857,"16.1":0.00482,"16.3":0.00482,"16.4":0.03857,"16.5":0.01446,"16.6":0.05303,"17.0":0.00482,"17.1":0.00964,"17.2":0.04339,"17.3":0.00482,"17.5":0.01928,"17.6":0.02411,"18.0":0.00482,"18.1":0.01446,"18.2":0.01928,"18.3":0.03857,"18.4":0.02411,"18.5-18.6":0.10124,"26.0":0.06749,"26.1":0.16391,"26.2":0.08678},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00151,"5.0-5.1":0,"6.0-6.1":0.00302,"7.0-7.1":0.00227,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.00605,"10.0-10.2":0.00076,"10.3":0.01059,"11.0-11.2":0.13006,"11.3-11.4":0.00378,"12.0-12.1":0.00302,"12.2-12.5":0.03403,"13.0-13.1":0.00076,"13.2":0.00529,"13.3":0.00151,"13.4-13.7":0.00529,"14.0-14.4":0.01059,"14.5-14.8":0.01134,"15.0-15.1":0.0121,"15.2-15.3":0.00907,"15.4":0.00983,"15.5":0.01059,"15.6-15.8":0.16408,"16.0":0.0189,"16.1":0.03629,"16.2":0.0189,"16.3":0.03403,"16.4":0.00832,"16.5":0.01437,"16.6-16.7":0.21323,"17.0":0.0121,"17.1":0.01966,"17.2":0.01437,"17.3":0.02193,"17.4":0.03705,"17.5":0.07259,"17.6-17.7":0.16786,"18.0":0.03781,"18.1":0.07864,"18.2":0.04159,"18.3":0.13535,"18.4":0.06956,"18.5-18.7":4.99502,"26.0":0.09754,"26.1":0.81133,"26.2":0.15425,"26.3":0.00681},P:{"4":0.02033,"21":0.02033,"22":0.03049,"23":0.04066,"24":0.04066,"25":0.09148,"26":0.09148,"27":0.16264,"28":0.23379,"29":0.5184,_:"20 5.0-5.4 6.2-6.4 8.2 9.2 10.1 12.0 15.0 16.0 18.0","7.2-7.4":0.03049,"11.1-11.2":0.01016,"13.0":0.01016,"14.0":0.03049,"17.0":0.02033,"19.0":0.01016},I:{"0":0.00517,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0},A:{"11":0.02411,_:"6 7 8 9 10 5.5"},K:{"0":0.3936,_:"10 11 12 11.1 11.5 12.1"},N:{_:"10 11"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},Q:{"14.9":0.17609},O:{"0":0.30038},H:{"0":0},L:{"0":47.72219},R:{_:"0"},M:{"0":0.04143}};

View File

@@ -0,0 +1,91 @@
'use strict';
const path = require('path');
const resolveCommand = require('./util/resolveCommand');
const escape = require('./util/escape');
const readShebang = require('./util/readShebang');
const isWin = process.platform === 'win32';
const isExecutableRegExp = /\.(?:com|exe)$/i;
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
function detectShebang(parsed) {
parsed.file = resolveCommand(parsed);
const shebang = parsed.file && readShebang(parsed.file);
if (shebang) {
parsed.args.unshift(parsed.file);
parsed.command = shebang;
return resolveCommand(parsed);
}
return parsed.file;
}
function parseNonShell(parsed) {
if (!isWin) {
return parsed;
}
// Detect & add support for shebangs
const commandFile = detectShebang(parsed);
// We don't need a shell if the command filename is an executable
const needsShell = !isExecutableRegExp.test(commandFile);
// If a shell is required, use cmd.exe and take care of escaping everything correctly
// Note that `forceShell` is an hidden option used only in tests
if (parsed.options.forceShell || needsShell) {
// Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`
// The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument
// Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,
// we need to double escape them
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
// Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar)
// This is necessary otherwise it will always fail with ENOENT in those cases
parsed.command = path.normalize(parsed.command);
// Escape command & arguments
parsed.command = escape.command(parsed.command);
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
const shellCommand = [parsed.command].concat(parsed.args).join(' ');
parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`];
parsed.command = process.env.comspec || 'cmd.exe';
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
}
return parsed;
}
function parse(command, args, options) {
// Normalize arguments, similar to nodejs
if (args && !Array.isArray(args)) {
options = args;
args = null;
}
args = args ? args.slice(0) : []; // Clone array to avoid changing the original
options = Object.assign({}, options); // Clone object to avoid changing the original
// Build our parsed object
const parsed = {
command,
args,
options,
file: undefined,
original: {
command,
args,
},
};
// Delegate further parsing to shell or non-shell
return options.shell ? parsed : parseNonShell(parsed);
}
module.exports = parse;

View File

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

View File

@@ -0,0 +1,473 @@
/**
* 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 Klass, type LexicalNode, type LexicalNodeConfig, type LexicalUpdateJSON, NODE_STATE_KEY, type SerializedLexicalNode, type Spread, type StaticNodeConfigRecord } from '.';
import { PROTOTYPE_CONFIG_METHOD } from './LexicalConstants';
/**
* Get the value type (V) from a StateConfig
*/
export type StateConfigValue<S extends AnyStateConfig> = S extends StateConfig<infer _K, infer V> ? V : never;
/**
* Get the key type (K) from a StateConfig
*/
export type StateConfigKey<S extends AnyStateConfig> = S extends StateConfig<infer K, infer _V> ? K : never;
/**
* A value type, or an updater for that value type. For use with
* {@link $setState} or any user-defined wrappers around it.
*/
export type ValueOrUpdater<V> = V | ((prevValue: V) => V);
/**
* A type alias to make it easier to define setter methods on your node class
*
* @example
* ```ts
* const fooState = createState("foo", { parse: ... });
* class MyClass extends TextNode {
* // ...
* setFoo(valueOrUpdater: StateValueOrUpdater<typeof fooState>): this {
* return $setState(this, fooState, valueOrUpdater);
* }
* }
* ```
*/
export type StateValueOrUpdater<Cfg extends AnyStateConfig> = ValueOrUpdater<StateConfigValue<Cfg>>;
export interface NodeStateConfig<S extends AnyStateConfig> {
stateConfig: S;
flat?: boolean;
}
export type RequiredNodeStateConfig = NodeStateConfig<AnyStateConfig> | AnyStateConfig;
export type StateConfigJSON<S> = S extends StateConfig<infer K, infer V> ? {
[Key in K]?: V;
} : Record<never, never>;
export type RequiredNodeStateConfigJSON<Config extends RequiredNodeStateConfig, Flat extends boolean> = StateConfigJSON<Config extends NodeStateConfig<infer S> ? Spread<Config, {
flat: false;
}> extends {
flat: Flat;
} ? S : never : false extends Flat ? Config : never>;
export type Prettify<T> = {
[K in keyof T]: T[K];
} & {};
export type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
export type CollectStateJSON<Tuple extends readonly RequiredNodeStateConfig[], Flat extends boolean> = UnionToIntersection<{
[K in keyof Tuple]: RequiredNodeStateConfigJSON<Tuple[K], Flat>;
}[number]>;
type GetStaticNodeConfig<T extends LexicalNode> = ReturnType<T[typeof PROTOTYPE_CONFIG_METHOD]> extends infer Record ? Record extends StaticNodeConfigRecord<infer Type, infer Config> ? Config & {
readonly type: Type;
} : never : never;
type GetStaticNodeConfigs<T extends LexicalNode> = GetStaticNodeConfig<T> extends infer OwnConfig ? OwnConfig extends never ? [] : OwnConfig extends {
extends: Klass<infer Parent>;
} ? GetStaticNodeConfig<Parent> extends infer ParentNodeConfig ? ParentNodeConfig extends never ? [OwnConfig] : [OwnConfig, ...GetStaticNodeConfigs<Parent>] : OwnConfig : [OwnConfig] : [];
type CollectStateConfigs<Configs> = Configs extends [
infer OwnConfig,
...infer ParentConfigs
] ? OwnConfig extends {
stateConfigs: infer StateConfigs;
} ? StateConfigs extends readonly RequiredNodeStateConfig[] ? [...StateConfigs, ...CollectStateConfigs<ParentConfigs>] : CollectStateConfigs<ParentConfigs> : CollectStateConfigs<ParentConfigs> : [];
export type GetNodeStateConfig<T extends LexicalNode> = CollectStateConfigs<GetStaticNodeConfigs<T>>;
/**
* The NodeState JSON produced by this LexicalNode
*/
export type NodeStateJSON<T extends LexicalNode> = Prettify<{
[NODE_STATE_KEY]?: Prettify<CollectStateJSON<GetNodeStateConfig<T>, false>>;
} & CollectStateJSON<GetNodeStateConfig<T>, true>>;
/**
* Configure a value to be used with StateConfig.
*
* The value type should be inferred from the definition of parse.
*
* If the value type is not JSON serializable, then unparse must also be provided.
*
* Values should be treated as immutable, much like React.useState. Mutating
* stored values directly will cause unpredictable behavior, is not supported,
* and may trigger errors in the future.
*
* @example
* ```ts
* const numberOrNullState = createState('numberOrNull', {parse: (v) => typeof v === 'number' ? v : null});
* // ^? State<'numberOrNull', StateValueConfig<number | null>>
* const numberState = createState('number', {parse: (v) => typeof v === 'number' ? v : 0});
* // ^? State<'number', StateValueConfig<number>>
* ```
*
* Only the parse option is required, it is generally not useful to
* override `unparse` or `isEqual`. However, if you are using
* non-primitive types such as Array, Object, Date, or something
* more exotic then you would want to override this. In these
* cases you might want to reach for third party libraries.
*
* @example
* ```ts
* const isoDateState = createState('isoDate', {
* parse: (v): null | Date => {
* const date = typeof v === 'string' ? new Date(v) : null;
* return date && !isNaN(date.valueOf()) ? date : null;
* }
* isEqual: (a, b) => a === b || (a && b && a.valueOf() === b.valueOf()),
* unparse: (v) => v && v.toString()
* });
* ```
*
* You may find it easier to write a parse function using libraries like
* zod, valibot, ajv, Effect, TypeBox, etc. perhaps with a wrapper function.
*/
export interface StateValueConfig<V> {
/**
* This function must return a default value when called with undefined,
* otherwise it should parse the given JSON value to your type V. Note
* that it is not required to copy or clone the given value, you can
* pass it directly through if it matches the expected type.
*
* When you encounter an invalid value, it's up to you to decide
* as to whether to ignore it and return the default value,
* return some non-default error value, or throw an error.
*
* It is possible for V to include undefined, but if it does, then
* it should also be considered the default value since undefined
* can not be serialized to JSON so it is indistinguishable from the
* default.
*
* Similarly, if your V is a function, then usage of {@link $setState}
* must use an updater function because your type will be indistinguishable
* from an updater function.
*/
parse: (jsonValue: unknown) => V;
/**
* This is optional and for advanced use cases only.
*
* You may specify a function that converts V back to JSON.
* This is mandatory when V is not a JSON serializable type.
*/
unparse?: (parsed: V) => unknown;
/**
* This is optional and for advanced use cases only.
*
* Used to define the equality function so you can use an Array or Object
* as V and still omit default values from the exported JSON.
*
* The default is `Object.is`, but something like `fast-deep-equal` might be
* more appropriate for your use case.
*/
isEqual?: (a: V, b: V) => boolean;
}
/**
* The return value of {@link createState}, for use with
* {@link $getState} and {@link $setState}.
*/
export declare class StateConfig<K extends string, V> {
/** The string key used when serializing this state to JSON */
readonly key: K;
/** The parse function from the StateValueConfig passed to createState */
readonly parse: (value?: unknown) => V;
/**
* The unparse function from the StateValueConfig passed to createState,
* with a default that is simply a pass-through that assumes the value is
* JSON serializable.
*/
readonly unparse: (value: V) => unknown;
/**
* An equality function from the StateValueConfig, with a default of
* Object.is.
*/
readonly isEqual: (a: V, b: V) => boolean;
/**
* The result of `stateValueConfig.parse(undefined)`, which is computed only
* once and used as the default value. When the current value `isEqual` to
* the `defaultValue`, it will not be serialized to JSON.
*/
readonly defaultValue: V;
constructor(key: K, stateValueConfig: StateValueConfig<V>);
}
/**
* For advanced use cases, using this type is not recommended unless
* it is required (due to TypeScript's lack of features like
* higher-kinded types).
*
* A {@link StateConfig} type with any key and any value that can be
* used in situations where the key and value type can not be known,
* such as in a generic constraint when working with a collection of
* StateConfig.
*
* {@link StateConfigKey} and {@link StateConfigValue} will be
* useful when this is used as a generic constraint.
*/
export type AnyStateConfig = StateConfig<any, any>;
/**
* Create a StateConfig for the given string key and StateValueConfig.
*
* The key must be locally unique. In dev you will get a key collision error
* when you use two separate StateConfig on the same node with the same key.
*
* The returned StateConfig value should be used with {@link $getState} and
* {@link $setState}.
*
* @param key The key to use
* @param valueConfig Configuration for the value type
* @returns a StateConfig
*/
export declare function createState<K extends string, V>(key: K, valueConfig: StateValueConfig<V>): StateConfig<K, V>;
/**
* The accessor for working with node state. This will read the value for the
* state on the given node, and will return `stateConfig.defaultValue` if the
* state has never been set on this node.
*
* The `version` parameter is optional and should generally be `'latest'`,
* consistent with the behavior of other node methods and functions,
* but for certain use cases such as `updateDOM` you may have a need to
* use `'direct'` to read the state from a previous version of the node.
*
* For very advanced use cases, you can expect that 'direct' does not
* require an editor state, just like directly accessing other properties
* of a node without an accessor (e.g. `textNode.__text`).
*
* @param node Any LexicalNode
* @param stateConfig The configuration of the state to read
* @param version The default value 'latest' will read the latest version of the node state, 'direct' will read the version that is stored on this LexicalNode which not reflect the version used in the current editor state
* @returns The current value from the state, or the default value provided by the configuration.
*/
export declare function $getState<K extends string, V>(node: LexicalNode, stateConfig: StateConfig<K, V>, version?: 'latest' | 'direct'): V;
/**
* Given two versions of a node and a stateConfig, compare their state values
* using `$getState(nodeVersion, stateConfig, 'direct')`.
* If the values are equal according to `stateConfig.isEqual`, return `null`,
* otherwise return `[value, prevValue]`.
*
* This is useful for implementing updateDOM. Note that the `'direct'`
* version argument is used for both nodes.
*
* @param node Any LexicalNode
* @param prevNode A previous version of node
* @param stateConfig The configuration of the state to read
* @returns `[value, prevValue]` if changed, otherwise `null`
*/
export declare function $getStateChange<T extends LexicalNode, K extends string, V>(node: T, prevNode: T, stateConfig: StateConfig<K, V>): null | [value: V, prevValue: V];
/**
* Set the state defined by stateConfig on node. Like with `React.useState`
* you may directly specify the value or use an updater function that will
* be called with the previous value of the state on that node (which will
* be the `stateConfig.defaultValue` if not set).
*
* When an updater function is used, the node will only be marked dirty if
* `stateConfig.isEqual(prevValue, value)` is false.
*
* @example
* ```ts
* const toggle = createState('toggle', {parse: Boolean});
* // set it direction
* $setState(node, counterState, true);
* // use an updater
* $setState(node, counterState, (prev) => !prev);
* ```
*
* @param node The LexicalNode to set the state on
* @param stateConfig The configuration for this state
* @param valueOrUpdater The value or updater function
* @returns node
*/
export declare function $setState<Node extends LexicalNode, K extends string, V>(node: Node, stateConfig: StateConfig<K, V>, valueOrUpdater: ValueOrUpdater<V>): Node;
/**
* @internal
*
* Opaque state to be stored on the editor's RegisterNode for use by NodeState
*/
export type SharedNodeState = {
sharedConfigMap: SharedConfigMap;
flatKeys: Set<string>;
};
/**
* @internal
*
* Create the state to store on RegisteredNode
*/
export declare function createSharedNodeState(nodeConfig: LexicalNodeConfig): SharedNodeState;
type KnownStateMap = Map<AnyStateConfig, unknown>;
type UnknownStateRecord = Record<string, unknown>;
/**
* @internal
*
* A Map of string keys to state configurations to be shared across nodes
* and/or node versions.
*/
type SharedConfigMap = Map<string, AnyStateConfig>;
/**
* @internal
*/
export declare class NodeState<T extends LexicalNode> {
/**
* @internal
*
* Track the (versioned) node that this NodeState was created for, to
* facilitate copy-on-write for NodeState. When a LexicalNode is cloned,
* it will *reference* the NodeState from its prevNode. From the nextNode
* you can continue to read state without copying, but the first $setState
* will trigger a copy of the prevNode's NodeState with the node property
* updated.
*/
readonly node: LexicalNode;
/**
* @internal
*
* State that has already been parsed in a get state, so it is safe. (can be returned with
* just a cast since the proof was given before).
*
* Note that it uses StateConfig, so in addition to (1) the CURRENT VALUE, it has access to
* (2) the State key (3) the DEFAULT VALUE and (4) the PARSE FUNCTION
*/
readonly knownState: KnownStateMap;
/**
* @internal
*
* A copy of serializedNode[NODE_STATE_KEY] that is made when JSON is
* imported but has not been parsed yet.
*
* It stays here until a get state requires us to parse it, and since we
* then know the value is safe we move it to knownState.
*
* Note that since only string keys are used here, we can only allow this
* state to pass-through on export or on the next version since there is
* no known value configuration. This pass-through is to support scenarios
* where multiple versions of the editor code are working in parallel so
* an old version of your code doesnt erase metadata that was
* set by a newer version of your code.
*/
unknownState: undefined | UnknownStateRecord;
/**
* @internal
*
* This sharedNodeState is preserved across all instances of a given
* node type in an editor and remains writable. It is how keys are resolved
* to configuration.
*/
readonly sharedNodeState: SharedNodeState;
/**
* @internal
*
* The count of known or unknown keys in this state, ignoring the
* intersection between the two sets.
*/
size: number;
/**
* @internal
*/
constructor(node: T, sharedNodeState: SharedNodeState, unknownState?: undefined | UnknownStateRecord, knownState?: KnownStateMap, size?: number | undefined);
/**
* @internal
*
* Get the value from knownState, or parse it from unknownState
* if it contains the given key.
*
* Updates the sharedConfigMap when no known state is found.
* Updates unknownState and knownState when an unknownState is parsed.
*/
getValue<K extends string, V>(stateConfig: StateConfig<K, V>): V;
/**
* @internal
*
* Used only for advanced use cases, such as collab. The intent here is to
* allow you to diff states with a more stable interface than the properties
* of this class.
*/
getInternalState(): [
{
readonly [k in string]: unknown;
} | undefined,
ReadonlyMap<AnyStateConfig, unknown>
];
/**
* Encode this NodeState to JSON in the format that its node expects.
* This returns `{[NODE_STATE_KEY]?: UnknownStateRecord}` rather than
* `UnknownStateRecord | undefined` so that we can support flattening
* specific entries in the future when nodes can declare what
* their required StateConfigs are.
*/
toJSON(): NodeStateJSON<T>;
/**
* @internal
*
* A NodeState is writable when the node to update matches
* the node associated with the NodeState. This basically
* mirrors how the EditorState NodeMap works, but in a
* bottom-up organization rather than a top-down organization.
*
* This allows us to implement the same "copy on write"
* pattern for state, without having the state version
* update every time the node version changes (e.g. when
* its parent or siblings change).
*
* @param node The node to associate with the state
* @returns The next writable state
*/
getWritable(node: T): NodeState<T>;
/** @internal */
updateFromKnown<K extends string, V>(stateConfig: StateConfig<K, V>, value: V): void;
/**
* @internal
*
* This is intended for advanced use cases only, such
* as collab or dev tools.
*
* Update a single key value pair from unknown state,
* parsing it if the key is known to this node. This is
* basically like updateFromJSON, but the effect is
* isolated to a single entry.
*
* @param k The string key from an UnknownStateRecord
* @param v The unknown value from an UnknownStateRecord
*/
updateFromUnknown(k: string, v: unknown): void;
/**
* @internal
*
* Reset all existing state to default or empty values,
* and perform any updates from the given unknownState.
*
* This is used when initializing a node's state from JSON,
* or when resetting a node's state from JSON.
*
* @param unknownState The new state in serialized form
*/
updateFromJSON(unknownState: undefined | UnknownStateRecord): void;
}
/**
* @internal
*
* Only for direct use in very advanced integrations, such as lexical-yjs.
* Typically you would only use {@link createState}, {@link $getState}, and
* {@link $setState}. This is effectively the preamble for {@link $setState}.
*/
export declare function $getWritableNodeState<T extends LexicalNode>(node: T): NodeState<T>;
/**
* @internal
*
* Get the SharedNodeState for a node on this editor
*/
export declare function $getSharedNodeState<T extends LexicalNode>(node: T): SharedNodeState;
/**
* @internal
*
* This is used to implement LexicalNode.updateFromJSON and is
* not intended to be exported from the package.
*
* @param node any LexicalNode
* @param unknownState undefined or a serialized State
* @returns A writable version of node, with the state set.
*/
export declare function $updateStateFromJSON<T extends LexicalNode>(node: T, serialized: LexicalUpdateJSON<SerializedLexicalNode>): T;
/**
* @internal
*
* Return true if the two nodes have equivalent NodeState, to be used
* to determine when TextNode are being merged, not a lot of use cases
* otherwise.
*/
export declare function nodeStatesAreEquivalent<T extends LexicalNode>(a: undefined | NodeState<T>, b: undefined | NodeState<T>): boolean;
/**
* @internal
*
* Clones the NodeState for a given node. Handles aliasing if the state references the from node.
*/
export declare function $cloneNodeState<T extends LexicalNode>(from: T, to: T): undefined | NodeState<T>;
export {};

View File

@@ -0,0 +1,19 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** only globals that common to node and browsers are allowed */
// eslint-disable-next-line node/no-unsupported-features/es-builtins
export var _globalThis = typeof globalThis === 'object' ? globalThis : global;
//# sourceMappingURL=globalThis.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/afterChange/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIzE,KAAK,IAAI,CAAC,CAAC,SAAS,UAAU,IAAI;IAChC,UAAU,EAAE,IAAI,GAAG,yBAAyB,CAAA;IAC5C,OAAO,EAAE,cAAc,CAAA;IACvB;;OAEG;IACH,IAAI,EAAE,CAAC,CAAA;IACP;;OAEG;IACH,GAAG,EAAE,CAAC,CAAA;IACN,MAAM,EAAE,IAAI,GAAG,qBAAqB,CAAA;IACpC,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC9B,WAAW,EAAE,CAAC,CAAA;IACd,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,SAAS,UAAU,yFASnD,IAAI,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,CAAC,CAqBrB,CAAA"}

View File

@@ -0,0 +1,19 @@
import type React from 'react';
type Result = [
{
data: any;
isError: boolean;
isLoading: boolean;
},
{
setParams: React.Dispatch<unknown>;
}
];
type Options = {
initialData?: any;
initialParams?: unknown;
};
type UsePayloadAPI = (url: string, options?: Options) => Result;
export declare const usePayloadAPI: UsePayloadAPI;
export {};
//# sourceMappingURL=usePayloadAPI.d.ts.map

View File

@@ -0,0 +1,32 @@
"use client";
import { jsx } from 'react/jsx-runtime';
import { useContext, useRef, useMemo } from 'react';
import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
import { DeprecatedLayoutGroupContext } from '../../context/DeprecatedLayoutGroupContext.mjs';
import { useForceUpdate } from '../../utils/use-force-update.mjs';
import { nodeGroup } from '../../projection/node/group.mjs';
const shouldInheritGroup = (inherit) => inherit === true;
const shouldInheritId = (inherit) => shouldInheritGroup(inherit === true) || inherit === "id";
const LayoutGroup = ({ children, id, inherit = true }) => {
const layoutGroupContext = useContext(LayoutGroupContext);
const deprecatedLayoutGroupContext = useContext(DeprecatedLayoutGroupContext);
const [forceRender, key] = useForceUpdate();
const context = useRef(null);
const upstreamId = layoutGroupContext.id || deprecatedLayoutGroupContext;
if (context.current === null) {
if (shouldInheritId(inherit) && upstreamId) {
id = id ? upstreamId + "-" + id : upstreamId;
}
context.current = {
id,
group: shouldInheritGroup(inherit)
? layoutGroupContext.group || nodeGroup()
: nodeGroup(),
};
}
const memoizedContext = useMemo(() => ({ ...context.current, forceRender }), [key]);
return (jsx(LayoutGroupContext.Provider, { value: memoizedContext, children: children }));
};
export { LayoutGroup };

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","names":["React","ListViewIcon","_jsx","className","fill","height","viewBox","width","xmlns","d","stroke","strokeLinecap","strokeLinejoin"],"sources":["../../../src/icons/ListView/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nexport const ListViewIcon = () => {\n return (\n <svg\n className=\"icon icon--list-view\"\n fill=\"none\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n width=\"20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4 10H16M4 14H16M4 6H16\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n}\n"],"mappings":";AAAA,OAAOA,KAAA,MAAW;AAElB,OAAO;AAEP,OAAO,MAAMC,YAAA,GAAeA,CAAA;EAC1B,oBACEC,IAAA,CAAC;IACCC,SAAA,EAAU;IACVC,IAAA,EAAK;IACLC,MAAA,EAAO;IACPC,OAAA,EAAQ;IACRC,KAAA,EAAM;IACNC,KAAA,EAAM;cAEN,aAAAN,IAAA,CAAC;MACCO,CAAA,EAAE;MACFC,MAAA,EAAO;MACPC,aAAA,EAAc;MACdC,cAAA,EAAe;;;AAIvB","ignoreList":[]}

View File

@@ -0,0 +1 @@
{"version":3,"file":"stringifyTruncated.js","names":["stringifyTruncated","value","maxLength","stringifiedJSON","JSON","stringify","totalChars","length","substring"],"sources":["../../src/utilities/stringifyTruncated.ts"],"sourcesContent":["/**\n * Safely stringify a value and truncate it to a maximum length.\n *\n * Converts any value to a JSON string representation and truncates the resulting\n * string if it exceeds the maximum length. If truncation occurs, an ellipsis (…)\n * is appended to indicate incomplete output.\n *\n * @param value - The value to stringify (can be any type including objects, arrays, primitives)\n * @param maxLength - The maximum character length of the output string\n * @returns A JSON string representation, truncated with \"…\" if it exceeds maxLength\n */\nexport function stringifyTruncated(value: unknown, maxLength: number): string {\n const stringifiedJSON = JSON.stringify(value)\n const totalChars = stringifiedJSON.length\n\n // Only truncate if the string is significantly longer (>1.5x the max length)\n if (totalChars / maxLength > 1.5) {\n return `${stringifiedJSON.substring(0, maxLength)}\\u2026`\n }\n\n return stringifiedJSON\n}\n"],"mappings":"AAAA;;;;;;;;;;GAWA,OAAO,SAASA,mBAAmBC,KAAc,EAAEC,SAAiB;EAClE,MAAMC,eAAA,GAAkBC,IAAA,CAAKC,SAAS,CAACJ,KAAA;EACvC,MAAMK,UAAA,GAAaH,eAAA,CAAgBI,MAAM;EAEzC;EACA,IAAID,UAAA,GAAaJ,SAAA,GAAY,KAAK;IAChC,OAAO,GAAGC,eAAA,CAAgBK,SAAS,CAAC,GAAGN,SAAA,SAAkB;EAC3D;EAEA,OAAOC,eAAA;AACT","ignoreList":[]}

View File

@@ -0,0 +1,155 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { WebpackError } = require("..");
const { getUsedModuleIdsAndModules } = require("./IdHelpers");
/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Module")} Module */
/** @typedef {import("../Module").ModuleId} ModuleId */
/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */
/** @typedef {{ [key: string]: ModuleId }} JSONContent */
const plugin = "SyncModuleIdsPlugin";
/**
* @typedef {object} SyncModuleIdsPluginOptions
* @property {string} path path to file
* @property {string=} context context for module names
* @property {((module: Module) => boolean)=} test selector for modules
* @property {"read" | "create" | "merge" | "update"=} mode operation mode (defaults to merge)
*/
class SyncModuleIdsPlugin {
/**
* @param {SyncModuleIdsPluginOptions} options options
*/
constructor({ path, context, test, mode }) {
this._path = path;
this._context = context;
this._test = test || (() => true);
const readAndWrite = !mode || mode === "merge" || mode === "update";
this._read = readAndWrite || mode === "read";
this._write = readAndWrite || mode === "create";
this._prune = mode === "update";
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
/** @type {Map<string, ModuleId>} */
let data;
let dataChanged = false;
if (this._read) {
compiler.hooks.readRecords.tapAsync(plugin, (callback) => {
const fs =
/** @type {IntermediateFileSystem} */
(compiler.intermediateFileSystem);
fs.readFile(this._path, (err, buffer) => {
if (err) {
if (err.code !== "ENOENT") {
return callback(err);
}
return callback();
}
/** @type {JSONContent} */
const json = JSON.parse(/** @type {Buffer} */ (buffer).toString());
/** @type {Map<string, string | number | null>} */
data = new Map();
for (const key of Object.keys(json)) {
data.set(key, json[key]);
}
dataChanged = false;
return callback();
});
});
}
if (this._write) {
compiler.hooks.emitRecords.tapAsync(plugin, (callback) => {
if (!data || !dataChanged) return callback();
/** @type {JSONContent} */
const json = {};
const sorted = [...data].sort(([a], [b]) => (a < b ? -1 : 1));
for (const [key, value] of sorted) {
json[key] = value;
}
const fs =
/** @type {IntermediateFileSystem} */
(compiler.intermediateFileSystem);
fs.writeFile(this._path, JSON.stringify(json), callback);
});
}
compiler.hooks.thisCompilation.tap(plugin, (compilation) => {
const associatedObjectForCache = compiler.root;
const context = this._context || compiler.context;
if (this._read) {
compilation.hooks.reviveModules.tap(plugin, (_1, _2) => {
if (!data) return;
const { chunkGraph } = compilation;
const [usedIds, modules] = getUsedModuleIdsAndModules(
compilation,
this._test
);
for (const module of modules) {
const name = module.libIdent({
context,
associatedObjectForCache
});
if (!name) continue;
const id = data.get(name);
const idAsString = `${id}`;
if (usedIds.has(idAsString)) {
const err = new WebpackError(
`SyncModuleIdsPlugin: Unable to restore id '${id}' from '${this._path}' as it's already used.`
);
err.module = module;
compilation.errors.push(err);
}
chunkGraph.setModuleId(module, /** @type {ModuleId} */ (id));
usedIds.add(idAsString);
}
});
}
if (this._write) {
compilation.hooks.recordModules.tap(plugin, (modules) => {
const { chunkGraph } = compilation;
let oldData = data;
if (!oldData) {
oldData = data = new Map();
} else if (this._prune) {
data = new Map();
}
for (const module of modules) {
if (this._test(module)) {
const name = module.libIdent({
context,
associatedObjectForCache
});
if (!name) continue;
const id = chunkGraph.getModuleId(module);
if (id === null) continue;
const oldId = oldData.get(name);
if (oldId !== id) {
dataChanged = true;
} else if (data === oldData) {
continue;
}
data.set(name, id);
}
}
if (data.size !== oldData.size) dataChanged = true;
});
}
});
}
}
module.exports = SyncModuleIdsPlugin;

View File

@@ -0,0 +1,55 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.IFrameElementContainer = void 0;
var element_container_1 = require("../element-container");
var node_parser_1 = require("../node-parser");
var color_1 = require("../../css/types/color");
var IFrameElementContainer = /** @class */ (function (_super) {
__extends(IFrameElementContainer, _super);
function IFrameElementContainer(context, iframe) {
var _this = _super.call(this, context, iframe) || this;
_this.src = iframe.src;
_this.width = parseInt(iframe.width, 10) || 0;
_this.height = parseInt(iframe.height, 10) || 0;
_this.backgroundColor = _this.styles.backgroundColor;
try {
if (iframe.contentWindow &&
iframe.contentWindow.document &&
iframe.contentWindow.document.documentElement) {
_this.tree = node_parser_1.parseTree(context, iframe.contentWindow.document.documentElement);
// http://www.w3.org/TR/css3-background/#special-backgrounds
var documentBackgroundColor = iframe.contentWindow.document.documentElement
? color_1.parseColor(context, getComputedStyle(iframe.contentWindow.document.documentElement).backgroundColor)
: color_1.COLORS.TRANSPARENT;
var bodyBackgroundColor = iframe.contentWindow.document.body
? color_1.parseColor(context, getComputedStyle(iframe.contentWindow.document.body).backgroundColor)
: color_1.COLORS.TRANSPARENT;
_this.backgroundColor = color_1.isTransparent(documentBackgroundColor)
? color_1.isTransparent(bodyBackgroundColor)
? _this.styles.backgroundColor
: bodyBackgroundColor
: documentBackgroundColor;
}
}
catch (e) { }
return _this;
}
return IFrameElementContainer;
}(element_container_1.ElementContainer));
exports.IFrameElementContainer = IFrameElementContainer;
//# sourceMappingURL=iframe-element-container.js.map

View File

@@ -0,0 +1,37 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.serviceInstanceIdDetector = void 0;
const semconv_1 = require("../../../semconv");
const crypto_1 = require("crypto");
/**
* ServiceInstanceIdDetector detects the resources related to the service instance ID.
*/
class ServiceInstanceIdDetector {
detect(_config) {
return {
attributes: {
[semconv_1.ATTR_SERVICE_INSTANCE_ID]: (0, crypto_1.randomUUID)(),
},
};
}
}
/**
* @experimental
*/
exports.serviceInstanceIdDetector = new ServiceInstanceIdDetector();
//# sourceMappingURL=ServiceInstanceIdDetector.js.map

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _defineProperty;
var _toPropertyKey = require("./toPropertyKey.js");
function _defineProperty(obj, key, value) {
key = (0, _toPropertyKey.default)(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
//# sourceMappingURL=defineProperty.js.map

View File

@@ -0,0 +1,4 @@
export declare const previousFriday: import("./types.js").FPFn1<
Date,
import("../fp.js").DateArg<Date>
>;

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,YAAY,CAAC;AAWpB,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA4ED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,EAClC,OAAO,GAAE,oBAAyB,GACjC,MAAM,CAUR;AAED,eAAe,MAAM,CAAC"}

View File

@@ -0,0 +1,17 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { wrapTracer, SugaredTracer } from './trace/SugaredTracer';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,9 @@
/// <reference types="node" />
import { GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql';
type BufferJson = {
type: 'Buffer';
data: number[];
};
export declare const GraphQLByteConfig: GraphQLScalarTypeConfig<Buffer | string | BufferJson, Buffer>;
export declare const GraphQLByte: GraphQLScalarType<string | BufferJson | Buffer, Buffer>;
export {};

View File

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

View File

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

View File

@@ -0,0 +1,7 @@
{
"name": "dom-helpers/collectSiblings",
"private": true,
"main": "../cjs/collectSiblings.js",
"module": "../esm/collectSiblings.js",
"types": "../esm/collectSiblings.d.ts"
}

View File

@@ -0,0 +1,9 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{createEmptyHistoryState as o,registerHistory as r}from"@lexical/history";export{createEmptyHistoryState}from"@lexical/history";import{useMemo as e,useEffect as i}from"react";function a({delay:a,externalHistoryState:c}){const[l]=t();return function(t,a,c=1e3){const l=e((()=>a||o()),[a]);i((()=>r(t,l,c)),[c,t,l])}(l,c,a),null}export{a as HistoryPlugin};

View File

@@ -0,0 +1,19 @@
/**
* @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 Repeat1 = createLucideIcon("Repeat1", [
["path", { d: "m17 2 4 4-4 4", key: "nntrym" }],
["path", { d: "M3 11v-1a4 4 0 0 1 4-4h14", key: "84bu3i" }],
["path", { d: "m7 22-4-4 4-4", key: "1wqhfi" }],
["path", { d: "M21 13v1a4 4 0 0 1-4 4H3", key: "1rx37r" }],
["path", { d: "M11 10h1v4", key: "70cz1p" }]
]);
export { Repeat1 as default };
//# sourceMappingURL=repeat-1.js.map

View File

@@ -0,0 +1,27 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** No-op implementation of SpanProcessor */
export class NoopSpanProcessor {
onStart(_span, _context) { }
onEnd(_span) { }
shutdown() {
return Promise.resolve();
}
forceFlush() {
return Promise.resolve();
}
}
//# sourceMappingURL=NoopSpanProcessor.js.map

View File

@@ -0,0 +1,31 @@
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { GridViewIcon } from '../../../icons/GridView/index.js';
import { ListViewIcon } from '../../../icons/ListView/index.js';
import { Button } from '../../Button/index.js';
import './index.scss';
const baseClass = 'folder-view-toggle-button';
export function ToggleViewButtons({
activeView,
setActiveView
}) {
return /*#__PURE__*/_jsxs(_Fragment, {
children: [/*#__PURE__*/_jsx(Button, {
buttonStyle: "pill",
className: [baseClass, activeView === 'grid' && `${baseClass}--active`].filter(Boolean).join(' '),
icon: /*#__PURE__*/_jsx(GridViewIcon, {}),
margin: false,
onClick: () => {
setActiveView('grid');
}
}), /*#__PURE__*/_jsx(Button, {
buttonStyle: "pill",
className: [baseClass, activeView === 'list' && `${baseClass}--active`].filter(Boolean).join(' '),
icon: /*#__PURE__*/_jsx(ListViewIcon, {}),
margin: false,
onClick: () => {
setActiveView('list');
}
})]
});
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,19 @@
export interface NodeSchedule {
scheduleJob(nameOrExpression: string | Date | object, expressionOrCallback: string | Date | object | (() => void), callback?: () => void): unknown;
}
/**
* Instruments the `node-schedule` library to send a check-in event to Sentry for each job execution.
*
* ```ts
* import * as Sentry from '@sentry/node';
* import * as schedule from 'node-schedule';
*
* const scheduleWithCheckIn = Sentry.cron.instrumentNodeSchedule(schedule);
*
* const job = scheduleWithCheckIn.scheduleJob('my-cron-job', '* * * * *', () => {
* console.log('You will see this message every minute');
* });
* ```
*/
export declare function instrumentNodeSchedule<T>(lib: T & NodeSchedule): T;
//# sourceMappingURL=node-schedule.d.ts.map

View File

@@ -0,0 +1,295 @@
import type {Nodes, Parent, PhrasingContent, Root} from 'mdast'
import type {ParseOptions, TokenizeContext, Token} from 'micromark-util-types'
/**
* Compiler context.
*/
export interface CompileContext {
/**
* Configuration.
*/
config: Config
/**
* Info passed around;
* key/value store.
*/
data: CompileData
/**
* Stack of nodes.
*/
stack: Array<Fragment | Nodes>
/**
* Stack of tokens.
*/
tokenStack: Array<TokenTuple>
/**
* Capture some of the output data.
*
* @param this
* Context.
* @returns
* Nothing.
*/
buffer(this: CompileContext): undefined
/**
* Enter a node.
*
* @param this
* Context.
* @param node
* Node.
* @param token
* Token.
* @param onError
* Error handler.
* @returns
* Nothing.
*/
enter(
this: CompileContext,
node: Nodes,
token: Token,
onError?: OnEnterError | null | undefined
): undefined
/**
* Exit a node.
*
* @param this
* Context.
* @param token
* Token.
* @param onError
* Error handler.
* @returns
* Nothing.
*/
exit(
this: CompileContext,
token: Token,
onError?: OnExitError | null | undefined
): undefined
/**
* Stop capturing and access the output data.
*
* @param this
* Context.
* @returns
* Nothing.
*/
resume(this: CompileContext): string
/**
* Get the source text that spans a token (or location).
*
* @param token
* Start/end in stream.
* @param expandTabs
* Whether to expand tabs.
* @returns
* Serialized chunks.
*/
sliceSerialize(
token: Pick<Token, 'end' | 'start'>,
expandTabs?: boolean | undefined
): string
}
/**
* Interface of tracked data.
*
* When working on extensions that use more data, extend the corresponding
* interface to register their types:
*
* ```ts
* declare module 'mdast-util-from-markdown' {
* interface CompileData {
* // Register a new field.
* mathFlowInside?: boolean | undefined
* }
* }
* ```
*/
export interface CompileData {
/**
* Whether were inside a hard break.
*/
atHardBreak?: boolean | undefined
/**
* Current character reference type.
*/
characterReferenceType?:
| 'characterReferenceMarkerHexadecimal'
| 'characterReferenceMarkerNumeric'
| undefined
/**
* Whether a first list item value (`1` in `1. a`) is expected.
*/
expectingFirstListItemValue?: boolean | undefined
/**
* Whether were in flow code.
*/
flowCodeInside?: boolean | undefined
/**
* Whether were in a reference.
*/
inReference?: boolean | undefined
/**
* Whether were expecting a line ending from a setext heading, which can be slurped.
*/
setextHeadingSlurpLineEnding?: boolean | undefined
/**
* Current reference.
*/
referenceType?: 'collapsed' | 'full' | undefined
}
/**
* Configuration.
*
* We have our defaults, but extensions will add more.
*/
export interface Config {
/**
* Token types where line endings are used.
*/
canContainEols: Array<string>
/**
* Opening handles.
*/
enter: Handles
/**
* Closing handles.
*/
exit: Handles
/**
* Tree transforms.
*/
transforms: Array<Transform>
}
/**
* Change how markdown tokens from micromark are turned into mdast.
*/
export interface Extension {
/**
* Token types where line endings are used.
*/
canContainEols?: Array<string> | null | undefined
/**
* Opening handles.
*/
enter?: Handles | null | undefined
/**
* Closing handles.
*/
exit?: Handles | null | undefined
/**
* Tree transforms.
*/
transforms?: Array<Transform> | null | undefined
}
/**
* Internal fragment.
*/
export interface Fragment extends Parent {
/**
* Node type.
*/
type: 'fragment'
/**
* Children.
*/
children: Array<PhrasingContent>
}
/**
* Token types mapping to handles
*/
export type Handles = Record<string, Handle>
/**
* Handle a token.
*
* @param this
* Context.
* @param token
* Current token.
* @returns
* Nothing.
*/
export type Handle = (this: CompileContext, token: Token) => undefined | void
/**
* Handle the case where the `right` token is open, but it is closed (by the
* `left` token) or because we reached the end of the document.
*
* @param this
* Context.
* @param left
* Left token.
* @param right
* Right token.
* @returns
* Nothing.
*/
export type OnEnterError = (
this: Omit<CompileContext, 'sliceSerialize'>,
left: Token | undefined,
right: Token
) => undefined
/**
* Handle the case where the `right` token is open but it is closed by
* exiting the `left` token.
*
* @param this
* Context.
* @param left
* Left token.
* @param right
* Right token.
* @returns
* Nothing.
*/
export type OnExitError = (
this: Omit<CompileContext, 'sliceSerialize'>,
left: Token,
right: Token
) => undefined
/**
* Configuration.
*/
export interface Options extends ParseOptions {
/**
* Extensions for this utility to change how tokens are turned into a tree.
*/
mdastExtensions?: Array<Extension | Array<Extension>> | null | undefined
}
/**
* Open token on the stack,
* with an optional error handler for when that token isnt closed properly.
*/
export type TokenTuple = [token: Token, onError: OnEnterError | undefined]
/**
* Extra transform, to change the AST afterwards.
*
* @param tree
* Tree to transform.
* @returns
* New tree or nothing (in which case the current tree is used).
*/
export type Transform = (tree: Root) => Root | null | undefined | void

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","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\nimport { AttributeValue } from '@opentelemetry/api';\nimport { ResourceDetectionConfig } from './config';\n\n/**\n * Interface for a Resource Detector.\n * A resource detector returns a set of detected resource attributes.\n * A detected resource attribute may be an {@link AttributeValue} or a Promise of an AttributeValue.\n */\nexport interface ResourceDetector {\n /**\n * Detect resource attributes.\n *\n * @returns a {@link DetectedResource} object containing detected resource attributes\n */\n detect(config?: ResourceDetectionConfig): DetectedResource;\n}\n\nexport type DetectedResource = {\n /**\n * Detected resource attributes.\n */\n attributes?: DetectedResourceAttributes;\n};\n\n/**\n * An object representing detected resource attributes.\n * Value may be {@link AttributeValue}s, a promise to an {@link AttributeValue}, or undefined.\n */\ntype DetectedResourceAttributeValue = MaybePromise<AttributeValue | undefined>;\n\n/**\n * An object representing detected resource attributes.\n * Values may be {@link AttributeValue}s or a promise to an {@link AttributeValue}.\n */\nexport type DetectedResourceAttributes = Record<\n string,\n DetectedResourceAttributeValue\n>;\n\nexport type MaybePromise<T> = T | Promise<T>;\n\nexport type RawResourceAttribute = [\n string,\n MaybePromise<AttributeValue | undefined>,\n];\n\n/**\n * Options for creating a {@link Resource}.\n */\nexport type ResourceOptions = {\n schemaUrl?: string;\n};\n"]}

View File

@@ -0,0 +1 @@
{"version":3,"file":"unfold-vertical.js","sources":["../../../src/icons/unfold-vertical.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name UnfoldVertical\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgMjJ2LTYiIC8+CiAgPHBhdGggZD0iTTEyIDhWMiIgLz4KICA8cGF0aCBkPSJNNCAxMkgyIiAvPgogIDxwYXRoIGQ9Ik0xMCAxMkg4IiAvPgogIDxwYXRoIGQ9Ik0xNiAxMmgtMiIgLz4KICA8cGF0aCBkPSJNMjIgMTJoLTIiIC8+CiAgPHBhdGggZD0ibTE1IDE5LTMgMy0zLTMiIC8+CiAgPHBhdGggZD0ibTE1IDUtMy0zLTMgMyIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/unfold-vertical\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 UnfoldVertical = createLucideIcon('UnfoldVertical', [\n ['path', { d: 'M12 22v-6', key: '6o8u61' }],\n ['path', { d: 'M12 8V2', key: '1wkif3' }],\n ['path', { d: 'M4 12H2', key: 'rhcxmi' }],\n ['path', { d: 'M10 12H8', key: 's88cx1' }],\n ['path', { d: 'M16 12h-2', key: '10asgb' }],\n ['path', { d: 'M22 12h-2', key: '14jgyd' }],\n ['path', { d: 'm15 19-3 3-3-3', key: '11eu04' }],\n ['path', { d: 'm15 5-3-3-3 3', key: 'itvq4r' }],\n]);\n\nexport default UnfoldVertical;\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,CAAiB,iBAAiB,gBAAkB,CAAA,CAAA,CAAA;AAAA,CAAA,CACxD,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,CAAA;AAAA,CAAA,CAC1C,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,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,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,CAAA;AAAA,CAAA,CAC1C,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,CAAA;AAAA,CAAA,CAC1C,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,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAChD,CAAC,CAAA,CAAA;;"}

View File

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

View File

@@ -0,0 +1,20 @@
'use strict';
const { spawnSync } = require('child_process');
const { readdirSync } = require('fs');
const { join } = require('path');
const files = readdirSync(__dirname).sort();
for (const filename of files) {
if (filename.startsWith('test-')) {
const path = join(__dirname, filename);
console.log(`> Running ${filename} ...`);
const result = spawnSync(`${process.argv0} ${path}`, {
shell: true,
stdio: 'inherit',
windowsHide: true
});
if (result.status !== 0)
process.exitCode = 1;
}
}

View File

@@ -0,0 +1,28 @@
"use strict";
exports.getTime = getTime;
var _index = require("./toDate.js");
/**
* @name getTime
* @category Timestamp Helpers
* @summary Get the milliseconds timestamp of the given date.
*
* @description
* Get the milliseconds timestamp of the given date.
*
* @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 given date
*
* @returns The timestamp
*
* @example
* // Get the timestamp of 29 February 2012 11:45:05.123:
* const result = getTime(new Date(2012, 1, 29, 11, 45, 5, 123))
* //=> 1330515905123
*/
function getTime(date) {
const _date = (0, _index.toDate)(date);
const timestamp = _date.getTime();
return timestamp;
}

View File

@@ -0,0 +1,4 @@
import crypto from 'crypto';
export default {
randomUUID: crypto.randomUUID
};

View File

@@ -0,0 +1,37 @@
/*
@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';
let fsEvents;
let fsEventsImportError;
async function loadFsEvents() {
try {
({ default: fsEvents } = await import('fsevents'));
}
catch (error) {
fsEventsImportError = error;
}
}
// A call to this function will be injected into the chokidar code
function getFsEvents() {
if (fsEventsImportError)
throw fsEventsImportError;
return fsEvents;
}
const fseventsImporter = /*#__PURE__*/Object.defineProperty({
__proto__: null,
getFsEvents,
loadFsEvents
}, Symbol.toStringTag, { value: 'Module' });
exports.fseventsImporter = fseventsImporter;
exports.loadFsEvents = loadFsEvents;
//# sourceMappingURL=fsevents-importer.js.map

View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _defineAccessor;
function _defineAccessor(type, obj, key, fn) {
var desc = {
configurable: true,
enumerable: true
};
desc[type] = fn;
return Object.defineProperty(obj, key, desc);
}
//# sourceMappingURL=defineAccessor.js.map

View File

@@ -0,0 +1,7 @@
export declare const differenceInBusinessDaysWithOptions: import("./types.js").FPFn3<
number,
| import("../differenceInBusinessDays.js").DifferenceInBusinessDaysOptions
| undefined,
string | number | Date,
string | number | Date
>;

View File

@@ -0,0 +1,5 @@
import { SdkInfo } from './sdkinfo';
export interface SdkMetadata {
sdk?: SdkInfo;
}
//# sourceMappingURL=sdkmetadata.d.ts.map

View File

@@ -0,0 +1,40 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMachineId = void 0;
const fs_1 = require("fs");
const execAsync_1 = require("./execAsync");
const api_1 = require("@opentelemetry/api");
async function getMachineId() {
try {
const result = await fs_1.promises.readFile('/etc/hostid', { encoding: 'utf8' });
return result.trim();
}
catch (e) {
api_1.diag.debug(`error reading machine id: ${e}`);
}
try {
const result = await (0, execAsync_1.execAsync)('kenv -q smbios.system.uuid');
return result.stdout.trim();
}
catch (e) {
api_1.diag.debug(`error reading machine id: ${e}`);
}
return undefined;
}
exports.getMachineId = getMachineId;
//# sourceMappingURL=getMachineId-bsd.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"findGlobal.d.ts","sourceRoot":"","sources":["../src/findGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAQzC,eAAO,MAAM,UAAU,EAAE,UA4BxB,CAAA"}

View File

@@ -0,0 +1,44 @@
"use strict";
exports.formatLong = void 0;
var _index = require("../../_lib/buildFormatLongFn.cjs");
// https://www.unicode.org/cldr/charts/32/summary/sk.html?hide#1986
const dateFormats = {
full: "EEEE d. MMMM y",
long: "d. MMMM y",
medium: "d. M. y",
short: "d. M. y",
};
// https://www.unicode.org/cldr/charts/32/summary/sk.html?hide#2149
const timeFormats = {
full: "H:mm:ss zzzz",
long: "H:mm:ss z",
medium: "H:mm:ss",
short: "H:mm",
};
// https://www.unicode.org/cldr/charts/32/summary/sk.html?hide#1994
const dateTimeFormats = {
full: "{{date}}, {{time}}",
long: "{{date}}, {{time}}",
medium: "{{date}}, {{time}}",
short: "{{date}} {{time}}",
};
const formatLong = (exports.formatLong = {
date: (0, _index.buildFormatLongFn)({
formats: dateFormats,
defaultWidth: "full",
}),
time: (0, _index.buildFormatLongFn)({
formats: timeFormats,
defaultWidth: "full",
}),
dateTime: (0, _index.buildFormatLongFn)({
formats: dateTimeFormats,
defaultWidth: "full",
}),
});

View File

@@ -0,0 +1 @@
{"version":3,"file":"sl.d.ts","sourceRoot":"","sources":["../../src/languages/sl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtE,eAAO,MAAM,cAAc,EAAE,yBA0nB5B,CAAA;AAED,eAAO,MAAM,EAAE,EAAE,QAGhB,CAAA"}

View File

@@ -0,0 +1,26 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const types = require('../../../types.js');
/**
* web-vitals 5.1.0 switched listeners to be added on the window rather than the document.
* Instead of having to check for window/document every time we add a listener, we can use this function.
*/
function addPageListener(type, listener, options) {
if (types.WINDOW.document) {
types.WINDOW.addEventListener(type, listener, options);
}
}
/**
* web-vitals 5.1.0 switched listeners to be removed from the window rather than the document.
* Instead of having to check for window/document every time we remove a listener, we can use this function.
*/
function removePageListener(type, listener, options) {
if (types.WINDOW.document) {
types.WINDOW.removeEventListener(type, listener, options);
}
}
exports.addPageListener = addPageListener;
exports.removePageListener = removePageListener;
//# sourceMappingURL=globalListeners.js.map

View File

@@ -0,0 +1,29 @@
import { formatDistance } from "./ka/_lib/formatDistance.js";
import { formatLong } from "./ka/_lib/formatLong.js";
import { formatRelative } from "./ka/_lib/formatRelative.js";
import { localize } from "./ka/_lib/localize.js";
import { match } from "./ka/_lib/match.js";
/**
* @category Locales
* @summary Georgian locale.
* @language Georgian
* @iso-639-2 geo
* @author Lado Lomidze [@Landish](https://github.com/Landish)
* @author Nick Shvelidze [@shvelo](https://github.com/shvelo)
*/
export const ka = {
code: "ka",
formatDistance: formatDistance,
formatLong: formatLong,
formatRelative: formatRelative,
localize: localize,
match: match,
options: {
weekStartsOn: 1 /* Monday */,
firstWeekContainsDate: 1,
},
};
// Fallback for modularized imports:
export default ka;

View File

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

View File

@@ -0,0 +1,51 @@
export type PathTypeFunction = (path: string) => Promise<boolean>;
/**
* Check whether the passed `path` is a file.
*
* @param path - The path to check.
* @returns Whether the `path` is a file.
*/
export const isFile: PathTypeFunction;
/**
* Check whether the passed `path` is a directory.
*
* @param path - The path to check.
* @returns Whether the `path` is a directory.
*/
export const isDirectory: PathTypeFunction;
/**
* Check whether the passed `path` is a symlink.
*
* @param path - The path to check.
* @returns Whether the `path` is a symlink.
*/
export const isSymlink: PathTypeFunction;
export type PathTypeSyncFunction = (path: string) => boolean;
/**
* Synchronously check whether the passed `path` is a file.
*
* @param path - The path to check.
* @returns Whether the `path` is a file.
*/
export const isFileSync: PathTypeSyncFunction;
/**
* Synchronously check whether the passed `path` is a directory.
*
* @param path - The path to check.
* @returns Whether the `path` is a directory.
*/
export const isDirectorySync: PathTypeSyncFunction;
/**
* Synchronously check whether the passed `path` is a symlink.
*
* @param path - The path to check.
* @returns Whether the `path` is a directory.
*/
export const isSymlinkSync: PathTypeSyncFunction;

View File

@@ -0,0 +1 @@
{"version":3,"file":"stethoscope.js","sources":["../../../src/icons/stethoscope.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Stethoscope\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTEgMnYyIiAvPgogIDxwYXRoIGQ9Ik01IDJ2MiIgLz4KICA8cGF0aCBkPSJNNSAzSDRhMiAyIDAgMCAwLTIgMnY0YTYgNiAwIDAgMCAxMiAwVjVhMiAyIDAgMCAwLTItMmgtMSIgLz4KICA8cGF0aCBkPSJNOCAxNWE2IDYgMCAwIDAgMTIgMHYtMyIgLz4KICA8Y2lyY2xlIGN4PSIyMCIgY3k9IjEwIiByPSIyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/stethoscope\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 Stethoscope = createLucideIcon('Stethoscope', [\n ['path', { d: 'M11 2v2', key: '1539x4' }],\n ['path', { d: 'M5 2v2', key: '1yf1q8' }],\n ['path', { d: 'M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1', key: 'rb5t3r' }],\n ['path', { d: 'M8 15a6 6 0 0 0 12 0v-3', key: 'x18d4x' }],\n ['circle', { cx: '20', cy: '10', r: '2', key: 'ts1r5v' }],\n]);\n\nexport default Stethoscope;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,iBAAiB,aAAe,CAAA,CAAA,CAAA;AAAA,CAAA,CAClD,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,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACvC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzF,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,CACxD,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA;AAC1D,CAAC,CAAA,CAAA;;"}

View File

@@ -0,0 +1,70 @@
{
"name": "@floating-ui/utils",
"version": "0.2.10",
"description": "Utilities for Floating UI",
"publishConfig": {
"access": "public"
},
"main": "./dist/floating-ui.utils.umd.js",
"module": "./dist/floating-ui.utils.esm.js",
"types": "./dist/floating-ui.utils.d.ts",
"sideEffects": false,
"files": [
"dist",
"dom"
],
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/floating-ui.utils.d.mts",
"default": "./dist/floating-ui.utils.mjs"
},
"types": "./dist/floating-ui.utils.d.ts",
"module": "./dist/floating-ui.utils.esm.js",
"default": "./dist/floating-ui.utils.umd.js"
},
"./dom": {
"import": {
"types": "./dist/floating-ui.utils.dom.d.mts",
"default": "./dist/floating-ui.utils.dom.mjs"
},
"types": "./dist/floating-ui.utils.dom.d.ts",
"module": "./dist/floating-ui.utils.dom.esm.js",
"default": "./dist/floating-ui.utils.dom.umd.js"
}
},
"author": "atomiks",
"license": "MIT",
"bugs": "https://github.com/floating-ui/floating-ui",
"repository": {
"type": "git",
"url": "https://github.com/floating-ui/floating-ui.git",
"directory": "packages/utils"
},
"homepage": "https://floating-ui.com",
"keywords": [
"tooltip",
"popover",
"dropdown",
"menu",
"popup",
"positioning"
],
"devDependencies": {
"@testing-library/jest-dom": "^6.1.6",
"config": "0.0.0"
},
"scripts": {
"lint": "eslint .",
"format": "prettier --write .",
"clean": "rimraf dist out-tsc dom react",
"test": "vitest run --globals",
"test:watch": "vitest watch --globals",
"dev": "rollup -c -w",
"build": "rollup -c",
"build:api": "build-api --tsc tsconfig.lib.json --aec api-extractor.json --aec api-extractor.dom.json --aec api-extractor.react.json",
"publint": "publint",
"typecheck": "tsc -b"
}
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"verified.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"suppress-tracing.js","sourceRoot":"","sources":["../../../src/trace/suppress-tracing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAW,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,oBAAoB,GAAG,gBAAgB,CAC3C,gDAAgD,CACjD,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,OAAO,OAAO,CAAC,QAAQ,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,OAAO,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,OAAO,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;AACzD,CAAC","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\nimport { Context, createContextKey } from '@opentelemetry/api';\n\nconst SUPPRESS_TRACING_KEY = createContextKey(\n 'OpenTelemetry SDK Context Key SUPPRESS_TRACING'\n);\n\nexport function suppressTracing(context: Context): Context {\n return context.setValue(SUPPRESS_TRACING_KEY, true);\n}\n\nexport function unsuppressTracing(context: Context): Context {\n return context.deleteValue(SUPPRESS_TRACING_KEY);\n}\n\nexport function isTracingSuppressed(context: Context): boolean {\n return context.getValue(SUPPRESS_TRACING_KEY) === true;\n}\n"]}

View File

@@ -0,0 +1,126 @@
import type { $ZodStringFormats } from "../core/checks.js";
import type * as errors from "../core/errors.js";
import * as util from "../core/util.js";
const error: () => errors.$ZodErrorMap = () => {
const Sizable: Record<string, { unit: string }> = {
string: { unit: "tekens" },
file: { unit: "bytes" },
array: { unit: "elementen" },
set: { unit: "elementen" },
};
function getSizing(origin: string): { unit: string } | null {
return Sizable[origin] ?? null;
}
const parsedType = (data: any): string => {
const t = typeof data;
switch (t) {
case "number": {
return Number.isNaN(data) ? "NaN" : "getal";
}
case "object": {
if (Array.isArray(data)) {
return "array";
}
if (data === null) {
return "null";
}
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
return data.constructor.name;
}
}
}
return t;
};
const Nouns: {
[k in $ZodStringFormats | (string & {})]?: string;
} = {
regex: "invoer",
email: "emailadres",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO datum en tijd",
date: "ISO datum",
time: "ISO tijd",
duration: "ISO duur",
ipv4: "IPv4-adres",
ipv6: "IPv6-adres",
cidrv4: "IPv4-bereik",
cidrv6: "IPv6-bereik",
base64: "base64-gecodeerde tekst",
base64url: "base64 URL-gecodeerde tekst",
json_string: "JSON string",
e164: "E.164-nummer",
jwt: "JWT",
template_literal: "invoer",
};
return (issue) => {
switch (issue.code) {
case "invalid_type":
return `Ongeldige invoer: verwacht ${issue.expected}, ontving ${parsedType(issue.input)}`;
case "invalid_value":
if (issue.values.length === 1) return `Ongeldige invoer: verwacht ${util.stringifyPrimitive(issue.values[0])}`;
return `Ongeldige optie: verwacht één van ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Te lang: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementen"} bevat`;
return `Te lang: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} is`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Te kort: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} bevat`;
}
return `Te kort: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} is`;
}
case "invalid_format": {
const _issue = issue as errors.$ZodStringFormatIssues;
if (_issue.format === "starts_with") {
return `Ongeldige tekst: moet met "${_issue.prefix}" beginnen`;
}
if (_issue.format === "ends_with") return `Ongeldige tekst: moet op "${_issue.suffix}" eindigen`;
if (_issue.format === "includes") return `Ongeldige tekst: moet "${_issue.includes}" bevatten`;
if (_issue.format === "regex") return `Ongeldige tekst: moet overeenkomen met patroon ${_issue.pattern}`;
return `Ongeldig: ${Nouns[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Ongeldig getal: moet een veelvoud van ${issue.divisor} zijn`;
case "unrecognized_keys":
return `Onbekende key${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Ongeldige key in ${issue.origin}`;
case "invalid_union":
return "Ongeldige invoer";
case "invalid_element":
return `Ongeldige waarde in ${issue.origin}`;
default:
return `Ongeldige invoer`;
}
};
};
export default function (): { localeError: errors.$ZodErrorMap } {
return {
localeError: error(),
};
}

View File

@@ -0,0 +1,22 @@
var REACT_ELEMENT_TYPE;
function _createRawReactElement(e, r, E, l) {
REACT_ELEMENT_TYPE || (REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol["for"] && Symbol["for"]("react.element") || 60103);
var o = e && e.defaultProps,
n = arguments.length - 3;
if (r || 0 === n || (r = {
children: void 0
}), 1 === n) r.children = l;else if (n > 1) {
for (var t = Array(n), f = 0; f < n; f++) t[f] = arguments[f + 3];
r.children = t;
}
if (r && o) for (var i in o) void 0 === r[i] && (r[i] = o[i]);else r || (r = o || {});
return {
$$typeof: REACT_ELEMENT_TYPE,
type: e,
key: void 0 === E ? null : "" + E,
ref: null,
props: r,
_owner: null
};
}
module.exports = _createRawReactElement, module.exports.__esModule = true, module.exports["default"] = module.exports;

View File

@@ -0,0 +1 @@
{"version":3,"file":"flattenAllFields.d.ts","sourceRoot":"","sources":["../../src/utilities/flattenAllFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,KAAK,EACL,cAAc,EAEd,cAAc,EAEf,MAAM,2BAA2B,CAAA;AAIlC,eAAO,MAAM,YAAY,cAAe;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,KAAG,cAK1D,CAAA;AAID;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,uBAG1B;IACD,wGAAwG;IACxG,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,KAAK,EAAE,CAAA;CAChB,KAAG,cAAc,EAiGjB,CAAA"}

View File

@@ -0,0 +1,852 @@
import type {ScopeValueSets, NameValue, ValueScope, ValueScopeName} from "./scope"
import {_, nil, _Code, Code, Name, UsedNames, CodeItem, addCodeArg, _CodeOrName} from "./code"
import {Scope, varKinds} from "./scope"
export {_, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code} from "./code"
export {Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds} from "./scope"
// type for expressions that can be safely inserted in code without quotes
export type SafeExpr = Code | number | boolean | null
// type that is either Code of function that adds code to CodeGen instance using its methods
export type Block = Code | (() => void)
export const operators = {
GT: new _Code(">"),
GTE: new _Code(">="),
LT: new _Code("<"),
LTE: new _Code("<="),
EQ: new _Code("==="),
NEQ: new _Code("!=="),
NOT: new _Code("!"),
OR: new _Code("||"),
AND: new _Code("&&"),
ADD: new _Code("+"),
}
abstract class Node {
abstract readonly names: UsedNames
optimizeNodes(): this | ChildNode | ChildNode[] | undefined {
return this
}
optimizeNames(_names: UsedNames, _constants: Constants): this | undefined {
return this
}
// get count(): number {
// return 1
// }
}
class Def extends Node {
constructor(
private readonly varKind: Name,
private readonly name: Name,
private rhs?: SafeExpr
) {
super()
}
render({es5, _n}: CGOptions): string {
const varKind = es5 ? varKinds.var : this.varKind
const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`
return `${varKind} ${this.name}${rhs};` + _n
}
optimizeNames(names: UsedNames, constants: Constants): this | undefined {
if (!names[this.name.str]) return
if (this.rhs) this.rhs = optimizeExpr(this.rhs, names, constants)
return this
}
get names(): UsedNames {
return this.rhs instanceof _CodeOrName ? this.rhs.names : {}
}
}
class Assign extends Node {
constructor(
readonly lhs: Code,
public rhs: SafeExpr,
private readonly sideEffects?: boolean
) {
super()
}
render({_n}: CGOptions): string {
return `${this.lhs} = ${this.rhs};` + _n
}
optimizeNames(names: UsedNames, constants: Constants): this | undefined {
if (this.lhs instanceof Name && !names[this.lhs.str] && !this.sideEffects) return
this.rhs = optimizeExpr(this.rhs, names, constants)
return this
}
get names(): UsedNames {
const names = this.lhs instanceof Name ? {} : {...this.lhs.names}
return addExprNames(names, this.rhs)
}
}
class AssignOp extends Assign {
constructor(
lhs: Code,
private readonly op: Code,
rhs: SafeExpr,
sideEffects?: boolean
) {
super(lhs, rhs, sideEffects)
}
render({_n}: CGOptions): string {
return `${this.lhs} ${this.op}= ${this.rhs};` + _n
}
}
class Label extends Node {
readonly names: UsedNames = {}
constructor(readonly label: Name) {
super()
}
render({_n}: CGOptions): string {
return `${this.label}:` + _n
}
}
class Break extends Node {
readonly names: UsedNames = {}
constructor(readonly label?: Code) {
super()
}
render({_n}: CGOptions): string {
const label = this.label ? ` ${this.label}` : ""
return `break${label};` + _n
}
}
class Throw extends Node {
constructor(readonly error: Code) {
super()
}
render({_n}: CGOptions): string {
return `throw ${this.error};` + _n
}
get names(): UsedNames {
return this.error.names
}
}
class AnyCode extends Node {
constructor(private code: SafeExpr) {
super()
}
render({_n}: CGOptions): string {
return `${this.code};` + _n
}
optimizeNodes(): this | undefined {
return `${this.code}` ? this : undefined
}
optimizeNames(names: UsedNames, constants: Constants): this {
this.code = optimizeExpr(this.code, names, constants)
return this
}
get names(): UsedNames {
return this.code instanceof _CodeOrName ? this.code.names : {}
}
}
abstract class ParentNode extends Node {
constructor(readonly nodes: ChildNode[] = []) {
super()
}
render(opts: CGOptions): string {
return this.nodes.reduce((code, n) => code + n.render(opts), "")
}
optimizeNodes(): this | ChildNode | ChildNode[] | undefined {
const {nodes} = this
let i = nodes.length
while (i--) {
const n = nodes[i].optimizeNodes()
if (Array.isArray(n)) nodes.splice(i, 1, ...n)
else if (n) nodes[i] = n
else nodes.splice(i, 1)
}
return nodes.length > 0 ? this : undefined
}
optimizeNames(names: UsedNames, constants: Constants): this | undefined {
const {nodes} = this
let i = nodes.length
while (i--) {
// iterating backwards improves 1-pass optimization
const n = nodes[i]
if (n.optimizeNames(names, constants)) continue
subtractNames(names, n.names)
nodes.splice(i, 1)
}
return nodes.length > 0 ? this : undefined
}
get names(): UsedNames {
return this.nodes.reduce((names: UsedNames, n) => addNames(names, n.names), {})
}
// get count(): number {
// return this.nodes.reduce((c, n) => c + n.count, 1)
// }
}
abstract class BlockNode extends ParentNode {
render(opts: CGOptions): string {
return "{" + opts._n + super.render(opts) + "}" + opts._n
}
}
class Root extends ParentNode {}
class Else extends BlockNode {
static readonly kind = "else"
}
class If extends BlockNode {
static readonly kind = "if"
else?: If | Else
constructor(
private condition: Code | boolean,
nodes?: ChildNode[]
) {
super(nodes)
}
render(opts: CGOptions): string {
let code = `if(${this.condition})` + super.render(opts)
if (this.else) code += "else " + this.else.render(opts)
return code
}
optimizeNodes(): If | ChildNode[] | undefined {
super.optimizeNodes()
const cond = this.condition
if (cond === true) return this.nodes // else is ignored here
let e = this.else
if (e) {
const ns = e.optimizeNodes()
e = this.else = Array.isArray(ns) ? new Else(ns) : (ns as Else | undefined)
}
if (e) {
if (cond === false) return e instanceof If ? e : e.nodes
if (this.nodes.length) return this
return new If(not(cond), e instanceof If ? [e] : e.nodes)
}
if (cond === false || !this.nodes.length) return undefined
return this
}
optimizeNames(names: UsedNames, constants: Constants): this | undefined {
this.else = this.else?.optimizeNames(names, constants)
if (!(super.optimizeNames(names, constants) || this.else)) return
this.condition = optimizeExpr(this.condition, names, constants)
return this
}
get names(): UsedNames {
const names = super.names
addExprNames(names, this.condition)
if (this.else) addNames(names, this.else.names)
return names
}
// get count(): number {
// return super.count + (this.else?.count || 0)
// }
}
abstract class For extends BlockNode {
static readonly kind = "for"
}
class ForLoop extends For {
constructor(private iteration: Code) {
super()
}
render(opts: CGOptions): string {
return `for(${this.iteration})` + super.render(opts)
}
optimizeNames(names: UsedNames, constants: Constants): this | undefined {
if (!super.optimizeNames(names, constants)) return
this.iteration = optimizeExpr(this.iteration, names, constants)
return this
}
get names(): UsedNames {
return addNames(super.names, this.iteration.names)
}
}
class ForRange extends For {
constructor(
private readonly varKind: Name,
private readonly name: Name,
private readonly from: SafeExpr,
private readonly to: SafeExpr
) {
super()
}
render(opts: CGOptions): string {
const varKind = opts.es5 ? varKinds.var : this.varKind
const {name, from, to} = this
return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts)
}
get names(): UsedNames {
const names = addExprNames(super.names, this.from)
return addExprNames(names, this.to)
}
}
class ForIter extends For {
constructor(
private readonly loop: "of" | "in",
private readonly varKind: Name,
private readonly name: Name,
private iterable: Code
) {
super()
}
render(opts: CGOptions): string {
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts)
}
optimizeNames(names: UsedNames, constants: Constants): this | undefined {
if (!super.optimizeNames(names, constants)) return
this.iterable = optimizeExpr(this.iterable, names, constants)
return this
}
get names(): UsedNames {
return addNames(super.names, this.iterable.names)
}
}
class Func extends BlockNode {
static readonly kind = "func"
constructor(
public name: Name,
public args: Code,
public async?: boolean
) {
super()
}
render(opts: CGOptions): string {
const _async = this.async ? "async " : ""
return `${_async}function ${this.name}(${this.args})` + super.render(opts)
}
}
class Return extends ParentNode {
static readonly kind = "return"
render(opts: CGOptions): string {
return "return " + super.render(opts)
}
}
class Try extends BlockNode {
catch?: Catch
finally?: Finally
render(opts: CGOptions): string {
let code = "try" + super.render(opts)
if (this.catch) code += this.catch.render(opts)
if (this.finally) code += this.finally.render(opts)
return code
}
optimizeNodes(): this {
super.optimizeNodes()
this.catch?.optimizeNodes() as Catch | undefined
this.finally?.optimizeNodes() as Finally | undefined
return this
}
optimizeNames(names: UsedNames, constants: Constants): this {
super.optimizeNames(names, constants)
this.catch?.optimizeNames(names, constants)
this.finally?.optimizeNames(names, constants)
return this
}
get names(): UsedNames {
const names = super.names
if (this.catch) addNames(names, this.catch.names)
if (this.finally) addNames(names, this.finally.names)
return names
}
// get count(): number {
// return super.count + (this.catch?.count || 0) + (this.finally?.count || 0)
// }
}
class Catch extends BlockNode {
static readonly kind = "catch"
constructor(readonly error: Name) {
super()
}
render(opts: CGOptions): string {
return `catch(${this.error})` + super.render(opts)
}
}
class Finally extends BlockNode {
static readonly kind = "finally"
render(opts: CGOptions): string {
return "finally" + super.render(opts)
}
}
type StartBlockNode = If | For | Func | Return | Try
type LeafNode = Def | Assign | Label | Break | Throw | AnyCode
type ChildNode = StartBlockNode | LeafNode
type EndBlockNodeType =
| typeof If
| typeof Else
| typeof For
| typeof Func
| typeof Return
| typeof Catch
| typeof Finally
type Constants = Record<string, SafeExpr | undefined>
export interface CodeGenOptions {
es5?: boolean
lines?: boolean
ownProperties?: boolean
}
interface CGOptions extends CodeGenOptions {
_n: "\n" | ""
}
export class CodeGen {
readonly _scope: Scope
readonly _extScope: ValueScope
readonly _values: ScopeValueSets = {}
private readonly _nodes: ParentNode[]
private readonly _blockStarts: number[] = []
private readonly _constants: Constants = {}
private readonly opts: CGOptions
constructor(extScope: ValueScope, opts: CodeGenOptions = {}) {
this.opts = {...opts, _n: opts.lines ? "\n" : ""}
this._extScope = extScope
this._scope = new Scope({parent: extScope})
this._nodes = [new Root()]
}
toString(): string {
return this._root.render(this.opts)
}
// returns unique name in the internal scope
name(prefix: string): Name {
return this._scope.name(prefix)
}
// reserves unique name in the external scope
scopeName(prefix: string): ValueScopeName {
return this._extScope.name(prefix)
}
// reserves unique name in the external scope and assigns value to it
scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name {
const name = this._extScope.value(prefixOrName, value)
const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set())
vs.add(name)
return name
}
getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined {
return this._extScope.getValue(prefix, keyOrRef)
}
// return code that assigns values in the external scope to the names that are used internally
// (same names that were returned by gen.scopeName or gen.scopeValue)
scopeRefs(scopeName: Name): Code {
return this._extScope.scopeRefs(scopeName, this._values)
}
scopeCode(): Code {
return this._extScope.scopeCode(this._values)
}
private _def(
varKind: Name,
nameOrPrefix: Name | string,
rhs?: SafeExpr,
constant?: boolean
): Name {
const name = this._scope.toName(nameOrPrefix)
if (rhs !== undefined && constant) this._constants[name.str] = rhs
this._leafNode(new Def(varKind, name, rhs))
return name
}
// `const` declaration (`var` in es5 mode)
const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name {
return this._def(varKinds.const, nameOrPrefix, rhs, _constant)
}
// `let` declaration with optional assignment (`var` in es5 mode)
let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name {
return this._def(varKinds.let, nameOrPrefix, rhs, _constant)
}
// `var` declaration with optional assignment
var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name {
return this._def(varKinds.var, nameOrPrefix, rhs, _constant)
}
// assignment code
assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen {
return this._leafNode(new Assign(lhs, rhs, sideEffects))
}
// `+=` code
add(lhs: Code, rhs: SafeExpr): CodeGen {
return this._leafNode(new AssignOp(lhs, operators.ADD, rhs))
}
// appends passed SafeExpr to code or executes Block
code(c: Block | SafeExpr): CodeGen {
if (typeof c == "function") c()
else if (c !== nil) this._leafNode(new AnyCode(c))
return this
}
// returns code for object literal for the passed argument list of key-value pairs
object(...keyValues: [Name | string, SafeExpr | string][]): _Code {
const code: CodeItem[] = ["{"]
for (const [key, value] of keyValues) {
if (code.length > 1) code.push(",")
code.push(key)
if (key !== value || this.opts.es5) {
code.push(":")
addCodeArg(code, value)
}
}
code.push("}")
return new _Code(code)
}
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen {
this._blockNode(new If(condition))
if (thenBody && elseBody) {
this.code(thenBody).else().code(elseBody).endIf()
} else if (thenBody) {
this.code(thenBody).endIf()
} else if (elseBody) {
throw new Error('CodeGen: "else" body without "then" body')
}
return this
}
// `else if` clause - invalid without `if` or after `else` clauses
elseIf(condition: Code | boolean): CodeGen {
return this._elseNode(new If(condition))
}
// `else` clause - only valid after `if` or `else if` clauses
else(): CodeGen {
return this._elseNode(new Else())
}
// end `if` statement (needed if gen.if was used only with condition)
endIf(): CodeGen {
return this._endBlockNode(If, Else)
}
private _for(node: For, forBody?: Block): CodeGen {
this._blockNode(node)
if (forBody) this.code(forBody).endFor()
return this
}
// a generic `for` clause (or statement if `forBody` is passed)
for(iteration: Code, forBody?: Block): CodeGen {
return this._for(new ForLoop(iteration), forBody)
}
// `for` statement for a range of values
forRange(
nameOrPrefix: Name | string,
from: SafeExpr,
to: SafeExpr,
forBody: (index: Name) => void,
varKind: Code = this.opts.es5 ? varKinds.var : varKinds.let
): CodeGen {
const name = this._scope.toName(nameOrPrefix)
return this._for(new ForRange(varKind, name, from, to), () => forBody(name))
}
// `for-of` statement (in es5 mode replace with a normal for loop)
forOf(
nameOrPrefix: Name | string,
iterable: Code,
forBody: (item: Name) => void,
varKind: Code = varKinds.const
): CodeGen {
const name = this._scope.toName(nameOrPrefix)
if (this.opts.es5) {
const arr = iterable instanceof Name ? iterable : this.var("_arr", iterable)
return this.forRange("_i", 0, _`${arr}.length`, (i) => {
this.var(name, _`${arr}[${i}]`)
forBody(name)
})
}
return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name))
}
// `for-in` statement.
// With option `ownProperties` replaced with a `for-of` loop for object keys
forIn(
nameOrPrefix: Name | string,
obj: Code,
forBody: (item: Name) => void,
varKind: Code = this.opts.es5 ? varKinds.var : varKinds.const
): CodeGen {
if (this.opts.ownProperties) {
return this.forOf(nameOrPrefix, _`Object.keys(${obj})`, forBody)
}
const name = this._scope.toName(nameOrPrefix)
return this._for(new ForIter("in", varKind, name, obj), () => forBody(name))
}
// end `for` loop
endFor(): CodeGen {
return this._endBlockNode(For)
}
// `label` statement
label(label: Name): CodeGen {
return this._leafNode(new Label(label))
}
// `break` statement
break(label?: Code): CodeGen {
return this._leafNode(new Break(label))
}
// `return` statement
return(value: Block | SafeExpr): CodeGen {
const node = new Return()
this._blockNode(node)
this.code(value)
if (node.nodes.length !== 1) throw new Error('CodeGen: "return" should have one node')
return this._endBlockNode(Return)
}
// `try` statement
try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen {
if (!catchCode && !finallyCode) throw new Error('CodeGen: "try" without "catch" and "finally"')
const node = new Try()
this._blockNode(node)
this.code(tryBody)
if (catchCode) {
const error = this.name("e")
this._currNode = node.catch = new Catch(error)
catchCode(error)
}
if (finallyCode) {
this._currNode = node.finally = new Finally()
this.code(finallyCode)
}
return this._endBlockNode(Catch, Finally)
}
// `throw` statement
throw(error: Code): CodeGen {
return this._leafNode(new Throw(error))
}
// start self-balancing block
block(body?: Block, nodeCount?: number): CodeGen {
this._blockStarts.push(this._nodes.length)
if (body) this.code(body).endBlock(nodeCount)
return this
}
// end the current self-balancing block
endBlock(nodeCount?: number): CodeGen {
const len = this._blockStarts.pop()
if (len === undefined) throw new Error("CodeGen: not in self-balancing block")
const toClose = this._nodes.length - len
if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) {
throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`)
}
this._nodes.length = len
return this
}
// `function` heading (or definition if funcBody is passed)
func(name: Name, args: Code = nil, async?: boolean, funcBody?: Block): CodeGen {
this._blockNode(new Func(name, args, async))
if (funcBody) this.code(funcBody).endFunc()
return this
}
// end function definition
endFunc(): CodeGen {
return this._endBlockNode(Func)
}
optimize(n = 1): void {
while (n-- > 0) {
this._root.optimizeNodes()
this._root.optimizeNames(this._root.names, this._constants)
}
}
private _leafNode(node: LeafNode): CodeGen {
this._currNode.nodes.push(node)
return this
}
private _blockNode(node: StartBlockNode): void {
this._currNode.nodes.push(node)
this._nodes.push(node)
}
private _endBlockNode(N1: EndBlockNodeType, N2?: EndBlockNodeType): CodeGen {
const n = this._currNode
if (n instanceof N1 || (N2 && n instanceof N2)) {
this._nodes.pop()
return this
}
throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`)
}
private _elseNode(node: If | Else): CodeGen {
const n = this._currNode
if (!(n instanceof If)) {
throw new Error('CodeGen: "else" without "if"')
}
this._currNode = n.else = node
return this
}
private get _root(): Root {
return this._nodes[0] as Root
}
private get _currNode(): ParentNode {
const ns = this._nodes
return ns[ns.length - 1]
}
private set _currNode(node: ParentNode) {
const ns = this._nodes
ns[ns.length - 1] = node
}
// get nodeCount(): number {
// return this._root.count
// }
}
function addNames(names: UsedNames, from: UsedNames): UsedNames {
for (const n in from) names[n] = (names[n] || 0) + (from[n] || 0)
return names
}
function addExprNames(names: UsedNames, from: SafeExpr): UsedNames {
return from instanceof _CodeOrName ? addNames(names, from.names) : names
}
function optimizeExpr<T extends SafeExpr | Code>(expr: T, names: UsedNames, constants: Constants): T
function optimizeExpr(expr: SafeExpr, names: UsedNames, constants: Constants): SafeExpr {
if (expr instanceof Name) return replaceName(expr)
if (!canOptimize(expr)) return expr
return new _Code(
expr._items.reduce((items: CodeItem[], c: SafeExpr | string) => {
if (c instanceof Name) c = replaceName(c)
if (c instanceof _Code) items.push(...c._items)
else items.push(c)
return items
}, [])
)
function replaceName(n: Name): SafeExpr {
const c = constants[n.str]
if (c === undefined || names[n.str] !== 1) return n
delete names[n.str]
return c
}
function canOptimize(e: SafeExpr): e is _Code {
return (
e instanceof _Code &&
e._items.some(
(c) => c instanceof Name && names[c.str] === 1 && constants[c.str] !== undefined
)
)
}
}
function subtractNames(names: UsedNames, from: UsedNames): void {
for (const n in from) names[n] = (names[n] || 0) - (from[n] || 0)
}
export function not<T extends Code | SafeExpr>(x: T): T
export function not(x: Code | SafeExpr): Code | SafeExpr {
return typeof x == "boolean" || typeof x == "number" || x === null ? !x : _`!${par(x)}`
}
const andCode = mappend(operators.AND)
// boolean AND (&&) expression with the passed arguments
export function and(...args: Code[]): Code {
return args.reduce(andCode)
}
const orCode = mappend(operators.OR)
// boolean OR (||) expression with the passed arguments
export function or(...args: Code[]): Code {
return args.reduce(orCode)
}
type MAppend = (x: Code, y: Code) => Code
function mappend(op: Code): MAppend {
return (x, y) => (x === nil ? y : y === nil ? x : _`${par(x)} ${op} ${par(y)}`)
}
function par(x: Code): Code {
return x instanceof Name ? x : _`(${x})`
}

View File

@@ -0,0 +1,49 @@
var baseTimes = require('./_baseTimes'),
isArguments = require('./isArguments'),
isArray = require('./isArray'),
isBuffer = require('./isBuffer'),
isIndex = require('./_isIndex'),
isTypedArray = require('./isTypedArray');
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
var isArr = isArray(value),
isArg = !isArr && isArguments(value),
isBuff = !isArr && !isArg && isBuffer(value),
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? baseTimes(value.length, String) : [],
length = result.length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (
// Safari 9 has enumerable `arguments.length` in strict mode.
key == 'length' ||
// Node.js 0.10 has enumerable non-index properties on buffers.
(isBuff && (key == 'offset' || key == 'parent')) ||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
// Skip index properties.
isIndex(key, length)
))) {
result.push(key);
}
}
return result;
}
module.exports = arrayLikeKeys;

View File

@@ -0,0 +1,7 @@
import type {Plugin} from "ajv"
import getDef from "../definitions/range"
const range: Plugin<undefined> = (ajv) => ajv.addKeyword(getDef())
export default range
module.exports = range

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