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,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decrypt = exports.encrypt = void 0;
const node_util_1 = require("node:util");
const node_crypto_1 = require("node:crypto");
const random_js_1 = require("./random.js");
const buffer_utils_js_1 = require("../lib/buffer_utils.js");
const base64url_js_1 = require("./base64url.js");
const aeskw_js_1 = require("./aeskw.js");
const check_p2s_js_1 = require("../lib/check_p2s.js");
const webcrypto_js_1 = require("./webcrypto.js");
const crypto_key_js_1 = require("../lib/crypto_key.js");
const is_key_object_js_1 = require("./is_key_object.js");
const invalid_key_input_js_1 = require("../lib/invalid_key_input.js");
const is_key_like_js_1 = require("./is_key_like.js");
const pbkdf2 = (0, node_util_1.promisify)(node_crypto_1.pbkdf2);
function getPassword(key, alg) {
if ((0, is_key_object_js_1.default)(key)) {
return key.export();
}
if (key instanceof Uint8Array) {
return key;
}
if ((0, webcrypto_js_1.isCryptoKey)(key)) {
(0, crypto_key_js_1.checkEncCryptoKey)(key, alg, 'deriveBits', 'deriveKey');
return node_crypto_1.KeyObject.from(key).export();
}
throw new TypeError((0, invalid_key_input_js_1.default)(key, ...is_key_like_js_1.types, 'Uint8Array'));
}
const encrypt = async (alg, key, cek, p2c = 2048, p2s = (0, random_js_1.default)(new Uint8Array(16))) => {
(0, check_p2s_js_1.default)(p2s);
const salt = (0, buffer_utils_js_1.p2s)(alg, p2s);
const keylen = parseInt(alg.slice(13, 16), 10) >> 3;
const password = getPassword(key, alg);
const derivedKey = await pbkdf2(password, salt, p2c, keylen, `sha${alg.slice(8, 11)}`);
const encryptedKey = await (0, aeskw_js_1.wrap)(alg.slice(-6), derivedKey, cek);
return { encryptedKey, p2c, p2s: (0, base64url_js_1.encode)(p2s) };
};
exports.encrypt = encrypt;
const decrypt = async (alg, key, encryptedKey, p2c, p2s) => {
(0, check_p2s_js_1.default)(p2s);
const salt = (0, buffer_utils_js_1.p2s)(alg, p2s);
const keylen = parseInt(alg.slice(13, 16), 10) >> 3;
const password = getPassword(key, alg);
const derivedKey = await pbkdf2(password, salt, p2c, keylen, `sha${alg.slice(8, 11)}`);
return (0, aeskw_js_1.unwrap)(alg.slice(-6), derivedKey, encryptedKey);
};
exports.decrypt = decrypt;

View File

