From d04a4450726d0e1a1b7ff450af9e2ac633c44981 Mon Sep 17 00:00:00 2001 From: Patrick Moody <4031292+patmood@users.noreply.github.com> Date: Fri, 18 Nov 2022 21:06:55 -0800 Subject: [PATCH] Support PocketBase v0.8 (#19) * add v0.8 schema * update system fields to handle base and auth collection types * handle relation fields with multiple items * create enums for select fields that have values * additional typecheck * add user field for backwards compatability * refactor strings * refactor system types * readme * Add lint and formatting (#17) * add linting and formatting * lint codebase * prettier * update test workflow * update test workflow again * fix: url login for pocketbase 0.8.0-rc2 servers (#16) Co-authored-by: Ethan Olsen * e2e integration test (#18) * add dockerfile to run e2e tests * add db typegen * cleanup * add test * add github workflow * remove interactive flag * intentionally fail integration test * save artifacts in case of failing tests * fix output dir * ignore files Co-authored-by: Ethan Olsen <46045126+o2dependent@users.noreply.github.com> Co-authored-by: Ethan Olsen --- .eslintrc.json | 22 + .github/workflows/integration.yml | 32 + .github/workflows/test.yml | 20 +- .prettierignore | 4 + Dockerfile | 33 + README.md | 23 +- dist/index.js | 148 +- package-lock.json | 2035 ++++++++++++++++- package.json | 27 +- src/constants.ts | 30 +- src/lib.ts | 157 +- src/schema.ts | 10 +- src/types.ts | 1 + src/utils.ts | 9 + test/__snapshots__/fromJSON.test.ts.snap | 96 + test/__snapshots__/integration.test.ts.snap | 65 - test/__snapshots__/lib.test.ts.snap | 37 +- .../{integration.test.ts => fromJSON.test.ts} | 0 test/integration/integration.js | 24 + test/integration/pb_data/data.db | Bin 0 -> 172032 bytes test/integration/run.sh | 14 + test/lib.test.ts | 167 +- test/pb_schema.json | 266 ++- test/pocketbase-types-example.ts | 99 +- test/typecheck.ts | 26 +- test/utils.test.ts | 23 +- 26 files changed, 2950 insertions(+), 418 deletions(-) create mode 100644 .eslintrc.json create mode 100644 .github/workflows/integration.yml create mode 100644 .prettierignore create mode 100644 Dockerfile create mode 100644 test/__snapshots__/fromJSON.test.ts.snap delete mode 100644 test/__snapshots__/integration.test.ts.snap rename test/{integration.test.ts => fromJSON.test.ts} (100%) create mode 100644 test/integration/integration.js create mode 100644 test/integration/pb_data/data.db create mode 100644 test/integration/run.sh diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..2b3b105 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,22 @@ +{ + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "eslint-config-prettier" + ], + "overrides": [], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": ["@typescript-eslint"], + "rules": { + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/ban-ts-comment": "off" + } +} diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 0000000..822f5f8 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,32 @@ +name: Integration Test + +on: + push: + branches: [main, rc] + pull_request: + branches: "**" + +jobs: + test: + timeout-minutes: 5 + runs-on: ubuntu-latest + env: + CI: true + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run in docker + run: | + docker build . -t pocketbase-typegen:latest + docker run --name integration_test pocketbase-typegen:latest + mkdir -p output + docker cp integration_test:/app/output output + + - name: Archive generated type results + uses: actions/upload-artifact@v3 + with: + name: generated-types + path: output/* + retention-days: 5 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 51d6e22..90995f6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,9 +2,9 @@ name: Test on: push: - branches: [ main ] + branches: [main, rc] pull_request: - branches: [ main ] + branches: "**" jobs: test: @@ -17,11 +17,11 @@ jobs: node-version: [16.x] steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci - - run: npm run build - - run: npm test + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm run build + - run: npm test diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..7130288 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +dist +coverage +test/pocketbase-types-example.ts +pocketbase-types.ts \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b84373d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# Dockerfile to run e2e integration tests against a test PocketBase server +FROM node:16-alpine3.16 + +ARG POCKETBASE_VERSION=0.8.0-rc2 + +WORKDIR /app/output/ +WORKDIR /app/ + +# Install the dependencies +RUN apk add --no-cache \ + ca-certificates \ + unzip \ + wget \ + zip \ + zlib-dev + +# Download Pocketbase and install it +ADD https://github.com/pocketbase/pocketbase/releases/download/v${POCKETBASE_VERSION}/pocketbase_${POCKETBASE_VERSION}_linux_amd64.zip /tmp/pocketbase.zip +RUN unzip /tmp/pocketbase.zip -d /app/ + +COPY package.json package-lock.json ./ +RUN npm ci + +# Copy test files +COPY test/integration ./ +COPY test/pocketbase-types-example.ts ./ +COPY dist/index.js ./dist/index.js + +RUN chmod +x ./pocketbase +RUN chmod +x ./run.sh +EXPOSE 8090 + +CMD [ "./run.sh" ] diff --git a/README.md b/README.md index b1e5ba0..42d63d9 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,12 @@ Generate typescript definitions from your [pocketbase.io](https://pocketbase.io/ This will produce types for all your PocketBase collections to use in your frontend typescript codebase. +## Versions + +When using PocketBase v0.8.x, use `pocketbase-typegen` v1.1.x + +Users of PocketBase v0.7.x should use `pocketbase-typegen` v1.0.x + ## Usage ``` @@ -38,11 +44,18 @@ URL example: The output is a typescript file `pocketbase-types.ts` ([example](./test/pocketbase-types-example.ts)) which will contain: -- An enum of all collections -- One type for each collection (eg `ProfilesRecord`) -- One response type for each collection (eg `ProfilesResponse`) which includes base fields like id, updated, created -- A type `CollectionRecords` mapping each collection name to the record type +- `Collections` An enum of all collections/ +- `[CollectionName]Record` One type for each collection (eg ProfilesRecord)/ +- `[CollectionName]Response` One response type for each collection (eg ProfilesResponse) which includes system fields. This is what is returned from the PocketBase API. + - `[CollectionName][FieldName]Options` If the collection contains a select field with set values, an enum of the options will be generated. +- `CollectionRecords` A type mapping each collection name to the record type. + +## Example usage In the upcoming [PocketBase SDK](https://github.com/pocketbase/js-sdk) v0.8 you will be able to use generic types when fetching records, eg: -`pb.collection('tasks').getOne("RECORD_ID") // -> results in Promise` +```typescript +import { Collections, TasksResponse } from "./pocketbase-types" + +pb.collection(Collections.Tasks).getOne("RECORD_ID") // -> results in Promise +``` diff --git a/dist/index.js b/dist/index.js index 22d106a..f2edce4 100755 --- a/dist/index.js +++ b/dist/index.js @@ -23,36 +23,46 @@ async function fromJSON(path) { } async function fromURL(url, email = "", password = "") { const formData = new FormData(); - formData.append("email", email); + formData.append("identity", email); formData.append("password", password); - const { token } = await fetch(`${url}/api/admins/auth-via-email`, { + const { token } = await fetch(`${url}/api/admins/auth-with-password`, { method: "post", body: formData }).then((res) => res.json()); const result = await fetch(`${url}/api/collections?perPage=200`, { headers: { - Authorization: `Admin ${token}` + Authorization: token } }).then((res) => res.json()); return result.items; } // src/constants.ts -var EXPORT_COMMENT = `// This file was @generated using pocketbase-typegen`; +var EXPORT_COMMENT = `/** +* This file was @generated using pocketbase-typegen +*/`; +var RECORD_TYPE_COMMENT = `// Record types for each collection`; +var RESPONSE_TYPE_COMMENT = `// Response types include system fields and match responses from the PocketBase API`; var DATE_STRING_TYPE_NAME = `IsoDateString`; -var DATE_STRING_TYPE_DEFINITION = `export type ${DATE_STRING_TYPE_NAME} = string`; var RECORD_ID_STRING_NAME = `RecordIdString`; -var RECORD_ID_STRING_DEFINITION = `export type ${RECORD_ID_STRING_NAME} = string`; -var USER_ID_STRING_NAME = `UserIdString`; -var USER_ID_STRING_DEFINITION = `export type ${USER_ID_STRING_NAME} = string`; -var BASE_RECORD_DEFINITION = `export type BaseRecord = { +var ALIAS_TYPE_DEFINITIONS = `// Alias types for improved usability +export type ${DATE_STRING_TYPE_NAME} = string +export type ${RECORD_ID_STRING_NAME} = string`; +var BASE_SYSTEM_FIELDS_DEFINITION = `// System fields +export type BaseSystemFields = { id: ${RECORD_ID_STRING_NAME} created: ${DATE_STRING_TYPE_NAME} updated: ${DATE_STRING_TYPE_NAME} - "@collectionId": string - "@collectionName": string - "@expand"?: { [key: string]: any } + collectionId: string + collectionName: Collections + expand?: { [key: string]: any } }`; +var AUTH_SYSTEM_FIELDS_DEFINITION = `export type AuthSystemFields = { + email: string + emailVisibility: boolean + username: string + verified: boolean +} & BaseSystemFields`; // src/generics.ts function fieldNameToGeneric(name) { @@ -93,6 +103,12 @@ async function saveFile(outPath, typeString) { await fs2.writeFile(outPath, typeString, "utf8"); console.log(`Created typescript definitions at ${outPath}`); } +function getSystemFields(type) { + return type === "auth" ? "AuthSystemFields" : "BaseSystemFields"; +} +function getOptionEnumName(recordName, fieldName) { + return `${toPascalCase(recordName)}${toPascalCase(fieldName)}Options`; +} // src/lib.ts var pbSchemaTypescriptMap = { @@ -102,82 +118,98 @@ var pbSchemaTypescriptMap = { email: "string", url: "string", date: DATE_STRING_TYPE_NAME, - select: (fieldSchema) => fieldSchema.options.values ? fieldSchema.options.values.map((val) => `"${val}"`).join(" | ") : "string", + select: (fieldSchema, collectionName) => fieldSchema.options.values ? getOptionEnumName(collectionName, fieldSchema.name) : "string", json: (fieldSchema) => `null | ${fieldNameToGeneric(fieldSchema.name)}`, file: (fieldSchema) => fieldSchema.options.maxSelect && fieldSchema.options.maxSelect > 1 ? "string[]" : "string", - relation: RECORD_ID_STRING_NAME, - user: USER_ID_STRING_NAME + relation: (fieldSchema) => fieldSchema.options.maxSelect && fieldSchema.options.maxSelect > 1 ? `${RECORD_ID_STRING_NAME}[]` : RECORD_ID_STRING_NAME, + user: (fieldSchema) => fieldSchema.options.maxSelect && fieldSchema.options.maxSelect > 1 ? `${RECORD_ID_STRING_NAME}[]` : RECORD_ID_STRING_NAME }; function generate(results) { const collectionNames = []; const recordTypes = []; - results.forEach((row) => { + const responseTypes = [RESPONSE_TYPE_COMMENT]; + results.sort((a, b) => { + if (a.name < b.name) { + return -1; + } + if (a.name > b.name) { + return 1; + } + return 0; + }).forEach((row) => { if (row.name) collectionNames.push(row.name); if (row.schema) { recordTypes.push(createRecordType(row.name, row.schema)); - recordTypes.push(createResponseType(row.name, row.schema)); + responseTypes.push(createResponseType(row)); } }); - const sortedCollectionNames = collectionNames.sort(); + const sortedCollectionNames = collectionNames; const fileParts = [ EXPORT_COMMENT, - DATE_STRING_TYPE_DEFINITION, - RECORD_ID_STRING_DEFINITION, - USER_ID_STRING_DEFINITION, - BASE_RECORD_DEFINITION, createCollectionEnum(sortedCollectionNames), - ...recordTypes.sort(), - createCollectionRecord(sortedCollectionNames) + ALIAS_TYPE_DEFINITIONS, + BASE_SYSTEM_FIELDS_DEFINITION, + AUTH_SYSTEM_FIELDS_DEFINITION, + RECORD_TYPE_COMMENT, + ...recordTypes, + responseTypes.join("\n"), + createCollectionRecords(sortedCollectionNames) ]; return fileParts.join("\n\n"); } function createCollectionEnum(collectionNames) { - let typeString = `export enum Collections { -`; - collectionNames.forEach((name) => { - typeString += ` ${toPascalCase(name)} = "${name}", -`; - }); - typeString += `}`; + const collections = collectionNames.map((name) => ` ${toPascalCase(name)} = "${name}",`).join("\n"); + const typeString = `export enum Collections { +${collections} +}`; return typeString; } -function createCollectionRecord(collectionNames) { - let typeString = `export type CollectionRecords = { -`; - collectionNames.forEach((name) => { - typeString += ` ${name}: ${toPascalCase(name)}Record -`; - }); - typeString += `}`; - return typeString; +function createCollectionRecords(collectionNames) { + const nameRecordMap = collectionNames.map((name) => ` ${name}: ${toPascalCase(name)}Record`).join("\n"); + return `export type CollectionRecords = { +${nameRecordMap} +}`; } function createRecordType(name, schema) { - let typeString = `export type ${toPascalCase( - name - )}Record${getGenericArgStringWithDefault(schema)} = { -`; - schema.forEach((fieldSchema) => { - typeString += createTypeField(fieldSchema); - }); - typeString += `}`; - return typeString; + const selectOptionEnums = createSelectOptions(name, schema); + const typeName = toPascalCase(name); + const genericArgs = getGenericArgStringWithDefault(schema); + const fields = schema.map((fieldSchema) => createTypeField(name, fieldSchema)).join("\n"); + return `${selectOptionEnums}export type ${typeName}Record${genericArgs} = { +${fields} +}`; } -function createResponseType(name, schema) { +function createResponseType(collectionSchemaEntry) { + const { name, schema, type } = collectionSchemaEntry; const pascaleName = toPascalCase(name); - let typeString = `export type ${pascaleName}Response${getGenericArgStringWithDefault( - schema - )} = ${pascaleName}Record${getGenericArgString(schema)} & BaseRecord`; - return typeString; + const genericArgsWithDefaults = getGenericArgStringWithDefault(schema); + const genericArgs = getGenericArgString(schema); + const systemFields = getSystemFields(type); + return `export type ${pascaleName}Response${genericArgsWithDefaults} = ${pascaleName}Record${genericArgs} & ${systemFields}`; } -function createTypeField(fieldSchema) { +function createTypeField(collectionName, fieldSchema) { if (!(fieldSchema.type in pbSchemaTypescriptMap)) { throw new Error(`unknown type ${fieldSchema.type} found in schema`); } const typeStringOrFunc = pbSchemaTypescriptMap[fieldSchema.type]; - const typeString = typeof typeStringOrFunc === "function" ? typeStringOrFunc(fieldSchema) : typeStringOrFunc; - return ` ${sanitizeFieldName(fieldSchema.name)}${fieldSchema.required ? "" : "?"}: ${typeString} + const typeString = typeof typeStringOrFunc === "function" ? typeStringOrFunc(fieldSchema, collectionName) : typeStringOrFunc; + const fieldName = sanitizeFieldName(fieldSchema.name); + const required = fieldSchema.required ? "" : "?"; + return ` ${fieldName}${required}: ${typeString}`; +} +function createSelectOptions(recordName, schema) { + const selectFields = schema.filter((field) => field.type === "select"); + const typestring = selectFields.map( + (field) => { + var _a; + return `export enum ${getOptionEnumName(recordName, field.name)} { +${(_a = field.options.values) == null ? void 0 : _a.map((val) => ` ${val} = "${val}",`).join("\n")} +} `; + } + ).join("\n"); + return typestring; } // src/cli.ts @@ -203,7 +235,7 @@ async function main(options2) { import { program } from "commander"; // package.json -var version = "1.0.12"; +var version = "1.1.0"; // src/index.ts program.name("Pocketbase Typegen").version(version).description( diff --git a/package-lock.json b/package-lock.json index d10f0f5..d79c5f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pocketbase-typegen", - "version": "1.0.3", + "version": "1.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pocketbase-typegen", - "version": "1.0.3", + "version": "1.1.0", "license": "ISC", "dependencies": { "commander": "^9.4.1", @@ -21,10 +21,16 @@ "devDependencies": { "@types/jest": "^29.1.2", "@types/node": "^18.8.3", + "@typescript-eslint/eslint-plugin": "^5.42.1", + "@typescript-eslint/parser": "^5.42.1", "esbuild": "^0.15.11", "esbuild-node-externals": "^1.5.0", + "eslint": "^8.27.0", + "eslint-config-prettier": "^8.5.0", "jest": "^29.1.2", + "prettier": "^2.7.1", "ts-jest": "^29.0.3", + "tslint-config-prettier": "^1.18.0", "typescript": "^4.8.4" } }, @@ -656,12 +662,113 @@ "node": ">=12" } }, + "node_modules/@eslint/eslintrc": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", + "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.4.0", + "globals": "^13.15.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", + "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/eslintrc/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", "optional": true }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz", + "integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -1032,6 +1139,41 @@ "node-pre-gyp": "bin/node-pre-gyp" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@npmcli/fs": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz", @@ -1172,6 +1314,12 @@ "pretty-format": "^29.0.0" } }, + "node_modules/@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, "node_modules/@types/node": { "version": "18.8.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.3.tgz", @@ -1184,6 +1332,12 @@ "integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==", "dev": true }, + "node_modules/@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true + }, "node_modules/@types/stack-utils": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", @@ -1205,11 +1359,219 @@ "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.42.1.tgz", + "integrity": "sha512-LyR6x784JCiJ1j6sH5Y0K6cdExqCCm8DJUTcwG5ThNXJj/G8o5E56u5EdG4SLy+bZAwZBswC+GYn3eGdttBVCg==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.42.1", + "@typescript-eslint/type-utils": "5.42.1", + "@typescript-eslint/utils": "5.42.1", + "debug": "^4.3.4", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "regexpp": "^3.2.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.42.1.tgz", + "integrity": "sha512-kAV+NiNBWVQDY9gDJDToTE/NO8BHi4f6b7zTsVAJoTkmB/zlfOpiEVBzHOKtlgTndCKe8vj9F/PuolemZSh50Q==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.42.1", + "@typescript-eslint/types": "5.42.1", + "@typescript-eslint/typescript-estree": "5.42.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.42.1.tgz", + "integrity": "sha512-QAZY/CBP1Emx4rzxurgqj3rUinfsh/6mvuKbLNMfJMMKYLRBfweus8brgXF8f64ABkIZ3zdj2/rYYtF8eiuksQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.42.1", + "@typescript-eslint/visitor-keys": "5.42.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.42.1.tgz", + "integrity": "sha512-WWiMChneex5w4xPIX56SSnQQo0tEOy5ZV2dqmj8Z371LJ0E+aymWD25JQ/l4FOuuX+Q49A7pzh/CGIQflxMVXg==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "5.42.1", + "@typescript-eslint/utils": "5.42.1", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.42.1.tgz", + "integrity": "sha512-Qrco9dsFF5lhalz+lLFtxs3ui1/YfC6NdXu+RAGBa8uSfn01cjO7ssCsjIsUs484vny9Xm699FSKwpkCcqwWwA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.42.1.tgz", + "integrity": "sha512-qElc0bDOuO0B8wDhhW4mYVgi/LZL+igPwXtV87n69/kYC/7NG3MES0jHxJNCr4EP7kY1XVsRy8C/u3DYeTKQmw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.42.1", + "@typescript-eslint/visitor-keys": "5.42.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.42.1.tgz", + "integrity": "sha512-Gxvf12xSp3iYZd/fLqiQRD4uKZjDNR01bQ+j8zvhPjpsZ4HmvEFL/tC4amGNyxN9Rq+iqvpHLhlqx6KTxz9ZyQ==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.42.1", + "@typescript-eslint/types": "5.42.1", + "@typescript-eslint/typescript-estree": "5.42.1", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.42.1.tgz", + "integrity": "sha512-LOQtSF4z+hejmpUvitPlc4hA7ERGoj2BVkesOcG91HCn8edLGUXbTrErmutmPbl8Bo9HjAvOO/zBKQHExXNA2A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.42.1", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, + "node_modules/acorn": { + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -1248,6 +1610,22 @@ "node": ">=8" } }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -1325,6 +1703,15 @@ "sprintf-js": "~1.0.2" } }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -1754,6 +2141,12 @@ "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", "dev": true }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, "node_modules/deepmerge": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", @@ -1811,6 +2204,30 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/electron-to-chromium": { "version": "1.4.281", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.281.tgz", @@ -2301,43 +2718,362 @@ "node": ">=8" } }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "node_modules/eslint": { + "version": "8.27.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.27.0.tgz", + "integrity": "sha512-0y1bfG2ho7mty+SiILVf9PfuRA49ek4Nc60Wmmu62QlobNR+CeXa4xXIJgcuwSQgZiWaPH+5BDsctpIW0PR/wQ==", "dev": true, + "dependencies": { + "@eslint/eslintrc": "^1.3.3", + "@humanwhocodes/config-array": "^0.11.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.4.0", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.15.0", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" + }, "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" + "eslint": "bin/eslint.js" }, "engines": { - "node": ">=4" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/execa": { + "node_modules/eslint-config-prettier": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz", + "integrity": "sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-scope": { "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" + "node": ">=8.0.0" } }, - "node_modules/exit": { + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/globals": { + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", + "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/espree": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "dev": true, + "dependencies": { + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", @@ -2362,12 +3098,61 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -2377,6 +3162,18 @@ "bser": "2.1.1" } }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2402,6 +3199,25 @@ "node": ">=8" } }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -2528,6 +3344,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -2537,12 +3365,38 @@ "node": ">=4" } }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "devOptional": true }, + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -2637,6 +3491,40 @@ "node": ">=0.10.0" } }, + "node_modules/ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/import-local": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", @@ -2718,6 +3606,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -2732,7 +3629,19 @@ "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", "dev": true, "engines": { - "node": ">=6" + "node": ">=6" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" } }, "node_modules/is-lambda": { @@ -2750,6 +3659,15 @@ "node": ">=0.12.0" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -3401,6 +4319,12 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/js-sdsl": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz", + "integrity": "sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q==", + "dev": true + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3438,6 +4362,18 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, "node_modules/json5": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", @@ -3468,6 +4404,19 @@ "node": ">=6" } }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -3492,6 +4441,12 @@ "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", "dev": true }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -3573,6 +4528,15 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -3735,6 +4699,12 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "node_modules/natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -3928,6 +4898,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -3994,6 +4981,18 @@ "node": ">=6" } }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -4044,6 +5043,15 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -4083,6 +5091,30 @@ "node": ">=8" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-format": { "version": "29.1.2", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.1.2.tgz", @@ -4141,6 +5173,35 @@ "node": ">= 6" } }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", @@ -4160,6 +5221,18 @@ "node": ">= 6" } }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -4225,6 +5298,16 @@ "node": ">= 4" } }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -4239,6 +5322,29 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -4596,6 +5702,12 @@ "node": ">=8" } }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -4677,6 +5789,51 @@ "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", "dev": true }, + "node_modules/tslint-config-prettier": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz", + "integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==", + "dev": true, + "bin": { + "tslint-config-prettier-check": "bin/check.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/tsutils/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -4755,6 +5912,15 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -4820,6 +5986,15 @@ "string-width": "^1.0.2 || 2 || 3 || 4" } }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -5374,12 +6549,84 @@ "dev": true, "optional": true }, + "@eslint/eslintrc": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", + "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.4.0", + "globals": "^13.15.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "globals": { + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", + "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + } + } + }, "@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", "optional": true }, + "@humanwhocodes/config-array": { + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz", + "integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + } + }, + "@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -5674,6 +6921,32 @@ "tar": "^6.1.11" } }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, "@npmcli/fs": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz", @@ -5808,6 +7081,12 @@ "pretty-format": "^29.0.0" } }, + "@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, "@types/node": { "version": "18.8.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.3.tgz", @@ -5820,6 +7099,12 @@ "integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==", "dev": true }, + "@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true + }, "@types/stack-utils": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", @@ -5841,11 +7126,122 @@ "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, + "@typescript-eslint/eslint-plugin": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.42.1.tgz", + "integrity": "sha512-LyR6x784JCiJ1j6sH5Y0K6cdExqCCm8DJUTcwG5ThNXJj/G8o5E56u5EdG4SLy+bZAwZBswC+GYn3eGdttBVCg==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.42.1", + "@typescript-eslint/type-utils": "5.42.1", + "@typescript-eslint/utils": "5.42.1", + "debug": "^4.3.4", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "regexpp": "^3.2.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/parser": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.42.1.tgz", + "integrity": "sha512-kAV+NiNBWVQDY9gDJDToTE/NO8BHi4f6b7zTsVAJoTkmB/zlfOpiEVBzHOKtlgTndCKe8vj9F/PuolemZSh50Q==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.42.1", + "@typescript-eslint/types": "5.42.1", + "@typescript-eslint/typescript-estree": "5.42.1", + "debug": "^4.3.4" + } + }, + "@typescript-eslint/scope-manager": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.42.1.tgz", + "integrity": "sha512-QAZY/CBP1Emx4rzxurgqj3rUinfsh/6mvuKbLNMfJMMKYLRBfweus8brgXF8f64ABkIZ3zdj2/rYYtF8eiuksQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.42.1", + "@typescript-eslint/visitor-keys": "5.42.1" + } + }, + "@typescript-eslint/type-utils": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.42.1.tgz", + "integrity": "sha512-WWiMChneex5w4xPIX56SSnQQo0tEOy5ZV2dqmj8Z371LJ0E+aymWD25JQ/l4FOuuX+Q49A7pzh/CGIQflxMVXg==", + "dev": true, + "requires": { + "@typescript-eslint/typescript-estree": "5.42.1", + "@typescript-eslint/utils": "5.42.1", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/types": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.42.1.tgz", + "integrity": "sha512-Qrco9dsFF5lhalz+lLFtxs3ui1/YfC6NdXu+RAGBa8uSfn01cjO7ssCsjIsUs484vny9Xm699FSKwpkCcqwWwA==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.42.1.tgz", + "integrity": "sha512-qElc0bDOuO0B8wDhhW4mYVgi/LZL+igPwXtV87n69/kYC/7NG3MES0jHxJNCr4EP7kY1XVsRy8C/u3DYeTKQmw==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.42.1", + "@typescript-eslint/visitor-keys": "5.42.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/utils": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.42.1.tgz", + "integrity": "sha512-Gxvf12xSp3iYZd/fLqiQRD4uKZjDNR01bQ+j8zvhPjpsZ4HmvEFL/tC4amGNyxN9Rq+iqvpHLhlqx6KTxz9ZyQ==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.42.1", + "@typescript-eslint/types": "5.42.1", + "@typescript-eslint/typescript-estree": "5.42.1", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.42.1.tgz", + "integrity": "sha512-LOQtSF4z+hejmpUvitPlc4hA7ERGoj2BVkesOcG91HCn8edLGUXbTrErmutmPbl8Bo9HjAvOO/zBKQHExXNA2A==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.42.1", + "eslint-visitor-keys": "^3.3.0" + } + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, + "acorn": { + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "requires": {} + }, "agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -5875,6 +7271,18 @@ "indent-string": "^4.0.0" } }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, "ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -5931,6 +7339,12 @@ "sprintf-js": "~1.0.2" } }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -6253,6 +7667,12 @@ "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", "dev": true }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, "deepmerge": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", @@ -6292,6 +7712,24 @@ "integrity": "sha512-7Qe/zd1wxSDL4D/X/FPjOMB+ZMDt71W94KYaq05I2l0oQqgXgs7s4ftYYmV38gBSrPz2vcygxfs1xn0FT+rKNA==", "dev": true }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "electron-to-chromium": { "version": "1.4.281", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.281.tgz", @@ -6561,12 +7999,238 @@ "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", "dev": true }, + "eslint": { + "version": "8.27.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.27.0.tgz", + "integrity": "sha512-0y1bfG2ho7mty+SiILVf9PfuRA49ek4Nc60Wmmu62QlobNR+CeXa4xXIJgcuwSQgZiWaPH+5BDsctpIW0PR/wQ==", + "dev": true, + "requires": { + "@eslint/eslintrc": "^1.3.3", + "@humanwhocodes/config-array": "^0.11.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.4.0", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.15.0", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "globals": { + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", + "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + } + } + }, + "eslint-config-prettier": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz", + "integrity": "sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==", + "dev": true, + "requires": {} + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true + }, + "espree": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "dev": true, + "requires": { + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + } + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, "execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -6603,12 +8267,57 @@ "jest-util": "^29.1.2" } }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "dependencies": { + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + } + } + }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, "fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -6618,6 +8327,15 @@ "bser": "2.1.1" } }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -6637,6 +8355,22 @@ "path-exists": "^4.0.0" } }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, "form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -6726,18 +8460,47 @@ "path-is-absolute": "^1.0.0" } }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, "globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, + "globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + } + }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "devOptional": true }, + "grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -6814,6 +8577,30 @@ "safer-buffer": ">= 2.1.2 < 3.0.0" } }, + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + } + } + }, "import-local": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", @@ -6877,6 +8664,12 @@ "has": "^1.0.3" } }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -6888,6 +8681,15 @@ "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", "dev": true }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, "is-lambda": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", @@ -6900,6 +8702,12 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, "is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -7400,6 +9208,12 @@ } } }, + "js-sdsl": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz", + "integrity": "sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q==", + "dev": true + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -7428,6 +9242,18 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, "json5": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", @@ -7446,6 +9272,16 @@ "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", "dev": true }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, "lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -7467,6 +9303,12 @@ "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", "dev": true }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -7535,6 +9377,12 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, "micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -7653,6 +9501,12 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, "negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -7798,6 +9652,20 @@ "mimic-fn": "^2.1.0" } }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, "p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -7842,6 +9710,15 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -7877,6 +9754,12 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, "picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -7904,6 +9787,18 @@ "find-up": "^4.0.0" } }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true + }, "pretty-format": { "version": "29.1.2", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.1.2.tgz", @@ -7949,6 +9844,18 @@ "sisteransi": "^1.0.5" } }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, "react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", @@ -7965,6 +9872,12 @@ "util-deprecate": "^1.0.1" } }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -8009,6 +9922,12 @@ "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", "optional": true }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -8017,6 +9936,15 @@ "glob": "^7.1.3" } }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -8269,6 +10197,12 @@ "minimatch": "^3.0.4" } }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -8317,6 +10251,38 @@ "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", "dev": true }, + "tslint-config-prettier": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz", + "integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==", + "dev": true + }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + } + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -8363,6 +10329,15 @@ "picocolors": "^1.0.0" } }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -8419,6 +10394,12 @@ "string-width": "^1.0.2 || 2 || 3 || 4" } }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, "wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/package.json b/package.json index f110a0c..7a04cec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pocketbase-typegen", - "version": "1.0.13", + "version": "1.1.0", "description": "Generate pocketbase record types from your database", "main": "dist/index.js", "bin": { @@ -23,7 +23,12 @@ "test:update": "jest -u", "build": "rm -rf dist && node build.js", "prepublishOnly": "tsc && npm run test && npm run build", - "typecheck": "tsc" + "typecheck": "tsc", + "lint": "eslint src test", + "lint:fix": "npm run lint -- --fix", + "prettier": "prettier src test --check", + "prettier:fix": "npm run prettier -- --write", + "format": "npm run prettier:fix && npm run lint:fix" }, "author": "@patmood", "license": "ISC", @@ -37,14 +42,30 @@ "devDependencies": { "@types/jest": "^29.1.2", "@types/node": "^18.8.3", + "@typescript-eslint/eslint-plugin": "^5.42.1", + "@typescript-eslint/parser": "^5.42.1", "esbuild": "^0.15.11", "esbuild-node-externals": "^1.5.0", + "eslint": "^8.27.0", + "eslint-config-prettier": "^8.5.0", "jest": "^29.1.2", + "prettier": "^2.7.1", "ts-jest": "^29.0.3", + "tslint-config-prettier": "^1.18.0", "typescript": "^4.8.4" }, "jest": { "preset": "ts-jest", - "testEnvironment": "node" + "testEnvironment": "node", + "modulePathIgnorePatterns": [ + "/dist/", + "/test/pocketbase-types-examples.ts" + ] + }, + "prettier": { + "trailingComma": "es5", + "tabWidth": 2, + "semi": false, + "singleQuote": false } } diff --git a/src/constants.ts b/src/constants.ts index e6a1dae..ff9e6e5 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,15 +1,27 @@ -export const EXPORT_COMMENT = `// This file was @generated using pocketbase-typegen` +export const EXPORT_COMMENT = `/** +* This file was @generated using pocketbase-typegen +*/` +export const RECORD_TYPE_COMMENT = `// Record types for each collection` +export const RESPONSE_TYPE_COMMENT = `// Response types include system fields and match responses from the PocketBase API` export const DATE_STRING_TYPE_NAME = `IsoDateString` -export const DATE_STRING_TYPE_DEFINITION = `export type ${DATE_STRING_TYPE_NAME} = string` export const RECORD_ID_STRING_NAME = `RecordIdString` -export const RECORD_ID_STRING_DEFINITION = `export type ${RECORD_ID_STRING_NAME} = string` -export const USER_ID_STRING_NAME = `UserIdString` -export const USER_ID_STRING_DEFINITION = `export type ${USER_ID_STRING_NAME} = string` -export const BASE_RECORD_DEFINITION = `export type BaseRecord = { +export const ALIAS_TYPE_DEFINITIONS = `// Alias types for improved usability +export type ${DATE_STRING_TYPE_NAME} = string +export type ${RECORD_ID_STRING_NAME} = string` + +export const BASE_SYSTEM_FIELDS_DEFINITION = `// System fields +export type BaseSystemFields = { \tid: ${RECORD_ID_STRING_NAME} \tcreated: ${DATE_STRING_TYPE_NAME} \tupdated: ${DATE_STRING_TYPE_NAME} -\t"@collectionId": string -\t"@collectionName": string -\t"@expand"?: { [key: string]: any } +\tcollectionId: string +\tcollectionName: Collections +\texpand?: { [key: string]: any } }` + +export const AUTH_SYSTEM_FIELDS_DEFINITION = `export type AuthSystemFields = { +\temail: string +\temailVisibility: boolean +\tusername: string +\tverified: boolean +} & BaseSystemFields` diff --git a/src/lib.ts b/src/lib.ts index 32cf459..fb22f97 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -1,12 +1,12 @@ import { - BASE_RECORD_DEFINITION, - DATE_STRING_TYPE_DEFINITION, + ALIAS_TYPE_DEFINITIONS, + AUTH_SYSTEM_FIELDS_DEFINITION, + BASE_SYSTEM_FIELDS_DEFINITION, DATE_STRING_TYPE_NAME, EXPORT_COMMENT, - RECORD_ID_STRING_DEFINITION, RECORD_ID_STRING_NAME, - USER_ID_STRING_DEFINITION, - USER_ID_STRING_NAME, + RECORD_TYPE_COMMENT, + RESPONSE_TYPE_COMMENT, } from "./constants" import { CollectionRecord, FieldSchema } from "./types" import { @@ -14,7 +14,12 @@ import { getGenericArgString, getGenericArgStringWithDefault, } from "./generics" -import { sanitizeFieldName, toPascalCase } from "./utils" +import { + getOptionEnumName, + getSystemFields, + sanitizeFieldName, + toPascalCase, +} from "./utils" const pbSchemaTypescriptMap = { text: "string", @@ -23,9 +28,9 @@ const pbSchemaTypescriptMap = { email: "string", url: "string", date: DATE_STRING_TYPE_NAME, - select: (fieldSchema: FieldSchema) => + select: (fieldSchema: FieldSchema, collectionName: string) => fieldSchema.options.values - ? fieldSchema.options.values.map((val) => `"${val}"`).join(" | ") + ? getOptionEnumName(collectionName, fieldSchema.name) : "string", json: (fieldSchema: FieldSchema) => `null | ${fieldNameToGeneric(fieldSchema.name)}`, @@ -33,78 +38,105 @@ const pbSchemaTypescriptMap = { fieldSchema.options.maxSelect && fieldSchema.options.maxSelect > 1 ? "string[]" : "string", - relation: RECORD_ID_STRING_NAME, - user: USER_ID_STRING_NAME, + relation: (fieldSchema: FieldSchema) => + fieldSchema.options.maxSelect && fieldSchema.options.maxSelect > 1 + ? `${RECORD_ID_STRING_NAME}[]` + : RECORD_ID_STRING_NAME, + // DEPRECATED: PocketBase v0.8 does not have a dedicated user relation + user: (fieldSchema: FieldSchema) => + fieldSchema.options.maxSelect && fieldSchema.options.maxSelect > 1 + ? `${RECORD_ID_STRING_NAME}[]` + : RECORD_ID_STRING_NAME, } export function generate(results: Array) { const collectionNames: Array = [] const recordTypes: Array = [] + const responseTypes: Array = [RESPONSE_TYPE_COMMENT] - results.forEach((row) => { - if (row.name) collectionNames.push(row.name) - if (row.schema) { - recordTypes.push(createRecordType(row.name, row.schema)) - recordTypes.push(createResponseType(row.name, row.schema)) - } - }) - const sortedCollectionNames = collectionNames.sort() + results + .sort((a, b) => { + if (a.name < b.name) { + return -1 + } + if (a.name > b.name) { + return 1 + } + return 0 + }) + .forEach((row) => { + if (row.name) collectionNames.push(row.name) + if (row.schema) { + recordTypes.push(createRecordType(row.name, row.schema)) + responseTypes.push(createResponseType(row)) + } + }) + const sortedCollectionNames = collectionNames const fileParts = [ EXPORT_COMMENT, - DATE_STRING_TYPE_DEFINITION, - RECORD_ID_STRING_DEFINITION, - USER_ID_STRING_DEFINITION, - BASE_RECORD_DEFINITION, createCollectionEnum(sortedCollectionNames), - ...recordTypes.sort(), - createCollectionRecord(sortedCollectionNames), + ALIAS_TYPE_DEFINITIONS, + BASE_SYSTEM_FIELDS_DEFINITION, + AUTH_SYSTEM_FIELDS_DEFINITION, + RECORD_TYPE_COMMENT, + ...recordTypes, + responseTypes.join("\n"), + createCollectionRecords(sortedCollectionNames), ] return fileParts.join("\n\n") } export function createCollectionEnum(collectionNames: Array) { - let typeString = `export enum Collections {\n` - collectionNames.forEach((name) => { - typeString += `\t${toPascalCase(name)} = "${name}",\n` - }) - typeString += `}` + const collections = collectionNames + .map((name) => `\t${toPascalCase(name)} = "${name}",`) + .join("\n") + const typeString = `export enum Collections { +${collections} +}` return typeString } -export function createCollectionRecord(collectionNames: Array) { - let typeString = `export type CollectionRecords = {\n` - collectionNames.forEach((name) => { - typeString += `\t${name}: ${toPascalCase(name)}Record\n` - }) - typeString += `}` - return typeString +export function createCollectionRecords(collectionNames: Array) { + const nameRecordMap = collectionNames + .map((name) => `\t${name}: ${toPascalCase(name)}Record`) + .join("\n") + return `export type CollectionRecords = { +${nameRecordMap} +}` } export function createRecordType( name: string, schema: Array ): string { - let typeString = `export type ${toPascalCase( - name - )}Record${getGenericArgStringWithDefault(schema)} = {\n` - schema.forEach((fieldSchema: FieldSchema) => { - typeString += createTypeField(fieldSchema) - }) - typeString += `}` - return typeString + const selectOptionEnums = createSelectOptions(name, schema) + const typeName = toPascalCase(name) + const genericArgs = getGenericArgStringWithDefault(schema) + const fields = schema + .map((fieldSchema: FieldSchema) => createTypeField(name, fieldSchema)) + .join("\n") + + return `${selectOptionEnums}export type ${typeName}Record${genericArgs} = { +${fields} +}` } -export function createResponseType(name: string, schema: Array) { +export function createResponseType(collectionSchemaEntry: CollectionRecord) { + const { name, schema, type } = collectionSchemaEntry const pascaleName = toPascalCase(name) - let typeString = `export type ${pascaleName}Response${getGenericArgStringWithDefault( - schema - )} = ${pascaleName}Record${getGenericArgString(schema)} & BaseRecord` - return typeString + const genericArgsWithDefaults = getGenericArgStringWithDefault(schema) + const genericArgs = getGenericArgString(schema) + const systemFields = getSystemFields(type) + + return `export type ${pascaleName}Response${genericArgsWithDefaults} = ${pascaleName}Record${genericArgs} & ${systemFields}` } -export function createTypeField(fieldSchema: FieldSchema) { +export function createTypeField( + collectionName: string, + fieldSchema: FieldSchema +) { if (!(fieldSchema.type in pbSchemaTypescriptMap)) { throw new Error(`unknown type ${fieldSchema.type} found in schema`) } @@ -115,9 +147,26 @@ export function createTypeField(fieldSchema: FieldSchema) { const typeString = typeof typeStringOrFunc === "function" - ? typeStringOrFunc(fieldSchema) + ? typeStringOrFunc(fieldSchema, collectionName) : typeStringOrFunc - return `\t${sanitizeFieldName(fieldSchema.name)}${ - fieldSchema.required ? "" : "?" - }: ${typeString}\n` + + const fieldName = sanitizeFieldName(fieldSchema.name) + const required = fieldSchema.required ? "" : "?" + + return `\t${fieldName}${required}: ${typeString}` +} + +export function createSelectOptions( + recordName: string, + schema: Array +) { + const selectFields = schema.filter((field) => field.type === "select") + const typestring = selectFields + .map( + (field) => `export enum ${getOptionEnumName(recordName, field.name)} { +${field.options.values?.map((val) => `\t${val} = "${val}",`).join("\n")} +}\n` + ) + .join("\n") + return typestring } diff --git a/src/schema.ts b/src/schema.ts index 1627559..5b49fca 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -26,15 +26,15 @@ export async function fromJSON(path: string): Promise> { export async function fromURL( url: string, - email: string = "", - password: string = "" + email = "", + password = "" ): Promise> { const formData = new FormData() - formData.append("email", email) + formData.append("identity", email) formData.append("password", password) // Login - const { token } = await fetch(`${url}/api/admins/auth-via-email`, { + const { token } = await fetch(`${url}/api/admins/auth-with-password`, { method: "post", // @ts-ignore body: formData, @@ -43,7 +43,7 @@ export async function fromURL( // Get the collection const result = await fetch(`${url}/api/collections?perPage=200`, { headers: { - Authorization: `Admin ${token}`, + Authorization: token, }, }).then((res) => res.json()) diff --git a/src/types.ts b/src/types.ts index 006a0cc..bbd023e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -31,6 +31,7 @@ export type FieldSchema = { export type CollectionRecord = { id: string + type: "base" | "auth" name: string system: boolean listRule: string | null diff --git a/src/utils.ts b/src/utils.ts index 1234253..2b274bb 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,3 +1,4 @@ +import { CollectionRecord } from "./types" import { promises as fs } from "fs" export function toPascalCase(str: string) { @@ -22,3 +23,11 @@ export async function saveFile(outPath: string, typeString: string) { await fs.writeFile(outPath, typeString, "utf8") console.log(`Created typescript definitions at ${outPath}`) } + +export function getSystemFields(type: CollectionRecord["type"]) { + return type === "auth" ? "AuthSystemFields" : "BaseSystemFields" +} + +export function getOptionEnumName(recordName: string, fieldName: string) { + return `${toPascalCase(recordName)}${toPascalCase(fieldName)}Options` +} diff --git a/test/__snapshots__/fromJSON.test.ts.snap b/test/__snapshots__/fromJSON.test.ts.snap new file mode 100644 index 0000000..deb07b7 --- /dev/null +++ b/test/__snapshots__/fromJSON.test.ts.snap @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`creates a type file from json schema 1`] = ` +"/** +* This file was @generated using pocketbase-typegen +*/ + +export enum Collections { + Base = "base", + CustomAuth = "custom_auth", + Everything = "everything", + Posts = "posts", + Users = "users", +} + +// Alias types for improved usability +export type IsoDateString = string +export type RecordIdString = string + +// System fields +export type BaseSystemFields = { + id: RecordIdString + created: IsoDateString + updated: IsoDateString + collectionId: string + collectionName: Collections + expand?: { [key: string]: any } +} + +export type AuthSystemFields = { + email: string + emailVisibility: boolean + username: string + verified: boolean +} & BaseSystemFields + +// Record types for each collection + +export type BaseRecord = { + field?: string +} + +export type CustomAuthRecord = { + custom_field?: string +} + +export enum EverythingSelectFieldOptions { + optionA = "optionA", + optionB = "optionB", + optionC = "optionC", +} +export type EverythingRecord = { + text_field?: string + number_field?: number + bool_field?: boolean + email_field?: string + url_field?: string + date_field?: IsoDateString + select_field?: EverythingSelectFieldOptions + json_field?: null | Tjson_field + another_json_field?: null | Tanother_json_field + file_field?: string + three_files_field?: string[] + user_relation_field?: RecordIdString + custom_relation_field?: RecordIdString[] + post_relation_field?: RecordIdString + select_field_no_values?: string +} + +export type PostsRecord = { + field?: string + nonempty_field: string + nonempty_bool: boolean + field1?: number +} + +export type UsersRecord = { + name?: string + avatar?: string +} + +// Response types include system fields and match responses from the PocketBase API +export type BaseResponse = BaseRecord & BaseSystemFields +export type CustomAuthResponse = CustomAuthRecord & AuthSystemFields +export type EverythingResponse = EverythingRecord & BaseSystemFields +export type PostsResponse = PostsRecord & BaseSystemFields +export type UsersResponse = UsersRecord & AuthSystemFields + +export type CollectionRecords = { + base: BaseRecord + custom_auth: CustomAuthRecord + everything: EverythingRecord + posts: PostsRecord + users: UsersRecord +}" +`; diff --git a/test/__snapshots__/integration.test.ts.snap b/test/__snapshots__/integration.test.ts.snap deleted file mode 100644 index 0c26ac9..0000000 --- a/test/__snapshots__/integration.test.ts.snap +++ /dev/null @@ -1,65 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`creates a type file from json schema 1`] = ` -"// This file was @generated using pocketbase-typegen - -export type IsoDateString = string - -export type RecordIdString = string - -export type UserIdString = string - -export type BaseRecord = { - id: RecordIdString - created: IsoDateString - updated: IsoDateString - "@collectionId": string - "@collectionName": string - "@expand"?: { [key: string]: any } -} - -export enum Collections { - EveryType = "every_type", - Orders = "orders", - Profiles = "profiles", -} - -export type EveryTypeRecord = { - text_field: string - number_field: number - bool_field: boolean - email_field?: string - url_field?: string - date_field?: IsoDateString - select_field?: "optionA" | "optionB" | "optionC" - json_field?: null | Tjson_field - file_field?: string - relation_field?: RecordIdString - user_field?: UserIdString -} - -export type EveryTypeResponse = EveryTypeRecord & BaseRecord - -export type OrdersRecord = { - amount: number - payment_type: "credit card" | "paypal" | "crypto" - user: UserIdString - product: string -} - -export type OrdersResponse = OrdersRecord & BaseRecord - -export type ProfilesRecord = { - userId: UserIdString - name?: string - avatar?: string -} - -export type ProfilesResponse = ProfilesRecord & BaseRecord - -export type CollectionRecords = { - every_type: EveryTypeRecord - orders: OrdersRecord - profiles: ProfilesRecord -}" -`; diff --git a/test/__snapshots__/lib.test.ts.snap b/test/__snapshots__/lib.test.ts.snap index 83d2ec6..dea9acf 100644 --- a/test/__snapshots__/lib.test.ts.snap +++ b/test/__snapshots__/lib.test.ts.snap @@ -26,7 +26,7 @@ exports[`createRecordType handles file fields with multiple files 1`] = ` }" `; -exports[`createResponseType creates type definition for a response 1`] = `"export type BooksResponse = BooksRecord & BaseRecord"`; +exports[`createResponseType creates type definition for a response 1`] = `"export type BooksResponse = BooksRecord & BaseSystemFields"`; exports[`createResponseType handles file fields with multiple files 1`] = ` "export type BooksRecord = { @@ -35,32 +35,43 @@ exports[`createResponseType handles file fields with multiple files 1`] = ` `; exports[`generate generates correct output given db input 1`] = ` -"// This file was @generated using pocketbase-typegen +"/** +* This file was @generated using pocketbase-typegen +*/ -export type IsoDateString = string +export enum Collections { + Books = "books", +} +// Alias types for improved usability +export type IsoDateString = string export type RecordIdString = string -export type UserIdString = string - -export type BaseRecord = { +// System fields +export type BaseSystemFields = { id: RecordIdString created: IsoDateString updated: IsoDateString - "@collectionId": string - "@collectionName": string - "@expand"?: { [key: string]: any } + collectionId: string + collectionName: Collections + expand?: { [key: string]: any } } -export enum Collections { - Books = "books", -} +export type AuthSystemFields = { + email: string + emailVisibility: boolean + username: string + verified: boolean +} & BaseSystemFields + +// Record types for each collection export type BooksRecord = { title?: string } -export type BooksResponse = BooksRecord & BaseRecord +// Response types include system fields and match responses from the PocketBase API +export type BooksResponse = BooksRecord & BaseSystemFields export type CollectionRecords = { books: BooksRecord diff --git a/test/integration.test.ts b/test/fromJSON.test.ts similarity index 100% rename from test/integration.test.ts rename to test/fromJSON.test.ts diff --git a/test/integration/integration.js b/test/integration/integration.js new file mode 100644 index 0000000..f0969da --- /dev/null +++ b/test/integration/integration.js @@ -0,0 +1,24 @@ +import assert from "node:assert" +import fs from "fs/promises" + +// Known good types from repo +const controlTypes = await fs.readFile("pocketbase-types-example.ts", { + encoding: "utf8", +}) + +async function testCreateFromUrl() { + const typesFromUrl = await fs.readFile("output/pocketbase-types-url.ts", { + encoding: "utf8", + }) + assert.equal(typesFromUrl, controlTypes) +} + +async function testCreateFromDb() { + const typesFromDb = await fs.readFile("output/pocketbase-types-db.ts", { + encoding: "utf8", + }) + assert.equal(typesFromDb, controlTypes) +} + +await testCreateFromUrl() +await testCreateFromDb() diff --git a/test/integration/pb_data/data.db b/test/integration/pb_data/data.db new file mode 100644 index 0000000000000000000000000000000000000000..e0c8494875f48397a57006ead50d7b8d15ed4a40 GIT binary patch literal 172032 zcmeI5ON<*ynwZI=>LsZ}sk_zeUQPF;C~4Ik)q}}*u~FV;Rk0qbQkCkZmZ~L?$z+hs zs$^y|AAFRoL$zjl8ip@pU*_PQgWUOa$(m`fY5Z@bvbVh&@h$AiHF>&5P1 z=U_)fCYi~nsw}BnkDri=nUQ}){Qnn!{1K7N$IjNepd+Rrt7T4S!mf+1p&{324C8XS zhVlO&;Q!6fRlISgxr4vmj_rP%!>;Mf_eeo*?;nWF74ILs-V49F@bk0F=l|;b&&K}w z><8n&8TtL#FGkYCKlMBrE_==m{bcBz`zP*)?uY#feO=PSAB^~xuex1=lt*=~B4W@P z&d_DLpFvfmHuRDp6*H{8{bBw6QQxx9ef)h>Dx>5whK5v)d2%>uK5W6$MLUkX?KY4560nG?iT zz3-o>-d3LWN@;R7z+4v?!rYO$ zOX8lO2{{3KYa`3dZ*H!qQyZOgi2F6G%@Wj>3afb>IfC9% z-xgL@>!qxUc-$nd8b}9fFZ$vM6zx$+A0>HN6cJAx39E(`HFKKVO{HU{Il8#`1XdiQS2~(&|w+=5fC0g3jvS=|aPctQ2Hat@T z+l*y;mC=e8b{WlR;`iH5Z&ujq948Q-nwp}SmNvK3tIHcC8eqR^GdsX+rZd+MU~EBwT!(v)ZsPu5$rhyK}5{G z)b_$kYWtH=G#X$W{$jfU!zqf0rf00e*l5P0ngT=uZz-RA(z-~VS_ z-q{O<*WN@h00;m9AOHk_01yBIKmZ5;0U!VbzIy`y8Y*hjyj(7Y)nH>`E3~%~-v~xy^IB;ww_Pl=srv`}%AKYAMp(Gh zkVW~y)_kS5vbeRiaXrLcXT#SIs&{j-y-kfhOzjj`^ToniL0v&phC)*;I~9yGY%Cc~B%|zfD3;jomyT)vx8p_k*;`{bO_PeU z5wD{{uv*RY3Xkur(e%&AA7V=JUS;R=4fg1ey|WkL!=O zuY~rC`?Gu1`L){W{gP!$WBv2RWlmUIUaIS%AmXB{ca|5X!wZ%0otk(k?aio>g?(=4 z=#I|nhYH6Di+kIZE|o*U=~ygcn=;D;!^!AuGLo1Mhr|2k@BhDZd4K2q-FNRKpaBp7 z0zd!=00AHX1b_e#00KY&2mk>fa9RTIb)0D#ddG8XyyH}bx&Hq~%@S5LW2&MbFLgwyP7&_5U|6?>F9m`yFZw zRRaMa00e*l5C8%|00;m9AOHk_01$W!3B*r-|HDw!QyD+~y#|hV^Zmg4hq3p^-fzb} z`ukgBm#_ZpQ<{2dZZ2Wq7f6-Vc*KYuaC(HiKE-}{-4~Dj=Bru!$pR;8Xwom_{Yn23 ziXR!F1HnJ(CvR54DLO7BgI}2?=5ZQ%Ig6Es_f%9d1Qp?YRuP6IR17R&?ON|7@h2bq z@tZmPNy!k!Nq?EEH#ZedC$GxFCHkK{ne44mj4vsiQsHckB%_?e@6+ng$xMBIt@C~5xW z7mp_WvLrSf34N7Pa*axjj}>jD47G~^PHIy~R}Ji6{hgyjAJa|RG$KiTbwX-A$5nF` zTPN~{xK2(atxcxLIUct)Jr9;o%rTP|(;By%^DBuf(znGmr&)ONb=P{^ z>N=8&q|$^r6&iUi6*4eY}ny%TR}F`JJ`*9jtszZOk_i z+O6E$w={aWlNi5H#=&IfKp`{!<~Fi-6v^J!s>NINGMW0Df<>X=$4iUmB*>h@KN9lH z9P=3oGUTRv(jwDB{y7sLzxF{DKguAUjIh(O*d2dZ?4pZ=lif>hM-Eiy>w$gMJ*qHLJA z-lTYZ2hJo(*u!^JB>g2_SCTU`qRivV>hZ;s$wY8Ahy_YQ9xcd{uF4|5*xb6WK|@j= zsa8olhN8$Sxs2CLPUZ6|(y*{!Gmm_R>Ree75qS#=mZ~CEC4>lG#+SK2 z_UGh$17~_@1cPB-pJC?V;2rvRmS$L#81cOhHze16h!;$&8^foX$K> z-MyRHNZm<4nI2fif++BZj4Uzu_5mhm=sMoaA$%zeg?ATc`P%AIAAb~SPb_?8pg zIA-N03mdM91q*V#F36JUQ1mddZ6-5wZH8QnH^a+PK~T$6P7j!Qyt}!U-gx4FLhkv( z9^1T{_yxGez-FbDnU*Nl1YgpP>1hXwy3$z#D>m8+=I>Tv)#CdyI zIZ4HMPGW?jB&!HJy`Y&**aTpeXz9|s-@Q1eG6B&3bziI<0)CwCbfin)sZv!Lqux9nN@td1il}SZsRds!K0^jgyVTUh_4|s zBx6Ah@oF;@9%p%Um(xo-dIR6&W=;xlbzC0baX{`P*_96wE)?H$+sqZKly{bP4QX-q zK{U=*iboIDl>Opj+p-1KQ;LgGdXNc_b>Pl(-!G2|H3D=o7R60q(cPEB|v$0^X zS;t)~UemzQT^U!6Oytos;vpD}C9Z|RD`Sr${7SijL z`L%=g$`Z6D74fo~?`_U*S_?@D{0g_7=*pdiXzYIUK{_XIrB{l%#8zQ{akhRhC)A}% zX=NoY2iI2QMtcn{bIeMfVNW7x?C7j;xVyBlT2B|#Y_)J-t%*yU)e^h7SXx?(S8I3l zqh+paL~5UJrZ%+p+MM<{Lts}c3A1`>dEs_+bECxFuZAnJs1)90^XV;lojWQlZfiPP z-`a~rHt#-2&8F1Q0-4S^TFF@vohdYDd0jQhOWMl9Qe56FvLWR*H=o~@#C!Yu#XGli z_bQe6_U8OXp}t;Nhzd%cEAQN0BKODGHN}Dvvo6}}NE`KX^poBCOKz;}x`m0jT2YpZ zBI;c@K3w2?=?d@ZAZyL5D@I|KYr#HT|#KHe9`46UhDTeTr|p)6c&Czx@U{ zXS(_PKl1*+*J$AbssaHZ00e*l5C8%|00;m9AOHk_01yBI{Rxow|8@LSXs-YN!R7sj z{@LIN5C8%|00;m9AOHk_01yBIKmZ5;0U+@D5jf}hXuNreFuDHUb@BDH0W<~zKmZ5; z0U!VbfB+Bx0zd!=00AHX1WrzX{QeK?|C93qNgx0OfB+Bx0zd!=00AHX1b_e#00OTg z0a*XPj;#hd0|6ia1b_e#00KY&2mk>f00e*l5I7wHSpT1n7f1sEAOHk_01yBIKmZ5; z0U!VbfB+D99SP9)|9L-l;eYS}0zd!=00AHX1b_e#00KY&2mk>f@Rkxd&bYl3b2DSN zCMIqi4_D?s91jIUp(&P~3dR{WkqolQaC|x#jPHw@ETGb7>q1FGMe@RH0SU3g(xJ>3 z>vAHfYWUsQMN!a7NG)Cuao5@K^`&4wbX!;~Pbb2q+Xs7l`NXumVieW&{Qa45Jzc5q zS5vbkaeC?AW_V{`jK*RsT)DO%Pw27vo#KvMyknr%S~{vOm#W+R8h59*pcFQuJ4)$j zD|f$?Sb4CRSIUe1G*+reC>@y3|A+Vgy`>HgW&;5r00e*l5C8%|00;m9AOHk_z?(>b zy#KG`yo9;_|Fz5e>o?J0un7nN0U!VbfB+Bx0zd!=00AHX1c1QXL*R;MuJ3gV=KB91 zUEY6udw77QKmZ5;0U!VbfB+Bx0zd!=00AHX1l|q;9+;WXgOkA3qxfP!H$oYi+c#;h#BeT=7V06FA9u`ZnFdtScaaAmT z@yH<#_HBynpxdgOy6fRgR(K38%&nw%`%^4 zn+0YA$DYfhz7($d)8191GAD?wdfz`$y{$a$mD1#FfcbnSy`5&V<}Pz}j=6cW{@y_Q ziQW=dMlC%qpGXg9wsuvTN3sFs-BDi}n}4ad`Mioa9pzgUzh_l!63=!acgSbktF(?} z17pANJofo~?jO(UTuwx^P3WI@tg?4g^Xr%oPJ3FuGC{H6uBFua zPTHA6$XnXn-Cn(u+J3;Sr61s`L{8JUk%sggBZ@ zt4v(2!f9GfR`V;IR~Hl76O!YIq2!4hbQS4TleD3uUPo@+=dto6`(Rvw;~!ic z^*soXmmQhr>D&&#c+E}H2nL$peOFer=n@B5vYr`yvktHVEUK;VK zX0=(u&r)GEk0VFWJL=oQ%4)roRS}Olw`w3AsJ-ZmCs4FUA$^qOWl=;t@eZsSR@BUC zZa0Mop%yxPShy9I(^bU41`xp&d7-N7$%e}jcWK>&7?JT4g(br5n{q>;<)6uHV79Q)s>JaN@+r-!1jkJcQqcUN~JR^=ynke;#LQ#_p?UZty zhPpi7jNL?dU<+z|36GOmD%RGB{x2SNm5JZ|t#2D5RijM>M~hblRC|_;=@q6_zjDkT zJ6I-t=;JBv<~;lgq(hM zHa>RZjI1-`_|uO)G%9@cuIb2JzAQ+1@=d?abhxjX+S79hG803$`!=U$REGRn-Plbp zr?*>Er(kCYwx(mP41?l|J$13fDdFBRsC^QI<*95(pc*_u>uz1ABTyCkHL=w>+sBut z5v%#x;AlxjL}d|a{e@Z`u%mP* zH$!dV?~s~g{A9h8QISYp->k=PqGL%kBZ<=CYe)BA(Xtj=;_9Bfd{B_v^-c+lYB$dzFoJ6E5UKcd6hkFQe4cN}tTGM19oIV#5y zrwW65gO#Okr!ZT0PzhAxH8=^?KF^{Zy*Ys65Z~%Xrm2o2&+Pv=cgxqha-aBQlk&Z` zGoMGX+-zCXjGR1MMn%CHffZTPweNSh=Ky)rJ!vkdR|EoAMtpO=eleKJXIT36@s}fi zM9+LaHJ6q&k^cFp-2rKuvywrM)7R(d0XEBYjl+FLcS)8|So-2EreV_~54u z^XCs5@JX+uC#(hxL2uJf8G&~Ob!bW}!_u#J@dDyEZ~9LeKl)?esP9Kt@gKZ4`d1UM zHiESgIhEFbZDh@bp1p`7!`unhTFzx-Mv^o1Y_rzA_%g5m|Fz5eYr3+BKR^Ho00AHX z1b_e#00KY&2mk>f00e-*Yf9jXXKvi_=m6IFi~;lce}C@s{`qTa9H|E&uK%g zqEOOMQA5+bTnruVpc@qSe?_O+U^oY=oTohTan zcen3{Qi;RD-KB6YAGx33iPSexRJ$v)<^5`Kl#E`>AU_ZIC>U6R!V1wNpR_AOHk_01yBIKmZ5;0U!Vb zfB+Bx0f00e-*D?uRYsf?fg34!GK|E`O#gaM!g5C8%|00;m9AOHk_01yBI zKmZ5;0U+>_2$0|ZVg3J-;6kxL00;m9AOHk_01yBIKmZ5;0U!VbUJ(MY{(nUp0@MHk zKmZ5;0U!VbfB+Bx0zd!=00AKI5($v&|A#z(;htbTe=+ud$KHR5RYB1}00_Jo0{;dL zd2fwfzWN`o(DE+L%_R&}*Gp6f@N!YMi~BvTNOn8#^)LusbrJrz|9K}9&9RfHi46$1-cyRxDS zvZVQwkNssq@+T!j6es;%D6bv zI$u1R^vjaia3u6qO35`UH9l6fl`_;Wm2lE?DP;Odn@S|9uTn^@=eTOFVk?#Bbkx~0 zB<*x+QK$9eJk(_e_-LsSEzTwqlC6M-M8tRX8#DEkN^tcZT9`k{PWr2yXdu#NezS9> zaAD@wd~0jL|EMo2C0COhay)KpdZ5WtCn}P5DlPlgm*d3JK~YNB^>LD{mvHxex%Kk- zoXD3|*{-)Bh+Qs0(oSV3@dQU}kUilD2fSz~5=tb3*i(cu+QmWA>Q;IQ$11wrmyl6M zjrw7MMAv4-Evbm8Dk813VV+CjFm>eTR=CpM54-rtea_TjpDP-@ydS z>Pb~j=NxkluDNe%^jwh#yU*ZI=@-ge5zQPZ#G{+r$lg&Tdt0j(Z`I3WhG7a8g@PZ? zV49)UoGCmK^2{9b8JVFXO`j$$GA-nvGx4#X6Ggd}CeyGKF43RVRRhnQY3e3P33Vm! z;W$Ow)_K63f6-!EbFSvxSi&5(4LmG0XUl?gm(#SGtmfB|R3w!q%;{RM{ML+|9%_a` zhaGpwq$I(#iVYbM~KH6aV_$ukaUqfB+Bx0zd!=00AHX1c1PsNZ`0I zOwONQ{xU$V!{^WO!ki7xmidBVu!%~AoIfZ3`z-2^Qk27`hU4_`w{g>E6`#j6H(K>y8 z%3A literal 0 HcmV?d00001 diff --git a/test/integration/run.sh b/test/integration/run.sh new file mode 100644 index 0000000..222438a --- /dev/null +++ b/test/integration/run.sh @@ -0,0 +1,14 @@ +#!/bin/sh +echo "Starting integration test." + +# Start pocketbase server +/app/pocketbase serve --http=0.0.0.0:8090 & + +echo "Waiting for server to start." +while ! nc -z localhost 8090 { { name: "books", id: "123", + type: "base", system: false, listRule: null, viewRule: null, @@ -58,7 +59,7 @@ describe("createCollectionEnum", () => { describe("createCollectionRecord", () => { it("creates mapping of collection name to record type", () => { const names = ["book", "magazine"] - expect(createCollectionRecord(names)).toMatchSnapshot() + expect(createCollectionRecords(names)).toMatchSnapshot() }) }) @@ -100,19 +101,30 @@ describe("createRecordType", () => { describe("createResponseType", () => { it("creates type definition for a response", () => { - const name = "books" - const schema: FieldSchema[] = [ - { - system: false, - id: "hhnwjkke", - name: "title", - type: "text", - required: false, - unique: false, - options: { min: null, max: null, pattern: "" }, - }, - ] - const result = createResponseType(name, schema) + const row: CollectionRecord = { + type: "base", + id: "123", + system: false, + listRule: null, + viewRule: null, + createRule: null, + updateRule: null, + deleteRule: null, + name: "books", + schema: [ + { + system: false, + id: "hhnwjkke", + name: "title", + type: "text", + required: false, + unique: false, + options: { min: null, max: null, pattern: "" }, + }, + ], + } + + const result = createResponseType(row) expect(result).toMatchSnapshot() }) @@ -137,75 +149,96 @@ describe("createResponseType", () => { describe("createTypeField", () => { it("handles required and optional fields", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, required: false, }) - ).toEqual("\tdefaultName?: string\n") + ).toEqual("\tdefaultName?: string") expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, required: true, }) - ).toEqual("\tdefaultName: string\n") + ).toEqual("\tdefaultName: string") }) - it("converts pocketbase schema types to typescript", () => { + it("converts default types to typescript", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, }) - ).toEqual("\tdefaultName: string\n") + ).toEqual("\tdefaultName: string") expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, name: "textField", }) - ).toEqual("\ttextField: string\n") + ).toEqual("\ttextField: string") + }) + + it("converts number type", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, name: "numberField", type: "number", }) - ).toEqual("\tnumberField: number\n") + ).toEqual("\tnumberField: number") + }) + + it("converts bool type", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, name: "boolField", type: "bool", }) - ).toEqual("\tboolField: boolean\n") + ).toEqual("\tboolField: boolean") + }) + + it("converts email type", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, name: "emailField", type: "email", }) - ).toEqual("\temailField: string\n") + ).toEqual("\temailField: string") + }) + + it("converts url type", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, name: "urlField", type: "url", }) - ).toEqual("\turlField: string\n") + ).toEqual("\turlField: string") + }) + + it("converts date type", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, name: "dateField", type: "date", }) - ).toEqual("\tdateField: IsoDateString\n") + ).toEqual("\tdateField: IsoDateString") + }) + + it("converts select type", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, name: "selectField", type: "select", }) - ).toEqual("\tselectField: string\n") + ).toEqual("\tselectField: string") + }) + + it("converts select type with value", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, name: "selectFieldWithOpts", type: "select", @@ -213,23 +246,32 @@ describe("createTypeField", () => { values: ["one", "two", "three"], }, }) - ).toEqual(`\tselectFieldWithOpts: "one" | "two" | "three"\n`) + ).toEqual(`\tselectFieldWithOpts: TestCollectionSelectFieldWithOptsOptions`) + }) + + it("converts json type", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, name: "jsonField", type: "json", }) - ).toEqual("\tjsonField: null | TjsonField\n") + ).toEqual("\tjsonField: null | TjsonField") + }) + + it("converts file type", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, name: "fileField", type: "file", }) - ).toEqual("\tfileField: string\n") + ).toEqual("\tfileField: string") + }) + + it("converts file type with multiple files", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, name: "fileField", type: "file", @@ -237,27 +279,50 @@ describe("createTypeField", () => { maxSelect: 3, }, }) - ).toEqual("\tfileField: string[]\n") + ).toEqual("\tfileField: string[]") + }) + + it("converts relation type", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, name: "relationField", type: "relation", }) - ).toEqual("\trelationField: RecordIdString\n") + ).toEqual("\trelationField: RecordIdString") + }) + + it("converts relation type with multiple options", () => { + expect( + createTypeField("test_collection", { + ...defaultFieldSchema, + name: "relationFieldMany", + type: "relation", + options: { + maxSelect: 3, + }, + }) + ).toEqual("\trelationFieldMany: RecordIdString[]") + }) + + // DEPRECATED: This was removed in PocketBase v0.8 + it("converts user relation type", () => { expect( - createTypeField({ + createTypeField("test_collection", { ...defaultFieldSchema, - name: "userField", + name: "userRelationField", type: "user", }) - ).toEqual("\tuserField: UserIdString\n") + ).toEqual("\tuserRelationField: RecordIdString") }) it("throws for unexpected types", () => { expect(() => - // @ts-ignore - createTypeField({ ...defaultFieldSchema, type: "unknowntype" }) + createTypeField("test_collection", { + ...defaultFieldSchema, + // @ts-ignore + type: "unknowntype", + }) ).toThrowError("unknown type unknowntype found in schema") }) }) diff --git a/test/pb_schema.json b/test/pb_schema.json index 73486a6..2cf0782 100644 --- a/test/pb_schema.json +++ b/test/pb_schema.json @@ -1,28 +1,12 @@ [ { - "id": "systemprofiles0", - "name": "profiles", - "system": true, - "listRule": "userId = @request.user.id", - "viewRule": "userId = @request.user.id", - "createRule": "userId = @request.user.id", - "updateRule": "userId = @request.user.id", - "deleteRule": null, + "id": "_pb_users_auth_", + "name": "users", + "type": "auth", + "system": false, "schema": [ { - "id": "pbfielduser", - "name": "userId", - "type": "user", - "system": true, - "required": true, - "unique": true, - "options": { - "maxSelect": 1, - "cascadeDelete": true - } - }, - { - "id": "pbfieldname", + "id": "users_name", "name": "name", "type": "text", "system": false, @@ -35,7 +19,7 @@ } }, { - "id": "pbfieldavatar", + "id": "users_avatar", "name": "avatar", "type": "file", "system": false, @@ -54,24 +38,35 @@ "thumbs": null } } - ] + ], + "listRule": "id = @request.auth.id", + "viewRule": "id = @request.auth.id", + "createRule": "", + "updateRule": "id = @request.auth.id", + "deleteRule": "id = @request.auth.id", + "options": { + "allowEmailAuth": true, + "allowOAuth2Auth": true, + "allowUsernameAuth": true, + "exceptEmailDomains": null, + "manageRule": null, + "minPasswordLength": 8, + "onlyEmailDomains": null, + "requireEmail": false + } }, { - "id": "l9oq1jy97be69be", - "name": "every_type", + "id": "8uexthr74u6jat4", + "name": "everything", + "type": "base", "system": false, - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, "schema": [ { - "id": "locu2fqr", + "id": "ze7zu2ji", "name": "text_field", "type": "text", "system": false, - "required": true, + "required": false, "unique": false, "options": { "min": null, @@ -80,11 +75,11 @@ } }, { - "id": "4pqdzxck", + "id": "6chpapqa", "name": "number_field", "type": "number", "system": false, - "required": true, + "required": false, "unique": false, "options": { "min": null, @@ -92,28 +87,28 @@ } }, { - "id": "xtjqakgy", + "id": "bunghw2b", "name": "bool_field", "type": "bool", "system": false, - "required": true, + "required": false, "unique": false, "options": {} }, { - "id": "dc9wxgad", + "id": "kgt2vwcr", "name": "email_field", "type": "email", "system": false, "required": false, "unique": false, "options": { - "exceptDomains": null, - "onlyDomains": null + "exceptDomains": [], + "onlyDomains": [] } }, { - "id": "ptemvsvm", + "id": "pbyqwc6g", "name": "url_field", "type": "url", "system": false, @@ -125,7 +120,7 @@ } }, { - "id": "6reugpzq", + "id": "erxbavbq", "name": "date_field", "type": "date", "system": false, @@ -137,7 +132,7 @@ } }, { - "id": "5tsmp1az", + "id": "hy5g988n", "name": "select_field", "type": "select", "system": false, @@ -149,7 +144,7 @@ } }, { - "id": "jo91e9vw", + "id": "pbwoyo77", "name": "json_field", "type": "json", "system": false, @@ -158,7 +153,16 @@ "options": {} }, { - "id": "f2x5ly7x", + "id": "balhjgn8", + "name": "another_json_field", + "type": "json", + "system": false, + "required": false, + "unique": false, + "options": {} + }, + { + "id": "cdblcmro", "name": "file_field", "type": "file", "system": false, @@ -172,84 +176,188 @@ } }, { - "id": "uky0rgym", - "name": "relation_field", + "id": "uxeyxkfd", + "name": "three_files_field", + "type": "file", + "system": false, + "required": false, + "unique": false, + "options": { + "maxSelect": 3, + "maxSize": 5242880, + "mimeTypes": [], + "thumbs": [] + } + }, + { + "id": "vyuzrvxm", + "name": "user_relation_field", "type": "relation", "system": false, "required": false, "unique": false, "options": { "maxSelect": 1, - "collectionId": "dkrwccg04gaf6n0", + "collectionId": "_pb_users_auth_", + "cascadeDelete": false + } + }, + { + "id": "fjzpmh9i", + "name": "custom_relation_field", + "type": "relation", + "system": false, + "required": false, + "unique": false, + "options": { + "maxSelect": 5, + "collectionId": "rs7hepu8zl6kr8e", "cascadeDelete": false } }, { - "id": "qerbl31d", - "name": "user_field", - "type": "user", + "id": "iwh5jvyg", + "name": "post_relation_field", + "type": "relation", "system": false, "required": false, "unique": false, "options": { "maxSelect": 1, + "collectionId": "z6b9mssubo9megi", "cascadeDelete": false } + }, + { + "id": "tccaq6g6", + "name": "select_field_no_values", + "type": "text", + "system": false, + "required": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } } - ] - }, - { - "id": "dkrwccg04gaf6n0", - "name": "orders", - "system": false, + ], "listRule": null, "viewRule": null, "createRule": null, "updateRule": null, "deleteRule": null, + "options": {} + }, + { + "id": "z6b9mssubo9megi", + "name": "posts", + "type": "base", + "system": false, "schema": [ { - "id": "fbipzebf", - "name": "amount", - "type": "number", + "id": "wzasqdgc", + "name": "field", + "type": "text", "system": false, - "required": true, + "required": false, "unique": false, "options": { "min": null, - "max": null + "max": null, + "pattern": "" } }, { - "id": "gvuptuxz", - "name": "payment_type", - "type": "select", + "id": "175adqww", + "name": "nonempty_field", + "type": "text", "system": false, "required": true, "unique": false, "options": { - "maxSelect": 1, - "values": ["credit card", "paypal", "crypto"] + "min": null, + "max": null, + "pattern": "" } }, { - "id": "bnji5emw", - "name": "user", - "type": "user", + "id": "s3cl0rdp", + "name": "nonempty_bool", + "type": "bool", "system": false, "required": true, "unique": false, + "options": {} + }, + { + "id": "36buozcb", + "name": "field1", + "type": "number", + "system": false, + "required": false, + "unique": false, "options": { - "maxSelect": 1, - "cascadeDelete": false + "min": null, + "max": null } - }, + } + ], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "rs7hepu8zl6kr8e", + "name": "custom_auth", + "type": "auth", + "system": false, + "schema": [ { - "id": "pfelzqqv", - "name": "product", + "id": "zj6cku68", + "name": "custom_field", "type": "text", "system": false, - "required": true, + "required": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + } + ], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": { + "allowEmailAuth": true, + "allowOAuth2Auth": true, + "allowUsernameAuth": true, + "exceptEmailDomains": null, + "manageRule": null, + "minPasswordLength": 8, + "onlyEmailDomains": null, + "requireEmail": false + } + }, + { + "id": "kr8109mcfuu18qq", + "name": "base", + "type": "base", + "system": false, + "schema": [ + { + "id": "epgo3hyb", + "name": "field", + "type": "text", + "system": false, + "required": false, "unique": false, "options": { "min": null, @@ -257,6 +365,12 @@ "pattern": "" } } - ] + ], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} } ] diff --git a/test/pocketbase-types-example.ts b/test/pocketbase-types-example.ts index d341b97..c682923 100644 --- a/test/pocketbase-types-example.ts +++ b/test/pocketbase-types-example.ts @@ -1,61 +1,92 @@ -// This file was @generated using pocketbase-typegen +/** +* This file was @generated using pocketbase-typegen +*/ -export type IsoDateString = string +export enum Collections { + Base = "base", + CustomAuth = "custom_auth", + Everything = "everything", + Posts = "posts", + Users = "users", +} +// Alias types for improved usability +export type IsoDateString = string export type RecordIdString = string -export type UserIdString = string - -export type BaseRecord = { +// System fields +export type BaseSystemFields = { id: RecordIdString created: IsoDateString updated: IsoDateString - "@collectionId": string - "@collectionName": string - "@expand"?: { [key: string]: any } + collectionId: string + collectionName: Collections + expand?: { [key: string]: any } } -export enum Collections { - EveryType = "every_type", - Orders = "orders", - Profiles = "profiles", +export type AuthSystemFields = { + email: string + emailVisibility: boolean + username: string + verified: boolean +} & BaseSystemFields + +// Record types for each collection + +export type BaseRecord = { + field?: string +} + +export type CustomAuthRecord = { + custom_field?: string } -export type EveryTypeRecord = { - text_field: string - number_field: number - bool_field: boolean +export enum EverythingSelectFieldOptions { + optionA = "optionA", + optionB = "optionB", + optionC = "optionC", +} +export type EverythingRecord = { + text_field?: string + number_field?: number + bool_field?: boolean email_field?: string url_field?: string date_field?: IsoDateString - select_field?: "optionA" | "optionB" | "optionC" + select_field?: EverythingSelectFieldOptions json_field?: null | Tjson_field + another_json_field?: null | Tanother_json_field file_field?: string - relation_field?: RecordIdString - user_field?: UserIdString + three_files_field?: string[] + user_relation_field?: RecordIdString + custom_relation_field?: RecordIdString[] + post_relation_field?: RecordIdString + select_field_no_values?: string } -export type EveryTypeResponse = EveryTypeRecord & BaseRecord - -export type OrdersRecord = { - amount: number - payment_type: "credit card" | "paypal" | "crypto" - user: UserIdString - product: string +export type PostsRecord = { + field?: string + nonempty_field: string + nonempty_bool: boolean + field1?: number } -export type OrdersResponse = OrdersRecord & BaseRecord - -export type ProfilesRecord = { - userId: UserIdString +export type UsersRecord = { name?: string avatar?: string } -export type ProfilesResponse = ProfilesRecord & BaseRecord +// Response types include system fields and match responses from the PocketBase API +export type BaseResponse = BaseRecord & BaseSystemFields +export type CustomAuthResponse = CustomAuthRecord & AuthSystemFields +export type EverythingResponse = EverythingRecord & BaseSystemFields +export type PostsResponse = PostsRecord & BaseSystemFields +export type UsersResponse = UsersRecord & AuthSystemFields export type CollectionRecords = { - every_type: EveryTypeRecord - orders: OrdersRecord - profiles: ProfilesRecord + base: BaseRecord + custom_auth: CustomAuthRecord + everything: EverythingRecord + posts: PostsRecord + users: UsersRecord } \ No newline at end of file diff --git a/test/typecheck.ts b/test/typecheck.ts index 1bf5216..7391a43 100644 --- a/test/typecheck.ts +++ b/test/typecheck.ts @@ -5,7 +5,8 @@ import { CollectionRecords, Collections, - EveryTypeRecord, + EverythingRecord, + EverythingSelectFieldOptions, } from "./pocketbase-types-example" // Utility function can to infer collection type @@ -13,26 +14,37 @@ function getOne( collection: T, id: string ): CollectionRecords[T] { + console.log(collection, id) return JSON.parse("id") as CollectionRecords[T] } // Return type is correctly inferred -let thing = getOne(Collections.EveryType, "a") +const thing = getOne(Collections.Everything, "a") // Works when passing in JSON generic -const everythingRecordWithGeneric: EveryTypeRecord<{ a: "some string" }> = { +const everythingRecordWithGeneric: EverythingRecord<{ a: "some string" }> = { json_field: { a: "some string" }, - text_field: "string", number_field: 1, bool_field: true, } // Works without passing in JSON generic -const everythingRecordWithoutGeneric: EveryTypeRecord = { +const everythingRecordWithoutGeneric: EverythingRecord = { json_field: { a: "some string" }, - text_field: "string", number_field: 1, bool_field: true, } -console.log(thing, everythingRecordWithGeneric, everythingRecordWithoutGeneric) +// Test select option enums +const selectOptions: EverythingRecord = { + select_field: EverythingSelectFieldOptions.optionA, + select_field_no_values: "foo", +} + +// Reference the created variables +console.log( + thing, + everythingRecordWithGeneric, + everythingRecordWithoutGeneric, + selectOptions +) diff --git a/test/utils.test.ts b/test/utils.test.ts index f71781d..7647856 100644 --- a/test/utils.test.ts +++ b/test/utils.test.ts @@ -1,4 +1,9 @@ -import { sanitizeFieldName, toPascalCase } from "../src/utils" +import { + getOptionEnumName, + getSystemFields, + sanitizeFieldName, + toPascalCase, +} from "../src/utils" describe("toPascalCase", () => { it("return pascal case string", () => { @@ -22,3 +27,19 @@ describe("sanitizeFieldName", () => { expect(sanitizeFieldName("4number")).toEqual('"4number"') }) }) + +describe("getSystemFields", () => { + it("returns the system field type name for a given collection type", () => { + expect(getSystemFields("base")).toBe("BaseSystemFields") + expect(getSystemFields("auth")).toBe("AuthSystemFields") + }) +}) + +describe("getOptionEnumName", () => { + it("returns the enum name for select field options", () => { + expect(getOptionEnumName("orders", "type")).toBe("OrdersTypeOptions") + expect(getOptionEnumName("orders_with_underscore", "type_underscore")).toBe( + "OrdersWithUnderscoreTypeUnderscoreOptions" + ) + }) +})