Change endpoint from persons to people

This commit is contained in:
xfarrow
2025-03-23 21:00:08 +01:00
parent 4ae263662c
commit d005193f63
7158 changed files with 700476 additions and 735 deletions

21
backend/apis/nodejs/node_modules/create-jest/LICENSE generated vendored Normal file
View 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.

11
backend/apis/nodejs/node_modules/create-jest/README.md generated vendored Normal file
View File

@ -0,0 +1,11 @@
# create-jest
> Getting started with Jest with a single command
```bash
npm init jest@latest
# Or for Yarn
yarn create jest
# Or for pnpm
pnpm create jest
```

View File

@ -0,0 +1,8 @@
#!/usr/bin/env node
/**
* 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.
*/
require('..').runCLI();

View File

@ -0,0 +1,31 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.NotFoundPackageJsonError = exports.MalformedPackageJsonError = 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.
*/
class NotFoundPackageJsonError extends Error {
constructor(rootDir) {
super(`Could not find a "package.json" file in ${rootDir}`);
this.name = '';
// eslint-disable-next-line @typescript-eslint/no-empty-function
Error.captureStackTrace(this, () => {});
}
}
exports.NotFoundPackageJsonError = NotFoundPackageJsonError;
class MalformedPackageJsonError extends Error {
constructor(packageJsonPath) {
super(`There is malformed json in ${packageJsonPath}`);
this.name = '';
// eslint-disable-next-line @typescript-eslint/no-empty-function
Error.captureStackTrace(this, () => {});
}
}
exports.MalformedPackageJsonError = MalformedPackageJsonError;

View File