@@ -0,0 +1,28 @@
"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.noopDetector = exports.serviceInstanceIdDetector = exports.processDetector = exports.osDetector = exports.hostDetector = exports.envDetector = void 0;
var EnvDetector_1 = require("./EnvDetector");
Object.defineProperty(exports, "envDetector", { enumerable: true, get: function () { return EnvDetector_1.envDetector; } });
var platform_1 = require("./platform");
Object.defineProperty(exports, "hostDetector", { enumerable: true, get: function () { return platform_1.hostDetector; } });
Object.defineProperty(exports, "osDetector", { enumerable: true, get: function () { return platform_1.osDetector; } });
Object.defineProperty(exports, "processDetector", { enumerable: true, get: function () { return platform_1.processDetector; } });
Object.defineProperty(exports, "serviceInstanceIdDetector", { enumerable: true, get: function () { return platform_1.serviceInstanceIdDetector; } });
var NoopDetector_1 = require("./NoopDetector");
Object.defineProperty(exports, "noopDetector", { enumerable: true, get: function () { return NoopDetector_1.noopDetector; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,5 @@
const SQLiteViewConfig = Symbol.for("drizzle:SQLiteViewConfig");
export {
SQLiteViewConfig
};
//# sourceMappingURL=view-common.js.map

View File

@@ -0,0 +1,79 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EncryptJWT = void 0;
const encrypt_js_1 = require("../jwe/compact/encrypt.js");
const buffer_utils_js_1 = require("../lib/buffer_utils.js");
const produce_js_1 = require("./produce.js");
class EncryptJWT extends produce_js_1.ProduceJWT {
_cek;
_iv;
_keyManagementParameters;
_protectedHeader;
_replicateIssuerAsHeader;
_replicateSubjectAsHeader;
_replicateAudienceAsHeader;
setProtectedHeader(protectedHeader) {
if (this._protectedHeader) {
throw new TypeError('setProtectedHeader can only be called once');
}
this._protectedHeader = protectedHeader;
return this;
}
setKeyManagementParameters(parameters) {
if (this._keyManagementParameters) {
throw new TypeError('setKeyManagementParameters can only be called once');
}
this._keyManagementParameters = parameters;
return this;
}
setContentEncryptionKey(cek) {
if (this._cek) {
throw new TypeError('setContentEncryptionKey can only be called once');
}
this._cek = cek;
return this;
}
setInitializationVector(iv) {
if (this._iv) {
throw new TypeError('setInitializationVector can only be called once');
}
this._iv = iv;
return this;
}
replicateIssuerAsHeader() {
this._replicateIssuerAsHeader = true;
return this;
}
replicateSubjectAsHeader() {
this._replicateSubjectAsHeader = true;
return this;
}
replicateAudienceAsHeader() {
this._replicateAudienceAsHeader = true;
return this;
}
async encrypt(key, options) {
const enc = new encrypt_js_1.CompactEncrypt(buffer_utils_js_1.encoder.encode(JSON.stringify(this._payload)));
if (this._replicateIssuerAsHeader) {
this._protectedHeader = { ...this._protectedHeader, iss: this._payload.iss };
}
if (this._replicateSubjectAsHeader) {
this._protectedHeader = { ...this._protectedHeader, sub: this._payload.sub };
}
if (this._replicateAudienceAsHeader) {
this._protectedHeader = { ...this._protectedHeader, aud: this._payload.aud };
}
enc.setProtectedHeader(this._protectedHeader);
if (this._iv) {
enc.setInitializationVector(this._iv);
}
if (this._cek) {
enc.setContentEncryptionKey(this._cek);
}
if (this._keyManagementParameters) {
enc.setKeyManagementParameters(this._keyManagementParameters);
}
return enc.encrypt(key, options);
}
}
exports.EncryptJWT = EncryptJWT;

View File

@@ -0,0 +1,19 @@
/**
* 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 { RootNode, TextNode } from 'lexical';
/**
* Finds a TextNode with a size larger than targetCharacters and returns
* the node along with the remaining length of the text.
* @param root - The RootNode.
* @param targetCharacters - The number of characters whose TextNode must be larger than.
* @returns The TextNode and the intersections offset, or null if no TextNode is found.
*/
export declare function $findTextIntersectionFromCharacters(root: RootNode, targetCharacters: number): null | {
node: TextNode;
offset: number;
};

View File

@@ -0,0 +1,19 @@
var arrayFilter = require('./_arrayFilter'),
isFunction = require('./isFunction');
/**
* The base implementation of `_.functions` which creates an array of
* `object` function property names filtered from `props`.
*
* @private
* @param {Object} object The object to inspect.
* @param {Array} props The property names to filter.
* @returns {Array} Returns the function names.
*/
function baseFunctions(object, props) {
return arrayFilter(props, function(key) {
return isFunction(object[key]);
});
}
module.exports = baseFunctions;

View File

@@ -0,0 +1,10 @@
import { ErrorEvent, Event, FeedbackEvent, ReplayEvent, TransactionEvent } from '@sentry/core';
/** If the event is an error event */
export declare function isErrorEvent(event: Event): event is ErrorEvent;
/** If the event is a transaction event */
export declare function isTransactionEvent(event: Event): event is TransactionEvent;
/** If the event is an replay event */
export declare function isReplayEvent(event: Event): event is ReplayEvent;
/** If the event is a feedback event */
export declare function isFeedbackEvent(event: Event): event is FeedbackEvent;
//# sourceMappingURL=eventUtils.d.ts.map

View File

@@ -0,0 +1,443 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { SyncHook } = require("tapable");
/** @typedef {import("enhanced-resolve").ResolveRequest} ResolveRequest */
/** @typedef {import("../../declarations/WebpackOptions").Falsy} Falsy */
/** @typedef {import("../../declarations/WebpackOptions").RuleSetLoaderOptions} RuleSetLoaderOptions */
/** @typedef {import("../../declarations/WebpackOptions").RuleSetRule} RuleSetRule */
/** @typedef {(Falsy | RuleSetRule)[]} RuleSetRules */
/**
* @typedef {(value: EffectData[keyof EffectData]) => boolean} RuleConditionFunction
*/
/**
* @typedef {object} RuleCondition
* @property {string | string[]} property
* @property {boolean} matchWhenEmpty
* @property {RuleConditionFunction} fn
*/
/**
* @typedef {object} Condition
* @property {boolean} matchWhenEmpty
* @property {RuleConditionFunction} fn
*/
/**
* @typedef {object} EffectData
* @property {string=} resource
* @property {string=} realResource
* @property {string=} resourceQuery
* @property {string=} resourceFragment
* @property {string=} scheme
* @property {ImportAttributes=} attributes
* @property {string=} mimetype
* @property {string} dependency
* @property {ResolveRequest["descriptionFileData"]=} descriptionData
* @property {string=} compiler
* @property {string} issuer
* @property {string} issuerLayer
*/
/**
* @typedef {object} CompiledRule
* @property {RuleCondition[]} conditions
* @property {(Effect | ((effectData: EffectData) => Effect[]))[]} effects
* @property {CompiledRule[]=} rules
* @property {CompiledRule[]=} oneOf
*/
/** @typedef {"use" | "use-pre" | "use-post"} EffectUseType */
/**
* @typedef {object} EffectUse
* @property {EffectUseType} type
* @property {{ loader: string, options?: string | null | Record<string, EXPECTED_ANY>, ident?: string }} value
*/
/**
* @typedef {object} EffectBasic
* @property {string} type
* @property {EXPECTED_ANY} value
*/
/** @typedef {EffectUse | EffectBasic} Effect */
/** @typedef {Map<string, RuleSetLoaderOptions>} References */
/**
* @typedef {object} RuleSet
* @property {References} references map of references in the rule set (may grow over time)
* @property {(effectData: EffectData) => Effect[]} exec execute the rule set
*/
/**
* @template T
* @template {T[keyof T]} V
* @typedef {({ [key in keyof Required<T>]: Required<T>[key] extends V ? key : never })[keyof T]} KeysOfTypes
*/
/** @typedef {Set<string>} UnhandledProperties */
/** @typedef {{ apply: (ruleSetCompiler: RuleSetCompiler) => void }} RuleSetPlugin */
class RuleSetCompiler {
/**
* @param {RuleSetPlugin[]} plugins plugins
*/
constructor(plugins) {
this.hooks = Object.freeze({
/** @type {SyncHook<[string, RuleSetRule, UnhandledProperties, CompiledRule, References]>} */
rule: new SyncHook([
"path",
"rule",
"unhandledProperties",
"compiledRule",
"references"
])
});
if (plugins) {
for (const plugin of plugins) {
plugin.apply(this);
}
}
}
/**
* @param {RuleSetRules} ruleSet raw user provided rules
* @returns {RuleSet} compiled RuleSet
*/
compile(ruleSet) {
/** @type {References} */
const refs = new Map();
const rules = this.compileRules("ruleSet", ruleSet, refs);
/**
* @param {EffectData} data data passed in
* @param {CompiledRule} rule the compiled rule
* @param {Effect[]} effects an array where effects are pushed to
* @returns {boolean} true, if the rule has matched
*/
const execRule = (data, rule, effects) => {
for (const condition of rule.conditions) {
const p = condition.property;
if (Array.isArray(p)) {
/** @type {EXPECTED_ANY} */
let current = data;
for (const subProperty of p) {
if (
current &&
typeof current === "object" &&
Object.prototype.hasOwnProperty.call(current, subProperty)
) {
current = current[/** @type {keyof EffectData} */ (subProperty)];
} else {
current = undefined;
break;
}
}
if (current !== undefined) {
if (!condition.fn(current)) return false;
continue;
}
} else if (p in data) {
const value = data[/** @type {keyof EffectData} */ (p)];
if (value !== undefined) {
if (!condition.fn(value)) return false;
continue;
}
}
if (!condition.matchWhenEmpty) {
return false;
}
}
for (const effect of rule.effects) {
if (typeof effect === "function") {
const returnedEffects = effect(data);
for (const effect of returnedEffects) {
effects.push(effect);
}
} else {
effects.push(effect);
}
}
if (rule.rules) {
for (const childRule of rule.rules) {
execRule(data, childRule, effects);
}
}
if (rule.oneOf) {
for (const childRule of rule.oneOf) {
if (execRule(data, childRule, effects)) {
break;
}
}
}
return true;
};
return {
references: refs,
exec: (data) => {
/** @type {Effect[]} */
const effects = [];
for (const rule of rules) {
execRule(data, rule, effects);
}
return effects;
}
};
}
/**
* @param {string} path current path
* @param {RuleSetRules} rules the raw rules provided by user
* @param {References} refs references
* @returns {CompiledRule[]} rules
*/
compileRules(path, rules, refs) {
return rules
.filter(Boolean)
.map((rule, i) =>
this.compileRule(
`${path}[${i}]`,
/** @type {RuleSetRule} */ (rule),
refs
)
);
}
/**
* @param {string} path current path
* @param {RuleSetRule} rule the raw rule provided by user
* @param {References} refs references
* @returns {CompiledRule} normalized and compiled rule for processing
*/
compileRule(path, rule, refs) {
/** @type {UnhandledProperties} */
const unhandledProperties = new Set(
Object.keys(rule).filter(
(key) => rule[/** @type {keyof RuleSetRule} */ (key)] !== undefined
)
);
/** @type {CompiledRule} */
const compiledRule = {
conditions: [],
effects: [],
rules: undefined,
oneOf: undefined
};
this.hooks.rule.call(path, rule, unhandledProperties, compiledRule, refs);
if (unhandledProperties.has("rules")) {
unhandledProperties.delete("rules");
const rules = rule.rules;
if (!Array.isArray(rules)) {
throw this.error(path, rules, "Rule.rules must be an array of rules");
}
compiledRule.rules = this.compileRules(`${path}.rules`, rules, refs);
}
if (unhandledProperties.has("oneOf")) {
unhandledProperties.delete("oneOf");
const oneOf = rule.oneOf;
if (!Array.isArray(oneOf)) {
throw this.error(path, oneOf, "Rule.oneOf must be an array of rules");
}
compiledRule.oneOf = this.compileRules(`${path}.oneOf`, oneOf, refs);
}
if (unhandledProperties.size > 0) {
throw this.error(
path,
rule,
`Properties ${[...unhandledProperties].join(", ")} are unknown`
);
}
return compiledRule;
}
/**
* @param {string} path current path
* @param {RuleSetLoaderOptions} condition user provided condition value
* @returns {Condition} compiled condition
*/
compileCondition(path, condition) {
if (condition === "") {
return {
matchWhenEmpty: true,
fn: (str) => str === ""
};
}
if (!condition) {
throw this.error(
path,
condition,
"Expected condition but got falsy value"
);
}
if (typeof condition === "string") {
return {
matchWhenEmpty: condition.length === 0,
fn: (str) => typeof str === "string" && str.startsWith(condition)
};
}
if (typeof condition === "function") {
try {
return {
matchWhenEmpty: condition(""),
fn: /** @type {RuleConditionFunction} */ (condition)
};
} catch (_err) {
throw this.error(
path,
condition,
"Evaluation of condition function threw error"
);
}
}
if (condition instanceof RegExp) {
return {
matchWhenEmpty: condition.test(""),
fn: (v) => typeof v === "string" && condition.test(v)
};
}
if (Array.isArray(condition)) {
const items = condition.map((c, i) =>
this.compileCondition(`${path}[${i}]`, c)
);
return this.combineConditionsOr(items);
}
if (typeof condition !== "object") {
throw this.error(
path,
condition,
`Unexpected ${typeof condition} when condition was expected`
);
}
/** @type {Condition[]} */
const conditions = [];
for (const key of Object.keys(condition)) {
const value = condition[key];
switch (key) {
case "or":
if (value) {
if (!Array.isArray(value)) {
throw this.error(
`${path}.or`,
condition.or,
"Expected array of conditions"
);
}
conditions.push(this.compileCondition(`${path}.or`, value));
}
break;
case "and":
if (value) {
if (!Array.isArray(value)) {
throw this.error(
`${path}.and`,
condition.and,
"Expected array of conditions"
);
}
let i = 0;
for (const item of value) {
conditions.push(this.compileCondition(`${path}.and[${i}]`, item));
i++;
}
}
break;
case "not":
if (value) {
const matcher = this.compileCondition(`${path}.not`, value);
const fn = matcher.fn;
conditions.push({
matchWhenEmpty: !matcher.matchWhenEmpty,
fn: /** @type {RuleConditionFunction} */ ((v) => !fn(v))
});
}
break;
default:
throw this.error(
`${path}.${key}`,
condition[key],
`Unexpected property ${key} in condition`
);
}
}
if (conditions.length === 0) {
throw this.error(
path,
condition,
"Expected condition, but got empty thing"
);
}
return this.combineConditionsAnd(conditions);
}
/**
* @param {Condition[]} conditions some conditions
* @returns {Condition} merged condition
*/
combineConditionsOr(conditions) {
if (conditions.length === 0) {
return {
matchWhenEmpty: false,
fn: () => false
};
} else if (conditions.length === 1) {
return conditions[0];
}
return {
matchWhenEmpty: conditions.some((c) => c.matchWhenEmpty),
fn: (v) => conditions.some((c) => c.fn(v))
};
}
/**
* @param {Condition[]} conditions some conditions
* @returns {Condition} merged condition
*/
combineConditionsAnd(conditions) {
if (conditions.length === 0) {
return {
matchWhenEmpty: false,
fn: () => false
};
} else if (conditions.length === 1) {
return conditions[0];
}
return {
matchWhenEmpty: conditions.every((c) => c.matchWhenEmpty),
fn: (v) => conditions.every((c) => c.fn(v))
};
}
/**
* @param {string} path current path
* @param {EXPECTED_ANY} value value at the error location
* @param {string} message message explaining the problem
* @returns {Error} an error object
*/
error(path, value, message) {
return new Error(
`Compiling RuleSet failed: ${message} (at ${path}: ${value})`
);
}
}
module.exports = RuleSetCompiler;

View File

@@ -0,0 +1,474 @@
"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 __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.cloneNode = exports.hasChildren = exports.isDocument = exports.isDirective = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = exports.Element = exports.Document = exports.CDATA = exports.NodeWithChildren = exports.ProcessingInstruction = exports.Comment = exports.Text = exports.DataNode = exports.Node = void 0;
var domelementtype_1 = require("domelementtype");
/**
* This object will be used as the prototype for Nodes when creating a
* DOM-Level-1-compliant structure.
*/
var Node = /** @class */ (function () {
function Node() {
/** Parent of the node */
this.parent = null;
/** Previous sibling */
this.prev = null;
/** Next sibling */
this.next = null;
/** The start index of the node. Requires `withStartIndices` on the handler to be `true. */
this.startIndex = null;
/** The end index of the node. Requires `withEndIndices` on the handler to be `true. */
this.endIndex = null;
}
Object.defineProperty(Node.prototype, "parentNode", {
// Read-write aliases for properties
/**
* Same as {@link parent}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function () {
return this.parent;
},
set: function (parent) {
this.parent = parent;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Node.prototype, "previousSibling", {
/**
* Same as {@link prev}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function () {
return this.prev;
},
set: function (prev) {
this.prev = prev;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Node.prototype, "nextSibling", {
/**
* Same as {@link next}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function () {
return this.next;
},
set: function (next) {
this.next = next;
},
enumerable: false,
configurable: true
});
/**
* Clone this node, and optionally its children.
*
* @param recursive Clone child nodes as well.
* @returns A clone of the node.
*/
Node.prototype.cloneNode = function (recursive) {
if (recursive === void 0) { recursive = false; }
return cloneNode(this, recursive);
};
return Node;
}());
exports.Node = Node;
/**
* A node that contains some data.
*/
var DataNode = /** @class */ (function (_super) {
__extends(DataNode, _super);
/**
* @param data The content of the data node
*/
function DataNode(data) {
var _this = _super.call(this) || this;
_this.data = data;
return _this;
}
Object.defineProperty(DataNode.prototype, "nodeValue", {
/**
* Same as {@link data}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function () {
return this.data;
},
set: function (data) {
this.data = data;
},
enumerable: false,
configurable: true
});
return DataNode;
}(Node));
exports.DataNode = DataNode;
/**
* Text within the document.
*/
var Text = /** @class */ (function (_super) {
__extends(Text, _super);
function Text() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = domelementtype_1.ElementType.Text;
return _this;
}
Object.defineProperty(Text.prototype, "nodeType", {
get: function () {
return 3;
},
enumerable: false,
configurable: true
});
return Text;
}(DataNode));
exports.Text = Text;
/**
* Comments within the document.
*/
var Comment = /** @class */ (function (_super) {
__extends(Comment, _super);
function Comment() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = domelementtype_1.ElementType.Comment;
return _this;
}
Object.defineProperty(Comment.prototype, "nodeType", {
get: function () {
return 8;
},
enumerable: false,
configurable: true
});
return Comment;
}(DataNode));
exports.Comment = Comment;
/**
* Processing instructions, including doc types.
*/
var ProcessingInstruction = /** @class */ (function (_super) {
__extends(ProcessingInstruction, _super);
function ProcessingInstruction(name, data) {
var _this = _super.call(this, data) || this;
_this.name = name;
_this.type = domelementtype_1.ElementType.Directive;
return _this;
}
Object.defineProperty(ProcessingInstruction.prototype, "nodeType", {
get: function () {
return 1;
},
enumerable: false,
configurable: true
});
return ProcessingInstruction;
}(DataNode));
exports.ProcessingInstruction = ProcessingInstruction;
/**
* A `Node` that can have children.
*/
var NodeWithChildren = /** @class */ (function (_super) {
__extends(NodeWithChildren, _super);
/**
* @param children Children of the node. Only certain node types can have children.
*/
function NodeWithChildren(children) {
var _this = _super.call(this) || this;
_this.children = children;
return _this;
}
Object.defineProperty(NodeWithChildren.prototype, "firstChild", {
// Aliases
/** First child of the node. */
get: function () {
var _a;
return (_a = this.children[0]) !== null && _a !== void 0 ? _a : null;
},
enumerable: false,
configurable: true
});
Object.defineProperty(NodeWithChildren.prototype, "lastChild", {
/** Last child of the node. */
get: function () {
return this.children.length > 0
? this.children[this.children.length - 1]
: null;
},
enumerable: false,
configurable: true
});
Object.defineProperty(NodeWithChildren.prototype, "childNodes", {
/**
* Same as {@link children}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function () {
return this.children;
},
set: function (children) {
this.children = children;
},
enumerable: false,
configurable: true
});
return NodeWithChildren;
}(Node));
exports.NodeWithChildren = NodeWithChildren;
var CDATA = /** @class */ (function (_super) {
__extends(CDATA, _super);
function CDATA() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = domelementtype_1.ElementType.CDATA;
return _this;
}
Object.defineProperty(CDATA.prototype, "nodeType", {
get: function () {
return 4;
},
enumerable: false,
configurable: true
});
return CDATA;
}(NodeWithChildren));
exports.CDATA = CDATA;
/**
* The root node of the document.
*/
var Document = /** @class */ (function (_super) {
__extends(Document, _super);
function Document() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = domelementtype_1.ElementType.Root;
return _this;
}
Object.defineProperty(Document.prototype, "nodeType", {
get: function () {
return 9;
},
enumerable: false,
configurable: true
});
return Document;
}(NodeWithChildren));
exports.Document = Document;
/**
* An element within the DOM.
*/
var Element = /** @class */ (function (_super) {
__extends(Element, _super);
/**
* @param name Name of the tag, eg. `div`, `span`.
* @param attribs Object mapping attribute names to attribute values.
* @param children Children of the node.
*/
function Element(name, attribs, children, type) {
if (children === void 0) { children = []; }
if (type === void 0) { type = name === "script"
? domelementtype_1.ElementType.Script
: name === "style"
? domelementtype_1.ElementType.Style
: domelementtype_1.ElementType.Tag; }
var _this = _super.call(this, children) || this;
_this.name = name;
_this.attribs = attribs;
_this.type = type;
return _this;
}
Object.defineProperty(Element.prototype, "nodeType", {
get: function () {
return 1;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Element.prototype, "tagName", {
// DOM Level 1 aliases
/**
* Same as {@link name}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function () {
return this.name;
},
set: function (name) {
this.name = name;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Element.prototype, "attributes", {
get: function () {
var _this = this;
return Object.keys(this.attribs).map(function (name) {
var _a, _b;
return ({
name: name,
value: _this.attribs[name],
namespace: (_a = _this["x-attribsNamespace"]) === null || _a === void 0 ? void 0 : _a[name],
prefix: (_b = _this["x-attribsPrefix"]) === null || _b === void 0 ? void 0 : _b[name],
});
});
},
enumerable: false,
configurable: true
});
return Element;
}(NodeWithChildren));
exports.Element = Element;
/**
* @param node Node to check.
* @returns `true` if the node is a `Element`, `false` otherwise.
*/
function isTag(node) {
return (0, domelementtype_1.isTag)(node);
}
exports.isTag = isTag;
/**
* @param node Node to check.
* @returns `true` if the node has the type `CDATA`, `false` otherwise.
*/
function isCDATA(node) {
return node.type === domelementtype_1.ElementType.CDATA;
}
exports.isCDATA = isCDATA;
/**
* @param node Node to check.
* @returns `true` if the node has the type `Text`, `false` otherwise.
*/
function isText(node) {
return node.type === domelementtype_1.ElementType.Text;
}
exports.isText = isText;
/**
* @param node Node to check.
* @returns `true` if the node has the type `Comment`, `false` otherwise.
*/
function isComment(node) {
return node.type === domelementtype_1.ElementType.Comment;
}
exports.isComment = isComment;
/**
* @param node Node to check.
* @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
*/
function isDirective(node) {
return node.type === domelementtype_1.ElementType.Directive;
}
exports.isDirective = isDirective;
/**
* @param node Node to check.
* @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
*/
function isDocument(node) {
return node.type === domelementtype_1.ElementType.Root;
}
exports.isDocument = isDocument;
/**
* @param node Node to check.
* @returns `true` if the node has children, `false` otherwise.
*/
function hasChildren(node) {
return Object.prototype.hasOwnProperty.call(node, "children");
}
exports.hasChildren = hasChildren;
/**
* Clone a node, and optionally its children.
*
* @param recursive Clone child nodes as well.
* @returns A clone of the node.
*/
function cloneNode(node, recursive) {
if (recursive === void 0) { recursive = false; }
var result;
if (isText(node)) {
result = new Text(node.data);
}
else if (isComment(node)) {
result = new Comment(node.data);
}
else if (isTag(node)) {
var children = recursive ? cloneChildren(node.children) : [];
var clone_1 = new Element(node.name, __assign({}, node.attribs), children);
children.forEach(function (child) { return (child.parent = clone_1); });
if (node.namespace != null) {
clone_1.namespace = node.namespace;
}
if (node["x-attribsNamespace"]) {
clone_1["x-attribsNamespace"] = __assign({}, node["x-attribsNamespace"]);
}
if (node["x-attribsPrefix"]) {
clone_1["x-attribsPrefix"] = __assign({}, node["x-attribsPrefix"]);
}
result = clone_1;
}
else if (isCDATA(node)) {
var children = recursive ? cloneChildren(node.children) : [];
var clone_2 = new CDATA(children);
children.forEach(function (child) { return (child.parent = clone_2); });
result = clone_2;
}
else if (isDocument(node)) {
var children = recursive ? cloneChildren(node.children) : [];
var clone_3 = new Document(children);
children.forEach(function (child) { return (child.parent = clone_3); });
if (node["x-mode"]) {
clone_3["x-mode"] = node["x-mode"];
}
result = clone_3;
}
else if (isDirective(node)) {
var instruction = new ProcessingInstruction(node.name, node.data);
if (node["x-name"] != null) {
instruction["x-name"] = node["x-name"];
instruction["x-publicId"] = node["x-publicId"];
instruction["x-systemId"] = node["x-systemId"];
}
result = instruction;
}
else {
throw new Error("Not implemented yet: ".concat(node.type));
}
result.startIndex = node.startIndex;
result.endIndex = node.endIndex;
if (node.sourceCodeLocation != null) {
result.sourceCodeLocation = node.sourceCodeLocation;
}
return result;
}
exports.cloneNode = cloneNode;
function cloneChildren(childs) {
var children = childs.map(function (child) { return cloneNode(child, true); });
for (var i = 1; i < children.length; i++) {
children[i].prev = children[i - 1];
children[i - 1].next = children[i];
}
return children;
}

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,gBAAgB,EAAE,EAAE,EAC9B,KAAK,EAAE,OAAO,GACb,gBAAgB,EAAE,EAAE,CAYtB;AAuBD,wBAAgB,cAAc,CAAC,CAAC,SAAS,gBAAgB,GAAG,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAE9F"}

View File

@@ -0,0 +1,43 @@
import { normalizeDates } from "./_lib/normalizeDates.js";
/**
* The {@link differenceInCalendarMonths} function options.
*/
/**
* @name differenceInCalendarMonths
* @category Month Helpers
* @summary Get the number of calendar months between the given dates.
*
* @description
* Get the number of calendar months between the given dates.
*
* @param laterDate - The later date
* @param earlierDate - The earlier date
* @param options - An object with options
*
* @returns The number of calendar months
*
* @example
* // How many calendar months are between 31 January 2014 and 1 September 2014?
* const result = differenceInCalendarMonths(
* new Date(2014, 8, 1),
* new Date(2014, 0, 31)
* )
* //=> 8
*/
export function differenceInCalendarMonths(laterDate, earlierDate, options) {
const [laterDate_, earlierDate_] = normalizeDates(
options?.in,
laterDate,
earlierDate,
);
const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();
return yearsDiff * 12 + monthsDiff;
}
// Fallback for modularized imports:
export default differenceInCalendarMonths;

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/pglite/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { PgliteDatabase } from './driver.ts';\n\nexport async function migrate<TSchema extends Record<string, unknown>>(\n\tdb: PgliteDatabase<TSchema>,\n\tconfig: MigrationConfig,\n) {\n\tconst migrations = readMigrationFiles(config);\n\tawait db.dialect.migrate(migrations, db.session, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAmC;AAGnC,eAAsB,QACrB,IACA,QACC;AACD,QAAM,iBAAa,oCAAmB,MAAM;AAC5C,QAAM,GAAG,QAAQ,QAAQ,YAAY,GAAG,SAAS,MAAM;AACxD;","names":[]}

View File

@@ -0,0 +1,18 @@
import { DirectusVersion } from "./version.js";
import { DirectusActivity } from "./activity.js";
import { MergeCoreCollection } from "../types/schema.js";
//#region src/schema/revision.d.ts
type DirectusRevision<Schema = any> = MergeCoreCollection<Schema, 'directus_revisions', {
id: number;
activity: DirectusActivity<Schema> | number;
collection: string;
item: string;
data: Record<string, any> | null;
delta: Record<string, any> | null;
parent: DirectusRevision<Schema> | number | null;
version: DirectusVersion<Schema> | string | null;
}>;
//#endregion
export { DirectusRevision };
//# sourceMappingURL=revision.d.ts.map

View File

@@ -0,0 +1,46 @@
import { defineIntegration, debug, startSession, captureSession } from '@sentry/core';
import { addHistoryInstrumentationHandler } from '@sentry-internal/browser-utils';
import { DEBUG_BUILD } from '../debug-build.js';
import { WINDOW } from '../helpers.js';
/**
* When added, automatically creates sessions which allow you to track adoption and crashes (crash free rate) in your Releases in Sentry.
* More information: https://docs.sentry.io/product/releases/health/
*
* Note: In order for session tracking to work, you need to set up Releases: https://docs.sentry.io/product/releases/
*/
const browserSessionIntegration = defineIntegration((options = {}) => {
const lifecycle = options.lifecycle ?? 'route';
return {
name: 'BrowserSession',
setupOnce() {
if (typeof WINDOW.document === 'undefined') {
DEBUG_BUILD &&
debug.warn('Using the `browserSessionIntegration` in non-browser environments is not supported.');
return;
}
// The session duration for browser sessions does not track a meaningful
// concept that can be used as a metric.
// Automatically captured sessions are akin to page views, and thus we
// discard their duration.
startSession({ ignoreDuration: true });
captureSession();
if (lifecycle === 'route') {
// We want to create a session for every navigation as well
addHistoryInstrumentationHandler(({ from, to }) => {
// Don't create an additional session for the initial route or if the location did not change
if (from !== undefined && from !== to) {
startSession({ ignoreDuration: true });
captureSession();
}
});
}
},
};
});
export { browserSessionIntegration };
//# sourceMappingURL=browsersession.js.map

View File

@@ -0,0 +1,8 @@
import { Profiler } from '@sentry/core';
/**
* Profiler namespace for controlling the JS profiler in 'manual' mode.
*
* Requires the `browserProfilingIntegration` from the `@sentry/browser` package.
*/
export declare const uiProfiler: Profiler;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,15 @@
export { wrapGetStaticPropsWithSentry } from './pages-router-instrumentation/wrapGetStaticPropsWithSentry';
export { wrapGetInitialPropsWithSentry } from './pages-router-instrumentation/wrapGetInitialPropsWithSentry';
export { wrapAppGetInitialPropsWithSentry } from './pages-router-instrumentation/wrapAppGetInitialPropsWithSentry';
export { wrapDocumentGetInitialPropsWithSentry } from './pages-router-instrumentation/wrapDocumentGetInitialPropsWithSentry';
export { wrapErrorGetInitialPropsWithSentry } from './pages-router-instrumentation/wrapErrorGetInitialPropsWithSentry';
export { wrapGetServerSidePropsWithSentry } from './pages-router-instrumentation/wrapGetServerSidePropsWithSentry';
export { wrapServerComponentWithSentry } from './wrapServerComponentWithSentry';
export { wrapRouteHandlerWithSentry } from './wrapRouteHandlerWithSentry';
export { wrapApiHandlerWithSentryVercelCrons } from './pages-router-instrumentation/wrapApiHandlerWithSentryVercelCrons';
export { wrapMiddlewareWithSentry } from './wrapMiddlewareWithSentry';
export { wrapPageComponentWithSentry } from './pages-router-instrumentation/wrapPageComponentWithSentry';
export { wrapGenerationFunctionWithSentry } from './wrapGenerationFunctionWithSentry';
export { withServerActionInstrumentation } from './withServerActionInstrumentation';
export { captureRequestError } from './captureRequestError';
//# sourceMappingURL=index.d.ts.map

View File

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

View File

@@ -0,0 +1,123 @@
import type { Span as WriteableSpan } from '@opentelemetry/api';
import type { Instrumentation } from '@opentelemetry/instrumentation';
import type { ReadableSpan, SpanProcessor } from '@opentelemetry/sdk-trace-base';
import type { ClientOptions, Options, SamplingContext, Scope, ServerRuntimeOptions, Span } from '@sentry/core';
import type { NodeTransportOptions } from './transports';
/**
* Base options for WinterTC-compatible server-side JavaScript runtimes with OpenTelemetry support.
* This interface extends the base ServerRuntimeOptions from @sentry/core with OpenTelemetry-specific configuration options.
* Used by Node.js, Bun, and other WinterTC-compliant runtime SDKs that support OpenTelemetry instrumentation.
*/
export interface OpenTelemetryServerRuntimeOptions extends ServerRuntimeOptions {
/**
* If this is set to true, the SDK will not set up OpenTelemetry automatically.
* In this case, you _have_ to ensure to set it up correctly yourself, including:
* * The `SentrySpanProcessor`
* * The `SentryPropagator`
* * The `SentryContextManager`
* * The `SentrySampler`
*/
skipOpenTelemetrySetup?: boolean;
/**
* Provide an array of OpenTelemetry Instrumentations that should be registered.
*
* Use this option if you want to register OpenTelemetry instrumentation that the Sentry SDK does not yet have support for.
*/
openTelemetryInstrumentations?: Instrumentation[];
/**
* Provide an array of additional OpenTelemetry SpanProcessors that should be registered.
*/
openTelemetrySpanProcessors?: SpanProcessor[];
}
/**
* Base options for the Sentry Node SDK.
* Extends the common WinterTC options with OpenTelemetry support shared with Bun and other server-side SDKs.
*/
export interface BaseNodeOptions extends OpenTelemetryServerRuntimeOptions {
/**
* Override the runtime name reported in events.
* Defaults to 'node' with the current process version if not specified.
*
* @hidden This is primarily used internally to support platforms like Next on OpenNext/Cloudflare.
*/
runtime?: {
name: string;
version?: string;
};
/**
* Sets profiling sample rate when @sentry/profiling-node is installed
*
* @deprecated
*/
profilesSampleRate?: number;
/**
* Function to compute profiling sample rate dynamically and filter unwanted profiles.
*
* Profiling is enabled if either this or `profilesSampleRate` is defined. If both are defined, `profilesSampleRate` is
* ignored.
*
* Will automatically be passed a context object of default and optional custom data.
*
* @returns A sample rate between 0 and 1 (0 drops the profile, 1 guarantees it will be sent). Returning `true` is
* equivalent to returning 1 and returning `false` is equivalent to returning 0.
*
* @deprecated
*/
profilesSampler?: (samplingContext: SamplingContext) => number | boolean;
/**
* Sets profiling session sample rate - only evaluated once per SDK initialization.
* @default 0
*/
profileSessionSampleRate?: number;
/**
* Set the lifecycle of the profiler.
*
* - `manual`: The profiler will be manually started and stopped.
* - `trace`: The profiler will be automatically started when when a span is sampled and stopped when there are no more sampled spans.
*
* @default 'manual'
*/
profileLifecycle?: 'manual' | 'trace';
/**
* Include local variables with stack traces.
*
* Requires the `LocalVariables` integration.
*/
includeLocalVariables?: boolean;
/**
* Whether to register ESM loader hooks to automatically instrument libraries.
* This is necessary to auto instrument libraries that are loaded via ESM imports, but it can cause issues
* with certain libraries. If you run into problems running your app with this enabled,
* please raise an issue in https://github.com/getsentry/sentry-javascript.
*
* Defaults to `true`.
*/
registerEsmLoaderHooks?: boolean;
}
/**
* Configuration options for the Sentry Node SDK
* @see @sentry/core Options for more information.
*/
export interface NodeOptions extends Options<NodeTransportOptions>, BaseNodeOptions {
}
/**
* Configuration options for the Sentry Node SDK Client class
* @see NodeClient for more information.
*/
export interface NodeClientOptions extends ClientOptions<NodeTransportOptions>, BaseNodeOptions {
}
export interface CurrentScopes {
scope: Scope;
isolationScope: Scope;
}
/**
* The base `Span` type is basically a `WriteableSpan`.
* There are places where we basically want to allow passing _any_ span,
* so in these cases we type this as `AbstractSpan` which could be either a regular `Span` or a `ReadableSpan`.
* You'll have to make sur to check relevant fields before accessing them.
*
* Note that technically, the `Span` exported from `@opentelemetry/sdk-trace-base` matches this,
* but we cannot be 100% sure that we are actually getting such a span, so this type is more defensive.
*/
export type AbstractSpan = WriteableSpan | ReadableSpan | Span;
//# sourceMappingURL=types.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","names":["React","PlusIcon","XIcon","DraggableSortable","Pill","baseClass","PillSelector","draggable","onClick","pills","pillElements","useMemo","map","pill","i","_jsx","alignIcon","selected","className","filter","Boolean","join","icon","id","name","size","Label","key","ids","onDragEnd","moveFromIndex","moveToIndex"],"sources":["../../../src/elements/PillSelector/index.tsx"],"sourcesContent":["'use client'\n\nimport React from 'react'\n\nimport { PlusIcon } from '../../icons/Plus/index.js'\nimport { XIcon } from '../../icons/X/index.js'\nimport { DraggableSortable } from '../DraggableSortable/index.js'\nimport { Pill } from '../Pill/index.js'\nimport './index.scss'\n\nconst baseClass = 'pill-selector'\n\nexport type SelectablePill = {\n key?: string\n Label?: React.ReactNode\n name: string\n selected: boolean\n}\n\nexport type Props = {\n draggable?: {\n onDragEnd: (args: { moveFromIndex: number; moveToIndex: number }) => void\n }\n onClick?: (args: { pill: SelectablePill }) => Promise<void> | void\n pills: SelectablePill[]\n}\n\n/**\n * Displays a wrappable list of pills that can be selected or deselected.\n * If `draggable` is true, the pills can be reordered by dragging.\n */\nexport const PillSelector: React.FC<Props> = ({ draggable, onClick, pills }) => {\n // IMPORTANT: Do NOT wrap DraggableSortable in a dynamic component function using useMemo.\n // BAD: useMemo(() => ({ children }) => <DraggableSortable>...</DraggableSortable>, [deps])\n // This creates a new function reference on each recomputation, causing React to treat it as a\n // different component type, triggering unmount/mount cycles instead of just updating props.\n // GOOD: Use conditional rendering directly: draggable ? <DraggableSortable /> : <div />\n const pillElements = React.useMemo(() => {\n return pills.map((pill, i) => {\n return (\n <Pill\n alignIcon=\"left\"\n aria-checked={pill.selected}\n className={[`${baseClass}__pill`, pill.selected && `${baseClass}__pill--selected`]\n .filter(Boolean)\n .join(' ')}\n draggable={Boolean(draggable)}\n icon={pill.selected ? <XIcon /> : <PlusIcon />}\n id={pill.name}\n key={pill.key ?? `${pill.name}-${i}`}\n onClick={() => {\n if (onClick) {\n void onClick({ pill })\n }\n }}\n size=\"small\"\n >\n {pill.Label ?? <span className={`${baseClass}__pill-label`}>{pill.name}</span>}\n </Pill>\n )\n })\n }, [pills, onClick, draggable])\n\n if (draggable) {\n return (\n <DraggableSortable\n className={baseClass}\n ids={pills.map((pill) => pill.name)}\n onDragEnd={({ moveFromIndex, moveToIndex }) => {\n draggable.onDragEnd({\n moveFromIndex,\n moveToIndex,\n })\n }}\n >\n {pillElements}\n </DraggableSortable>\n )\n }\n\n return <div className={baseClass}>{pillElements}</div>\n}\n"],"mappings":"AAAA;;;AAEA,OAAOA,KAAA,MAAW;AAElB,SAASC,QAAQ,QAAQ;AACzB,SAASC,KAAK,QAAQ;AACtB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,IAAI,QAAQ;AACrB,OAAO;AAEP,MAAMC,SAAA,GAAY;AAiBlB;;;;AAIA,OAAO,MAAMC,YAAA,GAAgCA,CAAC;EAAEC,SAAS;EAAEC,OAAO;EAAEC;AAAK,CAAE;EACzE;EACA;EACA;EACA;EACA;EACA,MAAMC,YAAA,GAAeV,KAAA,CAAMW,OAAO,CAAC;IACjC,OAAOF,KAAA,CAAMG,GAAG,CAAC,CAACC,IAAA,EAAMC,CAAA;MACtB,oBACEC,IAAA,CAACX,IAAA;QACCY,SAAA,EAAU;QACV,gBAAcH,IAAA,CAAKI,QAAQ;QAC3BC,SAAA,EAAW,CAAC,GAAGb,SAAA,QAAiB,EAAEQ,IAAA,CAAKI,QAAQ,IAAI,GAAGZ,SAAA,kBAA2B,CAAC,CAC/Ec,MAAM,CAACC,OAAA,EACPC,IAAI,CAAC;QACRd,SAAA,EAAWa,OAAA,CAAQb,SAAA;QACnBe,IAAA,EAAMT,IAAA,CAAKI,QAAQ,gBAAGF,IAAA,CAACb,KAAA,qBAAWa,IAAA,CAACd,QAAA;QACnCsB,EAAA,EAAIV,IAAA,CAAKW,IAAI;QAEbhB,OAAA,EAASA,CAAA;UACP,IAAIA,OAAA,EAAS;YACX,KAAKA,OAAA,CAAQ;cAAEK;YAAK;UACtB;QACF;QACAY,IAAA,EAAK;kBAEJZ,IAAA,CAAKa,KAAK,iBAAIX,IAAA,CAAC;UAAKG,SAAA,EAAW,GAAGb,SAAA,cAAuB;oBAAGQ,IAAA,CAAKW;;SAR7DX,IAAA,CAAKc,GAAG,IAAI,GAAGd,IAAA,CAAKW,IAAI,IAAIV,CAAA,EAAG;IAW1C;EACF,GAAG,CAACL,KAAA,EAAOD,OAAA,EAASD,SAAA,CAAU;EAE9B,IAAIA,SAAA,EAAW;IACb,oBACEQ,IAAA,CAACZ,iBAAA;MACCe,SAAA,EAAWb,SAAA;MACXuB,GAAA,EAAKnB,KAAA,CAAMG,GAAG,CAAEC,MAAA,IAASA,MAAA,CAAKW,IAAI;MAClCK,SAAA,EAAWA,CAAC;QAAEC,aAAa;QAAEC;MAAW,CAAE;QACxCxB,SAAA,CAAUsB,SAAS,CAAC;UAClBC,aAAA;UACAC;QACF;MACF;gBAECrB;;EAGP;EAEA,oBAAOK,IAAA,CAAC;IAAIG,SAAA,EAAWb,SAAA;cAAYK;;AACrC","ignoreList":[]}

View File

@@ -0,0 +1,17 @@
type ModuleInfo = Record<string, string>;
/**
* Add node modules / packages to the event.
* For this, multiple sources are used:
* - They can be injected at build time into the __SENTRY_SERVER_MODULES__ variable (e.g. in Next.js)
* - They are extracted from the dependencies & devDependencies in the package.json file
* - They are extracted from the require.cache (CJS only)
*/
export declare const modulesIntegration: () => {
name: string;
processEvent(event: import("@sentry/core").Event): import("@sentry/core").Event;
getModules: typeof _getModules;
};
/** Fetches the list of modules and the versions loaded by the entry file for your node.js app. */
declare function _getModules(): ModuleInfo;
export {};
//# sourceMappingURL=modules.d.ts.map

View File

@@ -0,0 +1,5 @@
const file2 = require("./file2.js")
module.exports = function () {
file2()
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/FieldError/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAyBlD,CAAA"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"translations.js","names":[],"sources":["../../../../src/rest/commands/create/translations.ts"],"sourcesContent":["import type { DirectusTranslation } from '../../../schema/translation.js';\nimport type { ApplyQueryFields, NestedPartial, Query } from '../../../types/index.js';\nimport type { RestCommand } from '../../types.js';\n\nexport type CreateTranslationOutput<\n\tSchema,\n\tTQuery extends Query<Schema, Item>,\n\tItem extends object = DirectusTranslation<Schema>,\n> = ApplyQueryFields<Schema, Item, TQuery['fields']>;\n\n/**\n * Create multiple new translation.\n *\n * @param items The translations to create\n * @param query Optional return data query\n *\n * @returns Returns the translation object for the created translation.\n */\nexport const createTranslations =\n\t<Schema, const TQuery extends Query<Schema, DirectusTranslation<Schema>>>(\n\t\titems: NestedPartial<DirectusTranslation<Schema>>[],\n\t\tquery?: TQuery,\n\t): RestCommand<CreateTranslationOutput<Schema, TQuery>[], Schema> =>\n\t() => ({\n\t\tpath: `/translations`,\n\t\tparams: query ?? {},\n\t\tbody: JSON.stringify(items),\n\t\tmethod: 'POST',\n\t});\n\n/**\n * Create a new translation.\n *\n * @param item The translation to create\n * @param query Optional return data query\n *\n * @returns Returns the translation object for the created translation.\n */\nexport const createTranslation =\n\t<Schema, const TQuery extends Query<Schema, DirectusTranslation<Schema>>>(\n\t\titem: NestedPartial<DirectusTranslation<Schema>>,\n\t\tquery?: TQuery,\n\t): RestCommand<CreateTranslationOutput<Schema, TQuery>, Schema> =>\n\t() => ({\n\t\tpath: `/translations`,\n\t\tparams: query ?? {},\n\t\tbody: JSON.stringify(item),\n\t\tmethod: 'POST',\n\t});\n"],"mappings":"AAkBA,MAAa,GAEX,EACA,SAEM,CACN,KAAM,gBACN,OAAQ,GAAS,EAAE,CACnB,KAAM,KAAK,UAAU,EAAM,CAC3B,OAAQ,OACR,EAUW,GAEX,EACA,SAEM,CACN,KAAM,gBACN,OAAQ,GAAS,EAAE,CACnB,KAAM,KAAK,UAAU,EAAK,CAC1B,OAAQ,OACR"}

View File

@@ -0,0 +1,43 @@
/*
* 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.
*/
import * as process from 'process';
let getMachineIdImpl;
export async function getMachineId() {
if (!getMachineIdImpl) {
switch (process.platform) {
case 'darwin':
getMachineIdImpl = (await import('./getMachineId-darwin.js'))
.getMachineId;
break;
case 'linux':
getMachineIdImpl = (await import('./getMachineId-linux.js'))
.getMachineId;
break;
case 'freebsd':
getMachineIdImpl = (await import('./getMachineId-bsd.js')).getMachineId;
break;
case 'win32':
getMachineIdImpl = (await import('./getMachineId-win.js')).getMachineId;
break;
default:
getMachineIdImpl = (await import('./getMachineId-unsupported.js'))
.getMachineId;
break;
}
}
return getMachineIdImpl();
}
//# sourceMappingURL=getMachineId.js.map

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 Axis3d = createLucideIcon("Axis3d", [
["path", { d: "M4 4v16h16", key: "1s015l" }],
["path", { d: "m4 20 7-7", key: "17qe9y" }]
]);
export { Axis3d as default };
//# sourceMappingURL=axis-3d.js.map

View File

@@ -0,0 +1,56 @@
'use client';
import { c as _c } from "react/compiler-runtime";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React, { useId } from 'react';
import { SearchIcon } from '../../../icons/Search/index.js';
import './index.scss';
const baseClass = 'item-search';
export const ItemSearch = t0 => {
const $ = _c(7);
const {
placeholder,
setSearchTerm
} = t0;
const inputId = useId();
const labelId = `${inputId}-label`;
let t1;
if ($[0] !== setSearchTerm) {
t1 = e => {
setSearchTerm(e.target.value);
};
$[0] = setSearchTerm;
$[1] = t1;
} else {
t1 = $[1];
}
const handleChange = t1;
let t2;
if ($[2] !== handleChange || $[3] !== inputId || $[4] !== labelId || $[5] !== placeholder) {
t2 = _jsxs("div", {
className: baseClass,
children: [_jsx("label", {
className: "sr-only",
htmlFor: inputId,
id: labelId,
children: placeholder
}), _jsx("input", {
"aria-labelledby": labelId,
className: `${baseClass}__input`,
id: inputId,
onChange: handleChange,
placeholder,
type: "text"
}), _jsx(SearchIcon, {})]
});
$[2] = handleChange;
$[3] = inputId;
$[4] = labelId;
$[5] = placeholder;
$[6] = t2;
} else {
t2 = $[6];
}
return t2;
};
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,77 @@
import { entityKind } from "../entity.js";
import { TableName } from "../table.utils.js";
class ForeignKeyBuilder {
static [entityKind] = "SQLiteForeignKeyBuilder";
/** @internal */
reference;
/** @internal */
_onUpdate;
/** @internal */
_onDelete;
constructor(config, actions) {
this.reference = () => {
const { name, columns, foreignColumns } = config();
return { name, columns, foreignTable: foreignColumns[0].table, foreignColumns };
};
if (actions) {
this._onUpdate = actions.onUpdate;
this._onDelete = actions.onDelete;
}
}
onUpdate(action) {
this._onUpdate = action;
return this;
}
onDelete(action) {
this._onDelete = action;
return this;
}
/** @internal */
build(table) {
return new ForeignKey(table, this);
}
}
class ForeignKey {
constructor(table, builder) {
this.table = table;
this.reference = builder.reference;
this.onUpdate = builder._onUpdate;
this.onDelete = builder._onDelete;
}
static [entityKind] = "SQLiteForeignKey";
reference;
onUpdate;
onDelete;
getName() {
const { name, columns, foreignColumns } = this.reference();
const columnNames = columns.map((column) => column.name);
const foreignColumnNames = foreignColumns.map((column) => column.name);
const chunks = [
this.table[TableName],
...columnNames,
foreignColumns[0].table[TableName],
...foreignColumnNames
];
return name ?? `${chunks.join("_")}_fk`;
}
}
function foreignKey(config) {
function mappedConfig() {
if (typeof config === "function") {
const { name, columns, foreignColumns } = config();
return {
name,
columns,
foreignColumns
};
}
return config;
}
return new ForeignKeyBuilder(mappedConfig);
}
export {
ForeignKey,
ForeignKeyBuilder,
foreignKey
};
//# sourceMappingURL=foreign-keys.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"strikethrough.js","sources":["../../../src/icons/strikethrough.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Strikethrough\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTYgNEg5YTMgMyAwIDAgMC0yLjgzIDQiIC8+CiAgPHBhdGggZD0iTTE0IDEyYTQgNCAwIDAgMSAwIDhINiIgLz4KICA8bGluZSB4MT0iNCIgeDI9IjIwIiB5MT0iMTIiIHkyPSIxMiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/strikethrough\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 Strikethrough = createLucideIcon('Strikethrough', [\n ['path', { d: 'M16 4H9a3 3 0 0 0-2.83 4', key: '43sutm' }],\n ['path', { d: 'M14 12a4 4 0 0 1 0 8H6', key: 'nlfj13' }],\n ['line', { x1: '4', x2: '20', y1: '12', y2: '12', key: '1e0a9i' }],\n]);\n\nexport default Strikethrough;\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,CAAgB,iBAAiB,eAAiB,CAAA,CAAA,CAAA;AAAA,CAAA,CACtD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA0B,CAAA,CAAA,CAAA,CAAA,CAAA,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,CACvD,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACnE,CAAC,CAAA,CAAA;;"}

View File

@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.441.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const PanelBottomClose = createLucideIcon("PanelBottomClose", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
["path", { d: "M3 15h18", key: "5xshup" }],
["path", { d: "m15 8-3 3-3-3", key: "1oxy1z" }]
]);
export { PanelBottomClose as default };
//# sourceMappingURL=panel-bottom-close.js.map

View File

@@ -0,0 +1,167 @@
"use strict";
exports.localize = void 0;
var _index = require("../../_lib/buildLocalizeFn.js");
// All data for localization are taken from this page
// https://www.unicode.org/cldr/charts/32/summary/id.html
const eraValues = {
narrow: ["SM", "M"],
abbreviated: ["SM", "M"],
wide: ["Sebelum Masehi", "Masehi"],
};
const quarterValues = {
narrow: ["1", "2", "3", "4"],
abbreviated: ["K1", "K2", "K3", "K4"],
wide: ["Kuartal ke-1", "Kuartal ke-2", "Kuartal ke-3", "Kuartal ke-4"],
};
// Note: in Indonesian, the names of days of the week and months are capitalized.
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
// Generally, formatted dates should look like they are in the middle of a sentence,
// e.g. in Spanish language the weekdays and months should be in the lowercase.
const monthValues = {
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
abbreviated: [
"Jan",
"Feb",
"Mar",
"Apr",
"Mei",
"Jun",
"Jul",
"Agt",
"Sep",
"Okt",
"Nov",
"Des",
],
wide: [
"Januari",
"Februari",
"Maret",
"April",
"Mei",
"Juni",
"Juli",
"Agustus",
"September",
"Oktober",
"November",
"Desember",
],
};
const dayValues = {
narrow: ["M", "S", "S", "R", "K", "J", "S"],
short: ["Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"],
abbreviated: ["Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"],
wide: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"],
};
const dayPeriodValues = {
narrow: {
am: "AM",
pm: "PM",
midnight: "tengah malam",
noon: "tengah hari",
morning: "pagi",
afternoon: "siang",
evening: "sore",
night: "malam",
},
abbreviated: {
am: "AM",
pm: "PM",
midnight: "tengah malam",
noon: "tengah hari",
morning: "pagi",
afternoon: "siang",
evening: "sore",
night: "malam",
},
wide: {
am: "AM",
pm: "PM",
midnight: "tengah malam",
noon: "tengah hari",
morning: "pagi",
afternoon: "siang",
evening: "sore",
night: "malam",
},
};
const formattingDayPeriodValues = {
narrow: {
am: "AM",
pm: "PM",
midnight: "tengah malam",
noon: "tengah hari",
morning: "pagi",
afternoon: "siang",
evening: "sore",
night: "malam",
},
abbreviated: {
am: "AM",
pm: "PM",
midnight: "tengah malam",
noon: "tengah hari",
morning: "pagi",
afternoon: "siang",
evening: "sore",
night: "malam",
},
wide: {
am: "AM",
pm: "PM",
midnight: "tengah malam",
noon: "tengah hari",
morning: "pagi",
afternoon: "siang",
evening: "sore",
night: "malam",
},
};
const ordinalNumber = (dirtyNumber, _options) => {
const number = Number(dirtyNumber);
// Can't use "pertama", "kedua" because can't be parsed
return "ke-" + number;
};
const localize = (exports.localize = {
ordinalNumber,
era: (0, _index.buildLocalizeFn)({
values: eraValues,
defaultWidth: "wide",
}),
quarter: (0, _index.buildLocalizeFn)({
values: quarterValues,
defaultWidth: "wide",
argumentCallback: (quarter) => quarter - 1,
}),
month: (0, _index.buildLocalizeFn)({
values: monthValues,
defaultWidth: "wide",
}),
day: (0, _index.buildLocalizeFn)({
values: dayValues,
defaultWidth: "wide",
}),
dayPeriod: (0, _index.buildLocalizeFn)({
values: dayPeriodValues,
defaultWidth: "wide",
formattingValues: formattingDayPeriodValues,
defaultFormattingWidth: "wide",
}),
});

View File

@@ -0,0 +1,554 @@
# Class: MockPool
Extends: `undici.Pool`
A mock Pool class that implements the Pool API and is used by MockAgent to intercept real requests and return mocked responses.
## `new MockPool(origin, [options])`
Arguments:
* **origin** `string` - It should only include the **protocol, hostname, and port**.
* **options** `MockPoolOptions` - It extends the `Pool` options.
Returns: `MockPool`
### Parameter: `MockPoolOptions`
Extends: `PoolOptions`
* **agent** `Agent` - the agent to associate this MockPool with.
### Example - Basic MockPool instantiation
We can use MockAgent to instantiate a MockPool ready to be used to intercept specified requests. It will not do anything until registered as the agent to use and any mock request are registered.
```js
import { MockAgent } from 'undici'
const mockAgent = new MockAgent()
const mockPool = mockAgent.get('http://localhost:3000')
```
## Instance Methods
### `MockPool.intercept(options)`
This method defines the interception rules for matching against requests for a MockPool or MockPool. We can intercept multiple times on a single instance, but each intercept is only used once. For example if you expect to make 2 requests inside a test, you need to call `intercept()` twice. Assuming you use `disableNetConnect()` you will get `MockNotMatchedError` on the second request when you only call `intercept()` once.
When defining interception rules, all the rules must pass for a request to be intercepted. If a request is not intercepted, a real request will be attempted.
| Matcher type | Condition to pass |
|:------------:| -------------------------- |
| `string` | Exact match against string |
| `RegExp` | Regex must pass |
| `Function` | Function must return true |
Arguments:
* **options** `MockPoolInterceptOptions` - Interception options.
Returns: `MockInterceptor` corresponding to the input options.
### Parameter: `MockPoolInterceptOptions`
* **path** `string | RegExp | (path: string) => boolean` - a matcher for the HTTP request path. When a `RegExp` or callback is used, it will match against the request path including all query parameters in alphabetical order. When a `string` is provided, the query parameters can be conveniently specified through the `MockPoolInterceptOptions.query` setting.
* **method** `string | RegExp | (method: string) => boolean` - (optional) - a matcher for the HTTP request method. Defaults to `GET`.
* **body** `string | RegExp | (body: string) => boolean` - (optional) - a matcher for the HTTP request body.
* **headers** `Record<string, string | RegExp | (body: string) => boolean`> - (optional) - a matcher for the HTTP request headers. To be intercepted, a request must match all defined headers. Extra headers not defined here may (or may not) be included in the request and do not affect the interception in any way.
* **query** `Record<string, any> | null` - (optional) - a matcher for the HTTP request query string params. Only applies when a `string` was provided for `MockPoolInterceptOptions.path`.
* **ignoreTrailingSlash** `boolean` - (optional) - set to `true` if the matcher should also match by ignoring potential trailing slashes in `MockPoolInterceptOptions.path`.
### Return: `MockInterceptor`
We can define the behaviour of an intercepted request with the following options.
* **reply** `(statusCode: number, replyData: string | Buffer | object | MockInterceptor.MockResponseDataHandler, responseOptions?: MockResponseOptions) => MockScope` - define a reply for a matching request. You can define the replyData as a callback to read incoming request data. Default for `responseOptions` is `{}`.
* **reply** `(callback: MockInterceptor.MockReplyOptionsCallback) => MockScope` - define a reply for a matching request, allowing dynamic mocking of all reply options rather than just the data.
* **replyWithError** `(error: Error) => MockScope` - define an error for a matching request to throw.
* **defaultReplyHeaders** `(headers: Record<string, string>) => MockInterceptor` - define default headers to be included in subsequent replies. These are in addition to headers on a specific reply.
* **defaultReplyTrailers** `(trailers: Record<string, string>) => MockInterceptor` - define default trailers to be included in subsequent replies. These are in addition to trailers on a specific reply.
* **replyContentLength** `() => MockInterceptor` - define automatically calculated `content-length` headers to be included in subsequent replies.
The reply data of an intercepted request may either be a string, buffer, or JavaScript object. Objects are converted to JSON while strings and buffers are sent as-is.
By default, `reply` and `replyWithError` define the behaviour for the first matching request only. Subsequent requests will not be affected (this can be changed using the returned `MockScope`).
### Parameter: `MockResponseOptions`
* **headers** `Record<string, string>` - headers to be included on the mocked reply.
* **trailers** `Record<string, string>` - trailers to be included on the mocked reply.
### Return: `MockScope`
A `MockScope` is associated with a single `MockInterceptor`. With this, we can configure the default behaviour of an intercepted reply.
* **delay** `(waitInMs: number) => MockScope` - delay the associated reply by a set amount in ms.
* **persist** `() => MockScope` - any matching request will always reply with the defined response indefinitely.
* **times** `(repeatTimes: number) => MockScope` - any matching request will reply with the defined response a fixed amount of times. This is overridden by **persist**.
#### Example - Basic Mocked Request
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
// MockPool
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({ path: '/foo' }).reply(200, 'foo')
const {
statusCode,
body
} = await request('http://localhost:3000/foo')
console.log('response received', statusCode) // response received 200
for await (const data of body) {
console.log('data', data.toString('utf8')) // data foo
}
```
#### Example - Mocked request using reply data callbacks
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/echo',
method: 'GET',
headers: {
'User-Agent': 'undici',
Host: 'example.com'
}
}).reply(200, ({ headers }) => ({ message: headers.get('message') }))
const { statusCode, body, headers } = await request('http://localhost:3000', {
headers: {
message: 'hello world!'
}
})
console.log('response received', statusCode) // response received 200
console.log('headers', headers) // { 'content-type': 'application/json' }
for await (const data of body) {
console.log('data', data.toString('utf8')) // { "message":"hello world!" }
}
```
#### Example - Mocked request using reply options callback
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/echo',
method: 'GET',
headers: {
'User-Agent': 'undici',
Host: 'example.com'
}
}).reply(({ headers }) => ({ statusCode: 200, data: { message: headers.get('message') }})))
const { statusCode, body, headers } = await request('http://localhost:3000', {
headers: {
message: 'hello world!'
}
})
console.log('response received', statusCode) // response received 200
console.log('headers', headers) // { 'content-type': 'application/json' }
for await (const data of body) {
console.log('data', data.toString('utf8')) // { "message":"hello world!" }
}
```
#### Example - Basic Mocked requests with multiple intercepts
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo',
method: 'GET'
}).reply(200, 'foo')
mockPool.intercept({
path: '/hello',
method: 'GET',
}).reply(200, 'hello')
const result1 = await request('http://localhost:3000/foo')
console.log('response received', result1.statusCode) // response received 200
for await (const data of result1.body) {
console.log('data', data.toString('utf8')) // data foo
}
const result2 = await request('http://localhost:3000/hello')
console.log('response received', result2.statusCode) // response received 200
for await (const data of result2.body) {
console.log('data', data.toString('utf8')) // data hello
}
```
#### Example - Mocked request with query body, request headers and response headers and trailers
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo?hello=there&see=ya',
method: 'POST',
body: 'form1=data1&form2=data2',
headers: {
'User-Agent': 'undici',
Host: 'example.com'
}
}).reply(200, { foo: 'bar' }, {
headers: { 'content-type': 'application/json' },
trailers: { 'Content-MD5': 'test' }
})
const {
statusCode,
headers,
trailers,
body
} = await request('http://localhost:3000/foo?hello=there&see=ya', {
method: 'POST',
body: 'form1=data1&form2=data2',
headers: {
foo: 'bar',
'User-Agent': 'undici',
Host: 'example.com'
}
})
console.log('response received', statusCode) // response received 200
console.log('headers', headers) // { 'content-type': 'application/json' }
for await (const data of body) {
console.log('data', data.toString('utf8')) // '{"foo":"bar"}'
}
console.log('trailers', trailers) // { 'content-md5': 'test' }
```
#### Example - Mocked request using different matchers
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo',
method: /^GET$/,
body: (value) => value === 'form=data',
headers: {
'User-Agent': 'undici',
Host: /^example.com$/
}
}).reply(200, 'foo')
const {
statusCode,
body
} = await request('http://localhost:3000/foo', {
method: 'GET',
body: 'form=data',
headers: {
foo: 'bar',
'User-Agent': 'undici',
Host: 'example.com'
}
})
console.log('response received', statusCode) // response received 200
for await (const data of body) {
console.log('data', data.toString('utf8')) // data foo
}
```
#### Example - Mocked request with reply with a defined error
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo',
method: 'GET'
}).replyWithError(new Error('kaboom'))
try {
await request('http://localhost:3000/foo', {
method: 'GET'
})
} catch (error) {
console.error(error) // Error: kaboom
}
```
#### Example - Mocked request with defaultReplyHeaders
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo',
method: 'GET'
}).defaultReplyHeaders({ foo: 'bar' })
.reply(200, 'foo')
const { headers } = await request('http://localhost:3000/foo')
console.log('headers', headers) // headers { foo: 'bar' }
```
#### Example - Mocked request with defaultReplyTrailers
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo',
method: 'GET'
}).defaultReplyTrailers({ foo: 'bar' })
.reply(200, 'foo')
const { trailers } = await request('http://localhost:3000/foo')
console.log('trailers', trailers) // trailers { foo: 'bar' }
```
#### Example - Mocked request with automatic content-length calculation
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo',
method: 'GET'
}).replyContentLength().reply(200, 'foo')
const { headers } = await request('http://localhost:3000/foo')
console.log('headers', headers) // headers { 'content-length': '3' }
```
#### Example - Mocked request with automatic content-length calculation on an object
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo',
method: 'GET'
}).replyContentLength().reply(200, { foo: 'bar' })
const { headers } = await request('http://localhost:3000/foo')
console.log('headers', headers) // headers { 'content-length': '13' }
```
#### Example - Mocked request with persist enabled
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo',
method: 'GET'
}).reply(200, 'foo').persist()
const result1 = await request('http://localhost:3000/foo')
// Will match and return mocked data
const result2 = await request('http://localhost:3000/foo')
// Will match and return mocked data
// Etc
```
#### Example - Mocked request with times enabled
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo',
method: 'GET'
}).reply(200, 'foo').times(2)
const result1 = await request('http://localhost:3000/foo')
// Will match and return mocked data
const result2 = await request('http://localhost:3000/foo')
// Will match and return mocked data
const result3 = await request('http://localhost:3000/foo')
// Will not match and make attempt a real request
```
#### Example - Mocked request with path callback
```js
import { MockAgent, setGlobalDispatcher, request } from 'undici'
import querystring from 'querystring'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
const matchPath = requestPath => {
const [pathname, search] = requestPath.split('?')
const requestQuery = querystring.parse(search)
if (!pathname.startsWith('/foo')) {
return false
}
if (!Object.keys(requestQuery).includes('foo') || requestQuery.foo !== 'bar') {
return false
}
return true
}
mockPool.intercept({
path: matchPath,
method: 'GET'
}).reply(200, 'foo')
const result = await request('http://localhost:3000/foo?foo=bar')
// Will match and return mocked data
```
### `MockPool.close()`
Closes the mock pool and de-registers from associated MockAgent.
Returns: `Promise<void>`
#### Example - clean up after tests are complete
```js
import { MockAgent } from 'undici'
const mockAgent = new MockAgent()
const mockPool = mockAgent.get('http://localhost:3000')
await mockPool.close()
```
### `MockPool.dispatch(options, handlers)`
Implements [`Dispatcher.dispatch(options, handlers)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler).
### `MockPool.request(options[, callback])`
See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback).
#### Example - MockPool request
```js
import { MockAgent } from 'undici'
const mockAgent = new MockAgent()
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo',
method: 'GET',
}).reply(200, 'foo')
const {
statusCode,
body
} = await mockPool.request({
origin: 'http://localhost:3000',
path: '/foo',
method: 'GET'
})
console.log('response received', statusCode) // response received 200
for await (const data of body) {
console.log('data', data.toString('utf8')) // data foo
}
```
### `MockPool.cleanMocks()`
This method cleans up all the prepared mocks.
Returns: `void`

View File

@@ -0,0 +1,10 @@
'use strict';
module.exports = function isArrayish(obj) {
if (!obj) {
return false;
}
return obj instanceof Array || Array.isArray(obj) ||
(obj.length >= 0 && obj.splice instanceof Function);
};

View File

@@ -0,0 +1,13 @@
import { type CompiledMessage } from 'icu-minify/format';
import type { FormatMessage } from './types.js';
/**
* Formats a precompiled ICU message using icu-minify/format.
* This implementation requires messages to be precompiled at build time.
*/
declare function formatMessage(
/** The precompiled ICU message (CompiledMessage from icu-minify) */
...[, message, values, options]: Parameters<FormatMessage<CompiledMessage>>): ReturnType<FormatMessage<CompiledMessage>>;
declare namespace formatMessage {
var raw: boolean;
}
export default formatMessage;

View File

@@ -0,0 +1,55 @@
var test = require('tape');
var commondir = require('../');
test('common', function (t) {
t.equal(
commondir([ '/foo', '//foo/bar', '/foo//bar/baz' ]),
'/foo'
);
t.equal(
commondir([ '/a/b/c', '/a/b', '/a/b/c/d/e' ]),
'/a/b'
);
t.equal(
commondir([ '/x/y/z/w', '/xy/z', '/x/y/z' ]),
'/'
);
t.equal(
commondir([ 'X:\\foo', 'X:\\\\foo\\bar', 'X://foo/bar/baz' ]),
'X:/foo'
);
t.equal(
commondir([ 'X:\\a\\b\\c', 'X:\\a\\b', 'X:\\a\\b\\c\\d\\e' ]),
'X:/a/b'
);
t.equal(
commondir([ 'X:\\x\\y\\z\\w', '\\\\xy\\z', '\\x\\y\\z' ]),
'/'
);
t.throws(function () {
commondir([ '/x/y/z/w', 'qrs', '/x/y/z' ]);
});
t.end();
});
test('base', function (t) {
t.equal(
commondir('/foo/bar', [ 'baz', './quux', '../bar/bazzy' ]),
'/foo/bar'
);
t.equal(
commondir('/a/b', [ 'c', '../b/.', '../../a/b/e' ]),
'/a/b'
);
t.equal(
commondir('/a/b/c', [ '..', '../d', '../../a/z/e' ]),
'/a'
);
t.equal(
commondir('/foo/bar', [ 'baz', '.\\quux', '..\\bar\\bazzy' ]),
'/foo/bar'
);
// Tests including X:\ basedirs must wait until path.resolve supports
// Windows-style paths, starting in Node.js v0.5.X
t.end();
});

View File

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

View File

@@ -0,0 +1,49 @@
@import '../../scss/styles.scss';
@layer payload-default {
.combobox {
&__content {
display: flex;
flex-direction: column;
}
&__search-wrapper {
padding-top: var(--popup-padding);
padding-bottom: calc(var(--base) * 0.5);
border-bottom: 1px solid var(--theme-elevation-150);
margin-bottom: calc(var(--base) * 0.5);
&--no-results {
border-bottom: none;
margin-bottom: 0;
}
}
&__search-input {
width: 100%;
background: var(--theme-elevation-50);
color: var(--theme-text);
border: none;
border-radius: var(--style-radius-s);
padding: calc(var(--base) * 0.25) calc(var(--base) * 0.5);
outline: none;
box-shadow: none;
&::placeholder {
color: var(--theme-elevation-400);
}
&:focus,
&:focus-visible {
background: var(--theme-elevation-100);
outline: none;
border: none;
box-shadow: none;
}
}
&__entry {
cursor: pointer;
}
}
}

View File

@@ -0,0 +1,53 @@
var baseClone = require('./_baseClone'),
baseIteratee = require('./_baseIteratee');
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1;
/**
* Creates a function that invokes `func` with the arguments of the created
* function. If `func` is a property name, the created function returns the
* property value for a given element. If `func` is an array or object, the
* created function returns `true` for elements that contain the equivalent
* source properties, otherwise it returns `false`.
*
* @static
* @since 4.0.0
* @memberOf _
* @category Util
* @param {*} [func=_.identity] The value to convert to a callback.
* @returns {Function} Returns the callback.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* // The `_.matches` iteratee shorthand.
* _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
* // => [{ 'user': 'barney', 'age': 36, 'active': true }]
*
* // The `_.matchesProperty` iteratee shorthand.
* _.filter(users, _.iteratee(['user', 'fred']));
* // => [{ 'user': 'fred', 'age': 40 }]
*
* // The `_.property` iteratee shorthand.
* _.map(users, _.iteratee('user'));
* // => ['barney', 'fred']
*
* // Create custom iteratee shorthands.
* _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
* return !_.isRegExp(func) ? iteratee(func) : function(string) {
* return func.test(string);
* };
* });
*
* _.filter(['abc', 'def'], /ef/);
* // => ['def']
*/
function iteratee(func) {
return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
}
module.exports = iteratee;

View File

@@ -0,0 +1,79 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "NIL", {
enumerable: true,
get: function () {
return _nil.default;
}
});
Object.defineProperty(exports, "parse", {
enumerable: true,
get: function () {
return _parse.default;
}
});
Object.defineProperty(exports, "stringify", {
enumerable: true,
get: function () {
return _stringify.default;
}
});
Object.defineProperty(exports, "v1", {
enumerable: true,
get: function () {
return _v.default;
}
});
Object.defineProperty(exports, "v3", {
enumerable: true,
get: function () {
return _v2.default;
}
});
Object.defineProperty(exports, "v4", {
enumerable: true,
get: function () {
return _v3.default;
}
});
Object.defineProperty(exports, "v5", {
enumerable: true,
get: function () {
return _v4.default;
}
});
Object.defineProperty(exports, "validate", {
enumerable: true,
get: function () {
return _validate.default;
}
});
Object.defineProperty(exports, "version", {
enumerable: true,
get: function () {
return _version.default;
}
});
var _v = _interopRequireDefault(require("./v1.js"));
var _v2 = _interopRequireDefault(require("./v3.js"));
var _v3 = _interopRequireDefault(require("./v4.js"));
var _v4 = _interopRequireDefault(require("./v5.js"));
var _nil = _interopRequireDefault(require("./nil.js"));
var _version = _interopRequireDefault(require("./version.js"));
var _validate = _interopRequireDefault(require("./validate.js"));
var _stringify = _interopRequireDefault(require("./stringify.js"));
var _parse = _interopRequireDefault(require("./parse.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

View File

@@ -0,0 +1,7 @@
var _typeof = require("./typeof.js")["default"];
var toPrimitive = require("./toPrimitive.js");
function toPropertyKey(t) {
var i = toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;

View File

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

View File

@@ -0,0 +1,451 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors, Aspecto
*
* 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.KafkaJsInstrumentation = void 0;
const api_1 = require("@opentelemetry/api");
const instrumentation_1 = require("@opentelemetry/instrumentation");
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
const internal_types_1 = require("./internal-types");
const propagator_1 = require("./propagator");
const semconv_1 = require("./semconv");
/** @knipignore */
const version_1 = require("./version");
function prepareCounter(meter, value, attributes) {
return (errorType) => {
meter.add(value, {
...attributes,
...(errorType ? { [semantic_conventions_1.ATTR_ERROR_TYPE]: errorType } : {}),
});
};
}
function prepareDurationHistogram(meter, value, attributes) {
return (errorType) => {
meter.record((Date.now() - value) / 1000, {
...attributes,
...(errorType ? { [semantic_conventions_1.ATTR_ERROR_TYPE]: errorType } : {}),
});
};
}
const HISTOGRAM_BUCKET_BOUNDARIES = [
0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10,
];
class KafkaJsInstrumentation extends instrumentation_1.InstrumentationBase {
constructor(config = {}) {
super(version_1.PACKAGE_NAME, version_1.PACKAGE_VERSION, config);
}
_updateMetricInstruments() {
this._clientDuration = this.meter.createHistogram(semconv_1.METRIC_MESSAGING_CLIENT_OPERATION_DURATION, { advice: { explicitBucketBoundaries: HISTOGRAM_BUCKET_BOUNDARIES } });
this._sentMessages = this.meter.createCounter(semconv_1.METRIC_MESSAGING_CLIENT_SENT_MESSAGES);
this._consumedMessages = this.meter.createCounter(semconv_1.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES);
this._processDuration = this.meter.createHistogram(semconv_1.METRIC_MESSAGING_PROCESS_DURATION, { advice: { explicitBucketBoundaries: HISTOGRAM_BUCKET_BOUNDARIES } });
}
init() {
const unpatch = (moduleExports) => {
if ((0, instrumentation_1.isWrapped)(moduleExports?.Kafka?.prototype.producer)) {
this._unwrap(moduleExports.Kafka.prototype, 'producer');
}
if ((0, instrumentation_1.isWrapped)(moduleExports?.Kafka?.prototype.consumer)) {
this._unwrap(moduleExports.Kafka.prototype, 'consumer');
}
};
const module = new instrumentation_1.InstrumentationNodeModuleDefinition('kafkajs', ['>=0.3.0 <3'], (moduleExports) => {
unpatch(moduleExports);
this._wrap(moduleExports?.Kafka?.prototype, 'producer', this._getProducerPatch());
this._wrap(moduleExports?.Kafka?.prototype, 'consumer', this._getConsumerPatch());
return moduleExports;
}, unpatch);
return module;
}
_getConsumerPatch() {
const instrumentation = this;
return (original) => {
return function consumer(...args) {
const newConsumer = original.apply(this, args);
if ((0, instrumentation_1.isWrapped)(newConsumer.run)) {
instrumentation._unwrap(newConsumer, 'run');
}
instrumentation._wrap(newConsumer, 'run', instrumentation._getConsumerRunPatch());
instrumentation._setKafkaEventListeners(newConsumer);
return newConsumer;
};
};
}
_setKafkaEventListeners(kafkaObj) {
if (kafkaObj[internal_types_1.EVENT_LISTENERS_SET])
return;
// The REQUEST Consumer event was added in kafkajs@1.5.0.
if (kafkaObj.events?.REQUEST) {
kafkaObj.on(kafkaObj.events.REQUEST, this._recordClientDurationMetric.bind(this));
}
kafkaObj[internal_types_1.EVENT_LISTENERS_SET] = true;
}
_recordClientDurationMetric(event) {
const [address, port] = event.payload.broker.split(':');
this._clientDuration.record(event.payload.duration / 1000, {
[semconv_1.ATTR_MESSAGING_SYSTEM]: semconv_1.MESSAGING_SYSTEM_VALUE_KAFKA,
[semconv_1.ATTR_MESSAGING_OPERATION_NAME]: `${event.payload.apiName}`,
[semantic_conventions_1.ATTR_SERVER_ADDRESS]: address,
[semantic_conventions_1.ATTR_SERVER_PORT]: Number.parseInt(port, 10),
});
}
_getProducerPatch() {
const instrumentation = this;
return (original) => {
return function consumer(...args) {
const newProducer = original.apply(this, args);
if ((0, instrumentation_1.isWrapped)(newProducer.sendBatch)) {
instrumentation._unwrap(newProducer, 'sendBatch');
}
instrumentation._wrap(newProducer, 'sendBatch', instrumentation._getSendBatchPatch());
if ((0, instrumentation_1.isWrapped)(newProducer.send)) {
instrumentation._unwrap(newProducer, 'send');
}
instrumentation._wrap(newProducer, 'send', instrumentation._getSendPatch());
if ((0, instrumentation_1.isWrapped)(newProducer.transaction)) {
instrumentation._unwrap(newProducer, 'transaction');
}
instrumentation._wrap(newProducer, 'transaction', instrumentation._getProducerTransactionPatch());
instrumentation._setKafkaEventListeners(newProducer);
return newProducer;
};
};
}
_getConsumerRunPatch() {
const instrumentation = this;
return (original) => {
return function run(...args) {
const config = args[0];
if (config?.eachMessage) {
if ((0, instrumentation_1.isWrapped)(config.eachMessage)) {
instrumentation._unwrap(config, 'eachMessage');
}
instrumentation._wrap(config, 'eachMessage', instrumentation._getConsumerEachMessagePatch());
}
if (config?.eachBatch) {
if ((0, instrumentation_1.isWrapped)(config.eachBatch)) {
instrumentation._unwrap(config, 'eachBatch');
}
instrumentation._wrap(config, 'eachBatch', instrumentation._getConsumerEachBatchPatch());
}
return original.call(this, config);
};
};
}
_getConsumerEachMessagePatch() {
const instrumentation = this;
return (original) => {
return function eachMessage(...args) {
const payload = args[0];
const propagatedContext = api_1.propagation.extract(api_1.ROOT_CONTEXT, payload.message.headers, propagator_1.bufferTextMapGetter);
const span = instrumentation._startConsumerSpan({
topic: payload.topic,
message: payload.message,
operationType: semconv_1.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,
ctx: propagatedContext,
attributes: {
[semconv_1.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),
},
});
const pendingMetrics = [
prepareDurationHistogram(instrumentation._processDuration, Date.now(), {
[semconv_1.ATTR_MESSAGING_SYSTEM]: semconv_1.MESSAGING_SYSTEM_VALUE_KAFKA,
[semconv_1.ATTR_MESSAGING_OPERATION_NAME]: 'process',
[semconv_1.ATTR_MESSAGING_DESTINATION_NAME]: payload.topic,
[semconv_1.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),
}),
prepareCounter(instrumentation._consumedMessages, 1, {
[semconv_1.ATTR_MESSAGING_SYSTEM]: semconv_1.MESSAGING_SYSTEM_VALUE_KAFKA,
[semconv_1.ATTR_MESSAGING_OPERATION_NAME]: 'process',
[semconv_1.ATTR_MESSAGING_DESTINATION_NAME]: payload.topic,
[semconv_1.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),
}),
];
const eachMessagePromise = api_1.context.with(api_1.trace.setSpan(propagatedContext, span), () => {
return original.apply(this, args);
});
return instrumentation._endSpansOnPromise([span], pendingMetrics, eachMessagePromise);
};
};
}
_getConsumerEachBatchPatch() {
return (original) => {
const instrumentation = this;
return function eachBatch(...args) {
const payload = args[0];
// https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#topic-with-multiple-consumers
const receivingSpan = instrumentation._startConsumerSpan({
topic: payload.batch.topic,
message: undefined,
operationType: semconv_1.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,
ctx: api_1.ROOT_CONTEXT,
attributes: {
[semconv_1.ATTR_MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,
[semconv_1.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),
},
});
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), receivingSpan), () => {
const startTime = Date.now();
const spans = [];
const pendingMetrics = [
prepareCounter(instrumentation._consumedMessages, payload.batch.messages.length, {
[semconv_1.ATTR_MESSAGING_SYSTEM]: semconv_1.MESSAGING_SYSTEM_VALUE_KAFKA,
[semconv_1.ATTR_MESSAGING_OPERATION_NAME]: 'process',
[semconv_1.ATTR_MESSAGING_DESTINATION_NAME]: payload.batch.topic,
[semconv_1.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),
}),
];
payload.batch.messages.forEach(message => {
const propagatedContext = api_1.propagation.extract(api_1.ROOT_CONTEXT, message.headers, propagator_1.bufferTextMapGetter);
const spanContext = api_1.trace
.getSpan(propagatedContext)
?.spanContext();
let origSpanLink;
if (spanContext) {
origSpanLink = {
context: spanContext,
};
}
spans.push(instrumentation._startConsumerSpan({
topic: payload.batch.topic,
message,
operationType: semconv_1.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,
link: origSpanLink,
attributes: {
[semconv_1.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),
},
}));
pendingMetrics.push(prepareDurationHistogram(instrumentation._processDuration, startTime, {
[semconv_1.ATTR_MESSAGING_SYSTEM]: semconv_1.MESSAGING_SYSTEM_VALUE_KAFKA,
[semconv_1.ATTR_MESSAGING_OPERATION_NAME]: 'process',
[semconv_1.ATTR_MESSAGING_DESTINATION_NAME]: payload.batch.topic,
[semconv_1.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),
}));
});
const batchMessagePromise = original.apply(this, args);
spans.unshift(receivingSpan);
return instrumentation._endSpansOnPromise(spans, pendingMetrics, batchMessagePromise);
});
};
};
}
_getProducerTransactionPatch() {
const instrumentation = this;
return (original) => {
return function transaction(...args) {
const transactionSpan = instrumentation.tracer.startSpan('transaction');
const transactionPromise = original.apply(this, args);
transactionPromise
.then((transaction) => {
const originalSend = transaction.send;
transaction.send = function send(...args) {
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), transactionSpan), () => {
const patched = instrumentation._getSendPatch()(originalSend);
return patched.apply(this, args).catch(err => {
transactionSpan.setStatus({
code: api_1.SpanStatusCode.ERROR,
message: err?.message,
});
transactionSpan.recordException(err);
throw err;
});
});
};
const originalSendBatch = transaction.sendBatch;
transaction.sendBatch = function sendBatch(...args) {
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), transactionSpan), () => {
const patched = instrumentation._getSendBatchPatch()(originalSendBatch);
return patched.apply(this, args).catch(err => {
transactionSpan.setStatus({
code: api_1.SpanStatusCode.ERROR,
message: err?.message,
});
transactionSpan.recordException(err);
throw err;
});
});
};
const originalCommit = transaction.commit;
transaction.commit = function commit(...args) {
const originCommitPromise = originalCommit
.apply(this, args)
.then(() => {
transactionSpan.setStatus({ code: api_1.SpanStatusCode.OK });
});
return instrumentation._endSpansOnPromise([transactionSpan], [], originCommitPromise);
};
const originalAbort = transaction.abort;
transaction.abort = function abort(...args) {
const originAbortPromise = originalAbort.apply(this, args);
return instrumentation._endSpansOnPromise([transactionSpan], [], originAbortPromise);
};
})
.catch(err => {
transactionSpan.setStatus({
code: api_1.SpanStatusCode.ERROR,
message: err?.message,
});
transactionSpan.recordException(err);
transactionSpan.end();
});
return transactionPromise;
};
};
}
_getSendBatchPatch() {
const instrumentation = this;
return (original) => {
return function sendBatch(...args) {
const batch = args[0];
const messages = batch.topicMessages || [];
const spans = [];
const pendingMetrics = [];
messages.forEach(topicMessage => {
topicMessage.messages.forEach(message => {
spans.push(instrumentation._startProducerSpan(topicMessage.topic, message));
pendingMetrics.push(prepareCounter(instrumentation._sentMessages, 1, {
[semconv_1.ATTR_MESSAGING_SYSTEM]: semconv_1.MESSAGING_SYSTEM_VALUE_KAFKA,
[semconv_1.ATTR_MESSAGING_OPERATION_NAME]: 'send',
[semconv_1.ATTR_MESSAGING_DESTINATION_NAME]: topicMessage.topic,
...(message.partition !== undefined
? {
[semconv_1.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(message.partition),
}
: {}),
}));
});
});
const origSendResult = original.apply(this, args);
return instrumentation._endSpansOnPromise(spans, pendingMetrics, origSendResult);
};
};
}
_getSendPatch() {
const instrumentation = this;
return (original) => {
return function send(...args) {
const record = args[0];
const spans = record.messages.map(message => {
return instrumentation._startProducerSpan(record.topic, message);
});
const pendingMetrics = record.messages.map(m => prepareCounter(instrumentation._sentMessages, 1, {
[semconv_1.ATTR_MESSAGING_SYSTEM]: semconv_1.MESSAGING_SYSTEM_VALUE_KAFKA,
[semconv_1.ATTR_MESSAGING_OPERATION_NAME]: 'send',
[semconv_1.ATTR_MESSAGING_DESTINATION_NAME]: record.topic,
...(m.partition !== undefined
? {
[semconv_1.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(m.partition),
}
: {}),
}));
const origSendResult = original.apply(this, args);
return instrumentation._endSpansOnPromise(spans, pendingMetrics, origSendResult);
};
};
}
_endSpansOnPromise(spans, pendingMetrics, sendPromise) {
return Promise.resolve(sendPromise)
.then(result => {
pendingMetrics.forEach(m => m());
return result;
})
.catch(reason => {
let errorMessage;
let errorType = semantic_conventions_1.ERROR_TYPE_VALUE_OTHER;
if (typeof reason === 'string' || reason === undefined) {
errorMessage = reason;
}
else if (typeof reason === 'object' &&
Object.prototype.hasOwnProperty.call(reason, 'message')) {
errorMessage = reason.message;
errorType = reason.constructor.name;
}
pendingMetrics.forEach(m => m(errorType));
spans.forEach(span => {
span.setAttribute(semantic_conventions_1.ATTR_ERROR_TYPE, errorType);
span.setStatus({
code: api_1.SpanStatusCode.ERROR,
message: errorMessage,
});
});
throw reason;
})
.finally(() => {
spans.forEach(span => span.end());
});
}
_startConsumerSpan({ topic, message, operationType, ctx, link, attributes, }) {
const operationName = operationType === semconv_1.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE
? 'poll' // for batch processing spans
: operationType; // for individual message processing spans
const span = this.tracer.startSpan(`${operationName} ${topic}`, {
kind: operationType === semconv_1.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE
? api_1.SpanKind.CLIENT
: api_1.SpanKind.CONSUMER,
attributes: {
...attributes,
[semconv_1.ATTR_MESSAGING_SYSTEM]: semconv_1.MESSAGING_SYSTEM_VALUE_KAFKA,
[semconv_1.ATTR_MESSAGING_DESTINATION_NAME]: topic,
[semconv_1.ATTR_MESSAGING_OPERATION_TYPE]: operationType,
[semconv_1.ATTR_MESSAGING_OPERATION_NAME]: operationName,
[semconv_1.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message?.key
? String(message.key)
: undefined,
[semconv_1.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message?.key && message.value === null ? true : undefined,
[semconv_1.ATTR_MESSAGING_KAFKA_OFFSET]: message?.offset,
},
links: link ? [link] : [],
}, ctx);
const { consumerHook } = this.getConfig();
if (consumerHook && message) {
(0, instrumentation_1.safeExecuteInTheMiddle)(() => consumerHook(span, { topic, message }), e => {
if (e)
this._diag.error('consumerHook error', e);
}, true);
}
return span;
}
_startProducerSpan(topic, message) {
const span = this.tracer.startSpan(`send ${topic}`, {
kind: api_1.SpanKind.PRODUCER,
attributes: {
[semconv_1.ATTR_MESSAGING_SYSTEM]: semconv_1.MESSAGING_SYSTEM_VALUE_KAFKA,
[semconv_1.ATTR_MESSAGING_DESTINATION_NAME]: topic,
[semconv_1.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message.key
? String(message.key)
: undefined,
[semconv_1.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message.key && message.value === null ? true : undefined,
[semconv_1.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: message.partition !== undefined
? String(message.partition)
: undefined,
[semconv_1.ATTR_MESSAGING_OPERATION_NAME]: 'send',
[semconv_1.ATTR_MESSAGING_OPERATION_TYPE]: semconv_1.MESSAGING_OPERATION_TYPE_VALUE_SEND,
},
});
message.headers = message.headers ?? {};
api_1.propagation.inject(api_1.trace.setSpan(api_1.context.active(), span), message.headers);
const { producerHook } = this.getConfig();
if (producerHook) {
(0, instrumentation_1.safeExecuteInTheMiddle)(() => producerHook(span, { topic, message }), e => {
if (e)
this._diag.error('producerHook error', e);
}, true);
}
return span;
}
}
exports.KafkaJsInstrumentation = KafkaJsInstrumentation;
//# sourceMappingURL=instrumentation.js.map

View File

@@ -0,0 +1,44 @@
import { normalizeDates } from "./_lib/normalizeDates.js";
import { getQuarter } from "./getQuarter.js";
/**
* The {@link differenceInCalendarQuarters} function options.
*/
/**
* @name differenceInCalendarQuarters
* @category Quarter Helpers
* @summary Get the number of calendar quarters between the given dates.
*
* @description
* Get the number of calendar quarters between the given dates.
*
* @param laterDate - The later date
* @param earlierDate - The earlier date
* @param options - An object with options
*
* @returns The number of calendar quarters
*
* @example
* // How many calendar quarters are between 31 December 2013 and 2 July 2014?
* const result = differenceInCalendarQuarters(
* new Date(2014, 6, 2),
* new Date(2013, 11, 31)
* )
* //=> 3
*/
export function differenceInCalendarQuarters(laterDate, earlierDate, options) {
const [laterDate_, earlierDate_] = normalizeDates(
options?.in,
laterDate,
earlierDate,
);
const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
const quartersDiff = getQuarter(laterDate_) - getQuarter(earlierDate_);
return yearsDiff * 4 + quartersDiff;
}
// Fallback for modularized imports:
export default differenceInCalendarQuarters;

View File

@@ -0,0 +1,152 @@
import type { Maybe } from '../jsutils/Maybe';
import type { ASTNode } from '../language/ast';
import type { SourceLocation } from '../language/location';
import type { Source } from '../language/source';
/**
* Custom extensions
*
* @remarks
* Use a unique identifier name for your extension, for example the name of
* your library or project. Do not use a shortened identifier as this increases
* the risk of conflicts. We recommend you add at most one extension field,
* an object which can contain all the values you need.
*/
export interface GraphQLErrorExtensions {
[attributeName: string]: unknown;
}
/**
* Custom formatted extensions
*
* @remarks
* Use a unique identifier name for your extension, for example the name of
* your library or project. Do not use a shortened identifier as this increases
* the risk of conflicts. We recommend you add at most one extension field,
* an object which can contain all the values you need.
*/
export interface GraphQLFormattedErrorExtensions {
[attributeName: string]: unknown;
}
export interface GraphQLErrorOptions {
nodes?: ReadonlyArray<ASTNode> | ASTNode | null;
source?: Maybe<Source>;
positions?: Maybe<ReadonlyArray<number>>;
path?: Maybe<ReadonlyArray<string | number>>;
originalError?: Maybe<
Error & {
readonly extensions?: unknown;
}
>;
extensions?: Maybe<GraphQLErrorExtensions>;
}
/**
* A GraphQLError describes an Error found during the parse, validate, or
* execute phases of performing a GraphQL operation. In addition to a message
* and stack trace, it also includes information about the locations in a
* GraphQL document and/or execution result that correspond to the Error.
*/
export declare class GraphQLError extends Error {
/**
* An array of `{ line, column }` locations within the source GraphQL document
* which correspond to this error.
*
* Errors during validation often contain multiple locations, for example to
* point out two things with the same name. Errors during execution include a
* single location, the field which produced the error.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
readonly locations: ReadonlyArray<SourceLocation> | undefined;
/**
* An array describing the JSON-path into the execution response which
* corresponds to this error. Only included for errors during execution.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
readonly path: ReadonlyArray<string | number> | undefined;
/**
* An array of GraphQL AST Nodes corresponding to this error.
*/
readonly nodes: ReadonlyArray<ASTNode> | undefined;
/**
* The source GraphQL document for the first location of this error.
*
* Note that if this Error represents more than one node, the source may not
* represent nodes after the first node.
*/
readonly source: Source | undefined;
/**
* An array of character offsets within the source GraphQL document
* which correspond to this error.
*/
readonly positions: ReadonlyArray<number> | undefined;
/**
* The original error thrown from a field resolver during execution.
*/
readonly originalError: Error | undefined;
/**
* Extension fields to add to the formatted error.
*/
readonly extensions: GraphQLErrorExtensions;
constructor(message: string, options?: GraphQLErrorOptions);
/**
* @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
*/
constructor(
message: string,
nodes?: ReadonlyArray<ASTNode> | ASTNode | null,
source?: Maybe<Source>,
positions?: Maybe<ReadonlyArray<number>>,
path?: Maybe<ReadonlyArray<string | number>>,
originalError?: Maybe<
Error & {
readonly extensions?: unknown;
}
>,
extensions?: Maybe<GraphQLErrorExtensions>,
);
get [Symbol.toStringTag](): string;
toString(): string;
toJSON(): GraphQLFormattedError;
}
/**
* See: https://spec.graphql.org/draft/#sec-Errors
*/
export interface GraphQLFormattedError {
/**
* A short, human-readable summary of the problem that **SHOULD NOT** change
* from occurrence to occurrence of the problem, except for purposes of
* localization.
*/
readonly message: string;
/**
* If an error can be associated to a particular point in the requested
* GraphQL document, it should contain a list of locations.
*/
readonly locations?: ReadonlyArray<SourceLocation>;
/**
* If an error can be associated to a particular field in the GraphQL result,
* it _must_ contain an entry with the key `path` that details the path of
* the response field which experienced the error. This allows clients to
* identify whether a null result is intentional or caused by a runtime error.
*/
readonly path?: ReadonlyArray<string | number>;
/**
* Reserved for implementors to extend the protocol however they see fit,
* and hence there are no additional restrictions on its contents.
*/
readonly extensions?: GraphQLFormattedErrorExtensions;
}
/**
* Prints a GraphQLError to a string, representing useful location information
* about the error's position in the source.
*
* @deprecated Please use `error.toString` instead. Will be removed in v17
*/
export declare function printError(error: GraphQLError): string;
/**
* Given a GraphQLError, format it according to the rules described by the
* Response Format, Errors section of the GraphQL Specification.
*
* @deprecated Please use `error.toJSON` instead. Will be removed in v17
*/
export declare function formatError(error: GraphQLError): GraphQLFormattedError;

View File

@@ -0,0 +1,3 @@
export { az } from '@payloadcms/translations/languages/az';
//# sourceMappingURL=az.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/pg-core/utils/index.ts"],"sourcesContent":["export * from './array.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,uBAAd;","names":[]}

View File

@@ -0,0 +1,36 @@
/**
* 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 { MenuRenderFn, MenuResolution } from './shared/LexicalMenu';
import type { JSX } from 'react';
import { CommandListenerPriority, LexicalNode } from 'lexical';
import { MutableRefObject, ReactPortal } from 'react';
import { MenuOption } from './shared/LexicalMenu';
export type ContextMenuRenderFn<TOption extends MenuOption> = (anchorElementRef: MutableRefObject<HTMLElement | null>, itemProps: {
selectedIndex: number | null;
selectOptionAndCleanUp: (option: TOption) => void;
setHighlightedIndex: (index: number) => void;
options: Array<TOption>;
}, menuProps: {
setMenuRef: (element: HTMLElement | null) => void;
}) => ReactPortal | JSX.Element | null;
export type LexicalContextMenuPluginProps<TOption extends MenuOption> = {
onSelectOption: (option: TOption, textNodeContainingQuery: LexicalNode | null, closeMenu: () => void, matchingString: string) => void;
options: Array<TOption>;
onClose?: () => void;
onWillOpen?: (event: MouseEvent) => void;
onOpen?: (resolution: MenuResolution) => void;
menuRenderFn: ContextMenuRenderFn<TOption>;
anchorClassName?: string;
commandPriority?: CommandListenerPriority;
parent?: HTMLElement;
};
/**
* @deprecated Use LexicalNodeContextMenuPlugin instead.
*/
export declare function LexicalContextMenuPlugin<TOption extends MenuOption>({ options, onWillOpen, onClose, onOpen, onSelectOption, menuRenderFn: contextMenuRenderFn, anchorClassName, commandPriority, parent, }: LexicalContextMenuPluginProps<TOption>): JSX.Element | null;
export { MenuOption, MenuRenderFn, MenuResolution };

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 Lasso = createLucideIcon("Lasso", [
["path", { d: "M7 22a5 5 0 0 1-2-4", key: "umushi" }],
[
"path",
{
d: "M3.3 14A6.8 6.8 0 0 1 2 10c0-4.4 4.5-8 10-8s10 3.6 10 8-4.5 8-10 8a12 12 0 0 1-5-1",
key: "146dds"
}
],
["path", { d: "M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z", key: "bq3ynw" }]
]);
export { Lasso as default };
//# sourceMappingURL=lasso.js.map

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Version/SelectLocales/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAClE,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,cAAc,EAAE,CAAA;CAAE,KAAK,IAAI,CAAA;AAClF,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,kBAAkB,EAAE,OAAO,CAAA;IAC3B,QAAQ,EAAE,sBAAsB,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAyBzC,CAAA"}

View File

@@ -0,0 +1,4 @@
function _identity(t) {
return t;
}
module.exports = _identity, module.exports.__esModule = true, module.exports["default"] = module.exports;

View File

@@ -0,0 +1 @@
{"version":3,"file":"languages.js","sources":["../../../src/icons/languages.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Languages\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtNSA4IDYgNiIgLz4KICA8cGF0aCBkPSJtNCAxNCA2LTYgMi0zIiAvPgogIDxwYXRoIGQ9Ik0yIDVoMTIiIC8+CiAgPHBhdGggZD0iTTcgMmgxIiAvPgogIDxwYXRoIGQ9Im0yMiAyMi01LTEwLTUgMTAiIC8+CiAgPHBhdGggZD0iTTE0IDE4aDYiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/languages\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 Languages = createLucideIcon('Languages', [\n ['path', { d: 'm5 8 6 6', key: '1wu5hv' }],\n ['path', { d: 'm4 14 6-6 2-3', key: '1k1g8d' }],\n ['path', { d: 'M2 5h12', key: 'or177f' }],\n ['path', { d: 'M7 2h1', key: '1t2jsx' }],\n ['path', { d: 'm22 22-5-10-5 10', key: 'don7ne' }],\n ['path', { d: 'M14 18h6', key: '1m8k6r' }],\n]);\n\nexport default Languages;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,iBAAiB,WAAa,CAAA,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,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,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,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,CAAoB,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,CACjD,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,7 @@
import REGEX from './regex.js';
function validate(uuid) {
return typeof uuid === 'string' && REGEX.test(uuid);
}
export default validate;

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../../src/index.server.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}

View File

@@ -0,0 +1,77 @@
"use strict";
exports.areIntervalsOverlapping = areIntervalsOverlapping;
var _index = require("./toDate.js");
/**
* The {@link areIntervalsOverlapping} function options.
*/
/**
* @name areIntervalsOverlapping
* @category Interval Helpers
* @summary Is the given time interval overlapping with another time interval?
*
* @description
* Is the given time interval overlapping with another time interval? Adjacent intervals do not count as overlapping unless `inclusive` is set to `true`.
*
* @param intervalLeft - The first interval to compare.
* @param intervalRight - The second interval to compare.
* @param options - The object with options
*
* @returns Whether the time intervals are overlapping
*
* @example
* // For overlapping time intervals:
* areIntervalsOverlapping(
* { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
* { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) }
* )
* //=> true
*
* @example
* // For non-overlapping time intervals:
* areIntervalsOverlapping(
* { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
* { start: new Date(2014, 0, 21), end: new Date(2014, 0, 22) }
* )
* //=> false
*
* @example
* // For adjacent time intervals:
* areIntervalsOverlapping(
* { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
* { start: new Date(2014, 0, 20), end: new Date(2014, 0, 30) }
* )
* //=> false
*
* @example
* // Using the inclusive option:
* areIntervalsOverlapping(
* { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
* { start: new Date(2014, 0, 20), end: new Date(2014, 0, 24) }
* )
* //=> false
*
* @example
* areIntervalsOverlapping(
* { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
* { start: new Date(2014, 0, 20), end: new Date(2014, 0, 24) },
* { inclusive: true }
* )
* //=> true
*/
function areIntervalsOverlapping(intervalLeft, intervalRight, options) {
const [leftStartTime, leftEndTime] = [
+(0, _index.toDate)(intervalLeft.start),
+(0, _index.toDate)(intervalLeft.end),
].sort((a, b) => a - b);
const [rightStartTime, rightEndTime] = [
+(0, _index.toDate)(intervalRight.start),
+(0, _index.toDate)(intervalRight.end),
].sort((a, b) => a - b);
if (options?.inclusive)
return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime;
return leftStartTime < rightEndTime && rightStartTime < leftEndTime;
}

View File

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

View File

@@ -0,0 +1,17 @@
export type XOrds = 'e' | 'w';
export type YOrds = 'n' | 's';
export type XYOrds = 'nw' | 'ne' | 'se' | 'sw';
export type Ords = XOrds | YOrds | XYOrds;
export interface Crop {
x: number;
y: number;
width: number;
height: number;
unit: 'px' | '%';
}
export interface PixelCrop extends Crop {
unit: 'px';
}
export interface PercentCrop extends Crop {
unit: '%';
}

View File

@@ -0,0 +1,4 @@
{
"main": "../../cjs/_async_generator.cjs",
"module": "../../esm/_async_generator.js"
}

View File

@@ -0,0 +1,18 @@
import { entityKind } from "../entity.js";
import type { SQL } from "../sql/index.js";
import type { GelTable } from "./table.js";
export declare class CheckBuilder {
name: string;
value: SQL;
static readonly [entityKind]: string;
protected brand: 'GelConstraintBuilder';
constructor(name: string, value: SQL);
}
export declare class Check {
table: GelTable;
static readonly [entityKind]: string;
readonly name: string;
readonly value: SQL;
constructor(table: GelTable, builder: CheckBuilder);
}
export declare function check(name: string, value: SQL): CheckBuilder;

View File

@@ -0,0 +1,29 @@
"use strict";
exports.hu = void 0;
var _index = require("./hu/_lib/formatDistance.js");
var _index2 = require("./hu/_lib/formatLong.js");
var _index3 = require("./hu/_lib/formatRelative.js");
var _index4 = require("./hu/_lib/localize.js");
var _index5 = require("./hu/_lib/match.js");
/**
* @category Locales
* @summary Hungarian locale.
* @language Hungarian
* @iso-639-2 hun
* @author Pavlo Shpak [@pshpak](https://github.com/pshpak)
* @author Eduardo Pardo [@eduardopsll](https://github.com/eduardopsll)
* @author Zoltan Szepesi [@twodcube](https://github.com/twodcube)
*/
const hu = (exports.hu = {
code: "hu",
formatDistance: _index.formatDistance,
formatLong: _index2.formatLong,
formatRelative: _index3.formatRelative,
localize: _index4.localize,
match: _index5.match,
options: {
weekStartsOn: 1 /* Monday */,
firstWeekContainsDate: 4,
},
});

View File

@@ -0,0 +1 @@
{"version":3,"file":"parse-args-cjs.cjs","sourceRoot":"","sources":["../../src/parse-args-cjs.cts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4B;AAE5B,MAAM,EAAE,GACN,CACE,OAAO,OAAO,KAAK,QAAQ;IAC3B,CAAC,CAAC,OAAO;IACT,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,CACpC,CAAC,CAAC;IACD,OAAO,CAAC,OAAO;IACjB,CAAC,CAAC,QAAQ,CAAA;AACZ,MAAM,GAAG,GAAG,EAAE;KACX,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;KACjB,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAE5B,qBAAqB;AACrB,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,GAAG,GAAG,CAAA;AAClC,oBAAoB;AAEpB,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,IAAI,CAAA;AAC5B,qBAAqB;AACrB,IACE,CAAC,EAAE;IACH,KAAK,GAAG,EAAE;IACV,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,GAAG,EAAE,CAAC;IAC5B,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,GAAG,EAAE,CAAC,EAC5B,CAAC;IACD,oBAAoB;IACpB,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,SAAS,CAAA;AAC5C,CAAC;AAEY,QAAA,SAAS,GAAG,EAAE,CAAA","sourcesContent":["import * as util from 'util'\n\nconst pv =\n (\n typeof process === 'object' &&\n !!process &&\n typeof process.version === 'string'\n ) ?\n process.version\n : 'v0.0.0'\nconst pvs = pv\n .replace(/^v/, '')\n .split('.')\n .map(s => parseInt(s, 10))\n\n/* c8 ignore start */\nconst [major = 0, minor = 0] = pvs\n/* c8 ignore stop */\n\nlet { parseArgs: pa } = util\n/* c8 ignore start */\nif (\n !pa ||\n major < 16 ||\n (major === 18 && minor < 11) ||\n (major === 16 && minor < 19)\n) {\n /* c8 ignore stop */\n pa = require('@pkgjs/parseargs').parseArgs\n}\n\nexport const parseArgs = pa\n"]}

View File

@@ -0,0 +1,92 @@
import { wrapInternalEndpoints } from '../../utilities/wrapInternalEndpoints.js';
import { countHandler } from './count.js';
import { createHandler } from './create.js';
import { deleteHandler } from './delete.js';
import { deleteByIDHandler } from './deleteByID.js';
import { docAccessHandler } from './docAccess.js';
import { duplicateHandler } from './duplicate.js';
import { findHandler } from './find.js';
import { findByIDHandler } from './findByID.js';
// import { findDistinctHandler } from './findDistinct.js'
import { findVersionByIDHandler } from './findVersionByID.js';
import { findVersionsHandler } from './findVersions.js';
import { restoreVersionHandler } from './restoreVersion.js';
import { updateHandler } from './update.js';
import { updateByIDHandler } from './updateByID.js';
export const defaultCollectionEndpoints = [
...wrapInternalEndpoints([
{
handler: countHandler,
method: 'get',
path: '/count'
},
{
handler: createHandler,
method: 'post',
path: '/'
},
{
handler: deleteHandler,
method: 'delete',
path: '/'
},
{
handler: deleteByIDHandler,
method: 'delete',
path: '/:id'
},
{
handler: docAccessHandler,
method: 'post',
path: '/access/:id?'
},
{
handler: findVersionsHandler,
method: 'get',
path: '/versions'
},
// Might be uncommented in the future
// {
// handler: findDistinctHandler,
// method: 'get',
// path: '/distinct',
// },
{
handler: duplicateHandler,
method: 'post',
path: '/:id/duplicate'
},
{
handler: findHandler,
method: 'get',
path: '/'
},
{
handler: findByIDHandler,
method: 'get',
path: '/:id'
},
{
handler: findVersionByIDHandler,
method: 'get',
path: '/versions/:id'
},
{
handler: restoreVersionHandler,
method: 'post',
path: '/versions/:id'
},
{
handler: updateHandler,
method: 'patch',
path: '/'
},
{
handler: updateByIDHandler,
method: 'patch',
path: '/:id'
}
])
];
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,178 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const RuntimeGlobals = require("../RuntimeGlobals");
const Template = require("../Template");
const { isSubset } = require("../util/SetHelpers");
const { getAllChunks } = require("./ChunkHelpers");
/** @typedef {import("../util/Hash")} Hash */
/** @typedef {import("../Chunk")} Chunk */
/** @typedef {import("../Chunk").ChunkId} ChunkId */
/** @typedef {import("../ChunkGraph")} ChunkGraph */
/** @typedef {import("../ChunkGraph").ModuleId} ModuleId */
/** @typedef {import("../Entrypoint")} Entrypoint */
/** @typedef {import("../ChunkGraph").EntryModuleWithChunkGroup} EntryModuleWithChunkGroup */
/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
const EXPORT_PREFIX = `var ${RuntimeGlobals.exports} = `;
/** @typedef {Set<Chunk>} Chunks */
/** @typedef {ModuleId[]} ModuleIds */
/**
* @param {ChunkGraph} chunkGraph chunkGraph
* @param {RuntimeTemplate} runtimeTemplate runtimeTemplate
* @param {EntryModuleWithChunkGroup[]} entries entries
* @param {Chunk} chunk chunk
* @param {boolean} passive true: passive startup with on chunks loaded
* @returns {string} runtime code
*/
module.exports.generateEntryStartup = (
chunkGraph,
runtimeTemplate,
entries,
chunk,
passive
) => {
/** @type {string[]} */
const runtime = [
`var __webpack_exec__ = ${runtimeTemplate.returningFunction(
`${RuntimeGlobals.require}(${RuntimeGlobals.entryModuleId} = moduleId)`,
"moduleId"
)}`
];
/**
* @param {ModuleId} id id
* @returns {string} fn to execute
*/
const runModule = (id) => `__webpack_exec__(${JSON.stringify(id)})`;
/**
* @param {Chunks} chunks chunks
* @param {ModuleIds} moduleIds module ids
* @param {boolean=} final true when final, otherwise false
*/
const outputCombination = (chunks, moduleIds, final) => {
if (chunks.size === 0) {
runtime.push(
`${final ? EXPORT_PREFIX : ""}(${moduleIds.map(runModule).join(", ")});`
);
} else {
const fn = runtimeTemplate.returningFunction(
moduleIds.map(runModule).join(", ")
);
runtime.push(
`${final && !passive ? EXPORT_PREFIX : ""}${
passive
? RuntimeGlobals.onChunksLoaded
: RuntimeGlobals.startupEntrypoint
}(0, ${JSON.stringify(Array.from(chunks, (c) => c.id))}, ${fn});`
);
if (final && passive) {
runtime.push(`${EXPORT_PREFIX}${RuntimeGlobals.onChunksLoaded}();`);
}
}
};
/** @type {Chunks | undefined} */
let currentChunks;
/** @type {ModuleIds | undefined} */
let currentModuleIds;
for (const [module, entrypoint] of entries) {
if (!chunkGraph.getModuleSourceTypes(module).has("javascript")) {
continue;
}
const runtimeChunk =
/** @type {Entrypoint} */
(entrypoint).getRuntimeChunk();
const moduleId = /** @type {ModuleId} */ (chunkGraph.getModuleId(module));
const chunks = getAllChunks(
/** @type {Entrypoint} */
(entrypoint),
chunk,
runtimeChunk
);
if (
currentChunks &&
currentChunks.size === chunks.size &&
isSubset(currentChunks, chunks)
) {
/** @type {ModuleIds} */
(currentModuleIds).push(moduleId);
} else {
if (currentChunks) {
outputCombination(
currentChunks,
/** @type {ModuleIds} */ (currentModuleIds)
);
}
currentChunks = chunks;
currentModuleIds = [moduleId];
}
}
// output current modules with export prefix
if (currentChunks) {
outputCombination(
currentChunks,
/** @type {ModuleIds} */
(currentModuleIds),
true
);
}
runtime.push("");
return Template.asString(runtime);
};
/**
* @param {Chunk} chunk the chunk
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {(chunk: Chunk, chunkGraph: ChunkGraph) => boolean} filterFn filter function
* @returns {Set<ChunkId>} initially fulfilled chunk ids
*/
module.exports.getInitialChunkIds = (chunk, chunkGraph, filterFn) => {
/** @type {Set<ChunkId>} */
const initialChunkIds = new Set(chunk.ids);
for (const c of chunk.getAllInitialChunks()) {
if (c === chunk || filterFn(c, chunkGraph)) continue;
for (const id of /** @type {ChunkId[]} */ (c.ids)) {
initialChunkIds.add(id);
}
}
return initialChunkIds;
};
/**
* @param {Hash} hash the hash to update
* @param {ChunkGraph} chunkGraph chunkGraph
* @param {EntryModuleWithChunkGroup[]} entries entries
* @param {Chunk} chunk chunk
* @returns {void}
*/
module.exports.updateHashForEntryStartup = (
hash,
chunkGraph,
entries,
chunk
) => {
for (const [module, entrypoint] of entries) {
const runtimeChunk =
/** @type {Entrypoint} */
(entrypoint).getRuntimeChunk();
const moduleId = chunkGraph.getModuleId(module);
hash.update(`${moduleId}`);
for (const c of getAllChunks(
/** @type {Entrypoint} */ (entrypoint),
chunk,
/** @type {Chunk} */ (runtimeChunk)
)) {
hash.update(`${c.id}`);
}
}
};

View File

@@ -0,0 +1,6 @@
/**
* Set of all paths which should be moved
* This will be built up into one WHERE query
*/ export { };
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"runOnce.js","sources":["../../../../../src/metrics/web-vitals/lib/runOnce.ts"],"sourcesContent":["/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const runOnce = (cb: () => void) => {\n let called = false;\n return () => {\n if (!called) {\n cb();\n called = true;\n }\n };\n};\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;MAEa,OAAA,GAAU,CAAC,EAAE,KAAiB;AAC3C,EAAE,IAAI,MAAA,GAAS,KAAK;AACpB,EAAE,OAAO,MAAM;AACf,IAAI,IAAI,CAAC,MAAM,EAAE;AACjB,MAAM,EAAE,EAAE;AACV,MAAM,MAAA,GAAS,IAAI;AACnB,IAAI;AACJ,EAAE,CAAC;AACH;;;;"}

View File

@@ -0,0 +1,25 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var better_sqlite3_exports = {};
module.exports = __toCommonJS(better_sqlite3_exports);
__reExport(better_sqlite3_exports, require("./driver.cjs"), module.exports);
__reExport(better_sqlite3_exports, require("./session.cjs"), module.exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
...require("./driver.cjs"),
...require("./session.cjs")
});
//# sourceMappingURL=index.cjs.map

View File

@@ -0,0 +1,5 @@
var id = 0;
function _classPrivateFieldKey(e) {
return "__private_" + id++ + "_" + e;
}
export { _classPrivateFieldKey as default };

View File

@@ -0,0 +1,91 @@
"use strict";
exports.formatRelative = void 0;
var _index = require("../../../isSameWeek.js");
const accusativeWeekdays = [
"воскресенье",
"понедельник",
"вторник",
"среду",
"четверг",
"пятницу",
"субботу",
];
function lastWeek(day) {
const weekday = accusativeWeekdays[day];
switch (day) {
case 0:
return "'в прошлое " + weekday + " в' p";
case 1:
case 2:
case 4:
return "'в прошлый " + weekday + " в' p";
case 3:
case 5:
case 6:
return "'в прошлую " + weekday + " в' p";
}
}
function thisWeek(day) {
const weekday = accusativeWeekdays[day];
if (day === 2 /* Tue */) {
return "'во " + weekday + " в' p";
} else {
return "'в " + weekday + " в' p";
}
}
function nextWeek(day) {
const weekday = accusativeWeekdays[day];
switch (day) {
case 0:
return "'в следующее " + weekday + " в' p";
case 1:
case 2:
case 4:
return "'в следующий " + weekday + " в' p";
case 3:
case 5:
case 6:
return "'в следующую " + weekday + " в' p";
}
}
const formatRelativeLocale = {
lastWeek: (date, baseDate, options) => {
const day = date.getDay();
if ((0, _index.isSameWeek)(date, baseDate, options)) {
return thisWeek(day);
} else {
return lastWeek(day);
}
},
yesterday: "'вчера в' p",
today: "'сегодня в' p",
tomorrow: "'завтра в' p",
nextWeek: (date, baseDate, options) => {
const day = date.getDay();
if ((0, _index.isSameWeek)(date, baseDate, options)) {
return thisWeek(day);
} else {
return nextWeek(day);
}
},
other: "P",
};
const formatRelative = (token, date, baseDate, options) => {
const format = formatRelativeLocale[token];
if (typeof format === "function") {
return format(date, baseDate, options);
}
return format;
};
exports.formatRelative = formatRelative;

View File

@@ -0,0 +1,29 @@
import type { ContextOptions, DateArg } from "./types.js";
/**
* The {@link isThisHour} function options.
*/
export interface IsThisHourOptions extends ContextOptions<Date> {}
/**
* @name isThisHour
* @category Hour Helpers
* @summary Is the given date in the same hour as the current date?
* @pure false
*
* @description
* Is the given date in the same hour as the current date?
*
* @param date - The date to check
* @param options - An object with options
*
* @returns The date is in this hour
*
* @example
* // If now is 25 September 2014 18:30:15.500,
* // is 25 September 2014 18:00:00 in this hour?
* const result = isThisHour(new Date(2014, 8, 25, 18))
* //=> true
*/
export declare function isThisHour(
date: DateArg<Date> & {},
options?: IsThisHourOptions,
): boolean;

View File

@@ -0,0 +1,57 @@
import type { OPSQLiteConnection, QueryResult } from '@op-engineering/op-sqlite';
import { type Cache } from "../cache/core/index.cjs";
import type { WithCacheConfig } from "../cache/core/types.cjs";
import { entityKind } from "../entity.cjs";
import type { Logger } from "../logger.cjs";
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.cjs";
import { type Query } from "../sql/sql.cjs";
import type { SQLiteAsyncDialect } from "../sqlite-core/dialect.cjs";
import { SQLiteTransaction } from "../sqlite-core/index.cjs";
import type { SelectedFieldsOrdered } from "../sqlite-core/query-builders/select.types.cjs";
import { type PreparedQueryConfig as PreparedQueryConfigBase, type SQLiteExecuteMethod, SQLitePreparedQuery, SQLiteSession, type SQLiteTransactionConfig } from "../sqlite-core/session.cjs";
export interface OPSQLiteSessionOptions {
logger?: Logger;
cache?: Cache;
}
type PreparedQueryConfig = Omit<PreparedQueryConfigBase, 'statement' | 'run'>;
export declare class OPSQLiteSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteSession<'async', QueryResult, TFullSchema, TSchema> {
private client;
private schema;
static readonly [entityKind]: string;
private logger;
private cache;
constructor(client: OPSQLiteConnection, dialect: SQLiteAsyncDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: OPSQLiteSessionOptions);
prepareQuery<T extends Omit<PreparedQueryConfig, 'run'>>(query: Query, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][]) => unknown, queryMetadata?: {
type: 'select' | 'update' | 'delete' | 'insert';
tables: string[];
}, cacheConfig?: WithCacheConfig): OPSQLitePreparedQuery<T>;
transaction<T>(transaction: (tx: OPSQLiteTransaction<TFullSchema, TSchema>) => T, config?: SQLiteTransactionConfig): T;
}
export declare class OPSQLiteTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteTransaction<'async', QueryResult, TFullSchema, TSchema> {
static readonly [entityKind]: string;
transaction<T>(transaction: (tx: OPSQLiteTransaction<TFullSchema, TSchema>) => T): T;
}
export declare class OPSQLitePreparedQuery<T extends PreparedQueryConfig = PreparedQueryConfig> extends SQLitePreparedQuery<{
type: 'async';
run: QueryResult;
all: T['all'];
get: T['get'];
values: T['values'];
execute: T['execute'];
}> {
private client;
private logger;
private fields;
private _isResponseInArrayMode;
private customResultMapper?;
static readonly [entityKind]: string;
constructor(client: OPSQLiteConnection, query: Query, logger: Logger, cache: Cache, queryMetadata: {
type: 'select' | 'update' | 'delete' | 'insert';
tables: string[];
} | undefined, cacheConfig: WithCacheConfig | undefined, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, _isResponseInArrayMode: boolean, customResultMapper?: ((rows: unknown[][]) => unknown) | undefined);
run(placeholderValues?: Record<string, unknown>): Promise<QueryResult>;
all(placeholderValues?: Record<string, unknown>): Promise<T['all']>;
get(placeholderValues?: Record<string, unknown>): Promise<T['get']>;
values(placeholderValues?: Record<string, unknown>): Promise<T['values']>;
}
export {};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/postgres/init.ts"],"sourcesContent":["import type { Init } from 'payload'\n\nimport type { BasePostgresAdapter } from './types.js'\n\nimport { buildDrizzleRelations } from '../schema/buildDrizzleRelations.js'\nimport { buildRawSchema } from '../schema/buildRawSchema.js'\nimport { executeSchemaHooks } from '../utilities/executeSchemaHooks.js'\nimport { buildDrizzleTable } from './schema/buildDrizzleTable.js'\nimport { setColumnID } from './schema/setColumnID.js'\n\nexport const init: Init = async function init(this: BasePostgresAdapter) {\n this.rawRelations = {}\n this.rawTables = {}\n\n buildRawSchema({\n adapter: this,\n setColumnID,\n })\n\n await executeSchemaHooks({ type: 'beforeSchemaInit', adapter: this })\n\n if (this.payload.config.localization) {\n this.enums.enum__locales = this.pgSchema.enum(\n '_locales',\n this.payload.config.localization.locales.map(({ code }) => code) as [string, ...string[]],\n )\n }\n\n for (const tableName in this.rawTables) {\n buildDrizzleTable({ adapter: this, rawTable: this.rawTables[tableName] })\n }\n\n buildDrizzleRelations({\n adapter: this,\n })\n\n await executeSchemaHooks({ type: 'afterSchemaInit', adapter: this })\n\n this.schema = {\n pgSchema: this.pgSchema,\n ...this.tables,\n ...this.relations,\n ...this.enums,\n }\n}\n"],"names":["buildDrizzleRelations","buildRawSchema","executeSchemaHooks","buildDrizzleTable","setColumnID","init","rawRelations","rawTables","adapter","type","payload","config","localization","enums","enum__locales","pgSchema","enum","locales","map","code","tableName","rawTable","schema","tables","relations"],"mappings":"AAIA,SAASA,qBAAqB,QAAQ,qCAAoC;AAC1E,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,iBAAiB,QAAQ,gCAA+B;AACjE,SAASC,WAAW,QAAQ,0BAAyB;AAErD,OAAO,MAAMC,OAAa,eAAeA;IACvC,IAAI,CAACC,YAAY,GAAG,CAAC;IACrB,IAAI,CAACC,SAAS,GAAG,CAAC;IAElBN,eAAe;QACbO,SAAS,IAAI;QACbJ;IACF;IAEA,MAAMF,mBAAmB;QAAEO,MAAM;QAAoBD,SAAS,IAAI;IAAC;IAEnE,IAAI,IAAI,CAACE,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;QACpC,IAAI,CAACC,KAAK,CAACC,aAAa,GAAG,IAAI,CAACC,QAAQ,CAACC,IAAI,CAC3C,YACA,IAAI,CAACN,OAAO,CAACC,MAAM,CAACC,YAAY,CAACK,OAAO,CAACC,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA;IAE/D;IAEA,IAAK,MAAMC,aAAa,IAAI,CAACb,SAAS,CAAE;QACtCJ,kBAAkB;YAAEK,SAAS,IAAI;YAAEa,UAAU,IAAI,CAACd,SAAS,CAACa,UAAU;QAAC;IACzE;IAEApB,sBAAsB;QACpBQ,SAAS,IAAI;IACf;IAEA,MAAMN,mBAAmB;QAAEO,MAAM;QAAmBD,SAAS,IAAI;IAAC;IAElE,IAAI,CAACc,MAAM,GAAG;QACZP,UAAU,IAAI,CAACA,QAAQ;QACvB,GAAG,IAAI,CAACQ,MAAM;QACd,GAAG,IAAI,CAACC,SAAS;QACjB,GAAG,IAAI,CAACX,KAAK;IACf;AACF,EAAC"}

View File

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

View File

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

View File

@@ -0,0 +1,57 @@
{
"definitions": {
"HashFunction": {
"description": "Algorithm used for generation the hash (see node.js crypto package).",
"anyOf": [
{
"type": "string",
"minLength": 1
},
{
"instanceof": "Function",
"tsType": "typeof import('../../../lib/util/Hash')"
}
]
}
},
"title": "HashedModuleIdsPluginOptions",
"type": "object",
"additionalProperties": false,
"properties": {
"context": {
"description": "The context directory for creating names.",
"type": "string",
"absolutePath": true
},
"hashDigest": {
"description": "The encoding to use when generating the hash, defaults to 'base64'. All encodings from Node.JS' hash.digest are supported.",
"enum": [
"base64",
"base64url",
"hex",
"binary",
"utf8",
"utf-8",
"utf16le",
"utf-16le",
"latin1",
"ascii",
"ucs2",
"ucs-2"
]
},
"hashDigestLength": {
"description": "The prefix length of the hash digest to use, defaults to 4.",
"type": "number",
"minimum": 1
},
"hashFunction": {
"description": "The hashing algorithm to use, defaults to 'md4'. All functions from Node.JS' crypto.createHash are supported.",
"oneOf": [
{
"$ref": "#/definitions/HashFunction"
}
]
}
}
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"rat.js","sources":["../../../src/icons/rat.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Rat\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTcgNWMwLTEuNy0xLjMtMy0zLTNzLTMgMS4zLTMgM2MwIC44LjMgMS41LjggMkgxMWMtMy45IDAtNyAzLjEtNyA3YzAgMi4yIDEuOCA0IDQgNCIgLz4KICA8cGF0aCBkPSJNMTYuOCAzLjljLjMtLjMuNi0uNSAxLS43IDEuNS0uNiAzLjMuMSAzLjkgMS42LjYgMS41LS4xIDMuMy0xLjYgMy45bDEuNiAyLjhjLjIuMy4yLjcuMiAxLS4yLjgtLjkgMS4yLTEuNyAxLjEgMCAwLTEuNi0uMy0yLjctLjZIMTdjLTEuNyAwLTMgMS4zLTMgMyIgLz4KICA8cGF0aCBkPSJNMTMuMiAxOGEzIDMgMCAwIDAtMi4yLTUiIC8+CiAgPHBhdGggZD0iTTEzIDIySDRhMiAyIDAgMCAxIDAtNGgxMiIgLz4KICA8cGF0aCBkPSJNMTYgOWguMDEiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/rat\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 Rat = createLucideIcon('Rat', [\n [\n 'path',\n {\n d: 'M17 5c0-1.7-1.3-3-3-3s-3 1.3-3 3c0 .8.3 1.5.8 2H11c-3.9 0-7 3.1-7 7c0 2.2 1.8 4 4 4',\n key: '1wq71c',\n },\n ],\n [\n 'path',\n {\n d: 'M16.8 3.9c.3-.3.6-.5 1-.7 1.5-.6 3.3.1 3.9 1.6.6 1.5-.1 3.3-1.6 3.9l1.6 2.8c.2.3.2.7.2 1-.2.8-.9 1.2-1.7 1.1 0 0-1.6-.3-2.7-.6H17c-1.7 0-3 1.3-3 3',\n key: '1crdmb',\n },\n ],\n ['path', { d: 'M13.2 18a3 3 0 0 0-2.2-5', key: '1ol3lk' }],\n ['path', { d: 'M13 22H4a2 2 0 0 1 0-4h12', key: 'bt3f23' }],\n ['path', { d: 'M16 9h.01', key: '1bdo4e' }],\n]);\n\nexport default Rat;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,iBAAiB,KAAO,CAAA,CAAA,CAAA;AAAA,CAClC,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;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,CACA,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,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,CAA4B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA6B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CAC1D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC5C,CAAC,CAAA,CAAA;;"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"dashboards.cjs","names":[],"sources":["../../../../src/rest/commands/create/dashboards.ts"],"sourcesContent":["import type { DirectusDashboard } from '../../../schema/dashboard.js';\nimport type { ApplyQueryFields, NestedPartial, Query } from '../../../types/index.js';\nimport type { RestCommand } from '../../types.js';\n\nexport type CreateDashboardOutput<\n\tSchema,\n\tTQuery extends Query<Schema, Item>,\n\tItem extends object = DirectusDashboard<Schema>,\n> = ApplyQueryFields<Schema, Item, TQuery['fields']>;\n\n/**\n * Create multiple new dashboards.\n *\n * @param items The items to create\n * @param query Optional return data query\n *\n * @returns Returns the dashboard object for the created dashboards.\n */\nexport const createDashboards =\n\t<Schema, const TQuery extends Query<Schema, DirectusDashboard<Schema>>>(\n\t\titems: NestedPartial<DirectusDashboard<Schema>>[],\n\t\tquery?: TQuery,\n\t): RestCommand<CreateDashboardOutput<Schema, TQuery>[], Schema> =>\n\t() => ({\n\t\tpath: `/dashboards`,\n\t\tparams: query ?? {},\n\t\tbody: JSON.stringify(items),\n\t\tmethod: 'POST',\n\t});\n\n/**\n * Create a new dashboard.\n *\n * @param item The dashboard to create\n * @param query Optional return data query\n *\n * @returns Returns the dashboard object for the created dashboard.\n */\nexport const createDashboard =\n\t<Schema, const TQuery extends Query<Schema, DirectusDashboard<Schema>>>(\n\t\titem: NestedPartial<DirectusDashboard<Schema>>,\n\t\tquery?: TQuery,\n\t): RestCommand<CreateDashboardOutput<Schema, TQuery>, Schema> =>\n\t() => ({\n\t\tpath: `/dashboards`,\n\t\tparams: query ?? {},\n\t\tbody: JSON.stringify(item),\n\t\tmethod: 'POST',\n\t});\n"],"mappings":"AAkBA,MAAa,GAEX,EACA,SAEM,CACN,KAAM,cACN,OAAQ,GAAS,EAAE,CACnB,KAAM,KAAK,UAAU,EAAM,CAC3B,OAAQ,OACR,EAUW,GAEX,EACA,SAEM,CACN,KAAM,cACN,OAAQ,GAAS,EAAE,CACnB,KAAM,KAAK,UAAU,EAAK,CAC1B,OAAQ,OACR"}

View File

@@ -0,0 +1,22 @@
function resolveElements(elementOrSelector, scope, selectorCache) {
var _a;
if (elementOrSelector instanceof Element) {
return [elementOrSelector];
}
else if (typeof elementOrSelector === "string") {
let root = document;
if (scope) {
// TODO: Refactor to utils package
// invariant(
// Boolean(scope.current),
// "Scope provided, but no element detected."
// )
root = scope.current;
}
const elements = (_a = selectorCache === null || selectorCache === void 0 ? void 0 : selectorCache[elementOrSelector]) !== null && _a !== void 0 ? _a : root.querySelectorAll(elementOrSelector);
return elements ? Array.from(elements) : [];
}
return Array.from(elementOrSelector);
}
export { resolveElements };

View File

@@ -0,0 +1,53 @@
"use strict";
exports.ISOWeekParser = void 0;
var _index = require("../../../setISOWeek.cjs");
var _index2 = require("../../../startOfISOWeek.cjs");
var _constants = require("../constants.cjs");
var _Parser = require("../Parser.cjs");
var _utils = require("../utils.cjs");
// ISO week of year
class ISOWeekParser extends _Parser.Parser {
priority = 100;
parse(dateString, token, match) {
switch (token) {
case "I":
return (0, _utils.parseNumericPattern)(
_constants.numericPatterns.week,
dateString,
);
case "Io":
return match.ordinalNumber(dateString, { unit: "week" });
default:
return (0, _utils.parseNDigits)(token.length, dateString);
}
}
validate(_date, value) {
return value >= 1 && value <= 53;
}
set(date, _flags, value) {
return (0, _index2.startOfISOWeek)((0, _index.setISOWeek)(date, value));
}
incompatibleTokens = [
"y",
"Y",
"u",
"q",
"Q",
"M",
"L",
"w",
"d",
"D",
"e",
"c",
"t",
"T",
];
}
exports.ISOWeekParser = ISOWeekParser;

View File

@@ -0,0 +1,29 @@
import type { I18nClient } from '@payloadcms/translations';
import type { ImportMap } from '../../bin/generateImportMap/index.js';
import type { LivePreviewConfig, SanitizedConfig, ServerOnlyLivePreviewProperties } from '../../config/types.js';
import type { Payload } from '../../types/index.js';
import type { SanitizedGlobalConfig } from './types.js';
import { type ClientField } from '../../fields/config/client.js';
export type ServerOnlyGlobalProperties = keyof Pick<SanitizedGlobalConfig, 'access' | 'admin' | 'custom' | 'endpoints' | 'fields' | 'flattenedFields' | 'hooks'>;
export type ServerOnlyGlobalAdminProperties = keyof Pick<SanitizedGlobalConfig['admin'], 'components' | 'hidden'>;
export type ClientGlobalConfig = {
admin: {
components: null;
livePreview?: Omit<LivePreviewConfig, ServerOnlyLivePreviewProperties>;
preview?: boolean;
} & Omit<SanitizedGlobalConfig['admin'], 'components' | 'livePreview' | 'preview' | ServerOnlyGlobalAdminProperties>;
fields: ClientField[];
} & Omit<SanitizedGlobalConfig, 'admin' | 'fields' | ServerOnlyGlobalProperties>;
export declare const createClientGlobalConfig: ({ defaultIDType, global, i18n, importMap, }: {
defaultIDType: Payload["config"]["db"]["defaultIDType"];
global: SanitizedConfig["globals"][0];
i18n: I18nClient;
importMap: ImportMap;
}) => ClientGlobalConfig;
export declare const createClientGlobalConfigs: ({ defaultIDType, globals, i18n, importMap, }: {
defaultIDType: Payload["config"]["db"]["defaultIDType"];
globals: SanitizedConfig["globals"];
i18n: I18nClient;
importMap: ImportMap;
}) => ClientGlobalConfig[];
//# sourceMappingURL=client.d.ts.map

View File

@@ -0,0 +1,336 @@
<p align="left"> <img width="675" src="https://raw.githubusercontent.com/willmcpo/body-scroll-lock/master/images/logo.png" alt="Body scroll lock...just works with everything ;-)" /> </p>
## Why BSL?
Enables body scroll locking (for iOS Mobile and Tablet, Android, desktop Safari/Chrome/Firefox) without breaking scrolling of a target element (eg. modal/lightbox/flyouts/nav-menus).
_Features:_
- disables body scroll WITHOUT disabling scroll of a target element
- works on iOS mobile/tablet (!!)
- works on Android
- works on Safari desktop
- works on Chrome/Firefox
- works with vanilla JS and frameworks such as React / Angular / VueJS
- supports nested target elements (eg. a modal that appears on top of a flyout)
- can reserve scrollbar width
- `-webkit-overflow-scrolling: touch` still works
_Aren't the alternative approaches sufficient?_
- the approach `document.body.ontouchmove = (e) => { e.preventDefault(); return false; };` locks the
body scroll, but ALSO locks the scroll of a target element (eg. modal).
- the approach `overflow: hidden` on the body or html elements doesn't work for all browsers
- the `position: fixed` approach causes the body scroll to reset
- some approaches break inertia/momentum/rubber-band scrolling on iOS
_LIGHT Package Size:_
[![minzip size](https://badgen.net/bundlephobia/minzip/body-scroll-lock?color=orange)](https://badgen.net/bundlephobia/minzip/body-scroll-lock?color=orange)
## Install
$ yarn add body-scroll-lock
or
$ npm install body-scroll-lock
You can also load via a `<script src="lib/bodyScrollLock.js"></script>` tag (refer to the lib folder).
## Usage examples
##### Common JS
```javascript
// 1. Import the functions
const bodyScrollLock = require('body-scroll-lock');
const disableBodyScroll = bodyScrollLock.disableBodyScroll;
const enableBodyScroll = bodyScrollLock.enableBodyScroll;
// 2. Get a target element that you want to persist scrolling for (such as a modal/lightbox/flyout/nav).
// Specifically, the target element is the one we would like to allow scroll on (NOT a parent of that element).
// This is also the element to apply the CSS '-webkit-overflow-scrolling: touch;' if desired.
const targetElement = document.querySelector('#someElementId');
// 3. ...in some event handler after showing the target element...disable body scroll
disableBodyScroll(targetElement);
// 4. ...in some event handler after hiding the target element...
enableBodyScroll(targetElement);
```
##### React/ES6
```javascript
// 1. Import the functions
import { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';
class SomeComponent extends React.Component {
targetElement = null;
componentDidMount() {
// 2. Get a target element that you want to persist scrolling for (such as a modal/lightbox/flyout/nav).
// Specifically, the target element is the one we would like to allow scroll on (NOT a parent of that element).
// This is also the element to apply the CSS '-webkit-overflow-scrolling: touch;' if desired.
this.targetElement = document.querySelector('#targetElementId');
}
showTargetElement = () => {
// ... some logic to show target element
// 3. Disable body scroll
disableBodyScroll(this.targetElement);
};
hideTargetElement = () => {
// ... some logic to hide target element
// 4. Re-enable body scroll
enableBodyScroll(this.targetElement);
};
componentWillUnmount() {
// 5. Useful if we have called disableBodyScroll for multiple target elements,
// and we just want a kill-switch to undo all that.
// OR useful for if the `hideTargetElement()` function got circumvented eg. visitor
// clicks a link which takes him/her to a different page within the app.
clearAllBodyScrollLocks();
}
render() {
return <div>some JSX to go here</div>;
}
}
```
##### React/ES6 with Refs
```javascript
// 1. Import the functions
import { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';
class SomeComponent extends React.Component {
// 2. Initialise your ref and targetElement here
targetRef = React.createRef();
targetElement = null;
componentDidMount() {
// 3. Get a target element that you want to persist scrolling for (such as a modal/lightbox/flyout/nav).
// Specifically, the target element is the one we would like to allow scroll on (NOT a parent of that element).
// This is also the element to apply the CSS '-webkit-overflow-scrolling: touch;' if desired.
this.targetElement = this.targetRef.current;
}
showTargetElement = () => {
// ... some logic to show target element
// 4. Disable body scroll
disableBodyScroll(this.targetElement);
};
hideTargetElement = () => {
// ... some logic to hide target element
// 5. Re-enable body scroll
enableBodyScroll(this.targetElement);
};
componentWillUnmount() {
// 5. Useful if we have called disableBodyScroll for multiple target elements,
// and we just want a kill-switch to undo all that.
// OR useful for if the `hideTargetElement()` function got circumvented eg. visitor
// clicks a link which takes him/her to a different page within the app.
clearAllBodyScrollLocks();
}
render() {
return (
// 6. Pass your ref with the reference to the targetElement to SomeOtherComponent
<SomeOtherComponent ref={this.targetRef}>some JSX to go here</SomeOtherComponent>
);
}
}
// 7. SomeOtherComponent needs to be a Class component to receive the ref (unless Hooks - https://reactjs.org/docs/hooks-faq.html#can-i-make-a-ref-to-a-function-component - are used).
class SomeOtherComponent extends React.Component {
componentDidMount() {
// Your logic on mount goes here
}
// 8. BSL will be applied to div below in SomeOtherComponent and persist scrolling for the container
render() {
return <div>some JSX to go here</div>;
}
}
```
##### Angular
```javascript
import { Component, ElementRef, OnDestroy, ViewChild } from "@angular/core";
// 1. Import the functions
import {
disableBodyScroll,
enableBodyScroll,
clearAllBodyScrollLocks
} from "body-scroll-lock";
@Component({
selector: "app-scroll-block",
templateUrl: "./scroll-block.component.html",
styleUrls: ["./scroll-block.component.css"]
})
export class SomeComponent implements OnDestroy {
// 2. Get a target element that you want to persist scrolling for (such as a modal/lightbox/flyout/nav).
// Specifically, the target element is the one we would like to allow scroll on (NOT a parent of that element).
// This is also the element to apply the CSS '-webkit-overflow-scrolling: touch;' if desired.
@ViewChild("scrollTarget") scrollTarget: ElementRef;
showTargetElement() {
// ... some logic to show target element
// 3. Disable body scroll
disableBodyScroll(this.scrollTarget.nativeElement);
}
hideTargetElement() {
// ... some logic to hide target element
// 4. Re-enable body scroll
enableBodyScroll(this.scrollTarget.nativeElement);
}
ngOnDestroy() {
// 5. Useful if we have called disableBodyScroll for multiple target elements,
// and we just want a kill-switch to undo all that.
// OR useful for if the `hideTargetElement()` function got circumvented eg. visitor
// clicks a link which takes him/her to a different page within the app.
clearAllBodyScrollLocks();
}
}
```
##### Vanilla JS
In the html:
```html
<head>
<script src="some-path-where-you-dump-the-javascript-libraries/lib/bodyScrollLock.js"></script>
</head>
```
Then in the javascript:
```javascript
// 1. Get a target element that you want to persist scrolling for (such as a modal/lightbox/flyout/nav).
// Specifically, the target element is the one we would like to allow scroll on (NOT a parent of that element).
// This is also the element to apply the CSS '-webkit-overflow-scrolling: touch;' if desired.
const targetElement = document.querySelector('#someElementId');
// 2. ...in some event handler after showing the target element...disable body scroll
bodyScrollLock.disableBodyScroll(targetElement);
// 3. ...in some event handler after hiding the target element...
bodyScrollLock.enableBodyScroll(targetElement);
// 4. Useful if we have called disableBodyScroll for multiple target elements,
// and we just want a kill-switch to undo all that.
bodyScrollLock.clearAllBodyScrollLocks();
```
## Demo
Check out the demo, powered by Vercel.
* https://bodyscrolllock.vercel.app for a basic example
* https://bodyscrolllock-modal.vercel.app for an example with a modal.
## Functions
| Function | Arguments | Return | Description |
| :------------------------ | :------------------------------------------------------------- | :----: | :----------------------------------------------------------- |
| `disableBodyScroll` | `targetElement: HTMLElement` <br/>`options: BodyScrollOptions` | `void` | Disables body scroll while enabling scroll on target element |
| `enableBodyScroll` | `targetElement: HTMLElement` | `void` | Enables body scroll and removing listeners on target element |
| `clearAllBodyScrollLocks` | `null` | `void` | Clears all scroll locks |
## Options
### reserveScrollBarGap
**optional, default:** false
If the overflow property of the body is set to hidden, the body widens by the width of the scrollbar. This produces an
unpleasant flickering effect, especially on websites with centered content. If the `reserveScrollBarGap` option is set,
this gap is filled by a `padding-right` on the body element. If `disableBodyScroll` is called for the last target element,
or `clearAllBodyScrollLocks` is called, the `padding-right` is automatically reset to the previous value.
```js
import { disableBodyScroll } from 'body-scroll-lock';
import type { BodyScrollOptions } from 'body-scroll-lock';
const options: BodyScrollOptions = {
reserveScrollBarGap: true,
};
disableBodyScroll(targetElement, options);
```
### allowTouchMove
**optional, default:** undefined
To disable scrolling on iOS, `disableBodyScroll` prevents `touchmove` events.
However, there are cases where you have called `disableBodyScroll` on an
element, but its children still require `touchmove` events to function.
See below for 2 use cases:
##### Simple
```javascript
disableBodyScroll(container, {
allowTouchMove: el => el.tagName === 'TEXTAREA',
});
```
##### More Complex
Javascript:
```javascript
disableBodyScroll(container, {
allowTouchMove: el => {
while (el && el !== document.body) {
if (el.getAttribute('body-scroll-lock-ignore') !== null) {
return true;
}
el = el.parentElement;
}
},
});
```
Html:
```html
<div id="container">
<div id="scrolling-map" body-scroll-lock-ignore>
...
</div>
</div>
```
## References
https://medium.com/jsdownunder/locking-body-scroll-for-all-devices-22def9615177
https://stackoverflow.com/questions/41594997/ios-10-safari-prevent-scrolling-behind-a-fixed-overlay-and-maintain-scroll-posi
## Changelog
Refer to the [releases](https://github.com/willmcpo/body-scroll-lock/releases) page.

View File

@@ -0,0 +1,18 @@
/**
* This method returns `true`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `true`.
* @example
*
* _.times(2, _.stubTrue);
* // => [true, true]
*/
function stubTrue() {
return true;
}
module.exports = stubTrue;

View File

@@ -0,0 +1,2 @@
const e=()=>()=>({method:`GET`,path:`/server/specs/oas`});export{e as readOpenApiSpec};
//# sourceMappingURL=openapi.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"policies.cjs","names":[],"sources":["../../../../src/rest/commands/read/policies.ts"],"sourcesContent":["import type { DirectusPolicy } from '../../../schema/policy.js';\nimport type { ApplyQueryFields, Query } from '../../../types/index.js';\nimport type { RestCommand } from '../../types.js';\nimport { throwIfEmpty } from '../../utils/index.js';\n\nexport type ReadPolicyOutput<\n\tSchema,\n\tTQuery extends Query<Schema, Item>,\n\tItem extends object = DirectusPolicy<Schema>,\n> = ApplyQueryFields<Schema, Item, TQuery['fields']>;\n\nexport type ReadPolicyGlobalsOutput = {\n\tapp_access: boolean;\n\tadmin_access: boolean;\n\tenforce_tfa: boolean;\n};\n\n/**\n * List all policies that exist in the project.\n * @param query The query parameters\n * @returns An array of up to limit Policy objects. If no items are available, data will be an empty array.\n */\nexport const readPolicies =\n\t<Schema, const TQuery extends Query<Schema, DirectusPolicy<Schema>>>(\n\t\tquery?: TQuery,\n\t): RestCommand<ReadPolicyOutput<Schema, TQuery>[], Schema> =>\n\t() => ({\n\t\tpath: `/policies`,\n\t\tparams: query ?? {},\n\t\tmethod: 'GET',\n\t});\n\n/**\n * Read a specific policy.\n * @param key The primary key of the permission\n * @param query The query parameters\n * @returns Returns a Policy object if a valid primary key was provided.\n * @throws Will throw if key is empty\n */\nexport const readPolicy =\n\t<Schema, const TQuery extends Query<Schema, DirectusPolicy<Schema>>>(\n\t\tkey: DirectusPolicy<Schema>['id'],\n\t\tquery?: TQuery,\n\t): RestCommand<ReadPolicyOutput<Schema, TQuery>, Schema> =>\n\t() => {\n\t\tthrowIfEmpty(String(key), 'Key cannot be empty');\n\n\t\treturn {\n\t\t\tpath: `/policies/${key}`,\n\t\t\tparams: query ?? {},\n\t\t\tmethod: 'GET',\n\t\t};\n\t};\n\n/**\n * Check the current user's policy globals.\n */\nexport const readPolicyGlobals =\n\t<Schema>(): RestCommand<ReadPolicyGlobalsOutput, Schema> =>\n\t() => ({\n\t\tpath: `/policies/me/globals`,\n\t\tmethod: 'GET',\n\t});\n"],"mappings":"kDAsBa,EAEX,QAEM,CACN,KAAM,YACN,OAAQ,GAAS,EAAE,CACnB,OAAQ,MACR,EASW,GAEX,EACA,SAGA,EAAA,aAAa,OAAO,EAAI,CAAE,sBAAsB,CAEzC,CACN,KAAM,aAAa,IACnB,OAAQ,GAAS,EAAE,CACnB,OAAQ,MACR,EAMU,WAEL,CACN,KAAM,uBACN,OAAQ,MACR"}

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"file":"Collapsible.d.ts","sourceRoot":"","sources":["../../../src/admin/fields/Collapsible.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAC5F,OAAO,KAAK,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,+BAA+B,EAC/B,+BAA+B,EAC/B,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB,KAAK,+BAA+B,GAAG,UAAU,CAAA;AAEjD,KAAK,iCAAiC,GAAG,YAAY,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAA;AAErF,MAAM,MAAM,2BAA2B,GAAG,eAAe,CAAC,iCAAiC,CAAC,GAC1F,+BAA+B,CAAA;AAEjC,MAAM,MAAM,2BAA2B,GAAG,eAAe,CACvD,gBAAgB,EAChB,iCAAiC,CAClC,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,oBAAoB,CAChE,gBAAgB,EAChB,iCAAiC,CAClC,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,oBAAoB,CAChE,iCAAiC,EACjC,+BAA+B,CAChC,CAAA;AAED,MAAM,MAAM,oCAAoC,GAAG,yBAAyB,CAC1E,gBAAgB,EAChB,iCAAiC,CAClC,CAAA;AAED,MAAM,MAAM,oCAAoC,GAC9C,yBAAyB,CAAC,iCAAiC,CAAC,CAAA;AAE9D,MAAM,MAAM,0CAA0C,GAAG,+BAA+B,CACtF,gBAAgB,EAChB,iCAAiC,CAClC,CAAA;AAED,MAAM,MAAM,0CAA0C,GACpD,+BAA+B,CAAC,iCAAiC,CAAC,CAAA;AAEpE,MAAM,MAAM,oCAAoC,GAAG,yBAAyB,CAC1E,gBAAgB,EAChB,iCAAiC,CAClC,CAAA;AAED,MAAM,MAAM,oCAAoC,GAC9C,yBAAyB,CAAC,iCAAiC,CAAC,CAAA;AAE9D,MAAM,MAAM,mCAAmC,GAAG,wBAAwB,CACxE,gBAAgB,EAChB,sBAAsB,CACvB,CAAA;AAED,MAAM,MAAM,mCAAmC,GAAG,wBAAwB,CAAC,sBAAsB,CAAC,CAAA"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"pocket-knife.js","sources":["../../../src/icons/pocket-knife.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name PocketKnife\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMyAydjFjMCAxIDIgMSAyIDJTMyA2IDMgN3MyIDEgMiAyLTIgMS0yIDIgMiAxIDIgMiIgLz4KICA8cGF0aCBkPSJNMTggNmguMDEiIC8+CiAgPHBhdGggZD0iTTYgMThoLjAxIiAvPgogIDxwYXRoIGQ9Ik0yMC44MyA4LjgzYTQgNCAwIDAgMC01LjY2LTUuNjZsLTEyIDEyYTQgNCAwIDEgMCA1LjY2IDUuNjZaIiAvPgogIDxwYXRoIGQ9Ik0xOCAxMS42NlYyMmE0IDQgMCAwIDAgNC00VjYiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/pocket-knife\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 PocketKnife = createLucideIcon('PocketKnife', [\n ['path', { d: 'M3 2v1c0 1 2 1 2 2S3 6 3 7s2 1 2 2-2 1-2 2 2 1 2 2', key: '19w3oe' }],\n ['path', { d: 'M18 6h.01', key: '1v4wsw' }],\n ['path', { d: 'M6 18h.01', key: 'uhywen' }],\n ['path', { d: 'M20.83 8.83a4 4 0 0 0-5.66-5.66l-12 12a4 4 0 1 0 5.66 5.66Z', key: '6fykxj' }],\n ['path', { d: 'M18 11.66V22a4 4 0 0 0 4-4V6', key: '1utzek' }],\n]);\n\nexport default PocketKnife;\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,CAAsD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CACnF,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,CAA+D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CAC5F,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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;AAC/D,CAAC,CAAA,CAAA;;"}

View File

@@ -0,0 +1,316 @@
import { status as httpStatus } from 'http-status';
import { executeAccess } from '../../auth/executeAccess.js';
import { APIError } from '../../errors/index.js';
import { commitTransaction } from '../../utilities/commitTransaction.js';
import { initTransaction } from '../../utilities/initTransaction.js';
import { killTransaction } from '../../utilities/killTransaction.js';
import { traverseFields } from '../../utilities/traverseFields.js';
import { generateKeyBetween, generateNKeysBetween } from './fractional-indexing.js';
/**
* This function creates:
* - N fields per collection, named `_order` or `_<collection>_<joinField>_order`
* - 1 hook per collection
* - 1 endpoint per app
*
* Also, if collection.defaultSort or joinField.defaultSort is not set, it will be set to the orderable field.
*/ export const setupOrderable = (config)=>{
const fieldsToAdd = new Map();
config.collections.forEach((collection)=>{
if (collection.orderable) {
const currentFields = fieldsToAdd.get(collection) || [];
fieldsToAdd.set(collection, [
...currentFields,
'_order'
]);
collection.defaultSort = collection.defaultSort ?? '_order';
}
traverseFields({
callback: ({ field, parentRef, ref })=>{
if (field.type === 'array' || field.type === 'blocks') {
return false;
}
if (field.type === 'group' || field.type === 'tab') {
// @ts-expect-error ref is untyped
const parentPrefix = parentRef?.prefix ? `${parentRef.prefix}_` : '';
// @ts-expect-error ref is untyped
ref.prefix = `${parentPrefix}${field.name}`;
}
if (field.type === 'join' && field.orderable === true) {
if (Array.isArray(field.collection)) {
throw new APIError('Orderable joins must target a single collection', httpStatus.BAD_REQUEST, {}, true);
}
const relationshipCollection = config.collections.find((c)=>c.slug === field.collection);
if (!relationshipCollection) {
return false;
}
field.defaultSort = field.defaultSort ?? `_${field.collection}_${field.name}_order`;
const currentFields = fieldsToAdd.get(relationshipCollection) || [];
// @ts-expect-error ref is untyped
const prefix = parentRef?.prefix ? `${parentRef.prefix}_` : '';
fieldsToAdd.set(relationshipCollection, [
...currentFields,
`_${field.collection}_${prefix}${field.name}_order`
]);
}
},
fields: collection.fields
});
});
Array.from(fieldsToAdd.entries()).forEach(([collection, orderableFields])=>{
addOrderableFieldsAndHook(collection, orderableFields);
});
if (fieldsToAdd.size > 0) {
addOrderableEndpoint(config);
}
};
export const addOrderableFieldsAndHook = (collection, orderableFieldNames)=>{
// 1. Add field
orderableFieldNames.forEach((orderableFieldName)=>{
const orderField = {
name: orderableFieldName,
type: 'text',
admin: {
disableBulkEdit: true,
disabled: true,
disableGroupBy: true,
disableListColumn: true,
disableListFilter: true,
hidden: true,
readOnly: true
},
hooks: {
beforeDuplicate: [
({ siblingData })=>{
delete siblingData[orderableFieldName];
}
]
},
index: true
};
collection.fields.unshift(orderField);
});
// 2. Add hook
if (!collection.hooks) {
collection.hooks = {};
}
if (!collection.hooks.beforeChange) {
collection.hooks.beforeChange = [];
}
const orderBeforeChangeHook = async ({ data, originalDoc, req })=>{
for (const orderableFieldName of orderableFieldNames){
if (!data[orderableFieldName] && !originalDoc?.[orderableFieldName]) {
const lastDoc = await req.payload.find({
collection: collection.slug,
depth: 0,
limit: 1,
pagination: false,
req,
select: {
[orderableFieldName]: true
},
sort: `-${orderableFieldName}`,
where: {
[orderableFieldName]: {
exists: true
}
}
});
const lastOrderValue = lastDoc.docs[0]?.[orderableFieldName] || null;
data[orderableFieldName] = generateKeyBetween(lastOrderValue, null);
}
}
return data;
};
collection.hooks.beforeChange.push(orderBeforeChangeHook);
};
export const addOrderableEndpoint = (config)=>{
// 3. Add endpoint
const reorderHandler = async (req)=>{
const body = await req.json?.();
const { collectionSlug, docsToMove, newKeyWillBe, orderableFieldName, target } = body;
if (!Array.isArray(docsToMove) || docsToMove.length === 0) {
return new Response(JSON.stringify({
error: 'docsToMove must be a non-empty array'
}), {
headers: {
'Content-Type': 'application/json'
},
status: 400
});
}
if (newKeyWillBe !== 'greater' && newKeyWillBe !== 'less') {
return new Response(JSON.stringify({
error: 'newKeyWillBe must be "greater" or "less"'
}), {
headers: {
'Content-Type': 'application/json'
},
status: 400
});
}
const collection = config.collections.find((c)=>c.slug === collectionSlug);
if (!collection) {
return new Response(JSON.stringify({
error: `Collection ${collectionSlug} not found`
}), {
headers: {
'Content-Type': 'application/json'
},
status: 400
});
}
if (typeof orderableFieldName !== 'string') {
return new Response(JSON.stringify({
error: 'orderableFieldName must be a string'
}), {
headers: {
'Content-Type': 'application/json'
},
status: 400
});
}
// Prevent reordering if user doesn't have editing permissions
if (collection.access?.update) {
await executeAccess({
// Currently only one doc can be moved at a time. We should review this if we want to allow
// multiple docs to be moved at once in the future.
id: docsToMove[0],
data: {},
req
}, collection.access.update);
}
/**
* If there is no target.key, we can assume the user enabled `orderable`
* on a collection with existing documents, and that this is the first
* time they tried to reorder them. Therefore, we perform a one-time
* migration by setting the key value for all documents. We do this
* instead of enforcing `required` and `unique` at the database schema
* level, so that users don't have to run a migration when they enable
* `orderable` on a collection with existing documents.
*/ if (!target.key) {
const { docs } = await req.payload.find({
collection: collection.slug,
depth: 0,
limit: 0,
req,
select: {
[orderableFieldName]: true
},
where: {
[orderableFieldName]: {
exists: false
}
}
});
await initTransaction(req);
// We cannot update all documents in a single operation with `payload.update`,
// because they would all end up with the same order key (`a0`).
try {
for (const doc of docs){
await req.payload.update({
id: doc.id,
collection: collection.slug,
data: {
},
depth: 0,
req
});
await commitTransaction(req);
}
} catch (e) {
await killTransaction(req);
if (e instanceof Error) {
throw new APIError(e.message, httpStatus.INTERNAL_SERVER_ERROR);
}
}
return new Response(JSON.stringify({
message: 'initial migration',
success: true
}), {
headers: {
'Content-Type': 'application/json'
},
status: 200
});
}
if (typeof target !== 'object' || typeof target.id === 'undefined' || typeof target.key !== 'string') {
return new Response(JSON.stringify({
error: 'target must be an object with id'
}), {
headers: {
'Content-Type': 'application/json'
},
status: 400
});
}
const targetId = target.id;
let targetKey = target.key;
// If targetKey = pending, we need to find its current key.
// This can only happen if the user reorders rows quickly with a slow connection.
if (targetKey === 'pending') {
const beforeDoc = await req.payload.findByID({
id: targetId,
collection: collection.slug,
depth: 0,
select: {
[orderableFieldName]: true
}
});
targetKey = beforeDoc?.[orderableFieldName] || null;
}
// The reason the endpoint does not receive this docId as an argument is that there
// are situations where the user may not see or know what the next or previous one is. For
// example, access control restrictions, if docBefore is the last one on the page, etc.
const adjacentDoc = await req.payload.find({
collection: collection.slug,
depth: 0,
limit: 1,
pagination: false,
select: {
[orderableFieldName]: true
},
sort: newKeyWillBe === 'greater' ? orderableFieldName : `-${orderableFieldName}`,
where: {
[orderableFieldName]: {
[newKeyWillBe === 'greater' ? 'greater_than' : 'less_than']: targetKey
}
}
});
const adjacentDocKey = adjacentDoc.docs?.[0]?.[orderableFieldName] || null;
// Currently N (= docsToMove.length) is always 1. Maybe in the future we will
// allow dragging and reordering multiple documents at once via the UI.
const orderValues = newKeyWillBe === 'greater' ? generateNKeysBetween(targetKey, adjacentDocKey, docsToMove.length) : generateNKeysBetween(adjacentDocKey, targetKey, docsToMove.length);
// Update each document with its new order value
for (const [index, id] of docsToMove.entries()){
await req.payload.update({
id,
collection: collection.slug,
data: {
[orderableFieldName]: orderValues[index]
},
depth: 0,
req
});
}
return new Response(JSON.stringify({
orderValues,
success: true
}), {
headers: {
'Content-Type': 'application/json'
},
status: 200
});
};
const reorderEndpoint = {
handler: reorderHandler,
method: 'post',
path: '/reorder'
};
if (!config.endpoints) {
config.endpoints = [];
}
config.endpoints.push(reorderEndpoint);
};
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,57 @@
"use strict";
exports.closestIndexTo = closestIndexTo;
var _index = require("./toDate.js");
/**
* @name closestIndexTo
* @category Common Helpers
* @summary Return an index of the closest date from the array comparing to the given date.
*
* @description
* Return an index of the closest date from the array comparing to 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 dateToCompare - The date to compare with
* @param dates - The array to search
*
* @returns An index of the date closest to the given date or undefined if no valid value is given
*
* @example
* // Which date is closer to 6 September 2015?
* const dateToCompare = new Date(2015, 8, 6)
* const datesArray = [
* new Date(2015, 0, 1),
* new Date(2016, 0, 1),
* new Date(2017, 0, 1)
* ]
* const result = closestIndexTo(dateToCompare, datesArray)
* //=> 1
*/
function closestIndexTo(dateToCompare, dates) {
const date = (0, _index.toDate)(dateToCompare);
if (isNaN(Number(date))) return NaN;
const timeToCompare = date.getTime();
let result;
let minDistance;
dates.forEach(function (dirtyDate, index) {
const currentDate = (0, _index.toDate)(dirtyDate);
if (isNaN(Number(currentDate))) {
result = NaN;
minDistance = NaN;
return;
}
const distance = Math.abs(timeToCompare - currentDate.getTime());
if (result == null || distance < minDistance) {
result = index;
minDistance = distance;
}
});
return result;
}

View File

@@ -0,0 +1,60 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var migrator_exports = {};
__export(migrator_exports, {
migrate: () => migrate
});
module.exports = __toCommonJS(migrator_exports);
var import_migrator = require("../migrator.cjs");
var import_sql = require("../sql/sql.cjs");
async function migrate(db, config) {
const migrations = (0, import_migrator.readMigrationFiles)(config);
const migrationsTable = config.migrationsTable ?? "__drizzle_migrations";
const migrationTableCreate = import_sql.sql`
CREATE TABLE IF NOT EXISTS ${import_sql.sql.identifier(migrationsTable)} (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at numeric
)
`;
await db.session.run(migrationTableCreate);
const dbMigrations = await db.values(
import_sql.sql`SELECT id, hash, created_at FROM ${import_sql.sql.identifier(migrationsTable)} ORDER BY created_at DESC LIMIT 1`
);
const lastDbMigration = dbMigrations[0] ?? void 0;
const statementToBatch = [];
for (const migration of migrations) {
if (!lastDbMigration || Number(lastDbMigration[2]) < migration.folderMillis) {
for (const stmt of migration.sql) {
statementToBatch.push(db.run(import_sql.sql.raw(stmt)));
}
statementToBatch.push(
db.run(
import_sql.sql`INSERT INTO ${import_sql.sql.identifier(migrationsTable)} ("hash", "created_at") VALUES(${migration.hash}, ${migration.folderMillis})`
)
);
}
}
await db.session.migrate(statementToBatch);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
migrate
});
//# sourceMappingURL=migrator.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/uploads/fetchAPI-multipart/uploadTimer.ts"],"sourcesContent":["type CreateUploadTimer = (\n timeout?: number,\n callback?: () => void,\n) => {\n clear: () => void\n set: () => boolean\n}\n\nexport const createUploadTimer: CreateUploadTimer = (timeout = 0, callback = () => {}) => {\n let timer: NodeJS.Timeout | null | number = null\n\n const clear = () => {\n clearTimeout(timer!)\n }\n\n const set = () => {\n // Do not start a timer if zero timeout or it hasn't been set.\n if (!timeout) {\n return false\n }\n clear()\n timer = setTimeout(callback, timeout)\n return true\n }\n\n return { clear, set }\n}\n"],"names":["createUploadTimer","timeout","callback","timer","clear","clearTimeout","set","setTimeout"],"mappings":"AAQA,OAAO,MAAMA,oBAAuC,CAACC,UAAU,CAAC,EAAEC,WAAW,KAAO,CAAC;IACnF,IAAIC,QAAwC;IAE5C,MAAMC,QAAQ;QACZC,aAAaF;IACf;IAEA,MAAMG,MAAM;QACV,8DAA8D;QAC9D,IAAI,CAACL,SAAS;YACZ,OAAO;QACT;QACAG;QACAD,QAAQI,WAAWL,UAAUD;QAC7B,OAAO;IACT;IAEA,OAAO;QAAEG;QAAOE;IAAI;AACtB,EAAC"}

View File

@@ -0,0 +1,11 @@
import type { DeepPartial } from 'ts-essentials';
import type { CollectionSlug } from '../../index.js';
import type { TransformCollectionWithSelect } from '../../types/index.js';
import type { RequiredDataFromCollectionSlug, SelectFromCollectionSlug } from '../config/types.js';
import { type Arguments as CreateArguments } from './create.js';
export type Arguments<TSlug extends CollectionSlug> = {
data?: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>;
id: number | string;
} & Omit<CreateArguments<TSlug>, 'data' | 'duplicateFromID'>;
export declare const duplicateOperation: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(incomingArgs: Arguments<TSlug>) => Promise<TransformCollectionWithSelect<TSlug, TSelect>>;
//# sourceMappingURL=duplicate.d.ts.map

View File

@@ -0,0 +1,2 @@
const e=e=>()=>({method:`POST`,path:`/schema/apply`,body:JSON.stringify(e)});export{e as schemaApply};
//# sourceMappingURL=apply.js.map

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