diff --git a/deno/README.md b/deno/README.md deleted file mode 100644 index 9b5875bb1..000000000 --- a/deno/README.md +++ /dev/null @@ -1,3 +0,0 @@ -Feathers logo - -> **Important:** An experimental Deno first implementation is currently under development at https://github.com/feathersjs/feathers/pull/2828 diff --git a/generators/package.ts b/generators/package.ts new file mode 100644 index 000000000..2793515f9 --- /dev/null +++ b/generators/package.ts @@ -0,0 +1,43 @@ +import type { Callable, PinionContext } from '@feathershq/pinion' +import { generator, install, prompt, runGenerators, toFile } from '@feathershq/pinion' + +export interface ModuleContext extends PinionContext { + name: string + uppername: string + description: string + moduleName: string + packagePath: Callable +} + +export const generate = (context: ModuleContext) => + generator(context) + .then( + prompt([ + { + type: 'input', + name: 'name', + message: 'What is the name of the module?' + }, + { + type: 'input', + name: 'description', + message: 'Write a short description' + } + ]) + ) + .then((ctx) => { + return { + ...ctx, + moduleName: `@feathersjs/${ctx.name}`, + uppername: ctx.name.charAt(0).toUpperCase() + ctx.name.slice(1), + packagePath: toFile('packages', ctx.name) + } + }) + .then(runGenerators(__dirname, 'package')) + .then( + install( + ['@types/node', 'shx', 'ts-node', 'typescript', 'mocha'], + true, + (context) => `npm --workspace packages/${context.name}` + ) + ) diff --git a/generators/package/index.tpl.ts b/generators/package/index.tpl.ts new file mode 100644 index 000000000..676166608 --- /dev/null +++ b/generators/package/index.tpl.ts @@ -0,0 +1,13 @@ +import { generator, renderTemplate, toFile } from '@feathershq/pinion' +import { ModuleContext } from '../package' + +interface Context extends ModuleContext {} + +const template = ({ name }: Context) => ` +export function ${name}() { + return 'Hello from ${name}' +} +` + +export const generate = (context: Context) => + generator(context).then(renderTemplate(template, toFile(context.packagePath, 'src', 'index.ts'))) diff --git a/generators/package/license.tpl.ts b/generators/package/license.tpl.ts new file mode 100644 index 000000000..173ed4e2e --- /dev/null +++ b/generators/package/license.tpl.ts @@ -0,0 +1,33 @@ +import { generator, renderTemplate, toFile } from '@feathershq/pinion' +import { ModuleContext } from '../package' + +interface Context extends ModuleContext {} + +export const generate = (context: Context) => + generator(context).then( + renderTemplate( + `The MIT License (MIT) + +Copyright (c) ${new Date().getFullYear()} Feathers Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + `, + toFile(context.packagePath, 'LICENSE') + ) + ) diff --git a/generators/package/package.json.tpl.ts b/generators/package/package.json.tpl.ts new file mode 100644 index 000000000..ae9c8a1fd --- /dev/null +++ b/generators/package/package.json.tpl.ts @@ -0,0 +1,58 @@ +import { generator, toFile, writeJSON } from '@feathershq/pinion' +import { ModuleContext } from '../package' + +interface Context extends ModuleContext {} + +export const generate = (context: Context) => + generator(context).then( + writeJSON( + ({ moduleName, description, name }) => ({ + name: moduleName, + description, + version: '0.0.0', + homepage: 'https://feathersjs.com', + keywords: ['feathers'], + license: 'MIT', + repository: { + type: 'git', + url: 'git://github.com/feathersjs/feathers.git', + directory: `packages/${name}` + }, + author: { + name: 'Feathers contributor', + email: 'hello@feathersjs.com', + url: 'https://feathersjs.com' + }, + contributors: [], + bugs: { + url: 'https://github.com/feathersjs/feathers/issues' + }, + engines: { + node: '>= 20' + }, + files: ['CHANGELOG.md', 'LICENSE', 'README.md', 'src/**', 'lib/**', 'esm/**'], + // module: './esm/index.js', + main: './lib/index.js', + types: './src/index.ts', + exports: { + '.': { + // import: './esm/index.js', + require: './lib/index.js', + types: './src/index.ts' + } + }, + scripts: { + prepublish: 'npm run compile', + pack: 'npm pack --pack-destination ../generators/test/build', + compile: 'shx rm -rf lib/ && tsc && npm run pack', + test: 'mocha --config ../../.mocharc.json --recursive test/**.test.ts test/**/*.test.ts' + }, + publishConfig: { + access: 'public' + }, + dependencies: {}, + devDependencies: {} + }), + toFile('packages', context.name, 'package.json') + ) + ) diff --git a/generators/package/readme.md.tpl.ts b/generators/package/readme.md.tpl.ts new file mode 100644 index 000000000..b5946f5f5 --- /dev/null +++ b/generators/package/readme.md.tpl.ts @@ -0,0 +1,30 @@ +import { generator, renderTemplate, toFile } from '@feathershq/pinion' +import { ModuleContext } from '../package' + +const template = ({ description, moduleName }: ModuleContext) => `# ${moduleName} + +[![CI](https://github.com/feathersjs/feathers/workflows/CI/badge.svg)](https://github.com/feathersjs/feathers/actions?query=workflow%3ACI) +[![Download Status](https://img.shields.io/npm/dm/${moduleName}.svg?style=flat-square)](https://www.npmjs.com/package/${moduleName}) +[![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/qa8kez8QBx) + +> ${description} + +## Installation + +\`\`\` +npm install ${moduleName} --save +\`\`\` + +## Documentation + +Refer to the [Feathers API documentation](https://feathersjs.com/api) for more details. + +## License + +Copyright (c) ${new Date().getFullYear()} [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors) + +Licensed under the [MIT license](LICENSE). +` + +export const generate = (context: ModuleContext) => + generator(context).then(renderTemplate(template, toFile(context.packagePath, 'README.md'))) diff --git a/generators/package/test.tpl.ts b/generators/package/test.tpl.ts new file mode 100644 index 000000000..c2b6f4f2e --- /dev/null +++ b/generators/package/test.tpl.ts @@ -0,0 +1,19 @@ +import { generator, renderTemplate, toFile } from '@feathershq/pinion' +import { ModuleContext } from '../package' + +interface Context extends ModuleContext {} + +const template = ({ moduleName, name }: Context) => /** ts */ `import { strict as assert } from 'assert' +import { ${name} } from '../src/index' + +describe('${moduleName}', () => { + it('initializes', () => { + assert.equal(${name}(), 'Hello from ${name}') + }) +}) +` + +export const generate = (context: Context) => + generator(context).then( + renderTemplate(template, toFile(context.packagePath, 'test', 'index.test.ts')) + ) diff --git a/generators/package/tsconfig.json.tpl.ts b/generators/package/tsconfig.json.tpl.ts new file mode 100644 index 000000000..820b5a3a8 --- /dev/null +++ b/generators/package/tsconfig.json.tpl.ts @@ -0,0 +1,16 @@ +import { generator, toFile, writeJSON } from '@feathershq/pinion' +import { ModuleContext } from '../package' + +export const generate = (context: ModuleContext) => + generator(context).then( + writeJSON( + { + extends: '../../tsconfig', + include: ['src/**/*.ts'], + compilerOptions: { + outDir: 'lib' + } + }, + toFile(context.packagePath, 'tsconfig.json') + ) + ) diff --git a/package-lock.json b/package-lock.json index 42a3792c4..30e7e3e64 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "packages/*" ], "devDependencies": { + "@feathershq/pinion": "^0.4.0-pre.3", "@typescript-eslint/eslint-plugin": "^6.12.0", "@typescript-eslint/parser": "^6.12.0", "c8": "^8.0.1", @@ -2971,17 +2972,34 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@feathershq/pinion": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@feathershq/pinion/-/pinion-0.3.5.tgz", - "integrity": "sha512-mH7s62TlQKCbej2yFF139mAE9eEAvGmek0HkRW3pk7xWLMGXR94wbsW+KBMg6UHFPz71pevfb27tnF7zhKa1/g==", + "node_modules/@feathershq/api": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@feathershq/api/-/api-0.3.1.tgz", + "integrity": "sha512-jZRhz/3kQdlGC/bf//pTqPxqF+cAvz9OFNv4UhPeYRfLs4NmD9n/Rlis9hqFLZ6+MbY2jN78GUbomuGizDLT5A==", + "dev": true, "dependencies": { - "@types/inquirer": "^8.2.1", - "@types/yargs": "^17.0.10", - "chalk": "^4.0.1", + "@feathersjs/authentication-client": "^5.0.6", + "@feathersjs/feathers": "^5.0.6", + "@feathersjs/socketio-client": "^5.0.6", + "socket.io-client": "^4.6.2" + }, + "engines": { + "node": ">= 16" + } + }, + "node_modules/@feathershq/pinion": { + "version": "0.4.0-pre.3", + "resolved": "https://registry.npmjs.org/@feathershq/pinion/-/pinion-0.4.0-pre.3.tgz", + "integrity": "sha512-nAH/PnivnqSooWs/TLnQIrswr0Sr10xZ9wRu9oXkdrSbaTnz16ZdP3dL2nkNU5B1r+A/i30JT6QM0Sq8bowb9A==", + "dev": true, + "dependencies": { + "@feathershq/api": "^0.3.1", + "@types/inquirer": "^9.0.3", + "chalk": "^4.0.0", + "commander": "^10.0.1", "inquirer": "^8.0.0", - "ts-node": "^10.9.1", - "yargs": "^17.5.1" + "open": "^8.4.0", + "ts-node": "^10.9.1" }, "bin": { "pinion": "bin/pinion" @@ -2994,42 +3012,13 @@ "url": "https://github.com/sponsors/daffl" } }, - "node_modules/@feathershq/pinion/node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, + "node_modules/@feathershq/pinion/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, "engines": { - "node": ">=12" - } - }, - "node_modules/@feathershq/pinion/node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@feathershq/pinion/node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "engines": { - "node": ">=12" + "node": ">=14" } }, "node_modules/@feathersjs/adapter-commons": { @@ -3056,6 +3045,10 @@ "resolved": "packages/authentication-oauth", "link": true }, + "node_modules/@feathersjs/blablfdsjkl": { + "resolved": "packages/blablfdsjkl", + "link": true + }, "node_modules/@feathersjs/cli": { "resolved": "packages/cli", "link": true @@ -5305,9 +5298,10 @@ "integrity": "sha512-/K3ds8TRAfBvi5vfjuz8y6+GiAYBZ0x4tXv1Av6CWBWn0IlADc+ZX9pMq7oU0fNQPnBwIZl3rmeLp6SBApbxSQ==" }, "node_modules/@types/inquirer": { - "version": "8.2.6", - "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-8.2.6.tgz", - "integrity": "sha512-3uT88kxg8lNzY8ay2ZjP44DKcRaTGztqeIvN2zHvhzIBH/uAPaL75aBtdNRKbA7xXoMbBt5kX0M00VKAnfOYlA==", + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-9.0.7.tgz", + "integrity": "sha512-Q0zyBupO6NxGRZut/JdmqYKOnN95Eg5V8Csg3PGKkP+FnvsUZx1jAyK7fztIszxxMuoBA6E3KXWvdZVXIpx60g==", + "dev": true, "dependencies": { "@types/through": "*", "rxjs": "^7.2.0" @@ -5442,9 +5436,9 @@ } }, "node_modules/@types/node": { - "version": "20.10.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.0.tgz", - "integrity": "sha512-D0WfRmU9TQ8I9PFx9Yc+EBHw+vSpIub4IDvQivcp26PtPrdMGAq5SDcpXEo/epqa/DXotVpekHiLNTg3iaKXBQ==", + "version": "20.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.1.tgz", + "integrity": "sha512-T2qwhjWwGH81vUEx4EXmBKsTJRXFXNZTL4v0gi01+zyBmCwzE6TyHszqX01m+QHTEq+EZNo13NeJIdEqf+Myrg==", "dependencies": { "undici-types": "~5.26.4" } @@ -5516,9 +5510,9 @@ } }, "node_modules/@types/through": { - "version": "0.0.30", - "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.30.tgz", - "integrity": "sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==", + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.33.tgz", + "integrity": "sha512-HsJ+z3QuETzP3cswwtzt2vEIiHBk/dCcHGhbmG5X3ecnwFD/lPrMpliGXxSCg03L9AhrdwA4Oz/qfspkDW+xGQ==", "dependencies": { "@types/node": "*" } @@ -5549,17 +5543,17 @@ } }, "node_modules/@types/yargs": { - "version": "17.0.24", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", - "integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==", + "version": "17.0.32", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", + "integrity": "sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==", "dependencies": { "@types/yargs-parser": "*" } }, "node_modules/@types/yargs-parser": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", - "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==" }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "6.12.0", @@ -23419,6 +23413,30 @@ "url": "https://github.com/sponsors/daffl" } }, + "packages/blabla": { + "name": "@feathersjs/blabla", + "version": "0.0.0", + "extraneous": true, + "license": "MIT", + "devDependencies": { + "@types/node": "^20.10.1", + "mocha": "^10.2.0", + "shx": "^0.3.4", + "ts-node": "^10.9.1", + "typescript": "^5.3.2" + }, + "engines": { + "node": ">= 20" + } + }, + "packages/blablfdsjkl": { + "version": "0.0.0", + "license": "MIT", + "devDependencies": {}, + "engines": { + "node": ">= 20" + } + }, "packages/cli": { "name": "@feathersjs/cli", "version": "5.0.12", @@ -23716,6 +23734,51 @@ "url": "https://github.com/sponsors/daffl" } }, + "packages/generators/node_modules/@feathershq/pinion": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@feathershq/pinion/-/pinion-0.3.5.tgz", + "integrity": "sha512-mH7s62TlQKCbej2yFF139mAE9eEAvGmek0HkRW3pk7xWLMGXR94wbsW+KBMg6UHFPz71pevfb27tnF7zhKa1/g==", + "dependencies": { + "@types/inquirer": "^8.2.1", + "@types/yargs": "^17.0.10", + "chalk": "^4.0.1", + "inquirer": "^8.0.0", + "ts-node": "^10.9.1", + "yargs": "^17.5.1" + }, + "bin": { + "pinion": "bin/pinion" + }, + "engines": { + "node": ">= 14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/daffl" + } + }, + "packages/generators/node_modules/@types/inquirer": { + "version": "8.2.10", + "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-8.2.10.tgz", + "integrity": "sha512-IdD5NmHyVjWM8SHWo/kPBgtzXatwPkfwzyP3fN1jF2g9BWt5WO+8hL2F4o2GKIYsU40PpqeevuUWvkS/roXJkA==", + "dependencies": { + "@types/through": "*", + "rxjs": "^7.2.0" + } + }, + "packages/generators/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, "packages/generators/node_modules/type-fest": { "version": "4.8.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.8.2.tgz", @@ -23728,6 +23791,31 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "packages/generators/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "packages/generators/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "engines": { + "node": ">=12" + } + }, "packages/knex": { "name": "@feathersjs/knex", "version": "5.0.12", diff --git a/package.json b/package.json index cba164d02..bd65ac705 100644 --- a/package.json +++ b/package.json @@ -39,9 +39,11 @@ "update-dependencies": "ncu -u && lerna exec -- ncu -u --dep prod,dev,optional,peer -x node-fetch,chalk,\"@sinclair/typebox\"", "clean": "find . -name node_modules -exec rm -rf '{}' + && find . -name package-lock.json -exec rm -rf '{}' +", "test:deno": "deno test --config deno/tsconfig.json deno/test.ts", - "test": "npm run lint && npm run compile && c8 lerna run test --ignore @feathersjs/tests" + "test": "npm run lint && npm run compile && c8 lerna run test --ignore @feathersjs/tests", + "generate:package": "pinion run generators/package.ts" }, "devDependencies": { + "@feathershq/pinion": "^0.4.0-pre.3", "@typescript-eslint/eslint-plugin": "^6.12.0", "@typescript-eslint/parser": "^6.12.0", "c8": "^8.0.1", diff --git a/packages/authentication-oauth/test/utils/provider.ts b/packages/authentication-oauth/test/utils/provider.ts index 77eafa7a8..7a63e25e8 100644 --- a/packages/authentication-oauth/test/utils/provider.ts +++ b/packages/authentication-oauth/test/utils/provider.ts @@ -68,10 +68,10 @@ const oauth1 = (port: number) => provider === 'getpocket' ? res.end(qs.stringify({ code: 'code' })) : provider === 'sellsy' - ? res.end( - 'authentification_url=https://apifeed.sellsy.com/0/login.php&oauth_token=token&oauth_token_secret=secret&oauth_callback_confirmed=true' - ) - : res.end(qs.stringify({ oauth_token: 'token', oauth_token_secret: 'secret' })) + ? res.end( + 'authentification_url=https://apifeed.sellsy.com/0/login.php&oauth_token=token&oauth_token_secret=secret&oauth_callback_confirmed=true' + ) + : res.end(qs.stringify({ oauth_token: 'token', oauth_token_secret: 'secret' })) }) } else if (/authorize_url/.test(url)) { const location = callback + '?' + qs.stringify({ oauth_token: 'token', oauth_verifier: 'verifier' }) @@ -180,26 +180,26 @@ const oauth2 = (port: number) => provider === 'concur' ? res.end(' token refresh ') : provider === 'withings' - ? res.end( - JSON.stringify({ - body: { + ? res.end( + JSON.stringify({ + body: { + access_token: 'token', + refresh_token: 'refresh', + expires_in: 3600 + } + }) + ) + : res.end( + JSON.stringify({ access_token: 'token', refresh_token: 'refresh', - expires_in: 3600 - } - }) - ) - : res.end( - JSON.stringify({ - access_token: 'token', - refresh_token: 'refresh', - expires_in: 3600, - id_token: openid ? sign({ typ: 'JWT' }, { nonce: 'whatever' }, 'signature') : undefined, - open_id: provider === 'tiktok' ? 'id' : undefined, - uid: provider === 'weibo' ? 'id' : undefined, - openid: provider === 'wechat' ? 'openid' : undefined - }) - ) + expires_in: 3600, + id_token: openid ? sign({ typ: 'JWT' }, { nonce: 'whatever' }, 'signature') : undefined, + open_id: provider === 'tiktok' ? 'id' : undefined, + uid: provider === 'weibo' ? 'id' : undefined, + openid: provider === 'wechat' ? 'openid' : undefined + }) + ) }) } else if (/authorize_error_message/.test(url)) { on.authorize({ url, query, headers }) diff --git a/packages/memory/src/index.ts b/packages/memory/src/index.ts index 1843eeda8..543592aec 100644 --- a/packages/memory/src/index.ts +++ b/packages/memory/src/index.ts @@ -196,7 +196,11 @@ export class MemoryAdapter< async _patch(id: null, data: PatchData | Partial, params?: ServiceParams): Promise async _patch(id: Id, data: PatchData | Partial, params?: ServiceParams): Promise - async _patch(id: NullableId, data: PatchData | Partial, _params?: ServiceParams): Promise + async _patch( + id: NullableId, + data: PatchData | Partial, + _params?: ServiceParams + ): Promise async _patch( id: NullableId, data: PatchData | Partial, diff --git a/packages/mongodb/src/adapter.ts b/packages/mongodb/src/adapter.ts index 7112890b1..5b60b7dd7 100644 --- a/packages/mongodb/src/adapter.ts +++ b/packages/mongodb/src/adapter.ts @@ -303,7 +303,11 @@ export class MongoDbAdapter< async _patch(id: null, data: PatchData | Partial, params?: ServiceParams): Promise async _patch(id: AdapterId, data: PatchData | Partial, params?: ServiceParams): Promise - async _patch(id: NullableAdapterId, data: PatchData | Partial, _params?: ServiceParams): Promise + async _patch( + id: NullableAdapterId, + data: PatchData | Partial, + _params?: ServiceParams + ): Promise async _patch( id: NullableAdapterId, _data: PatchData | Partial, diff --git a/packages/schema/src/hooks/validate.ts b/packages/schema/src/hooks/validate.ts index 7b76a8c8a..37bcfb0a6 100644 --- a/packages/schema/src/hooks/validate.ts +++ b/packages/schema/src/hooks/validate.ts @@ -36,8 +36,8 @@ export const validateData = (schema: Schema | DataVa typeof (schema as Schema).validate === 'function' ? (schema as Schema).validate.bind(schema) : typeof schema === 'function' - ? schema - : (schema as any)[context.method] + ? schema + : (schema as any)[context.method] if (validator) { try {