@ -0,0 +1,92 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _jestConfig() {
const data = require('jest-config');
_jestConfig = 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 stringifyOption = (option, map, linePrefix = '') => {
const description = _jestConfig().descriptions[option];
const optionDescription =
description != null && description.length > 0 ? ` // ${description}` : '';
const stringifiedObject = `${option}: ${JSON.stringify(
map[option],
null,
2
)}`;
return `${optionDescription}\n${stringifiedObject
.split('\n')
.map(line => ` ${linePrefix}${line}`)
.join('\n')},`;
};
const generateConfigFile = (results, generateEsm = false) => {
const {useTypescript, coverage, coverageProvider, clearMocks, environment} =
results;
const overrides = {};
if (coverage) {
Object.assign(overrides, {
collectCoverage: true,
coverageDirectory: 'coverage'
});
}
if (coverageProvider === 'v8') {
Object.assign(overrides, {
coverageProvider: 'v8'
});
}
if (environment === 'jsdom') {
Object.assign(overrides, {
testEnvironment: 'jsdom'
});
}
if (clearMocks) {
Object.assign(overrides, {
clearMocks: true
});
}
const overrideKeys = Object.keys(overrides);
const properties = [];
for (const option in _jestConfig().descriptions) {
const opt = option;
if (overrideKeys.includes(opt)) {
properties.push(stringifyOption(opt, overrides));
} else {
properties.push(stringifyOption(opt, _jestConfig().defaults, '// '));
}
}
const configHeaderMessage = `/**
* For a detailed explanation regarding each configuration property, visit:
* https://jestjs.io/docs/configuration
*/
`;
const jsDeclaration = `/** @type {import('jest').Config} */
const config = {`;
const tsDeclaration = `import type {Config} from 'jest';
const config: Config = {`;
const cjsExport = 'module.exports = config;';
const esmExport = 'export default config;';
return [
configHeaderMessage,
useTypescript ? tsDeclaration : jsDeclaration,
properties.join('\n\n'),
'};\n',
useTypescript || generateEsm ? esmExport : cjsExport,
''
].join('\n');
};
var _default = generateConfigFile;
exports.default = _default;

View File

@ -0,0 +1,12 @@
/**
* 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.
*/
export declare function runCLI(): Promise<void>;
export declare function runCreate(rootDir?: string): Promise<void>;
export {};

View File

@ -0,0 +1,18 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
Object.defineProperty(exports, 'runCLI', {
enumerable: true,
get: function () {
return _runCreate.runCLI;
}
});
Object.defineProperty(exports, 'runCreate', {
enumerable: true,
get: function () {
return _runCreate.runCreate;
}
});
var _runCreate = require('./runCreate');

View File

@ -0,0 +1,26 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
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 modifyPackageJson = ({projectPackageJson, shouldModifyScripts}) => {
if (shouldModifyScripts) {
projectPackageJson.scripts
? (projectPackageJson.scripts.test = 'jest')
: (projectPackageJson.scripts = {
test: 'jest'
});
}
delete projectPackageJson.jest;
return `${JSON.stringify(projectPackageJson, null, 2)}\n`;
};
var _default = modifyPackageJson;
exports.default = _default;

View File

@ -0,0 +1,76 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.testScriptQuestion = 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 defaultQuestions = [
{
initial: false,
message: 'Would you like to use Typescript for the configuration file?',
name: 'useTypescript',
type: 'confirm'
},
{
choices: [
{
title: 'node',
value: 'node'
},
{
title: 'jsdom (browser-like)',
value: 'jsdom'
}
],
initial: 0,
message: 'Choose the test environment that will be used for testing',
name: 'environment',
type: 'select'
},
{
initial: false,
message: 'Do you want Jest to add coverage reports?',
name: 'coverage',
type: 'confirm'
},
{
choices: [
{
title: 'v8',
value: 'v8'
},
{
title: 'babel',
value: 'babel'
}
],
initial: 0,
message: 'Which provider should be used to instrument code for coverage?',
name: 'coverageProvider',
type: 'select'
},
{
initial: false,
message:
'Automatically clear mock calls, instances, contexts and results before every test?',
name: 'clearMocks',
type: 'confirm'
}
];
var _default = defaultQuestions;
exports.default = _default;
const testScriptQuestion = {
initial: true,
message:
'Would you like to use Jest when running "test" script in "package.json"?',
name: 'scripts',
type: 'confirm'
};
exports.testScriptQuestion = testScriptQuestion;

View File

@ -0,0 +1,237 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.runCLI = runCLI;
exports.runCreate = runCreate;
function path() {
const data = _interopRequireWildcard(require('path'));
path = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _exit() {
const data = _interopRequireDefault(require('exit'));
_exit = function () {
return data;
};
return data;
}
function fs() {
const data = _interopRequireWildcard(require('graceful-fs'));
fs = function () {
return data;
};
return data;
}
function _prompts() {
const data = _interopRequireDefault(require('prompts'));
_prompts = function () {
return data;
};
return data;
}
function _jestConfig() {
const data = require('jest-config');
_jestConfig = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
var _errors = require('./errors');
var _generateConfigFile = _interopRequireDefault(
require('./generateConfigFile')
);
var _modifyPackageJson = _interopRequireDefault(require('./modifyPackageJson'));
var _questions = _interopRequireWildcard(require('./questions'));
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 {
JEST_CONFIG_BASE_NAME,
JEST_CONFIG_EXT_MJS,
JEST_CONFIG_EXT_JS,
JEST_CONFIG_EXT_TS,
JEST_CONFIG_EXT_ORDER,
PACKAGE_JSON
} = _jestConfig().constants;
const getConfigFilename = ext => JEST_CONFIG_BASE_NAME + ext;
async function runCLI() {
try {
const rootDir = process.argv[2];
await runCreate(rootDir);
} catch (error) {
(0, _jestUtil().clearLine)(process.stderr);
(0, _jestUtil().clearLine)(process.stdout);
if (error instanceof Error && Boolean(error?.stack)) {
console.error(_chalk().default.red(error.stack));
} else {
console.error(_chalk().default.red(error));
}
(0, _exit().default)(1);
throw error;
}
}
async function runCreate(rootDir = process.cwd()) {
rootDir = (0, _jestUtil().tryRealpath)(rootDir);
// prerequisite checks
const projectPackageJsonPath = path().join(rootDir, PACKAGE_JSON);
if (!fs().existsSync(projectPackageJsonPath)) {
throw new _errors.NotFoundPackageJsonError(rootDir);
}
const questions = _questions.default.slice(0);
let hasJestProperty = false;
let projectPackageJson;
try {
projectPackageJson = JSON.parse(
fs().readFileSync(projectPackageJsonPath, 'utf-8')
);
} catch {
throw new _errors.MalformedPackageJsonError(projectPackageJsonPath);
}
if (projectPackageJson.jest) {
hasJestProperty = true;
}
const existingJestConfigExt = JEST_CONFIG_EXT_ORDER.find(ext =>
fs().existsSync(path().join(rootDir, getConfigFilename(ext)))
);
if (hasJestProperty || existingJestConfigExt != null) {
const result = await (0, _prompts().default)({
initial: true,
message:
'It seems that you already have a jest configuration, do you want to override it?',
name: 'continue',
type: 'confirm'
});
if (!result.continue) {
console.log();
console.log('Aborting...');
return;
}
}
// Add test script installation only if needed
if (
!projectPackageJson.scripts ||
projectPackageJson.scripts.test !== 'jest'
) {
questions.unshift(_questions.testScriptQuestion);
}
// Start the init process
console.log();
console.log(
_chalk().default.underline(
'The following questions will help Jest to create a suitable configuration for your project\n'
)
);
let promptAborted = false;
const results = await (0, _prompts().default)(questions, {
onCancel: () => {
promptAborted = true;
}
});
if (promptAborted) {
console.log();
console.log('Aborting...');
return;
}
// Determine if Jest should use JS or TS for the config file
const jestConfigFileExt = results.useTypescript
? JEST_CONFIG_EXT_TS
: projectPackageJson.type === 'module'
? JEST_CONFIG_EXT_MJS
: JEST_CONFIG_EXT_JS;
// Determine Jest config path
const jestConfigPath =
existingJestConfigExt != null
? getConfigFilename(existingJestConfigExt)
: path().join(rootDir, getConfigFilename(jestConfigFileExt));
const shouldModifyScripts = results.scripts;
if (shouldModifyScripts || hasJestProperty) {
const modifiedPackageJson = (0, _modifyPackageJson.default)({
projectPackageJson,
shouldModifyScripts
});
fs().writeFileSync(projectPackageJsonPath, modifiedPackageJson);
console.log('');
console.log(
`✏️ Modified ${_chalk().default.cyan(projectPackageJsonPath)}`
);
}
const generatedConfig = (0, _generateConfigFile.default)(
results,
projectPackageJson.type === 'module' ||
jestConfigPath.endsWith(JEST_CONFIG_EXT_MJS)
);
fs().writeFileSync(jestConfigPath, generatedConfig);
console.log('');
console.log(
`📝 Configuration file created at ${_chalk().default.cyan(jestConfigPath)}`
);
}

View File

@ -0,0 +1 @@
'use strict';

View File

@ -0,0 +1,43 @@
{
"name": "create-jest",
"description": "Create a new Jest project",
"version": "29.7.0",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/create-jest"
},
"license": "MIT",
"bin": "./bin/create-jest.js",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"default": "./build/index.js"
},
"./package.json": "./package.json",
"./bin/create-jest": "./bin/create-jest.js"
},
"dependencies": {
"@jest/types": "^29.6.3",
"chalk": "^4.0.0",
"exit": "^0.1.2",
"graceful-fs": "^4.2.9",
"jest-config": "^29.7.0",
"jest-util": "^29.7.0",
"prompts": "^2.0.1"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@types/exit": "^0.1.30",
"@types/graceful-fs": "^4.1.3",
"@types/prompts": "^2.0.1"
},
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
}