feat(auth): implement user authentication system
This commit is contained in:
parent
4847ab793a
commit
25cea4fbe8
12051 changed files with 1462377 additions and 0 deletions
21
backend/node_modules/jest-snapshot/LICENSE
generated
vendored
Normal file
21
backend/node_modules/jest-snapshot/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
421
backend/node_modules/jest-snapshot/build/InlineSnapshots.js
generated
vendored
Normal file
421
backend/node_modules/jest-snapshot/build/InlineSnapshots.js
generated
vendored
Normal file
|
|
@ -0,0 +1,421 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.saveInlineSnapshots = saveInlineSnapshots;
|
||||
var path = _interopRequireWildcard(require('path'));
|
||||
var _util = require('util');
|
||||
var fs = _interopRequireWildcard(require('graceful-fs'));
|
||||
var _semver = _interopRequireDefault(require('semver'));
|
||||
var _utils = require('./utils');
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function (nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interopRequireWildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
var jestWriteFile =
|
||||
globalThis[Symbol.for('jest-native-write-file')] || fs.writeFileSync;
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
var jestReadFile =
|
||||
globalThis[Symbol.for('jest-native-read-file')] || fs.readFileSync;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
// prettier-ignore
|
||||
const generate = // @ts-expect-error requireOutside Babel transform
|
||||
require(require.resolve('@babel/generator', {
|
||||
[(globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol).for('jest-resolve-outside-vm-option')]: true
|
||||
})).default;
|
||||
const {
|
||||
isAwaitExpression,
|
||||
templateElement,
|
||||
templateLiteral,
|
||||
traverse,
|
||||
traverseFast
|
||||
} = require(require.resolve('@babel/types', { // @ts-expect-error requireOutside Babel transform
|
||||
[(globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol).for(
|
||||
'jest-resolve-outside-vm-option'
|
||||
)]: true
|
||||
}));
|
||||
// @ts-expect-error requireOutside Babel transform
|
||||
const {parseSync} = require(require.resolve('@babel/core', {
|
||||
[(globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol).for(
|
||||
'jest-resolve-outside-vm-option'
|
||||
)]: true
|
||||
}));
|
||||
function saveInlineSnapshots(snapshots, rootDir, prettierPath) {
|
||||
let prettier = null;
|
||||
if (prettierPath) {
|
||||
try {
|
||||
// @ts-expect-error requireOutside Babel transform
|
||||
prettier = require(require.resolve(prettierPath, {
|
||||
[(globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol).for(
|
||||
'jest-resolve-outside-vm-option'
|
||||
)]: true
|
||||
}));
|
||||
if (_semver.default.gte(prettier.version, '3.0.0')) {
|
||||
throw new Error(
|
||||
'Jest: Inline Snapshots are not supported when using Prettier 3.0.0 or above.\nSee https://jestjs.io/docs/configuration/#prettierpath-string for alternatives.'
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
if (!_util.types.isNativeError(error)) {
|
||||
throw error;
|
||||
}
|
||||
if (error.code !== 'MODULE_NOT_FOUND') {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
const snapshotsByFile = groupSnapshotsByFile(snapshots);
|
||||
for (const sourceFilePath of Object.keys(snapshotsByFile)) {
|
||||
saveSnapshotsForFile(
|
||||
snapshotsByFile[sourceFilePath],
|
||||
sourceFilePath,
|
||||
rootDir,
|
||||
prettier && _semver.default.gte(prettier.version, '1.5.0')
|
||||
? prettier
|
||||
: undefined
|
||||
);
|
||||
}
|
||||
}
|
||||
const saveSnapshotsForFile = (snapshots, sourceFilePath, rootDir, prettier) => {
|
||||
const sourceFile = jestReadFile(sourceFilePath, 'utf8');
|
||||
|
||||
// TypeScript projects may not have a babel config; make sure they can be parsed anyway.
|
||||
const presets = [require.resolve('babel-preset-current-node-syntax')];
|
||||
const plugins = [];
|
||||
if (/\.([cm]?ts|tsx)$/.test(sourceFilePath)) {
|
||||
plugins.push([
|
||||
require.resolve('@babel/plugin-syntax-typescript'),
|
||||
{
|
||||
isTSX: sourceFilePath.endsWith('x')
|
||||
},
|
||||
// unique name to make sure Babel does not complain about a possible duplicate plugin.
|
||||
'TypeScript syntax plugin added by Jest snapshot'
|
||||
]);
|
||||
}
|
||||
|
||||
// Record the matcher names seen during traversal and pass them down one
|
||||
// by one to formatting parser.
|
||||
const snapshotMatcherNames = [];
|
||||
let ast = null;
|
||||
try {
|
||||
ast = parseSync(sourceFile, {
|
||||
filename: sourceFilePath,
|
||||
plugins,
|
||||
presets,
|
||||
root: rootDir
|
||||
});
|
||||
} catch (error) {
|
||||
// attempt to recover from missing jsx plugin
|
||||
if (error.message.includes('@babel/plugin-syntax-jsx')) {
|
||||
try {
|
||||
const jsxSyntaxPlugin = [
|
||||
require.resolve('@babel/plugin-syntax-jsx'),
|
||||
{},
|
||||
// unique name to make sure Babel does not complain about a possible duplicate plugin.
|
||||
'JSX syntax plugin added by Jest snapshot'
|
||||
];
|
||||
ast = parseSync(sourceFile, {
|
||||
filename: sourceFilePath,
|
||||
plugins: [...plugins, jsxSyntaxPlugin],
|
||||
presets,
|
||||
root: rootDir
|
||||
});
|
||||
} catch {
|
||||
throw error;
|
||||
}
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
if (!ast) {
|
||||
throw new Error(`jest-snapshot: Failed to parse ${sourceFilePath}`);
|
||||
}
|
||||
traverseAst(snapshots, ast, snapshotMatcherNames);
|
||||
|
||||
// substitute in the snapshots in reverse order, so slice calculations aren't thrown off.
|
||||
const sourceFileWithSnapshots = snapshots.reduceRight(
|
||||
(sourceSoFar, nextSnapshot) => {
|
||||
const {node} = nextSnapshot;
|
||||
if (
|
||||
!node ||
|
||||
typeof node.start !== 'number' ||
|
||||
typeof node.end !== 'number'
|
||||
) {
|
||||
throw new Error('Jest: no snapshot insert location found');
|
||||
}
|
||||
|
||||
// A hack to prevent unexpected line breaks in the generated code
|
||||
node.loc.end.line = node.loc.start.line;
|
||||
return (
|
||||
sourceSoFar.slice(0, node.start) +
|
||||
generate(node, {
|
||||
retainLines: true
|
||||
}).code.trim() +
|
||||
sourceSoFar.slice(node.end)
|
||||
);
|
||||
},
|
||||
sourceFile
|
||||
);
|
||||
const newSourceFile = prettier
|
||||
? runPrettier(
|
||||
prettier,
|
||||
sourceFilePath,
|
||||
sourceFileWithSnapshots,
|
||||
snapshotMatcherNames
|
||||
)
|
||||
: sourceFileWithSnapshots;
|
||||
if (newSourceFile !== sourceFile) {
|
||||
jestWriteFile(sourceFilePath, newSourceFile);
|
||||
}
|
||||
};
|
||||
const groupSnapshotsBy = createKey => snapshots =>
|
||||
snapshots.reduce((object, inlineSnapshot) => {
|
||||
const key = createKey(inlineSnapshot);
|
||||
return {
|
||||
...object,
|
||||
[key]: (object[key] || []).concat(inlineSnapshot)
|
||||
};
|
||||
}, {});
|
||||
const groupSnapshotsByFrame = groupSnapshotsBy(({frame: {line, column}}) =>
|
||||
typeof line === 'number' && typeof column === 'number'
|
||||
? `${line}:${column - 1}`
|
||||
: ''
|
||||
);
|
||||
const groupSnapshotsByFile = groupSnapshotsBy(({frame: {file}}) => file);
|
||||
const indent = (snapshot, numIndents, indentation) => {
|
||||
const lines = snapshot.split('\n');
|
||||
// Prevent re-indentation of inline snapshots.
|
||||
if (
|
||||
lines.length >= 2 &&
|
||||
lines[1].startsWith(indentation.repeat(numIndents + 1))
|
||||
) {
|
||||
return snapshot;
|
||||
}
|
||||
return lines
|
||||
.map((line, index) => {
|
||||
if (index === 0) {
|
||||
// First line is either a 1-line snapshot or a blank line.
|
||||
return line;
|
||||
} else if (index !== lines.length - 1) {
|
||||
// Do not indent empty lines.
|
||||
if (line === '') {
|
||||
return line;
|
||||
}
|
||||
|
||||
// Not last line, indent one level deeper than expect call.
|
||||
return indentation.repeat(numIndents + 1) + line;
|
||||
} else {
|
||||
// The last line should be placed on the same level as the expect call.
|
||||
return indentation.repeat(numIndents) + line;
|
||||
}
|
||||
})
|
||||
.join('\n');
|
||||
};
|
||||
const traverseAst = (snapshots, ast, snapshotMatcherNames) => {
|
||||
const groupedSnapshots = groupSnapshotsByFrame(snapshots);
|
||||
const remainingSnapshots = new Set(snapshots.map(({snapshot}) => snapshot));
|
||||
traverseFast(ast, node => {
|
||||
if (node.type !== 'CallExpression') return;
|
||||
const {arguments: args, callee} = node;
|
||||
if (
|
||||
callee.type !== 'MemberExpression' ||
|
||||
callee.property.type !== 'Identifier' ||
|
||||
callee.property.loc == null
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const {line, column} = callee.property.loc.start;
|
||||
const snapshotsForFrame = groupedSnapshots[`${line}:${column}`];
|
||||
if (!snapshotsForFrame) {
|
||||
return;
|
||||
}
|
||||
if (snapshotsForFrame.length > 1) {
|
||||
throw new Error(
|
||||
'Jest: Multiple inline snapshots for the same call are not supported.'
|
||||
);
|
||||
}
|
||||
const inlineSnapshot = snapshotsForFrame[0];
|
||||
inlineSnapshot.node = node;
|
||||
snapshotMatcherNames.push(callee.property.name);
|
||||
const snapshotIndex = args.findIndex(
|
||||
({type}) => type === 'TemplateLiteral' || type === 'StringLiteral'
|
||||
);
|
||||
const {snapshot} = inlineSnapshot;
|
||||
remainingSnapshots.delete(snapshot);
|
||||
const replacementNode = templateLiteral(
|
||||
[
|
||||
templateElement({
|
||||
raw: (0, _utils.escapeBacktickString)(snapshot)
|
||||
})
|
||||
],
|
||||
[]
|
||||
);
|
||||
if (snapshotIndex > -1) {
|
||||
args[snapshotIndex] = replacementNode;
|
||||
} else {
|
||||
args.push(replacementNode);
|
||||
}
|
||||
});
|
||||
if (remainingSnapshots.size) {
|
||||
throw new Error("Jest: Couldn't locate all inline snapshots.");
|
||||
}
|
||||
};
|
||||
const runPrettier = (
|
||||
prettier,
|
||||
sourceFilePath,
|
||||
sourceFileWithSnapshots,
|
||||
snapshotMatcherNames
|
||||
) => {
|
||||
// Resolve project configuration.
|
||||
// For older versions of Prettier, do not load configuration.
|
||||
const config = prettier.resolveConfig
|
||||
? prettier.resolveConfig.sync(sourceFilePath, {
|
||||
editorconfig: true
|
||||
})
|
||||
: null;
|
||||
|
||||
// Prioritize parser found in the project config.
|
||||
// If not found detect the parser for the test file.
|
||||
// For older versions of Prettier, fallback to a simple parser detection.
|
||||
// @ts-expect-error - `inferredParser` is `string`
|
||||
const inferredParser =
|
||||
(config && typeof config.parser === 'string' && config.parser) ||
|
||||
(prettier.getFileInfo
|
||||
? prettier.getFileInfo.sync(sourceFilePath).inferredParser
|
||||
: simpleDetectParser(sourceFilePath));
|
||||
if (!inferredParser) {
|
||||
throw new Error(
|
||||
`Could not infer Prettier parser for file ${sourceFilePath}`
|
||||
);
|
||||
}
|
||||
|
||||
// Snapshots have now been inserted. Run prettier to make sure that the code is
|
||||
// formatted, except snapshot indentation. Snapshots cannot be formatted until
|
||||
// after the initial format because we don't know where the call expression
|
||||
// will be placed (specifically its indentation), so we have to do two
|
||||
// prettier.format calls back-to-back.
|
||||
return prettier.format(
|
||||
prettier.format(sourceFileWithSnapshots, {
|
||||
...config,
|
||||
filepath: sourceFilePath
|
||||
}),
|
||||
{
|
||||
...config,
|
||||
filepath: sourceFilePath,
|
||||
parser: createFormattingParser(snapshotMatcherNames, inferredParser)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
// This parser formats snapshots to the correct indentation.
|
||||
const createFormattingParser =
|
||||
(snapshotMatcherNames, inferredParser) => (text, parsers, options) => {
|
||||
// Workaround for https://github.com/prettier/prettier/issues/3150
|
||||
options.parser = inferredParser;
|
||||
const ast = parsers[inferredParser](text, options);
|
||||
traverse(ast, (node, ancestors) => {
|
||||
if (node.type !== 'CallExpression') return;
|
||||
const {arguments: args, callee} = node;
|
||||
if (
|
||||
callee.type !== 'MemberExpression' ||
|
||||
callee.property.type !== 'Identifier' ||
|
||||
!snapshotMatcherNames.includes(callee.property.name) ||
|
||||
!callee.loc ||
|
||||
callee.computed
|
||||
) {
|
||||
return;
|
||||
}
|
||||
let snapshotIndex;
|
||||
let snapshot;
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
const node = args[i];
|
||||
if (node.type === 'TemplateLiteral') {
|
||||
snapshotIndex = i;
|
||||
snapshot = node.quasis[0].value.raw;
|
||||
}
|
||||
}
|
||||
if (snapshot === undefined) {
|
||||
return;
|
||||
}
|
||||
const parent = ancestors[ancestors.length - 1].node;
|
||||
const startColumn =
|
||||
isAwaitExpression(parent) && parent.loc
|
||||
? parent.loc.start.column
|
||||
: callee.loc.start.column;
|
||||
const useSpaces = !options.useTabs;
|
||||
snapshot = indent(
|
||||
snapshot,
|
||||
Math.ceil(
|
||||
useSpaces
|
||||
? startColumn / (options.tabWidth ?? 1)
|
||||
: // Each tab is 2 characters.
|
||||
startColumn / 2
|
||||
),
|
||||
useSpaces ? ' '.repeat(options.tabWidth ?? 1) : '\t'
|
||||
);
|
||||
const replacementNode = templateLiteral(
|
||||
[
|
||||
templateElement({
|
||||
raw: snapshot
|
||||
})
|
||||
],
|
||||
[]
|
||||
);
|
||||
args[snapshotIndex] = replacementNode;
|
||||
});
|
||||
return ast;
|
||||
};
|
||||
const simpleDetectParser = filePath => {
|
||||
const extname = path.extname(filePath);
|
||||
if (/\.tsx?$/.test(extname)) {
|
||||
return 'typescript';
|
||||
}
|
||||
return 'babel';
|
||||
};
|
||||
153
backend/node_modules/jest-snapshot/build/SnapshotResolver.js
generated
vendored
Normal file
153
backend/node_modules/jest-snapshot/build/SnapshotResolver.js
generated
vendored
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.isSnapshotPath =
|
||||
exports.buildSnapshotResolver =
|
||||
exports.EXTENSION =
|
||||
exports.DOT_EXTENSION =
|
||||
void 0;
|
||||
var path = _interopRequireWildcard(require('path'));
|
||||
var _chalk = _interopRequireDefault(require('chalk'));
|
||||
var _transform = require('@jest/transform');
|
||||
var _jestUtil = require('jest-util');
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function (nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interopRequireWildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const EXTENSION = 'snap';
|
||||
exports.EXTENSION = EXTENSION;
|
||||
const DOT_EXTENSION = `.${EXTENSION}`;
|
||||
exports.DOT_EXTENSION = DOT_EXTENSION;
|
||||
const isSnapshotPath = path => path.endsWith(DOT_EXTENSION);
|
||||
exports.isSnapshotPath = isSnapshotPath;
|
||||
const cache = new Map();
|
||||
const buildSnapshotResolver = async (
|
||||
config,
|
||||
localRequire = (0, _transform.createTranspilingRequire)(config)
|
||||
) => {
|
||||
const key = config.rootDir;
|
||||
const resolver =
|
||||
cache.get(key) ??
|
||||
(await createSnapshotResolver(await localRequire, config.snapshotResolver));
|
||||
cache.set(key, resolver);
|
||||
return resolver;
|
||||
};
|
||||
exports.buildSnapshotResolver = buildSnapshotResolver;
|
||||
async function createSnapshotResolver(localRequire, snapshotResolverPath) {
|
||||
return typeof snapshotResolverPath === 'string'
|
||||
? createCustomSnapshotResolver(snapshotResolverPath, localRequire)
|
||||
: createDefaultSnapshotResolver();
|
||||
}
|
||||
function createDefaultSnapshotResolver() {
|
||||
return {
|
||||
resolveSnapshotPath: testPath =>
|
||||
path.join(
|
||||
path.join(path.dirname(testPath), '__snapshots__'),
|
||||
path.basename(testPath) + DOT_EXTENSION
|
||||
),
|
||||
resolveTestPath: snapshotPath =>
|
||||
path.resolve(
|
||||
path.dirname(snapshotPath),
|
||||
'..',
|
||||
path.basename(snapshotPath, DOT_EXTENSION)
|
||||
),
|
||||
testPathForConsistencyCheck: path.posix.join(
|
||||
'consistency_check',
|
||||
'__tests__',
|
||||
'example.test.js'
|
||||
)
|
||||
};
|
||||
}
|
||||
async function createCustomSnapshotResolver(
|
||||
snapshotResolverPath,
|
||||
localRequire
|
||||
) {
|
||||
const custom = (0, _jestUtil.interopRequireDefault)(
|
||||
await localRequire(snapshotResolverPath)
|
||||
).default;
|
||||
const keys = [
|
||||
['resolveSnapshotPath', 'function'],
|
||||
['resolveTestPath', 'function'],
|
||||
['testPathForConsistencyCheck', 'string']
|
||||
];
|
||||
keys.forEach(([propName, requiredType]) => {
|
||||
if (typeof custom[propName] !== requiredType) {
|
||||
throw new TypeError(mustImplement(propName, requiredType));
|
||||
}
|
||||
});
|
||||
const customResolver = {
|
||||
resolveSnapshotPath: testPath =>
|
||||
custom.resolveSnapshotPath(testPath, DOT_EXTENSION),
|
||||
resolveTestPath: snapshotPath =>
|
||||
custom.resolveTestPath(snapshotPath, DOT_EXTENSION),
|
||||
testPathForConsistencyCheck: custom.testPathForConsistencyCheck
|
||||
};
|
||||
verifyConsistentTransformations(customResolver);
|
||||
return customResolver;
|
||||
}
|
||||
function mustImplement(propName, requiredType) {
|
||||
return `${_chalk.default.bold(
|
||||
`Custom snapshot resolver must implement a \`${propName}\` as a ${requiredType}.`
|
||||
)}\nDocumentation: https://jestjs.io/docs/configuration#snapshotresolver-string`;
|
||||
}
|
||||
function verifyConsistentTransformations(custom) {
|
||||
const resolvedSnapshotPath = custom.resolveSnapshotPath(
|
||||
custom.testPathForConsistencyCheck
|
||||
);
|
||||
const resolvedTestPath = custom.resolveTestPath(resolvedSnapshotPath);
|
||||
if (resolvedTestPath !== custom.testPathForConsistencyCheck) {
|
||||
throw new Error(
|
||||
_chalk.default.bold(
|
||||
`Custom snapshot resolver functions must transform paths consistently, i.e. expects resolveTestPath(resolveSnapshotPath('${custom.testPathForConsistencyCheck}')) === ${resolvedTestPath}`
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
288
backend/node_modules/jest-snapshot/build/State.js
generated
vendored
Normal file
288
backend/node_modules/jest-snapshot/build/State.js
generated
vendored
Normal file
|
|
@ -0,0 +1,288 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var fs = _interopRequireWildcard(require('graceful-fs'));
|
||||
var _jestMessageUtil = require('jest-message-util');
|
||||
var _InlineSnapshots = require('./InlineSnapshots');
|
||||
var _utils = require('./utils');
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function (nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interopRequireWildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
var jestExistsFile =
|
||||
globalThis[Symbol.for('jest-native-exists-file')] || fs.existsSync;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
class SnapshotState {
|
||||
_counters;
|
||||
_dirty;
|
||||
// @ts-expect-error - seemingly unused?
|
||||
_index;
|
||||
_updateSnapshot;
|
||||
_snapshotData;
|
||||
_initialData;
|
||||
_snapshotPath;
|
||||
_inlineSnapshots;
|
||||
_uncheckedKeys;
|
||||
_prettierPath;
|
||||
_rootDir;
|
||||
snapshotFormat;
|
||||
added;
|
||||
expand;
|
||||
matched;
|
||||
unmatched;
|
||||
updated;
|
||||
constructor(snapshotPath, options) {
|
||||
this._snapshotPath = snapshotPath;
|
||||
const {data, dirty} = (0, _utils.getSnapshotData)(
|
||||
this._snapshotPath,
|
||||
options.updateSnapshot
|
||||
);
|
||||
this._initialData = data;
|
||||
this._snapshotData = data;
|
||||
this._dirty = dirty;
|
||||
this._prettierPath = options.prettierPath ?? null;
|
||||
this._inlineSnapshots = [];
|
||||
this._uncheckedKeys = new Set(Object.keys(this._snapshotData));
|
||||
this._counters = new Map();
|
||||
this._index = 0;
|
||||
this.expand = options.expand || false;
|
||||
this.added = 0;
|
||||
this.matched = 0;
|
||||
this.unmatched = 0;
|
||||
this._updateSnapshot = options.updateSnapshot;
|
||||
this.updated = 0;
|
||||
this.snapshotFormat = options.snapshotFormat;
|
||||
this._rootDir = options.rootDir;
|
||||
}
|
||||
markSnapshotsAsCheckedForTest(testName) {
|
||||
this._uncheckedKeys.forEach(uncheckedKey => {
|
||||
if ((0, _utils.keyToTestName)(uncheckedKey) === testName) {
|
||||
this._uncheckedKeys.delete(uncheckedKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
_addSnapshot(key, receivedSerialized, options) {
|
||||
this._dirty = true;
|
||||
if (options.isInline) {
|
||||
const error = options.error || new Error();
|
||||
const lines = (0, _jestMessageUtil.getStackTraceLines)(
|
||||
(0, _utils.removeLinesBeforeExternalMatcherTrap)(error.stack || '')
|
||||
);
|
||||
const frame = (0, _jestMessageUtil.getTopFrame)(lines);
|
||||
if (!frame) {
|
||||
throw new Error(
|
||||
"Jest: Couldn't infer stack frame for inline snapshot."
|
||||
);
|
||||
}
|
||||
this._inlineSnapshots.push({
|
||||
frame,
|
||||
snapshot: receivedSerialized
|
||||
});
|
||||
} else {
|
||||
this._snapshotData[key] = receivedSerialized;
|
||||
}
|
||||
}
|
||||
clear() {
|
||||
this._snapshotData = this._initialData;
|
||||
this._inlineSnapshots = [];
|
||||
this._counters = new Map();
|
||||
this._index = 0;
|
||||
this.added = 0;
|
||||
this.matched = 0;
|
||||
this.unmatched = 0;
|
||||
this.updated = 0;
|
||||
}
|
||||
save() {
|
||||
const hasExternalSnapshots = Object.keys(this._snapshotData).length;
|
||||
const hasInlineSnapshots = this._inlineSnapshots.length;
|
||||
const isEmpty = !hasExternalSnapshots && !hasInlineSnapshots;
|
||||
const status = {
|
||||
deleted: false,
|
||||
saved: false
|
||||
};
|
||||
if ((this._dirty || this._uncheckedKeys.size) && !isEmpty) {
|
||||
if (hasExternalSnapshots) {
|
||||
(0, _utils.saveSnapshotFile)(this._snapshotData, this._snapshotPath);
|
||||
}
|
||||
if (hasInlineSnapshots) {
|
||||
(0, _InlineSnapshots.saveInlineSnapshots)(
|
||||
this._inlineSnapshots,
|
||||
this._rootDir,
|
||||
this._prettierPath
|
||||
);
|
||||
}
|
||||
status.saved = true;
|
||||
} else if (!hasExternalSnapshots && jestExistsFile(this._snapshotPath)) {
|
||||
if (this._updateSnapshot === 'all') {
|
||||
fs.unlinkSync(this._snapshotPath);
|
||||
}
|
||||
status.deleted = true;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
getUncheckedCount() {
|
||||
return this._uncheckedKeys.size || 0;
|
||||
}
|
||||
getUncheckedKeys() {
|
||||
return Array.from(this._uncheckedKeys);
|
||||
}
|
||||
removeUncheckedKeys() {
|
||||
if (this._updateSnapshot === 'all' && this._uncheckedKeys.size) {
|
||||
this._dirty = true;
|
||||
this._uncheckedKeys.forEach(key => delete this._snapshotData[key]);
|
||||
this._uncheckedKeys.clear();
|
||||
}
|
||||
}
|
||||
match({testName, received, key, inlineSnapshot, isInline, error}) {
|
||||
this._counters.set(testName, (this._counters.get(testName) || 0) + 1);
|
||||
const count = Number(this._counters.get(testName));
|
||||
if (!key) {
|
||||
key = (0, _utils.testNameToKey)(testName, count);
|
||||
}
|
||||
|
||||
// Do not mark the snapshot as "checked" if the snapshot is inline and
|
||||
// there's an external snapshot. This way the external snapshot can be
|
||||
// removed with `--updateSnapshot`.
|
||||
if (!(isInline && this._snapshotData[key] !== undefined)) {
|
||||
this._uncheckedKeys.delete(key);
|
||||
}
|
||||
const receivedSerialized = (0, _utils.addExtraLineBreaks)(
|
||||
(0, _utils.serialize)(received, undefined, this.snapshotFormat)
|
||||
);
|
||||
const expected = isInline ? inlineSnapshot : this._snapshotData[key];
|
||||
const pass = expected === receivedSerialized;
|
||||
const hasSnapshot = expected !== undefined;
|
||||
const snapshotIsPersisted = isInline || fs.existsSync(this._snapshotPath);
|
||||
if (pass && !isInline) {
|
||||
// Executing a snapshot file as JavaScript and writing the strings back
|
||||
// when other snapshots have changed loses the proper escaping for some
|
||||
// characters. Since we check every snapshot in every test, use the newly
|
||||
// generated formatted string.
|
||||
// Note that this is only relevant when a snapshot is added and the dirty
|
||||
// flag is set.
|
||||
this._snapshotData[key] = receivedSerialized;
|
||||
}
|
||||
|
||||
// These are the conditions on when to write snapshots:
|
||||
// * There's no snapshot file in a non-CI environment.
|
||||
// * There is a snapshot file and we decided to update the snapshot.
|
||||
// * There is a snapshot file, but it doesn't have this snaphsot.
|
||||
// These are the conditions on when not to write snapshots:
|
||||
// * The update flag is set to 'none'.
|
||||
// * There's no snapshot file or a file without this snapshot on a CI environment.
|
||||
if (
|
||||
(hasSnapshot && this._updateSnapshot === 'all') ||
|
||||
((!hasSnapshot || !snapshotIsPersisted) &&
|
||||
(this._updateSnapshot === 'new' || this._updateSnapshot === 'all'))
|
||||
) {
|
||||
if (this._updateSnapshot === 'all') {
|
||||
if (!pass) {
|
||||
if (hasSnapshot) {
|
||||
this.updated++;
|
||||
} else {
|
||||
this.added++;
|
||||
}
|
||||
this._addSnapshot(key, receivedSerialized, {
|
||||
error,
|
||||
isInline
|
||||
});
|
||||
} else {
|
||||
this.matched++;
|
||||
}
|
||||
} else {
|
||||
this._addSnapshot(key, receivedSerialized, {
|
||||
error,
|
||||
isInline
|
||||
});
|
||||
this.added++;
|
||||
}
|
||||
return {
|
||||
actual: '',
|
||||
count,
|
||||
expected: '',
|
||||
key,
|
||||
pass: true
|
||||
};
|
||||
} else {
|
||||
if (!pass) {
|
||||
this.unmatched++;
|
||||
return {
|
||||
actual: (0, _utils.removeExtraLineBreaks)(receivedSerialized),
|
||||
count,
|
||||
expected:
|
||||
expected !== undefined
|
||||
? (0, _utils.removeExtraLineBreaks)(expected)
|
||||
: undefined,
|
||||
key,
|
||||
pass: false
|
||||
};
|
||||
} else {
|
||||
this.matched++;
|
||||
return {
|
||||
actual: '',
|
||||
count,
|
||||
expected: '',
|
||||
key,
|
||||
pass: true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
fail(testName, _received, key) {
|
||||
this._counters.set(testName, (this._counters.get(testName) || 0) + 1);
|
||||
const count = Number(this._counters.get(testName));
|
||||
if (!key) {
|
||||
key = (0, _utils.testNameToKey)(testName, count);
|
||||
}
|
||||
this._uncheckedKeys.delete(key);
|
||||
this.unmatched++;
|
||||
return key;
|
||||
}
|
||||
}
|
||||
exports.default = SnapshotState;
|
||||
39
backend/node_modules/jest-snapshot/build/colors.js
generated
vendored
Normal file
39
backend/node_modules/jest-snapshot/build/colors.js
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.bForeground3 =
|
||||
exports.bForeground2 =
|
||||
exports.bBackground3 =
|
||||
exports.bBackground2 =
|
||||
exports.aForeground3 =
|
||||
exports.aForeground2 =
|
||||
exports.aBackground3 =
|
||||
exports.aBackground2 =
|
||||
void 0;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// https://jonasjacek.github.io/colors/
|
||||
|
||||
const aForeground2 = 90;
|
||||
exports.aForeground2 = aForeground2;
|
||||
const aBackground2 = 225;
|
||||
exports.aBackground2 = aBackground2;
|
||||
const bForeground2 = 23;
|
||||
exports.bForeground2 = bForeground2;
|
||||
const bBackground2 = 195;
|
||||
exports.bBackground2 = bBackground2;
|
||||
const aForeground3 = [0x80, 0, 0x80];
|
||||
exports.aForeground3 = aForeground3;
|
||||
const aBackground3 = [0xff, 0xd7, 0xff];
|
||||
exports.aBackground3 = aBackground3;
|
||||
const bForeground3 = [0, 0x5f, 0x5f];
|
||||
exports.bForeground3 = bForeground3;
|
||||
const bBackground3 = [0xd7, 0xff, 0xff];
|
||||
exports.bBackground3 = bBackground3;
|
||||
132
backend/node_modules/jest-snapshot/build/dedentLines.js
generated
vendored
Normal file
132
backend/node_modules/jest-snapshot/build/dedentLines.js
generated
vendored
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.dedentLines = void 0;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const getIndentationLength = line => {
|
||||
const result = /^( {2})+/.exec(line);
|
||||
return result === null ? 0 : result[0].length;
|
||||
};
|
||||
const dedentLine = line => line.slice(getIndentationLength(line));
|
||||
|
||||
// Return true if:
|
||||
// "key": "value has multiple lines\n…
|
||||
// "key has multiple lines\n…
|
||||
const hasUnmatchedDoubleQuoteMarks = string => {
|
||||
let n = 0;
|
||||
let i = string.indexOf('"', 0);
|
||||
while (i !== -1) {
|
||||
if (i === 0 || string[i - 1] !== '\\') {
|
||||
n += 1;
|
||||
}
|
||||
i = string.indexOf('"', i + 1);
|
||||
}
|
||||
return n % 2 !== 0;
|
||||
};
|
||||
const isFirstLineOfTag = line => /^( {2})*</.test(line);
|
||||
|
||||
// The length of the output array is the index of the next input line.
|
||||
|
||||
// Push dedented lines of start tag onto output and return true;
|
||||
// otherwise return false because:
|
||||
// * props include a multiline string (or text node, if props have markup)
|
||||
// * start tag does not close
|
||||
const dedentStartTag = (input, output) => {
|
||||
let line = input[output.length];
|
||||
output.push(dedentLine(line));
|
||||
if (line.includes('>')) {
|
||||
return true;
|
||||
}
|
||||
while (output.length < input.length) {
|
||||
line = input[output.length];
|
||||
if (hasUnmatchedDoubleQuoteMarks(line)) {
|
||||
return false; // because props include a multiline string
|
||||
} else if (isFirstLineOfTag(line)) {
|
||||
// Recursion only if props have markup.
|
||||
if (!dedentMarkup(input, output)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
output.push(dedentLine(line));
|
||||
if (line.includes('>')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// Push dedented lines of markup onto output and return true;
|
||||
// otherwise return false because:
|
||||
// * props include a multiline string
|
||||
// * text has more than one adjacent line
|
||||
// * markup does not close
|
||||
const dedentMarkup = (input, output) => {
|
||||
let line = input[output.length];
|
||||
if (!dedentStartTag(input, output)) {
|
||||
return false;
|
||||
}
|
||||
if (input[output.length - 1].includes('/>')) {
|
||||
return true;
|
||||
}
|
||||
let isText = false;
|
||||
const stack = [];
|
||||
stack.push(getIndentationLength(line));
|
||||
while (stack.length > 0 && output.length < input.length) {
|
||||
line = input[output.length];
|
||||
if (isFirstLineOfTag(line)) {
|
||||
if (line.includes('</')) {
|
||||
output.push(dedentLine(line));
|
||||
stack.pop();
|
||||
} else {
|
||||
if (!dedentStartTag(input, output)) {
|
||||
return false;
|
||||
}
|
||||
if (!input[output.length - 1].includes('/>')) {
|
||||
stack.push(getIndentationLength(line));
|
||||
}
|
||||
}
|
||||
isText = false;
|
||||
} else {
|
||||
if (isText) {
|
||||
return false; // because text has more than one adjacent line
|
||||
}
|
||||
|
||||
const indentationLengthOfTag = stack[stack.length - 1];
|
||||
output.push(line.slice(indentationLengthOfTag + 2));
|
||||
isText = true;
|
||||
}
|
||||
}
|
||||
return stack.length === 0;
|
||||
};
|
||||
|
||||
// Return lines unindented by heuristic;
|
||||
// otherwise return null because:
|
||||
// * props include a multiline string
|
||||
// * text has more than one adjacent line
|
||||
// * markup does not close
|
||||
const dedentLines = input => {
|
||||
const output = [];
|
||||
while (output.length < input.length) {
|
||||
const line = input[output.length];
|
||||
if (hasUnmatchedDoubleQuoteMarks(line)) {
|
||||
return null;
|
||||
} else if (isFirstLineOfTag(line)) {
|
||||
if (!dedentMarkup(input, output)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
output.push(dedentLine(line));
|
||||
}
|
||||
}
|
||||
return output;
|
||||
};
|
||||
exports.dedentLines = dedentLines;
|
||||
186
backend/node_modules/jest-snapshot/build/index.d.ts
generated
vendored
Normal file
186
backend/node_modules/jest-snapshot/build/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
/**
|
||||
* 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 {Config} from '@jest/types';
|
||||
import type {MatcherContext} from 'expect';
|
||||
import type {MatcherFunctionWithContext} from 'expect';
|
||||
import {Plugin as Plugin_2} from 'pretty-format';
|
||||
import {Plugins} from 'pretty-format';
|
||||
import type {PrettyFormatOptions} from 'pretty-format';
|
||||
|
||||
export declare const addSerializer: (plugin: Plugin_2) => void;
|
||||
|
||||
export declare const buildSnapshotResolver: (
|
||||
config: Config.ProjectConfig,
|
||||
localRequire?: Promise<LocalRequire> | LocalRequire,
|
||||
) => Promise<SnapshotResolver>;
|
||||
|
||||
export declare const cleanup: (
|
||||
fileSystem: FileSystem_2,
|
||||
update: Config.SnapshotUpdateState,
|
||||
snapshotResolver: SnapshotResolver,
|
||||
testPathIgnorePatterns?: Config.ProjectConfig['testPathIgnorePatterns'],
|
||||
) => {
|
||||
filesRemoved: number;
|
||||
filesRemovedList: Array<string>;
|
||||
};
|
||||
|
||||
export declare interface Context extends MatcherContext {
|
||||
snapshotState: SnapshotState;
|
||||
}
|
||||
|
||||
export declare const EXTENSION = 'snap';
|
||||
|
||||
declare interface FileSystem_2 {
|
||||
exists(path: string): boolean;
|
||||
matchFiles(pattern: RegExp | string): Array<string>;
|
||||
}
|
||||
|
||||
export declare const getSerializers: () => Plugins;
|
||||
|
||||
export declare const isSnapshotPath: (path: string) => boolean;
|
||||
|
||||
declare type LocalRequire = (module: string) => unknown;
|
||||
|
||||
declare type SaveStatus = {
|
||||
deleted: boolean;
|
||||
saved: boolean;
|
||||
};
|
||||
|
||||
declare type SnapshotFormat = Omit<PrettyFormatOptions, 'compareKeys'>;
|
||||
|
||||
export declare interface SnapshotMatchers<R extends void | Promise<void>, T> {
|
||||
/**
|
||||
* This ensures that a value matches the most recent snapshot with property matchers.
|
||||
* Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
|
||||
*/
|
||||
toMatchSnapshot(hint?: string): R;
|
||||
/**
|
||||
* This ensures that a value matches the most recent snapshot.
|
||||
* Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
|
||||
*/
|
||||
toMatchSnapshot<U extends Record<keyof T, unknown>>(
|
||||
propertyMatchers: Partial<U>,
|
||||
hint?: string,
|
||||
): R;
|
||||
/**
|
||||
* This ensures that a value matches the most recent snapshot with property matchers.
|
||||
* Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
|
||||
* Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
|
||||
*/
|
||||
toMatchInlineSnapshot(snapshot?: string): R;
|
||||
/**
|
||||
* This ensures that a value matches the most recent snapshot with property matchers.
|
||||
* Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
|
||||
* Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
|
||||
*/
|
||||
toMatchInlineSnapshot<U extends Record<keyof T, unknown>>(
|
||||
propertyMatchers: Partial<U>,
|
||||
snapshot?: string,
|
||||
): R;
|
||||
/**
|
||||
* Used to test that a function throws a error matching the most recent snapshot when it is called.
|
||||
*/
|
||||
toThrowErrorMatchingSnapshot(hint?: string): R;
|
||||
/**
|
||||
* Used to test that a function throws a error matching the most recent snapshot when it is called.
|
||||
* Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
|
||||
*/
|
||||
toThrowErrorMatchingInlineSnapshot(snapshot?: string): R;
|
||||
}
|
||||
|
||||
declare type SnapshotMatchOptions = {
|
||||
readonly testName: string;
|
||||
readonly received: unknown;
|
||||
readonly key?: string;
|
||||
readonly inlineSnapshot?: string;
|
||||
readonly isInline: boolean;
|
||||
readonly error?: Error;
|
||||
};
|
||||
|
||||
export declare type SnapshotResolver = {
|
||||
/** Resolves from `testPath` to snapshot path. */
|
||||
resolveSnapshotPath(testPath: string, snapshotExtension?: string): string;
|
||||
/** Resolves from `snapshotPath` to test path. */
|
||||
resolveTestPath(snapshotPath: string, snapshotExtension?: string): string;
|
||||
/** Example test path, used for preflight consistency check of the implementation above. */
|
||||
testPathForConsistencyCheck: string;
|
||||
};
|
||||
|
||||
declare type SnapshotReturnOptions = {
|
||||
readonly actual: string;
|
||||
readonly count: number;
|
||||
readonly expected?: string;
|
||||
readonly key: string;
|
||||
readonly pass: boolean;
|
||||
};
|
||||
|
||||
export declare class SnapshotState {
|
||||
private _counters;
|
||||
private _dirty;
|
||||
private _index;
|
||||
private readonly _updateSnapshot;
|
||||
private _snapshotData;
|
||||
private readonly _initialData;
|
||||
private readonly _snapshotPath;
|
||||
private _inlineSnapshots;
|
||||
private readonly _uncheckedKeys;
|
||||
private readonly _prettierPath;
|
||||
private readonly _rootDir;
|
||||
readonly snapshotFormat: SnapshotFormat;
|
||||
added: number;
|
||||
expand: boolean;
|
||||
matched: number;
|
||||
unmatched: number;
|
||||
updated: number;
|
||||
constructor(snapshotPath: string, options: SnapshotStateOptions);
|
||||
markSnapshotsAsCheckedForTest(testName: string): void;
|
||||
private _addSnapshot;
|
||||
clear(): void;
|
||||
save(): SaveStatus;
|
||||
getUncheckedCount(): number;
|
||||
getUncheckedKeys(): Array<string>;
|
||||
removeUncheckedKeys(): void;
|
||||
match({
|
||||
testName,
|
||||
received,
|
||||
key,
|
||||
inlineSnapshot,
|
||||
isInline,
|
||||
error,
|
||||
}: SnapshotMatchOptions): SnapshotReturnOptions;
|
||||
fail(testName: string, _received: unknown, key?: string): string;
|
||||
}
|
||||
|
||||
declare type SnapshotStateOptions = {
|
||||
readonly updateSnapshot: Config.SnapshotUpdateState;
|
||||
readonly prettierPath?: string | null;
|
||||
readonly expand?: boolean;
|
||||
readonly snapshotFormat: SnapshotFormat;
|
||||
readonly rootDir: string;
|
||||
};
|
||||
|
||||
export declare const toMatchInlineSnapshot: MatcherFunctionWithContext<
|
||||
Context,
|
||||
[propertiesOrSnapshot?: object | string, inlineSnapshot?: string]
|
||||
>;
|
||||
|
||||
export declare const toMatchSnapshot: MatcherFunctionWithContext<
|
||||
Context,
|
||||
[propertiesOrHint?: object | string, hint?: string]
|
||||
>;
|
||||
|
||||
export declare const toThrowErrorMatchingInlineSnapshot: MatcherFunctionWithContext<
|
||||
Context,
|
||||
[inlineSnapshot?: string, fromPromise?: boolean]
|
||||
>;
|
||||
|
||||
export declare const toThrowErrorMatchingSnapshot: MatcherFunctionWithContext<
|
||||
Context,
|
||||
[hint?: string, fromPromise?: boolean]
|
||||
>;
|
||||
|
||||
export {};
|
||||
591
backend/node_modules/jest-snapshot/build/index.js
generated
vendored
Normal file
591
backend/node_modules/jest-snapshot/build/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,591 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, 'EXTENSION', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _SnapshotResolver.EXTENSION;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'SnapshotState', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _State.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'addSerializer', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _plugins.addSerializer;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'buildSnapshotResolver', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _SnapshotResolver.buildSnapshotResolver;
|
||||
}
|
||||
});
|
||||
exports.cleanup = void 0;
|
||||
Object.defineProperty(exports, 'getSerializers', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _plugins.getSerializers;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'isSnapshotPath', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _SnapshotResolver.isSnapshotPath;
|
||||
}
|
||||
});
|
||||
exports.toThrowErrorMatchingSnapshot =
|
||||
exports.toThrowErrorMatchingInlineSnapshot =
|
||||
exports.toMatchSnapshot =
|
||||
exports.toMatchInlineSnapshot =
|
||||
void 0;
|
||||
var fs = _interopRequireWildcard(require('graceful-fs'));
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
var _SnapshotResolver = require('./SnapshotResolver');
|
||||
var _printSnapshot = require('./printSnapshot');
|
||||
var _utils = require('./utils');
|
||||
var _plugins = require('./plugins');
|
||||
var _State = _interopRequireDefault(require('./State'));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function (nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interopRequireWildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
var jestExistsFile =
|
||||
globalThis[Symbol.for('jest-native-exists-file')] || fs.existsSync;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
const DID_NOT_THROW = 'Received function did not throw'; // same as toThrow
|
||||
const NOT_SNAPSHOT_MATCHERS = `Snapshot matchers cannot be used with ${(0,
|
||||
_jestMatcherUtils.BOLD_WEIGHT)('not')}`;
|
||||
const INDENTATION_REGEX = /^([^\S\n]*)\S/m;
|
||||
|
||||
// Display name in report when matcher fails same as in snapshot file,
|
||||
// but with optional hint argument in bold weight.
|
||||
const printSnapshotName = (concatenatedBlockNames = '', hint = '', count) => {
|
||||
const hasNames = concatenatedBlockNames.length !== 0;
|
||||
const hasHint = hint.length !== 0;
|
||||
return `Snapshot name: \`${
|
||||
hasNames ? (0, _utils.escapeBacktickString)(concatenatedBlockNames) : ''
|
||||
}${hasNames && hasHint ? ': ' : ''}${
|
||||
hasHint
|
||||
? (0, _jestMatcherUtils.BOLD_WEIGHT)(
|
||||
(0, _utils.escapeBacktickString)(hint)
|
||||
)
|
||||
: ''
|
||||
} ${count}\``;
|
||||
};
|
||||
function stripAddedIndentation(inlineSnapshot) {
|
||||
// Find indentation if exists.
|
||||
const match = inlineSnapshot.match(INDENTATION_REGEX);
|
||||
if (!match || !match[1]) {
|
||||
// No indentation.
|
||||
return inlineSnapshot;
|
||||
}
|
||||
const indentation = match[1];
|
||||
const lines = inlineSnapshot.split('\n');
|
||||
if (lines.length <= 2) {
|
||||
// Must be at least 3 lines.
|
||||
return inlineSnapshot;
|
||||
}
|
||||
if (lines[0].trim() !== '' || lines[lines.length - 1].trim() !== '') {
|
||||
// If not blank first and last lines, abort.
|
||||
return inlineSnapshot;
|
||||
}
|
||||
for (let i = 1; i < lines.length - 1; i++) {
|
||||
if (lines[i] !== '') {
|
||||
if (lines[i].indexOf(indentation) !== 0) {
|
||||
// All lines except first and last should either be blank or have the same
|
||||
// indent as the first line (or more). If this isn't the case we don't
|
||||
// want to touch the snapshot at all.
|
||||
return inlineSnapshot;
|
||||
}
|
||||
lines[i] = lines[i].substring(indentation.length);
|
||||
}
|
||||
}
|
||||
|
||||
// Last line is a special case because it won't have the same indent as others
|
||||
// but may still have been given some indent to line up.
|
||||
lines[lines.length - 1] = '';
|
||||
|
||||
// Return inline snapshot, now at indent 0.
|
||||
inlineSnapshot = lines.join('\n');
|
||||
return inlineSnapshot;
|
||||
}
|
||||
const fileExists = (filePath, fileSystem) =>
|
||||
fileSystem.exists(filePath) || jestExistsFile(filePath);
|
||||
const cleanup = (
|
||||
fileSystem,
|
||||
update,
|
||||
snapshotResolver,
|
||||
testPathIgnorePatterns
|
||||
) => {
|
||||
const pattern = `\\.${_SnapshotResolver.EXTENSION}$`;
|
||||
const files = fileSystem.matchFiles(pattern);
|
||||
let testIgnorePatternsRegex = null;
|
||||
if (testPathIgnorePatterns && testPathIgnorePatterns.length > 0) {
|
||||
testIgnorePatternsRegex = new RegExp(testPathIgnorePatterns.join('|'));
|
||||
}
|
||||
const list = files.filter(snapshotFile => {
|
||||
const testPath = snapshotResolver.resolveTestPath(snapshotFile);
|
||||
|
||||
// ignore snapshots of ignored tests
|
||||
if (testIgnorePatternsRegex && testIgnorePatternsRegex.test(testPath)) {
|
||||
return false;
|
||||
}
|
||||
if (!fileExists(testPath, fileSystem)) {
|
||||
if (update === 'all') {
|
||||
fs.unlinkSync(snapshotFile);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
return {
|
||||
filesRemoved: list.length,
|
||||
filesRemovedList: list
|
||||
};
|
||||
};
|
||||
exports.cleanup = cleanup;
|
||||
const toMatchSnapshot = function (received, propertiesOrHint, hint) {
|
||||
const matcherName = 'toMatchSnapshot';
|
||||
let properties;
|
||||
const length = arguments.length;
|
||||
if (length === 2 && typeof propertiesOrHint === 'string') {
|
||||
hint = propertiesOrHint;
|
||||
} else if (length >= 2) {
|
||||
if (typeof propertiesOrHint !== 'object' || propertiesOrHint === null) {
|
||||
const options = {
|
||||
isNot: this.isNot,
|
||||
promise: this.promise
|
||||
};
|
||||
let printedWithType = (0, _jestMatcherUtils.printWithType)(
|
||||
'Expected properties',
|
||||
propertiesOrHint,
|
||||
_printSnapshot.printExpected
|
||||
);
|
||||
if (length === 3) {
|
||||
options.secondArgument = 'hint';
|
||||
options.secondArgumentColor = _jestMatcherUtils.BOLD_WEIGHT;
|
||||
if (propertiesOrHint == null) {
|
||||
printedWithType +=
|
||||
"\n\nTo provide a hint without properties: toMatchSnapshot('hint')";
|
||||
}
|
||||
}
|
||||
throw new Error(
|
||||
(0, _jestMatcherUtils.matcherErrorMessage)(
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
_printSnapshot.PROPERTIES_ARG,
|
||||
options
|
||||
),
|
||||
`Expected ${(0, _jestMatcherUtils.EXPECTED_COLOR)(
|
||||
'properties'
|
||||
)} must be an object`,
|
||||
printedWithType
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Future breaking change: Snapshot hint must be a string
|
||||
// if (arguments.length === 3 && typeof hint !== 'string') {}
|
||||
|
||||
properties = propertiesOrHint;
|
||||
}
|
||||
return _toMatchSnapshot({
|
||||
context: this,
|
||||
hint,
|
||||
isInline: false,
|
||||
matcherName,
|
||||
properties,
|
||||
received
|
||||
});
|
||||
};
|
||||
exports.toMatchSnapshot = toMatchSnapshot;
|
||||
const toMatchInlineSnapshot = function (
|
||||
received,
|
||||
propertiesOrSnapshot,
|
||||
inlineSnapshot
|
||||
) {
|
||||
const matcherName = 'toMatchInlineSnapshot';
|
||||
let properties;
|
||||
const length = arguments.length;
|
||||
if (length === 2 && typeof propertiesOrSnapshot === 'string') {
|
||||
inlineSnapshot = propertiesOrSnapshot;
|
||||
} else if (length >= 2) {
|
||||
const options = {
|
||||
isNot: this.isNot,
|
||||
promise: this.promise
|
||||
};
|
||||
if (length === 3) {
|
||||
options.secondArgument = _printSnapshot.SNAPSHOT_ARG;
|
||||
options.secondArgumentColor = _printSnapshot.noColor;
|
||||
}
|
||||
if (
|
||||
typeof propertiesOrSnapshot !== 'object' ||
|
||||
propertiesOrSnapshot === null
|
||||
) {
|
||||
throw new Error(
|
||||
(0, _jestMatcherUtils.matcherErrorMessage)(
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
_printSnapshot.PROPERTIES_ARG,
|
||||
options
|
||||
),
|
||||
`Expected ${(0, _jestMatcherUtils.EXPECTED_COLOR)(
|
||||
'properties'
|
||||
)} must be an object`,
|
||||
(0, _jestMatcherUtils.printWithType)(
|
||||
'Expected properties',
|
||||
propertiesOrSnapshot,
|
||||
_printSnapshot.printExpected
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (length === 3 && typeof inlineSnapshot !== 'string') {
|
||||
throw new Error(
|
||||
(0, _jestMatcherUtils.matcherErrorMessage)(
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
_printSnapshot.PROPERTIES_ARG,
|
||||
options
|
||||
),
|
||||
'Inline snapshot must be a string',
|
||||
(0, _jestMatcherUtils.printWithType)(
|
||||
'Inline snapshot',
|
||||
inlineSnapshot,
|
||||
_utils.serialize
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
properties = propertiesOrSnapshot;
|
||||
}
|
||||
return _toMatchSnapshot({
|
||||
context: this,
|
||||
inlineSnapshot:
|
||||
inlineSnapshot !== undefined
|
||||
? stripAddedIndentation(inlineSnapshot)
|
||||
: undefined,
|
||||
isInline: true,
|
||||
matcherName,
|
||||
properties,
|
||||
received
|
||||
});
|
||||
};
|
||||
exports.toMatchInlineSnapshot = toMatchInlineSnapshot;
|
||||
const _toMatchSnapshot = config => {
|
||||
const {context, hint, inlineSnapshot, isInline, matcherName, properties} =
|
||||
config;
|
||||
let {received} = config;
|
||||
context.dontThrow && context.dontThrow();
|
||||
const {currentConcurrentTestName, isNot, snapshotState} = context;
|
||||
const currentTestName =
|
||||
currentConcurrentTestName?.() ?? context.currentTestName;
|
||||
if (isNot) {
|
||||
throw new Error(
|
||||
(0, _jestMatcherUtils.matcherErrorMessage)(
|
||||
(0, _printSnapshot.matcherHintFromConfig)(config, false),
|
||||
NOT_SNAPSHOT_MATCHERS
|
||||
)
|
||||
);
|
||||
}
|
||||
if (snapshotState == null) {
|
||||
// Because the state is the problem, this is not a matcher error.
|
||||
// Call generic stringify from jest-matcher-utils package
|
||||
// because uninitialized snapshot state does not need snapshot serializers.
|
||||
throw new Error(
|
||||
`${(0, _printSnapshot.matcherHintFromConfig)(config, false)}\n\n` +
|
||||
'Snapshot state must be initialized' +
|
||||
`\n\n${(0, _jestMatcherUtils.printWithType)(
|
||||
'Snapshot state',
|
||||
snapshotState,
|
||||
_jestMatcherUtils.stringify
|
||||
)}`
|
||||
);
|
||||
}
|
||||
const fullTestName =
|
||||
currentTestName && hint
|
||||
? `${currentTestName}: ${hint}`
|
||||
: currentTestName || ''; // future BREAKING change: || hint
|
||||
|
||||
if (typeof properties === 'object') {
|
||||
if (typeof received !== 'object' || received === null) {
|
||||
throw new Error(
|
||||
(0, _jestMatcherUtils.matcherErrorMessage)(
|
||||
(0, _printSnapshot.matcherHintFromConfig)(config, false),
|
||||
`${(0, _jestMatcherUtils.RECEIVED_COLOR)(
|
||||
'received'
|
||||
)} value must be an object when the matcher has ${(0,
|
||||
_jestMatcherUtils.EXPECTED_COLOR)('properties')}`,
|
||||
(0, _jestMatcherUtils.printWithType)(
|
||||
'Received',
|
||||
received,
|
||||
_printSnapshot.printReceived
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
const propertyPass = context.equals(received, properties, [
|
||||
context.utils.iterableEquality,
|
||||
context.utils.subsetEquality
|
||||
]);
|
||||
if (!propertyPass) {
|
||||
const key = snapshotState.fail(fullTestName, received);
|
||||
const matched = /(\d+)$/.exec(key);
|
||||
const count = matched === null ? 1 : Number(matched[1]);
|
||||
const message = () =>
|
||||
`${(0, _printSnapshot.matcherHintFromConfig)(
|
||||
config,
|
||||
false
|
||||
)}\n\n${printSnapshotName(currentTestName, hint, count)}\n\n${(0,
|
||||
_printSnapshot.printPropertiesAndReceived)(
|
||||
properties,
|
||||
received,
|
||||
snapshotState.expand
|
||||
)}`;
|
||||
return {
|
||||
message,
|
||||
name: matcherName,
|
||||
pass: false
|
||||
};
|
||||
} else {
|
||||
received = (0, _utils.deepMerge)(received, properties);
|
||||
}
|
||||
}
|
||||
const result = snapshotState.match({
|
||||
error: context.error,
|
||||
inlineSnapshot,
|
||||
isInline,
|
||||
received,
|
||||
testName: fullTestName
|
||||
});
|
||||
const {actual, count, expected, pass} = result;
|
||||
if (pass) {
|
||||
return {
|
||||
message: () => '',
|
||||
pass: true
|
||||
};
|
||||
}
|
||||
const message =
|
||||
expected === undefined
|
||||
? () =>
|
||||
`${(0, _printSnapshot.matcherHintFromConfig)(
|
||||
config,
|
||||
true
|
||||
)}\n\n${printSnapshotName(currentTestName, hint, count)}\n\n` +
|
||||
`New snapshot was ${(0, _jestMatcherUtils.BOLD_WEIGHT)(
|
||||
'not written'
|
||||
)}. The update flag ` +
|
||||
'must be explicitly passed to write a new snapshot.\n\n' +
|
||||
'This is likely because this test is run in a continuous integration ' +
|
||||
'(CI) environment in which snapshots are not written by default.\n\n' +
|
||||
`Received:${actual.includes('\n') ? '\n' : ' '}${(0,
|
||||
_printSnapshot.bReceivedColor)(actual)}`
|
||||
: () =>
|
||||
`${(0, _printSnapshot.matcherHintFromConfig)(
|
||||
config,
|
||||
true
|
||||
)}\n\n${printSnapshotName(currentTestName, hint, count)}\n\n${(0,
|
||||
_printSnapshot.printSnapshotAndReceived)(
|
||||
expected,
|
||||
actual,
|
||||
received,
|
||||
snapshotState.expand,
|
||||
snapshotState.snapshotFormat
|
||||
)}`;
|
||||
|
||||
// Passing the actual and expected objects so that a custom reporter
|
||||
// could access them, for example in order to display a custom visual diff,
|
||||
// or create a different error message
|
||||
return {
|
||||
actual,
|
||||
expected,
|
||||
message,
|
||||
name: matcherName,
|
||||
pass: false
|
||||
};
|
||||
};
|
||||
const toThrowErrorMatchingSnapshot = function (received, hint, fromPromise) {
|
||||
const matcherName = 'toThrowErrorMatchingSnapshot';
|
||||
|
||||
// Future breaking change: Snapshot hint must be a string
|
||||
// if (hint !== undefined && typeof hint !== string) {}
|
||||
|
||||
return _toThrowErrorMatchingSnapshot(
|
||||
{
|
||||
context: this,
|
||||
hint,
|
||||
isInline: false,
|
||||
matcherName,
|
||||
received
|
||||
},
|
||||
fromPromise
|
||||
);
|
||||
};
|
||||
exports.toThrowErrorMatchingSnapshot = toThrowErrorMatchingSnapshot;
|
||||
const toThrowErrorMatchingInlineSnapshot = function (
|
||||
received,
|
||||
inlineSnapshot,
|
||||
fromPromise
|
||||
) {
|
||||
const matcherName = 'toThrowErrorMatchingInlineSnapshot';
|
||||
if (inlineSnapshot !== undefined && typeof inlineSnapshot !== 'string') {
|
||||
const options = {
|
||||
expectedColor: _printSnapshot.noColor,
|
||||
isNot: this.isNot,
|
||||
promise: this.promise
|
||||
};
|
||||
throw new Error(
|
||||
(0, _jestMatcherUtils.matcherErrorMessage)(
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
_printSnapshot.SNAPSHOT_ARG,
|
||||
options
|
||||
),
|
||||
'Inline snapshot must be a string',
|
||||
(0, _jestMatcherUtils.printWithType)(
|
||||
'Inline snapshot',
|
||||
inlineSnapshot,
|
||||
_utils.serialize
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
return _toThrowErrorMatchingSnapshot(
|
||||
{
|
||||
context: this,
|
||||
inlineSnapshot:
|
||||
inlineSnapshot !== undefined
|
||||
? stripAddedIndentation(inlineSnapshot)
|
||||
: undefined,
|
||||
isInline: true,
|
||||
matcherName,
|
||||
received
|
||||
},
|
||||
fromPromise
|
||||
);
|
||||
};
|
||||
exports.toThrowErrorMatchingInlineSnapshot = toThrowErrorMatchingInlineSnapshot;
|
||||
const _toThrowErrorMatchingSnapshot = (config, fromPromise) => {
|
||||
const {context, hint, inlineSnapshot, isInline, matcherName, received} =
|
||||
config;
|
||||
context.dontThrow && context.dontThrow();
|
||||
const {isNot, promise} = context;
|
||||
if (!fromPromise) {
|
||||
if (typeof received !== 'function') {
|
||||
const options = {
|
||||
isNot,
|
||||
promise
|
||||
};
|
||||
throw new Error(
|
||||
(0, _jestMatcherUtils.matcherErrorMessage)(
|
||||
(0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
'',
|
||||
options
|
||||
),
|
||||
`${(0, _jestMatcherUtils.RECEIVED_COLOR)(
|
||||
'received'
|
||||
)} value must be a function`,
|
||||
(0, _jestMatcherUtils.printWithType)(
|
||||
'Received',
|
||||
received,
|
||||
_printSnapshot.printReceived
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
if (isNot) {
|
||||
throw new Error(
|
||||
(0, _jestMatcherUtils.matcherErrorMessage)(
|
||||
(0, _printSnapshot.matcherHintFromConfig)(config, false),
|
||||
NOT_SNAPSHOT_MATCHERS
|
||||
)
|
||||
);
|
||||
}
|
||||
let error;
|
||||
if (fromPromise) {
|
||||
error = received;
|
||||
} else {
|
||||
try {
|
||||
received();
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
}
|
||||
if (error === undefined) {
|
||||
// Because the received value is a function, this is not a matcher error.
|
||||
throw new Error(
|
||||
`${(0, _printSnapshot.matcherHintFromConfig)(
|
||||
config,
|
||||
false
|
||||
)}\n\n${DID_NOT_THROW}`
|
||||
);
|
||||
}
|
||||
return _toMatchSnapshot({
|
||||
context,
|
||||
hint,
|
||||
inlineSnapshot,
|
||||
isInline,
|
||||
matcherName,
|
||||
received: error.message
|
||||
});
|
||||
};
|
||||
47
backend/node_modules/jest-snapshot/build/mockSerializer.js
generated
vendored
Normal file
47
backend/node_modules/jest-snapshot/build/mockSerializer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.test = exports.serialize = exports.default = void 0;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const serialize = (val, config, indentation, depth, refs, printer) => {
|
||||
// Serialize a non-default name, even if config.printFunctionName is false.
|
||||
const name = val.getMockName();
|
||||
const nameString = name === 'jest.fn()' ? '' : ` ${name}`;
|
||||
let callsString = '';
|
||||
if (val.mock.calls.length !== 0) {
|
||||
const indentationNext = indentation + config.indent;
|
||||
callsString = ` {${config.spacingOuter}${indentationNext}"calls": ${printer(
|
||||
val.mock.calls,
|
||||
config,
|
||||
indentationNext,
|
||||
depth,
|
||||
refs
|
||||
)}${config.min ? ', ' : ','}${
|
||||
config.spacingOuter
|
||||
}${indentationNext}"results": ${printer(
|
||||
val.mock.results,
|
||||
config,
|
||||
indentationNext,
|
||||
depth,
|
||||
refs
|
||||
)}${config.min ? '' : ','}${config.spacingOuter}${indentation}}`;
|
||||
}
|
||||
return `[MockFunction${nameString}]${callsString}`;
|
||||
};
|
||||
exports.serialize = serialize;
|
||||
const test = val => val && !!val._isMockFunction;
|
||||
exports.test = test;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
||||
43
backend/node_modules/jest-snapshot/build/plugins.js
generated
vendored
Normal file
43
backend/node_modules/jest-snapshot/build/plugins.js
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.getSerializers = exports.addSerializer = void 0;
|
||||
var _prettyFormat = require('pretty-format');
|
||||
var _mockSerializer = _interopRequireDefault(require('./mockSerializer'));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const {
|
||||
DOMCollection,
|
||||
DOMElement,
|
||||
Immutable,
|
||||
ReactElement,
|
||||
ReactTestComponent,
|
||||
AsymmetricMatcher
|
||||
} = _prettyFormat.plugins;
|
||||
let PLUGINS = [
|
||||
ReactTestComponent,
|
||||
ReactElement,
|
||||
DOMElement,
|
||||
DOMCollection,
|
||||
Immutable,
|
||||
_mockSerializer.default,
|
||||
AsymmetricMatcher
|
||||
];
|
||||
|
||||
// Prepend to list so the last added is the first tested.
|
||||
const addSerializer = plugin => {
|
||||
PLUGINS = [plugin].concat(PLUGINS);
|
||||
};
|
||||
exports.addSerializer = addSerializer;
|
||||
const getSerializers = () => PLUGINS;
|
||||
exports.getSerializers = getSerializers;
|
||||
340
backend/node_modules/jest-snapshot/build/printSnapshot.js
generated
vendored
Normal file
340
backend/node_modules/jest-snapshot/build/printSnapshot.js
generated
vendored
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.printSnapshotAndReceived =
|
||||
exports.printReceived =
|
||||
exports.printPropertiesAndReceived =
|
||||
exports.printExpected =
|
||||
exports.noColor =
|
||||
exports.matcherHintFromConfig =
|
||||
exports.getSnapshotColorForChalkInstance =
|
||||
exports.getReceivedColorForChalkInstance =
|
||||
exports.bReceivedColor =
|
||||
exports.aSnapshotColor =
|
||||
exports.SNAPSHOT_ARG =
|
||||
exports.PROPERTIES_ARG =
|
||||
exports.HINT_ARG =
|
||||
void 0;
|
||||
var _chalk = _interopRequireDefault(require('chalk'));
|
||||
var _expectUtils = require('@jest/expect-utils');
|
||||
var _jestDiff = require('jest-diff');
|
||||
var _jestGetType = require('jest-get-type');
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
var _prettyFormat = require('pretty-format');
|
||||
var _colors = require('./colors');
|
||||
var _dedentLines = require('./dedentLines');
|
||||
var _utils = require('./utils');
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const getSnapshotColorForChalkInstance = chalkInstance => {
|
||||
const level = chalkInstance.level;
|
||||
if (level === 3) {
|
||||
return chalkInstance
|
||||
.rgb(
|
||||
_colors.aForeground3[0],
|
||||
_colors.aForeground3[1],
|
||||
_colors.aForeground3[2]
|
||||
)
|
||||
.bgRgb(
|
||||
_colors.aBackground3[0],
|
||||
_colors.aBackground3[1],
|
||||
_colors.aBackground3[2]
|
||||
);
|
||||
}
|
||||
if (level === 2) {
|
||||
return chalkInstance
|
||||
.ansi256(_colors.aForeground2)
|
||||
.bgAnsi256(_colors.aBackground2);
|
||||
}
|
||||
return chalkInstance.magenta.bgYellowBright;
|
||||
};
|
||||
exports.getSnapshotColorForChalkInstance = getSnapshotColorForChalkInstance;
|
||||
const getReceivedColorForChalkInstance = chalkInstance => {
|
||||
const level = chalkInstance.level;
|
||||
if (level === 3) {
|
||||
return chalkInstance
|
||||
.rgb(
|
||||
_colors.bForeground3[0],
|
||||
_colors.bForeground3[1],
|
||||
_colors.bForeground3[2]
|
||||
)
|
||||
.bgRgb(
|
||||
_colors.bBackground3[0],
|
||||
_colors.bBackground3[1],
|
||||
_colors.bBackground3[2]
|
||||
);
|
||||
}
|
||||
if (level === 2) {
|
||||
return chalkInstance
|
||||
.ansi256(_colors.bForeground2)
|
||||
.bgAnsi256(_colors.bBackground2);
|
||||
}
|
||||
return chalkInstance.cyan.bgWhiteBright; // also known as teal
|
||||
};
|
||||
exports.getReceivedColorForChalkInstance = getReceivedColorForChalkInstance;
|
||||
const aSnapshotColor = getSnapshotColorForChalkInstance(_chalk.default);
|
||||
exports.aSnapshotColor = aSnapshotColor;
|
||||
const bReceivedColor = getReceivedColorForChalkInstance(_chalk.default);
|
||||
exports.bReceivedColor = bReceivedColor;
|
||||
const noColor = string => string;
|
||||
exports.noColor = noColor;
|
||||
const HINT_ARG = 'hint';
|
||||
exports.HINT_ARG = HINT_ARG;
|
||||
const SNAPSHOT_ARG = 'snapshot';
|
||||
exports.SNAPSHOT_ARG = SNAPSHOT_ARG;
|
||||
const PROPERTIES_ARG = 'properties';
|
||||
exports.PROPERTIES_ARG = PROPERTIES_ARG;
|
||||
const matcherHintFromConfig = (
|
||||
{context: {isNot, promise}, hint, inlineSnapshot, matcherName, properties},
|
||||
isUpdatable
|
||||
) => {
|
||||
const options = {
|
||||
isNot,
|
||||
promise
|
||||
};
|
||||
if (isUpdatable) {
|
||||
options.receivedColor = bReceivedColor;
|
||||
}
|
||||
let expectedArgument = '';
|
||||
if (typeof properties === 'object') {
|
||||
expectedArgument = PROPERTIES_ARG;
|
||||
if (isUpdatable) {
|
||||
options.expectedColor = noColor;
|
||||
}
|
||||
if (typeof hint === 'string' && hint.length !== 0) {
|
||||
options.secondArgument = HINT_ARG;
|
||||
options.secondArgumentColor = _jestMatcherUtils.BOLD_WEIGHT;
|
||||
} else if (typeof inlineSnapshot === 'string') {
|
||||
options.secondArgument = SNAPSHOT_ARG;
|
||||
if (isUpdatable) {
|
||||
options.secondArgumentColor = aSnapshotColor;
|
||||
} else {
|
||||
options.secondArgumentColor = noColor;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (typeof hint === 'string' && hint.length !== 0) {
|
||||
expectedArgument = HINT_ARG;
|
||||
options.expectedColor = _jestMatcherUtils.BOLD_WEIGHT;
|
||||
} else if (typeof inlineSnapshot === 'string') {
|
||||
expectedArgument = SNAPSHOT_ARG;
|
||||
if (isUpdatable) {
|
||||
options.expectedColor = aSnapshotColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (0, _jestMatcherUtils.matcherHint)(
|
||||
matcherName,
|
||||
undefined,
|
||||
expectedArgument,
|
||||
options
|
||||
);
|
||||
};
|
||||
|
||||
// Given array of diffs, return string:
|
||||
// * include common substrings
|
||||
// * exclude change substrings which have opposite op
|
||||
// * include change substrings which have argument op
|
||||
// with change color only if there is a common substring
|
||||
exports.matcherHintFromConfig = matcherHintFromConfig;
|
||||
const joinDiffs = (diffs, op, hasCommon) =>
|
||||
diffs.reduce(
|
||||
(reduced, diff) =>
|
||||
reduced +
|
||||
(diff[0] === _jestDiff.DIFF_EQUAL
|
||||
? diff[1]
|
||||
: diff[0] !== op
|
||||
? ''
|
||||
: hasCommon
|
||||
? (0, _jestMatcherUtils.INVERTED_COLOR)(diff[1])
|
||||
: diff[1]),
|
||||
''
|
||||
);
|
||||
const isLineDiffable = received => {
|
||||
const receivedType = (0, _jestGetType.getType)(received);
|
||||
if ((0, _jestGetType.isPrimitive)(received)) {
|
||||
return typeof received === 'string';
|
||||
}
|
||||
if (
|
||||
receivedType === 'date' ||
|
||||
receivedType === 'function' ||
|
||||
receivedType === 'regexp'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (received instanceof Error) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
receivedType === 'object' &&
|
||||
typeof received.asymmetricMatch === 'function'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
const printExpected = val =>
|
||||
(0, _jestMatcherUtils.EXPECTED_COLOR)((0, _utils.minify)(val));
|
||||
exports.printExpected = printExpected;
|
||||
const printReceived = val =>
|
||||
(0, _jestMatcherUtils.RECEIVED_COLOR)((0, _utils.minify)(val));
|
||||
exports.printReceived = printReceived;
|
||||
const printPropertiesAndReceived = (
|
||||
properties,
|
||||
received,
|
||||
expand // CLI options: true if `--expand` or false if `--no-expand`
|
||||
) => {
|
||||
const aAnnotation = 'Expected properties';
|
||||
const bAnnotation = 'Received value';
|
||||
if (isLineDiffable(properties) && isLineDiffable(received)) {
|
||||
const {replacedExpected, replacedReceived} = (0,
|
||||
_jestMatcherUtils.replaceMatchedToAsymmetricMatcher)(
|
||||
properties,
|
||||
received,
|
||||
[],
|
||||
[]
|
||||
);
|
||||
return (0, _jestDiff.diffLinesUnified)(
|
||||
(0, _utils.serialize)(replacedExpected).split('\n'),
|
||||
(0, _utils.serialize)(
|
||||
(0, _expectUtils.getObjectSubset)(replacedReceived, replacedExpected)
|
||||
).split('\n'),
|
||||
{
|
||||
aAnnotation,
|
||||
aColor: _jestMatcherUtils.EXPECTED_COLOR,
|
||||
bAnnotation,
|
||||
bColor: _jestMatcherUtils.RECEIVED_COLOR,
|
||||
changeLineTrailingSpaceColor: _chalk.default.bgYellow,
|
||||
commonLineTrailingSpaceColor: _chalk.default.bgYellow,
|
||||
emptyFirstOrLastLinePlaceholder: '↵',
|
||||
// U+21B5
|
||||
expand,
|
||||
includeChangeCounts: true
|
||||
}
|
||||
);
|
||||
}
|
||||
const printLabel = (0, _jestMatcherUtils.getLabelPrinter)(
|
||||
aAnnotation,
|
||||
bAnnotation
|
||||
);
|
||||
return `${printLabel(aAnnotation) + printExpected(properties)}\n${printLabel(
|
||||
bAnnotation
|
||||
)}${printReceived(received)}`;
|
||||
};
|
||||
exports.printPropertiesAndReceived = printPropertiesAndReceived;
|
||||
const MAX_DIFF_STRING_LENGTH = 20000;
|
||||
const printSnapshotAndReceived = (a, b, received, expand, snapshotFormat) => {
|
||||
const aAnnotation = 'Snapshot';
|
||||
const bAnnotation = 'Received';
|
||||
const aColor = aSnapshotColor;
|
||||
const bColor = bReceivedColor;
|
||||
const options = {
|
||||
aAnnotation,
|
||||
aColor,
|
||||
bAnnotation,
|
||||
bColor,
|
||||
changeLineTrailingSpaceColor: noColor,
|
||||
commonLineTrailingSpaceColor: _chalk.default.bgYellow,
|
||||
emptyFirstOrLastLinePlaceholder: '↵',
|
||||
// U+21B5
|
||||
expand,
|
||||
includeChangeCounts: true
|
||||
};
|
||||
if (typeof received === 'string') {
|
||||
if (
|
||||
a.length >= 2 &&
|
||||
a.startsWith('"') &&
|
||||
a.endsWith('"') &&
|
||||
b === (0, _prettyFormat.format)(received)
|
||||
) {
|
||||
// If snapshot looks like default serialization of a string
|
||||
// and received is string which has default serialization.
|
||||
|
||||
if (!a.includes('\n') && !b.includes('\n')) {
|
||||
// If neither string is multiline,
|
||||
// display as labels and quoted strings.
|
||||
let aQuoted = a;
|
||||
let bQuoted = b;
|
||||
if (
|
||||
a.length - 2 <= MAX_DIFF_STRING_LENGTH &&
|
||||
b.length - 2 <= MAX_DIFF_STRING_LENGTH
|
||||
) {
|
||||
const diffs = (0, _jestDiff.diffStringsRaw)(
|
||||
a.slice(1, -1),
|
||||
b.slice(1, -1),
|
||||
true
|
||||
);
|
||||
const hasCommon = diffs.some(
|
||||
diff => diff[0] === _jestDiff.DIFF_EQUAL
|
||||
);
|
||||
aQuoted = `"${joinDiffs(diffs, _jestDiff.DIFF_DELETE, hasCommon)}"`;
|
||||
bQuoted = `"${joinDiffs(diffs, _jestDiff.DIFF_INSERT, hasCommon)}"`;
|
||||
}
|
||||
const printLabel = (0, _jestMatcherUtils.getLabelPrinter)(
|
||||
aAnnotation,
|
||||
bAnnotation
|
||||
);
|
||||
return `${printLabel(aAnnotation) + aColor(aQuoted)}\n${printLabel(
|
||||
bAnnotation
|
||||
)}${bColor(bQuoted)}`;
|
||||
}
|
||||
|
||||
// Else either string is multiline, so display as unquoted strings.
|
||||
a = (0, _utils.deserializeString)(a); // hypothetical expected string
|
||||
b = received; // not serialized
|
||||
}
|
||||
// Else expected had custom serialization or was not a string
|
||||
// or received has custom serialization.
|
||||
|
||||
return a.length <= MAX_DIFF_STRING_LENGTH &&
|
||||
b.length <= MAX_DIFF_STRING_LENGTH
|
||||
? (0, _jestDiff.diffStringsUnified)(a, b, options)
|
||||
: (0, _jestDiff.diffLinesUnified)(a.split('\n'), b.split('\n'), options);
|
||||
}
|
||||
if (isLineDiffable(received)) {
|
||||
const aLines2 = a.split('\n');
|
||||
const bLines2 = b.split('\n');
|
||||
|
||||
// Fall through to fix a regression for custom serializers
|
||||
// like jest-snapshot-serializer-raw that ignore the indent option.
|
||||
const b0 = (0, _utils.serialize)(received, 0, snapshotFormat);
|
||||
if (b0 !== b) {
|
||||
const aLines0 = (0, _dedentLines.dedentLines)(aLines2);
|
||||
if (aLines0 !== null) {
|
||||
// Compare lines without indentation.
|
||||
const bLines0 = b0.split('\n');
|
||||
return (0, _jestDiff.diffLinesUnified2)(
|
||||
aLines2,
|
||||
bLines2,
|
||||
aLines0,
|
||||
bLines0,
|
||||
options
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back because:
|
||||
// * props include a multiline string
|
||||
// * text has more than one adjacent line
|
||||
// * markup does not close
|
||||
return (0, _jestDiff.diffLinesUnified)(aLines2, bLines2, options);
|
||||
}
|
||||
const printLabel = (0, _jestMatcherUtils.getLabelPrinter)(
|
||||
aAnnotation,
|
||||
bAnnotation
|
||||
);
|
||||
return `${printLabel(aAnnotation) + aColor(a)}\n${printLabel(
|
||||
bAnnotation
|
||||
)}${bColor(b)}`;
|
||||
};
|
||||
exports.printSnapshotAndReceived = printSnapshotAndReceived;
|
||||
1
backend/node_modules/jest-snapshot/build/types.js
generated
vendored
Normal file
1
backend/node_modules/jest-snapshot/build/types.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
'use strict';
|
||||
320
backend/node_modules/jest-snapshot/build/utils.js
generated
vendored
Normal file
320
backend/node_modules/jest-snapshot/build/utils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,320 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.testNameToKey =
|
||||
exports.serialize =
|
||||
exports.saveSnapshotFile =
|
||||
exports.removeLinesBeforeExternalMatcherTrap =
|
||||
exports.removeExtraLineBreaks =
|
||||
exports.minify =
|
||||
exports.keyToTestName =
|
||||
exports.getSnapshotData =
|
||||
exports.escapeBacktickString =
|
||||
exports.ensureDirectoryExists =
|
||||
exports.deserializeString =
|
||||
exports.deepMerge =
|
||||
exports.addExtraLineBreaks =
|
||||
exports.SNAPSHOT_VERSION_WARNING =
|
||||
exports.SNAPSHOT_VERSION =
|
||||
exports.SNAPSHOT_GUIDE_LINK =
|
||||
void 0;
|
||||
var path = _interopRequireWildcard(require('path'));
|
||||
var _chalk = _interopRequireDefault(require('chalk'));
|
||||
var fs = _interopRequireWildcard(require('graceful-fs'));
|
||||
var _naturalCompare = _interopRequireDefault(require('natural-compare'));
|
||||
var _prettyFormat = require('pretty-format');
|
||||
var _plugins = require('./plugins');
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function (nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interopRequireWildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
var jestWriteFile =
|
||||
globalThis[Symbol.for('jest-native-write-file')] || fs.writeFileSync;
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
var jestReadFile =
|
||||
globalThis[Symbol.for('jest-native-read-file')] || fs.readFileSync;
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
var jestExistsFile =
|
||||
globalThis[Symbol.for('jest-native-exists-file')] || fs.existsSync;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
const SNAPSHOT_VERSION = '1';
|
||||
exports.SNAPSHOT_VERSION = SNAPSHOT_VERSION;
|
||||
const SNAPSHOT_VERSION_REGEXP = /^\/\/ Jest Snapshot v(.+),/;
|
||||
const SNAPSHOT_GUIDE_LINK = 'https://goo.gl/fbAQLP';
|
||||
exports.SNAPSHOT_GUIDE_LINK = SNAPSHOT_GUIDE_LINK;
|
||||
const SNAPSHOT_VERSION_WARNING = _chalk.default.yellow(
|
||||
`${_chalk.default.bold('Warning')}: Before you upgrade snapshots, ` +
|
||||
'we recommend that you revert any local changes to tests or other code, ' +
|
||||
'to ensure that you do not store invalid state.'
|
||||
);
|
||||
exports.SNAPSHOT_VERSION_WARNING = SNAPSHOT_VERSION_WARNING;
|
||||
const writeSnapshotVersion = () =>
|
||||
`// Jest Snapshot v${SNAPSHOT_VERSION}, ${SNAPSHOT_GUIDE_LINK}`;
|
||||
const validateSnapshotVersion = snapshotContents => {
|
||||
const versionTest = SNAPSHOT_VERSION_REGEXP.exec(snapshotContents);
|
||||
const version = versionTest && versionTest[1];
|
||||
if (!version) {
|
||||
return new Error(
|
||||
_chalk.default.red(
|
||||
`${_chalk.default.bold(
|
||||
'Outdated snapshot'
|
||||
)}: No snapshot header found. ` +
|
||||
'Jest 19 introduced versioned snapshots to ensure all developers ' +
|
||||
'on a project are using the same version of Jest. ' +
|
||||
'Please update all snapshots during this upgrade of Jest.\n\n'
|
||||
) + SNAPSHOT_VERSION_WARNING
|
||||
);
|
||||
}
|
||||
if (version < SNAPSHOT_VERSION) {
|
||||
return new Error(
|
||||
// eslint-disable-next-line prefer-template
|
||||
_chalk.default.red(
|
||||
`${_chalk.default.red.bold(
|
||||
'Outdated snapshot'
|
||||
)}: The version of the snapshot ` +
|
||||
'file associated with this test is outdated. The snapshot file ' +
|
||||
'version ensures that all developers on a project are using ' +
|
||||
'the same version of Jest. ' +
|
||||
'Please update all snapshots during this upgrade of Jest.'
|
||||
) +
|
||||
'\n\n' +
|
||||
`Expected: v${SNAPSHOT_VERSION}\n` +
|
||||
`Received: v${version}\n\n` +
|
||||
SNAPSHOT_VERSION_WARNING
|
||||
);
|
||||
}
|
||||
if (version > SNAPSHOT_VERSION) {
|
||||
return new Error(
|
||||
// eslint-disable-next-line prefer-template
|
||||
_chalk.default.red(
|
||||
`${_chalk.default.red.bold(
|
||||
'Outdated Jest version'
|
||||
)}: The version of this ` +
|
||||
'snapshot file indicates that this project is meant to be used ' +
|
||||
'with a newer version of Jest. The snapshot file version ensures ' +
|
||||
'that all developers on a project are using the same version of ' +
|
||||
'Jest. Please update your version of Jest and re-run the tests.'
|
||||
) +
|
||||
'\n\n' +
|
||||
`Expected: v${SNAPSHOT_VERSION}\n` +
|
||||
`Received: v${version}`
|
||||
);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
function isObject(item) {
|
||||
return item != null && typeof item === 'object' && !Array.isArray(item);
|
||||
}
|
||||
const testNameToKey = (testName, count) => `${testName} ${count}`;
|
||||
exports.testNameToKey = testNameToKey;
|
||||
const keyToTestName = key => {
|
||||
if (!/ \d+$/.test(key)) {
|
||||
throw new Error('Snapshot keys must end with a number.');
|
||||
}
|
||||
return key.replace(/ \d+$/, '');
|
||||
};
|
||||
exports.keyToTestName = keyToTestName;
|
||||
const getSnapshotData = (snapshotPath, update) => {
|
||||
const data = Object.create(null);
|
||||
let snapshotContents = '';
|
||||
let dirty = false;
|
||||
if (jestExistsFile(snapshotPath)) {
|
||||
try {
|
||||
snapshotContents = jestReadFile(snapshotPath, 'utf8');
|
||||
// eslint-disable-next-line no-new-func
|
||||
const populate = new Function('exports', snapshotContents);
|
||||
populate(data);
|
||||
} catch {}
|
||||
}
|
||||
const validationResult = validateSnapshotVersion(snapshotContents);
|
||||
const isInvalid = snapshotContents && validationResult;
|
||||
if (update === 'none' && isInvalid) {
|
||||
throw validationResult;
|
||||
}
|
||||
if ((update === 'all' || update === 'new') && isInvalid) {
|
||||
dirty = true;
|
||||
}
|
||||
return {
|
||||
data,
|
||||
dirty
|
||||
};
|
||||
};
|
||||
|
||||
// Add extra line breaks at beginning and end of multiline snapshot
|
||||
// to make the content easier to read.
|
||||
exports.getSnapshotData = getSnapshotData;
|
||||
const addExtraLineBreaks = string =>
|
||||
string.includes('\n') ? `\n${string}\n` : string;
|
||||
|
||||
// Remove extra line breaks at beginning and end of multiline snapshot.
|
||||
// Instead of trim, which can remove additional newlines or spaces
|
||||
// at beginning or end of the content from a custom serializer.
|
||||
exports.addExtraLineBreaks = addExtraLineBreaks;
|
||||
const removeExtraLineBreaks = string =>
|
||||
string.length > 2 && string.startsWith('\n') && string.endsWith('\n')
|
||||
? string.slice(1, -1)
|
||||
: string;
|
||||
exports.removeExtraLineBreaks = removeExtraLineBreaks;
|
||||
const removeLinesBeforeExternalMatcherTrap = stack => {
|
||||
const lines = stack.split('\n');
|
||||
for (let i = 0; i < lines.length; i += 1) {
|
||||
// It's a function name specified in `packages/expect/src/index.ts`
|
||||
// for external custom matchers.
|
||||
if (lines[i].includes('__EXTERNAL_MATCHER_TRAP__')) {
|
||||
return lines.slice(i + 1).join('\n');
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
};
|
||||
exports.removeLinesBeforeExternalMatcherTrap =
|
||||
removeLinesBeforeExternalMatcherTrap;
|
||||
const escapeRegex = true;
|
||||
const printFunctionName = false;
|
||||
const serialize = (val, indent = 2, formatOverrides = {}) =>
|
||||
normalizeNewlines(
|
||||
(0, _prettyFormat.format)(val, {
|
||||
escapeRegex,
|
||||
indent,
|
||||
plugins: (0, _plugins.getSerializers)(),
|
||||
printFunctionName,
|
||||
...formatOverrides
|
||||
})
|
||||
);
|
||||
exports.serialize = serialize;
|
||||
const minify = val =>
|
||||
(0, _prettyFormat.format)(val, {
|
||||
escapeRegex,
|
||||
min: true,
|
||||
plugins: (0, _plugins.getSerializers)(),
|
||||
printFunctionName
|
||||
});
|
||||
|
||||
// Remove double quote marks and unescape double quotes and backslashes.
|
||||
exports.minify = minify;
|
||||
const deserializeString = stringified =>
|
||||
stringified.slice(1, -1).replace(/\\("|\\)/g, '$1');
|
||||
exports.deserializeString = deserializeString;
|
||||
const escapeBacktickString = str => str.replace(/`|\\|\${/g, '\\$&');
|
||||
exports.escapeBacktickString = escapeBacktickString;
|
||||
const printBacktickString = str => `\`${escapeBacktickString(str)}\``;
|
||||
const ensureDirectoryExists = filePath => {
|
||||
try {
|
||||
fs.mkdirSync(path.dirname(filePath), {
|
||||
recursive: true
|
||||
});
|
||||
} catch {}
|
||||
};
|
||||
exports.ensureDirectoryExists = ensureDirectoryExists;
|
||||
const normalizeNewlines = string => string.replace(/\r\n|\r/g, '\n');
|
||||
const saveSnapshotFile = (snapshotData, snapshotPath) => {
|
||||
const snapshots = Object.keys(snapshotData)
|
||||
.sort(_naturalCompare.default)
|
||||
.map(
|
||||
key =>
|
||||
`exports[${printBacktickString(key)}] = ${printBacktickString(
|
||||
normalizeNewlines(snapshotData[key])
|
||||
)};`
|
||||
);
|
||||
ensureDirectoryExists(snapshotPath);
|
||||
jestWriteFile(
|
||||
snapshotPath,
|
||||
`${writeSnapshotVersion()}\n\n${snapshots.join('\n\n')}\n`
|
||||
);
|
||||
};
|
||||
exports.saveSnapshotFile = saveSnapshotFile;
|
||||
const isAnyOrAnything = input =>
|
||||
'$$typeof' in input &&
|
||||
input.$$typeof === Symbol.for('jest.asymmetricMatcher') &&
|
||||
['Any', 'Anything'].includes(input.constructor.name);
|
||||
const deepMergeArray = (target, source) => {
|
||||
const mergedOutput = Array.from(target);
|
||||
source.forEach((sourceElement, index) => {
|
||||
const targetElement = mergedOutput[index];
|
||||
if (Array.isArray(target[index]) && Array.isArray(sourceElement)) {
|
||||
mergedOutput[index] = deepMergeArray(target[index], sourceElement);
|
||||
} else if (isObject(targetElement) && !isAnyOrAnything(sourceElement)) {
|
||||
mergedOutput[index] = deepMerge(target[index], sourceElement);
|
||||
} else {
|
||||
// Source does not exist in target or target is primitive and cannot be deep merged
|
||||
mergedOutput[index] = sourceElement;
|
||||
}
|
||||
});
|
||||
return mergedOutput;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
const deepMerge = (target, source) => {
|
||||
if (isObject(target) && isObject(source)) {
|
||||
const mergedOutput = {
|
||||
...target
|
||||
};
|
||||
Object.keys(source).forEach(key => {
|
||||
if (isObject(source[key]) && !source[key].$$typeof) {
|
||||
if (!(key in target))
|
||||
Object.assign(mergedOutput, {
|
||||
[key]: source[key]
|
||||
});
|
||||
else mergedOutput[key] = deepMerge(target[key], source[key]);
|
||||
} else if (Array.isArray(source[key])) {
|
||||
mergedOutput[key] = deepMergeArray(target[key], source[key]);
|
||||
} else {
|
||||
Object.assign(mergedOutput, {
|
||||
[key]: source[key]
|
||||
});
|
||||
}
|
||||
});
|
||||
return mergedOutput;
|
||||
} else if (Array.isArray(target) && Array.isArray(source)) {
|
||||
return deepMergeArray(target, source);
|
||||
}
|
||||
return target;
|
||||
};
|
||||
exports.deepMerge = deepMerge;
|
||||
21
backend/node_modules/jest-snapshot/node_modules/@jest/schemas/LICENSE
generated
vendored
Normal file
21
backend/node_modules/jest-snapshot/node_modules/@jest/schemas/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
3
backend/node_modules/jest-snapshot/node_modules/@jest/schemas/README.md
generated
vendored
Normal file
3
backend/node_modules/jest-snapshot/node_modules/@jest/schemas/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# `@jest/schemas`
|
||||
|
||||
Experimental and currently incomplete module for JSON schemas for [Jest's](https://jestjs.io/) configuration.
|
||||
63
backend/node_modules/jest-snapshot/node_modules/@jest/schemas/build/index.d.ts
generated
vendored
Normal file
63
backend/node_modules/jest-snapshot/node_modules/@jest/schemas/build/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* 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 {Static} from '@sinclair/typebox';
|
||||
import {TBoolean} from '@sinclair/typebox';
|
||||
import {TNull} from '@sinclair/typebox';
|
||||
import {TNumber} from '@sinclair/typebox';
|
||||
import {TObject} from '@sinclair/typebox';
|
||||
import {TReadonlyOptional} from '@sinclair/typebox';
|
||||
import {TString} from '@sinclair/typebox';
|
||||
|
||||
declare const RawSnapshotFormat: TObject<{
|
||||
callToJSON: TReadonlyOptional<TBoolean>;
|
||||
compareKeys: TReadonlyOptional<TNull>;
|
||||
escapeRegex: TReadonlyOptional<TBoolean>;
|
||||
escapeString: TReadonlyOptional<TBoolean>;
|
||||
highlight: TReadonlyOptional<TBoolean>;
|
||||
indent: TReadonlyOptional<TNumber>;
|
||||
maxDepth: TReadonlyOptional<TNumber>;
|
||||
maxWidth: TReadonlyOptional<TNumber>;
|
||||
min: TReadonlyOptional<TBoolean>;
|
||||
printBasicPrototype: TReadonlyOptional<TBoolean>;
|
||||
printFunctionName: TReadonlyOptional<TBoolean>;
|
||||
theme: TReadonlyOptional<
|
||||
TObject<{
|
||||
comment: TReadonlyOptional<TString<string>>;
|
||||
content: TReadonlyOptional<TString<string>>;
|
||||
prop: TReadonlyOptional<TString<string>>;
|
||||
tag: TReadonlyOptional<TString<string>>;
|
||||
value: TReadonlyOptional<TString<string>>;
|
||||
}>
|
||||
>;
|
||||
}>;
|
||||
|
||||
export declare const SnapshotFormat: TObject<{
|
||||
callToJSON: TReadonlyOptional<TBoolean>;
|
||||
compareKeys: TReadonlyOptional<TNull>;
|
||||
escapeRegex: TReadonlyOptional<TBoolean>;
|
||||
escapeString: TReadonlyOptional<TBoolean>;
|
||||
highlight: TReadonlyOptional<TBoolean>;
|
||||
indent: TReadonlyOptional<TNumber>;
|
||||
maxDepth: TReadonlyOptional<TNumber>;
|
||||
maxWidth: TReadonlyOptional<TNumber>;
|
||||
min: TReadonlyOptional<TBoolean>;
|
||||
printBasicPrototype: TReadonlyOptional<TBoolean>;
|
||||
printFunctionName: TReadonlyOptional<TBoolean>;
|
||||
theme: TReadonlyOptional<
|
||||
TObject<{
|
||||
comment: TReadonlyOptional<TString<string>>;
|
||||
content: TReadonlyOptional<TString<string>>;
|
||||
prop: TReadonlyOptional<TString<string>>;
|
||||
tag: TReadonlyOptional<TString<string>>;
|
||||
value: TReadonlyOptional<TString<string>>;
|
||||
}>
|
||||
>;
|
||||
}>;
|
||||
|
||||
export declare type SnapshotFormat = Static<typeof RawSnapshotFormat>;
|
||||
|
||||
export {};
|
||||
60
backend/node_modules/jest-snapshot/node_modules/@jest/schemas/build/index.js
generated
vendored
Normal file
60
backend/node_modules/jest-snapshot/node_modules/@jest/schemas/build/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.SnapshotFormat = void 0;
|
||||
function _typebox() {
|
||||
const data = require('@sinclair/typebox');
|
||||
_typebox = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const RawSnapshotFormat = _typebox().Type.Partial(
|
||||
_typebox().Type.Object({
|
||||
callToJSON: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
compareKeys: _typebox().Type.Readonly(_typebox().Type.Null()),
|
||||
escapeRegex: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
escapeString: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
highlight: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
indent: _typebox().Type.Readonly(
|
||||
_typebox().Type.Number({
|
||||
minimum: 0
|
||||
})
|
||||
),
|
||||
maxDepth: _typebox().Type.Readonly(
|
||||
_typebox().Type.Number({
|
||||
minimum: 0
|
||||
})
|
||||
),
|
||||
maxWidth: _typebox().Type.Readonly(
|
||||
_typebox().Type.Number({
|
||||
minimum: 0
|
||||
})
|
||||
),
|
||||
min: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
printBasicPrototype: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
printFunctionName: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
theme: _typebox().Type.Readonly(
|
||||
_typebox().Type.Partial(
|
||||
_typebox().Type.Object({
|
||||
comment: _typebox().Type.Readonly(_typebox().Type.String()),
|
||||
content: _typebox().Type.Readonly(_typebox().Type.String()),
|
||||
prop: _typebox().Type.Readonly(_typebox().Type.String()),
|
||||
tag: _typebox().Type.Readonly(_typebox().Type.String()),
|
||||
value: _typebox().Type.Readonly(_typebox().Type.String())
|
||||
})
|
||||
)
|
||||
)
|
||||
})
|
||||
);
|
||||
const SnapshotFormat = _typebox().Type.Strict(RawSnapshotFormat);
|
||||
exports.SnapshotFormat = SnapshotFormat;
|
||||
29
backend/node_modules/jest-snapshot/node_modules/@jest/schemas/package.json
generated
vendored
Normal file
29
backend/node_modules/jest-snapshot/node_modules/@jest/schemas/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "@jest/schemas",
|
||||
"version": "29.6.3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-schemas"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sinclair/typebox": "^0.27.8"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "fb7d95c8af6e0d65a8b65348433d8a0ea0725b5b"
|
||||
}
|
||||
21
backend/node_modules/jest-snapshot/node_modules/@jest/transform/LICENSE
generated
vendored
Normal file
21
backend/node_modules/jest-snapshot/node_modules/@jest/transform/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
1000
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/ScriptTransformer.js
generated
vendored
Normal file
1000
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/ScriptTransformer.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
76
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js
generated
vendored
Normal file
76
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js
generated
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = handlePotentialSyntaxError;
|
||||
exports.enhanceUnexpectedTokenMessage = enhanceUnexpectedTokenMessage;
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const DOT = ' \u2022 ';
|
||||
function handlePotentialSyntaxError(e) {
|
||||
if (e.codeFrame != null) {
|
||||
e.stack = `${e.message}\n${e.codeFrame}`;
|
||||
}
|
||||
if (
|
||||
// `instanceof` might come from the wrong context
|
||||
e.name === 'SyntaxError' &&
|
||||
!e.message.includes(' expected')
|
||||
) {
|
||||
throw enhanceUnexpectedTokenMessage(e);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
function enhanceUnexpectedTokenMessage(e) {
|
||||
e.stack = `${_chalk().default.bold.red(
|
||||
'Jest encountered an unexpected token'
|
||||
)}
|
||||
|
||||
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
|
||||
|
||||
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
|
||||
|
||||
By default "node_modules" folder is ignored by transformers.
|
||||
|
||||
Here's what you can do:
|
||||
${DOT}If you are trying to use ECMAScript Modules, see ${_chalk().default.underline(
|
||||
'https://jestjs.io/docs/ecmascript-modules'
|
||||
)} for how to enable it.
|
||||
${DOT}If you are trying to use TypeScript, see ${_chalk().default.underline(
|
||||
'https://jestjs.io/docs/getting-started#using-typescript'
|
||||
)}
|
||||
${DOT}To have some of your "node_modules" files transformed, you can specify a custom ${_chalk().default.bold(
|
||||
'"transformIgnorePatterns"'
|
||||
)} in your config.
|
||||
${DOT}If you need a custom transformation specify a ${_chalk().default.bold(
|
||||
'"transform"'
|
||||
)} option in your config.
|
||||
${DOT}If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the ${_chalk().default.bold(
|
||||
'"moduleNameMapper"'
|
||||
)} config option.
|
||||
|
||||
You'll find more details and examples of these config options in the docs:
|
||||
${_chalk().default.cyan('https://jestjs.io/docs/configuration')}
|
||||
For information about custom transformations, see:
|
||||
${_chalk().default.cyan('https://jestjs.io/docs/code-transformation')}
|
||||
|
||||
${_chalk().default.bold.red('Details:')}
|
||||
|
||||
${e.stack ?? ''}`.trimRight();
|
||||
return e;
|
||||
}
|
||||
240
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/index.d.ts
generated
vendored
Normal file
240
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
/**
|
||||
* 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 {Config} from '@jest/types';
|
||||
import type {EncodedSourceMap} from '@jridgewell/trace-mapping';
|
||||
import type {TransformTypes} from '@jest/types';
|
||||
|
||||
export declare interface AsyncTransformer<TransformerConfig = unknown> {
|
||||
/**
|
||||
* Indicates if the transformer is capable of instrumenting the code for code coverage.
|
||||
*
|
||||
* If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented.
|
||||
* If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel.
|
||||
*/
|
||||
canInstrument?: boolean;
|
||||
getCacheKey?: (
|
||||
sourceText: string,
|
||||
sourcePath: string,
|
||||
options: TransformOptions<TransformerConfig>,
|
||||
) => string;
|
||||
getCacheKeyAsync?: (
|
||||
sourceText: string,
|
||||
sourcePath: string,
|
||||
options: TransformOptions<TransformerConfig>,
|
||||
) => Promise<string>;
|
||||
process?: (
|
||||
sourceText: string,
|
||||
sourcePath: string,
|
||||
options: TransformOptions<TransformerConfig>,
|
||||
) => TransformedSource;
|
||||
processAsync: (
|
||||
sourceText: string,
|
||||
sourcePath: string,
|
||||
options: TransformOptions<TransformerConfig>,
|
||||
) => Promise<TransformedSource>;
|
||||
}
|
||||
|
||||
export declare interface CallerTransformOptions {
|
||||
supportsDynamicImport: boolean;
|
||||
supportsExportNamespaceFrom: boolean;
|
||||
supportsStaticESM: boolean;
|
||||
supportsTopLevelAwait: boolean;
|
||||
}
|
||||
|
||||
export declare function createScriptTransformer(
|
||||
config: Config.ProjectConfig,
|
||||
cacheFS?: StringMap,
|
||||
): Promise<ScriptTransformer>;
|
||||
|
||||
export declare function createTranspilingRequire(
|
||||
config: Config.ProjectConfig,
|
||||
): Promise<
|
||||
<TModuleType = unknown>(
|
||||
resolverPath: string,
|
||||
applyInteropRequireDefault?: boolean,
|
||||
) => Promise<TModuleType>
|
||||
>;
|
||||
|
||||
declare interface ErrorWithCodeFrame extends Error {
|
||||
codeFrame?: string;
|
||||
}
|
||||
|
||||
declare interface FixedRawSourceMap extends Omit<EncodedSourceMap, 'version'> {
|
||||
version: number;
|
||||
}
|
||||
|
||||
export declare function handlePotentialSyntaxError(
|
||||
e: ErrorWithCodeFrame,
|
||||
): ErrorWithCodeFrame;
|
||||
|
||||
declare interface ReducedTransformOptions extends CallerTransformOptions {
|
||||
instrument: boolean;
|
||||
}
|
||||
|
||||
declare interface RequireAndTranspileModuleOptions
|
||||
extends ReducedTransformOptions {
|
||||
applyInteropRequireDefault: boolean;
|
||||
}
|
||||
|
||||
export declare type ScriptTransformer = ScriptTransformer_2;
|
||||
|
||||
declare class ScriptTransformer_2 {
|
||||
private readonly _config;
|
||||
private readonly _cacheFS;
|
||||
private readonly _cache;
|
||||
private readonly _transformCache;
|
||||
private _transformsAreLoaded;
|
||||
constructor(_config: Config.ProjectConfig, _cacheFS: StringMap);
|
||||
private _buildCacheKeyFromFileInfo;
|
||||
private _buildTransformCacheKey;
|
||||
private _getCacheKey;
|
||||
private _getCacheKeyAsync;
|
||||
private _createCachedFilename;
|
||||
private _getFileCachePath;
|
||||
private _getFileCachePathAsync;
|
||||
private _getTransformPatternAndPath;
|
||||
private _getTransformPath;
|
||||
loadTransformers(): Promise<void>;
|
||||
private _getTransformer;
|
||||
private _instrumentFile;
|
||||
private _buildTransformResult;
|
||||
transformSource(
|
||||
filepath: string,
|
||||
content: string,
|
||||
options: ReducedTransformOptions,
|
||||
): TransformResult;
|
||||
transformSourceAsync(
|
||||
filepath: string,
|
||||
content: string,
|
||||
options: ReducedTransformOptions,
|
||||
): Promise<TransformResult>;
|
||||
private _transformAndBuildScriptAsync;
|
||||
private _transformAndBuildScript;
|
||||
transformAsync(
|
||||
filename: string,
|
||||
options: TransformationOptions,
|
||||
fileSource?: string,
|
||||
): Promise<TransformResult>;
|
||||
transform(
|
||||
filename: string,
|
||||
options: TransformationOptions,
|
||||
fileSource?: string,
|
||||
): TransformResult;
|
||||
transformJson(
|
||||
filename: string,
|
||||
options: TransformationOptions,
|
||||
fileSource: string,
|
||||
): string;
|
||||
requireAndTranspileModule<ModuleType = unknown>(
|
||||
moduleName: string,
|
||||
callback?: (module: ModuleType) => void | Promise<void>,
|
||||
options?: RequireAndTranspileModuleOptions,
|
||||
): Promise<ModuleType>;
|
||||
shouldTransform(filename: string): boolean;
|
||||
}
|
||||
|
||||
export declare function shouldInstrument(
|
||||
filename: string,
|
||||
options: ShouldInstrumentOptions,
|
||||
config: Config.ProjectConfig,
|
||||
loadedFilenames?: Array<string>,
|
||||
): boolean;
|
||||
|
||||
export declare interface ShouldInstrumentOptions
|
||||
extends Pick<
|
||||
Config.GlobalConfig,
|
||||
'collectCoverage' | 'collectCoverageFrom' | 'coverageProvider'
|
||||
> {
|
||||
changedFiles?: Set<string>;
|
||||
sourcesRelatedToTestsInChangedFiles?: Set<string>;
|
||||
}
|
||||
|
||||
declare type StringMap = Map<string, string>;
|
||||
|
||||
export declare interface SyncTransformer<TransformerConfig = unknown> {
|
||||
/**
|
||||
* Indicates if the transformer is capable of instrumenting the code for code coverage.
|
||||
*
|
||||
* If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented.
|
||||
* If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel.
|
||||
*/
|
||||
canInstrument?: boolean;
|
||||
getCacheKey?: (
|
||||
sourceText: string,
|
||||
sourcePath: string,
|
||||
options: TransformOptions<TransformerConfig>,
|
||||
) => string;
|
||||
getCacheKeyAsync?: (
|
||||
sourceText: string,
|
||||
sourcePath: string,
|
||||
options: TransformOptions<TransformerConfig>,
|
||||
) => Promise<string>;
|
||||
process: (
|
||||
sourceText: string,
|
||||
sourcePath: string,
|
||||
options: TransformOptions<TransformerConfig>,
|
||||
) => TransformedSource;
|
||||
processAsync?: (
|
||||
sourceText: string,
|
||||
sourcePath: string,
|
||||
options: TransformOptions<TransformerConfig>,
|
||||
) => Promise<TransformedSource>;
|
||||
}
|
||||
|
||||
export declare interface TransformationOptions
|
||||
extends ShouldInstrumentOptions,
|
||||
CallerTransformOptions {
|
||||
isInternalModule?: boolean;
|
||||
}
|
||||
|
||||
export declare type TransformedSource = {
|
||||
code: string;
|
||||
map?: FixedRawSourceMap | string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* We have both sync (`process`) and async (`processAsync`) code transformation, which both can be provided.
|
||||
* `require` will always use `process`, and `import` will use `processAsync` if it exists, otherwise fall back to `process`.
|
||||
* Meaning, if you use `import` exclusively you do not need `process`, but in most cases supplying both makes sense:
|
||||
* Jest transpiles on demand rather than ahead of time, so the sync one needs to exist.
|
||||
*
|
||||
* For more info on the sync vs async model, see https://jestjs.io/docs/code-transformation#writing-custom-transformers
|
||||
*/
|
||||
declare type Transformer_2<TransformerConfig = unknown> =
|
||||
| SyncTransformer<TransformerConfig>
|
||||
| AsyncTransformer<TransformerConfig>;
|
||||
export {Transformer_2 as Transformer};
|
||||
|
||||
export declare type TransformerCreator<
|
||||
X extends Transformer_2<TransformerConfig>,
|
||||
TransformerConfig = unknown,
|
||||
> = (transformerConfig?: TransformerConfig) => X | Promise<X>;
|
||||
|
||||
/**
|
||||
* Instead of having your custom transformer implement the Transformer interface
|
||||
* directly, you can choose to export a factory function to dynamically create
|
||||
* transformers. This is to allow having a transformer config in your jest config.
|
||||
*/
|
||||
export declare type TransformerFactory<X extends Transformer_2> = {
|
||||
createTransformer: TransformerCreator<X>;
|
||||
};
|
||||
|
||||
export declare interface TransformOptions<TransformerConfig = unknown>
|
||||
extends ReducedTransformOptions {
|
||||
/** Cached file system which is used by `jest-runtime` to improve performance. */
|
||||
cacheFS: StringMap;
|
||||
/** Jest configuration of currently running project. */
|
||||
config: Config.ProjectConfig;
|
||||
/** Stringified version of the `config` - useful in cache busting. */
|
||||
configString: string;
|
||||
/** Transformer configuration passed through `transform` option by the user. */
|
||||
transformerConfig: TransformerConfig;
|
||||
}
|
||||
|
||||
export declare type TransformResult = TransformTypes.TransformResult;
|
||||
|
||||
export {};
|
||||
37
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/index.js
generated
vendored
Normal file
37
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, 'createScriptTransformer', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _ScriptTransformer.createScriptTransformer;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'createTranspilingRequire', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _ScriptTransformer.createTranspilingRequire;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'handlePotentialSyntaxError', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _enhanceUnexpectedTokenMessage.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'shouldInstrument', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _shouldInstrument.default;
|
||||
}
|
||||
});
|
||||
var _ScriptTransformer = require('./ScriptTransformer');
|
||||
var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument'));
|
||||
var _enhanceUnexpectedTokenMessage = _interopRequireDefault(
|
||||
require('./enhanceUnexpectedTokenMessage')
|
||||
);
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
94
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js
generated
vendored
Normal file
94
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js
generated
vendored
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.makeInvalidTransformerError =
|
||||
exports.makeInvalidSyncTransformerError =
|
||||
exports.makeInvalidSourceMapWarning =
|
||||
exports.makeInvalidReturnValueError =
|
||||
void 0;
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _slash() {
|
||||
const data = _interopRequireDefault(require('slash'));
|
||||
_slash = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const BULLET = '\u25cf ';
|
||||
const DOCUMENTATION_NOTE = ` ${_chalk().default.bold(
|
||||
'Code Transformation Documentation:'
|
||||
)}
|
||||
https://jestjs.io/docs/code-transformation
|
||||
`;
|
||||
const UPGRADE_NOTE = ` ${_chalk().default.bold(
|
||||
'This error may be caused by a breaking change in Jest 28:'
|
||||
)}
|
||||
https://jestjs.io/docs/28.x/upgrading-to-jest28#transformer
|
||||
`;
|
||||
const makeInvalidReturnValueError = transformPath =>
|
||||
_chalk().default.red(
|
||||
[
|
||||
_chalk().default.bold(`${BULLET}Invalid return value:`),
|
||||
' `process()` or/and `processAsync()` method of code transformer found at ',
|
||||
` "${(0, _slash().default)(transformPath)}" `,
|
||||
' should return an object or a Promise resolving to an object. The object ',
|
||||
' must have `code` property with a string of processed code.',
|
||||
''
|
||||
].join('\n') +
|
||||
UPGRADE_NOTE +
|
||||
DOCUMENTATION_NOTE
|
||||
);
|
||||
exports.makeInvalidReturnValueError = makeInvalidReturnValueError;
|
||||
const makeInvalidSourceMapWarning = (filename, transformPath) =>
|
||||
_chalk().default.yellow(
|
||||
[
|
||||
_chalk().default.bold(`${BULLET}Invalid source map:`),
|
||||
` The source map for "${(0, _slash().default)(
|
||||
filename
|
||||
)}" returned by "${(0, _slash().default)(transformPath)}" is invalid.`,
|
||||
' Proceeding without source mapping for that file.'
|
||||
].join('\n')
|
||||
);
|
||||
exports.makeInvalidSourceMapWarning = makeInvalidSourceMapWarning;
|
||||
const makeInvalidSyncTransformerError = transformPath =>
|
||||
_chalk().default.red(
|
||||
[
|
||||
_chalk().default.bold(`${BULLET}Invalid synchronous transformer module:`),
|
||||
` "${(0, _slash().default)(
|
||||
transformPath
|
||||
)}" specified in the "transform" object of Jest configuration`,
|
||||
' must export a `process` function.',
|
||||
''
|
||||
].join('\n') + DOCUMENTATION_NOTE
|
||||
);
|
||||
exports.makeInvalidSyncTransformerError = makeInvalidSyncTransformerError;
|
||||
const makeInvalidTransformerError = transformPath =>
|
||||
_chalk().default.red(
|
||||
[
|
||||
_chalk().default.bold(`${BULLET}Invalid transformer module:`),
|
||||
` "${(0, _slash().default)(
|
||||
transformPath
|
||||
)}" specified in the "transform" object of Jest configuration`,
|
||||
' must export a `process` or `processAsync` or `createTransformer` function.',
|
||||
''
|
||||
].join('\n') + DOCUMENTATION_NOTE
|
||||
);
|
||||
exports.makeInvalidTransformerError = makeInvalidTransformerError;
|
||||
177
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/shouldInstrument.js
generated
vendored
Normal file
177
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/shouldInstrument.js
generated
vendored
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = shouldInstrument;
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _micromatch() {
|
||||
const data = _interopRequireDefault(require('micromatch'));
|
||||
_micromatch = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestRegexUtil() {
|
||||
const data = require('jest-regex-util');
|
||||
_jestRegexUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function (nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interopRequireWildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const MOCKS_PATTERN = new RegExp(
|
||||
(0, _jestRegexUtil().escapePathForRegex)(
|
||||
`${path().sep}__mocks__${path().sep}`
|
||||
)
|
||||
);
|
||||
const cachedRegexes = new Map();
|
||||
const getRegex = regexStr => {
|
||||
if (!cachedRegexes.has(regexStr)) {
|
||||
cachedRegexes.set(regexStr, new RegExp(regexStr));
|
||||
}
|
||||
const regex = cachedRegexes.get(regexStr);
|
||||
|
||||
// prevent stateful regexes from breaking, just in case
|
||||
regex.lastIndex = 0;
|
||||
return regex;
|
||||
};
|
||||
function shouldInstrument(filename, options, config, loadedFilenames) {
|
||||
if (!options.collectCoverage) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
config.forceCoverageMatch.length &&
|
||||
_micromatch().default.any(filename, config.forceCoverageMatch)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
if (
|
||||
!config.testPathIgnorePatterns.some(pattern =>
|
||||
getRegex(pattern).test(filename)
|
||||
)
|
||||
) {
|
||||
if (config.testRegex.some(regex => new RegExp(regex).test(filename))) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
(0, _jestUtil().globsToMatcher)(config.testMatch)(
|
||||
(0, _jestUtil().replacePathSepForGlob)(filename)
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (
|
||||
options.collectCoverageFrom.length === 0 &&
|
||||
loadedFilenames != null &&
|
||||
!loadedFilenames.includes(filename)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
// still cover if `only` is specified
|
||||
options.collectCoverageFrom.length &&
|
||||
!(0, _jestUtil().globsToMatcher)(options.collectCoverageFrom)(
|
||||
(0, _jestUtil().replacePathSepForGlob)(
|
||||
path().relative(config.rootDir, filename)
|
||||
)
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
config.coveragePathIgnorePatterns.some(pattern => !!filename.match(pattern))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (config.globalSetup === filename) {
|
||||
return false;
|
||||
}
|
||||
if (config.globalTeardown === filename) {
|
||||
return false;
|
||||
}
|
||||
if (config.setupFiles.includes(filename)) {
|
||||
return false;
|
||||
}
|
||||
if (config.setupFilesAfterEnv.includes(filename)) {
|
||||
return false;
|
||||
}
|
||||
if (MOCKS_PATTERN.test(filename)) {
|
||||
return false;
|
||||
}
|
||||
if (options.changedFiles && !options.changedFiles.has(filename)) {
|
||||
if (!options.sourcesRelatedToTestsInChangedFiles) {
|
||||
return false;
|
||||
}
|
||||
if (!options.sourcesRelatedToTestsInChangedFiles.has(filename)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (filename.endsWith('.json')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
1
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/types.js
generated
vendored
Normal file
1
backend/node_modules/jest-snapshot/node_modules/@jest/transform/build/types.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
'use strict';
|
||||
52
backend/node_modules/jest-snapshot/node_modules/@jest/transform/package.json
generated
vendored
Normal file
52
backend/node_modules/jest-snapshot/node_modules/@jest/transform/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": "@jest/transform",
|
||||
"version": "29.7.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-transform"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.11.6",
|
||||
"@jest/types": "^29.6.3",
|
||||
"@jridgewell/trace-mapping": "^0.3.18",
|
||||
"babel-plugin-istanbul": "^6.1.1",
|
||||
"chalk": "^4.0.0",
|
||||
"convert-source-map": "^2.0.0",
|
||||
"fast-json-stable-stringify": "^2.1.0",
|
||||
"graceful-fs": "^4.2.9",
|
||||
"jest-haste-map": "^29.7.0",
|
||||
"jest-regex-util": "^29.6.3",
|
||||
"jest-util": "^29.7.0",
|
||||
"micromatch": "^4.0.4",
|
||||
"pirates": "^4.0.4",
|
||||
"slash": "^3.0.0",
|
||||
"write-file-atomic": "^4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/test-utils": "^29.7.0",
|
||||
"@types/babel__core": "^7.1.14",
|
||||
"@types/convert-source-map": "^2.0.0",
|
||||
"@types/graceful-fs": "^4.1.3",
|
||||
"@types/micromatch": "^4.0.1",
|
||||
"@types/write-file-atomic": "^4.0.0",
|
||||
"dedent": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
|
||||
}
|
||||
21
backend/node_modules/jest-snapshot/node_modules/@jest/types/LICENSE
generated
vendored
Normal file
21
backend/node_modules/jest-snapshot/node_modules/@jest/types/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
30
backend/node_modules/jest-snapshot/node_modules/@jest/types/README.md
generated
vendored
Normal file
30
backend/node_modules/jest-snapshot/node_modules/@jest/types/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# @jest/types
|
||||
|
||||
This package contains shared types of Jest's packages.
|
||||
|
||||
If you are looking for types of [Jest globals](https://jestjs.io/docs/api), you can import them from `@jest/globals` package:
|
||||
|
||||
```ts
|
||||
import {describe, expect, it} from '@jest/globals';
|
||||
|
||||
describe('my tests', () => {
|
||||
it('works', () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
If you prefer to omit imports, a similar result can be achieved installing the [@types/jest](https://npmjs.com/package/@types/jest) package. Note that this is a third party library maintained at [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest) and may not cover the latest Jest features.
|
||||
|
||||
Another use-case for `@types/jest` is a typed Jest config as those types are not provided by Jest out of the box:
|
||||
|
||||
```ts
|
||||
// jest.config.ts
|
||||
import {Config} from '@jest/types';
|
||||
|
||||
const config: Config.InitialOptions = {
|
||||
// some typed config
|
||||
};
|
||||
|
||||
export default config;
|
||||
```
|
||||
1
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/Circus.js
generated
vendored
Normal file
1
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/Circus.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
'use strict';
|
||||
1
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/Config.js
generated
vendored
Normal file
1
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/Config.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
'use strict';
|
||||
1
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/Global.js
generated
vendored
Normal file
1
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/Global.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
'use strict';
|
||||
1
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/TestResult.js
generated
vendored
Normal file
1
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/TestResult.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
'use strict';
|
||||
1
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/Transform.js
generated
vendored
Normal file
1
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/Transform.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
'use strict';
|
||||
1204
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/index.d.ts
generated
vendored
Normal file
1204
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/index.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/index.js
generated
vendored
Normal file
1
backend/node_modules/jest-snapshot/node_modules/@jest/types/build/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
'use strict';
|
||||
38
backend/node_modules/jest-snapshot/node_modules/@jest/types/package.json
generated
vendored
Normal file
38
backend/node_modules/jest-snapshot/node_modules/@jest/types/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "@jest/types",
|
||||
"version": "29.6.3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-types"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/schemas": "^29.6.3",
|
||||
"@types/istanbul-lib-coverage": "^2.0.0",
|
||||
"@types/istanbul-reports": "^3.0.0",
|
||||
"@types/node": "*",
|
||||
"@types/yargs": "^17.0.8",
|
||||
"chalk": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsd/typescript": "^5.0.4",
|
||||
"tsd-lite": "^0.7.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "fb7d95c8af6e0d65a8b65348433d8a0ea0725b5b"
|
||||
}
|
||||
35
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/compiler/compiler.d.ts
generated
vendored
Normal file
35
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/compiler/compiler.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import * as Types from '../typebox';
|
||||
import { ValueErrorIterator } from '../errors/index';
|
||||
export type CheckFunction = (value: unknown) => boolean;
|
||||
export declare class TypeCheck<T extends Types.TSchema> {
|
||||
private readonly schema;
|
||||
private readonly references;
|
||||
private readonly checkFunc;
|
||||
private readonly code;
|
||||
constructor(schema: T, references: Types.TSchema[], checkFunc: CheckFunction, code: string);
|
||||
/** Returns the generated assertion code used to validate this type. */
|
||||
Code(): string;
|
||||
/** Returns an iterator for each error in this value. */
|
||||
Errors(value: unknown): ValueErrorIterator;
|
||||
/** Returns true if the value matches the compiled type. */
|
||||
Check(value: unknown): value is Types.Static<T>;
|
||||
}
|
||||
export declare class TypeCompilerUnknownTypeError extends Error {
|
||||
readonly schema: Types.TSchema;
|
||||
constructor(schema: Types.TSchema);
|
||||
}
|
||||
export declare class TypeCompilerDereferenceError extends Error {
|
||||
readonly schema: Types.TRef;
|
||||
constructor(schema: Types.TRef);
|
||||
}
|
||||
export declare class TypeCompilerTypeGuardError extends Error {
|
||||
readonly schema: Types.TSchema;
|
||||
constructor(schema: Types.TSchema);
|
||||
}
|
||||
/** Compiles Types for Runtime Type Checking */
|
||||
export declare namespace TypeCompiler {
|
||||
/** Returns the generated assertion code used to validate this type. */
|
||||
function Code<T extends Types.TSchema>(schema: T, references?: Types.TSchema[]): string;
|
||||
/** Compiles the given type for runtime type checking. This compiler only accepts known TypeBox types non-inclusive of unsafe types. */
|
||||
function Compile<T extends Types.TSchema>(schema: T, references?: Types.TSchema[]): TypeCheck<T>;
|
||||
}
|
||||
577
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/compiler/compiler.js
generated
vendored
Normal file
577
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/compiler/compiler.js
generated
vendored
Normal file
|
|
@ -0,0 +1,577 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/compiler
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TypeCompiler = exports.TypeCompilerTypeGuardError = exports.TypeCompilerDereferenceError = exports.TypeCompilerUnknownTypeError = exports.TypeCheck = void 0;
|
||||
const Types = require("../typebox");
|
||||
const index_1 = require("../errors/index");
|
||||
const index_2 = require("../system/index");
|
||||
const hash_1 = require("../value/hash");
|
||||
// -------------------------------------------------------------------
|
||||
// TypeCheck
|
||||
// -------------------------------------------------------------------
|
||||
class TypeCheck {
|
||||
constructor(schema, references, checkFunc, code) {
|
||||
this.schema = schema;
|
||||
this.references = references;
|
||||
this.checkFunc = checkFunc;
|
||||
this.code = code;
|
||||
}
|
||||
/** Returns the generated assertion code used to validate this type. */
|
||||
Code() {
|
||||
return this.code;
|
||||
}
|
||||
/** Returns an iterator for each error in this value. */
|
||||
Errors(value) {
|
||||
return index_1.ValueErrors.Errors(this.schema, this.references, value);
|
||||
}
|
||||
/** Returns true if the value matches the compiled type. */
|
||||
Check(value) {
|
||||
return this.checkFunc(value);
|
||||
}
|
||||
}
|
||||
exports.TypeCheck = TypeCheck;
|
||||
// -------------------------------------------------------------------
|
||||
// Character
|
||||
// -------------------------------------------------------------------
|
||||
var Character;
|
||||
(function (Character) {
|
||||
function DollarSign(code) {
|
||||
return code === 36;
|
||||
}
|
||||
Character.DollarSign = DollarSign;
|
||||
function IsUnderscore(code) {
|
||||
return code === 95;
|
||||
}
|
||||
Character.IsUnderscore = IsUnderscore;
|
||||
function IsAlpha(code) {
|
||||
return (code >= 65 && code <= 90) || (code >= 97 && code <= 122);
|
||||
}
|
||||
Character.IsAlpha = IsAlpha;
|
||||
function IsNumeric(code) {
|
||||
return code >= 48 && code <= 57;
|
||||
}
|
||||
Character.IsNumeric = IsNumeric;
|
||||
})(Character || (Character = {}));
|
||||
// -------------------------------------------------------------------
|
||||
// MemberExpression
|
||||
// -------------------------------------------------------------------
|
||||
var MemberExpression;
|
||||
(function (MemberExpression) {
|
||||
function IsFirstCharacterNumeric(value) {
|
||||
if (value.length === 0)
|
||||
return false;
|
||||
return Character.IsNumeric(value.charCodeAt(0));
|
||||
}
|
||||
function IsAccessor(value) {
|
||||
if (IsFirstCharacterNumeric(value))
|
||||
return false;
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const code = value.charCodeAt(i);
|
||||
const check = Character.IsAlpha(code) || Character.IsNumeric(code) || Character.DollarSign(code) || Character.IsUnderscore(code);
|
||||
if (!check)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function EscapeHyphen(key) {
|
||||
return key.replace(/'/g, "\\'");
|
||||
}
|
||||
function Encode(object, key) {
|
||||
return IsAccessor(key) ? `${object}.${key}` : `${object}['${EscapeHyphen(key)}']`;
|
||||
}
|
||||
MemberExpression.Encode = Encode;
|
||||
})(MemberExpression || (MemberExpression = {}));
|
||||
// -------------------------------------------------------------------
|
||||
// Identifier
|
||||
// -------------------------------------------------------------------
|
||||
var Identifier;
|
||||
(function (Identifier) {
|
||||
function Encode($id) {
|
||||
const buffer = [];
|
||||
for (let i = 0; i < $id.length; i++) {
|
||||
const code = $id.charCodeAt(i);
|
||||
if (Character.IsNumeric(code) || Character.IsAlpha(code)) {
|
||||
buffer.push($id.charAt(i));
|
||||
}
|
||||
else {
|
||||
buffer.push(`_${code}_`);
|
||||
}
|
||||
}
|
||||
return buffer.join('').replace(/__/g, '_');
|
||||
}
|
||||
Identifier.Encode = Encode;
|
||||
})(Identifier || (Identifier = {}));
|
||||
// -------------------------------------------------------------------
|
||||
// TypeCompiler
|
||||
// -------------------------------------------------------------------
|
||||
class TypeCompilerUnknownTypeError extends Error {
|
||||
constructor(schema) {
|
||||
super('TypeCompiler: Unknown type');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.TypeCompilerUnknownTypeError = TypeCompilerUnknownTypeError;
|
||||
class TypeCompilerDereferenceError extends Error {
|
||||
constructor(schema) {
|
||||
super(`TypeCompiler: Unable to dereference schema with $id '${schema.$ref}'`);
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.TypeCompilerDereferenceError = TypeCompilerDereferenceError;
|
||||
class TypeCompilerTypeGuardError extends Error {
|
||||
constructor(schema) {
|
||||
super('TypeCompiler: Preflight validation check failed to guard for the given schema');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.TypeCompilerTypeGuardError = TypeCompilerTypeGuardError;
|
||||
/** Compiles Types for Runtime Type Checking */
|
||||
var TypeCompiler;
|
||||
(function (TypeCompiler) {
|
||||
// -------------------------------------------------------------------
|
||||
// Guards
|
||||
// -------------------------------------------------------------------
|
||||
function IsBigInt(value) {
|
||||
return typeof value === 'bigint';
|
||||
}
|
||||
function IsNumber(value) {
|
||||
return typeof value === 'number' && globalThis.Number.isFinite(value);
|
||||
}
|
||||
function IsString(value) {
|
||||
return typeof value === 'string';
|
||||
}
|
||||
// -------------------------------------------------------------------
|
||||
// Polices
|
||||
// -------------------------------------------------------------------
|
||||
function IsExactOptionalProperty(value, key, expression) {
|
||||
return index_2.TypeSystem.ExactOptionalPropertyTypes ? `('${key}' in ${value} ? ${expression} : true)` : `(${MemberExpression.Encode(value, key)} !== undefined ? ${expression} : true)`;
|
||||
}
|
||||
function IsObjectCheck(value) {
|
||||
return !index_2.TypeSystem.AllowArrayObjects ? `(typeof ${value} === 'object' && ${value} !== null && !Array.isArray(${value}))` : `(typeof ${value} === 'object' && ${value} !== null)`;
|
||||
}
|
||||
function IsRecordCheck(value) {
|
||||
return !index_2.TypeSystem.AllowArrayObjects
|
||||
? `(typeof ${value} === 'object' && ${value} !== null && !Array.isArray(${value}) && !(${value} instanceof Date) && !(${value} instanceof Uint8Array))`
|
||||
: `(typeof ${value} === 'object' && ${value} !== null && !(${value} instanceof Date) && !(${value} instanceof Uint8Array))`;
|
||||
}
|
||||
function IsNumberCheck(value) {
|
||||
return !index_2.TypeSystem.AllowNaN ? `(typeof ${value} === 'number' && Number.isFinite(${value}))` : `typeof ${value} === 'number'`;
|
||||
}
|
||||
function IsVoidCheck(value) {
|
||||
return index_2.TypeSystem.AllowVoidNull ? `(${value} === undefined || ${value} === null)` : `${value} === undefined`;
|
||||
}
|
||||
// -------------------------------------------------------------------
|
||||
// Types
|
||||
// -------------------------------------------------------------------
|
||||
function* Any(schema, references, value) {
|
||||
yield 'true';
|
||||
}
|
||||
function* Array(schema, references, value) {
|
||||
const expression = CreateExpression(schema.items, references, 'value');
|
||||
yield `Array.isArray(${value}) && ${value}.every(value => ${expression})`;
|
||||
if (IsNumber(schema.minItems))
|
||||
yield `${value}.length >= ${schema.minItems}`;
|
||||
if (IsNumber(schema.maxItems))
|
||||
yield `${value}.length <= ${schema.maxItems}`;
|
||||
if (schema.uniqueItems === true)
|
||||
yield `((function() { const set = new Set(); for(const element of ${value}) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true })())`;
|
||||
}
|
||||
function* BigInt(schema, references, value) {
|
||||
yield `(typeof ${value} === 'bigint')`;
|
||||
if (IsBigInt(schema.multipleOf))
|
||||
yield `(${value} % BigInt(${schema.multipleOf})) === 0`;
|
||||
if (IsBigInt(schema.exclusiveMinimum))
|
||||
yield `${value} > BigInt(${schema.exclusiveMinimum})`;
|
||||
if (IsBigInt(schema.exclusiveMaximum))
|
||||
yield `${value} < BigInt(${schema.exclusiveMaximum})`;
|
||||
if (IsBigInt(schema.minimum))
|
||||
yield `${value} >= BigInt(${schema.minimum})`;
|
||||
if (IsBigInt(schema.maximum))
|
||||
yield `${value} <= BigInt(${schema.maximum})`;
|
||||
}
|
||||
function* Boolean(schema, references, value) {
|
||||
yield `typeof ${value} === 'boolean'`;
|
||||
}
|
||||
function* Constructor(schema, references, value) {
|
||||
yield* Visit(schema.returns, references, `${value}.prototype`);
|
||||
}
|
||||
function* Date(schema, references, value) {
|
||||
yield `(${value} instanceof Date) && Number.isFinite(${value}.getTime())`;
|
||||
if (IsNumber(schema.exclusiveMinimumTimestamp))
|
||||
yield `${value}.getTime() > ${schema.exclusiveMinimumTimestamp}`;
|
||||
if (IsNumber(schema.exclusiveMaximumTimestamp))
|
||||
yield `${value}.getTime() < ${schema.exclusiveMaximumTimestamp}`;
|
||||
if (IsNumber(schema.minimumTimestamp))
|
||||
yield `${value}.getTime() >= ${schema.minimumTimestamp}`;
|
||||
if (IsNumber(schema.maximumTimestamp))
|
||||
yield `${value}.getTime() <= ${schema.maximumTimestamp}`;
|
||||
}
|
||||
function* Function(schema, references, value) {
|
||||
yield `typeof ${value} === 'function'`;
|
||||
}
|
||||
function* Integer(schema, references, value) {
|
||||
yield `(typeof ${value} === 'number' && Number.isInteger(${value}))`;
|
||||
if (IsNumber(schema.multipleOf))
|
||||
yield `(${value} % ${schema.multipleOf}) === 0`;
|
||||
if (IsNumber(schema.exclusiveMinimum))
|
||||
yield `${value} > ${schema.exclusiveMinimum}`;
|
||||
if (IsNumber(schema.exclusiveMaximum))
|
||||
yield `${value} < ${schema.exclusiveMaximum}`;
|
||||
if (IsNumber(schema.minimum))
|
||||
yield `${value} >= ${schema.minimum}`;
|
||||
if (IsNumber(schema.maximum))
|
||||
yield `${value} <= ${schema.maximum}`;
|
||||
}
|
||||
function* Intersect(schema, references, value) {
|
||||
if (schema.unevaluatedProperties === undefined) {
|
||||
const expressions = schema.allOf.map((schema) => CreateExpression(schema, references, value));
|
||||
yield `${expressions.join(' && ')}`;
|
||||
}
|
||||
else if (schema.unevaluatedProperties === false) {
|
||||
// prettier-ignore
|
||||
const schemaKeys = Types.KeyResolver.Resolve(schema).map((key) => `'${key}'`).join(', ');
|
||||
const expressions = schema.allOf.map((schema) => CreateExpression(schema, references, value));
|
||||
const expression1 = `Object.getOwnPropertyNames(${value}).every(key => [${schemaKeys}].includes(key))`;
|
||||
yield `${expressions.join(' && ')} && ${expression1}`;
|
||||
}
|
||||
else if (typeof schema.unevaluatedProperties === 'object') {
|
||||
// prettier-ignore
|
||||
const schemaKeys = Types.KeyResolver.Resolve(schema).map((key) => `'${key}'`).join(', ');
|
||||
const expressions = schema.allOf.map((schema) => CreateExpression(schema, references, value));
|
||||
const expression1 = CreateExpression(schema.unevaluatedProperties, references, 'value[key]');
|
||||
const expression2 = `Object.getOwnPropertyNames(${value}).every(key => [${schemaKeys}].includes(key) || ${expression1})`;
|
||||
yield `${expressions.join(' && ')} && ${expression2}`;
|
||||
}
|
||||
}
|
||||
function* Literal(schema, references, value) {
|
||||
if (typeof schema.const === 'number' || typeof schema.const === 'boolean') {
|
||||
yield `${value} === ${schema.const}`;
|
||||
}
|
||||
else {
|
||||
yield `${value} === '${schema.const}'`;
|
||||
}
|
||||
}
|
||||
function* Never(schema, references, value) {
|
||||
yield `false`;
|
||||
}
|
||||
function* Not(schema, references, value) {
|
||||
const left = CreateExpression(schema.allOf[0].not, references, value);
|
||||
const right = CreateExpression(schema.allOf[1], references, value);
|
||||
yield `!${left} && ${right}`;
|
||||
}
|
||||
function* Null(schema, references, value) {
|
||||
yield `${value} === null`;
|
||||
}
|
||||
function* Number(schema, references, value) {
|
||||
yield IsNumberCheck(value);
|
||||
if (IsNumber(schema.multipleOf))
|
||||
yield `(${value} % ${schema.multipleOf}) === 0`;
|
||||
if (IsNumber(schema.exclusiveMinimum))
|
||||
yield `${value} > ${schema.exclusiveMinimum}`;
|
||||
if (IsNumber(schema.exclusiveMaximum))
|
||||
yield `${value} < ${schema.exclusiveMaximum}`;
|
||||
if (IsNumber(schema.minimum))
|
||||
yield `${value} >= ${schema.minimum}`;
|
||||
if (IsNumber(schema.maximum))
|
||||
yield `${value} <= ${schema.maximum}`;
|
||||
}
|
||||
function* Object(schema, references, value) {
|
||||
yield IsObjectCheck(value);
|
||||
if (IsNumber(schema.minProperties))
|
||||
yield `Object.getOwnPropertyNames(${value}).length >= ${schema.minProperties}`;
|
||||
if (IsNumber(schema.maxProperties))
|
||||
yield `Object.getOwnPropertyNames(${value}).length <= ${schema.maxProperties}`;
|
||||
const knownKeys = globalThis.Object.getOwnPropertyNames(schema.properties);
|
||||
for (const knownKey of knownKeys) {
|
||||
const memberExpression = MemberExpression.Encode(value, knownKey);
|
||||
const property = schema.properties[knownKey];
|
||||
if (schema.required && schema.required.includes(knownKey)) {
|
||||
yield* Visit(property, references, memberExpression);
|
||||
if (Types.ExtendsUndefined.Check(property))
|
||||
yield `('${knownKey}' in ${value})`;
|
||||
}
|
||||
else {
|
||||
const expression = CreateExpression(property, references, memberExpression);
|
||||
yield IsExactOptionalProperty(value, knownKey, expression);
|
||||
}
|
||||
}
|
||||
if (schema.additionalProperties === false) {
|
||||
if (schema.required && schema.required.length === knownKeys.length) {
|
||||
yield `Object.getOwnPropertyNames(${value}).length === ${knownKeys.length}`;
|
||||
}
|
||||
else {
|
||||
const keys = `[${knownKeys.map((key) => `'${key}'`).join(', ')}]`;
|
||||
yield `Object.getOwnPropertyNames(${value}).every(key => ${keys}.includes(key))`;
|
||||
}
|
||||
}
|
||||
if (typeof schema.additionalProperties === 'object') {
|
||||
const expression = CreateExpression(schema.additionalProperties, references, 'value[key]');
|
||||
const keys = `[${knownKeys.map((key) => `'${key}'`).join(', ')}]`;
|
||||
yield `(Object.getOwnPropertyNames(${value}).every(key => ${keys}.includes(key) || ${expression}))`;
|
||||
}
|
||||
}
|
||||
function* Promise(schema, references, value) {
|
||||
yield `(typeof value === 'object' && typeof ${value}.then === 'function')`;
|
||||
}
|
||||
function* Record(schema, references, value) {
|
||||
yield IsRecordCheck(value);
|
||||
if (IsNumber(schema.minProperties))
|
||||
yield `Object.getOwnPropertyNames(${value}).length >= ${schema.minProperties}`;
|
||||
if (IsNumber(schema.maxProperties))
|
||||
yield `Object.getOwnPropertyNames(${value}).length <= ${schema.maxProperties}`;
|
||||
const [keyPattern, valueSchema] = globalThis.Object.entries(schema.patternProperties)[0];
|
||||
const local = PushLocal(`new RegExp(/${keyPattern}/)`);
|
||||
yield `(Object.getOwnPropertyNames(${value}).every(key => ${local}.test(key)))`;
|
||||
const expression = CreateExpression(valueSchema, references, 'value');
|
||||
yield `Object.values(${value}).every(value => ${expression})`;
|
||||
}
|
||||
function* Ref(schema, references, value) {
|
||||
const index = references.findIndex((foreign) => foreign.$id === schema.$ref);
|
||||
if (index === -1)
|
||||
throw new TypeCompilerDereferenceError(schema);
|
||||
const target = references[index];
|
||||
// Reference: If we have seen this reference before we can just yield and return
|
||||
// the function call. If this isn't the case we defer to visit to generate and
|
||||
// set the function for subsequent passes. Consider for refactor.
|
||||
if (state_local_function_names.has(schema.$ref))
|
||||
return yield `${CreateFunctionName(schema.$ref)}(${value})`;
|
||||
yield* Visit(target, references, value);
|
||||
}
|
||||
function* String(schema, references, value) {
|
||||
yield `(typeof ${value} === 'string')`;
|
||||
if (IsNumber(schema.minLength))
|
||||
yield `${value}.length >= ${schema.minLength}`;
|
||||
if (IsNumber(schema.maxLength))
|
||||
yield `${value}.length <= ${schema.maxLength}`;
|
||||
if (schema.pattern !== undefined) {
|
||||
const local = PushLocal(`${new RegExp(schema.pattern)};`);
|
||||
yield `${local}.test(${value})`;
|
||||
}
|
||||
if (schema.format !== undefined) {
|
||||
yield `format('${schema.format}', ${value})`;
|
||||
}
|
||||
}
|
||||
function* Symbol(schema, references, value) {
|
||||
yield `(typeof ${value} === 'symbol')`;
|
||||
}
|
||||
function* TemplateLiteral(schema, references, value) {
|
||||
yield `(typeof ${value} === 'string')`;
|
||||
const local = PushLocal(`${new RegExp(schema.pattern)};`);
|
||||
yield `${local}.test(${value})`;
|
||||
}
|
||||
function* This(schema, references, value) {
|
||||
const func = CreateFunctionName(schema.$ref);
|
||||
yield `${func}(${value})`;
|
||||
}
|
||||
function* Tuple(schema, references, value) {
|
||||
yield `(Array.isArray(${value}))`;
|
||||
if (schema.items === undefined)
|
||||
return yield `${value}.length === 0`;
|
||||
yield `(${value}.length === ${schema.maxItems})`;
|
||||
for (let i = 0; i < schema.items.length; i++) {
|
||||
const expression = CreateExpression(schema.items[i], references, `${value}[${i}]`);
|
||||
yield `${expression}`;
|
||||
}
|
||||
}
|
||||
function* Undefined(schema, references, value) {
|
||||
yield `${value} === undefined`;
|
||||
}
|
||||
function* Union(schema, references, value) {
|
||||
const expressions = schema.anyOf.map((schema) => CreateExpression(schema, references, value));
|
||||
yield `(${expressions.join(' || ')})`;
|
||||
}
|
||||
function* Uint8Array(schema, references, value) {
|
||||
yield `${value} instanceof Uint8Array`;
|
||||
if (IsNumber(schema.maxByteLength))
|
||||
yield `(${value}.length <= ${schema.maxByteLength})`;
|
||||
if (IsNumber(schema.minByteLength))
|
||||
yield `(${value}.length >= ${schema.minByteLength})`;
|
||||
}
|
||||
function* Unknown(schema, references, value) {
|
||||
yield 'true';
|
||||
}
|
||||
function* Void(schema, references, value) {
|
||||
yield IsVoidCheck(value);
|
||||
}
|
||||
function* UserDefined(schema, references, value) {
|
||||
const schema_key = `schema_key_${state_remote_custom_types.size}`;
|
||||
state_remote_custom_types.set(schema_key, schema);
|
||||
yield `custom('${schema[Types.Kind]}', '${schema_key}', ${value})`;
|
||||
}
|
||||
function* Visit(schema, references, value) {
|
||||
const references_ = IsString(schema.$id) ? [...references, schema] : references;
|
||||
const schema_ = schema;
|
||||
// Reference: Referenced schemas can originate from either additional schemas
|
||||
// or inline in the schema itself. Ideally the recursive path should align to
|
||||
// reference path. Consider for refactor.
|
||||
if (IsString(schema.$id) && !state_local_function_names.has(schema.$id)) {
|
||||
state_local_function_names.add(schema.$id);
|
||||
const name = CreateFunctionName(schema.$id);
|
||||
const body = CreateFunction(name, schema, references, 'value');
|
||||
PushFunction(body);
|
||||
yield `${name}(${value})`;
|
||||
return;
|
||||
}
|
||||
switch (schema_[Types.Kind]) {
|
||||
case 'Any':
|
||||
return yield* Any(schema_, references_, value);
|
||||
case 'Array':
|
||||
return yield* Array(schema_, references_, value);
|
||||
case 'BigInt':
|
||||
return yield* BigInt(schema_, references_, value);
|
||||
case 'Boolean':
|
||||
return yield* Boolean(schema_, references_, value);
|
||||
case 'Constructor':
|
||||
return yield* Constructor(schema_, references_, value);
|
||||
case 'Date':
|
||||
return yield* Date(schema_, references_, value);
|
||||
case 'Function':
|
||||
return yield* Function(schema_, references_, value);
|
||||
case 'Integer':
|
||||
return yield* Integer(schema_, references_, value);
|
||||
case 'Intersect':
|
||||
return yield* Intersect(schema_, references_, value);
|
||||
case 'Literal':
|
||||
return yield* Literal(schema_, references_, value);
|
||||
case 'Never':
|
||||
return yield* Never(schema_, references_, value);
|
||||
case 'Not':
|
||||
return yield* Not(schema_, references_, value);
|
||||
case 'Null':
|
||||
return yield* Null(schema_, references_, value);
|
||||
case 'Number':
|
||||
return yield* Number(schema_, references_, value);
|
||||
case 'Object':
|
||||
return yield* Object(schema_, references_, value);
|
||||
case 'Promise':
|
||||
return yield* Promise(schema_, references_, value);
|
||||
case 'Record':
|
||||
return yield* Record(schema_, references_, value);
|
||||
case 'Ref':
|
||||
return yield* Ref(schema_, references_, value);
|
||||
case 'String':
|
||||
return yield* String(schema_, references_, value);
|
||||
case 'Symbol':
|
||||
return yield* Symbol(schema_, references_, value);
|
||||
case 'TemplateLiteral':
|
||||
return yield* TemplateLiteral(schema_, references_, value);
|
||||
case 'This':
|
||||
return yield* This(schema_, references_, value);
|
||||
case 'Tuple':
|
||||
return yield* Tuple(schema_, references_, value);
|
||||
case 'Undefined':
|
||||
return yield* Undefined(schema_, references_, value);
|
||||
case 'Union':
|
||||
return yield* Union(schema_, references_, value);
|
||||
case 'Uint8Array':
|
||||
return yield* Uint8Array(schema_, references_, value);
|
||||
case 'Unknown':
|
||||
return yield* Unknown(schema_, references_, value);
|
||||
case 'Void':
|
||||
return yield* Void(schema_, references_, value);
|
||||
default:
|
||||
if (!Types.TypeRegistry.Has(schema_[Types.Kind]))
|
||||
throw new TypeCompilerUnknownTypeError(schema);
|
||||
return yield* UserDefined(schema_, references_, value);
|
||||
}
|
||||
}
|
||||
// -------------------------------------------------------------------
|
||||
// Compiler State
|
||||
// -------------------------------------------------------------------
|
||||
const state_local_variables = new Set(); // local variables and functions
|
||||
const state_local_function_names = new Set(); // local function names used call ref validators
|
||||
const state_remote_custom_types = new Map(); // remote custom types used during compilation
|
||||
function ResetCompiler() {
|
||||
state_local_variables.clear();
|
||||
state_local_function_names.clear();
|
||||
state_remote_custom_types.clear();
|
||||
}
|
||||
function CreateExpression(schema, references, value) {
|
||||
return `(${[...Visit(schema, references, value)].join(' && ')})`;
|
||||
}
|
||||
function CreateFunctionName($id) {
|
||||
return `check_${Identifier.Encode($id)}`;
|
||||
}
|
||||
function CreateFunction(name, schema, references, value) {
|
||||
const expression = [...Visit(schema, references, value)].map((condition) => ` ${condition}`).join(' &&\n');
|
||||
return `function ${name}(value) {\n return (\n${expression}\n )\n}`;
|
||||
}
|
||||
function PushFunction(functionBody) {
|
||||
state_local_variables.add(functionBody);
|
||||
}
|
||||
function PushLocal(expression) {
|
||||
const local = `local_${state_local_variables.size}`;
|
||||
state_local_variables.add(`const ${local} = ${expression}`);
|
||||
return local;
|
||||
}
|
||||
function GetLocals() {
|
||||
return [...state_local_variables.values()];
|
||||
}
|
||||
// -------------------------------------------------------------------
|
||||
// Compile
|
||||
// -------------------------------------------------------------------
|
||||
function Build(schema, references) {
|
||||
ResetCompiler();
|
||||
const check = CreateFunction('check', schema, references, 'value');
|
||||
const locals = GetLocals();
|
||||
return `${locals.join('\n')}\nreturn ${check}`;
|
||||
}
|
||||
/** Returns the generated assertion code used to validate this type. */
|
||||
function Code(schema, references = []) {
|
||||
if (!Types.TypeGuard.TSchema(schema))
|
||||
throw new TypeCompilerTypeGuardError(schema);
|
||||
for (const schema of references)
|
||||
if (!Types.TypeGuard.TSchema(schema))
|
||||
throw new TypeCompilerTypeGuardError(schema);
|
||||
return Build(schema, references);
|
||||
}
|
||||
TypeCompiler.Code = Code;
|
||||
/** Compiles the given type for runtime type checking. This compiler only accepts known TypeBox types non-inclusive of unsafe types. */
|
||||
function Compile(schema, references = []) {
|
||||
const code = Code(schema, references);
|
||||
const custom_schemas = new Map(state_remote_custom_types);
|
||||
const compiledFunction = globalThis.Function('custom', 'format', 'hash', code);
|
||||
const checkFunction = compiledFunction((kind, schema_key, value) => {
|
||||
if (!Types.TypeRegistry.Has(kind) || !custom_schemas.has(schema_key))
|
||||
return false;
|
||||
const schema = custom_schemas.get(schema_key);
|
||||
const func = Types.TypeRegistry.Get(kind);
|
||||
return func(schema, value);
|
||||
}, (format, value) => {
|
||||
if (!Types.FormatRegistry.Has(format))
|
||||
return false;
|
||||
const func = Types.FormatRegistry.Get(format);
|
||||
return func(value);
|
||||
}, (value) => {
|
||||
return hash_1.ValueHash.Create(value);
|
||||
});
|
||||
return new TypeCheck(schema, references, checkFunction, code);
|
||||
}
|
||||
TypeCompiler.Compile = Compile;
|
||||
})(TypeCompiler = exports.TypeCompiler || (exports.TypeCompiler = {}));
|
||||
2
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/compiler/index.d.ts
generated
vendored
Normal file
2
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/compiler/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export { ValueError, ValueErrorType } from '../errors/index';
|
||||
export * from './compiler';
|
||||
47
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/compiler/index.js
generated
vendored
Normal file
47
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/compiler/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/compiler
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueErrorType = void 0;
|
||||
var index_1 = require("../errors/index");
|
||||
Object.defineProperty(exports, "ValueErrorType", { enumerable: true, get: function () { return index_1.ValueErrorType; } });
|
||||
__exportStar(require("./compiler"), exports);
|
||||
88
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/errors/errors.d.ts
generated
vendored
Normal file
88
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/errors/errors.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
import * as Types from '../typebox';
|
||||
export declare enum ValueErrorType {
|
||||
Array = 0,
|
||||
ArrayMinItems = 1,
|
||||
ArrayMaxItems = 2,
|
||||
ArrayUniqueItems = 3,
|
||||
BigInt = 4,
|
||||
BigIntMultipleOf = 5,
|
||||
BigIntExclusiveMinimum = 6,
|
||||
BigIntExclusiveMaximum = 7,
|
||||
BigIntMinimum = 8,
|
||||
BigIntMaximum = 9,
|
||||
Boolean = 10,
|
||||
Date = 11,
|
||||
DateExclusiveMinimumTimestamp = 12,
|
||||
DateExclusiveMaximumTimestamp = 13,
|
||||
DateMinimumTimestamp = 14,
|
||||
DateMaximumTimestamp = 15,
|
||||
Function = 16,
|
||||
Integer = 17,
|
||||
IntegerMultipleOf = 18,
|
||||
IntegerExclusiveMinimum = 19,
|
||||
IntegerExclusiveMaximum = 20,
|
||||
IntegerMinimum = 21,
|
||||
IntegerMaximum = 22,
|
||||
Intersect = 23,
|
||||
IntersectUnevaluatedProperties = 24,
|
||||
Literal = 25,
|
||||
Never = 26,
|
||||
Not = 27,
|
||||
Null = 28,
|
||||
Number = 29,
|
||||
NumberMultipleOf = 30,
|
||||
NumberExclusiveMinimum = 31,
|
||||
NumberExclusiveMaximum = 32,
|
||||
NumberMinumum = 33,
|
||||
NumberMaximum = 34,
|
||||
Object = 35,
|
||||
ObjectMinProperties = 36,
|
||||
ObjectMaxProperties = 37,
|
||||
ObjectAdditionalProperties = 38,
|
||||
ObjectRequiredProperties = 39,
|
||||
Promise = 40,
|
||||
RecordKeyNumeric = 41,
|
||||
RecordKeyString = 42,
|
||||
String = 43,
|
||||
StringMinLength = 44,
|
||||
StringMaxLength = 45,
|
||||
StringPattern = 46,
|
||||
StringFormatUnknown = 47,
|
||||
StringFormat = 48,
|
||||
Symbol = 49,
|
||||
TupleZeroLength = 50,
|
||||
TupleLength = 51,
|
||||
Undefined = 52,
|
||||
Union = 53,
|
||||
Uint8Array = 54,
|
||||
Uint8ArrayMinByteLength = 55,
|
||||
Uint8ArrayMaxByteLength = 56,
|
||||
Void = 57,
|
||||
Custom = 58
|
||||
}
|
||||
export interface ValueError {
|
||||
type: ValueErrorType;
|
||||
schema: Types.TSchema;
|
||||
path: string;
|
||||
value: unknown;
|
||||
message: string;
|
||||
}
|
||||
export declare class ValueErrorIterator {
|
||||
private readonly iterator;
|
||||
constructor(iterator: IterableIterator<ValueError>);
|
||||
[Symbol.iterator](): IterableIterator<ValueError>;
|
||||
/** Returns the first value error or undefined if no errors */
|
||||
First(): ValueError | undefined;
|
||||
}
|
||||
export declare class ValueErrorsUnknownTypeError extends Error {
|
||||
readonly schema: Types.TSchema;
|
||||
constructor(schema: Types.TSchema);
|
||||
}
|
||||
export declare class ValueErrorsDereferenceError extends Error {
|
||||
readonly schema: Types.TRef | Types.TThis;
|
||||
constructor(schema: Types.TRef | Types.TThis);
|
||||
}
|
||||
/** Provides functionality to generate a sequence of errors against a TypeBox type. */
|
||||
export declare namespace ValueErrors {
|
||||
function Errors<T extends Types.TSchema>(schema: T, references: Types.TSchema[], value: any): ValueErrorIterator;
|
||||
}
|
||||
609
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/errors/errors.js
generated
vendored
Normal file
609
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/errors/errors.js
generated
vendored
Normal file
|
|
@ -0,0 +1,609 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueErrors = exports.ValueErrorsDereferenceError = exports.ValueErrorsUnknownTypeError = exports.ValueErrorIterator = exports.ValueErrorType = void 0;
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/errors
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
const Types = require("../typebox");
|
||||
const index_1 = require("../system/index");
|
||||
const hash_1 = require("../value/hash");
|
||||
// -------------------------------------------------------------------
|
||||
// ValueErrorType
|
||||
// -------------------------------------------------------------------
|
||||
var ValueErrorType;
|
||||
(function (ValueErrorType) {
|
||||
ValueErrorType[ValueErrorType["Array"] = 0] = "Array";
|
||||
ValueErrorType[ValueErrorType["ArrayMinItems"] = 1] = "ArrayMinItems";
|
||||
ValueErrorType[ValueErrorType["ArrayMaxItems"] = 2] = "ArrayMaxItems";
|
||||
ValueErrorType[ValueErrorType["ArrayUniqueItems"] = 3] = "ArrayUniqueItems";
|
||||
ValueErrorType[ValueErrorType["BigInt"] = 4] = "BigInt";
|
||||
ValueErrorType[ValueErrorType["BigIntMultipleOf"] = 5] = "BigIntMultipleOf";
|
||||
ValueErrorType[ValueErrorType["BigIntExclusiveMinimum"] = 6] = "BigIntExclusiveMinimum";
|
||||
ValueErrorType[ValueErrorType["BigIntExclusiveMaximum"] = 7] = "BigIntExclusiveMaximum";
|
||||
ValueErrorType[ValueErrorType["BigIntMinimum"] = 8] = "BigIntMinimum";
|
||||
ValueErrorType[ValueErrorType["BigIntMaximum"] = 9] = "BigIntMaximum";
|
||||
ValueErrorType[ValueErrorType["Boolean"] = 10] = "Boolean";
|
||||
ValueErrorType[ValueErrorType["Date"] = 11] = "Date";
|
||||
ValueErrorType[ValueErrorType["DateExclusiveMinimumTimestamp"] = 12] = "DateExclusiveMinimumTimestamp";
|
||||
ValueErrorType[ValueErrorType["DateExclusiveMaximumTimestamp"] = 13] = "DateExclusiveMaximumTimestamp";
|
||||
ValueErrorType[ValueErrorType["DateMinimumTimestamp"] = 14] = "DateMinimumTimestamp";
|
||||
ValueErrorType[ValueErrorType["DateMaximumTimestamp"] = 15] = "DateMaximumTimestamp";
|
||||
ValueErrorType[ValueErrorType["Function"] = 16] = "Function";
|
||||
ValueErrorType[ValueErrorType["Integer"] = 17] = "Integer";
|
||||
ValueErrorType[ValueErrorType["IntegerMultipleOf"] = 18] = "IntegerMultipleOf";
|
||||
ValueErrorType[ValueErrorType["IntegerExclusiveMinimum"] = 19] = "IntegerExclusiveMinimum";
|
||||
ValueErrorType[ValueErrorType["IntegerExclusiveMaximum"] = 20] = "IntegerExclusiveMaximum";
|
||||
ValueErrorType[ValueErrorType["IntegerMinimum"] = 21] = "IntegerMinimum";
|
||||
ValueErrorType[ValueErrorType["IntegerMaximum"] = 22] = "IntegerMaximum";
|
||||
ValueErrorType[ValueErrorType["Intersect"] = 23] = "Intersect";
|
||||
ValueErrorType[ValueErrorType["IntersectUnevaluatedProperties"] = 24] = "IntersectUnevaluatedProperties";
|
||||
ValueErrorType[ValueErrorType["Literal"] = 25] = "Literal";
|
||||
ValueErrorType[ValueErrorType["Never"] = 26] = "Never";
|
||||
ValueErrorType[ValueErrorType["Not"] = 27] = "Not";
|
||||
ValueErrorType[ValueErrorType["Null"] = 28] = "Null";
|
||||
ValueErrorType[ValueErrorType["Number"] = 29] = "Number";
|
||||
ValueErrorType[ValueErrorType["NumberMultipleOf"] = 30] = "NumberMultipleOf";
|
||||
ValueErrorType[ValueErrorType["NumberExclusiveMinimum"] = 31] = "NumberExclusiveMinimum";
|
||||
ValueErrorType[ValueErrorType["NumberExclusiveMaximum"] = 32] = "NumberExclusiveMaximum";
|
||||
ValueErrorType[ValueErrorType["NumberMinumum"] = 33] = "NumberMinumum";
|
||||
ValueErrorType[ValueErrorType["NumberMaximum"] = 34] = "NumberMaximum";
|
||||
ValueErrorType[ValueErrorType["Object"] = 35] = "Object";
|
||||
ValueErrorType[ValueErrorType["ObjectMinProperties"] = 36] = "ObjectMinProperties";
|
||||
ValueErrorType[ValueErrorType["ObjectMaxProperties"] = 37] = "ObjectMaxProperties";
|
||||
ValueErrorType[ValueErrorType["ObjectAdditionalProperties"] = 38] = "ObjectAdditionalProperties";
|
||||
ValueErrorType[ValueErrorType["ObjectRequiredProperties"] = 39] = "ObjectRequiredProperties";
|
||||
ValueErrorType[ValueErrorType["Promise"] = 40] = "Promise";
|
||||
ValueErrorType[ValueErrorType["RecordKeyNumeric"] = 41] = "RecordKeyNumeric";
|
||||
ValueErrorType[ValueErrorType["RecordKeyString"] = 42] = "RecordKeyString";
|
||||
ValueErrorType[ValueErrorType["String"] = 43] = "String";
|
||||
ValueErrorType[ValueErrorType["StringMinLength"] = 44] = "StringMinLength";
|
||||
ValueErrorType[ValueErrorType["StringMaxLength"] = 45] = "StringMaxLength";
|
||||
ValueErrorType[ValueErrorType["StringPattern"] = 46] = "StringPattern";
|
||||
ValueErrorType[ValueErrorType["StringFormatUnknown"] = 47] = "StringFormatUnknown";
|
||||
ValueErrorType[ValueErrorType["StringFormat"] = 48] = "StringFormat";
|
||||
ValueErrorType[ValueErrorType["Symbol"] = 49] = "Symbol";
|
||||
ValueErrorType[ValueErrorType["TupleZeroLength"] = 50] = "TupleZeroLength";
|
||||
ValueErrorType[ValueErrorType["TupleLength"] = 51] = "TupleLength";
|
||||
ValueErrorType[ValueErrorType["Undefined"] = 52] = "Undefined";
|
||||
ValueErrorType[ValueErrorType["Union"] = 53] = "Union";
|
||||
ValueErrorType[ValueErrorType["Uint8Array"] = 54] = "Uint8Array";
|
||||
ValueErrorType[ValueErrorType["Uint8ArrayMinByteLength"] = 55] = "Uint8ArrayMinByteLength";
|
||||
ValueErrorType[ValueErrorType["Uint8ArrayMaxByteLength"] = 56] = "Uint8ArrayMaxByteLength";
|
||||
ValueErrorType[ValueErrorType["Void"] = 57] = "Void";
|
||||
ValueErrorType[ValueErrorType["Custom"] = 58] = "Custom";
|
||||
})(ValueErrorType = exports.ValueErrorType || (exports.ValueErrorType = {}));
|
||||
// -------------------------------------------------------------------
|
||||
// ValueErrorIterator
|
||||
// -------------------------------------------------------------------
|
||||
class ValueErrorIterator {
|
||||
constructor(iterator) {
|
||||
this.iterator = iterator;
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return this.iterator;
|
||||
}
|
||||
/** Returns the first value error or undefined if no errors */
|
||||
First() {
|
||||
const next = this.iterator.next();
|
||||
return next.done ? undefined : next.value;
|
||||
}
|
||||
}
|
||||
exports.ValueErrorIterator = ValueErrorIterator;
|
||||
// -------------------------------------------------------------------
|
||||
// ValueErrors
|
||||
// -------------------------------------------------------------------
|
||||
class ValueErrorsUnknownTypeError extends Error {
|
||||
constructor(schema) {
|
||||
super('ValueErrors: Unknown type');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueErrorsUnknownTypeError = ValueErrorsUnknownTypeError;
|
||||
class ValueErrorsDereferenceError extends Error {
|
||||
constructor(schema) {
|
||||
super(`ValueErrors: Unable to dereference schema with $id '${schema.$ref}'`);
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueErrorsDereferenceError = ValueErrorsDereferenceError;
|
||||
/** Provides functionality to generate a sequence of errors against a TypeBox type. */
|
||||
var ValueErrors;
|
||||
(function (ValueErrors) {
|
||||
// ----------------------------------------------------------------------
|
||||
// Guards
|
||||
// ----------------------------------------------------------------------
|
||||
function IsBigInt(value) {
|
||||
return typeof value === 'bigint';
|
||||
}
|
||||
function IsInteger(value) {
|
||||
return globalThis.Number.isInteger(value);
|
||||
}
|
||||
function IsString(value) {
|
||||
return typeof value === 'string';
|
||||
}
|
||||
function IsDefined(value) {
|
||||
return value !== undefined;
|
||||
}
|
||||
// ----------------------------------------------------------------------
|
||||
// Policies
|
||||
// ----------------------------------------------------------------------
|
||||
function IsExactOptionalProperty(value, key) {
|
||||
return index_1.TypeSystem.ExactOptionalPropertyTypes ? key in value : value[key] !== undefined;
|
||||
}
|
||||
function IsObject(value) {
|
||||
const result = typeof value === 'object' && value !== null;
|
||||
return index_1.TypeSystem.AllowArrayObjects ? result : result && !globalThis.Array.isArray(value);
|
||||
}
|
||||
function IsRecordObject(value) {
|
||||
return IsObject(value) && !(value instanceof globalThis.Date) && !(value instanceof globalThis.Uint8Array);
|
||||
}
|
||||
function IsNumber(value) {
|
||||
const result = typeof value === 'number';
|
||||
return index_1.TypeSystem.AllowNaN ? result : result && globalThis.Number.isFinite(value);
|
||||
}
|
||||
function IsVoid(value) {
|
||||
const result = value === undefined;
|
||||
return index_1.TypeSystem.AllowVoidNull ? result || value === null : result;
|
||||
}
|
||||
// ----------------------------------------------------------------------
|
||||
// Types
|
||||
// ----------------------------------------------------------------------
|
||||
function* Any(schema, references, path, value) { }
|
||||
function* Array(schema, references, path, value) {
|
||||
if (!globalThis.Array.isArray(value)) {
|
||||
return yield { type: ValueErrorType.Array, schema, path, value, message: `Expected array` };
|
||||
}
|
||||
if (IsDefined(schema.minItems) && !(value.length >= schema.minItems)) {
|
||||
yield { type: ValueErrorType.ArrayMinItems, schema, path, value, message: `Expected array length to be greater or equal to ${schema.minItems}` };
|
||||
}
|
||||
if (IsDefined(schema.maxItems) && !(value.length <= schema.maxItems)) {
|
||||
yield { type: ValueErrorType.ArrayMinItems, schema, path, value, message: `Expected array length to be less or equal to ${schema.maxItems}` };
|
||||
}
|
||||
// prettier-ignore
|
||||
if (schema.uniqueItems === true && !((function () { const set = new Set(); for (const element of value) {
|
||||
const hashed = hash_1.ValueHash.Create(element);
|
||||
if (set.has(hashed)) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
set.add(hashed);
|
||||
}
|
||||
} return true; })())) {
|
||||
yield { type: ValueErrorType.ArrayUniqueItems, schema, path, value, message: `Expected array elements to be unique` };
|
||||
}
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
yield* Visit(schema.items, references, `${path}/${i}`, value[i]);
|
||||
}
|
||||
}
|
||||
function* BigInt(schema, references, path, value) {
|
||||
if (!IsBigInt(value)) {
|
||||
return yield { type: ValueErrorType.BigInt, schema, path, value, message: `Expected bigint` };
|
||||
}
|
||||
if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === globalThis.BigInt(0))) {
|
||||
yield { type: ValueErrorType.BigIntMultipleOf, schema, path, value, message: `Expected bigint to be a multiple of ${schema.multipleOf}` };
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
||||
yield { type: ValueErrorType.BigIntExclusiveMinimum, schema, path, value, message: `Expected bigint to be greater than ${schema.exclusiveMinimum}` };
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
||||
yield { type: ValueErrorType.BigIntExclusiveMaximum, schema, path, value, message: `Expected bigint to be less than ${schema.exclusiveMaximum}` };
|
||||
}
|
||||
if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
|
||||
yield { type: ValueErrorType.BigIntMinimum, schema, path, value, message: `Expected bigint to be greater or equal to ${schema.minimum}` };
|
||||
}
|
||||
if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
|
||||
yield { type: ValueErrorType.BigIntMaximum, schema, path, value, message: `Expected bigint to be less or equal to ${schema.maximum}` };
|
||||
}
|
||||
}
|
||||
function* Boolean(schema, references, path, value) {
|
||||
if (!(typeof value === 'boolean')) {
|
||||
return yield { type: ValueErrorType.Boolean, schema, path, value, message: `Expected boolean` };
|
||||
}
|
||||
}
|
||||
function* Constructor(schema, references, path, value) {
|
||||
yield* Visit(schema.returns, references, path, value.prototype);
|
||||
}
|
||||
function* Date(schema, references, path, value) {
|
||||
if (!(value instanceof globalThis.Date)) {
|
||||
return yield { type: ValueErrorType.Date, schema, path, value, message: `Expected Date object` };
|
||||
}
|
||||
if (!globalThis.isFinite(value.getTime())) {
|
||||
return yield { type: ValueErrorType.Date, schema, path, value, message: `Invalid Date` };
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) {
|
||||
yield { type: ValueErrorType.DateExclusiveMinimumTimestamp, schema, path, value, message: `Expected Date timestamp to be greater than ${schema.exclusiveMinimum}` };
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) {
|
||||
yield { type: ValueErrorType.DateExclusiveMaximumTimestamp, schema, path, value, message: `Expected Date timestamp to be less than ${schema.exclusiveMaximum}` };
|
||||
}
|
||||
if (IsDefined(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) {
|
||||
yield { type: ValueErrorType.DateMinimumTimestamp, schema, path, value, message: `Expected Date timestamp to be greater or equal to ${schema.minimum}` };
|
||||
}
|
||||
if (IsDefined(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) {
|
||||
yield { type: ValueErrorType.DateMaximumTimestamp, schema, path, value, message: `Expected Date timestamp to be less or equal to ${schema.maximum}` };
|
||||
}
|
||||
}
|
||||
function* Function(schema, references, path, value) {
|
||||
if (!(typeof value === 'function')) {
|
||||
return yield { type: ValueErrorType.Function, schema, path, value, message: `Expected function` };
|
||||
}
|
||||
}
|
||||
function* Integer(schema, references, path, value) {
|
||||
if (!IsInteger(value)) {
|
||||
return yield { type: ValueErrorType.Integer, schema, path, value, message: `Expected integer` };
|
||||
}
|
||||
if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
||||
yield { type: ValueErrorType.IntegerMultipleOf, schema, path, value, message: `Expected integer to be a multiple of ${schema.multipleOf}` };
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
||||
yield { type: ValueErrorType.IntegerExclusiveMinimum, schema, path, value, message: `Expected integer to be greater than ${schema.exclusiveMinimum}` };
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
||||
yield { type: ValueErrorType.IntegerExclusiveMaximum, schema, path, value, message: `Expected integer to be less than ${schema.exclusiveMaximum}` };
|
||||
}
|
||||
if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
|
||||
yield { type: ValueErrorType.IntegerMinimum, schema, path, value, message: `Expected integer to be greater or equal to ${schema.minimum}` };
|
||||
}
|
||||
if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
|
||||
yield { type: ValueErrorType.IntegerMaximum, schema, path, value, message: `Expected integer to be less or equal to ${schema.maximum}` };
|
||||
}
|
||||
}
|
||||
function* Intersect(schema, references, path, value) {
|
||||
for (const subschema of schema.allOf) {
|
||||
const next = Visit(subschema, references, path, value).next();
|
||||
if (!next.done) {
|
||||
yield next.value;
|
||||
yield { type: ValueErrorType.Intersect, schema, path, value, message: `Expected all sub schemas to be valid` };
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (schema.unevaluatedProperties === false) {
|
||||
const schemaKeys = Types.KeyResolver.Resolve(schema);
|
||||
const valueKeys = globalThis.Object.getOwnPropertyNames(value);
|
||||
for (const valueKey of valueKeys) {
|
||||
if (!schemaKeys.includes(valueKey)) {
|
||||
yield { type: ValueErrorType.IntersectUnevaluatedProperties, schema, path: `${path}/${valueKey}`, value, message: `Unexpected property` };
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof schema.unevaluatedProperties === 'object') {
|
||||
const schemaKeys = Types.KeyResolver.Resolve(schema);
|
||||
const valueKeys = globalThis.Object.getOwnPropertyNames(value);
|
||||
for (const valueKey of valueKeys) {
|
||||
if (!schemaKeys.includes(valueKey)) {
|
||||
const next = Visit(schema.unevaluatedProperties, references, `${path}/${valueKey}`, value[valueKey]).next();
|
||||
if (!next.done) {
|
||||
yield next.value;
|
||||
yield { type: ValueErrorType.IntersectUnevaluatedProperties, schema, path: `${path}/${valueKey}`, value, message: `Invalid additional property` };
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function* Literal(schema, references, path, value) {
|
||||
if (!(value === schema.const)) {
|
||||
const error = typeof schema.const === 'string' ? `'${schema.const}'` : schema.const;
|
||||
return yield { type: ValueErrorType.Literal, schema, path, value, message: `Expected ${error}` };
|
||||
}
|
||||
}
|
||||
function* Never(schema, references, path, value) {
|
||||
yield { type: ValueErrorType.Never, schema, path, value, message: `Value cannot be validated` };
|
||||
}
|
||||
function* Not(schema, references, path, value) {
|
||||
if (Visit(schema.allOf[0].not, references, path, value).next().done === true) {
|
||||
yield { type: ValueErrorType.Not, schema, path, value, message: `Value should not validate` };
|
||||
}
|
||||
yield* Visit(schema.allOf[1], references, path, value);
|
||||
}
|
||||
function* Null(schema, references, path, value) {
|
||||
if (!(value === null)) {
|
||||
return yield { type: ValueErrorType.Null, schema, path, value, message: `Expected null` };
|
||||
}
|
||||
}
|
||||
function* Number(schema, references, path, value) {
|
||||
if (!IsNumber(value)) {
|
||||
return yield { type: ValueErrorType.Number, schema, path, value, message: `Expected number` };
|
||||
}
|
||||
if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
||||
yield { type: ValueErrorType.NumberMultipleOf, schema, path, value, message: `Expected number to be a multiple of ${schema.multipleOf}` };
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
||||
yield { type: ValueErrorType.NumberExclusiveMinimum, schema, path, value, message: `Expected number to be greater than ${schema.exclusiveMinimum}` };
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
||||
yield { type: ValueErrorType.NumberExclusiveMaximum, schema, path, value, message: `Expected number to be less than ${schema.exclusiveMaximum}` };
|
||||
}
|
||||
if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
|
||||
yield { type: ValueErrorType.NumberMaximum, schema, path, value, message: `Expected number to be greater or equal to ${schema.minimum}` };
|
||||
}
|
||||
if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
|
||||
yield { type: ValueErrorType.NumberMinumum, schema, path, value, message: `Expected number to be less or equal to ${schema.maximum}` };
|
||||
}
|
||||
}
|
||||
function* Object(schema, references, path, value) {
|
||||
if (!IsObject(value)) {
|
||||
return yield { type: ValueErrorType.Object, schema, path, value, message: `Expected object` };
|
||||
}
|
||||
if (IsDefined(schema.minProperties) && !(globalThis.Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
||||
yield { type: ValueErrorType.ObjectMinProperties, schema, path, value, message: `Expected object to have at least ${schema.minProperties} properties` };
|
||||
}
|
||||
if (IsDefined(schema.maxProperties) && !(globalThis.Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
||||
yield { type: ValueErrorType.ObjectMaxProperties, schema, path, value, message: `Expected object to have less than ${schema.minProperties} properties` };
|
||||
}
|
||||
const requiredKeys = globalThis.Array.isArray(schema.required) ? schema.required : [];
|
||||
const knownKeys = globalThis.Object.getOwnPropertyNames(schema.properties);
|
||||
const unknownKeys = globalThis.Object.getOwnPropertyNames(value);
|
||||
for (const knownKey of knownKeys) {
|
||||
const property = schema.properties[knownKey];
|
||||
if (schema.required && schema.required.includes(knownKey)) {
|
||||
yield* Visit(property, references, `${path}/${knownKey}`, value[knownKey]);
|
||||
if (Types.ExtendsUndefined.Check(schema) && !(knownKey in value)) {
|
||||
yield { type: ValueErrorType.ObjectRequiredProperties, schema: property, path: `${path}/${knownKey}`, value: undefined, message: `Expected required property` };
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (IsExactOptionalProperty(value, knownKey)) {
|
||||
yield* Visit(property, references, `${path}/${knownKey}`, value[knownKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const requiredKey of requiredKeys) {
|
||||
if (unknownKeys.includes(requiredKey))
|
||||
continue;
|
||||
yield { type: ValueErrorType.ObjectRequiredProperties, schema: schema.properties[requiredKey], path: `${path}/${requiredKey}`, value: undefined, message: `Expected required property` };
|
||||
}
|
||||
if (schema.additionalProperties === false) {
|
||||
for (const valueKey of unknownKeys) {
|
||||
if (!knownKeys.includes(valueKey)) {
|
||||
yield { type: ValueErrorType.ObjectAdditionalProperties, schema, path: `${path}/${valueKey}`, value: value[valueKey], message: `Unexpected property` };
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof schema.additionalProperties === 'object') {
|
||||
for (const valueKey of unknownKeys) {
|
||||
if (knownKeys.includes(valueKey))
|
||||
continue;
|
||||
yield* Visit(schema.additionalProperties, references, `${path}/${valueKey}`, value[valueKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
function* Promise(schema, references, path, value) {
|
||||
if (!(typeof value === 'object' && typeof value.then === 'function')) {
|
||||
yield { type: ValueErrorType.Promise, schema, path, value, message: `Expected Promise` };
|
||||
}
|
||||
}
|
||||
function* Record(schema, references, path, value) {
|
||||
if (!IsRecordObject(value)) {
|
||||
return yield { type: ValueErrorType.Object, schema, path, value, message: `Expected record object` };
|
||||
}
|
||||
if (IsDefined(schema.minProperties) && !(globalThis.Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
||||
yield { type: ValueErrorType.ObjectMinProperties, schema, path, value, message: `Expected object to have at least ${schema.minProperties} properties` };
|
||||
}
|
||||
if (IsDefined(schema.maxProperties) && !(globalThis.Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
||||
yield { type: ValueErrorType.ObjectMaxProperties, schema, path, value, message: `Expected object to have less than ${schema.minProperties} properties` };
|
||||
}
|
||||
const [keyPattern, valueSchema] = globalThis.Object.entries(schema.patternProperties)[0];
|
||||
const regex = new RegExp(keyPattern);
|
||||
if (!globalThis.Object.getOwnPropertyNames(value).every((key) => regex.test(key))) {
|
||||
const numeric = keyPattern === Types.PatternNumberExact;
|
||||
const type = numeric ? ValueErrorType.RecordKeyNumeric : ValueErrorType.RecordKeyString;
|
||||
const message = numeric ? 'Expected all object property keys to be numeric' : 'Expected all object property keys to be strings';
|
||||
return yield { type, schema, path, value, message };
|
||||
}
|
||||
for (const [propKey, propValue] of globalThis.Object.entries(value)) {
|
||||
yield* Visit(valueSchema, references, `${path}/${propKey}`, propValue);
|
||||
}
|
||||
}
|
||||
function* Ref(schema, references, path, value) {
|
||||
const index = references.findIndex((foreign) => foreign.$id === schema.$ref);
|
||||
if (index === -1)
|
||||
throw new ValueErrorsDereferenceError(schema);
|
||||
const target = references[index];
|
||||
yield* Visit(target, references, path, value);
|
||||
}
|
||||
function* String(schema, references, path, value) {
|
||||
if (!IsString(value)) {
|
||||
return yield { type: ValueErrorType.String, schema, path, value, message: 'Expected string' };
|
||||
}
|
||||
if (IsDefined(schema.minLength) && !(value.length >= schema.minLength)) {
|
||||
yield { type: ValueErrorType.StringMinLength, schema, path, value, message: `Expected string length greater or equal to ${schema.minLength}` };
|
||||
}
|
||||
if (IsDefined(schema.maxLength) && !(value.length <= schema.maxLength)) {
|
||||
yield { type: ValueErrorType.StringMaxLength, schema, path, value, message: `Expected string length less or equal to ${schema.maxLength}` };
|
||||
}
|
||||
if (schema.pattern !== undefined) {
|
||||
const regex = new RegExp(schema.pattern);
|
||||
if (!regex.test(value)) {
|
||||
yield { type: ValueErrorType.StringPattern, schema, path, value, message: `Expected string to match pattern ${schema.pattern}` };
|
||||
}
|
||||
}
|
||||
if (schema.format !== undefined) {
|
||||
if (!Types.FormatRegistry.Has(schema.format)) {
|
||||
yield { type: ValueErrorType.StringFormatUnknown, schema, path, value, message: `Unknown string format '${schema.format}'` };
|
||||
}
|
||||
else {
|
||||
const format = Types.FormatRegistry.Get(schema.format);
|
||||
if (!format(value)) {
|
||||
yield { type: ValueErrorType.StringFormat, schema, path, value, message: `Expected string to match format '${schema.format}'` };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function* Symbol(schema, references, path, value) {
|
||||
if (!(typeof value === 'symbol')) {
|
||||
return yield { type: ValueErrorType.Symbol, schema, path, value, message: 'Expected symbol' };
|
||||
}
|
||||
}
|
||||
function* TemplateLiteral(schema, references, path, value) {
|
||||
if (!IsString(value)) {
|
||||
return yield { type: ValueErrorType.String, schema, path, value, message: 'Expected string' };
|
||||
}
|
||||
const regex = new RegExp(schema.pattern);
|
||||
if (!regex.test(value)) {
|
||||
yield { type: ValueErrorType.StringPattern, schema, path, value, message: `Expected string to match pattern ${schema.pattern}` };
|
||||
}
|
||||
}
|
||||
function* This(schema, references, path, value) {
|
||||
const index = references.findIndex((foreign) => foreign.$id === schema.$ref);
|
||||
if (index === -1)
|
||||
throw new ValueErrorsDereferenceError(schema);
|
||||
const target = references[index];
|
||||
yield* Visit(target, references, path, value);
|
||||
}
|
||||
function* Tuple(schema, references, path, value) {
|
||||
if (!globalThis.Array.isArray(value)) {
|
||||
return yield { type: ValueErrorType.Array, schema, path, value, message: 'Expected Array' };
|
||||
}
|
||||
if (schema.items === undefined && !(value.length === 0)) {
|
||||
return yield { type: ValueErrorType.TupleZeroLength, schema, path, value, message: 'Expected tuple to have 0 elements' };
|
||||
}
|
||||
if (!(value.length === schema.maxItems)) {
|
||||
yield { type: ValueErrorType.TupleLength, schema, path, value, message: `Expected tuple to have ${schema.maxItems} elements` };
|
||||
}
|
||||
if (!schema.items) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < schema.items.length; i++) {
|
||||
yield* Visit(schema.items[i], references, `${path}/${i}`, value[i]);
|
||||
}
|
||||
}
|
||||
function* Undefined(schema, references, path, value) {
|
||||
if (!(value === undefined)) {
|
||||
yield { type: ValueErrorType.Undefined, schema, path, value, message: `Expected undefined` };
|
||||
}
|
||||
}
|
||||
function* Union(schema, references, path, value) {
|
||||
const errors = [];
|
||||
for (const inner of schema.anyOf) {
|
||||
const variantErrors = [...Visit(inner, references, path, value)];
|
||||
if (variantErrors.length === 0)
|
||||
return;
|
||||
errors.push(...variantErrors);
|
||||
}
|
||||
if (errors.length > 0) {
|
||||
yield { type: ValueErrorType.Union, schema, path, value, message: 'Expected value of union' };
|
||||
}
|
||||
for (const error of errors) {
|
||||
yield error;
|
||||
}
|
||||
}
|
||||
function* Uint8Array(schema, references, path, value) {
|
||||
if (!(value instanceof globalThis.Uint8Array)) {
|
||||
return yield { type: ValueErrorType.Uint8Array, schema, path, value, message: `Expected Uint8Array` };
|
||||
}
|
||||
if (IsDefined(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) {
|
||||
yield { type: ValueErrorType.Uint8ArrayMaxByteLength, schema, path, value, message: `Expected Uint8Array to have a byte length less or equal to ${schema.maxByteLength}` };
|
||||
}
|
||||
if (IsDefined(schema.minByteLength) && !(value.length >= schema.minByteLength)) {
|
||||
yield { type: ValueErrorType.Uint8ArrayMinByteLength, schema, path, value, message: `Expected Uint8Array to have a byte length greater or equal to ${schema.maxByteLength}` };
|
||||
}
|
||||
}
|
||||
function* Unknown(schema, references, path, value) { }
|
||||
function* Void(schema, references, path, value) {
|
||||
if (!IsVoid(value)) {
|
||||
return yield { type: ValueErrorType.Void, schema, path, value, message: `Expected void` };
|
||||
}
|
||||
}
|
||||
function* UserDefined(schema, references, path, value) {
|
||||
const check = Types.TypeRegistry.Get(schema[Types.Kind]);
|
||||
if (!check(schema, value)) {
|
||||
return yield { type: ValueErrorType.Custom, schema, path, value, message: `Expected kind ${schema[Types.Kind]}` };
|
||||
}
|
||||
}
|
||||
function* Visit(schema, references, path, value) {
|
||||
const references_ = IsDefined(schema.$id) ? [...references, schema] : references;
|
||||
const schema_ = schema;
|
||||
switch (schema_[Types.Kind]) {
|
||||
case 'Any':
|
||||
return yield* Any(schema_, references_, path, value);
|
||||
case 'Array':
|
||||
return yield* Array(schema_, references_, path, value);
|
||||
case 'BigInt':
|
||||
return yield* BigInt(schema_, references_, path, value);
|
||||
case 'Boolean':
|
||||
return yield* Boolean(schema_, references_, path, value);
|
||||
case 'Constructor':
|
||||
return yield* Constructor(schema_, references_, path, value);
|
||||
case 'Date':
|
||||
return yield* Date(schema_, references_, path, value);
|
||||
case 'Function':
|
||||
return yield* Function(schema_, references_, path, value);
|
||||
case 'Integer':
|
||||
return yield* Integer(schema_, references_, path, value);
|
||||
case 'Intersect':
|
||||
return yield* Intersect(schema_, references_, path, value);
|
||||
case 'Literal':
|
||||
return yield* Literal(schema_, references_, path, value);
|
||||
case 'Never':
|
||||
return yield* Never(schema_, references_, path, value);
|
||||
case 'Not':
|
||||
return yield* Not(schema_, references_, path, value);
|
||||
case 'Null':
|
||||
return yield* Null(schema_, references_, path, value);
|
||||
case 'Number':
|
||||
return yield* Number(schema_, references_, path, value);
|
||||
case 'Object':
|
||||
return yield* Object(schema_, references_, path, value);
|
||||
case 'Promise':
|
||||
return yield* Promise(schema_, references_, path, value);
|
||||
case 'Record':
|
||||
return yield* Record(schema_, references_, path, value);
|
||||
case 'Ref':
|
||||
return yield* Ref(schema_, references_, path, value);
|
||||
case 'String':
|
||||
return yield* String(schema_, references_, path, value);
|
||||
case 'Symbol':
|
||||
return yield* Symbol(schema_, references_, path, value);
|
||||
case 'TemplateLiteral':
|
||||
return yield* TemplateLiteral(schema_, references_, path, value);
|
||||
case 'This':
|
||||
return yield* This(schema_, references_, path, value);
|
||||
case 'Tuple':
|
||||
return yield* Tuple(schema_, references_, path, value);
|
||||
case 'Undefined':
|
||||
return yield* Undefined(schema_, references_, path, value);
|
||||
case 'Union':
|
||||
return yield* Union(schema_, references_, path, value);
|
||||
case 'Uint8Array':
|
||||
return yield* Uint8Array(schema_, references_, path, value);
|
||||
case 'Unknown':
|
||||
return yield* Unknown(schema_, references_, path, value);
|
||||
case 'Void':
|
||||
return yield* Void(schema_, references_, path, value);
|
||||
default:
|
||||
if (!Types.TypeRegistry.Has(schema_[Types.Kind]))
|
||||
throw new ValueErrorsUnknownTypeError(schema);
|
||||
return yield* UserDefined(schema_, references_, path, value);
|
||||
}
|
||||
}
|
||||
function Errors(schema, references, value) {
|
||||
const iterator = Visit(schema, references, '', value);
|
||||
return new ValueErrorIterator(iterator);
|
||||
}
|
||||
ValueErrors.Errors = Errors;
|
||||
})(ValueErrors = exports.ValueErrors || (exports.ValueErrors = {}));
|
||||
1
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/errors/index.d.ts
generated
vendored
Normal file
1
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/errors/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './errors';
|
||||
44
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/errors/index.js
generated
vendored
Normal file
44
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/errors/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/errors
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./errors"), exports);
|
||||
23
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/license
generated
vendored
Normal file
23
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/license
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
TypeBox: JSON Schema Type Builder with Static Type Resolution for TypeScript
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
49
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/package.json
generated
vendored
Normal file
49
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "@sinclair/typebox",
|
||||
"version": "0.27.10",
|
||||
"description": "JSONSchema Type Builder with Static Type Resolution for TypeScript",
|
||||
"keywords": [
|
||||
"typescript",
|
||||
"json-schema",
|
||||
"validate",
|
||||
"typecheck"
|
||||
],
|
||||
"author": "sinclairzx81",
|
||||
"license": "MIT",
|
||||
"main": "./typebox.js",
|
||||
"types": "./typebox.d.ts",
|
||||
"exports": {
|
||||
"./compiler": "./compiler/index.js",
|
||||
"./errors": "./errors/index.js",
|
||||
"./system": "./system/index.js",
|
||||
"./value": "./value/index.js",
|
||||
".": "./typebox.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sinclairzx81/typebox-legacy"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "hammer task clean",
|
||||
"format": "hammer task format",
|
||||
"start": "hammer task start",
|
||||
"test": "hammer task test",
|
||||
"benchmark": "hammer task benchmark",
|
||||
"build": "hammer task build",
|
||||
"build:native": "hammer task build_native",
|
||||
"publish": "hammer task publish"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sinclair/hammer": "^0.17.1",
|
||||
"@typescript/native-preview": "^7.0.0-dev.20260203.1",
|
||||
"@types/chai": "^4.3.3",
|
||||
"@types/mocha": "^9.1.1",
|
||||
"@types/node": "^18.19.130",
|
||||
"ajv": "^8.12.0",
|
||||
"ajv-formats": "^2.1.1",
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^9.2.2",
|
||||
"prettier": "^2.7.1",
|
||||
"typescript": "5.0.2"
|
||||
}
|
||||
}
|
||||
1424
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/readme.md
generated
vendored
Normal file
1424
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/readme.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/system/index.d.ts
generated
vendored
Normal file
1
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/system/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './system';
|
||||
44
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/system/index.js
generated
vendored
Normal file
44
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/system/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/system
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./system"), exports);
|
||||
26
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/system/system.d.ts
generated
vendored
Normal file
26
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/system/system.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import * as Types from '../typebox';
|
||||
export declare class TypeSystemDuplicateTypeKind extends Error {
|
||||
constructor(kind: string);
|
||||
}
|
||||
export declare class TypeSystemDuplicateFormat extends Error {
|
||||
constructor(kind: string);
|
||||
}
|
||||
/** Creates user defined types and formats and provides overrides for value checking behaviours */
|
||||
export declare namespace TypeSystem {
|
||||
/** Sets whether TypeBox should assert optional properties using the TypeScript `exactOptionalPropertyTypes` assertion policy. The default is `false` */
|
||||
let ExactOptionalPropertyTypes: boolean;
|
||||
/** Sets whether arrays should be treated as a kind of objects. The default is `false` */
|
||||
let AllowArrayObjects: boolean;
|
||||
/** Sets whether `NaN` or `Infinity` should be treated as valid numeric values. The default is `false` */
|
||||
let AllowNaN: boolean;
|
||||
/** Sets whether `null` should validate for void types. The default is `false` */
|
||||
let AllowVoidNull: boolean;
|
||||
/** Creates a new type */
|
||||
function Type<Type, Options = object>(kind: string, check: (options: Options, value: unknown) => boolean): (options?: Partial<Options>) => Types.TUnsafe<Type>;
|
||||
/** Creates a new string format */
|
||||
function Format<F extends string>(format: F, check: (value: string) => boolean): F;
|
||||
/** @deprecated Use `TypeSystem.Type()` instead. */
|
||||
function CreateType<Type, Options = object>(kind: string, check: (options: Options, value: unknown) => boolean): (options?: Partial<Options>) => Types.TUnsafe<Type>;
|
||||
/** @deprecated Use `TypeSystem.Format()` instead. */
|
||||
function CreateFormat<F extends string>(format: F, check: (value: string) => boolean): F;
|
||||
}
|
||||
90
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/system/system.js
generated
vendored
Normal file
90
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/system/system.js
generated
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/system
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TypeSystem = exports.TypeSystemDuplicateFormat = exports.TypeSystemDuplicateTypeKind = void 0;
|
||||
const Types = require("../typebox");
|
||||
class TypeSystemDuplicateTypeKind extends Error {
|
||||
constructor(kind) {
|
||||
super(`Duplicate type kind '${kind}' detected`);
|
||||
}
|
||||
}
|
||||
exports.TypeSystemDuplicateTypeKind = TypeSystemDuplicateTypeKind;
|
||||
class TypeSystemDuplicateFormat extends Error {
|
||||
constructor(kind) {
|
||||
super(`Duplicate string format '${kind}' detected`);
|
||||
}
|
||||
}
|
||||
exports.TypeSystemDuplicateFormat = TypeSystemDuplicateFormat;
|
||||
/** Creates user defined types and formats and provides overrides for value checking behaviours */
|
||||
var TypeSystem;
|
||||
(function (TypeSystem) {
|
||||
// ------------------------------------------------------------------------
|
||||
// Assertion Policies
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets whether TypeBox should assert optional properties using the TypeScript `exactOptionalPropertyTypes` assertion policy. The default is `false` */
|
||||
TypeSystem.ExactOptionalPropertyTypes = false;
|
||||
/** Sets whether arrays should be treated as a kind of objects. The default is `false` */
|
||||
TypeSystem.AllowArrayObjects = false;
|
||||
/** Sets whether `NaN` or `Infinity` should be treated as valid numeric values. The default is `false` */
|
||||
TypeSystem.AllowNaN = false;
|
||||
/** Sets whether `null` should validate for void types. The default is `false` */
|
||||
TypeSystem.AllowVoidNull = false;
|
||||
// ------------------------------------------------------------------------
|
||||
// String Formats and Types
|
||||
// ------------------------------------------------------------------------
|
||||
/** Creates a new type */
|
||||
function Type(kind, check) {
|
||||
if (Types.TypeRegistry.Has(kind))
|
||||
throw new TypeSystemDuplicateTypeKind(kind);
|
||||
Types.TypeRegistry.Set(kind, check);
|
||||
return (options = {}) => Types.Type.Unsafe({ ...options, [Types.Kind]: kind });
|
||||
}
|
||||
TypeSystem.Type = Type;
|
||||
/** Creates a new string format */
|
||||
function Format(format, check) {
|
||||
if (Types.FormatRegistry.Has(format))
|
||||
throw new TypeSystemDuplicateFormat(format);
|
||||
Types.FormatRegistry.Set(format, check);
|
||||
return format;
|
||||
}
|
||||
TypeSystem.Format = Format;
|
||||
// ------------------------------------------------------------------------
|
||||
// Deprecated
|
||||
// ------------------------------------------------------------------------
|
||||
/** @deprecated Use `TypeSystem.Type()` instead. */
|
||||
function CreateType(kind, check) {
|
||||
return Type(kind, check);
|
||||
}
|
||||
TypeSystem.CreateType = CreateType;
|
||||
/** @deprecated Use `TypeSystem.Format()` instead. */
|
||||
function CreateFormat(format, check) {
|
||||
return Format(format, check);
|
||||
}
|
||||
TypeSystem.CreateFormat = CreateFormat;
|
||||
})(TypeSystem = exports.TypeSystem || (exports.TypeSystem = {}));
|
||||
717
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/typebox.d.ts
generated
vendored
Normal file
717
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/typebox.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,717 @@
|
|||
export declare const Modifier: unique symbol;
|
||||
export declare const Hint: unique symbol;
|
||||
export declare const Kind: unique symbol;
|
||||
export declare const PatternBoolean = "(true|false)";
|
||||
export declare const PatternNumber = "(0|[1-9][0-9]*)";
|
||||
export declare const PatternString = "(.*)";
|
||||
export declare const PatternBooleanExact: string;
|
||||
export declare const PatternNumberExact: string;
|
||||
export declare const PatternStringExact: string;
|
||||
export type TupleToIntersect<T extends any[]> = T extends [infer I] ? I : T extends [infer I, ...infer R] ? I & TupleToIntersect<R> : never;
|
||||
export type TupleToUnion<T extends any[]> = {
|
||||
[K in keyof T]: T[K];
|
||||
}[number];
|
||||
export type UnionToIntersect<U> = (U extends unknown ? (arg: U) => 0 : never) extends (arg: infer I) => 0 ? I : never;
|
||||
export type UnionLast<U> = UnionToIntersect<U extends unknown ? (x: U) => 0 : never> extends (x: infer L) => 0 ? L : never;
|
||||
export type UnionToTuple<U, L = UnionLast<U>> = [U] extends [never] ? [] : [...UnionToTuple<Exclude<U, L>>, L];
|
||||
export type Assert<T, E> = T extends E ? T : never;
|
||||
export type Evaluate<T> = T extends infer O ? {
|
||||
[K in keyof O]: O[K];
|
||||
} : never;
|
||||
export type Ensure<T> = T extends infer U ? U : never;
|
||||
export type TModifier = TReadonlyOptional<TSchema> | TOptional<TSchema> | TReadonly<TSchema>;
|
||||
export type TReadonly<T extends TSchema> = T & {
|
||||
[Modifier]: 'Readonly';
|
||||
};
|
||||
export type TOptional<T extends TSchema> = T & {
|
||||
[Modifier]: 'Optional';
|
||||
};
|
||||
export type TReadonlyOptional<T extends TSchema> = T & {
|
||||
[Modifier]: 'ReadonlyOptional';
|
||||
};
|
||||
export interface SchemaOptions {
|
||||
$schema?: string;
|
||||
/** Id for this schema */
|
||||
$id?: string;
|
||||
/** Title of this schema */
|
||||
title?: string;
|
||||
/** Description of this schema */
|
||||
description?: string;
|
||||
/** Default value for this schema */
|
||||
default?: any;
|
||||
/** Example values matching this schema */
|
||||
examples?: any;
|
||||
[prop: string]: any;
|
||||
}
|
||||
export interface TKind {
|
||||
[Kind]: string;
|
||||
}
|
||||
export interface TSchema extends SchemaOptions, TKind {
|
||||
[Modifier]?: string;
|
||||
[Hint]?: string;
|
||||
params: unknown[];
|
||||
static: unknown;
|
||||
}
|
||||
export type TAnySchema = TSchema | TAny | TArray | TBigInt | TBoolean | TConstructor | TDate | TEnum | TFunction | TInteger | TIntersect | TLiteral | TNot | TNull | TNumber | TObject | TPromise | TRecord | TRef | TString | TSymbol | TTemplateLiteral | TThis | TTuple | TUndefined | TUnion | TUint8Array | TUnknown | TVoid;
|
||||
export type TNumeric = TInteger | TNumber;
|
||||
export interface NumericOptions<N extends number | bigint> extends SchemaOptions {
|
||||
exclusiveMaximum?: N;
|
||||
exclusiveMinimum?: N;
|
||||
maximum?: N;
|
||||
minimum?: N;
|
||||
multipleOf?: N;
|
||||
}
|
||||
export interface TAny extends TSchema {
|
||||
[Kind]: 'Any';
|
||||
static: any;
|
||||
}
|
||||
export interface ArrayOptions extends SchemaOptions {
|
||||
uniqueItems?: boolean;
|
||||
minItems?: number;
|
||||
maxItems?: number;
|
||||
}
|
||||
export interface TArray<T extends TSchema = TSchema> extends TSchema, ArrayOptions {
|
||||
[Kind]: 'Array';
|
||||
static: Static<T, this['params']>[];
|
||||
type: 'array';
|
||||
items: T;
|
||||
}
|
||||
export interface TBigInt extends TSchema, NumericOptions<bigint> {
|
||||
[Kind]: 'BigInt';
|
||||
static: bigint;
|
||||
type: 'null';
|
||||
typeOf: 'BigInt';
|
||||
}
|
||||
export interface TBoolean extends TSchema {
|
||||
[Kind]: 'Boolean';
|
||||
static: boolean;
|
||||
type: 'boolean';
|
||||
}
|
||||
export type TConstructorParameters<T extends TConstructor<TSchema[], TSchema>> = TTuple<T['parameters']>;
|
||||
export type TInstanceType<T extends TConstructor<TSchema[], TSchema>> = T['returns'];
|
||||
export type TCompositeEvaluateArray<T extends readonly TSchema[], P extends unknown[]> = {
|
||||
[K in keyof T]: T[K] extends TSchema ? Static<T[K], P> : never;
|
||||
};
|
||||
export type TCompositeArray<T extends readonly TObject[]> = {
|
||||
[K in keyof T]: T[K] extends TObject<infer P> ? P : {};
|
||||
};
|
||||
export type TCompositeProperties<I extends unknown, T extends readonly any[]> = Evaluate<T extends [infer A, ...infer B] ? TCompositeProperties<I & A, B> : I extends object ? I : {}>;
|
||||
export interface TComposite<T extends TObject[] = TObject[]> extends TObject {
|
||||
[Hint]: 'Composite';
|
||||
static: Evaluate<TCompositeProperties<unknown, TCompositeEvaluateArray<T, this['params']>>>;
|
||||
properties: TCompositeProperties<unknown, TCompositeArray<T>>;
|
||||
}
|
||||
export type TConstructorParameterArray<T extends readonly TSchema[], P extends unknown[]> = [...{
|
||||
[K in keyof T]: Static<Assert<T[K], TSchema>, P>;
|
||||
}];
|
||||
export interface TConstructor<T extends TSchema[] = TSchema[], U extends TSchema = TSchema> extends TSchema {
|
||||
[Kind]: 'Constructor';
|
||||
static: new (...param: TConstructorParameterArray<T, this['params']>) => Static<U, this['params']>;
|
||||
type: 'object';
|
||||
instanceOf: 'Constructor';
|
||||
parameters: T;
|
||||
returns: U;
|
||||
}
|
||||
export interface DateOptions extends SchemaOptions {
|
||||
exclusiveMaximumTimestamp?: number;
|
||||
exclusiveMinimumTimestamp?: number;
|
||||
maximumTimestamp?: number;
|
||||
minimumTimestamp?: number;
|
||||
}
|
||||
export interface TDate extends TSchema, DateOptions {
|
||||
[Kind]: 'Date';
|
||||
static: Date;
|
||||
type: 'object';
|
||||
instanceOf: 'Date';
|
||||
}
|
||||
export interface TEnumOption<T> {
|
||||
type: 'number' | 'string';
|
||||
const: T;
|
||||
}
|
||||
export interface TEnum<T extends Record<string, string | number> = Record<string, string | number>> extends TSchema {
|
||||
[Kind]: 'Union';
|
||||
static: T[keyof T];
|
||||
anyOf: TLiteral<string | number>[];
|
||||
}
|
||||
export type TExtends<L extends TSchema, R extends TSchema, T extends TSchema, U extends TSchema> = (Static<L> extends Static<R> ? T : U) extends infer O ? UnionToTuple<O> extends [infer X, infer Y] ? TUnion<[Assert<X, TSchema>, Assert<Y, TSchema>]> : Assert<O, TSchema> : never;
|
||||
export type TExcludeTemplateLiteralResult<T extends string> = TString;
|
||||
export type TExcludeTemplateLiteral<T extends TTemplateLiteral, U extends TSchema> = Exclude<Static<T>, Static<U>> extends infer S ? TExcludeTemplateLiteralResult<Assert<S, string>> : never;
|
||||
export type TExcludeArray<T extends TSchema[], U extends TSchema> = Assert<UnionToTuple<{
|
||||
[K in keyof T]: Static<Assert<T[K], TSchema>> extends Static<U> ? never : T[K];
|
||||
}[number]>, TSchema[]> extends infer R ? TUnionResult<Assert<R, TSchema[]>> : never;
|
||||
export type TExclude<T extends TSchema, U extends TSchema> = T extends TTemplateLiteral ? TExcludeTemplateLiteral<T, U> : T extends TUnion<infer S> ? TExcludeArray<S, U> : T extends U ? TNever : T;
|
||||
export type TExtractTemplateLiteralResult<T extends string> = TString;
|
||||
export type TExtractTemplateLiteral<T extends TTemplateLiteral, U extends TSchema> = Extract<Static<T>, Static<U>> extends infer S ? TExtractTemplateLiteralResult<Assert<S, string>> : never;
|
||||
export type TExtractArray<T extends TSchema[], U extends TSchema> = Assert<UnionToTuple<{
|
||||
[K in keyof T]: Static<Assert<T[K], TSchema>> extends Static<U> ? T[K] : never;
|
||||
}[number]>, TSchema[]> extends infer R ? TUnionResult<Assert<R, TSchema[]>> : never;
|
||||
export type TExtract<T extends TSchema, U extends TSchema> = T extends TTemplateLiteral ? TExtractTemplateLiteral<T, U> : T extends TUnion<infer S> ? TExtractArray<S, U> : T extends U ? T : T;
|
||||
export type TFunctionParameters<T extends readonly TSchema[], P extends unknown[]> = [...{
|
||||
[K in keyof T]: Static<Assert<T[K], TSchema>, P>;
|
||||
}];
|
||||
export interface TFunction<T extends readonly TSchema[] = TSchema[], U extends TSchema = TSchema> extends TSchema {
|
||||
[Kind]: 'Function';
|
||||
static: (...param: TFunctionParameters<T, this['params']>) => Static<U, this['params']>;
|
||||
type: 'object';
|
||||
instanceOf: 'Function';
|
||||
parameters: T;
|
||||
returns: U;
|
||||
}
|
||||
export interface TInteger extends TSchema, NumericOptions<number> {
|
||||
[Kind]: 'Integer';
|
||||
static: number;
|
||||
type: 'integer';
|
||||
}
|
||||
export type TUnevaluatedProperties = undefined | TSchema | boolean;
|
||||
export interface IntersectOptions extends SchemaOptions {
|
||||
unevaluatedProperties?: TUnevaluatedProperties;
|
||||
}
|
||||
export interface TIntersect<T extends TSchema[] = TSchema[]> extends TSchema, IntersectOptions {
|
||||
[Kind]: 'Intersect';
|
||||
static: TupleToIntersect<{
|
||||
[K in keyof T]: Static<Assert<T[K], TSchema>, this['params']>;
|
||||
}>;
|
||||
type?: 'object';
|
||||
allOf: [...T];
|
||||
}
|
||||
export type TKeyOfTuple<T extends TSchema> = {
|
||||
[K in keyof Static<T>]: TLiteral<Assert<K, TLiteralValue>>;
|
||||
} extends infer U ? UnionToTuple<Exclude<{
|
||||
[K in keyof U]: U[K];
|
||||
}[keyof U], undefined>> : never;
|
||||
export type TKeyOf<T extends TSchema = TSchema> = (T extends TRecursive<infer S> ? TKeyOfTuple<S> : T extends TComposite ? TKeyOfTuple<T> : T extends TIntersect ? TKeyOfTuple<T> : T extends TUnion ? TKeyOfTuple<T> : T extends TObject ? TKeyOfTuple<T> : T extends TRecord<infer K> ? [K] : [
|
||||
]) extends infer R ? TUnionResult<Assert<R, TSchema[]>> : never;
|
||||
export type TLiteralValue = string | number | boolean;
|
||||
export interface TLiteral<T extends TLiteralValue = TLiteralValue> extends TSchema {
|
||||
[Kind]: 'Literal';
|
||||
static: T;
|
||||
const: T;
|
||||
}
|
||||
export interface TNever extends TSchema {
|
||||
[Kind]: 'Never';
|
||||
static: never;
|
||||
not: {};
|
||||
}
|
||||
export interface TNot<Not extends TSchema = TSchema, T extends TSchema = TSchema> extends TSchema {
|
||||
[Kind]: 'Not';
|
||||
static: Static<T>;
|
||||
allOf: [{
|
||||
not: Not;
|
||||
}, T];
|
||||
}
|
||||
export interface TNull extends TSchema {
|
||||
[Kind]: 'Null';
|
||||
static: null;
|
||||
type: 'null';
|
||||
}
|
||||
export interface TNumber extends TSchema, NumericOptions<number> {
|
||||
[Kind]: 'Number';
|
||||
static: number;
|
||||
type: 'number';
|
||||
}
|
||||
export type ReadonlyOptionalPropertyKeys<T extends TProperties> = {
|
||||
[K in keyof T]: T[K] extends TReadonlyOptional<TSchema> ? K : never;
|
||||
}[keyof T];
|
||||
export type ReadonlyPropertyKeys<T extends TProperties> = {
|
||||
[K in keyof T]: T[K] extends TReadonly<TSchema> ? K : never;
|
||||
}[keyof T];
|
||||
export type OptionalPropertyKeys<T extends TProperties> = {
|
||||
[K in keyof T]: T[K] extends TOptional<TSchema> ? K : never;
|
||||
}[keyof T];
|
||||
export type RequiredPropertyKeys<T extends TProperties> = keyof Omit<T, ReadonlyOptionalPropertyKeys<T> | ReadonlyPropertyKeys<T> | OptionalPropertyKeys<T>>;
|
||||
export type PropertiesReducer<T extends TProperties, R extends Record<keyof any, unknown>> = Evaluate<(Readonly<Partial<Pick<R, ReadonlyOptionalPropertyKeys<T>>>> & Readonly<Pick<R, ReadonlyPropertyKeys<T>>> & Partial<Pick<R, OptionalPropertyKeys<T>>> & Required<Pick<R, RequiredPropertyKeys<T>>>)>;
|
||||
export type PropertiesReduce<T extends TProperties, P extends unknown[]> = PropertiesReducer<T, {
|
||||
[K in keyof T]: Static<T[K], P>;
|
||||
}>;
|
||||
export type TProperties = Record<keyof any, TSchema>;
|
||||
export type ObjectProperties<T> = T extends TObject<infer U> ? U : never;
|
||||
export type ObjectPropertyKeys<T> = T extends TObject<infer U> ? keyof U : never;
|
||||
export type TAdditionalProperties = undefined | TSchema | boolean;
|
||||
export interface ObjectOptions extends SchemaOptions {
|
||||
additionalProperties?: TAdditionalProperties;
|
||||
minProperties?: number;
|
||||
maxProperties?: number;
|
||||
}
|
||||
export interface TObject<T extends TProperties = TProperties> extends TSchema, ObjectOptions {
|
||||
[Kind]: 'Object';
|
||||
static: PropertiesReduce<T, this['params']>;
|
||||
additionalProperties?: TAdditionalProperties;
|
||||
type: 'object';
|
||||
properties: T;
|
||||
required?: string[];
|
||||
}
|
||||
export type TOmitArray<T extends TSchema[], K extends keyof any> = Assert<{
|
||||
[K2 in keyof T]: TOmit<Assert<T[K2], TSchema>, K>;
|
||||
}, TSchema[]>;
|
||||
export type TOmitProperties<T extends TProperties, K extends keyof any> = Evaluate<Assert<Omit<T, K>, TProperties>>;
|
||||
export type TOmit<T extends TSchema = TSchema, K extends keyof any = keyof any> = T extends TRecursive<infer S> ? TRecursive<TOmit<S, K>> : T extends TComposite<infer S> ? TComposite<TOmitArray<S, K>> : T extends TIntersect<infer S> ? TIntersect<TOmitArray<S, K>> : T extends TUnion<infer S> ? TUnion<TOmitArray<S, K>> : T extends TObject<infer S> ? TObject<TOmitProperties<S, K>> : T;
|
||||
export type TParameters<T extends TFunction> = TTuple<T['parameters']>;
|
||||
export type TPartialObjectArray<T extends TObject[]> = Assert<{
|
||||
[K in keyof T]: TPartial<Assert<T[K], TObject>>;
|
||||
}, TObject[]>;
|
||||
export type TPartialArray<T extends TSchema[]> = Assert<{
|
||||
[K in keyof T]: TPartial<Assert<T[K], TSchema>>;
|
||||
}, TSchema[]>;
|
||||
export type TPartialProperties<T extends TProperties> = Evaluate<Assert<{
|
||||
[K in keyof T]: T[K] extends TReadonlyOptional<infer U> ? TReadonlyOptional<U> : T[K] extends TReadonly<infer U> ? TReadonlyOptional<U> : T[K] extends TOptional<infer U> ? TOptional<U> : TOptional<T[K]>;
|
||||
}, TProperties>>;
|
||||
export type TPartial<T extends TSchema> = T extends TRecursive<infer S> ? TRecursive<TPartial<S>> : T extends TComposite<infer S> ? TComposite<TPartialArray<S>> : T extends TIntersect<infer S> ? TIntersect<TPartialArray<S>> : T extends TUnion<infer S> ? TUnion<TPartialArray<S>> : T extends TObject<infer S> ? TObject<TPartialProperties<S>> : T;
|
||||
export type TPickArray<T extends TSchema[], K extends keyof any> = {
|
||||
[K2 in keyof T]: TPick<Assert<T[K2], TSchema>, K>;
|
||||
};
|
||||
export type TPickProperties<T extends TProperties, K extends keyof any> = Pick<T, Assert<Extract<K, keyof T>, keyof T>> extends infer R ? ({
|
||||
[K in keyof R]: Assert<R[K], TSchema> extends TSchema ? R[K] : never;
|
||||
}) : never;
|
||||
export type TPick<T extends TSchema = TSchema, K extends keyof any = keyof any> = T extends TRecursive<infer S> ? TRecursive<TPick<S, K>> : T extends TComposite<infer S> ? TComposite<TPickArray<S, K>> : T extends TIntersect<infer S> ? TIntersect<TPickArray<S, K>> : T extends TUnion<infer S> ? TUnion<TPickArray<S, K>> : T extends TObject<infer S> ? TObject<TPickProperties<S, K>> : T;
|
||||
export interface TPromise<T extends TSchema = TSchema> extends TSchema {
|
||||
[Kind]: 'Promise';
|
||||
static: Promise<Static<T, this['params']>>;
|
||||
type: 'object';
|
||||
instanceOf: 'Promise';
|
||||
item: TSchema;
|
||||
}
|
||||
export type RecordTemplateLiteralObjectType<K extends TTemplateLiteral, T extends TSchema> = Ensure<TObject<Evaluate<{
|
||||
[_ in Static<K>]: T;
|
||||
}>>>;
|
||||
export type RecordTemplateLiteralType<K extends TTemplateLiteral, T extends TSchema> = IsTemplateLiteralFinite<K> extends true ? RecordTemplateLiteralObjectType<K, T> : TRecord<K, T>;
|
||||
export type RecordUnionLiteralType<K extends TUnion<TLiteral<string | number>[]>, T extends TSchema> = Static<K> extends string ? Ensure<TObject<{
|
||||
[X in Static<K>]: T;
|
||||
}>> : never;
|
||||
export type RecordLiteralType<K extends TLiteral<string | number>, T extends TSchema> = Ensure<TObject<{
|
||||
[K2 in K['const']]: T;
|
||||
}>>;
|
||||
export type RecordNumberType<K extends TInteger | TNumber, T extends TSchema> = Ensure<TRecord<K, T>>;
|
||||
export type RecordStringType<K extends TString, T extends TSchema> = Ensure<TRecord<K, T>>;
|
||||
export type RecordKey = TUnion<TLiteral<string | number>[]> | TLiteral<string | number> | TTemplateLiteral | TInteger | TNumber | TString;
|
||||
export interface TRecord<K extends RecordKey = RecordKey, T extends TSchema = TSchema> extends TSchema {
|
||||
[Kind]: 'Record';
|
||||
static: Record<Static<K>, Static<T, this['params']>>;
|
||||
type: 'object';
|
||||
patternProperties: {
|
||||
[pattern: string]: T;
|
||||
};
|
||||
additionalProperties: false;
|
||||
}
|
||||
export interface TThis extends TSchema {
|
||||
[Kind]: 'This';
|
||||
static: this['params'][0];
|
||||
$ref: string;
|
||||
}
|
||||
export type TRecursiveReduce<T extends TSchema> = Static<T, [TRecursiveReduce<T>]>;
|
||||
export interface TRecursive<T extends TSchema> extends TSchema {
|
||||
[Hint]: 'Recursive';
|
||||
static: TRecursiveReduce<T>;
|
||||
}
|
||||
export interface TRef<T extends TSchema = TSchema> extends TSchema {
|
||||
[Kind]: 'Ref';
|
||||
static: Static<T, this['params']>;
|
||||
$ref: string;
|
||||
}
|
||||
export type TReturnType<T extends TFunction> = T['returns'];
|
||||
export type TRequiredArray<T extends TSchema[]> = Assert<{
|
||||
[K in keyof T]: TRequired<Assert<T[K], TSchema>>;
|
||||
}, TSchema[]>;
|
||||
export type TRequiredProperties<T extends TProperties> = Evaluate<Assert<{
|
||||
[K in keyof T]: T[K] extends TReadonlyOptional<infer U> ? TReadonly<U> : T[K] extends TReadonly<infer U> ? TReadonly<U> : T[K] extends TOptional<infer U> ? U : T[K];
|
||||
}, TProperties>>;
|
||||
export type TRequired<T extends TSchema> = T extends TRecursive<infer S> ? TRecursive<TRequired<S>> : T extends TComposite<infer S> ? TComposite<TRequiredArray<S>> : T extends TIntersect<infer S> ? TIntersect<TRequiredArray<S>> : T extends TUnion<infer S> ? TUnion<TRequiredArray<S>> : T extends TObject<infer S> ? TObject<TRequiredProperties<S>> : T;
|
||||
export type StringFormatOption = 'date-time' | 'time' | 'date' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'uuid' | 'iri-reference' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex';
|
||||
export interface StringOptions<Format extends string> extends SchemaOptions {
|
||||
minLength?: number;
|
||||
maxLength?: number;
|
||||
pattern?: string;
|
||||
format?: Format;
|
||||
contentEncoding?: '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64';
|
||||
contentMediaType?: string;
|
||||
}
|
||||
export interface TString<Format extends string = string> extends TSchema, StringOptions<Format> {
|
||||
[Kind]: 'String';
|
||||
static: string;
|
||||
type: 'string';
|
||||
}
|
||||
export type SymbolValue = string | number | undefined;
|
||||
export interface TSymbol extends TSchema, SchemaOptions {
|
||||
[Kind]: 'Symbol';
|
||||
static: symbol;
|
||||
type: 'null';
|
||||
typeOf: 'Symbol';
|
||||
}
|
||||
export type IsTemplateLiteralFiniteCheck<T> = T extends TTemplateLiteral<infer U> ? IsTemplateLiteralFiniteArray<Assert<U, TTemplateLiteralKind[]>> : T extends TUnion<infer U> ? IsTemplateLiteralFiniteArray<Assert<U, TTemplateLiteralKind[]>> : T extends TString ? false : T extends TBoolean ? false : T extends TNumber ? false : T extends TInteger ? false : T extends TBigInt ? false : T extends TLiteral ? true : false;
|
||||
export type IsTemplateLiteralFiniteArray<T extends TTemplateLiteralKind[]> = T extends [infer L, ...infer R] ? IsTemplateLiteralFiniteCheck<L> extends false ? false : IsTemplateLiteralFiniteArray<Assert<R, TTemplateLiteralKind[]>> : T extends [infer L] ? IsTemplateLiteralFiniteCheck<L> extends false ? false : true : true;
|
||||
export type IsTemplateLiteralFinite<T> = T extends TTemplateLiteral<infer U> ? IsTemplateLiteralFiniteArray<U> : false;
|
||||
export type TTemplateLiteralKind = TUnion | TLiteral | TInteger | TTemplateLiteral | TNumber | TBigInt | TString | TBoolean | TNever;
|
||||
export type TTemplateLiteralConst<T, Acc extends string> = T extends TUnion<infer U> ? {
|
||||
[K in keyof U]: TTemplateLiteralUnion<Assert<[U[K]], TTemplateLiteralKind[]>, Acc>;
|
||||
}[number] : T extends TTemplateLiteral ? `${Static<T>}` : T extends TLiteral<infer U> ? `${U}` : T extends TString ? `${string}` : T extends TNumber ? `${number}` : T extends TBigInt ? `${bigint}` : T extends TBoolean ? `${boolean}` : never;
|
||||
export type TTemplateLiteralUnion<T extends TTemplateLiteralKind[], Acc extends string = ''> = T extends [infer L, ...infer R] ? `${TTemplateLiteralConst<L, Acc>}${TTemplateLiteralUnion<Assert<R, TTemplateLiteralKind[]>, Acc>}` : T extends [infer L] ? `${TTemplateLiteralConst<L, Acc>}${Acc}` : Acc;
|
||||
export interface TTemplateLiteral<T extends TTemplateLiteralKind[] = TTemplateLiteralKind[]> extends TSchema {
|
||||
[Kind]: 'TemplateLiteral';
|
||||
static: TTemplateLiteralUnion<T>;
|
||||
type: 'string';
|
||||
pattern: string;
|
||||
}
|
||||
export type TTupleIntoArray<T extends TTuple<TSchema[]>> = T extends TTuple<infer R> ? Assert<R, TSchema[]> : never;
|
||||
export interface TTuple<T extends TSchema[] = TSchema[]> extends TSchema {
|
||||
[Kind]: 'Tuple';
|
||||
static: {
|
||||
[K in keyof T]: T[K] extends TSchema ? Static<T[K], this['params']> : T[K];
|
||||
};
|
||||
type: 'array';
|
||||
items?: T;
|
||||
additionalItems?: false;
|
||||
minItems: number;
|
||||
maxItems: number;
|
||||
}
|
||||
export interface TUndefined extends TSchema {
|
||||
[Kind]: 'Undefined';
|
||||
static: undefined;
|
||||
type: 'null';
|
||||
typeOf: 'Undefined';
|
||||
}
|
||||
export type TUnionOfLiteralArray<T extends TLiteral<string>[]> = {
|
||||
[K in keyof T]: Assert<T[K], TLiteral>['const'];
|
||||
}[number];
|
||||
export type TUnionOfLiteral<T extends TUnion<TLiteral<string>[]>> = TUnionOfLiteralArray<T['anyOf']>;
|
||||
export type TUnionResult<T extends TSchema[]> = T extends [] ? TNever : T extends [infer S] ? S : TUnion<T>;
|
||||
export type TUnionTemplateLiteral<T extends TTemplateLiteral, S extends string = Static<T>> = (string);
|
||||
export interface TUnion<T extends TSchema[] = TSchema[]> extends TSchema {
|
||||
[Kind]: 'Union';
|
||||
static: {
|
||||
[K in keyof T]: T[K] extends TSchema ? Static<T[K], this['params']> : never;
|
||||
}[number];
|
||||
anyOf: T;
|
||||
}
|
||||
export interface Uint8ArrayOptions extends SchemaOptions {
|
||||
maxByteLength?: number;
|
||||
minByteLength?: number;
|
||||
}
|
||||
export interface TUint8Array extends TSchema, Uint8ArrayOptions {
|
||||
[Kind]: 'Uint8Array';
|
||||
static: Uint8Array;
|
||||
instanceOf: 'Uint8Array';
|
||||
type: 'object';
|
||||
}
|
||||
export interface TUnknown extends TSchema {
|
||||
[Kind]: 'Unknown';
|
||||
static: unknown;
|
||||
}
|
||||
export interface UnsafeOptions extends SchemaOptions {
|
||||
[Kind]?: string;
|
||||
}
|
||||
export interface TUnsafe<T> extends TSchema {
|
||||
[Kind]: string;
|
||||
static: T;
|
||||
}
|
||||
export interface TVoid extends TSchema {
|
||||
[Kind]: 'Void';
|
||||
static: void;
|
||||
type: 'null';
|
||||
typeOf: 'Void';
|
||||
}
|
||||
/** Creates a TypeScript static type from a TypeBox type */
|
||||
export type Static<T extends TSchema, P extends unknown[] = []> = (T & {
|
||||
params: P;
|
||||
})['static'];
|
||||
export type TypeRegistryValidationFunction<TSchema> = (schema: TSchema, value: unknown) => boolean;
|
||||
/** A registry for user defined types */
|
||||
export declare namespace TypeRegistry {
|
||||
/** Returns the entries in this registry */
|
||||
function Entries(): Map<string, TypeRegistryValidationFunction<any>>;
|
||||
/** Clears all user defined types */
|
||||
function Clear(): void;
|
||||
/** Returns true if this registry contains this kind */
|
||||
function Has(kind: string): boolean;
|
||||
/** Sets a validation function for a user defined type */
|
||||
function Set<TSchema = unknown>(kind: string, func: TypeRegistryValidationFunction<TSchema>): void;
|
||||
/** Gets a custom validation function for a user defined type */
|
||||
function Get(kind: string): TypeRegistryValidationFunction<any> | undefined;
|
||||
}
|
||||
export type FormatRegistryValidationFunction = (value: string) => boolean;
|
||||
/** A registry for user defined string formats */
|
||||
export declare namespace FormatRegistry {
|
||||
/** Returns the entries in this registry */
|
||||
function Entries(): Map<string, FormatRegistryValidationFunction>;
|
||||
/** Clears all user defined string formats */
|
||||
function Clear(): void;
|
||||
/** Returns true if the user defined string format exists */
|
||||
function Has(format: string): boolean;
|
||||
/** Sets a validation function for a user defined string format */
|
||||
function Set(format: string, func: FormatRegistryValidationFunction): void;
|
||||
/** Gets a validation function for a user defined string format */
|
||||
function Get(format: string): FormatRegistryValidationFunction | undefined;
|
||||
}
|
||||
export declare class TypeGuardUnknownTypeError extends Error {
|
||||
readonly schema: unknown;
|
||||
constructor(schema: unknown);
|
||||
}
|
||||
/** Provides functions to test if JavaScript values are TypeBox types */
|
||||
export declare namespace TypeGuard {
|
||||
/** Returns true if the given schema is TAny */
|
||||
function TAny(schema: unknown): schema is TAny;
|
||||
/** Returns true if the given schema is TArray */
|
||||
function TArray(schema: unknown): schema is TArray;
|
||||
/** Returns true if the given schema is TBigInt */
|
||||
function TBigInt(schema: unknown): schema is TBigInt;
|
||||
/** Returns true if the given schema is TBoolean */
|
||||
function TBoolean(schema: unknown): schema is TBoolean;
|
||||
/** Returns true if the given schema is TConstructor */
|
||||
function TConstructor(schema: unknown): schema is TConstructor;
|
||||
/** Returns true if the given schema is TDate */
|
||||
function TDate(schema: unknown): schema is TDate;
|
||||
/** Returns true if the given schema is TFunction */
|
||||
function TFunction(schema: unknown): schema is TFunction;
|
||||
/** Returns true if the given schema is TInteger */
|
||||
function TInteger(schema: unknown): schema is TInteger;
|
||||
/** Returns true if the given schema is TIntersect */
|
||||
function TIntersect(schema: unknown): schema is TIntersect;
|
||||
/** Returns true if the given schema is TKind */
|
||||
function TKind(schema: unknown): schema is Record<typeof Kind | string, unknown>;
|
||||
/** Returns true if the given schema is TLiteral */
|
||||
function TLiteral(schema: unknown): schema is TLiteral;
|
||||
/** Returns true if the given schema is TNever */
|
||||
function TNever(schema: unknown): schema is TNever;
|
||||
/** Returns true if the given schema is TNot */
|
||||
function TNot(schema: unknown): schema is TNot;
|
||||
/** Returns true if the given schema is TNull */
|
||||
function TNull(schema: unknown): schema is TNull;
|
||||
/** Returns true if the given schema is TNumber */
|
||||
function TNumber(schema: unknown): schema is TNumber;
|
||||
/** Returns true if the given schema is TObject */
|
||||
function TObject(schema: unknown): schema is TObject;
|
||||
/** Returns true if the given schema is TPromise */
|
||||
function TPromise(schema: unknown): schema is TPromise;
|
||||
/** Returns true if the given schema is TRecord */
|
||||
function TRecord(schema: unknown): schema is TRecord;
|
||||
/** Returns true if the given schema is TRef */
|
||||
function TRef(schema: unknown): schema is TRef;
|
||||
/** Returns true if the given schema is TString */
|
||||
function TString(schema: unknown): schema is TString;
|
||||
/** Returns true if the given schema is TSymbol */
|
||||
function TSymbol(schema: unknown): schema is TSymbol;
|
||||
/** Returns true if the given schema is TTemplateLiteral */
|
||||
function TTemplateLiteral(schema: unknown): schema is TTemplateLiteral;
|
||||
/** Returns true if the given schema is TThis */
|
||||
function TThis(schema: unknown): schema is TThis;
|
||||
/** Returns true if the given schema is TTuple */
|
||||
function TTuple(schema: unknown): schema is TTuple;
|
||||
/** Returns true if the given schema is TUndefined */
|
||||
function TUndefined(schema: unknown): schema is TUndefined;
|
||||
/** Returns true if the given schema is TUnion */
|
||||
function TUnion(schema: unknown): schema is TUnion;
|
||||
/** Returns true if the given schema is TUnion<Literal<string>[]> */
|
||||
function TUnionLiteral(schema: unknown): schema is TUnion<TLiteral<string>[]>;
|
||||
/** Returns true if the given schema is TUint8Array */
|
||||
function TUint8Array(schema: unknown): schema is TUint8Array;
|
||||
/** Returns true if the given schema is TUnknown */
|
||||
function TUnknown(schema: unknown): schema is TUnknown;
|
||||
/** Returns true if the given schema is a raw TUnsafe */
|
||||
function TUnsafe(schema: unknown): schema is TUnsafe<unknown>;
|
||||
/** Returns true if the given schema is TVoid */
|
||||
function TVoid(schema: unknown): schema is TVoid;
|
||||
/** Returns true if this schema has the ReadonlyOptional modifier */
|
||||
function TReadonlyOptional<T extends TSchema>(schema: T): schema is TReadonlyOptional<T>;
|
||||
/** Returns true if this schema has the Readonly modifier */
|
||||
function TReadonly<T extends TSchema>(schema: T): schema is TReadonly<T>;
|
||||
/** Returns true if this schema has the Optional modifier */
|
||||
function TOptional<T extends TSchema>(schema: T): schema is TOptional<T>;
|
||||
/** Returns true if the given schema is TSchema */
|
||||
function TSchema(schema: unknown): schema is TSchema;
|
||||
}
|
||||
/** Fast undefined check used for properties of type undefined */
|
||||
export declare namespace ExtendsUndefined {
|
||||
function Check(schema: TSchema): boolean;
|
||||
}
|
||||
export declare enum TypeExtendsResult {
|
||||
Union = 0,
|
||||
True = 1,
|
||||
False = 2
|
||||
}
|
||||
export declare namespace TypeExtends {
|
||||
function Extends(left: TSchema, right: TSchema): TypeExtendsResult;
|
||||
}
|
||||
/** Specialized Clone for Types */
|
||||
export declare namespace TypeClone {
|
||||
/** Clones a type. */
|
||||
function Clone<T extends TSchema>(schema: T, options: SchemaOptions): T;
|
||||
}
|
||||
export declare namespace ObjectMap {
|
||||
function Map<T = TSchema>(schema: TSchema, callback: (object: TObject) => TObject, options: SchemaOptions): T;
|
||||
}
|
||||
export declare namespace KeyResolver {
|
||||
function Resolve<T extends TSchema>(schema: T): string[];
|
||||
}
|
||||
export declare namespace TemplateLiteralPattern {
|
||||
function Create(kinds: TTemplateLiteralKind[]): string;
|
||||
}
|
||||
export declare namespace TemplateLiteralResolver {
|
||||
function Resolve(template: TTemplateLiteral): TString | TUnion | TLiteral;
|
||||
}
|
||||
export declare class TemplateLiteralParserError extends Error {
|
||||
constructor(message: string);
|
||||
}
|
||||
export declare namespace TemplateLiteralParser {
|
||||
type Expression = And | Or | Const;
|
||||
type Const = {
|
||||
type: 'const';
|
||||
const: string;
|
||||
};
|
||||
type And = {
|
||||
type: 'and';
|
||||
expr: Expression[];
|
||||
};
|
||||
type Or = {
|
||||
type: 'or';
|
||||
expr: Expression[];
|
||||
};
|
||||
/** Parses a pattern and returns an expression tree */
|
||||
function Parse(pattern: string): Expression;
|
||||
/** Parses a pattern and strips forward and trailing ^ and $ */
|
||||
function ParseExact(pattern: string): Expression;
|
||||
}
|
||||
export declare namespace TemplateLiteralFinite {
|
||||
function Check(expression: TemplateLiteralParser.Expression): boolean;
|
||||
}
|
||||
export declare namespace TemplateLiteralGenerator {
|
||||
function Generate(expression: TemplateLiteralParser.Expression): IterableIterator<string>;
|
||||
}
|
||||
export declare class TypeBuilder {
|
||||
/** `[Utility]` Creates a schema without `static` and `params` types */
|
||||
protected Create<T>(schema: Omit<T, 'static' | 'params'>): T;
|
||||
/** `[Standard]` Omits compositing symbols from this schema */
|
||||
Strict<T extends TSchema>(schema: T): T;
|
||||
}
|
||||
export declare class StandardTypeBuilder extends TypeBuilder {
|
||||
/** `[Modifier]` Creates a Optional property */
|
||||
Optional<T extends TSchema>(schema: T): TOptional<T>;
|
||||
/** `[Modifier]` Creates a ReadonlyOptional property */
|
||||
ReadonlyOptional<T extends TSchema>(schema: T): TReadonlyOptional<T>;
|
||||
/** `[Modifier]` Creates a Readonly object or property */
|
||||
Readonly<T extends TSchema>(schema: T): TReadonly<T>;
|
||||
/** `[Standard]` Creates an Any type */
|
||||
Any(options?: SchemaOptions): TAny;
|
||||
/** `[Standard]` Creates an Array type */
|
||||
Array<T extends TSchema>(items: T, options?: ArrayOptions): TArray<T>;
|
||||
/** `[Standard]` Creates a Boolean type */
|
||||
Boolean(options?: SchemaOptions): TBoolean;
|
||||
/** `[Standard]` Creates a Composite object type. */
|
||||
Composite<T extends TObject[]>(objects: [...T], options?: ObjectOptions): TComposite<T>;
|
||||
/** `[Standard]` Creates a Enum type */
|
||||
Enum<T extends Record<string, string | number>>(item: T, options?: SchemaOptions): TEnum<T>;
|
||||
/** `[Standard]` A conditional type expression that will return the true type if the left type extends the right */
|
||||
Extends<L extends TSchema, R extends TSchema, T extends TSchema, U extends TSchema>(left: L, right: R, trueType: T, falseType: U, options?: SchemaOptions): TExtends<L, R, T, U>;
|
||||
/** `[Standard]` Excludes from the left type any type that is not assignable to the right */
|
||||
Exclude<L extends TSchema, R extends TSchema>(left: L, right: R, options?: SchemaOptions): TExclude<L, R>;
|
||||
/** `[Standard]` Extracts from the left type any type that is assignable to the right */
|
||||
Extract<L extends TSchema, R extends TSchema>(left: L, right: R, options?: SchemaOptions): TExtract<L, R>;
|
||||
/** `[Standard]` Creates an Integer type */
|
||||
Integer(options?: NumericOptions<number>): TInteger;
|
||||
/** `[Standard]` Creates a Intersect type */
|
||||
Intersect(allOf: [], options?: SchemaOptions): TNever;
|
||||
/** `[Standard]` Creates a Intersect type */
|
||||
Intersect<T extends [TSchema]>(allOf: [...T], options?: SchemaOptions): T[0];
|
||||
Intersect<T extends TSchema[]>(allOf: [...T], options?: IntersectOptions): TIntersect<T>;
|
||||
/** `[Standard]` Creates a KeyOf type */
|
||||
KeyOf<T extends TSchema>(schema: T, options?: SchemaOptions): TKeyOf<T>;
|
||||
/** `[Standard]` Creates a Literal type */
|
||||
Literal<T extends TLiteralValue>(value: T, options?: SchemaOptions): TLiteral<T>;
|
||||
/** `[Standard]` Creates a Never type */
|
||||
Never(options?: SchemaOptions): TNever;
|
||||
/** `[Standard]` Creates a Not type. The first argument is the disallowed type, the second is the allowed. */
|
||||
Not<N extends TSchema, T extends TSchema>(not: N, schema: T, options?: SchemaOptions): TNot<N, T>;
|
||||
/** `[Standard]` Creates a Null type */
|
||||
Null(options?: SchemaOptions): TNull;
|
||||
/** `[Standard]` Creates a Number type */
|
||||
Number(options?: NumericOptions<number>): TNumber;
|
||||
/** `[Standard]` Creates an Object type */
|
||||
Object<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<T>;
|
||||
/** `[Standard]` Creates a mapped type whose keys are omitted from the given type */
|
||||
Omit<T extends TSchema, K extends (keyof Static<T>)[]>(schema: T, keys: readonly [...K], options?: SchemaOptions): TOmit<T, K[number]>;
|
||||
/** `[Standard]` Creates a mapped type whose keys are omitted from the given type */
|
||||
Omit<T extends TSchema, K extends TUnion<TLiteral<string>[]>>(schema: T, keys: K, options?: SchemaOptions): TOmit<T, TUnionOfLiteral<K>>;
|
||||
/** `[Standard]` Creates a mapped type whose keys are omitted from the given type */
|
||||
Omit<T extends TSchema, K extends TLiteral<string>>(schema: T, key: K, options?: SchemaOptions): TOmit<T, K['const']>;
|
||||
/** `[Standard]` Creates a mapped type whose keys are omitted from the given type */
|
||||
Omit<T extends TSchema, K extends TNever>(schema: T, key: K, options?: SchemaOptions): TOmit<T, never>;
|
||||
/** `[Standard]` Creates a mapped type where all properties are Optional */
|
||||
Partial<T extends TSchema>(schema: T, options?: ObjectOptions): TPartial<T>;
|
||||
/** `[Standard]` Creates a mapped type whose keys are picked from the given type */
|
||||
Pick<T extends TSchema, K extends (keyof Static<T>)[]>(schema: T, keys: readonly [...K], options?: SchemaOptions): TPick<T, K[number]>;
|
||||
/** `[Standard]` Creates a mapped type whose keys are picked from the given type */
|
||||
Pick<T extends TSchema, K extends TUnion<TLiteral<string>[]>>(schema: T, keys: K, options?: SchemaOptions): TPick<T, TUnionOfLiteral<K>>;
|
||||
/** `[Standard]` Creates a mapped type whose keys are picked from the given type */
|
||||
Pick<T extends TSchema, K extends TLiteral<string>>(schema: T, key: K, options?: SchemaOptions): TPick<T, K['const']>;
|
||||
/** `[Standard]` Creates a mapped type whose keys are picked from the given type */
|
||||
Pick<T extends TSchema, K extends TNever>(schema: T, key: K, options?: SchemaOptions): TPick<T, never>;
|
||||
/** `[Standard]` Creates a Record type */
|
||||
Record<K extends TUnion<TLiteral<string | number>[]>, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): RecordUnionLiteralType<K, T>;
|
||||
/** `[Standard]` Creates a Record type */
|
||||
Record<K extends TLiteral<string | number>, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): RecordLiteralType<K, T>;
|
||||
/** `[Standard]` Creates a Record type */
|
||||
Record<K extends TTemplateLiteral, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): RecordTemplateLiteralType<K, T>;
|
||||
/** `[Standard]` Creates a Record type */
|
||||
Record<K extends TInteger | TNumber, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): RecordNumberType<K, T>;
|
||||
/** `[Standard]` Creates a Record type */
|
||||
Record<K extends TString, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): RecordStringType<K, T>;
|
||||
/** `[Standard]` Creates a Recursive type */
|
||||
Recursive<T extends TSchema>(callback: (thisType: TThis) => T, options?: SchemaOptions): TRecursive<T>;
|
||||
/** `[Standard]` Creates a Ref type. The referenced type must contain a $id */
|
||||
Ref<T extends TSchema>(schema: T, options?: SchemaOptions): TRef<T>;
|
||||
/** `[Standard]` Creates a mapped type where all properties are Required */
|
||||
Required<T extends TSchema>(schema: T, options?: SchemaOptions): TRequired<T>;
|
||||
/** `[Standard]` Creates a String type */
|
||||
String<Format extends string>(options?: StringOptions<StringFormatOption | Format>): TString<Format>;
|
||||
/** `[Standard]` Creates a template literal type */
|
||||
TemplateLiteral<T extends TTemplateLiteralKind[]>(kinds: [...T], options?: SchemaOptions): TTemplateLiteral<T>;
|
||||
/** `[Standard]` Creates a Tuple type */
|
||||
Tuple<T extends TSchema[]>(items: [...T], options?: SchemaOptions): TTuple<T>;
|
||||
/** `[Standard]` Creates a Union type */
|
||||
Union(anyOf: [], options?: SchemaOptions): TNever;
|
||||
/** `[Standard]` Creates a Union type */
|
||||
Union<T extends [TSchema]>(anyOf: [...T], options?: SchemaOptions): T[0];
|
||||
/** `[Standard]` Creates a Union type */
|
||||
Union<T extends TSchema[]>(anyOf: [...T], options?: SchemaOptions): TUnion<T>;
|
||||
/** `[Experimental]` Remaps a TemplateLiteral into a Union representation. This function is known to cause TS compiler crashes for finite templates with large generation counts. Use with caution. */
|
||||
Union<T extends TTemplateLiteral>(template: T): TUnionTemplateLiteral<T>;
|
||||
/** `[Standard]` Creates an Unknown type */
|
||||
Unknown(options?: SchemaOptions): TUnknown;
|
||||
/** `[Standard]` Creates a Unsafe type that infers for the generic argument */
|
||||
Unsafe<T>(options?: UnsafeOptions): TUnsafe<T>;
|
||||
}
|
||||
export declare class ExtendedTypeBuilder extends StandardTypeBuilder {
|
||||
/** `[Extended]` Creates a BigInt type */
|
||||
BigInt(options?: NumericOptions<bigint>): TBigInt;
|
||||
/** `[Extended]` Extracts the ConstructorParameters from the given Constructor type */
|
||||
ConstructorParameters<T extends TConstructor<any[], any>>(schema: T, options?: SchemaOptions): TConstructorParameters<T>;
|
||||
/** `[Extended]` Creates a Constructor type */
|
||||
Constructor<T extends TTuple<TSchema[]>, U extends TSchema>(parameters: T, returns: U, options?: SchemaOptions): TConstructor<TTupleIntoArray<T>, U>;
|
||||
/** `[Extended]` Creates a Constructor type */
|
||||
Constructor<T extends TSchema[], U extends TSchema>(parameters: [...T], returns: U, options?: SchemaOptions): TConstructor<T, U>;
|
||||
/** `[Extended]` Creates a Date type */
|
||||
Date(options?: DateOptions): TDate;
|
||||
/** `[Extended]` Creates a Function type */
|
||||
Function<T extends TTuple<TSchema[]>, U extends TSchema>(parameters: T, returns: U, options?: SchemaOptions): TFunction<TTupleIntoArray<T>, U>;
|
||||
/** `[Extended]` Creates a Function type */
|
||||
Function<T extends TSchema[], U extends TSchema>(parameters: [...T], returns: U, options?: SchemaOptions): TFunction<T, U>;
|
||||
/** `[Extended]` Extracts the InstanceType from the given Constructor */
|
||||
InstanceType<T extends TConstructor<any[], any>>(schema: T, options?: SchemaOptions): TInstanceType<T>;
|
||||
/** `[Extended]` Extracts the Parameters from the given Function type */
|
||||
Parameters<T extends TFunction<any[], any>>(schema: T, options?: SchemaOptions): TParameters<T>;
|
||||
/** `[Extended]` Creates a Promise type */
|
||||
Promise<T extends TSchema>(item: T, options?: SchemaOptions): TPromise<T>;
|
||||
/** `[Extended]` Creates a regular expression type */
|
||||
RegEx(regex: RegExp, options?: SchemaOptions): TString;
|
||||
/** `[Extended]` Extracts the ReturnType from the given Function */
|
||||
ReturnType<T extends TFunction<any[], any>>(schema: T, options?: SchemaOptions): TReturnType<T>;
|
||||
/** `[Extended]` Creates a Symbol type */
|
||||
Symbol(options?: SchemaOptions): TSymbol;
|
||||
/** `[Extended]` Creates a Undefined type */
|
||||
Undefined(options?: SchemaOptions): TUndefined;
|
||||
/** `[Extended]` Creates a Uint8Array type */
|
||||
Uint8Array(options?: Uint8ArrayOptions): TUint8Array;
|
||||
/** `[Extended]` Creates a Void type */
|
||||
Void(options?: SchemaOptions): TVoid;
|
||||
}
|
||||
/** JSON Schema TypeBuilder with Static Resolution for TypeScript */
|
||||
export declare const StandardType: StandardTypeBuilder;
|
||||
/** JSON Schema TypeBuilder with Static Resolution for TypeScript */
|
||||
export declare const Type: ExtendedTypeBuilder;
|
||||
2220
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/typebox.js
generated
vendored
Normal file
2220
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/typebox.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
30
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/cast.d.ts
generated
vendored
Normal file
30
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/cast.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import * as Types from '../typebox';
|
||||
export declare class ValueCastReferenceTypeError extends Error {
|
||||
readonly schema: Types.TRef | Types.TThis;
|
||||
constructor(schema: Types.TRef | Types.TThis);
|
||||
}
|
||||
export declare class ValueCastArrayUniqueItemsTypeError extends Error {
|
||||
readonly schema: Types.TSchema;
|
||||
readonly value: unknown;
|
||||
constructor(schema: Types.TSchema, value: unknown);
|
||||
}
|
||||
export declare class ValueCastNeverTypeError extends Error {
|
||||
readonly schema: Types.TSchema;
|
||||
constructor(schema: Types.TSchema);
|
||||
}
|
||||
export declare class ValueCastRecursiveTypeError extends Error {
|
||||
readonly schema: Types.TSchema;
|
||||
constructor(schema: Types.TSchema);
|
||||
}
|
||||
export declare class ValueCastUnknownTypeError extends Error {
|
||||
readonly schema: Types.TSchema;
|
||||
constructor(schema: Types.TSchema);
|
||||
}
|
||||
export declare class ValueCastDereferenceError extends Error {
|
||||
readonly schema: Types.TRef | Types.TThis;
|
||||
constructor(schema: Types.TRef | Types.TThis);
|
||||
}
|
||||
export declare namespace ValueCast {
|
||||
function Visit(schema: Types.TSchema, references: Types.TSchema[], value: any): any;
|
||||
function Cast<T extends Types.TSchema>(schema: T, references: Types.TSchema[], value: any): Types.Static<T>;
|
||||
}
|
||||
372
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/cast.js
generated
vendored
Normal file
372
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/cast.js
generated
vendored
Normal file
|
|
@ -0,0 +1,372 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/value
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueCast = exports.ValueCastDereferenceError = exports.ValueCastUnknownTypeError = exports.ValueCastRecursiveTypeError = exports.ValueCastNeverTypeError = exports.ValueCastArrayUniqueItemsTypeError = exports.ValueCastReferenceTypeError = void 0;
|
||||
const Types = require("../typebox");
|
||||
const create_1 = require("./create");
|
||||
const check_1 = require("./check");
|
||||
const clone_1 = require("./clone");
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
// Errors
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
class ValueCastReferenceTypeError extends Error {
|
||||
constructor(schema) {
|
||||
super(`ValueCast: Cannot locate referenced schema with $id '${schema.$ref}'`);
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueCastReferenceTypeError = ValueCastReferenceTypeError;
|
||||
class ValueCastArrayUniqueItemsTypeError extends Error {
|
||||
constructor(schema, value) {
|
||||
super('ValueCast: Array cast produced invalid data due to uniqueItems constraint');
|
||||
this.schema = schema;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
exports.ValueCastArrayUniqueItemsTypeError = ValueCastArrayUniqueItemsTypeError;
|
||||
class ValueCastNeverTypeError extends Error {
|
||||
constructor(schema) {
|
||||
super('ValueCast: Never types cannot be cast');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueCastNeverTypeError = ValueCastNeverTypeError;
|
||||
class ValueCastRecursiveTypeError extends Error {
|
||||
constructor(schema) {
|
||||
super('ValueCast.Recursive: Cannot cast recursive schemas');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueCastRecursiveTypeError = ValueCastRecursiveTypeError;
|
||||
class ValueCastUnknownTypeError extends Error {
|
||||
constructor(schema) {
|
||||
super('ValueCast: Unknown type');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueCastUnknownTypeError = ValueCastUnknownTypeError;
|
||||
class ValueCastDereferenceError extends Error {
|
||||
constructor(schema) {
|
||||
super(`ValueCast: Unable to dereference schema with $id '${schema.$ref}'`);
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueCastDereferenceError = ValueCastDereferenceError;
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
// The following will score a schema against a value. For objects, the score is the tally of
|
||||
// points awarded for each property of the value. Property points are (1.0 / propertyCount)
|
||||
// to prevent large property counts biasing results. Properties that match literal values are
|
||||
// maximally awarded as literals are typically used as union discriminator fields.
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
var UnionCastCreate;
|
||||
(function (UnionCastCreate) {
|
||||
function Score(schema, references, value) {
|
||||
if (schema[Types.Kind] === 'Object' && typeof value === 'object' && value !== null) {
|
||||
const object = schema;
|
||||
const keys = Object.keys(value);
|
||||
const entries = globalThis.Object.entries(object.properties);
|
||||
const [point, max] = [1 / entries.length, entries.length];
|
||||
return entries.reduce((acc, [key, schema]) => {
|
||||
const literal = schema[Types.Kind] === 'Literal' && schema.const === value[key] ? max : 0;
|
||||
const checks = check_1.ValueCheck.Check(schema, references, value[key]) ? point : 0;
|
||||
const exists = keys.includes(key) ? point : 0;
|
||||
return acc + (literal + checks + exists);
|
||||
}, 0);
|
||||
}
|
||||
else {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
function Select(union, references, value) {
|
||||
let [select, best] = [union.anyOf[0], 0];
|
||||
for (const schema of union.anyOf) {
|
||||
const score = Score(schema, references, value);
|
||||
if (score > best) {
|
||||
select = schema;
|
||||
best = score;
|
||||
}
|
||||
}
|
||||
return select;
|
||||
}
|
||||
function Create(union, references, value) {
|
||||
if (union.default !== undefined) {
|
||||
return union.default;
|
||||
}
|
||||
else {
|
||||
const schema = Select(union, references, value);
|
||||
return ValueCast.Cast(schema, references, value);
|
||||
}
|
||||
}
|
||||
UnionCastCreate.Create = Create;
|
||||
})(UnionCastCreate || (UnionCastCreate = {}));
|
||||
var ValueCast;
|
||||
(function (ValueCast) {
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
// Guards
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
function IsObject(value) {
|
||||
return typeof value === 'object' && value !== null && !globalThis.Array.isArray(value);
|
||||
}
|
||||
function IsArray(value) {
|
||||
return typeof value === 'object' && globalThis.Array.isArray(value);
|
||||
}
|
||||
function IsNumber(value) {
|
||||
return typeof value === 'number' && !isNaN(value);
|
||||
}
|
||||
function IsString(value) {
|
||||
return typeof value === 'string';
|
||||
}
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
// Cast
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
function Any(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Array(schema, references, value) {
|
||||
if (check_1.ValueCheck.Check(schema, references, value))
|
||||
return clone_1.ValueClone.Clone(value);
|
||||
const created = IsArray(value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references);
|
||||
const minimum = IsNumber(schema.minItems) && created.length < schema.minItems ? [...created, ...globalThis.Array.from({ length: schema.minItems - created.length }, () => null)] : created;
|
||||
const maximum = IsNumber(schema.maxItems) && minimum.length > schema.maxItems ? minimum.slice(0, schema.maxItems) : minimum;
|
||||
const casted = maximum.map((value) => Visit(schema.items, references, value));
|
||||
if (schema.uniqueItems !== true)
|
||||
return casted;
|
||||
const unique = [...new Set(casted)];
|
||||
if (!check_1.ValueCheck.Check(schema, references, unique))
|
||||
throw new ValueCastArrayUniqueItemsTypeError(schema, unique);
|
||||
return unique;
|
||||
}
|
||||
function BigInt(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? value : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Boolean(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? value : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Constructor(schema, references, value) {
|
||||
if (check_1.ValueCheck.Check(schema, references, value))
|
||||
return create_1.ValueCreate.Create(schema, references);
|
||||
const required = new Set(schema.returns.required || []);
|
||||
const result = function () { };
|
||||
for (const [key, property] of globalThis.Object.entries(schema.returns.properties)) {
|
||||
if (!required.has(key) && value.prototype[key] === undefined)
|
||||
continue;
|
||||
result.prototype[key] = Visit(property, references, value.prototype[key]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function Date(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Function(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? value : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Integer(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? value : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Intersect(schema, references, value) {
|
||||
const created = create_1.ValueCreate.Create(schema, references);
|
||||
const mapped = IsObject(created) && IsObject(value) ? { ...created, ...value } : value;
|
||||
return check_1.ValueCheck.Check(schema, references, mapped) ? mapped : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Literal(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? value : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Never(schema, references, value) {
|
||||
throw new ValueCastNeverTypeError(schema);
|
||||
}
|
||||
function Not(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? value : create_1.ValueCreate.Create(schema.allOf[1], references);
|
||||
}
|
||||
function Null(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? value : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Number(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? value : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Object(schema, references, value) {
|
||||
if (check_1.ValueCheck.Check(schema, references, value))
|
||||
return value;
|
||||
if (value === null || typeof value !== 'object')
|
||||
return create_1.ValueCreate.Create(schema, references);
|
||||
const required = new Set(schema.required || []);
|
||||
const result = {};
|
||||
for (const [key, property] of globalThis.Object.entries(schema.properties)) {
|
||||
if (!required.has(key) && value[key] === undefined)
|
||||
continue;
|
||||
result[key] = Visit(property, references, value[key]);
|
||||
}
|
||||
// additional schema properties
|
||||
if (typeof schema.additionalProperties === 'object') {
|
||||
const propertyNames = globalThis.Object.getOwnPropertyNames(schema.properties);
|
||||
for (const propertyName of globalThis.Object.getOwnPropertyNames(value)) {
|
||||
if (propertyNames.includes(propertyName))
|
||||
continue;
|
||||
result[propertyName] = Visit(schema.additionalProperties, references, value[propertyName]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function Promise(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? value : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Record(schema, references, value) {
|
||||
if (check_1.ValueCheck.Check(schema, references, value))
|
||||
return clone_1.ValueClone.Clone(value);
|
||||
if (value === null || typeof value !== 'object' || globalThis.Array.isArray(value) || value instanceof globalThis.Date)
|
||||
return create_1.ValueCreate.Create(schema, references);
|
||||
const subschemaPropertyName = globalThis.Object.getOwnPropertyNames(schema.patternProperties)[0];
|
||||
const subschema = schema.patternProperties[subschemaPropertyName];
|
||||
const result = {};
|
||||
for (const [propKey, propValue] of globalThis.Object.entries(value)) {
|
||||
result[propKey] = Visit(subschema, references, propValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function Ref(schema, references, value) {
|
||||
const index = references.findIndex((foreign) => foreign.$id === schema.$ref);
|
||||
if (index === -1)
|
||||
throw new ValueCastDereferenceError(schema);
|
||||
const target = references[index];
|
||||
return Visit(target, references, value);
|
||||
}
|
||||
function String(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? value : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Symbol(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function TemplateLiteral(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function This(schema, references, value) {
|
||||
const index = references.findIndex((foreign) => foreign.$id === schema.$ref);
|
||||
if (index === -1)
|
||||
throw new ValueCastDereferenceError(schema);
|
||||
const target = references[index];
|
||||
return Visit(target, references, value);
|
||||
}
|
||||
function Tuple(schema, references, value) {
|
||||
if (check_1.ValueCheck.Check(schema, references, value))
|
||||
return clone_1.ValueClone.Clone(value);
|
||||
if (!globalThis.Array.isArray(value))
|
||||
return create_1.ValueCreate.Create(schema, references);
|
||||
if (schema.items === undefined)
|
||||
return [];
|
||||
return schema.items.map((schema, index) => Visit(schema, references, value[index]));
|
||||
}
|
||||
function Undefined(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Union(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : UnionCastCreate.Create(schema, references, value);
|
||||
}
|
||||
function Uint8Array(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Unknown(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Void(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function UserDefined(schema, references, value) {
|
||||
return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
function Visit(schema, references, value) {
|
||||
const references_ = IsString(schema.$id) ? [...references, schema] : references;
|
||||
const schema_ = schema;
|
||||
switch (schema[Types.Kind]) {
|
||||
case 'Any':
|
||||
return Any(schema_, references_, value);
|
||||
case 'Array':
|
||||
return Array(schema_, references_, value);
|
||||
case 'BigInt':
|
||||
return BigInt(schema_, references_, value);
|
||||
case 'Boolean':
|
||||
return Boolean(schema_, references_, value);
|
||||
case 'Constructor':
|
||||
return Constructor(schema_, references_, value);
|
||||
case 'Date':
|
||||
return Date(schema_, references_, value);
|
||||
case 'Function':
|
||||
return Function(schema_, references_, value);
|
||||
case 'Integer':
|
||||
return Integer(schema_, references_, value);
|
||||
case 'Intersect':
|
||||
return Intersect(schema_, references_, value);
|
||||
case 'Literal':
|
||||
return Literal(schema_, references_, value);
|
||||
case 'Never':
|
||||
return Never(schema_, references_, value);
|
||||
case 'Not':
|
||||
return Not(schema_, references_, value);
|
||||
case 'Null':
|
||||
return Null(schema_, references_, value);
|
||||
case 'Number':
|
||||
return Number(schema_, references_, value);
|
||||
case 'Object':
|
||||
return Object(schema_, references_, value);
|
||||
case 'Promise':
|
||||
return Promise(schema_, references_, value);
|
||||
case 'Record':
|
||||
return Record(schema_, references_, value);
|
||||
case 'Ref':
|
||||
return Ref(schema_, references_, value);
|
||||
case 'String':
|
||||
return String(schema_, references_, value);
|
||||
case 'Symbol':
|
||||
return Symbol(schema_, references_, value);
|
||||
case 'TemplateLiteral':
|
||||
return TemplateLiteral(schema_, references_, value);
|
||||
case 'This':
|
||||
return This(schema_, references_, value);
|
||||
case 'Tuple':
|
||||
return Tuple(schema_, references_, value);
|
||||
case 'Undefined':
|
||||
return Undefined(schema_, references_, value);
|
||||
case 'Union':
|
||||
return Union(schema_, references_, value);
|
||||
case 'Uint8Array':
|
||||
return Uint8Array(schema_, references_, value);
|
||||
case 'Unknown':
|
||||
return Unknown(schema_, references_, value);
|
||||
case 'Void':
|
||||
return Void(schema_, references_, value);
|
||||
default:
|
||||
if (!Types.TypeRegistry.Has(schema_[Types.Kind]))
|
||||
throw new ValueCastUnknownTypeError(schema_);
|
||||
return UserDefined(schema_, references_, value);
|
||||
}
|
||||
}
|
||||
ValueCast.Visit = Visit;
|
||||
function Cast(schema, references, value) {
|
||||
return Visit(schema, references, clone_1.ValueClone.Clone(value));
|
||||
}
|
||||
ValueCast.Cast = Cast;
|
||||
})(ValueCast = exports.ValueCast || (exports.ValueCast = {}));
|
||||
12
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/check.d.ts
generated
vendored
Normal file
12
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/check.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import * as Types from '../typebox';
|
||||
export declare class ValueCheckUnknownTypeError extends Error {
|
||||
readonly schema: Types.TSchema;
|
||||
constructor(schema: Types.TSchema);
|
||||
}
|
||||
export declare class ValueCheckDereferenceError extends Error {
|
||||
readonly schema: Types.TRef | Types.TThis;
|
||||
constructor(schema: Types.TRef | Types.TThis);
|
||||
}
|
||||
export declare namespace ValueCheck {
|
||||
function Check<T extends Types.TSchema>(schema: T, references: Types.TSchema[], value: any): boolean;
|
||||
}
|
||||
484
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/check.js
generated
vendored
Normal file
484
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/check.js
generated
vendored
Normal file
|
|
@ -0,0 +1,484 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/value
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueCheck = exports.ValueCheckDereferenceError = exports.ValueCheckUnknownTypeError = void 0;
|
||||
const Types = require("../typebox");
|
||||
const index_1 = require("../system/index");
|
||||
const hash_1 = require("./hash");
|
||||
// -------------------------------------------------------------------------
|
||||
// Errors
|
||||
// -------------------------------------------------------------------------
|
||||
class ValueCheckUnknownTypeError extends Error {
|
||||
constructor(schema) {
|
||||
super(`ValueCheck: ${schema[Types.Kind] ? `Unknown type '${schema[Types.Kind]}'` : 'Unknown type'}`);
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueCheckUnknownTypeError = ValueCheckUnknownTypeError;
|
||||
class ValueCheckDereferenceError extends Error {
|
||||
constructor(schema) {
|
||||
super(`ValueCheck: Unable to dereference schema with $id '${schema.$ref}'`);
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueCheckDereferenceError = ValueCheckDereferenceError;
|
||||
var ValueCheck;
|
||||
(function (ValueCheck) {
|
||||
// ----------------------------------------------------------------------
|
||||
// Guards
|
||||
// ----------------------------------------------------------------------
|
||||
function IsBigInt(value) {
|
||||
return typeof value === 'bigint';
|
||||
}
|
||||
function IsInteger(value) {
|
||||
return globalThis.Number.isInteger(value);
|
||||
}
|
||||
function IsString(value) {
|
||||
return typeof value === 'string';
|
||||
}
|
||||
function IsDefined(value) {
|
||||
return value !== undefined;
|
||||
}
|
||||
// ----------------------------------------------------------------------
|
||||
// Policies
|
||||
// ----------------------------------------------------------------------
|
||||
function IsExactOptionalProperty(value, key) {
|
||||
return index_1.TypeSystem.ExactOptionalPropertyTypes ? key in value : value[key] !== undefined;
|
||||
}
|
||||
function IsObject(value) {
|
||||
const result = typeof value === 'object' && value !== null;
|
||||
return index_1.TypeSystem.AllowArrayObjects ? result : result && !globalThis.Array.isArray(value);
|
||||
}
|
||||
function IsRecordObject(value) {
|
||||
return IsObject(value) && !(value instanceof globalThis.Date) && !(value instanceof globalThis.Uint8Array);
|
||||
}
|
||||
function IsNumber(value) {
|
||||
const result = typeof value === 'number';
|
||||
return index_1.TypeSystem.AllowNaN ? result : result && globalThis.Number.isFinite(value);
|
||||
}
|
||||
function IsVoid(value) {
|
||||
const result = value === undefined;
|
||||
return index_1.TypeSystem.AllowVoidNull ? result || value === null : result;
|
||||
}
|
||||
// ----------------------------------------------------------------------
|
||||
// Types
|
||||
// ----------------------------------------------------------------------
|
||||
function Any(schema, references, value) {
|
||||
return true;
|
||||
}
|
||||
function Array(schema, references, value) {
|
||||
if (!globalThis.Array.isArray(value)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.minItems) && !(value.length >= schema.minItems)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.maxItems) && !(value.length <= schema.maxItems)) {
|
||||
return false;
|
||||
}
|
||||
// prettier-ignore
|
||||
if (schema.uniqueItems === true && !((function () { const set = new Set(); for (const element of value) {
|
||||
const hashed = hash_1.ValueHash.Create(element);
|
||||
if (set.has(hashed)) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
set.add(hashed);
|
||||
}
|
||||
} return true; })())) {
|
||||
return false;
|
||||
}
|
||||
return value.every((value) => Visit(schema.items, references, value));
|
||||
}
|
||||
function BigInt(schema, references, value) {
|
||||
if (!IsBigInt(value)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === globalThis.BigInt(0))) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function Boolean(schema, references, value) {
|
||||
return typeof value === 'boolean';
|
||||
}
|
||||
function Constructor(schema, references, value) {
|
||||
return Visit(schema.returns, references, value.prototype);
|
||||
}
|
||||
function Date(schema, references, value) {
|
||||
if (!(value instanceof globalThis.Date)) {
|
||||
return false;
|
||||
}
|
||||
if (!IsNumber(value.getTime())) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function Function(schema, references, value) {
|
||||
return typeof value === 'function';
|
||||
}
|
||||
function Integer(schema, references, value) {
|
||||
if (!IsInteger(value)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function Intersect(schema, references, value) {
|
||||
if (!schema.allOf.every((schema) => Visit(schema, references, value))) {
|
||||
return false;
|
||||
}
|
||||
else if (schema.unevaluatedProperties === false) {
|
||||
const schemaKeys = Types.KeyResolver.Resolve(schema);
|
||||
const valueKeys = globalThis.Object.getOwnPropertyNames(value);
|
||||
return valueKeys.every((key) => schemaKeys.includes(key));
|
||||
}
|
||||
else if (Types.TypeGuard.TSchema(schema.unevaluatedProperties)) {
|
||||
const schemaKeys = Types.KeyResolver.Resolve(schema);
|
||||
const valueKeys = globalThis.Object.getOwnPropertyNames(value);
|
||||
return valueKeys.every((key) => schemaKeys.includes(key) || Visit(schema.unevaluatedProperties, references, value[key]));
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function Literal(schema, references, value) {
|
||||
return value === schema.const;
|
||||
}
|
||||
function Never(schema, references, value) {
|
||||
return false;
|
||||
}
|
||||
function Not(schema, references, value) {
|
||||
return !Visit(schema.allOf[0].not, references, value) && Visit(schema.allOf[1], references, value);
|
||||
}
|
||||
function Null(schema, references, value) {
|
||||
return value === null;
|
||||
}
|
||||
function Number(schema, references, value) {
|
||||
if (!IsNumber(value)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function Object(schema, references, value) {
|
||||
if (!IsObject(value)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.minProperties) && !(globalThis.Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.maxProperties) && !(globalThis.Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
||||
return false;
|
||||
}
|
||||
const knownKeys = globalThis.Object.getOwnPropertyNames(schema.properties);
|
||||
for (const knownKey of knownKeys) {
|
||||
const property = schema.properties[knownKey];
|
||||
if (schema.required && schema.required.includes(knownKey)) {
|
||||
if (!Visit(property, references, value[knownKey])) {
|
||||
return false;
|
||||
}
|
||||
if (Types.ExtendsUndefined.Check(property)) {
|
||||
return knownKey in value;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (IsExactOptionalProperty(value, knownKey) && !Visit(property, references, value[knownKey])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (schema.additionalProperties === false) {
|
||||
const valueKeys = globalThis.Object.getOwnPropertyNames(value);
|
||||
// optimization: value is valid if schemaKey length matches the valueKey length
|
||||
if (schema.required && schema.required.length === knownKeys.length && valueKeys.length === knownKeys.length) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return valueKeys.every((valueKey) => knownKeys.includes(valueKey));
|
||||
}
|
||||
}
|
||||
else if (typeof schema.additionalProperties === 'object') {
|
||||
const valueKeys = globalThis.Object.getOwnPropertyNames(value);
|
||||
return valueKeys.every((key) => knownKeys.includes(key) || Visit(schema.additionalProperties, references, value[key]));
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function Promise(schema, references, value) {
|
||||
return typeof value === 'object' && typeof value.then === 'function';
|
||||
}
|
||||
function Record(schema, references, value) {
|
||||
if (!IsRecordObject(value)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.minProperties) && !(globalThis.Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.maxProperties) && !(globalThis.Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
||||
return false;
|
||||
}
|
||||
const [keyPattern, valueSchema] = globalThis.Object.entries(schema.patternProperties)[0];
|
||||
const regex = new RegExp(keyPattern);
|
||||
if (!globalThis.Object.getOwnPropertyNames(value).every((key) => regex.test(key))) {
|
||||
return false;
|
||||
}
|
||||
for (const propValue of globalThis.Object.values(value)) {
|
||||
if (!Visit(valueSchema, references, propValue))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function Ref(schema, references, value) {
|
||||
const index = references.findIndex((foreign) => foreign.$id === schema.$ref);
|
||||
if (index === -1)
|
||||
throw new ValueCheckDereferenceError(schema);
|
||||
const target = references[index];
|
||||
return Visit(target, references, value);
|
||||
}
|
||||
function String(schema, references, value) {
|
||||
if (!IsString(value)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.minLength)) {
|
||||
if (!(value.length >= schema.minLength))
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.maxLength)) {
|
||||
if (!(value.length <= schema.maxLength))
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.pattern)) {
|
||||
const regex = new RegExp(schema.pattern);
|
||||
if (!regex.test(value))
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.format)) {
|
||||
if (!Types.FormatRegistry.Has(schema.format))
|
||||
return false;
|
||||
const func = Types.FormatRegistry.Get(schema.format);
|
||||
return func(value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function Symbol(schema, references, value) {
|
||||
if (!(typeof value === 'symbol')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function TemplateLiteral(schema, references, value) {
|
||||
if (!IsString(value)) {
|
||||
return false;
|
||||
}
|
||||
return new RegExp(schema.pattern).test(value);
|
||||
}
|
||||
function This(schema, references, value) {
|
||||
const index = references.findIndex((foreign) => foreign.$id === schema.$ref);
|
||||
if (index === -1)
|
||||
throw new ValueCheckDereferenceError(schema);
|
||||
const target = references[index];
|
||||
return Visit(target, references, value);
|
||||
}
|
||||
function Tuple(schema, references, value) {
|
||||
if (!globalThis.Array.isArray(value)) {
|
||||
return false;
|
||||
}
|
||||
if (schema.items === undefined && !(value.length === 0)) {
|
||||
return false;
|
||||
}
|
||||
if (!(value.length === schema.maxItems)) {
|
||||
return false;
|
||||
}
|
||||
if (!schema.items) {
|
||||
return true;
|
||||
}
|
||||
for (let i = 0; i < schema.items.length; i++) {
|
||||
if (!Visit(schema.items[i], references, value[i]))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function Undefined(schema, references, value) {
|
||||
return value === undefined;
|
||||
}
|
||||
function Union(schema, references, value) {
|
||||
return schema.anyOf.some((inner) => Visit(inner, references, value));
|
||||
}
|
||||
function Uint8Array(schema, references, value) {
|
||||
if (!(value instanceof globalThis.Uint8Array)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) {
|
||||
return false;
|
||||
}
|
||||
if (IsDefined(schema.minByteLength) && !(value.length >= schema.minByteLength)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function Unknown(schema, references, value) {
|
||||
return true;
|
||||
}
|
||||
function Void(schema, references, value) {
|
||||
return IsVoid(value);
|
||||
}
|
||||
function UserDefined(schema, references, value) {
|
||||
if (!Types.TypeRegistry.Has(schema[Types.Kind]))
|
||||
return false;
|
||||
const func = Types.TypeRegistry.Get(schema[Types.Kind]);
|
||||
return func(schema, value);
|
||||
}
|
||||
function Visit(schema, references, value) {
|
||||
const references_ = IsDefined(schema.$id) ? [...references, schema] : references;
|
||||
const schema_ = schema;
|
||||
switch (schema_[Types.Kind]) {
|
||||
case 'Any':
|
||||
return Any(schema_, references_, value);
|
||||
case 'Array':
|
||||
return Array(schema_, references_, value);
|
||||
case 'BigInt':
|
||||
return BigInt(schema_, references_, value);
|
||||
case 'Boolean':
|
||||
return Boolean(schema_, references_, value);
|
||||
case 'Constructor':
|
||||
return Constructor(schema_, references_, value);
|
||||
case 'Date':
|
||||
return Date(schema_, references_, value);
|
||||
case 'Function':
|
||||
return Function(schema_, references_, value);
|
||||
case 'Integer':
|
||||
return Integer(schema_, references_, value);
|
||||
case 'Intersect':
|
||||
return Intersect(schema_, references_, value);
|
||||
case 'Literal':
|
||||
return Literal(schema_, references_, value);
|
||||
case 'Never':
|
||||
return Never(schema_, references_, value);
|
||||
case 'Not':
|
||||
return Not(schema_, references_, value);
|
||||
case 'Null':
|
||||
return Null(schema_, references_, value);
|
||||
case 'Number':
|
||||
return Number(schema_, references_, value);
|
||||
case 'Object':
|
||||
return Object(schema_, references_, value);
|
||||
case 'Promise':
|
||||
return Promise(schema_, references_, value);
|
||||
case 'Record':
|
||||
return Record(schema_, references_, value);
|
||||
case 'Ref':
|
||||
return Ref(schema_, references_, value);
|
||||
case 'String':
|
||||
return String(schema_, references_, value);
|
||||
case 'Symbol':
|
||||
return Symbol(schema_, references_, value);
|
||||
case 'TemplateLiteral':
|
||||
return TemplateLiteral(schema_, references_, value);
|
||||
case 'This':
|
||||
return This(schema_, references_, value);
|
||||
case 'Tuple':
|
||||
return Tuple(schema_, references_, value);
|
||||
case 'Undefined':
|
||||
return Undefined(schema_, references_, value);
|
||||
case 'Union':
|
||||
return Union(schema_, references_, value);
|
||||
case 'Uint8Array':
|
||||
return Uint8Array(schema_, references_, value);
|
||||
case 'Unknown':
|
||||
return Unknown(schema_, references_, value);
|
||||
case 'Void':
|
||||
return Void(schema_, references_, value);
|
||||
default:
|
||||
if (!Types.TypeRegistry.Has(schema_[Types.Kind]))
|
||||
throw new ValueCheckUnknownTypeError(schema_);
|
||||
return UserDefined(schema_, references_, value);
|
||||
}
|
||||
}
|
||||
// -------------------------------------------------------------------------
|
||||
// Check
|
||||
// -------------------------------------------------------------------------
|
||||
function Check(schema, references, value) {
|
||||
return Visit(schema, references, value);
|
||||
}
|
||||
ValueCheck.Check = Check;
|
||||
})(ValueCheck = exports.ValueCheck || (exports.ValueCheck = {}));
|
||||
3
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/clone.d.ts
generated
vendored
Normal file
3
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/clone.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export declare namespace ValueClone {
|
||||
function Clone<T extends unknown>(value: T): T;
|
||||
}
|
||||
71
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/clone.js
generated
vendored
Normal file
71
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/clone.js
generated
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/value
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueClone = void 0;
|
||||
const is_1 = require("./is");
|
||||
var ValueClone;
|
||||
(function (ValueClone) {
|
||||
function Array(value) {
|
||||
return value.map((element) => Clone(element));
|
||||
}
|
||||
function Date(value) {
|
||||
return new globalThis.Date(value.toISOString());
|
||||
}
|
||||
function Object(value) {
|
||||
const keys = [...globalThis.Object.keys(value), ...globalThis.Object.getOwnPropertySymbols(value)];
|
||||
return keys.reduce((acc, key) => ({ ...acc, [key]: Clone(value[key]) }), {});
|
||||
}
|
||||
function TypedArray(value) {
|
||||
return value.slice();
|
||||
}
|
||||
function Value(value) {
|
||||
return value;
|
||||
}
|
||||
function Clone(value) {
|
||||
if (is_1.Is.Date(value)) {
|
||||
return Date(value);
|
||||
}
|
||||
else if (is_1.Is.Object(value)) {
|
||||
return Object(value);
|
||||
}
|
||||
else if (is_1.Is.Array(value)) {
|
||||
return Array(value);
|
||||
}
|
||||
else if (is_1.Is.TypedArray(value)) {
|
||||
return TypedArray(value);
|
||||
}
|
||||
else if (is_1.Is.Value(value)) {
|
||||
return Value(value);
|
||||
}
|
||||
else {
|
||||
throw new Error('ValueClone: Unable to clone value');
|
||||
}
|
||||
}
|
||||
ValueClone.Clone = Clone;
|
||||
})(ValueClone = exports.ValueClone || (exports.ValueClone = {}));
|
||||
13
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/convert.d.ts
generated
vendored
Normal file
13
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/convert.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import * as Types from '../typebox';
|
||||
export declare class ValueConvertUnknownTypeError extends Error {
|
||||
readonly schema: Types.TSchema;
|
||||
constructor(schema: Types.TSchema);
|
||||
}
|
||||
export declare class ValueConvertDereferenceError extends Error {
|
||||
readonly schema: Types.TRef | Types.TThis;
|
||||
constructor(schema: Types.TRef | Types.TThis);
|
||||
}
|
||||
export declare namespace ValueConvert {
|
||||
function Visit(schema: Types.TSchema, references: Types.TSchema[], value: any): unknown;
|
||||
function Convert<T extends Types.TSchema>(schema: T, references: Types.TSchema[], value: any): unknown;
|
||||
}
|
||||
372
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/convert.js
generated
vendored
Normal file
372
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/convert.js
generated
vendored
Normal file
|
|
@ -0,0 +1,372 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/value
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueConvert = exports.ValueConvertDereferenceError = exports.ValueConvertUnknownTypeError = void 0;
|
||||
const Types = require("../typebox");
|
||||
const clone_1 = require("./clone");
|
||||
const check_1 = require("./check");
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
// Errors
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
class ValueConvertUnknownTypeError extends Error {
|
||||
constructor(schema) {
|
||||
super('ValueConvert: Unknown type');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueConvertUnknownTypeError = ValueConvertUnknownTypeError;
|
||||
class ValueConvertDereferenceError extends Error {
|
||||
constructor(schema) {
|
||||
super(`ValueConvert: Unable to dereference schema with $id '${schema.$ref}'`);
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueConvertDereferenceError = ValueConvertDereferenceError;
|
||||
var ValueConvert;
|
||||
(function (ValueConvert) {
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
// Guards
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
function IsObject(value) {
|
||||
return typeof value === 'object' && value !== null && !globalThis.Array.isArray(value);
|
||||
}
|
||||
function IsArray(value) {
|
||||
return typeof value === 'object' && globalThis.Array.isArray(value);
|
||||
}
|
||||
function IsDate(value) {
|
||||
return typeof value === 'object' && value instanceof globalThis.Date;
|
||||
}
|
||||
function IsSymbol(value) {
|
||||
return typeof value === 'symbol';
|
||||
}
|
||||
function IsString(value) {
|
||||
return typeof value === 'string';
|
||||
}
|
||||
function IsBoolean(value) {
|
||||
return typeof value === 'boolean';
|
||||
}
|
||||
function IsBigInt(value) {
|
||||
return typeof value === 'bigint';
|
||||
}
|
||||
function IsNumber(value) {
|
||||
return typeof value === 'number' && !isNaN(value);
|
||||
}
|
||||
function IsStringNumeric(value) {
|
||||
return IsString(value) && !isNaN(value) && !isNaN(parseFloat(value));
|
||||
}
|
||||
function IsValueToString(value) {
|
||||
return IsBigInt(value) || IsBoolean(value) || IsNumber(value);
|
||||
}
|
||||
function IsValueTrue(value) {
|
||||
return value === true || (IsNumber(value) && value === 1) || (IsBigInt(value) && value === globalThis.BigInt('1')) || (IsString(value) && (value.toLowerCase() === 'true' || value === '1'));
|
||||
}
|
||||
function IsValueFalse(value) {
|
||||
return value === false || (IsNumber(value) && value === 0) || (IsBigInt(value) && value === globalThis.BigInt('0')) || (IsString(value) && (value.toLowerCase() === 'false' || value === '0'));
|
||||
}
|
||||
function IsTimeStringWithTimeZone(value) {
|
||||
return IsString(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value);
|
||||
}
|
||||
function IsTimeStringWithoutTimeZone(value) {
|
||||
return IsString(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value);
|
||||
}
|
||||
function IsDateTimeStringWithTimeZone(value) {
|
||||
return IsString(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value);
|
||||
}
|
||||
function IsDateTimeStringWithoutTimeZone(value) {
|
||||
return IsString(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value);
|
||||
}
|
||||
function IsDateString(value) {
|
||||
return IsString(value) && /^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(value);
|
||||
}
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
// Convert
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
function TryConvertLiteralString(value, target) {
|
||||
const conversion = TryConvertString(value);
|
||||
return conversion === target ? conversion : value;
|
||||
}
|
||||
function TryConvertLiteralNumber(value, target) {
|
||||
const conversion = TryConvertNumber(value);
|
||||
return conversion === target ? conversion : value;
|
||||
}
|
||||
function TryConvertLiteralBoolean(value, target) {
|
||||
const conversion = TryConvertBoolean(value);
|
||||
return conversion === target ? conversion : value;
|
||||
}
|
||||
function TryConvertLiteral(schema, value) {
|
||||
if (typeof schema.const === 'string') {
|
||||
return TryConvertLiteralString(value, schema.const);
|
||||
}
|
||||
else if (typeof schema.const === 'number') {
|
||||
return TryConvertLiteralNumber(value, schema.const);
|
||||
}
|
||||
else if (typeof schema.const === 'boolean') {
|
||||
return TryConvertLiteralBoolean(value, schema.const);
|
||||
}
|
||||
else {
|
||||
return clone_1.ValueClone.Clone(value);
|
||||
}
|
||||
}
|
||||
function TryConvertBoolean(value) {
|
||||
return IsValueTrue(value) ? true : IsValueFalse(value) ? false : value;
|
||||
}
|
||||
function TryConvertBigInt(value) {
|
||||
return IsStringNumeric(value) ? globalThis.BigInt(parseInt(value)) : IsNumber(value) ? globalThis.BigInt(value | 0) : IsValueFalse(value) ? 0 : IsValueTrue(value) ? 1 : value;
|
||||
}
|
||||
function TryConvertString(value) {
|
||||
return IsValueToString(value) ? value.toString() : value;
|
||||
}
|
||||
function TryConvertNumber(value) {
|
||||
return IsStringNumeric(value) ? parseFloat(value) : IsValueTrue(value) ? 1 : IsValueFalse(value) ? 0 : value;
|
||||
}
|
||||
function TryConvertInteger(value) {
|
||||
return IsStringNumeric(value) ? parseInt(value) : IsNumber(value) ? value | 0 : IsValueTrue(value) ? 1 : IsValueFalse(value) ? 0 : value;
|
||||
}
|
||||
function TryConvertNull(value) {
|
||||
return IsString(value) && value.toLowerCase() === 'null' ? null : value;
|
||||
}
|
||||
function TryConvertUndefined(value) {
|
||||
return IsString(value) && value === 'undefined' ? undefined : value;
|
||||
}
|
||||
function TryConvertDate(value) {
|
||||
// note: this function may return an invalid dates for the regex tests
|
||||
// above. Invalid dates will however be checked during the casting
|
||||
// function and will return a epoch date if invalid. Consider better
|
||||
// string parsing for the iso dates in future revisions.
|
||||
return IsDate(value)
|
||||
? value
|
||||
: IsNumber(value)
|
||||
? new globalThis.Date(value)
|
||||
: IsValueTrue(value)
|
||||
? new globalThis.Date(1)
|
||||
: IsValueFalse(value)
|
||||
? new globalThis.Date(0)
|
||||
: IsStringNumeric(value)
|
||||
? new globalThis.Date(parseInt(value))
|
||||
: IsTimeStringWithoutTimeZone(value)
|
||||
? new globalThis.Date(`1970-01-01T${value}.000Z`)
|
||||
: IsTimeStringWithTimeZone(value)
|
||||
? new globalThis.Date(`1970-01-01T${value}`)
|
||||
: IsDateTimeStringWithoutTimeZone(value)
|
||||
? new globalThis.Date(`${value}.000Z`)
|
||||
: IsDateTimeStringWithTimeZone(value)
|
||||
? new globalThis.Date(value)
|
||||
: IsDateString(value)
|
||||
? new globalThis.Date(`${value}T00:00:00.000Z`)
|
||||
: value;
|
||||
}
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
// Cast
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
function Any(schema, references, value) {
|
||||
return value;
|
||||
}
|
||||
function Array(schema, references, value) {
|
||||
if (IsArray(value)) {
|
||||
return value.map((value) => Visit(schema.items, references, value));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function BigInt(schema, references, value) {
|
||||
return TryConvertBigInt(value);
|
||||
}
|
||||
function Boolean(schema, references, value) {
|
||||
return TryConvertBoolean(value);
|
||||
}
|
||||
function Constructor(schema, references, value) {
|
||||
return clone_1.ValueClone.Clone(value);
|
||||
}
|
||||
function Date(schema, references, value) {
|
||||
return TryConvertDate(value);
|
||||
}
|
||||
function Function(schema, references, value) {
|
||||
return value;
|
||||
}
|
||||
function Integer(schema, references, value) {
|
||||
return TryConvertInteger(value);
|
||||
}
|
||||
function Intersect(schema, references, value) {
|
||||
return value;
|
||||
}
|
||||
function Literal(schema, references, value) {
|
||||
return TryConvertLiteral(schema, value);
|
||||
}
|
||||
function Never(schema, references, value) {
|
||||
return value;
|
||||
}
|
||||
function Null(schema, references, value) {
|
||||
return TryConvertNull(value);
|
||||
}
|
||||
function Number(schema, references, value) {
|
||||
return TryConvertNumber(value);
|
||||
}
|
||||
function Object(schema, references, value) {
|
||||
if (IsObject(value))
|
||||
return globalThis.Object.keys(schema.properties).reduce((acc, key) => {
|
||||
return value[key] !== undefined ? { ...acc, [key]: Visit(schema.properties[key], references, value[key]) } : { ...acc };
|
||||
}, value);
|
||||
return value;
|
||||
}
|
||||
function Promise(schema, references, value) {
|
||||
return value;
|
||||
}
|
||||
function Record(schema, references, value) {
|
||||
const propertyKey = globalThis.Object.getOwnPropertyNames(schema.patternProperties)[0];
|
||||
const property = schema.patternProperties[propertyKey];
|
||||
const result = {};
|
||||
for (const [propKey, propValue] of globalThis.Object.entries(value)) {
|
||||
result[propKey] = Visit(property, references, propValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function Ref(schema, references, value) {
|
||||
const index = references.findIndex((foreign) => foreign.$id === schema.$ref);
|
||||
if (index === -1)
|
||||
throw new ValueConvertDereferenceError(schema);
|
||||
const target = references[index];
|
||||
return Visit(target, references, value);
|
||||
}
|
||||
function String(schema, references, value) {
|
||||
return TryConvertString(value);
|
||||
}
|
||||
function Symbol(schema, references, value) {
|
||||
return value;
|
||||
}
|
||||
function TemplateLiteral(schema, references, value) {
|
||||
return value;
|
||||
}
|
||||
function This(schema, references, value) {
|
||||
const index = references.findIndex((foreign) => foreign.$id === schema.$ref);
|
||||
if (index === -1)
|
||||
throw new ValueConvertDereferenceError(schema);
|
||||
const target = references[index];
|
||||
return Visit(target, references, value);
|
||||
}
|
||||
function Tuple(schema, references, value) {
|
||||
if (IsArray(value) && schema.items !== undefined) {
|
||||
return value.map((value, index) => {
|
||||
return index < schema.items.length ? Visit(schema.items[index], references, value) : value;
|
||||
});
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function Undefined(schema, references, value) {
|
||||
return TryConvertUndefined(value);
|
||||
}
|
||||
function Union(schema, references, value) {
|
||||
for (const subschema of schema.anyOf) {
|
||||
const converted = Visit(subschema, references, value);
|
||||
if (check_1.ValueCheck.Check(subschema, references, converted)) {
|
||||
return converted;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function Uint8Array(schema, references, value) {
|
||||
return value;
|
||||
}
|
||||
function Unknown(schema, references, value) {
|
||||
return value;
|
||||
}
|
||||
function Void(schema, references, value) {
|
||||
return value;
|
||||
}
|
||||
function UserDefined(schema, references, value) {
|
||||
return value;
|
||||
}
|
||||
function Visit(schema, references, value) {
|
||||
const references_ = IsString(schema.$id) ? [...references, schema] : references;
|
||||
const schema_ = schema;
|
||||
switch (schema[Types.Kind]) {
|
||||
case 'Any':
|
||||
return Any(schema_, references_, value);
|
||||
case 'Array':
|
||||
return Array(schema_, references_, value);
|
||||
case 'BigInt':
|
||||
return BigInt(schema_, references_, value);
|
||||
case 'Boolean':
|
||||
return Boolean(schema_, references_, value);
|
||||
case 'Constructor':
|
||||
return Constructor(schema_, references_, value);
|
||||
case 'Date':
|
||||
return Date(schema_, references_, value);
|
||||
case 'Function':
|
||||
return Function(schema_, references_, value);
|
||||
case 'Integer':
|
||||
return Integer(schema_, references_, value);
|
||||
case 'Intersect':
|
||||
return Intersect(schema_, references_, value);
|
||||
case 'Literal':
|
||||
return Literal(schema_, references_, value);
|
||||
case 'Never':
|
||||
return Never(schema_, references_, value);
|
||||
case 'Null':
|
||||
return Null(schema_, references_, value);
|
||||
case 'Number':
|
||||
return Number(schema_, references_, value);
|
||||
case 'Object':
|
||||
return Object(schema_, references_, value);
|
||||
case 'Promise':
|
||||
return Promise(schema_, references_, value);
|
||||
case 'Record':
|
||||
return Record(schema_, references_, value);
|
||||
case 'Ref':
|
||||
return Ref(schema_, references_, value);
|
||||
case 'String':
|
||||
return String(schema_, references_, value);
|
||||
case 'Symbol':
|
||||
return Symbol(schema_, references_, value);
|
||||
case 'TemplateLiteral':
|
||||
return TemplateLiteral(schema_, references_, value);
|
||||
case 'This':
|
||||
return This(schema_, references_, value);
|
||||
case 'Tuple':
|
||||
return Tuple(schema_, references_, value);
|
||||
case 'Undefined':
|
||||
return Undefined(schema_, references_, value);
|
||||
case 'Union':
|
||||
return Union(schema_, references_, value);
|
||||
case 'Uint8Array':
|
||||
return Uint8Array(schema_, references_, value);
|
||||
case 'Unknown':
|
||||
return Unknown(schema_, references_, value);
|
||||
case 'Void':
|
||||
return Void(schema_, references_, value);
|
||||
default:
|
||||
if (!Types.TypeRegistry.Has(schema_[Types.Kind]))
|
||||
throw new ValueConvertUnknownTypeError(schema_);
|
||||
return UserDefined(schema_, references_, value);
|
||||
}
|
||||
}
|
||||
ValueConvert.Visit = Visit;
|
||||
function Convert(schema, references, value) {
|
||||
return Visit(schema, references, clone_1.ValueClone.Clone(value));
|
||||
}
|
||||
ValueConvert.Convert = Convert;
|
||||
})(ValueConvert = exports.ValueConvert || (exports.ValueConvert = {}));
|
||||
26
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/create.d.ts
generated
vendored
Normal file
26
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/create.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import * as Types from '../typebox';
|
||||
export declare class ValueCreateUnknownTypeError extends Error {
|
||||
readonly schema: Types.TSchema;
|
||||
constructor(schema: Types.TSchema);
|
||||
}
|
||||
export declare class ValueCreateNeverTypeError extends Error {
|
||||
readonly schema: Types.TSchema;
|
||||
constructor(schema: Types.TSchema);
|
||||
}
|
||||
export declare class ValueCreateIntersectTypeError extends Error {
|
||||
readonly schema: Types.TSchema;
|
||||
constructor(schema: Types.TSchema);
|
||||
}
|
||||
export declare class ValueCreateTempateLiteralTypeError extends Error {
|
||||
readonly schema: Types.TSchema;
|
||||
constructor(schema: Types.TSchema);
|
||||
}
|
||||
export declare class ValueCreateDereferenceError extends Error {
|
||||
readonly schema: Types.TRef | Types.TThis;
|
||||
constructor(schema: Types.TRef | Types.TThis);
|
||||
}
|
||||
export declare namespace ValueCreate {
|
||||
/** Creates a value from the given schema. If the schema specifies a default value, then that value is returned. */
|
||||
function Visit(schema: Types.TSchema, references: Types.TSchema[]): unknown;
|
||||
function Create<T extends Types.TSchema>(schema: T, references: Types.TSchema[]): Types.Static<T>;
|
||||
}
|
||||
480
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/create.js
generated
vendored
Normal file
480
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/create.js
generated
vendored
Normal file
|
|
@ -0,0 +1,480 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/value
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueCreate = exports.ValueCreateDereferenceError = exports.ValueCreateTempateLiteralTypeError = exports.ValueCreateIntersectTypeError = exports.ValueCreateNeverTypeError = exports.ValueCreateUnknownTypeError = void 0;
|
||||
const Types = require("../typebox");
|
||||
const check_1 = require("./check");
|
||||
// --------------------------------------------------------------------------
|
||||
// Errors
|
||||
// --------------------------------------------------------------------------
|
||||
class ValueCreateUnknownTypeError extends Error {
|
||||
constructor(schema) {
|
||||
super('ValueCreate: Unknown type');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueCreateUnknownTypeError = ValueCreateUnknownTypeError;
|
||||
class ValueCreateNeverTypeError extends Error {
|
||||
constructor(schema) {
|
||||
super('ValueCreate: Never types cannot be created');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueCreateNeverTypeError = ValueCreateNeverTypeError;
|
||||
class ValueCreateIntersectTypeError extends Error {
|
||||
constructor(schema) {
|
||||
super('ValueCreate: Intersect produced invalid value. Consider using a default value.');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueCreateIntersectTypeError = ValueCreateIntersectTypeError;
|
||||
class ValueCreateTempateLiteralTypeError extends Error {
|
||||
constructor(schema) {
|
||||
super('ValueCreate: Can only create template literal values from patterns that produce finite sequences. Consider using a default value.');
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueCreateTempateLiteralTypeError = ValueCreateTempateLiteralTypeError;
|
||||
class ValueCreateDereferenceError extends Error {
|
||||
constructor(schema) {
|
||||
super(`ValueCreate: Unable to dereference schema with $id '${schema.$ref}'`);
|
||||
this.schema = schema;
|
||||
}
|
||||
}
|
||||
exports.ValueCreateDereferenceError = ValueCreateDereferenceError;
|
||||
// --------------------------------------------------------------------------
|
||||
// ValueCreate
|
||||
// --------------------------------------------------------------------------
|
||||
var ValueCreate;
|
||||
(function (ValueCreate) {
|
||||
// --------------------------------------------------------
|
||||
// Guards
|
||||
// --------------------------------------------------------
|
||||
function IsString(value) {
|
||||
return typeof value === 'string';
|
||||
}
|
||||
// --------------------------------------------------------
|
||||
// Types
|
||||
// --------------------------------------------------------
|
||||
function Any(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
function Array(schema, references) {
|
||||
if (schema.uniqueItems === true && schema.default === undefined) {
|
||||
throw new Error('ValueCreate.Array: Arrays with uniqueItems require a default value');
|
||||
}
|
||||
else if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else if (schema.minItems !== undefined) {
|
||||
return globalThis.Array.from({ length: schema.minItems }).map((item) => {
|
||||
return ValueCreate.Create(schema.items, references);
|
||||
});
|
||||
}
|
||||
else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
function BigInt(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
return globalThis.BigInt(0);
|
||||
}
|
||||
}
|
||||
function Boolean(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function Constructor(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
const value = ValueCreate.Create(schema.returns, references);
|
||||
if (typeof value === 'object' && !globalThis.Array.isArray(value)) {
|
||||
return class {
|
||||
constructor() {
|
||||
for (const [key, val] of globalThis.Object.entries(value)) {
|
||||
const self = this;
|
||||
self[key] = val;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
else {
|
||||
return class {
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
function Date(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else if (schema.minimumTimestamp !== undefined) {
|
||||
return new globalThis.Date(schema.minimumTimestamp);
|
||||
}
|
||||
else {
|
||||
return new globalThis.Date(0);
|
||||
}
|
||||
}
|
||||
function Function(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
return () => ValueCreate.Create(schema.returns, references);
|
||||
}
|
||||
}
|
||||
function Integer(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else if (schema.minimum !== undefined) {
|
||||
return schema.minimum;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
function Intersect(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
// Note: The best we can do here is attempt to instance each sub type and apply through object assign. For non-object
|
||||
// sub types, we just escape the assignment and just return the value. In the latter case, this is typically going to
|
||||
// be a consequence of an illogical intersection.
|
||||
const value = schema.allOf.reduce((acc, schema) => {
|
||||
const next = Visit(schema, references);
|
||||
return typeof next === 'object' ? { ...acc, ...next } : next;
|
||||
}, {});
|
||||
if (!check_1.ValueCheck.Check(schema, references, value))
|
||||
throw new ValueCreateIntersectTypeError(schema);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
function Literal(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
return schema.const;
|
||||
}
|
||||
}
|
||||
function Never(schema, references) {
|
||||
throw new ValueCreateNeverTypeError(schema);
|
||||
}
|
||||
function Not(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
return Visit(schema.allOf[1], references);
|
||||
}
|
||||
}
|
||||
function Null(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function Number(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else if (schema.minimum !== undefined) {
|
||||
return schema.minimum;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
function Object(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
const required = new Set(schema.required);
|
||||
return (schema.default ||
|
||||
globalThis.Object.entries(schema.properties).reduce((acc, [key, schema]) => {
|
||||
return required.has(key) ? { ...acc, [key]: ValueCreate.Create(schema, references) } : { ...acc };
|
||||
}, {}));
|
||||
}
|
||||
}
|
||||
function Promise(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
return globalThis.Promise.resolve(ValueCreate.Create(schema.item, references));
|
||||
}
|
||||
}
|
||||
function Record(schema, references) {
|
||||
const [keyPattern, valueSchema] = globalThis.Object.entries(schema.patternProperties)[0];
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else if (!(keyPattern === Types.PatternStringExact || keyPattern === Types.PatternNumberExact)) {
|
||||
const propertyKeys = keyPattern.slice(1, keyPattern.length - 1).split('|');
|
||||
return propertyKeys.reduce((acc, key) => {
|
||||
return { ...acc, [key]: Create(valueSchema, references) };
|
||||
}, {});
|
||||
}
|
||||
else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
function Ref(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
const index = references.findIndex((foreign) => foreign.$id === schema.$id);
|
||||
if (index === -1)
|
||||
throw new ValueCreateDereferenceError(schema);
|
||||
const target = references[index];
|
||||
return Visit(target, references);
|
||||
}
|
||||
}
|
||||
function String(schema, references) {
|
||||
if (schema.pattern !== undefined) {
|
||||
if (!('default' in schema)) {
|
||||
throw new Error('ValueCreate.String: String types with patterns must specify a default value');
|
||||
}
|
||||
else {
|
||||
return schema.default;
|
||||
}
|
||||
}
|
||||
else if (schema.format !== undefined) {
|
||||
if (!('default' in schema)) {
|
||||
throw new Error('ValueCreate.String: String types with formats must specify a default value');
|
||||
}
|
||||
else {
|
||||
return schema.default;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else if (schema.minLength !== undefined) {
|
||||
return globalThis.Array.from({ length: schema.minLength })
|
||||
.map(() => '.')
|
||||
.join('');
|
||||
}
|
||||
else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
function Symbol(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else if ('value' in schema) {
|
||||
return globalThis.Symbol.for(schema.value);
|
||||
}
|
||||
else {
|
||||
return globalThis.Symbol();
|
||||
}
|
||||
}
|
||||
function TemplateLiteral(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
const expression = Types.TemplateLiteralParser.ParseExact(schema.pattern);
|
||||
if (!Types.TemplateLiteralFinite.Check(expression))
|
||||
throw new ValueCreateTempateLiteralTypeError(schema);
|
||||
const sequence = Types.TemplateLiteralGenerator.Generate(expression);
|
||||
return sequence.next().value;
|
||||
}
|
||||
function This(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
const index = references.findIndex((foreign) => foreign.$id === schema.$id);
|
||||
if (index === -1)
|
||||
throw new ValueCreateDereferenceError(schema);
|
||||
const target = references[index];
|
||||
return Visit(target, references);
|
||||
}
|
||||
}
|
||||
function Tuple(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
if (schema.items === undefined) {
|
||||
return [];
|
||||
}
|
||||
else {
|
||||
return globalThis.Array.from({ length: schema.minItems }).map((_, index) => ValueCreate.Create(schema.items[index], references));
|
||||
}
|
||||
}
|
||||
function Undefined(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function Union(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else if (schema.anyOf.length === 0) {
|
||||
throw new Error('ValueCreate.Union: Cannot create Union with zero variants');
|
||||
}
|
||||
else {
|
||||
return ValueCreate.Create(schema.anyOf[0], references);
|
||||
}
|
||||
}
|
||||
function Uint8Array(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else if (schema.minByteLength !== undefined) {
|
||||
return new globalThis.Uint8Array(schema.minByteLength);
|
||||
}
|
||||
else {
|
||||
return new globalThis.Uint8Array(0);
|
||||
}
|
||||
}
|
||||
function Unknown(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
function Void(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
return void 0;
|
||||
}
|
||||
}
|
||||
function UserDefined(schema, references) {
|
||||
if ('default' in schema) {
|
||||
return schema.default;
|
||||
}
|
||||
else {
|
||||
throw new Error('ValueCreate.UserDefined: User defined types must specify a default value');
|
||||
}
|
||||
}
|
||||
/** Creates a value from the given schema. If the schema specifies a default value, then that value is returned. */
|
||||
function Visit(schema, references) {
|
||||
const references_ = IsString(schema.$id) ? [...references, schema] : references;
|
||||
const schema_ = schema;
|
||||
switch (schema_[Types.Kind]) {
|
||||
case 'Any':
|
||||
return Any(schema_, references_);
|
||||
case 'Array':
|
||||
return Array(schema_, references_);
|
||||
case 'BigInt':
|
||||
return BigInt(schema_, references_);
|
||||
case 'Boolean':
|
||||
return Boolean(schema_, references_);
|
||||
case 'Constructor':
|
||||
return Constructor(schema_, references_);
|
||||
case 'Date':
|
||||
return Date(schema_, references_);
|
||||
case 'Function':
|
||||
return Function(schema_, references_);
|
||||
case 'Integer':
|
||||
return Integer(schema_, references_);
|
||||
case 'Intersect':
|
||||
return Intersect(schema_, references_);
|
||||
case 'Literal':
|
||||
return Literal(schema_, references_);
|
||||
case 'Never':
|
||||
return Never(schema_, references_);
|
||||
case 'Not':
|
||||
return Not(schema_, references_);
|
||||
case 'Null':
|
||||
return Null(schema_, references_);
|
||||
case 'Number':
|
||||
return Number(schema_, references_);
|
||||
case 'Object':
|
||||
return Object(schema_, references_);
|
||||
case 'Promise':
|
||||
return Promise(schema_, references_);
|
||||
case 'Record':
|
||||
return Record(schema_, references_);
|
||||
case 'Ref':
|
||||
return Ref(schema_, references_);
|
||||
case 'String':
|
||||
return String(schema_, references_);
|
||||
case 'Symbol':
|
||||
return Symbol(schema_, references_);
|
||||
case 'TemplateLiteral':
|
||||
return TemplateLiteral(schema_, references_);
|
||||
case 'This':
|
||||
return This(schema_, references_);
|
||||
case 'Tuple':
|
||||
return Tuple(schema_, references_);
|
||||
case 'Undefined':
|
||||
return Undefined(schema_, references_);
|
||||
case 'Union':
|
||||
return Union(schema_, references_);
|
||||
case 'Uint8Array':
|
||||
return Uint8Array(schema_, references_);
|
||||
case 'Unknown':
|
||||
return Unknown(schema_, references_);
|
||||
case 'Void':
|
||||
return Void(schema_, references_);
|
||||
default:
|
||||
if (!Types.TypeRegistry.Has(schema_[Types.Kind]))
|
||||
throw new ValueCreateUnknownTypeError(schema_);
|
||||
return UserDefined(schema_, references_);
|
||||
}
|
||||
}
|
||||
ValueCreate.Visit = Visit;
|
||||
function Create(schema, references) {
|
||||
return Visit(schema, references);
|
||||
}
|
||||
ValueCreate.Create = Create;
|
||||
})(ValueCreate = exports.ValueCreate || (exports.ValueCreate = {}));
|
||||
43
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/delta.d.ts
generated
vendored
Normal file
43
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/delta.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import { Static } from '../typebox';
|
||||
export type Insert = Static<typeof Insert>;
|
||||
export declare const Insert: import("../typebox").TObject<{
|
||||
type: import("../typebox").TLiteral<"insert">;
|
||||
path: import("../typebox").TString<string>;
|
||||
value: import("../typebox").TUnknown;
|
||||
}>;
|
||||
export type Update = Static<typeof Update>;
|
||||
export declare const Update: import("../typebox").TObject<{
|
||||
type: import("../typebox").TLiteral<"update">;
|
||||
path: import("../typebox").TString<string>;
|
||||
value: import("../typebox").TUnknown;
|
||||
}>;
|
||||
export type Delete = Static<typeof Delete>;
|
||||
export declare const Delete: import("../typebox").TObject<{
|
||||
type: import("../typebox").TLiteral<"delete">;
|
||||
path: import("../typebox").TString<string>;
|
||||
}>;
|
||||
export type Edit = Static<typeof Edit>;
|
||||
export declare const Edit: import("../typebox").TUnion<[import("../typebox").TObject<{
|
||||
type: import("../typebox").TLiteral<"insert">;
|
||||
path: import("../typebox").TString<string>;
|
||||
value: import("../typebox").TUnknown;
|
||||
}>, import("../typebox").TObject<{
|
||||
type: import("../typebox").TLiteral<"update">;
|
||||
path: import("../typebox").TString<string>;
|
||||
value: import("../typebox").TUnknown;
|
||||
}>, import("../typebox").TObject<{
|
||||
type: import("../typebox").TLiteral<"delete">;
|
||||
path: import("../typebox").TString<string>;
|
||||
}>]>;
|
||||
export declare class ValueDeltaObjectWithSymbolKeyError extends Error {
|
||||
readonly key: unknown;
|
||||
constructor(key: unknown);
|
||||
}
|
||||
export declare class ValueDeltaUnableToDiffUnknownValue extends Error {
|
||||
readonly value: unknown;
|
||||
constructor(value: unknown);
|
||||
}
|
||||
export declare namespace ValueDelta {
|
||||
function Diff(current: unknown, next: unknown): Edit[];
|
||||
function Patch<T = any>(current: unknown, edits: Edit[]): T;
|
||||
}
|
||||
204
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/delta.js
generated
vendored
Normal file
204
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/delta.js
generated
vendored
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/value
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueDelta = exports.ValueDeltaUnableToDiffUnknownValue = exports.ValueDeltaObjectWithSymbolKeyError = exports.Edit = exports.Delete = exports.Update = exports.Insert = void 0;
|
||||
const typebox_1 = require("../typebox");
|
||||
const is_1 = require("./is");
|
||||
const clone_1 = require("./clone");
|
||||
const pointer_1 = require("./pointer");
|
||||
exports.Insert = typebox_1.Type.Object({
|
||||
type: typebox_1.Type.Literal('insert'),
|
||||
path: typebox_1.Type.String(),
|
||||
value: typebox_1.Type.Unknown(),
|
||||
});
|
||||
exports.Update = typebox_1.Type.Object({
|
||||
type: typebox_1.Type.Literal('update'),
|
||||
path: typebox_1.Type.String(),
|
||||
value: typebox_1.Type.Unknown(),
|
||||
});
|
||||
exports.Delete = typebox_1.Type.Object({
|
||||
type: typebox_1.Type.Literal('delete'),
|
||||
path: typebox_1.Type.String(),
|
||||
});
|
||||
exports.Edit = typebox_1.Type.Union([exports.Insert, exports.Update, exports.Delete]);
|
||||
// ---------------------------------------------------------------------
|
||||
// Errors
|
||||
// ---------------------------------------------------------------------
|
||||
class ValueDeltaObjectWithSymbolKeyError extends Error {
|
||||
constructor(key) {
|
||||
super('ValueDelta: Cannot diff objects with symbol keys');
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
exports.ValueDeltaObjectWithSymbolKeyError = ValueDeltaObjectWithSymbolKeyError;
|
||||
class ValueDeltaUnableToDiffUnknownValue extends Error {
|
||||
constructor(value) {
|
||||
super('ValueDelta: Unable to create diff edits for unknown value');
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
exports.ValueDeltaUnableToDiffUnknownValue = ValueDeltaUnableToDiffUnknownValue;
|
||||
// ---------------------------------------------------------------------
|
||||
// ValueDelta
|
||||
// ---------------------------------------------------------------------
|
||||
var ValueDelta;
|
||||
(function (ValueDelta) {
|
||||
// ---------------------------------------------------------------------
|
||||
// Edits
|
||||
// ---------------------------------------------------------------------
|
||||
function Update(path, value) {
|
||||
return { type: 'update', path, value };
|
||||
}
|
||||
function Insert(path, value) {
|
||||
return { type: 'insert', path, value };
|
||||
}
|
||||
function Delete(path) {
|
||||
return { type: 'delete', path };
|
||||
}
|
||||
// ---------------------------------------------------------------------
|
||||
// Diff
|
||||
// ---------------------------------------------------------------------
|
||||
function* Object(path, current, next) {
|
||||
if (!is_1.Is.Object(next))
|
||||
return yield Update(path, next);
|
||||
const currentKeys = [...globalThis.Object.keys(current), ...globalThis.Object.getOwnPropertySymbols(current)];
|
||||
const nextKeys = [...globalThis.Object.keys(next), ...globalThis.Object.getOwnPropertySymbols(next)];
|
||||
for (const key of currentKeys) {
|
||||
if (typeof key === 'symbol')
|
||||
throw new ValueDeltaObjectWithSymbolKeyError(key);
|
||||
if (next[key] === undefined && nextKeys.includes(key))
|
||||
yield Update(`${path}/${String(key)}`, undefined);
|
||||
}
|
||||
for (const key of nextKeys) {
|
||||
if (current[key] === undefined || next[key] === undefined)
|
||||
continue;
|
||||
if (typeof key === 'symbol')
|
||||
throw new ValueDeltaObjectWithSymbolKeyError(key);
|
||||
yield* Visit(`${path}/${String(key)}`, current[key], next[key]);
|
||||
}
|
||||
for (const key of nextKeys) {
|
||||
if (typeof key === 'symbol')
|
||||
throw new ValueDeltaObjectWithSymbolKeyError(key);
|
||||
if (current[key] === undefined)
|
||||
yield Insert(`${path}/${String(key)}`, next[key]);
|
||||
}
|
||||
for (const key of currentKeys.reverse()) {
|
||||
if (typeof key === 'symbol')
|
||||
throw new ValueDeltaObjectWithSymbolKeyError(key);
|
||||
if (next[key] === undefined && !nextKeys.includes(key))
|
||||
yield Delete(`${path}/${String(key)}`);
|
||||
}
|
||||
}
|
||||
function* Array(path, current, next) {
|
||||
if (!is_1.Is.Array(next))
|
||||
return yield Update(path, next);
|
||||
for (let i = 0; i < Math.min(current.length, next.length); i++) {
|
||||
yield* Visit(`${path}/${i}`, current[i], next[i]);
|
||||
}
|
||||
for (let i = 0; i < next.length; i++) {
|
||||
if (i < current.length)
|
||||
continue;
|
||||
yield Insert(`${path}/${i}`, next[i]);
|
||||
}
|
||||
for (let i = current.length - 1; i >= 0; i--) {
|
||||
if (i < next.length)
|
||||
continue;
|
||||
yield Delete(`${path}/${i}`);
|
||||
}
|
||||
}
|
||||
function* TypedArray(path, current, next) {
|
||||
if (!is_1.Is.TypedArray(next) || current.length !== next.length || globalThis.Object.getPrototypeOf(current).constructor.name !== globalThis.Object.getPrototypeOf(next).constructor.name)
|
||||
return yield Update(path, next);
|
||||
for (let i = 0; i < Math.min(current.length, next.length); i++) {
|
||||
yield* Visit(`${path}/${i}`, current[i], next[i]);
|
||||
}
|
||||
}
|
||||
function* Value(path, current, next) {
|
||||
if (current === next)
|
||||
return;
|
||||
yield Update(path, next);
|
||||
}
|
||||
function* Visit(path, current, next) {
|
||||
if (is_1.Is.Object(current)) {
|
||||
return yield* Object(path, current, next);
|
||||
}
|
||||
else if (is_1.Is.Array(current)) {
|
||||
return yield* Array(path, current, next);
|
||||
}
|
||||
else if (is_1.Is.TypedArray(current)) {
|
||||
return yield* TypedArray(path, current, next);
|
||||
}
|
||||
else if (is_1.Is.Value(current)) {
|
||||
return yield* Value(path, current, next);
|
||||
}
|
||||
else {
|
||||
throw new ValueDeltaUnableToDiffUnknownValue(current);
|
||||
}
|
||||
}
|
||||
function Diff(current, next) {
|
||||
return [...Visit('', current, next)];
|
||||
}
|
||||
ValueDelta.Diff = Diff;
|
||||
// ---------------------------------------------------------------------
|
||||
// Patch
|
||||
// ---------------------------------------------------------------------
|
||||
function IsRootUpdate(edits) {
|
||||
return edits.length > 0 && edits[0].path === '' && edits[0].type === 'update';
|
||||
}
|
||||
function IsIdentity(edits) {
|
||||
return edits.length === 0;
|
||||
}
|
||||
function Patch(current, edits) {
|
||||
if (IsRootUpdate(edits)) {
|
||||
return clone_1.ValueClone.Clone(edits[0].value);
|
||||
}
|
||||
if (IsIdentity(edits)) {
|
||||
return clone_1.ValueClone.Clone(current);
|
||||
}
|
||||
const clone = clone_1.ValueClone.Clone(current);
|
||||
for (const edit of edits) {
|
||||
switch (edit.type) {
|
||||
case 'insert': {
|
||||
pointer_1.ValuePointer.Set(clone, edit.path, edit.value);
|
||||
break;
|
||||
}
|
||||
case 'update': {
|
||||
pointer_1.ValuePointer.Set(clone, edit.path, edit.value);
|
||||
break;
|
||||
}
|
||||
case 'delete': {
|
||||
pointer_1.ValuePointer.Delete(clone, edit.path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
ValueDelta.Patch = Patch;
|
||||
})(ValueDelta = exports.ValueDelta || (exports.ValueDelta = {}));
|
||||
3
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/equal.d.ts
generated
vendored
Normal file
3
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/equal.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export declare namespace ValueEqual {
|
||||
function Equal<T>(left: T, right: unknown): right is T;
|
||||
}
|
||||
80
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/equal.js
generated
vendored
Normal file
80
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/equal.js
generated
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/value
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueEqual = void 0;
|
||||
const is_1 = require("./is");
|
||||
var ValueEqual;
|
||||
(function (ValueEqual) {
|
||||
function Object(left, right) {
|
||||
if (!is_1.Is.Object(right))
|
||||
return false;
|
||||
const leftKeys = [...globalThis.Object.keys(left), ...globalThis.Object.getOwnPropertySymbols(left)];
|
||||
const rightKeys = [...globalThis.Object.keys(right), ...globalThis.Object.getOwnPropertySymbols(right)];
|
||||
if (leftKeys.length !== rightKeys.length)
|
||||
return false;
|
||||
return leftKeys.every((key) => Equal(left[key], right[key]));
|
||||
}
|
||||
function Date(left, right) {
|
||||
return is_1.Is.Date(right) && left.getTime() === right.getTime();
|
||||
}
|
||||
function Array(left, right) {
|
||||
if (!is_1.Is.Array(right) || left.length !== right.length)
|
||||
return false;
|
||||
return left.every((value, index) => Equal(value, right[index]));
|
||||
}
|
||||
function TypedArray(left, right) {
|
||||
if (!is_1.Is.TypedArray(right) || left.length !== right.length || globalThis.Object.getPrototypeOf(left).constructor.name !== globalThis.Object.getPrototypeOf(right).constructor.name)
|
||||
return false;
|
||||
return left.every((value, index) => Equal(value, right[index]));
|
||||
}
|
||||
function Value(left, right) {
|
||||
return left === right;
|
||||
}
|
||||
function Equal(left, right) {
|
||||
if (is_1.Is.Object(left)) {
|
||||
return Object(left, right);
|
||||
}
|
||||
else if (is_1.Is.Date(left)) {
|
||||
return Date(left, right);
|
||||
}
|
||||
else if (is_1.Is.TypedArray(left)) {
|
||||
return TypedArray(left, right);
|
||||
}
|
||||
else if (is_1.Is.Array(left)) {
|
||||
return Array(left, right);
|
||||
}
|
||||
else if (is_1.Is.Value(left)) {
|
||||
return Value(left, right);
|
||||
}
|
||||
else {
|
||||
throw new Error('ValueEquals: Unable to compare value');
|
||||
}
|
||||
}
|
||||
ValueEqual.Equal = Equal;
|
||||
})(ValueEqual = exports.ValueEqual || (exports.ValueEqual = {}));
|
||||
8
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/hash.d.ts
generated
vendored
Normal file
8
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/hash.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
export declare class ValueHashError extends Error {
|
||||
readonly value: unknown;
|
||||
constructor(value: unknown);
|
||||
}
|
||||
export declare namespace ValueHash {
|
||||
/** Creates a FNV1A-64 non cryptographic hash of the given value */
|
||||
function Create(value: unknown): bigint;
|
||||
}
|
||||
208
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/hash.js
generated
vendored
Normal file
208
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/hash.js
generated
vendored
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/hash
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueHash = exports.ValueHashError = void 0;
|
||||
class ValueHashError extends Error {
|
||||
constructor(value) {
|
||||
super(`Hash: Unable to hash value`);
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
exports.ValueHashError = ValueHashError;
|
||||
var ValueHash;
|
||||
(function (ValueHash) {
|
||||
let ByteMarker;
|
||||
(function (ByteMarker) {
|
||||
ByteMarker[ByteMarker["Undefined"] = 0] = "Undefined";
|
||||
ByteMarker[ByteMarker["Null"] = 1] = "Null";
|
||||
ByteMarker[ByteMarker["Boolean"] = 2] = "Boolean";
|
||||
ByteMarker[ByteMarker["Number"] = 3] = "Number";
|
||||
ByteMarker[ByteMarker["String"] = 4] = "String";
|
||||
ByteMarker[ByteMarker["Object"] = 5] = "Object";
|
||||
ByteMarker[ByteMarker["Array"] = 6] = "Array";
|
||||
ByteMarker[ByteMarker["Date"] = 7] = "Date";
|
||||
ByteMarker[ByteMarker["Uint8Array"] = 8] = "Uint8Array";
|
||||
ByteMarker[ByteMarker["Symbol"] = 9] = "Symbol";
|
||||
ByteMarker[ByteMarker["BigInt"] = 10] = "BigInt";
|
||||
})(ByteMarker || (ByteMarker = {}));
|
||||
// ----------------------------------------------------
|
||||
// State
|
||||
// ----------------------------------------------------
|
||||
let Hash = globalThis.BigInt('14695981039346656037');
|
||||
const [Prime, Size] = [globalThis.BigInt('1099511628211'), globalThis.BigInt('2') ** globalThis.BigInt('64')];
|
||||
const Bytes = globalThis.Array.from({ length: 256 }).map((_, i) => globalThis.BigInt(i));
|
||||
const F64 = new globalThis.Float64Array(1);
|
||||
const F64In = new globalThis.DataView(F64.buffer);
|
||||
const F64Out = new globalThis.Uint8Array(F64.buffer);
|
||||
// ----------------------------------------------------
|
||||
// Guards
|
||||
// ----------------------------------------------------
|
||||
function IsDate(value) {
|
||||
return value instanceof globalThis.Date;
|
||||
}
|
||||
function IsUint8Array(value) {
|
||||
return value instanceof globalThis.Uint8Array;
|
||||
}
|
||||
function IsArray(value) {
|
||||
return globalThis.Array.isArray(value);
|
||||
}
|
||||
function IsBoolean(value) {
|
||||
return typeof value === 'boolean';
|
||||
}
|
||||
function IsNull(value) {
|
||||
return value === null;
|
||||
}
|
||||
function IsNumber(value) {
|
||||
return typeof value === 'number';
|
||||
}
|
||||
function IsSymbol(value) {
|
||||
return typeof value === 'symbol';
|
||||
}
|
||||
function IsBigInt(value) {
|
||||
return typeof value === 'bigint';
|
||||
}
|
||||
function IsObject(value) {
|
||||
return typeof value === 'object' && value !== null && !IsArray(value) && !IsDate(value) && !IsUint8Array(value);
|
||||
}
|
||||
function IsString(value) {
|
||||
return typeof value === 'string';
|
||||
}
|
||||
function IsUndefined(value) {
|
||||
return value === undefined;
|
||||
}
|
||||
// ----------------------------------------------------
|
||||
// Encoding
|
||||
// ----------------------------------------------------
|
||||
function Array(value) {
|
||||
FNV1A64(ByteMarker.Array);
|
||||
for (const item of value) {
|
||||
Visit(item);
|
||||
}
|
||||
}
|
||||
function Boolean(value) {
|
||||
FNV1A64(ByteMarker.Boolean);
|
||||
FNV1A64(value ? 1 : 0);
|
||||
}
|
||||
function BigInt(value) {
|
||||
FNV1A64(ByteMarker.BigInt);
|
||||
F64In.setBigInt64(0, value);
|
||||
for (const byte of F64Out) {
|
||||
FNV1A64(byte);
|
||||
}
|
||||
}
|
||||
function Date(value) {
|
||||
FNV1A64(ByteMarker.Date);
|
||||
Visit(value.getTime());
|
||||
}
|
||||
function Null(value) {
|
||||
FNV1A64(ByteMarker.Null);
|
||||
}
|
||||
function Number(value) {
|
||||
FNV1A64(ByteMarker.Number);
|
||||
F64In.setFloat64(0, value);
|
||||
for (const byte of F64Out) {
|
||||
FNV1A64(byte);
|
||||
}
|
||||
}
|
||||
function Object(value) {
|
||||
FNV1A64(ByteMarker.Object);
|
||||
for (const key of globalThis.Object.keys(value).sort()) {
|
||||
Visit(key);
|
||||
Visit(value[key]);
|
||||
}
|
||||
}
|
||||
function String(value) {
|
||||
FNV1A64(ByteMarker.String);
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
FNV1A64(value.charCodeAt(i));
|
||||
}
|
||||
}
|
||||
function Symbol(value) {
|
||||
FNV1A64(ByteMarker.Symbol);
|
||||
Visit(value.description);
|
||||
}
|
||||
function Uint8Array(value) {
|
||||
FNV1A64(ByteMarker.Uint8Array);
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
FNV1A64(value[i]);
|
||||
}
|
||||
}
|
||||
function Undefined(value) {
|
||||
return FNV1A64(ByteMarker.Undefined);
|
||||
}
|
||||
function Visit(value) {
|
||||
if (IsArray(value)) {
|
||||
Array(value);
|
||||
}
|
||||
else if (IsBoolean(value)) {
|
||||
Boolean(value);
|
||||
}
|
||||
else if (IsBigInt(value)) {
|
||||
BigInt(value);
|
||||
}
|
||||
else if (IsDate(value)) {
|
||||
Date(value);
|
||||
}
|
||||
else if (IsNull(value)) {
|
||||
Null(value);
|
||||
}
|
||||
else if (IsNumber(value)) {
|
||||
Number(value);
|
||||
}
|
||||
else if (IsObject(value)) {
|
||||
Object(value);
|
||||
}
|
||||
else if (IsString(value)) {
|
||||
String(value);
|
||||
}
|
||||
else if (IsSymbol(value)) {
|
||||
Symbol(value);
|
||||
}
|
||||
else if (IsUint8Array(value)) {
|
||||
Uint8Array(value);
|
||||
}
|
||||
else if (IsUndefined(value)) {
|
||||
Undefined(value);
|
||||
}
|
||||
else {
|
||||
throw new ValueHashError(value);
|
||||
}
|
||||
}
|
||||
function FNV1A64(byte) {
|
||||
Hash = Hash ^ Bytes[byte];
|
||||
Hash = (Hash * Prime) % Size;
|
||||
}
|
||||
/** Creates a FNV1A-64 non cryptographic hash of the given value */
|
||||
function Create(value) {
|
||||
Hash = globalThis.BigInt('14695981039346656037');
|
||||
Visit(value);
|
||||
return Hash;
|
||||
}
|
||||
ValueHash.Create = Create;
|
||||
})(ValueHash = exports.ValueHash || (exports.ValueHash = {}));
|
||||
6
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/index.d.ts
generated
vendored
Normal file
6
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export { ValueError, ValueErrorIterator, ValueErrorType } from '../errors/index';
|
||||
export { ValueHash } from './hash';
|
||||
export { Edit, Insert, Update, Delete } from './delta';
|
||||
export { Mutable } from './mutate';
|
||||
export * from './pointer';
|
||||
export * from './value';
|
||||
56
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/index.js
generated
vendored
Normal file
56
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/value
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Delete = exports.Update = exports.Insert = exports.Edit = exports.ValueHash = exports.ValueErrorType = exports.ValueErrorIterator = void 0;
|
||||
var index_1 = require("../errors/index");
|
||||
Object.defineProperty(exports, "ValueErrorIterator", { enumerable: true, get: function () { return index_1.ValueErrorIterator; } });
|
||||
Object.defineProperty(exports, "ValueErrorType", { enumerable: true, get: function () { return index_1.ValueErrorType; } });
|
||||
var hash_1 = require("./hash");
|
||||
Object.defineProperty(exports, "ValueHash", { enumerable: true, get: function () { return hash_1.ValueHash; } });
|
||||
var delta_1 = require("./delta");
|
||||
Object.defineProperty(exports, "Edit", { enumerable: true, get: function () { return delta_1.Edit; } });
|
||||
Object.defineProperty(exports, "Insert", { enumerable: true, get: function () { return delta_1.Insert; } });
|
||||
Object.defineProperty(exports, "Update", { enumerable: true, get: function () { return delta_1.Update; } });
|
||||
Object.defineProperty(exports, "Delete", { enumerable: true, get: function () { return delta_1.Delete; } });
|
||||
__exportStar(require("./pointer"), exports);
|
||||
__exportStar(require("./value"), exports);
|
||||
11
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/is.d.ts
generated
vendored
Normal file
11
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/is.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export type ValueType = null | undefined | Function | symbol | bigint | number | boolean | string;
|
||||
export type ObjectType = Record<string | number | symbol, unknown>;
|
||||
export type TypedArrayType = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
|
||||
export type ArrayType = unknown[];
|
||||
export declare namespace Is {
|
||||
function Object(value: unknown): value is ObjectType;
|
||||
function Date(value: unknown): value is Date;
|
||||
function Array(value: unknown): value is ArrayType;
|
||||
function Value(value: unknown): value is ValueType;
|
||||
function TypedArray(value: unknown): value is TypedArrayType;
|
||||
}
|
||||
53
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/is.js
generated
vendored
Normal file
53
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/is.js
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/value
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Is = void 0;
|
||||
var Is;
|
||||
(function (Is) {
|
||||
function Object(value) {
|
||||
return value !== null && typeof value === 'object' && !globalThis.Array.isArray(value) && !ArrayBuffer.isView(value) && !(value instanceof globalThis.Date);
|
||||
}
|
||||
Is.Object = Object;
|
||||
function Date(value) {
|
||||
return value instanceof globalThis.Date;
|
||||
}
|
||||
Is.Date = Date;
|
||||
function Array(value) {
|
||||
return globalThis.Array.isArray(value) && !ArrayBuffer.isView(value);
|
||||
}
|
||||
Is.Array = Array;
|
||||
function Value(value) {
|
||||
return value === null || value === undefined || typeof value === 'function' || typeof value === 'symbol' || typeof value === 'bigint' || typeof value === 'number' || typeof value === 'boolean' || typeof value === 'string';
|
||||
}
|
||||
Is.Value = Value;
|
||||
function TypedArray(value) {
|
||||
return ArrayBuffer.isView(value);
|
||||
}
|
||||
Is.TypedArray = TypedArray;
|
||||
})(Is = exports.Is || (exports.Is = {}));
|
||||
13
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/mutate.d.ts
generated
vendored
Normal file
13
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/mutate.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
export declare class ValueMutateTypeMismatchError extends Error {
|
||||
constructor();
|
||||
}
|
||||
export declare class ValueMutateInvalidRootMutationError extends Error {
|
||||
constructor();
|
||||
}
|
||||
export type Mutable = {
|
||||
[key: string]: unknown;
|
||||
} | unknown[];
|
||||
export declare namespace ValueMutate {
|
||||
/** Performs a deep mutable value assignment while retaining internal references. */
|
||||
function Mutate(current: Mutable, next: Mutable): void;
|
||||
}
|
||||
121
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/mutate.js
generated
vendored
Normal file
121
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/mutate.js
generated
vendored
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/value
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueMutate = exports.ValueMutateInvalidRootMutationError = exports.ValueMutateTypeMismatchError = void 0;
|
||||
const is_1 = require("./is");
|
||||
const pointer_1 = require("./pointer");
|
||||
const clone_1 = require("./clone");
|
||||
class ValueMutateTypeMismatchError extends Error {
|
||||
constructor() {
|
||||
super('ValueMutate: Cannot assign due type mismatch of assignable values');
|
||||
}
|
||||
}
|
||||
exports.ValueMutateTypeMismatchError = ValueMutateTypeMismatchError;
|
||||
class ValueMutateInvalidRootMutationError extends Error {
|
||||
constructor() {
|
||||
super('ValueMutate: Only object and array types can be mutated at the root level');
|
||||
}
|
||||
}
|
||||
exports.ValueMutateInvalidRootMutationError = ValueMutateInvalidRootMutationError;
|
||||
var ValueMutate;
|
||||
(function (ValueMutate) {
|
||||
function Object(root, path, current, next) {
|
||||
if (!is_1.Is.Object(current)) {
|
||||
pointer_1.ValuePointer.Set(root, path, clone_1.ValueClone.Clone(next));
|
||||
}
|
||||
else {
|
||||
const currentKeys = globalThis.Object.keys(current);
|
||||
const nextKeys = globalThis.Object.keys(next);
|
||||
for (const currentKey of currentKeys) {
|
||||
if (!nextKeys.includes(currentKey)) {
|
||||
delete current[currentKey];
|
||||
}
|
||||
}
|
||||
for (const nextKey of nextKeys) {
|
||||
if (!currentKeys.includes(nextKey)) {
|
||||
current[nextKey] = null;
|
||||
}
|
||||
}
|
||||
for (const nextKey of nextKeys) {
|
||||
Visit(root, `${path}/${nextKey}`, current[nextKey], next[nextKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
function Array(root, path, current, next) {
|
||||
if (!is_1.Is.Array(current)) {
|
||||
pointer_1.ValuePointer.Set(root, path, clone_1.ValueClone.Clone(next));
|
||||
}
|
||||
else {
|
||||
for (let index = 0; index < next.length; index++) {
|
||||
Visit(root, `${path}/${index}`, current[index], next[index]);
|
||||
}
|
||||
current.splice(next.length);
|
||||
}
|
||||
}
|
||||
function TypedArray(root, path, current, next) {
|
||||
if (is_1.Is.TypedArray(current) && current.length === next.length) {
|
||||
for (let i = 0; i < current.length; i++) {
|
||||
current[i] = next[i];
|
||||
}
|
||||
}
|
||||
else {
|
||||
pointer_1.ValuePointer.Set(root, path, clone_1.ValueClone.Clone(next));
|
||||
}
|
||||
}
|
||||
function Value(root, path, current, next) {
|
||||
if (current === next)
|
||||
return;
|
||||
pointer_1.ValuePointer.Set(root, path, next);
|
||||
}
|
||||
function Visit(root, path, current, next) {
|
||||
if (is_1.Is.Array(next)) {
|
||||
return Array(root, path, current, next);
|
||||
}
|
||||
else if (is_1.Is.TypedArray(next)) {
|
||||
return TypedArray(root, path, current, next);
|
||||
}
|
||||
else if (is_1.Is.Object(next)) {
|
||||
return Object(root, path, current, next);
|
||||
}
|
||||
else if (is_1.Is.Value(next)) {
|
||||
return Value(root, path, current, next);
|
||||
}
|
||||
}
|
||||
/** Performs a deep mutable value assignment while retaining internal references. */
|
||||
function Mutate(current, next) {
|
||||
if (is_1.Is.TypedArray(current) || is_1.Is.Value(current) || is_1.Is.TypedArray(next) || is_1.Is.Value(next)) {
|
||||
throw new ValueMutateInvalidRootMutationError();
|
||||
}
|
||||
if ((is_1.Is.Object(current) && is_1.Is.Array(next)) || (is_1.Is.Array(current) && is_1.Is.Object(next))) {
|
||||
throw new ValueMutateTypeMismatchError();
|
||||
}
|
||||
Visit(current, '', current, next);
|
||||
}
|
||||
ValueMutate.Mutate = Mutate;
|
||||
})(ValueMutate = exports.ValueMutate || (exports.ValueMutate = {}));
|
||||
24
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/pointer.d.ts
generated
vendored
Normal file
24
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/pointer.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
export declare class ValuePointerRootSetError extends Error {
|
||||
readonly value: unknown;
|
||||
readonly path: string;
|
||||
readonly update: unknown;
|
||||
constructor(value: unknown, path: string, update: unknown);
|
||||
}
|
||||
export declare class ValuePointerRootDeleteError extends Error {
|
||||
readonly value: unknown;
|
||||
readonly path: string;
|
||||
constructor(value: unknown, path: string);
|
||||
}
|
||||
/** Provides functionality to update values through RFC6901 string pointers */
|
||||
export declare namespace ValuePointer {
|
||||
/** Formats the given pointer into navigable key components */
|
||||
function Format(pointer: string): IterableIterator<string>;
|
||||
/** Sets the value at the given pointer. If the value at the pointer does not exist it is created */
|
||||
function Set(value: any, pointer: string, update: unknown): void;
|
||||
/** Deletes a value at the given pointer */
|
||||
function Delete(value: any, pointer: string): void;
|
||||
/** Returns true if a value exists at the given pointer */
|
||||
function Has(value: any, pointer: string): boolean;
|
||||
/** Gets the value at the given pointer */
|
||||
function Get(value: any, pointer: string): any;
|
||||
}
|
||||
142
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/pointer.js
generated
vendored
Normal file
142
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/pointer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/value
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValuePointer = exports.ValuePointerRootDeleteError = exports.ValuePointerRootSetError = void 0;
|
||||
class ValuePointerRootSetError extends Error {
|
||||
constructor(value, path, update) {
|
||||
super('ValuePointer: Cannot set root value');
|
||||
this.value = value;
|
||||
this.path = path;
|
||||
this.update = update;
|
||||
}
|
||||
}
|
||||
exports.ValuePointerRootSetError = ValuePointerRootSetError;
|
||||
class ValuePointerRootDeleteError extends Error {
|
||||
constructor(value, path) {
|
||||
super('ValuePointer: Cannot delete root value');
|
||||
this.value = value;
|
||||
this.path = path;
|
||||
}
|
||||
}
|
||||
exports.ValuePointerRootDeleteError = ValuePointerRootDeleteError;
|
||||
/** Provides functionality to update values through RFC6901 string pointers */
|
||||
var ValuePointer;
|
||||
(function (ValuePointer) {
|
||||
function Escape(component) {
|
||||
return component.indexOf('~') === -1 ? component : component.replace(/~1/g, '/').replace(/~0/g, '~');
|
||||
}
|
||||
/** Formats the given pointer into navigable key components */
|
||||
function* Format(pointer) {
|
||||
if (pointer === '')
|
||||
return;
|
||||
let [start, end] = [0, 0];
|
||||
for (let i = 0; i < pointer.length; i++) {
|
||||
const char = pointer.charAt(i);
|
||||
if (char === '/') {
|
||||
if (i === 0) {
|
||||
start = i + 1;
|
||||
}
|
||||
else {
|
||||
end = i;
|
||||
yield Escape(pointer.slice(start, end));
|
||||
start = i + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
end = i;
|
||||
}
|
||||
}
|
||||
yield Escape(pointer.slice(start));
|
||||
}
|
||||
ValuePointer.Format = Format;
|
||||
/** Sets the value at the given pointer. If the value at the pointer does not exist it is created */
|
||||
function Set(value, pointer, update) {
|
||||
if (pointer === '')
|
||||
throw new ValuePointerRootSetError(value, pointer, update);
|
||||
let [owner, next, key] = [null, value, ''];
|
||||
for (const component of Format(pointer)) {
|
||||
if (next[component] === undefined)
|
||||
next[component] = {};
|
||||
owner = next;
|
||||
next = next[component];
|
||||
key = component;
|
||||
}
|
||||
owner[key] = update;
|
||||
}
|
||||
ValuePointer.Set = Set;
|
||||
/** Deletes a value at the given pointer */
|
||||
function Delete(value, pointer) {
|
||||
if (pointer === '')
|
||||
throw new ValuePointerRootDeleteError(value, pointer);
|
||||
let [owner, next, key] = [null, value, ''];
|
||||
for (const component of Format(pointer)) {
|
||||
if (next[component] === undefined || next[component] === null)
|
||||
return;
|
||||
owner = next;
|
||||
next = next[component];
|
||||
key = component;
|
||||
}
|
||||
if (globalThis.Array.isArray(owner)) {
|
||||
const index = parseInt(key);
|
||||
owner.splice(index, 1);
|
||||
}
|
||||
else {
|
||||
delete owner[key];
|
||||
}
|
||||
}
|
||||
ValuePointer.Delete = Delete;
|
||||
/** Returns true if a value exists at the given pointer */
|
||||
function Has(value, pointer) {
|
||||
if (pointer === '')
|
||||
return true;
|
||||
let [owner, next, key] = [null, value, ''];
|
||||
for (const component of Format(pointer)) {
|
||||
if (next[component] === undefined)
|
||||
return false;
|
||||
owner = next;
|
||||
next = next[component];
|
||||
key = component;
|
||||
}
|
||||
return globalThis.Object.getOwnPropertyNames(owner).includes(key);
|
||||
}
|
||||
ValuePointer.Has = Has;
|
||||
/** Gets the value at the given pointer */
|
||||
function Get(value, pointer) {
|
||||
if (pointer === '')
|
||||
return value;
|
||||
let current = value;
|
||||
for (const component of Format(pointer)) {
|
||||
if (current[component] === undefined)
|
||||
return undefined;
|
||||
current = current[component];
|
||||
}
|
||||
return current;
|
||||
}
|
||||
ValuePointer.Get = Get;
|
||||
})(ValuePointer = exports.ValuePointer || (exports.ValuePointer = {}));
|
||||
39
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/value.d.ts
generated
vendored
Normal file
39
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/value.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import * as Types from '../typebox';
|
||||
import { ValueErrorIterator } from '../errors/index';
|
||||
import { Mutable } from './mutate';
|
||||
import { Edit } from './delta';
|
||||
/** Provides functions to perform structural updates to JavaScript values */
|
||||
export declare namespace Value {
|
||||
/** Casts a value into a given type. The return value will retain as much information of the original value as possible. Cast will convert string, number, boolean and date values if a reasonable conversion is possible. */
|
||||
function Cast<T extends Types.TSchema, R extends Types.TSchema[]>(schema: T, references: [...R], value: unknown): Types.Static<T>;
|
||||
/** Casts a value into a given type. The return value will retain as much information of the original value as possible. Cast will convert string, number, boolean and date values if a reasonable conversion is possible. */
|
||||
function Cast<T extends Types.TSchema>(schema: T, value: unknown): Types.Static<T>;
|
||||
/** Creates a value from the given type */
|
||||
function Create<T extends Types.TSchema, R extends Types.TSchema[]>(schema: T, references: [...R]): Types.Static<T>;
|
||||
/** Creates a value from the given type */
|
||||
function Create<T extends Types.TSchema>(schema: T): Types.Static<T>;
|
||||
/** Returns true if the value matches the given type. */
|
||||
function Check<T extends Types.TSchema, R extends Types.TSchema[]>(schema: T, references: [...R], value: unknown): value is Types.Static<T>;
|
||||
/** Returns true if the value matches the given type. */
|
||||
function Check<T extends Types.TSchema>(schema: T, value: unknown): value is Types.Static<T>;
|
||||
/** Converts any type mismatched values to their target type if a conversion is possible. */
|
||||
function Convert<T extends Types.TSchema, R extends Types.TSchema[]>(schema: T, references: [...R], value: unknown): unknown;
|
||||
/** Converts any type mismatched values to their target type if a conversion is possible. */
|
||||
function Convert<T extends Types.TSchema>(schema: T, value: unknown): unknown;
|
||||
/** Returns a structural clone of the given value */
|
||||
function Clone<T>(value: T): T;
|
||||
/** Returns an iterator for each error in this value. */
|
||||
function Errors<T extends Types.TSchema, R extends Types.TSchema[]>(schema: T, references: [...R], value: unknown): ValueErrorIterator;
|
||||
/** Returns an iterator for each error in this value. */
|
||||
function Errors<T extends Types.TSchema>(schema: T, value: unknown): ValueErrorIterator;
|
||||
/** Returns true if left and right values are structurally equal */
|
||||
function Equal<T>(left: T, right: unknown): right is T;
|
||||
/** Returns edits to transform the current value into the next value */
|
||||
function Diff(current: unknown, next: unknown): Edit[];
|
||||
/** Returns a FNV1A-64 non cryptographic hash of the given value */
|
||||
function Hash(value: unknown): bigint;
|
||||
/** Returns a new value with edits applied to the given value */
|
||||
function Patch<T = any>(current: unknown, edits: Edit[]): T;
|
||||
/** Performs a deep mutable value assignment while retaining internal references. */
|
||||
function Mutate(current: Mutable, next: Mutable): void;
|
||||
}
|
||||
99
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/value.js
generated
vendored
Normal file
99
backend/node_modules/jest-snapshot/node_modules/@sinclair/typebox/value/value.js
generated
vendored
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
"use strict";
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
@sinclair/typebox/value
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Value = void 0;
|
||||
const index_1 = require("../errors/index");
|
||||
const mutate_1 = require("./mutate");
|
||||
const hash_1 = require("./hash");
|
||||
const equal_1 = require("./equal");
|
||||
const cast_1 = require("./cast");
|
||||
const clone_1 = require("./clone");
|
||||
const convert_1 = require("./convert");
|
||||
const create_1 = require("./create");
|
||||
const check_1 = require("./check");
|
||||
const delta_1 = require("./delta");
|
||||
/** Provides functions to perform structural updates to JavaScript values */
|
||||
var Value;
|
||||
(function (Value) {
|
||||
function Cast(...args) {
|
||||
const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
|
||||
return cast_1.ValueCast.Cast(schema, references, value);
|
||||
}
|
||||
Value.Cast = Cast;
|
||||
function Create(...args) {
|
||||
const [schema, references] = args.length === 2 ? [args[0], args[1]] : [args[0], []];
|
||||
return create_1.ValueCreate.Create(schema, references);
|
||||
}
|
||||
Value.Create = Create;
|
||||
function Check(...args) {
|
||||
const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
|
||||
return check_1.ValueCheck.Check(schema, references, value);
|
||||
}
|
||||
Value.Check = Check;
|
||||
function Convert(...args) {
|
||||
const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
|
||||
return convert_1.ValueConvert.Convert(schema, references, value);
|
||||
}
|
||||
Value.Convert = Convert;
|
||||
/** Returns a structural clone of the given value */
|
||||
function Clone(value) {
|
||||
return clone_1.ValueClone.Clone(value);
|
||||
}
|
||||
Value.Clone = Clone;
|
||||
function Errors(...args) {
|
||||
const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
|
||||
return index_1.ValueErrors.Errors(schema, references, value);
|
||||
}
|
||||
Value.Errors = Errors;
|
||||
/** Returns true if left and right values are structurally equal */
|
||||
function Equal(left, right) {
|
||||
return equal_1.ValueEqual.Equal(left, right);
|
||||
}
|
||||
Value.Equal = Equal;
|
||||
/** Returns edits to transform the current value into the next value */
|
||||
function Diff(current, next) {
|
||||
return delta_1.ValueDelta.Diff(current, next);
|
||||
}
|
||||
Value.Diff = Diff;
|
||||
/** Returns a FNV1A-64 non cryptographic hash of the given value */
|
||||
function Hash(value) {
|
||||
return hash_1.ValueHash.Create(value);
|
||||
}
|
||||
Value.Hash = Hash;
|
||||
/** Returns a new value with edits applied to the given value */
|
||||
function Patch(current, edits) {
|
||||
return delta_1.ValueDelta.Patch(current, edits);
|
||||
}
|
||||
Value.Patch = Patch;
|
||||
/** Performs a deep mutable value assignment while retaining internal references. */
|
||||
function Mutate(current, next) {
|
||||
mutate_1.ValueMutate.Mutate(current, next);
|
||||
}
|
||||
Value.Mutate = Mutate;
|
||||
})(Value = exports.Value || (exports.Value = {}));
|
||||
320
backend/node_modules/jest-snapshot/node_modules/babel-plugin-istanbul/CHANGELOG.md
generated
vendored
Normal file
320
backend/node_modules/jest-snapshot/node_modules/babel-plugin-istanbul/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,320 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [6.1.1](https://www.github.com/istanbuljs/babel-plugin-istanbul/compare/v6.1.0...v6.1.1) (2021-10-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** first automated publication ([9a1b893](https://www.github.com/istanbuljs/babel-plugin-istanbul/commit/9a1b89342565d1127a011e31262520b057120531))
|
||||
|
||||
## [6.1.0](https://www.github.com/istanbuljs/babel-plugin-istanbul/compare/v6.0.0...v6.1.0) (2021-10-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **instrumenter:** instrumenter with fixes for branchMap instrumentation ([#265](https://www.github.com/istanbuljs/babel-plugin-istanbul/issues/265)) ([1e9ec62](https://www.github.com/istanbuljs/babel-plugin-istanbul/commit/1e9ec62b50c9d2224e7bb0ccb071fd10b80e018f))
|
||||
|
||||
## [6.0.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.2.0...v6.0.0) (2019-12-20)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* Drop node.js 6 (#226)
|
||||
|
||||
### Features
|
||||
|
||||
* Add support for instrumenter options ([#227](https://github.com/istanbuljs/babel-plugin-istanbul/issues/227)) ([fe08f5b](https://github.com/istanbuljs/babel-plugin-istanbul/commit/fe08f5b8282136c7ed9375fa32148586bd6a7e28)), closes [#208](https://github.com/istanbuljs/babel-plugin-istanbul/issues/208) [#212](https://github.com/istanbuljs/babel-plugin-istanbul/issues/212)
|
||||
* Drop node.js 6 ([#226](https://github.com/istanbuljs/babel-plugin-istanbul/issues/226)) ([93db21a](https://github.com/istanbuljs/babel-plugin-istanbul/commit/93db21aa2bbdbb06fb784f52c24a7847fad6be92)), closes [#209](https://github.com/istanbuljs/babel-plugin-istanbul/issues/209)
|
||||
|
||||
## [5.2.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.1.4...v5.2.0) (2019-07-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Print explicit error if use with babel 6 is attempted ([#207](https://github.com/istanbuljs/babel-plugin-istanbul/issues/207)) ([a12cf16](https://github.com/istanbuljs/babel-plugin-istanbul/commit/a12cf16))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Support turning off node_modules default exclude via flag ([#172](https://github.com/istanbuljs/babel-plugin-istanbul/issues/172)) ([a314f06](https://github.com/istanbuljs/babel-plugin-istanbul/commit/a314f06))
|
||||
|
||||
|
||||
|
||||
## [5.1.4](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.1.3...v5.1.4) (2019-04-25)
|
||||
|
||||
|
||||
|
||||
## [5.1.3](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.1.2...v5.1.3) (2019-04-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Revert [#192](https://github.com/istanbuljs/babel-plugin-istanbul/issues/192) ([201a933](https://github.com/istanbuljs/babel-plugin-istanbul/commit/201a933)) due to regression detailed at [#201](https://github.com/istanbuljs/babel-plugin-istanbul/issues/201)
|
||||
|
||||
|
||||
|
||||
## [5.1.2](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.1.1...v5.1.2) (2019-04-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Ensure correct scope references after traversal ([#192](https://github.com/istanbuljs/babel-plugin-istanbul/issues/192)) ([201a933](https://github.com/istanbuljs/babel-plugin-istanbul/commit/201a933))
|
||||
|
||||
|
||||
|
||||
<a name="5.1.1"></a>
|
||||
## [5.1.1](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.1.0...v5.1.1) (2019-01-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* respect changes of cwd in options ([#171](https://github.com/istanbuljs/babel-plugin-istanbul/issues/171)) ([adec723](https://github.com/istanbuljs/babel-plugin-istanbul/commit/adec723))
|
||||
|
||||
|
||||
|
||||
<a name="5.1.0"></a>
|
||||
# [5.1.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.0.1...v5.1.0) (2018-09-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Bump dependencies. ([b509649](https://github.com/istanbuljs/babel-plugin-istanbul/commit/b509649))
|
||||
|
||||
|
||||
|
||||
<a name="5.0.1"></a>
|
||||
## [5.0.1](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v5.0.0...v5.0.1) (2018-07-24)
|
||||
|
||||
|
||||
|
||||
<a name="5.0.0"></a>
|
||||
# [5.0.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.1.6...v5.0.0) (2018-06-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* upgrade to babel 7 and newest istanbul libraries ([#158](https://github.com/istanbuljs/babel-plugin-istanbul/issues/158)) ([a9e1564](https://github.com/istanbuljs/babel-plugin-istanbul/commit/a9e1564))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Drop node 4 support, upgrade to babel 7, stop shipping @babel/plugin-syntax-object-rest-spread
|
||||
|
||||
|
||||
|
||||
<a name="4.1.6"></a>
|
||||
## <small>4.1.6 (2018-03-09)</small>
|
||||
|
||||
* chore: explicit update of istanbul dependencies (#149) ([77b6eb7](https://github.com/istanbuljs/babel-plugin-istanbul/commit/77b6eb7)), closes [#149](https://github.com/istanbuljs/babel-plugin-istanbul/issues/149)
|
||||
* chore(package): update coveralls to version 3.0.0 (#133) ([7045a03](https://github.com/istanbuljs/babel-plugin-istanbul/commit/7045a03)), closes [#133](https://github.com/istanbuljs/babel-plugin-istanbul/issues/133)
|
||||
* chore(package): update mocha to version 4.0.0 (#134) ([38176ba](https://github.com/istanbuljs/babel-plugin-istanbul/commit/38176ba)), closes [#134](https://github.com/istanbuljs/babel-plugin-istanbul/issues/134)
|
||||
* fix: babel-preset-es2015 => babel-preset-env (#138) ([18fe954](https://github.com/istanbuljs/babel-plugin-istanbul/commit/18fe954)), closes [#138](https://github.com/istanbuljs/babel-plugin-istanbul/issues/138)
|
||||
* fix: include object-spread-syntax plugin (#141) ([428a952](https://github.com/istanbuljs/babel-plugin-istanbul/commit/428a952)), closes [#141](https://github.com/istanbuljs/babel-plugin-istanbul/issues/141)
|
||||
|
||||
|
||||
|
||||
<a name="4.1.5"></a>
|
||||
## [4.1.5](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.1.2...v4.1.5) (2017-08-23)
|
||||
|
||||
|
||||
|
||||
<a name="4.1.4"></a>
|
||||
## [4.1.4](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.1.3...v4.1.4) (2017-05-27)
|
||||
|
||||
|
||||
|
||||
<a name="4.1.3"></a>
|
||||
## [4.1.3](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.1.1...v4.1.3) (2017-04-29)
|
||||
|
||||
|
||||
|
||||
<a name="4.1.2"></a>
|
||||
## [4.1.2](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.1.1...v4.1.2) (2017-03-27)
|
||||
|
||||
|
||||
|
||||
<a name="4.1.1"></a>
|
||||
## [4.1.1](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.1.0...v4.1.1) (2017-03-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* explicit upgrade to patched version of istanbul-lib-instrument ([db8ecbe](https://github.com/istanbuljs/babel-plugin-istanbul/commit/db8ecbe))
|
||||
|
||||
|
||||
|
||||
<a name="4.1.0"></a>
|
||||
# [4.1.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v4.0.0...v4.1.0) (2017-03-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add includeUntested option to expose coverage of all instrumented files ([#80](https://github.com/istanbuljs/babel-plugin-istanbul/issues/80)) ([b078bbd](https://github.com/istanbuljs/babel-plugin-istanbul/commit/b078bbd))
|
||||
|
||||
|
||||
|
||||
<a name="4.0.0"></a>
|
||||
# [4.0.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v3.1.2...v4.0.0) (2017-02-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* load configuration from process.env.NYC_CONFIG if present ([#93](https://github.com/istanbuljs/babel-plugin-istanbul/issues/93)) ([e902924](https://github.com/istanbuljs/babel-plugin-istanbul/commit/e902924))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* drop Node 0.10 and 0.12 support, upgrade dependencies to reflect this ([#88](https://github.com/istanbuljs/babel-plugin-istanbul/issues/88)) ([594c03a](https://github.com/istanbuljs/babel-plugin-istanbul/commit/594c03a))
|
||||
* we can now use the language feature Object.assign ([#92](https://github.com/istanbuljs/babel-plugin-istanbul/issues/92)) ([f77db2a](https://github.com/istanbuljs/babel-plugin-istanbul/commit/f77db2a))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* I've updated dependencies and dropped Node 0.10 and Node 0.12 support.
|
||||
|
||||
|
||||
|
||||
<a name="3.1.2"></a>
|
||||
## [3.1.2](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v3.1.1...v3.1.2) (2017-01-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* address regression related to export const foo = () => {} ([#79](https://github.com/istanbuljs/babel-plugin-istanbul/issues/79)) ([f870a8f](https://github.com/istanbuljs/babel-plugin-istanbul/commit/f870a8f))
|
||||
|
||||
|
||||
|
||||
<a name="3.1.1"></a>
|
||||
## [3.1.1](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v3.1.0...v3.1.1) (2017-01-02)
|
||||
|
||||
|
||||
|
||||
<a name="3.1.0"></a>
|
||||
# [3.1.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v3.0.0...v3.1.0) (2016-12-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* upgrade a bunch of core dependencies ([#77](https://github.com/istanbuljs/babel-plugin-istanbul/issues/77)) ([e764330](https://github.com/istanbuljs/babel-plugin-istanbul/commit/e764330))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* accept source map input for the visitor ([#75](https://github.com/istanbuljs/babel-plugin-istanbul/issues/75)) ([437e90b](https://github.com/istanbuljs/babel-plugin-istanbul/commit/437e90b))
|
||||
|
||||
|
||||
|
||||
<a name="3.0.0"></a>
|
||||
# [3.0.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v2.0.3...v3.0.0) (2016-11-14)
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* **package:** update test-exclude to version 3.0.0 ([#68](https://github.com/istanbuljs/babel-plugin-istanbul/issues/68)) ([0396385](https://github.com/istanbuljs/babel-plugin-istanbul/commit/0396385))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* package: test-exclude now adds `**/node_modules/**` as exclude rule by default.
|
||||
|
||||
|
||||
|
||||
<a name="2.0.3"></a>
|
||||
## [2.0.3](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v2.0.2...v2.0.3) (2016-10-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* force istanbul-lib-instrument with variable hoisting fix ([#64](https://github.com/istanbuljs/babel-plugin-istanbul/issues/64)) ([209a0cf](https://github.com/istanbuljs/babel-plugin-istanbul/commit/209a0cf))
|
||||
* switch deprecated lodash.assign for object-assign ([#58](https://github.com/istanbuljs/babel-plugin-istanbul/issues/58)) ([6e051fc](https://github.com/istanbuljs/babel-plugin-istanbul/commit/6e051fc))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.2"></a>
|
||||
## [2.0.2](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v2.0.1...v2.0.2) (2016-09-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* take realpath of cwd, whether or not set in env ([#37](https://github.com/istanbuljs/babel-plugin-istanbul/issues/37)) ([6274d83](https://github.com/istanbuljs/babel-plugin-istanbul/commit/6274d83))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.1"></a>
|
||||
## [2.0.1](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v2.0.0...v2.0.1) (2016-09-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update istanbul-lib-instrument ([573e0d4](https://github.com/istanbuljs/babel-plugin-istanbul/commit/573e0d4))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0"></a>
|
||||
# [2.0.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v1.1.0...v2.0.0) (2016-08-14)
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* upgrade to version of test-exclude with new exclude rules ([#35](https://github.com/istanbuljs/babel-plugin-istanbul/issues/35)) ([220ce2b](https://github.com/istanbuljs/babel-plugin-istanbul/commit/220ce2b))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* see https://github.com/istanbuljs/test-exclude/blob/master/CHANGELOG.md#breaking-changes
|
||||
|
||||
|
||||
|
||||
<a name="1.1.0"></a>
|
||||
# [1.1.0](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v1.0.3...v1.1.0) (2016-07-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* upgrade to istanbul-lib-instrument with faster babel-generator ([#18](https://github.com/istanbuljs/babel-plugin-istanbul/issues/18)) ([d33263c](https://github.com/istanbuljs/babel-plugin-istanbul/commit/d33263c))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allow exclude/include options to be passed as Babel plugin config ([#16](https://github.com/istanbuljs/babel-plugin-istanbul/issues/16)) ([cf68421](https://github.com/istanbuljs/babel-plugin-istanbul/commit/cf68421))
|
||||
|
||||
|
||||
|
||||
<a name="1.0.3"></a>
|
||||
## [1.0.3](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v1.0.2...v1.0.3) (2016-07-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* keep using NYC_CWD if available ([#10](https://github.com/istanbuljs/babel-plugin-istanbul/issues/10)) ([db0352b](https://github.com/istanbuljs/babel-plugin-istanbul/commit/db0352b))
|
||||
|
||||
|
||||
|
||||
<a name="1.0.2"></a>
|
||||
## [1.0.2](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v1.0.1...v1.0.2) (2016-07-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* take realpath of process.cwd(), fixes [#7](https://github.com/istanbuljs/babel-plugin-istanbul/issues/7) ([#8](https://github.com/istanbuljs/babel-plugin-istanbul/issues/8)) ([e8d3785](https://github.com/istanbuljs/babel-plugin-istanbul/commit/e8d3785)), closes [#7](https://github.com/istanbuljs/babel-plugin-istanbul/issues/7) [#8](https://github.com/istanbuljs/babel-plugin-istanbul/issues/8)
|
||||
|
||||
|
||||
|
||||
<a name="1.0.1"></a>
|
||||
## [1.0.1](https://github.com/istanbuljs/babel-plugin-istanbul/compare/v1.0.0...v1.0.1) (2016-06-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* upgrade to version of istanbul-lib-instrument that fixes some out of bounds issues ([#6](https://github.com/istanbuljs/babel-plugin-istanbul/issues/6)) ([a949065](https://github.com/istanbuljs/babel-plugin-istanbul/commit/a949065)), closes [#6](https://github.com/istanbuljs/babel-plugin-istanbul/issues/6)
|
||||
|
||||
|
||||
<a name="1.0.0"></a>
|
||||
# 1.0.0 (2016-06-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* port functionality from __coverage__, get ready for first release ([#2](https://github.com/istanbuljs/babel-plugin-istanbul/issues/2)) ([2a8ee44](https://github.com/istanbuljs/babel-plugin-istanbul/commit/2a8ee44))
|
||||
27
backend/node_modules/jest-snapshot/node_modules/babel-plugin-istanbul/LICENSE
generated
vendored
Normal file
27
backend/node_modules/jest-snapshot/node_modules/babel-plugin-istanbul/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) 2016, Istanbul Code Coverage
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of babel-plugin-istanbul nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
135
backend/node_modules/jest-snapshot/node_modules/babel-plugin-istanbul/README.md
generated
vendored
Normal file
135
backend/node_modules/jest-snapshot/node_modules/babel-plugin-istanbul/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
# babel-plugin-istanbul
|
||||
|
||||
[](https://coveralls.io/github/istanbuljs/babel-plugin-istanbul?branch=master)
|
||||
[](https://conventionalcommits.org)
|
||||
[](http://devtoolscommunity.herokuapp.com)
|
||||
|
||||
_Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com)_.
|
||||
|
||||
A Babel plugin that instruments your code with Istanbul coverage.
|
||||
It can instantly be used with [karma-coverage](https://github.com/karma-runner/karma-coverage) and mocha on Node.js (through [nyc](https://github.com/bcoe/nyc)).
|
||||
|
||||
__Note:__ This plugin does not generate any report or save any data to any file;
|
||||
it only adds instrumenting code to your JavaScript source code.
|
||||
To integrate with testing tools, please see the [Integrations](#integrations) section.
|
||||
|
||||
## Usage
|
||||
|
||||
Install it:
|
||||
|
||||
```
|
||||
npm install --save-dev babel-plugin-istanbul
|
||||
```
|
||||
|
||||
Add it to `.babelrc` in test mode:
|
||||
|
||||
```js
|
||||
{
|
||||
"env": {
|
||||
"test": {
|
||||
"plugins": [ "istanbul" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Optionally, use [cross-env](https://www.npmjs.com/package/cross-env) to set
|
||||
`NODE_ENV=test`:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha test/*.js"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Integrations
|
||||
|
||||
### karma
|
||||
|
||||
It _just works_ with Karma. First, make sure that the code is already transpiled by Babel (either using `karma-babel-preprocessor`, `karma-webpack`, or `karma-browserify`). Then, simply set up [karma-coverage](https://github.com/karma-runner/karma-coverage) according to the docs, but __don’t add the `coverage` preprocessor.__ This plugin has already instrumented your code, and Karma should pick it up automatically.
|
||||
|
||||
It has been tested with [bemusic/bemuse](https://codecov.io/github/bemusic/bemuse) project, which contains ~2400 statements.
|
||||
|
||||
### mocha on node.js (through nyc)
|
||||
|
||||
Configure Mocha to transpile JavaScript code using Babel, then you can run your tests with [`nyc`](https://github.com/bcoe/nyc), which will collect all the coverage report.
|
||||
|
||||
babel-plugin-istanbul respects the `include`/`exclude` configuration options from nyc,
|
||||
but you also need to __configure NYC not to instrument your code__ by adding these settings in your `package.json`:
|
||||
|
||||
```js
|
||||
"nyc": {
|
||||
"sourceMap": false,
|
||||
"instrument": false
|
||||
},
|
||||
```
|
||||
|
||||
## Ignoring files
|
||||
|
||||
You don't want to cover your test files as this will skew your coverage results. You can configure this by providing plugin options matching nyc's [`exclude`/`include` rules](https://github.com/bcoe/nyc#excluding-files):
|
||||
|
||||
```json
|
||||
{
|
||||
"env": {
|
||||
"test": {
|
||||
"plugins": [
|
||||
["istanbul", {
|
||||
"exclude": [
|
||||
"**/*.spec.js"
|
||||
]
|
||||
}]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you don't provide options in your Babel config, the plugin will look for `exclude`/`include` config under an `"nyc"` key in `package.json`.
|
||||
|
||||
You can also use [istanbul's ignore hints](https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes) to specify specific lines of code to skip instrumenting.
|
||||
|
||||
## Source Maps
|
||||
|
||||
By default, this plugin will pick up inline source maps and attach them to the instrumented code such that code coverage can be remapped back to the original source, even for multi-step build processes. This can be memory intensive. Set `useInlineSourceMaps` to prevent this behavior.
|
||||
|
||||
```json
|
||||
{
|
||||
"env": {
|
||||
"test": {
|
||||
"plugins": [
|
||||
["istanbul", {
|
||||
"useInlineSourceMaps": false
|
||||
}]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you're instrumenting code programatically, you can pass a source map explicitly.
|
||||
```js
|
||||
import babelPluginIstanbul from 'babel-plugin-istanbul';
|
||||
|
||||
function instrument(sourceCode, sourceMap, fileName) {
|
||||
return babel.transform(sourceCode, {
|
||||
filename,
|
||||
plugins: [
|
||||
[babelPluginIstanbul, {
|
||||
inputSourceMap: sourceMap
|
||||
}]
|
||||
]
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
## Credit where credit is due
|
||||
|
||||
The approach used in `babel-plugin-istanbul` was inspired by [Thai Pangsakulyanont](https://github.com/dtinth)'s original library [`babel-plugin-__coverage__`](https://github.com/dtinth/babel-plugin-__coverage__).
|
||||
|
||||
## `babel-plugin-istanbul` for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of `babel-plugin-istanbul` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-babel-plugin-istanbul?utm_source=npm-babel-plugin-istanbul&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
170
backend/node_modules/jest-snapshot/node_modules/babel-plugin-istanbul/lib/index.js
generated
vendored
Normal file
170
backend/node_modules/jest-snapshot/node_modules/babel-plugin-istanbul/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
|
||||
var _fs = require("fs");
|
||||
|
||||
var _child_process = require("child_process");
|
||||
|
||||
var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
||||
|
||||
var _istanbulLibInstrument = require("istanbul-lib-instrument");
|
||||
|
||||
var _testExclude = _interopRequireDefault(require("test-exclude"));
|
||||
|
||||
var _schema = _interopRequireDefault(require("@istanbuljs/schema"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function getRealpath(n) {
|
||||
try {
|
||||
return (0, _fs.realpathSync)(n) ||
|
||||
/* istanbul ignore next */
|
||||
n;
|
||||
} catch (e) {
|
||||
/* istanbul ignore next */
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
const memoize = new Map();
|
||||
/* istanbul ignore next */
|
||||
|
||||
const memosep = _path.default.sep === '/' ? ':' : ';';
|
||||
|
||||
function loadNycConfig(cwd, opts) {
|
||||
let memokey = cwd;
|
||||
const args = [_path.default.resolve(__dirname, 'load-nyc-config-sync.js'), cwd];
|
||||
|
||||
if ('nycrcPath' in opts) {
|
||||
args.push(opts.nycrcPath);
|
||||
memokey += memosep + opts.nycrcPath;
|
||||
}
|
||||
/* execFileSync is expensive, avoid it if possible! */
|
||||
|
||||
|
||||
if (memoize.has(memokey)) {
|
||||
return memoize.get(memokey);
|
||||
}
|
||||
|
||||
const result = JSON.parse((0, _child_process.execFileSync)(process.execPath, args));
|
||||
const error = result['load-nyc-config-sync-error'];
|
||||
|
||||
if (error) {
|
||||
throw new Error(error);
|
||||
}
|
||||
|
||||
const config = { ..._schema.default.defaults.babelPluginIstanbul,
|
||||
cwd,
|
||||
...result
|
||||
};
|
||||
memoize.set(memokey, config);
|
||||
return config;
|
||||
}
|
||||
|
||||
function findConfig(opts) {
|
||||
const cwd = getRealpath(opts.cwd || process.env.NYC_CWD ||
|
||||
/* istanbul ignore next */
|
||||
process.cwd());
|
||||
const keys = Object.keys(opts);
|
||||
const ignored = Object.keys(opts).filter(s => s === 'nycrcPath' || s === 'cwd');
|
||||
|
||||
if (keys.length > ignored.length) {
|
||||
// explicitly configuring options in babel
|
||||
// takes precedence.
|
||||
return { ..._schema.default.defaults.babelPluginIstanbul,
|
||||
cwd,
|
||||
...opts
|
||||
};
|
||||
}
|
||||
|
||||
if (ignored.length === 0 && process.env.NYC_CONFIG) {
|
||||
// defaults were already applied by nyc
|
||||
return JSON.parse(process.env.NYC_CONFIG);
|
||||
}
|
||||
|
||||
return loadNycConfig(cwd, opts);
|
||||
}
|
||||
|
||||
function makeShouldSkip() {
|
||||
let exclude;
|
||||
return function shouldSkip(file, nycConfig) {
|
||||
if (!exclude || exclude.cwd !== nycConfig.cwd) {
|
||||
exclude = new _testExclude.default({
|
||||
cwd: nycConfig.cwd,
|
||||
include: nycConfig.include,
|
||||
exclude: nycConfig.exclude,
|
||||
extension: nycConfig.extension,
|
||||
// Make sure this is true unless explicitly set to `false`. `undefined` is still `true`.
|
||||
excludeNodeModules: nycConfig.excludeNodeModules !== false
|
||||
});
|
||||
}
|
||||
|
||||
return !exclude.shouldInstrument(file);
|
||||
};
|
||||
}
|
||||
|
||||
var _default = (0, _helperPluginUtils.declare)(api => {
|
||||
api.assertVersion(7);
|
||||
const shouldSkip = makeShouldSkip();
|
||||
const t = api.types;
|
||||
return {
|
||||
visitor: {
|
||||
Program: {
|
||||
enter(path) {
|
||||
this.__dv__ = null;
|
||||
this.nycConfig = findConfig(this.opts);
|
||||
const realPath = getRealpath(this.file.opts.filename);
|
||||
|
||||
if (shouldSkip(realPath, this.nycConfig)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let {
|
||||
inputSourceMap
|
||||
} = this.opts;
|
||||
|
||||
if (this.opts.useInlineSourceMaps !== false) {
|
||||
if (!inputSourceMap && this.file.inputMap) {
|
||||
inputSourceMap = this.file.inputMap.sourcemap;
|
||||
}
|
||||
}
|
||||
|
||||
const visitorOptions = {};
|
||||
Object.entries(_schema.default.defaults.instrumentVisitor).forEach(([name, defaultValue]) => {
|
||||
if (name in this.nycConfig) {
|
||||
visitorOptions[name] = this.nycConfig[name];
|
||||
} else {
|
||||
visitorOptions[name] = _schema.default.defaults.instrumentVisitor[name];
|
||||
}
|
||||
});
|
||||
this.__dv__ = (0, _istanbulLibInstrument.programVisitor)(t, realPath, { ...visitorOptions,
|
||||
inputSourceMap
|
||||
});
|
||||
|
||||
this.__dv__.enter(path);
|
||||
},
|
||||
|
||||
exit(path) {
|
||||
if (!this.__dv__) {
|
||||
return;
|
||||
}
|
||||
|
||||
const result = this.__dv__.exit(path);
|
||||
|
||||
if (this.opts.onCover) {
|
||||
this.opts.onCover(getRealpath(this.file.opts.filename), result.fileCoverage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
exports.default = _default;
|
||||
20
backend/node_modules/jest-snapshot/node_modules/babel-plugin-istanbul/lib/load-nyc-config-sync.js
generated
vendored
Normal file
20
backend/node_modules/jest-snapshot/node_modules/babel-plugin-istanbul/lib/load-nyc-config-sync.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
const {
|
||||
loadNycConfig
|
||||
} = require('@istanbuljs/load-nyc-config');
|
||||
|
||||
async function main() {
|
||||
const [cwd, nycrcPath] = process.argv.slice(2);
|
||||
console.log(JSON.stringify(await loadNycConfig({
|
||||
cwd,
|
||||
nycrcPath
|
||||
})));
|
||||
}
|
||||
|
||||
main().catch(error => {
|
||||
console.log(JSON.stringify({
|
||||
'load-nyc-config-sync-error': error.message
|
||||
}));
|
||||
});
|
||||
71
backend/node_modules/jest-snapshot/node_modules/babel-plugin-istanbul/package.json
generated
vendored
Normal file
71
backend/node_modules/jest-snapshot/node_modules/babel-plugin-istanbul/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"name": "babel-plugin-istanbul",
|
||||
"version": "6.1.1",
|
||||
"author": "Thai Pangsakulyanont @dtinth",
|
||||
"license": "BSD-3-Clause",
|
||||
"description": "A babel plugin that adds istanbul instrumentation to ES6 code",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.0.0",
|
||||
"@istanbuljs/load-nyc-config": "^1.0.0",
|
||||
"@istanbuljs/schema": "^0.1.2",
|
||||
"istanbul-lib-instrument": "^5.0.4",
|
||||
"test-exclude": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.7.5",
|
||||
"@babel/core": "^7.7.5",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.7.5",
|
||||
"@babel/register": "^7.7.4",
|
||||
"chai": "^4.2.0",
|
||||
"coveralls": "^3.0.9",
|
||||
"cross-env": "^6.0.3",
|
||||
"mocha": "^6.2.2",
|
||||
"nyc": "^15.0.0",
|
||||
"pmock": "^0.2.3",
|
||||
"standard": "^14.3.1"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
||||
"release": "babel src --out-dir lib",
|
||||
"pretest": "standard && npm run release",
|
||||
"test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha --timeout 5000 test/*.js",
|
||||
"prepublish": "npm test && npm run release"
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"fixtures/*.js"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/istanbuljs/babel-plugin-istanbul.git"
|
||||
},
|
||||
"keywords": [
|
||||
"istanbul",
|
||||
"babel",
|
||||
"plugin",
|
||||
"instrumentation"
|
||||
],
|
||||
"nyc": {
|
||||
"include": [
|
||||
"src/*.js",
|
||||
"fixtures/should-cover.js"
|
||||
],
|
||||
"require": [
|
||||
"@babel/register"
|
||||
],
|
||||
"sourceMap": false,
|
||||
"instrument": false
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/istanbuljs/babel-plugin-istanbul/issues"
|
||||
},
|
||||
"homepage": "https://github.com/istanbuljs/babel-plugin-istanbul#readme",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
}
|
||||
631
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/CHANGELOG.md
generated
vendored
Normal file
631
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,631 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [5.2.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.2.0...istanbul-lib-instrument-v5.2.1) (2022-10-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* handle error when inputSourceMap is not a plain object ([#662](https://github.com/istanbuljs/istanbuljs/issues/662)) ([3e3611f](https://github.com/istanbuljs/istanbuljs/commit/3e3611f0efffefd5f87e6cbccd840e9f33aaf43e))
|
||||
|
||||
## [5.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.1.0...istanbul-lib-instrument-v5.2.0) (2022-02-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* exclude Empty Object and Arrays in Truthy Detection ([#666](https://github.com/istanbuljs/istanbuljs/issues/666)) ([e279684](https://github.com/istanbuljs/istanbuljs/commit/e279684e735f4b7dbe2b632cde2515f6862099de))
|
||||
|
||||
## [5.1.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.4...istanbul-lib-instrument-v5.1.0) (2021-10-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* option to evaluate logical truthiness, for applications such as fuzzing ([#629](https://www.github.com/istanbuljs/istanbuljs/issues/629)) ([a743b84](https://www.github.com/istanbuljs/istanbuljs/commit/a743b8442e977f0c77ffa282eed7ac84ca200d1f))
|
||||
|
||||
### [5.0.4](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.3...istanbul-lib-instrument-v5.0.4) (2021-10-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **magic-value:** make incrementing magic value a manual step ([#641](https://www.github.com/istanbuljs/istanbuljs/issues/641)) ([823010b](https://www.github.com/istanbuljs/istanbuljs/commit/823010b821cf81bd91377d75fc83f0875925db66))
|
||||
|
||||
### [5.0.3](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.2...istanbul-lib-instrument-v5.0.3) (2021-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* coverage.branchMap else location. ([#633](https://www.github.com/istanbuljs/istanbuljs/issues/633)) ([eb4b4ec](https://www.github.com/istanbuljs/istanbuljs/commit/eb4b4ec8f4b858655a66b0033fcc662f44ef4cc9))
|
||||
|
||||
### [5.0.2](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.1...istanbul-lib-instrument-v5.0.2) (2021-09-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** verfiy automated publication ([b232690](https://www.github.com/istanbuljs/istanbuljs/commit/b232690193f4b524332046c96dd1cdc6e881c6c7))
|
||||
|
||||
### [5.0.1](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.0...istanbul-lib-instrument-v5.0.1) (2021-09-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** verfiy automated publication ([74c96bd](https://www.github.com/istanbuljs/istanbuljs/commit/74c96bdc4224a06e2e1166ebd9adf8faf28438b1))
|
||||
|
||||
## [5.0.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v4.0.3...istanbul-lib-instrument-v5.0.0) (2021-09-13)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* istanbul-lib-instrument no longer uses babel
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* istanbul-lib-instrument no longer uses babel ([8d3badb](https://www.github.com/istanbuljs/istanbuljs/commit/8d3badb8f6c9a4bed9af8e19c3ac6459ebd7267b))
|
||||
|
||||
## [4.0.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.2...istanbul-lib-instrument@4.0.3) (2020-05-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Prevent readInitialCoverage from reading babel config ([#562](https://github.com/istanbuljs/istanbuljs/issues/562)) ([49b4745](https://github.com/istanbuljs/istanbuljs/commit/49b474525c15e703642916011bd86f663aca0c3d))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.1...istanbul-lib-instrument@4.0.2) (2020-05-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add ts-ignore to reassignment of generated function ([#557](https://github.com/istanbuljs/istanbuljs/issues/557)) ([817efb0](https://github.com/istanbuljs/istanbuljs/commit/817efb04fc161efae426b2231a0221606b09f559))
|
||||
* Use @babel/core for all babel imports. ([#555](https://github.com/istanbuljs/istanbuljs/issues/555)) ([a99a13e](https://github.com/istanbuljs/istanbuljs/commit/a99a13ee6931fc124a2a723c3f511cdbcb0aa81d))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0...istanbul-lib-instrument@4.0.1) (2020-02-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Always call coverage initialization function ([#524](https://github.com/istanbuljs/istanbuljs/issues/524)) ([c6536c1](https://github.com/istanbuljs/istanbuljs/commit/c6536c14bf0663ca7e0493dd40ea132b05352594))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [4.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.3...istanbul-lib-instrument@4.0.0) (2019-12-20)
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-instrument
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [4.0.0-alpha.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.2...istanbul-lib-instrument@4.0.0-alpha.3) (2019-12-07)
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-instrument
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [4.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.1...istanbul-lib-instrument@4.0.0-alpha.2) (2019-11-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Produce properly merged source-maps when inputSourceMap is provided ([#487](https://github.com/istanbuljs/istanbuljs/issues/487)) ([8f8c88e](https://github.com/istanbuljs/istanbuljs/commit/8f8c88e3a2add4c08729e41e356aa7981dc69d4d))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [4.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.0...istanbul-lib-instrument@4.0.0-alpha.1) (2019-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Eliminate babel hoisting of the coverage variable ([#481](https://github.com/istanbuljs/istanbuljs/issues/481)) ([8dfbcba](https://github.com/istanbuljs/istanbuljs/commit/8dfbcba)), closes [#92](https://github.com/istanbuljs/istanbuljs/issues/92)
|
||||
* Honor ignore hints in chained if statements ([#469](https://github.com/istanbuljs/istanbuljs/issues/469)) ([a629770](https://github.com/istanbuljs/istanbuljs/commit/a629770)), closes [#468](https://github.com/istanbuljs/istanbuljs/issues/468)
|
||||
* Populate lastFileCoverage for already instrumented files ([#470](https://github.com/istanbuljs/istanbuljs/issues/470)) ([ea6d779](https://github.com/istanbuljs/istanbuljs/commit/ea6d779)), closes [istanbuljs/nyc#594](https://github.com/istanbuljs/nyc/issues/594)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Use @istanbuljs/schema to pull defaults ([#485](https://github.com/istanbuljs/istanbuljs/issues/485)) ([87e27f3](https://github.com/istanbuljs/istanbuljs/commit/87e27f3)), closes [#460](https://github.com/istanbuljs/istanbuljs/issues/460)
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* The defaults for `autoWrap`, `preserveComments`,
|
||||
`esModules` and `produceSourceMap` are now true. This applies only to
|
||||
the stand-alone instrumenter, the visitor does not use these options.
|
||||
* The `flow` and `jsx` parser plugins are no longer
|
||||
enabled by default. This applies only to the stand-alone instrumenter,
|
||||
the visitor does not use this option.
|
||||
* The `plugins` option of the stand-alone instrumenter
|
||||
has been renamed to `parserPlugins` to match nyc.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [4.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.3.0...istanbul-lib-instrument@4.0.0-alpha.0) (2019-06-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Node.js 8 is now required
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.3.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.2.0...istanbul-lib-instrument@3.3.0) (2019-04-24)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Enable classProperties and classPrivateProperties parsers and coverage. ([#379](https://github.com/istanbuljs/istanbuljs/issues/379)) ([c09dc38](https://github.com/istanbuljs/istanbuljs/commit/c09dc38))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.1.2...istanbul-lib-instrument@3.2.0) (2019-04-09)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add bigInt and importMeta to default parser plugins. ([#356](https://github.com/istanbuljs/istanbuljs/issues/356)) ([fb4d6ed](https://github.com/istanbuljs/istanbuljs/commit/fb4d6ed)), closes [#338](https://github.com/istanbuljs/istanbuljs/issues/338)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.1.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.1.1...istanbul-lib-instrument@3.1.2) (2019-04-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Be more friendly to ts-node. ([#352](https://github.com/istanbuljs/istanbuljs/issues/352)) ([40d15f5](https://github.com/istanbuljs/istanbuljs/commit/40d15f5)), closes [#336](https://github.com/istanbuljs/istanbuljs/issues/336)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.1.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.1.0...istanbul-lib-instrument@3.1.1) (2019-03-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Honor istanbul ignore next hints placed before export statement. ([#298](https://github.com/istanbuljs/istanbuljs/issues/298)) ([f24795d](https://github.com/istanbuljs/istanbuljs/commit/f24795d)), closes [#297](https://github.com/istanbuljs/istanbuljs/issues/297)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.1.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.0.1...istanbul-lib-instrument@3.1.0) (2019-01-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* dont skip for loop initialization instrumentation ([#188](https://github.com/istanbuljs/istanbuljs/issues/188)) ([2e0258e](https://github.com/istanbuljs/istanbuljs/commit/2e0258e))
|
||||
* New options coverageGlobalScope and coverageGlobalScopeFunc. ([#200](https://github.com/istanbuljs/istanbuljs/issues/200)) ([25509c7](https://github.com/istanbuljs/istanbuljs/commit/25509c7)), closes [#199](https://github.com/istanbuljs/istanbuljs/issues/199)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="3.0.1"></a>
|
||||
## [3.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.0.0...istanbul-lib-instrument@3.0.1) (2018-12-25)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-instrument
|
||||
|
||||
<a name="3.0.0"></a>
|
||||
# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.3.2...istanbul-lib-instrument@3.0.0) (2018-09-06)
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* Update test for babel 7. ([#218](https://github.com/istanbuljs/istanbuljs/issues/218)) ([9cf4d43](https://github.com/istanbuljs/istanbuljs/commit/9cf4d43)), closes [#205](https://github.com/istanbuljs/istanbuljs/issues/205)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add option plugins ([#205](https://github.com/istanbuljs/istanbuljs/issues/205)) ([312f81f](https://github.com/istanbuljs/istanbuljs/commit/312f81f))
|
||||
* Update babel to 7.0.0. ([#215](https://github.com/istanbuljs/istanbuljs/issues/215)) ([8a96613](https://github.com/istanbuljs/istanbuljs/commit/8a96613))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* was added which requires an option for the `decorators`
|
||||
plugin. Add it to get tests working again, commit updated api.md.
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="2.3.2"></a>
|
||||
## [2.3.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.3.1...istanbul-lib-instrument@2.3.2) (2018-07-24)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-instrument
|
||||
|
||||
<a name="2.3.1"></a>
|
||||
## [2.3.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.3.0...istanbul-lib-instrument@2.3.1) (2018-07-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Don't ignore src/visitor.js for self test. ([#194](https://github.com/istanbuljs/istanbuljs/issues/194)) ([71b815d](https://github.com/istanbuljs/istanbuljs/commit/71b815d))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="2.3.0"></a>
|
||||
# [2.3.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.2.1...istanbul-lib-instrument@2.3.0) (2018-06-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* update pinned babel version to latest release. ([#189](https://github.com/istanbuljs/istanbuljs/issues/189)) ([ac8ec07](https://github.com/istanbuljs/istanbuljs/commit/ac8ec07))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="2.2.1"></a>
|
||||
## [2.2.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.2.0...istanbul-lib-instrument@2.2.1) (2018-06-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Instrument ObjectMethod's. ([#182](https://github.com/istanbuljs/istanbuljs/issues/182)) ([126f09d](https://github.com/istanbuljs/istanbuljs/commit/126f09d))
|
||||
* update default args test guard to work on supported versions. ([#185](https://github.com/istanbuljs/istanbuljs/issues/185)) ([955511a](https://github.com/istanbuljs/istanbuljs/commit/955511a))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="2.2.0"></a>
|
||||
# [2.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.2...istanbul-lib-instrument@2.2.0) (2018-06-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for optional catch binding ([#175](https://github.com/istanbuljs/istanbuljs/issues/175)) ([088dd9f](https://github.com/istanbuljs/istanbuljs/commit/088dd9f))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="2.1.0"></a>
|
||||
# [2.1.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.2...istanbul-lib-instrument@2.1.0) (2018-05-31)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for optional catch binding ([#175](https://github.com/istanbuljs/istanbuljs/issues/175)) ([088dd9f](https://github.com/istanbuljs/istanbuljs/commit/088dd9f))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="2.0.2"></a>
|
||||
## [2.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.1...istanbul-lib-instrument@2.0.2) (2018-05-31)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-instrument
|
||||
|
||||
<a name="2.0.1"></a>
|
||||
## [2.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.0...istanbul-lib-instrument@2.0.1) (2018-05-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* should import [@babel](https://github.com/babel)/template ([85a0d1a](https://github.com/istanbuljs/istanbuljs/commit/85a0d1a))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0"></a>
|
||||
# [2.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.10.1...istanbul-lib-instrument@2.0.0) (2018-05-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* parenthesize superClass on non-idetifier case ([#158](https://github.com/istanbuljs/istanbuljs/issues/158)) ([6202c88](https://github.com/istanbuljs/istanbuljs/commit/6202c88))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* upgrade babel in instrumenter ([#174](https://github.com/istanbuljs/istanbuljs/issues/174)) ([ce23e91](https://github.com/istanbuljs/istanbuljs/commit/ce23e91))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* babel@7 drops Node@4 support
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.10.1"></a>
|
||||
## [1.10.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.10.0...istanbul-lib-instrument@1.10.1) (2018-03-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* default value for ignorelassMethods ([#151](https://github.com/istanbuljs/istanbuljs/issues/151)) ([5dd88e8](https://github.com/istanbuljs/istanbuljs/commit/5dd88e8))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.10.0"></a>
|
||||
# [1.10.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.2...istanbul-lib-instrument@1.10.0) (2018-03-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allows an array of ignored method names to be provided ([#127](https://github.com/istanbuljs/istanbuljs/issues/127)) ([67918e2](https://github.com/istanbuljs/istanbuljs/commit/67918e2))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.9.2"></a>
|
||||
## [1.9.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.1...istanbul-lib-instrument@1.9.2) (2018-02-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* compatibility with babel 7 ([#135](https://github.com/istanbuljs/istanbuljs/issues/135)) ([6cac849](https://github.com/istanbuljs/istanbuljs/commit/6cac849))
|
||||
* handle instrumentation when a function is called Function ([#131](https://github.com/istanbuljs/istanbuljs/issues/131)) ([b12a07e](https://github.com/istanbuljs/istanbuljs/commit/b12a07e))
|
||||
* proper passing of the preserveComments option to babel ([#122](https://github.com/istanbuljs/istanbuljs/issues/122)) ([470bb0e](https://github.com/istanbuljs/istanbuljs/commit/470bb0e))
|
||||
* update instrument, account for lack of arrow expression ([#119](https://github.com/istanbuljs/istanbuljs/issues/119)) ([#125](https://github.com/istanbuljs/istanbuljs/issues/125)) ([0968206](https://github.com/istanbuljs/istanbuljs/commit/0968206))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.9.1"></a>
|
||||
## [1.9.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.0...istanbul-lib-instrument@1.9.1) (2017-10-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* address issue with class instrumentation ([#111](https://github.com/istanbuljs/istanbuljs/issues/111)) ([cbd1c14](https://github.com/istanbuljs/istanbuljs/commit/cbd1c14))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.9.0"></a>
|
||||
# [1.9.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.8.0...istanbul-lib-instrument@1.9.0) (2017-10-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* support conditional expression for superClass ([#106](https://github.com/istanbuljs/istanbuljs/issues/106)) ([aae256f](https://github.com/istanbuljs/istanbuljs/commit/aae256f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for ignoring entire files ([#108](https://github.com/istanbuljs/istanbuljs/issues/108)) ([f12da65](https://github.com/istanbuljs/istanbuljs/commit/f12da65))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.8.0"></a>
|
||||
# [1.8.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.5...istanbul-lib-instrument@1.8.0) (2017-09-05)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for object-spread syntax ([#82](https://github.com/istanbuljs/istanbuljs/issues/82)) ([28d5566](https://github.com/istanbuljs/istanbuljs/commit/28d5566))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.7.5"></a>
|
||||
## [1.7.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.4...istanbul-lib-instrument@1.7.5) (2017-08-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* name of function is now preserved or named exports ([#79](https://github.com/istanbuljs/istanbuljs/issues/79)) ([2ce8974](https://github.com/istanbuljs/istanbuljs/commit/2ce8974))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.7.4"></a>
|
||||
## [1.7.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.3...istanbul-lib-instrument@1.7.4) (2017-07-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update increment operator to appropriate expression type ([#74](https://github.com/istanbuljs/istanbuljs/issues/74)) ([dc69e66](https://github.com/istanbuljs/istanbuljs/commit/dc69e66))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.7.3"></a>
|
||||
## [1.7.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.2...istanbul-lib-instrument@1.7.3) (2017-06-25)
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.7.2"></a>
|
||||
## [1.7.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.1...istanbul-lib-instrument@1.7.2) (2017-05-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* hoist statement counter for class variables, so that name is preserved ([#60](https://github.com/istanbuljs/istanbuljs/issues/60)) ([120d221](https://github.com/istanbuljs/istanbuljs/commit/120d221))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.7.1"></a>
|
||||
## [1.7.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.7.0...istanbul-lib-instrument@1.7.1) (2017-04-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* don't instrument a file if it has already been instrumented ([#38](https://github.com/istanbuljs/istanbuljs/issues/38)) ([9c38e4e](https://github.com/istanbuljs/istanbul-lib-instrument/commit/9c38e4e))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.7.0"></a>
|
||||
# [1.7.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.6.2...istanbul-lib-instrument@1.7.0) (2017-03-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* use extended babylon support; adding features such as jsx ([#22](https://github.com/istanbuljs/istanbuljs/issues/22)) ([11c2438](https://github.com/istanbuljs/istanbul-lib-instrument/commit/11c2438))
|
||||
|
||||
<a name="1.6.2"></a>
|
||||
## [1.6.2](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.6.1...istanbul-lib-instrument@1.6.2) (2017-03-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* loc is sometimes not defined, so loc.start fails see [#99](https://github.com/istanbuljs/istanbuljs/issues/99) ([#18](https://github.com/istanbuljs/istanbuljs/issues/18)) ([df85ba6](https://github.com/istanbuljs/istanbul-lib-instrument/commit/df85ba6))
|
||||
|
||||
<a name="1.6.1"></a>
|
||||
## [1.6.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.6.0...istanbul-lib-instrument@1.6.1) (2017-03-21)
|
||||
|
||||
<a name="1.6.0"></a>
|
||||
# [1.6.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.4.2...istanbul-lib-instrument@1.6.0) (2017-03-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* adds line number property back to coverage.json ([b03b927](https://github.com/istanbuljs/istanbul-lib-instrument/commit/b03b927))
|
||||
|
||||
<a name="1.4.2"></a>
|
||||
## [1.4.2](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.4.1...v1.4.2) (2017-01-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* only hoist counter for a smaller subset of function declarations ([9f8931e](https://github.com/istanbuljs/istanbul-lib-instrument/commit/9f8931e))
|
||||
|
||||
|
||||
|
||||
<a name="1.4.1"></a>
|
||||
## [1.4.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.4.0...v1.4.1) (2017-01-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* address regression discussed in https://github.com/istanbuljs/babel-plugin-istanbul/issues/78 ([#40](https://github.com/istanbuljs/istanbul-lib-instrument/issues/40)) ([7f458a3](https://github.com/istanbuljs/istanbul-lib-instrument/commit/7f458a3))
|
||||
|
||||
|
||||
|
||||
<a name="1.4.0"></a>
|
||||
# [1.4.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.3.1...v1.4.0) (2017-01-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* preserve inferred function names ([#38](https://github.com/istanbuljs/istanbul-lib-instrument/issues/38)) ([312666e](https://github.com/istanbuljs/istanbul-lib-instrument/commit/312666e))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.1"></a>
|
||||
## [1.3.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.3.0...v1.3.1) (2016-12-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* function declaration assignment now retains function name ([#33](https://github.com/istanbuljs/istanbul-lib-instrument/issues/33)) ([2d781da](https://github.com/istanbuljs/istanbul-lib-instrument/commit/2d781da))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.0"></a>
|
||||
# [1.3.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.2.0...v1.3.0) (2016-11-10)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allow an input source-map to be passed to instrumentSync() ([#23](https://github.com/istanbuljs/istanbul-lib-instrument/issues/23)) ([b08e4f5](https://github.com/istanbuljs/istanbul-lib-instrument/commit/b08e4f5))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.0"></a>
|
||||
# [1.2.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.4...v1.2.0) (2016-10-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* implement function to extract empty coverage data from an instrumented file ([#28](https://github.com/istanbuljs/istanbul-lib-instrument/issues/28)) ([06d0ef6](https://github.com/istanbuljs/istanbul-lib-instrument/commit/06d0ef6))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.4"></a>
|
||||
## [1.1.4](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.3...v1.1.4) (2016-10-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* hoist coverage variable to very top of file ([#26](https://github.com/istanbuljs/istanbul-lib-instrument/issues/26)) ([0225e8c](https://github.com/istanbuljs/istanbul-lib-instrument/commit/0225e8c))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.3"></a>
|
||||
## [1.1.3](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.2...v1.1.3) (2016-09-13)
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* simplify coverage variable naming https://github.com/istanbuljs/istanbul-lib-instrument/pull/24 ([7252aae](https://github.com/istanbuljs/istanbul-lib-instrument/commit/7252aae))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.2"></a>
|
||||
## [1.1.2](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.1...v1.1.2) (2016-09-08)
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* use zero-based numeric indices for much faster instrumented code ([#22](https://github.com/istanbuljs/istanbul-lib-instrument/issues/22)) ([5b401f5](https://github.com/istanbuljs/istanbul-lib-instrument/commit/5b401f5))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.1"></a>
|
||||
## [1.1.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.0...v1.1.1) (2016-08-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* upgrade istanbul-lib-coverage ([eb9b1f6](https://github.com/istanbuljs/istanbul-lib-instrument/commit/eb9b1f6))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.0"></a>
|
||||
# [1.1.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.0-alpha.4...v1.1.0) (2016-08-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* guard against invalid loc ([#16](https://github.com/istanbuljs/istanbul-lib-instrument/issues/16)) ([23ebfc3](https://github.com/istanbuljs/istanbul-lib-instrument/commit/23ebfc3))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.0-alpha.4"></a>
|
||||
# [1.1.0-alpha.4](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.0.0-alpha.5...v1.1.0-alpha.4) (2016-07-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* require more performant babel-generator ([#15](https://github.com/istanbuljs/istanbul-lib-instrument/issues/15)) ([21b2563](https://github.com/istanbuljs/istanbul-lib-instrument/commit/21b2563))
|
||||
24
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/LICENSE
generated
vendored
Normal file
24
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
Copyright 2012-2015 Yahoo! Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Yahoo! Inc. nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
22
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/README.md
generated
vendored
Normal file
22
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
## istanbul-lib-instrument
|
||||
|
||||
[](https://travis-ci.org/istanbuljs/istanbul-lib-instrument)
|
||||
|
||||
Istanbul instrumenter library.
|
||||
|
||||
Version 1.1.x now implements instrumentation using `Babel`. The implementation is inspired
|
||||
by prior art by @dtinth as demonstrated in the `__coverage__` babel plugin.
|
||||
|
||||
It provides 2 "modes" of instrumentation.
|
||||
|
||||
- The old API that is mostly unchanged (except for incompatibilities noted) and
|
||||
performs the instrumentation using babel as a library.
|
||||
|
||||
- A `programVisitor` function for the Babel AST that can be used by a Babel plugin
|
||||
to emit instrumentation for ES6 code directly without any source map
|
||||
processing. This is the preferred path for babel users. The Babel plugin is
|
||||
called `babel-plugin-istanbul`.
|
||||
|
||||
Incompatibilities and changes to instrumentation behavior can be found in
|
||||
[v0-changes.md](v0-changes.md).
|
||||
|
||||
1
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/.bin/semver
generated
vendored
Symbolic link
1
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/.bin/semver
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../semver/bin/semver.js
|
||||
15
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/semver/LICENSE
generated
vendored
Normal file
15
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/semver/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
443
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/semver/README.md
generated
vendored
Normal file
443
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/semver/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,443 @@
|
|||
semver(1) -- The semantic versioner for npm
|
||||
===========================================
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install semver
|
||||
````
|
||||
|
||||
## Usage
|
||||
|
||||
As a node module:
|
||||
|
||||
```js
|
||||
const semver = require('semver')
|
||||
|
||||
semver.valid('1.2.3') // '1.2.3'
|
||||
semver.valid('a.b.c') // null
|
||||
semver.clean(' =v1.2.3 ') // '1.2.3'
|
||||
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
|
||||
semver.gt('1.2.3', '9.8.7') // false
|
||||
semver.lt('1.2.3', '9.8.7') // true
|
||||
semver.minVersion('>=1.0.0') // '1.0.0'
|
||||
semver.valid(semver.coerce('v2')) // '2.0.0'
|
||||
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
|
||||
```
|
||||
|
||||
As a command-line utility:
|
||||
|
||||
```
|
||||
$ semver -h
|
||||
|
||||
A JavaScript implementation of the https://semver.org/ specification
|
||||
Copyright Isaac Z. Schlueter
|
||||
|
||||
Usage: semver [options] <version> [<version> [...]]
|
||||
Prints valid versions sorted by SemVer precedence
|
||||
|
||||
Options:
|
||||
-r --range <range>
|
||||
Print versions that match the specified range.
|
||||
|
||||
-i --increment [<level>]
|
||||
Increment a version by the specified level. Level can
|
||||
be one of: major, minor, patch, premajor, preminor,
|
||||
prepatch, or prerelease. Default level is 'patch'.
|
||||
Only one version may be specified.
|
||||
|
||||
--preid <identifier>
|
||||
Identifier to be used to prefix premajor, preminor,
|
||||
prepatch or prerelease version increments.
|
||||
|
||||
-l --loose
|
||||
Interpret versions and ranges loosely
|
||||
|
||||
-p --include-prerelease
|
||||
Always include prerelease versions in range matching
|
||||
|
||||
-c --coerce
|
||||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
|
||||
--rtl
|
||||
Coerce version strings right to left
|
||||
|
||||
--ltr
|
||||
Coerce version strings left to right (default)
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
If no satisfying versions are found, then exits failure.
|
||||
|
||||
Versions are printed in ascending order, so supplying
|
||||
multiple versions to the utility will just sort them.
|
||||
```
|
||||
|
||||
## Versions
|
||||
|
||||
A "version" is described by the `v2.0.0` specification found at
|
||||
<https://semver.org/>.
|
||||
|
||||
A leading `"="` or `"v"` character is stripped off and ignored.
|
||||
|
||||
## Ranges
|
||||
|
||||
A `version range` is a set of `comparators` which specify versions
|
||||
that satisfy the range.
|
||||
|
||||
A `comparator` is composed of an `operator` and a `version`. The set
|
||||
of primitive `operators` is:
|
||||
|
||||
* `<` Less than
|
||||
* `<=` Less than or equal to
|
||||
* `>` Greater than
|
||||
* `>=` Greater than or equal to
|
||||
* `=` Equal. If no operator is specified, then equality is assumed,
|
||||
so this operator is optional, but MAY be included.
|
||||
|
||||
For example, the comparator `>=1.2.7` would match the versions
|
||||
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
|
||||
or `1.1.0`.
|
||||
|
||||
Comparators can be joined by whitespace to form a `comparator set`,
|
||||
which is satisfied by the **intersection** of all of the comparators
|
||||
it includes.
|
||||
|
||||
A range is composed of one or more comparator sets, joined by `||`. A
|
||||
version matches a range if and only if every comparator in at least
|
||||
one of the `||`-separated comparator sets is satisfied by the version.
|
||||
|
||||
For example, the range `>=1.2.7 <1.3.0` would match the versions
|
||||
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
|
||||
or `1.1.0`.
|
||||
|
||||
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
|
||||
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
|
||||
|
||||
### Prerelease Tags
|
||||
|
||||
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
|
||||
it will only be allowed to satisfy comparator sets if at least one
|
||||
comparator with the same `[major, minor, patch]` tuple also has a
|
||||
prerelease tag.
|
||||
|
||||
For example, the range `>1.2.3-alpha.3` would be allowed to match the
|
||||
version `1.2.3-alpha.7`, but it would *not* be satisfied by
|
||||
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
|
||||
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
|
||||
range only accepts prerelease tags on the `1.2.3` version. The
|
||||
version `3.4.5` *would* satisfy the range, because it does not have a
|
||||
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
|
||||
|
||||
The purpose for this behavior is twofold. First, prerelease versions
|
||||
frequently are updated very quickly, and contain many breaking changes
|
||||
that are (by the author's design) not yet fit for public consumption.
|
||||
Therefore, by default, they are excluded from range matching
|
||||
semantics.
|
||||
|
||||
Second, a user who has opted into using a prerelease version has
|
||||
clearly indicated the intent to use *that specific* set of
|
||||
alpha/beta/rc versions. By including a prerelease tag in the range,
|
||||
the user is indicating that they are aware of the risk. However, it
|
||||
is still not appropriate to assume that they have opted into taking a
|
||||
similar risk on the *next* set of prerelease versions.
|
||||
|
||||
Note that this behavior can be suppressed (treating all prerelease
|
||||
versions as if they were normal versions, for the purpose of range
|
||||
matching) by setting the `includePrerelease` flag on the options
|
||||
object to any
|
||||
[functions](https://github.com/npm/node-semver#functions) that do
|
||||
range matching.
|
||||
|
||||
#### Prerelease Identifiers
|
||||
|
||||
The method `.inc` takes an additional `identifier` string argument that
|
||||
will append the value of the string as a prerelease identifier:
|
||||
|
||||
```javascript
|
||||
semver.inc('1.2.3', 'prerelease', 'beta')
|
||||
// '1.2.4-beta.0'
|
||||
```
|
||||
|
||||
command-line example:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.3 -i prerelease --preid beta
|
||||
1.2.4-beta.0
|
||||
```
|
||||
|
||||
Which then can be used to increment further:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.4-beta.0 -i prerelease
|
||||
1.2.4-beta.1
|
||||
```
|
||||
|
||||
### Advanced Range Syntax
|
||||
|
||||
Advanced range syntax desugars to primitive comparators in
|
||||
deterministic ways.
|
||||
|
||||
Advanced ranges may be combined in the same way as primitive
|
||||
comparators using white space or `||`.
|
||||
|
||||
#### Hyphen Ranges `X.Y.Z - A.B.C`
|
||||
|
||||
Specifies an inclusive set.
|
||||
|
||||
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the first version in the inclusive
|
||||
range, then the missing pieces are replaced with zeroes.
|
||||
|
||||
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the second version in the
|
||||
inclusive range, then all versions that start with the supplied parts
|
||||
of the tuple are accepted, but nothing that would be greater than the
|
||||
provided tuple parts.
|
||||
|
||||
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
|
||||
* `1.2.3 - 2` := `>=1.2.3 <3.0.0`
|
||||
|
||||
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
|
||||
|
||||
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
|
||||
numeric values in the `[major, minor, patch]` tuple.
|
||||
|
||||
* `*` := `>=0.0.0` (Any version satisfies)
|
||||
* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
|
||||
* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
|
||||
|
||||
A partial version range is treated as an X-Range, so the special
|
||||
character is in fact optional.
|
||||
|
||||
* `""` (empty string) := `*` := `>=0.0.0`
|
||||
* `1` := `1.x.x` := `>=1.0.0 <2.0.0`
|
||||
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
|
||||
|
||||
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
|
||||
|
||||
Allows patch-level changes if a minor version is specified on the
|
||||
comparator. Allows minor-level changes if not.
|
||||
|
||||
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
|
||||
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
|
||||
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
|
||||
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
|
||||
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
|
||||
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
|
||||
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
|
||||
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
|
||||
|
||||
Allows changes that do not modify the left-most non-zero element in the
|
||||
`[major, minor, patch]` tuple. In other words, this allows patch and
|
||||
minor updates for versions `1.0.0` and above, patch updates for
|
||||
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
|
||||
|
||||
Many authors treat a `0.x` version as if the `x` were the major
|
||||
"breaking-change" indicator.
|
||||
|
||||
Caret ranges are ideal when an author may make breaking changes
|
||||
between `0.2.4` and `0.3.0` releases, which is a common practice.
|
||||
However, it presumes that there will *not* be breaking changes between
|
||||
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
|
||||
additive (but non-breaking), according to commonly observed practices.
|
||||
|
||||
* `^1.2.3` := `>=1.2.3 <2.0.0`
|
||||
* `^0.2.3` := `>=0.2.3 <0.3.0`
|
||||
* `^0.0.3` := `>=0.0.3 <0.0.4`
|
||||
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the
|
||||
`0.0.3` version *only* will be allowed, if they are greater than or
|
||||
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
|
||||
|
||||
When parsing caret ranges, a missing `patch` value desugars to the
|
||||
number `0`, but will allow flexibility within that value, even if the
|
||||
major and minor versions are both `0`.
|
||||
|
||||
* `^1.2.x` := `>=1.2.0 <2.0.0`
|
||||
* `^0.0.x` := `>=0.0.0 <0.1.0`
|
||||
* `^0.0` := `>=0.0.0 <0.1.0`
|
||||
|
||||
A missing `minor` and `patch` values will desugar to zero, but also
|
||||
allow flexibility within those values, even if the major version is
|
||||
zero.
|
||||
|
||||
* `^1.x` := `>=1.0.0 <2.0.0`
|
||||
* `^0.x` := `>=0.0.0 <1.0.0`
|
||||
|
||||
### Range Grammar
|
||||
|
||||
Putting all this together, here is a Backus-Naur grammar for ranges,
|
||||
for the benefit of parser authors:
|
||||
|
||||
```bnf
|
||||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
All methods and classes take a final `options` object argument. All
|
||||
options in this object are `false` by default. The options supported
|
||||
are:
|
||||
|
||||
- `loose` Be more forgiving about not-quite-valid semver strings.
|
||||
(Any resulting output will always be 100% strict compliant, of
|
||||
course.) For backwards compatibility reasons, if the `options`
|
||||
argument is a boolean value instead of an object, it is interpreted
|
||||
to be the `loose` param.
|
||||
- `includePrerelease` Set to suppress the [default
|
||||
behavior](https://github.com/npm/node-semver#prerelease-tags) of
|
||||
excluding prerelease tagged versions from ranges unless they are
|
||||
explicitly opted into.
|
||||
|
||||
Strict-mode Comparators and Ranges will be strict about the SemVer
|
||||
strings that they parse.
|
||||
|
||||
* `valid(v)`: Return the parsed version, or null if it's not valid.
|
||||
* `inc(v, release)`: Return the version incremented by the release
|
||||
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
|
||||
`prepatch`, or `prerelease`), or null if it's not valid
|
||||
* `premajor` in one call will bump the version up to the next major
|
||||
version and down to a prerelease of that major version.
|
||||
`preminor`, and `prepatch` work the same way.
|
||||
* If called from a non-prerelease version, the `prerelease` will work the
|
||||
same as `prepatch`. It increments the patch version, then makes a
|
||||
prerelease. If the input version is already a prerelease it simply
|
||||
increments it.
|
||||
* `prerelease(v)`: Returns an array of prerelease components, or null
|
||||
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
|
||||
* `major(v)`: Return the major version number.
|
||||
* `minor(v)`: Return the minor version number.
|
||||
* `patch(v)`: Return the patch version number.
|
||||
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
|
||||
or comparators intersect.
|
||||
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
|
||||
a `SemVer` object or `null`.
|
||||
|
||||
### Comparison
|
||||
|
||||
* `gt(v1, v2)`: `v1 > v2`
|
||||
* `gte(v1, v2)`: `v1 >= v2`
|
||||
* `lt(v1, v2)`: `v1 < v2`
|
||||
* `lte(v1, v2)`: `v1 <= v2`
|
||||
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
|
||||
even if they're not the exact same string. You already know how to
|
||||
compare strings.
|
||||
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
|
||||
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
|
||||
the corresponding function above. `"==="` and `"!=="` do simple
|
||||
string comparison, but are included for completeness. Throws if an
|
||||
invalid comparison string is provided.
|
||||
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
|
||||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions
|
||||
in descending order when passed to `Array.sort()`.
|
||||
* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions
|
||||
are equal. Sorts in ascending order if passed to `Array.sort()`.
|
||||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `diff(v1, v2)`: Returns difference between two versions by the release type
|
||||
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
|
||||
or null if the versions are the same.
|
||||
|
||||
### Comparators
|
||||
|
||||
* `intersects(comparator)`: Return true if the comparators intersect
|
||||
|
||||
### Ranges
|
||||
|
||||
* `validRange(range)`: Return the valid range or null if it's not valid
|
||||
* `satisfies(version, range)`: Return true if the version satisfies the
|
||||
range.
|
||||
* `maxSatisfying(versions, range)`: Return the highest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minSatisfying(versions, range)`: Return the lowest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minVersion(range)`: Return the lowest version that can possibly match
|
||||
the given range.
|
||||
* `gtr(version, range)`: Return `true` if version is greater than all the
|
||||
versions possible in the range.
|
||||
* `ltr(version, range)`: Return `true` if version is less than all the
|
||||
versions possible in the range.
|
||||
* `outside(version, range, hilo)`: Return true if the version is outside
|
||||
the bounds of the range in either the high or low direction. The
|
||||
`hilo` argument must be either the string `'>'` or `'<'`. (This is
|
||||
the function called by `gtr` and `ltr`.)
|
||||
* `intersects(range)`: Return true if any of the ranges comparators intersect
|
||||
|
||||
Note that, since ranges may be non-contiguous, a version might not be
|
||||
greater than a range, less than a range, *or* satisfy a range! For
|
||||
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
|
||||
until `2.0.0`, so the version `1.2.10` would not be greater than the
|
||||
range (because `2.0.1` satisfies, which is higher), nor less than the
|
||||
range (since `1.2.8` satisfies, which is lower), and it also does not
|
||||
satisfy the range.
|
||||
|
||||
If you want to know if a version satisfies or does not satisfy a
|
||||
range, use the `satisfies(version, range)` function.
|
||||
|
||||
### Coercion
|
||||
|
||||
* `coerce(version, options)`: Coerces a string to semver if possible
|
||||
|
||||
This aims to provide a very forgiving translation of a non-semver string to
|
||||
semver. It looks for the first digit in a string, and consumes all
|
||||
remaining characters which satisfy at least a partial semver (e.g., `1`,
|
||||
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
|
||||
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
|
||||
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
|
||||
`3.4.0`). Only text which lacks digits will fail coercion (`version one`
|
||||
is not valid). The maximum length for any semver component considered for
|
||||
coercion is 16 characters; longer components will be ignored
|
||||
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
|
||||
semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
|
||||
components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
||||
|
||||
If the `options.rtl` flag is set, then `coerce` will return the right-most
|
||||
coercible tuple that does not share an ending index with a longer coercible
|
||||
tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
|
||||
`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
|
||||
any other overlapping SemVer tuple.
|
||||
|
||||
### Clean
|
||||
|
||||
* `clean(version)`: Clean a string to be a valid semver if possible
|
||||
|
||||
This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges.
|
||||
|
||||
ex.
|
||||
* `s.clean(' = v 2.1.5foo')`: `null`
|
||||
* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'`
|
||||
* `s.clean(' = v 2.1.5-foo')`: `null`
|
||||
* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'`
|
||||
* `s.clean('=v2.1.5')`: `'2.1.5'`
|
||||
* `s.clean(' =v2.1.5')`: `2.1.5`
|
||||
* `s.clean(' 2.1.5 ')`: `'2.1.5'`
|
||||
* `s.clean('~1.0.0')`: `null`
|
||||
174
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/semver/bin/semver.js
generated
vendored
Executable file
174
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/semver/bin/semver.js
generated
vendored
Executable file
|
|
@ -0,0 +1,174 @@
|
|||
#!/usr/bin/env node
|
||||
// Standalone semver comparison program.
|
||||
// Exits successfully and prints matching version(s) if
|
||||
// any supplied version is valid and passes all tests.
|
||||
|
||||
var argv = process.argv.slice(2)
|
||||
|
||||
var versions = []
|
||||
|
||||
var range = []
|
||||
|
||||
var inc = null
|
||||
|
||||
var version = require('../package.json').version
|
||||
|
||||
var loose = false
|
||||
|
||||
var includePrerelease = false
|
||||
|
||||
var coerce = false
|
||||
|
||||
var rtl = false
|
||||
|
||||
var identifier
|
||||
|
||||
var semver = require('../semver')
|
||||
|
||||
var reverse = false
|
||||
|
||||
var options = {}
|
||||
|
||||
main()
|
||||
|
||||
function main () {
|
||||
if (!argv.length) return help()
|
||||
while (argv.length) {
|
||||
var a = argv.shift()
|
||||
var indexOfEqualSign = a.indexOf('=')
|
||||
if (indexOfEqualSign !== -1) {
|
||||
a = a.slice(0, indexOfEqualSign)
|
||||
argv.unshift(a.slice(indexOfEqualSign + 1))
|
||||
}
|
||||
switch (a) {
|
||||
case '-rv': case '-rev': case '--rev': case '--reverse':
|
||||
reverse = true
|
||||
break
|
||||
case '-l': case '--loose':
|
||||
loose = true
|
||||
break
|
||||
case '-p': case '--include-prerelease':
|
||||
includePrerelease = true
|
||||
break
|
||||
case '-v': case '--version':
|
||||
versions.push(argv.shift())
|
||||
break
|
||||
case '-i': case '--inc': case '--increment':
|
||||
switch (argv[0]) {
|
||||
case 'major': case 'minor': case 'patch': case 'prerelease':
|
||||
case 'premajor': case 'preminor': case 'prepatch':
|
||||
inc = argv.shift()
|
||||
break
|
||||
default:
|
||||
inc = 'patch'
|
||||
break
|
||||
}
|
||||
break
|
||||
case '--preid':
|
||||
identifier = argv.shift()
|
||||
break
|
||||
case '-r': case '--range':
|
||||
range.push(argv.shift())
|
||||
break
|
||||
case '-c': case '--coerce':
|
||||
coerce = true
|
||||
break
|
||||
case '--rtl':
|
||||
rtl = true
|
||||
break
|
||||
case '--ltr':
|
||||
rtl = false
|
||||
break
|
||||
case '-h': case '--help': case '-?':
|
||||
return help()
|
||||
default:
|
||||
versions.push(a)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl }
|
||||
|
||||
versions = versions.map(function (v) {
|
||||
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
|
||||
}).filter(function (v) {
|
||||
return semver.valid(v)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
if (inc && (versions.length !== 1 || range.length)) { return failInc() }
|
||||
|
||||
for (var i = 0, l = range.length; i < l; i++) {
|
||||
versions = versions.filter(function (v) {
|
||||
return semver.satisfies(v, range[i], options)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
}
|
||||
return success(versions)
|
||||
}
|
||||
|
||||
function failInc () {
|
||||
console.error('--inc can only be used on a single version with no range')
|
||||
fail()
|
||||
}
|
||||
|
||||
function fail () { process.exit(1) }
|
||||
|
||||
function success () {
|
||||
var compare = reverse ? 'rcompare' : 'compare'
|
||||
versions.sort(function (a, b) {
|
||||
return semver[compare](a, b, options)
|
||||
}).map(function (v) {
|
||||
return semver.clean(v, options)
|
||||
}).map(function (v) {
|
||||
return inc ? semver.inc(v, inc, options, identifier) : v
|
||||
}).forEach(function (v, i, _) { console.log(v) })
|
||||
}
|
||||
|
||||
function help () {
|
||||
console.log(['SemVer ' + version,
|
||||
'',
|
||||
'A JavaScript implementation of the https://semver.org/ specification',
|
||||
'Copyright Isaac Z. Schlueter',
|
||||
'',
|
||||
'Usage: semver [options] <version> [<version> [...]]',
|
||||
'Prints valid versions sorted by SemVer precedence',
|
||||
'',
|
||||
'Options:',
|
||||
'-r --range <range>',
|
||||
' Print versions that match the specified range.',
|
||||
'',
|
||||
'-i --increment [<level>]',
|
||||
' Increment a version by the specified level. Level can',
|
||||
' be one of: major, minor, patch, premajor, preminor,',
|
||||
" prepatch, or prerelease. Default level is 'patch'.",
|
||||
' Only one version may be specified.',
|
||||
'',
|
||||
'--preid <identifier>',
|
||||
' Identifier to be used to prefix premajor, preminor,',
|
||||
' prepatch or prerelease version increments.',
|
||||
'',
|
||||
'-l --loose',
|
||||
' Interpret versions and ranges loosely',
|
||||
'',
|
||||
'-p --include-prerelease',
|
||||
' Always include prerelease versions in range matching',
|
||||
'',
|
||||
'-c --coerce',
|
||||
' Coerce a string into SemVer if possible',
|
||||
' (does not imply --loose)',
|
||||
'',
|
||||
'--rtl',
|
||||
' Coerce version strings right to left',
|
||||
'',
|
||||
'--ltr',
|
||||
' Coerce version strings left to right (default)',
|
||||
'',
|
||||
'Program exits successfully if any valid version satisfies',
|
||||
'all supplied ranges, and prints all satisfying versions.',
|
||||
'',
|
||||
'If no satisfying versions are found, then exits failure.',
|
||||
'',
|
||||
'Versions are printed in ascending order, so supplying',
|
||||
'multiple versions to the utility will just sort them.'
|
||||
].join('\n'))
|
||||
}
|
||||
38
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/semver/package.json
generated
vendored
Normal file
38
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/semver/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "semver",
|
||||
"version": "6.3.1",
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"main": "semver.js",
|
||||
"scripts": {
|
||||
"test": "tap test/ --100 --timeout=30",
|
||||
"lint": "echo linting disabled",
|
||||
"postlint": "template-oss-check",
|
||||
"template-oss-apply": "template-oss-apply --force",
|
||||
"lintfix": "npm run lint -- --fix",
|
||||
"snap": "tap test/ --100 --timeout=30",
|
||||
"posttest": "npm run lint"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@npmcli/template-oss": "4.17.0",
|
||||
"tap": "^12.7.0"
|
||||
},
|
||||
"license": "ISC",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/npm/node-semver.git"
|
||||
},
|
||||
"bin": {
|
||||
"semver": "./bin/semver.js"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"range.bnf",
|
||||
"semver.js"
|
||||
],
|
||||
"author": "GitHub Inc.",
|
||||
"templateOSS": {
|
||||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
||||
"content": "./scripts/template-oss",
|
||||
"version": "4.17.0"
|
||||
}
|
||||
}
|
||||
16
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/semver/range.bnf
generated
vendored
Normal file
16
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/semver/range.bnf
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | [1-9] ( [0-9] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
||||
1643
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/semver/semver.js
generated
vendored
Normal file
1643
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/node_modules/semver/semver.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
50
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/package.json
generated
vendored
Normal file
50
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
"name": "istanbul-lib-instrument",
|
||||
"version": "5.2.1",
|
||||
"description": "Core istanbul API for JS code coverage",
|
||||
"author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>",
|
||||
"main": "src/index.js",
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "nyc mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.12.3",
|
||||
"@babel/parser": "^7.14.7",
|
||||
"@istanbuljs/schema": "^0.1.2",
|
||||
"istanbul-lib-coverage": "^3.2.0",
|
||||
"semver": "^6.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.7.5",
|
||||
"chai": "^4.2.0",
|
||||
"clone": "^2.1.2",
|
||||
"debug": "^4.1.1",
|
||||
"documentation": "^12.1.4",
|
||||
"js-yaml": "^3.13.1",
|
||||
"mocha": "^6.2.3",
|
||||
"nopt": "^4.0.1",
|
||||
"nyc": "^15.1.0"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"bugs": {
|
||||
"url": "https://github.com/istanbuljs/istanbuljs/issues"
|
||||
},
|
||||
"homepage": "https://istanbul.js.org/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git",
|
||||
"directory": "packages/istanbul-lib-instrument"
|
||||
},
|
||||
"keywords": [
|
||||
"coverage",
|
||||
"istanbul",
|
||||
"js",
|
||||
"instrumentation"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
}
|
||||
14
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/src/constants.js
generated
vendored
Normal file
14
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/src/constants.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
const { createHash } = require('crypto');
|
||||
const { name } = require('../package.json');
|
||||
// TODO: increment this version if there are schema changes
|
||||
// that are not backwards compatible:
|
||||
const VERSION = '4';
|
||||
|
||||
const SHA = 'sha1';
|
||||
module.exports = {
|
||||
SHA,
|
||||
MAGIC_KEY: '_coverageSchema',
|
||||
MAGIC_VALUE: createHash(SHA)
|
||||
.update(name + '@' + VERSION)
|
||||
.digest('hex')
|
||||
};
|
||||
21
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/src/index.js
generated
vendored
Normal file
21
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/src/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
const { defaults } = require('@istanbuljs/schema');
|
||||
const Instrumenter = require('./instrumenter');
|
||||
const programVisitor = require('./visitor');
|
||||
const readInitialCoverage = require('./read-coverage');
|
||||
|
||||
/**
|
||||
* createInstrumenter creates a new instrumenter with the
|
||||
* supplied options.
|
||||
* @param {Object} opts - instrumenter options. See the documentation
|
||||
* for the Instrumenter class.
|
||||
*/
|
||||
function createInstrumenter(opts) {
|
||||
return new Instrumenter(opts);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createInstrumenter,
|
||||
programVisitor,
|
||||
readInitialCoverage,
|
||||
defaultOpts: defaults.instrumenter
|
||||
};
|
||||
162
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/src/instrumenter.js
generated
vendored
Normal file
162
backend/node_modules/jest-snapshot/node_modules/istanbul-lib-instrument/src/instrumenter.js
generated
vendored
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
const { transformSync } = require('@babel/core');
|
||||
const { defaults } = require('@istanbuljs/schema');
|
||||
const programVisitor = require('./visitor');
|
||||
const readInitialCoverage = require('./read-coverage');
|
||||
|
||||
/**
|
||||
* Instrumenter is the public API for the instrument library.
|
||||
* It is typically used for ES5 code. For ES6 code that you
|
||||
* are already running under `babel` use the coverage plugin
|
||||
* instead.
|
||||
* @param {Object} opts optional.
|
||||
* @param {string} [opts.coverageVariable=__coverage__] name of global coverage variable.
|
||||
* @param {boolean} [opts.reportLogic=false] report boolean value of logical expressions.
|
||||
* @param {boolean} [opts.preserveComments=false] preserve comments in output.
|
||||
* @param {boolean} [opts.compact=true] generate compact code.
|
||||
* @param {boolean} [opts.esModules=false] set to true to instrument ES6 modules.
|
||||
* @param {boolean} [opts.autoWrap=false] set to true to allow `return` statements outside of functions.
|
||||
* @param {boolean} [opts.produceSourceMap=false] set to true to produce a source map for the instrumented code.
|
||||
* @param {Array} [opts.ignoreClassMethods=[]] set to array of class method names to ignore for coverage.
|
||||
* @param {Function} [opts.sourceMapUrlCallback=null] a callback function that is called when a source map URL
|
||||
* is found in the original code. This function is called with the source file name and the source map URL.
|
||||
* @param {boolean} [opts.debug=false] - turn debugging on.
|
||||
* @param {array} [opts.parserPlugins] - set babel parser plugins, see @istanbuljs/schema for defaults.
|
||||
* @param {string} [opts.coverageGlobalScope=this] the global coverage variable scope.
|
||||
* @param {boolean} [opts.coverageGlobalScopeFunc=true] use an evaluated function to find coverageGlobalScope.
|
||||
*/
|
||||
class Instrumenter {
|
||||
constructor(opts = {}) {
|
||||
this.opts = {
|
||||
...defaults.instrumenter,
|
||||
...opts
|
||||
};
|
||||
this.fileCoverage = null;
|
||||
this.sourceMap = null;
|
||||
}
|
||||
/**
|
||||
* instrument the supplied code and track coverage against the supplied
|
||||
* filename. It throws if invalid code is passed to it. ES5 and ES6 syntax
|
||||
* is supported. To instrument ES6 modules, make sure that you set the
|
||||
* `esModules` property to `true` when creating the instrumenter.
|
||||
*
|
||||
* @param {string} code - the code to instrument
|
||||
* @param {string} filename - the filename against which to track coverage.
|
||||
* @param {object} [inputSourceMap] - the source map that maps the not instrumented code back to it's original form.
|
||||
* Is assigned to the coverage object and therefore, is available in the json output and can be used to remap the
|
||||
* coverage to the untranspiled source.
|
||||
* @returns {string} the instrumented code.
|
||||
*/
|
||||
instrumentSync(code, filename, inputSourceMap) {
|
||||
if (typeof code !== 'string') {
|
||||
throw new Error('Code must be a string');
|
||||
}
|
||||
filename = filename || String(new Date().getTime()) + '.js';
|
||||
const { opts } = this;
|
||||
let output = {};
|
||||
const babelOpts = {
|
||||
configFile: false,
|
||||
babelrc: false,
|
||||
ast: true,
|
||||
filename: filename || String(new Date().getTime()) + '.js',
|
||||
inputSourceMap,
|
||||
sourceMaps: opts.produceSourceMap,
|
||||
compact: opts.compact,
|
||||
comments: opts.preserveComments,
|
||||
parserOpts: {
|
||||
allowReturnOutsideFunction: opts.autoWrap,
|
||||
sourceType: opts.esModules ? 'module' : 'script',
|
||||
plugins: opts.parserPlugins
|
||||
},
|
||||
plugins: [
|
||||
[
|
||||
({ types }) => {
|
||||
const ee = programVisitor(types, filename, {
|
||||
coverageVariable: opts.coverageVariable,
|
||||
reportLogic: opts.reportLogic,
|
||||
coverageGlobalScope: opts.coverageGlobalScope,
|
||||
coverageGlobalScopeFunc:
|
||||
opts.coverageGlobalScopeFunc,
|
||||
ignoreClassMethods: opts.ignoreClassMethods,
|
||||
inputSourceMap
|
||||
});
|
||||
|
||||
return {
|
||||
visitor: {
|
||||
Program: {
|
||||
enter: ee.enter,
|
||||
exit(path) {
|
||||
output = ee.exit(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
|
||||
const codeMap = transformSync(code, babelOpts);
|
||||
|
||||
if (!output || !output.fileCoverage) {
|
||||
const initialCoverage =
|
||||
readInitialCoverage(codeMap.ast) ||
|
||||
/* istanbul ignore next: paranoid check */ {};
|
||||
this.fileCoverage = initialCoverage.coverageData;
|
||||
this.sourceMap = inputSourceMap;
|
||||
return code;
|
||||
}
|
||||
|
||||
this.fileCoverage = output.fileCoverage;
|
||||
this.sourceMap = codeMap.map;
|
||||
const cb = this.opts.sourceMapUrlCallback;
|
||||
if (cb && output.sourceMappingURL) {
|
||||
cb(filename, output.sourceMappingURL);
|
||||
}
|
||||
|
||||
return codeMap.code;
|
||||
}
|
||||
/**
|
||||
* callback-style instrument method that calls back with an error
|
||||
* as opposed to throwing one. Note that in the current implementation,
|
||||
* the callback will be called in the same process tick and is not asynchronous.
|
||||
*
|
||||
* @param {string} code - the code to instrument
|
||||
* @param {string} filename - the filename against which to track coverage.
|
||||
* @param {Function} callback - the callback
|
||||
* @param {Object} inputSourceMap - the source map that maps the not instrumented code back to it's original form.
|
||||
* Is assigned to the coverage object and therefore, is available in the json output and can be used to remap the
|
||||
* coverage to the untranspiled source.
|
||||
*/
|
||||
instrument(code, filename, callback, inputSourceMap) {
|
||||
if (!callback && typeof filename === 'function') {
|
||||
callback = filename;
|
||||
filename = null;
|
||||
}
|
||||
try {
|
||||
const out = this.instrumentSync(code, filename, inputSourceMap);
|
||||
callback(null, out);
|
||||
} catch (ex) {
|
||||
callback(ex);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* returns the file coverage object for the last file instrumented.
|
||||
* @returns {Object} the file coverage object.
|
||||
*/
|
||||
lastFileCoverage() {
|
||||
return this.fileCoverage;
|
||||
}
|
||||
/**
|
||||
* returns the source map produced for the last file instrumented.
|
||||
* @returns {null|Object} the source map object.
|
||||
*/
|
||||
lastSourceMap() {
|
||||
return this.sourceMap;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Instrumenter;
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue