From d39161622de7851e7ed1c212d10d6ad91c8ca7f4 Mon Sep 17 00:00:00 2001 From: ggurkal Date: Mon, 15 Aug 2022 17:09:43 +0200 Subject: [PATCH 1/6] refactor: rebranding --- LICENSE | 2 +- README.md | 22 +++++++-------- examples/route-matching/README.md | 4 +-- examples/route-matching/package.json | 2 +- examples/route-matching/pages/api/postman.ts | 2 +- .../pages/api/users/[[...params]].ts | 2 +- examples/route-matching/postman.json | 2 +- examples/route-matching/yarn.lock | 6 ++--- examples/with-next-auth/README.md | 4 +-- examples/with-next-auth/package.json | 2 +- .../pages/api/users/[[...params]].ts | 2 +- examples/with-next-auth/postman.json | 2 +- examples/with-next-auth/yarn.lock | 6 ++--- lib/createHandler.ts | 2 +- lib/decorators/httpMethod.decorators.ts | 22 +++++++-------- lib/internals/getCallerInfo.spec.ts | 12 ++++----- lib/internals/validateObject.spec.ts | 14 +++++----- lib/pipes/validators/validation.pipe.spec.ts | 2 +- lib/pipes/validators/validation.pipe.ts | 4 +-- package.json | 12 ++++----- website/docs/api/create-param-decorator.md | 2 +- website/docs/basics.md | 14 +++++----- website/docs/exceptions.md | 6 ++--- website/docs/getting-started.md | 6 ++--- website/docs/middlewares.md | 2 +- website/docs/route-matching.md | 2 +- website/docs/validation.md | 2 +- website/docusaurus.config.js | 14 +++++----- website/src/css/custom.css | 25 +++++++++++++----- website/src/pages/index.jsx | 2 +- website/static/img/favicon.ico | Bin 15086 -> 9662 bytes website/static/img/logo-dark.png | Bin 1826 -> 3574 bytes website/static/img/logo.png | Bin 1292 -> 3574 bytes 33 files changed, 106 insertions(+), 95 deletions(-) mode change 100755 => 100644 website/static/img/favicon.ico mode change 100755 => 100644 website/static/img/logo-dark.png mode change 100755 => 100644 website/static/img/logo.png diff --git a/LICENSE b/LICENSE index 8f161dcc..2586d508 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Story of AMS +Copyright (c) 2021 Instant Commerce Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 9b86935e..d516c9f1 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@
- - Story of AMS + + Instant Commerce -

@storyofams/next-api-decorators

+

@instantcommerce/next-api-decorators

- - + + - - + + - - + + - - + +

diff --git a/examples/route-matching/README.md b/examples/route-matching/README.md index 482df590..7e783417 100755 --- a/examples/route-matching/README.md +++ b/examples/route-matching/README.md @@ -1,6 +1,6 @@ -# @storyofams/next-api-decorators/example +# @instantcommerce/next-api-decorators/example -Example usage of the `@storyofams/next-api-decorators` with Next.js +Example usage of the `@instantcommerce/next-api-decorators` with Next.js ## Getting started diff --git a/examples/route-matching/package.json b/examples/route-matching/package.json index fb975d77..7437c64d 100644 --- a/examples/route-matching/package.json +++ b/examples/route-matching/package.json @@ -9,7 +9,7 @@ "type-check": "tsc" }, "dependencies": { - "@storyofams/next-api-decorators": "../../dist", + "@instantcommerce/next-api-decorators": "../../dist", "class-transformer": "^0.4.0", "class-validator": "^0.13.1", "next": "^12.1.0", diff --git a/examples/route-matching/pages/api/postman.ts b/examples/route-matching/pages/api/postman.ts index 3ab4f5ba..d3d4fe82 100644 --- a/examples/route-matching/pages/api/postman.ts +++ b/examples/route-matching/pages/api/postman.ts @@ -4,7 +4,7 @@ import { Download, DownloadFileResult, createHandler, -} from '@storyofams/next-api-decorators'; +} from '@instantcommerce/next-api-decorators'; class Postman { private pathToFile = `${process.cwd()}/postman.json`; diff --git a/examples/route-matching/pages/api/users/[[...params]].ts b/examples/route-matching/pages/api/users/[[...params]].ts index cd99c2a8..e612a62e 100644 --- a/examples/route-matching/pages/api/users/[[...params]].ts +++ b/examples/route-matching/pages/api/users/[[...params]].ts @@ -12,7 +12,7 @@ import { ParseNumberPipe, DefaultValuePipe, NotFoundException, -} from '@storyofams/next-api-decorators'; +} from '@instantcommerce/next-api-decorators'; import { User, sampleUserData } from '../../../data'; import { CreateUserInput, UpdateUserInput } from '../../../dto'; diff --git a/examples/route-matching/postman.json b/examples/route-matching/postman.json index 9ea5a725..577f0b32 100644 --- a/examples/route-matching/postman.json +++ b/examples/route-matching/postman.json @@ -1,6 +1,6 @@ { "info": { - "name": "@storyofams/next-api-decorators/example", + "name": "@instantcommerce/next-api-decorators/example", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ diff --git a/examples/route-matching/yarn.lock b/examples/route-matching/yarn.lock index 747811dc..5b6c6e49 100644 --- a/examples/route-matching/yarn.lock +++ b/examples/route-matching/yarn.lock @@ -320,6 +320,9 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" +"@instantcommerce/next-api-decorators@../../dist": + version "0.0.0" + "@mdx-js/util@1.6.22": version "1.6.22" resolved "https://registry.yarnpkg.com/@mdx-js/util/-/util-1.6.22.tgz#219dfd89ae5b97a8801f015323ffa4b62f45718b" @@ -390,9 +393,6 @@ resolved "https://registry.yarnpkg.com/@storyofams/eslint-config-ams/-/eslint-config-ams-1.1.3.tgz#ee6de44c89c6fabe401e6883f8b08ccc11fdc538" integrity sha512-iygvgZQIu8CicKYzXdHfEfrGXf23BeSeHrIDdj+zl0f85Al1lPINTC90y9xtQdbKKgw9iXrlmuiaJIjL1o1Y1w== -"@storyofams/next-api-decorators@../../dist": - version "0.0.0" - "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" diff --git a/examples/with-next-auth/README.md b/examples/with-next-auth/README.md index 19ca8010..efdf618f 100755 --- a/examples/with-next-auth/README.md +++ b/examples/with-next-auth/README.md @@ -1,6 +1,6 @@ -# `@storyofams/next-api-decorators` example with `next-auth` +# `@instantcommerce/next-api-decorators` example with `next-auth` -Example usage of the `@storyofams/next-api-decorators` with `next-auth`. This example only covers logging in via Github, for more providers please refer to `next-auth` documentation [here](https://next-auth.js.org/configuration/providers). +Example usage of the `@instantcommerce/next-api-decorators` with `next-auth`. This example only covers logging in via Github, for more providers please refer to `next-auth` documentation [here](https://next-auth.js.org/configuration/providers). ## Getting started diff --git a/examples/with-next-auth/package.json b/examples/with-next-auth/package.json index 654ebfe1..e7febeaf 100644 --- a/examples/with-next-auth/package.json +++ b/examples/with-next-auth/package.json @@ -9,7 +9,7 @@ "type-check": "tsc" }, "dependencies": { - "@storyofams/next-api-decorators": "../../dist", + "@instantcommerce/next-api-decorators": "../../dist", "class-transformer": "^0.4.0", "class-validator": "^0.13.1", "next": "^12.1.0", diff --git a/examples/with-next-auth/pages/api/users/[[...params]].ts b/examples/with-next-auth/pages/api/users/[[...params]].ts index 97c61cab..a6102bf4 100644 --- a/examples/with-next-auth/pages/api/users/[[...params]].ts +++ b/examples/with-next-auth/pages/api/users/[[...params]].ts @@ -8,7 +8,7 @@ import { NextFunction, UnauthorizedException, SetHeader, -} from '@storyofams/next-api-decorators'; +} from '@instantcommerce/next-api-decorators'; import { NextApiRequest, NextApiResponse } from 'next'; import { getToken } from 'next-auth/jwt'; import { User, sampleUserData } from '../../../data'; diff --git a/examples/with-next-auth/postman.json b/examples/with-next-auth/postman.json index 9ea5a725..577f0b32 100644 --- a/examples/with-next-auth/postman.json +++ b/examples/with-next-auth/postman.json @@ -1,6 +1,6 @@ { "info": { - "name": "@storyofams/next-api-decorators/example", + "name": "@instantcommerce/next-api-decorators/example", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ diff --git a/examples/with-next-auth/yarn.lock b/examples/with-next-auth/yarn.lock index a6e2fabb..8ce0a87a 100644 --- a/examples/with-next-auth/yarn.lock +++ b/examples/with-next-auth/yarn.lock @@ -320,6 +320,9 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" +"@instantcommerce/next-api-decorators@../../dist": + version "0.0.0" + "@mdx-js/util@1.6.22": version "1.6.22" resolved "https://registry.yarnpkg.com/@mdx-js/util/-/util-1.6.22.tgz#219dfd89ae5b97a8801f015323ffa4b62f45718b" @@ -395,9 +398,6 @@ resolved "https://registry.yarnpkg.com/@storyofams/eslint-config-ams/-/eslint-config-ams-1.1.3.tgz#ee6de44c89c6fabe401e6883f8b08ccc11fdc538" integrity sha512-iygvgZQIu8CicKYzXdHfEfrGXf23BeSeHrIDdj+zl0f85Al1lPINTC90y9xtQdbKKgw9iXrlmuiaJIjL1o1Y1w== -"@storyofams/next-api-decorators@../../dist": - version "0.0.0" - "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" diff --git a/lib/createHandler.ts b/lib/createHandler.ts index da109a25..807b8905 100644 --- a/lib/createHandler.ts +++ b/lib/createHandler.ts @@ -12,7 +12,7 @@ import { parseRequestUrl } from './internals/parseRequestUrl'; * * @example * ```ts - * import { createHandler, Get } from '@storyofams/next-api-decorators'; + * import { createHandler, Get } from '@instantcommerce/next-api-decorators'; * * class Events { * Get() diff --git a/lib/decorators/httpMethod.decorators.ts b/lib/decorators/httpMethod.decorators.ts index 09ab47c2..19c3be78 100644 --- a/lib/decorators/httpMethod.decorators.ts +++ b/lib/decorators/httpMethod.decorators.ts @@ -21,7 +21,7 @@ function applyHttpMethod(verb: HttpVerb, path: string) { if (process.env.NODE_ENV === 'development' && path !== '/') { loadPackage('path-to-regexp', { context: '@' + verb.charAt(0).toUpperCase() + verb.slice(1).toLowerCase(), - docsUrl: 'https://github.com/storyofams/next-api-decorators#route-matching' + docsUrl: 'https://next-api-decorators.vercel.app/docs/routing/route-matching' }); } @@ -41,12 +41,12 @@ export function Get(): MethodDecorator; /** * Makes the method for the defined path a GET request handler. * - * @param path Route path. Supports Express.js style [route matching](https://github.com/storyofams/next-api-decorators#route-matching) + * @param path Route path. Supports Express.js style [route matching](https://next-api-decorators.vercel.app/docs/routing/route-matching) * including route parameters (e.g. `'/:id'`) and regular expressions. * * @remarks * `path-to-regexp` needs to be installed, otherwise request handlers with non-empty path parameters will not be handled. - * More information: [route matching](https://github.com/storyofams/next-api-decorators#route-matching) + * More information: [route matching](https://next-api-decorators.vercel.app/docs/routing/route-matching) */ export function Get(path: string): MethodDecorator; export function Get(path: string = '/'): MethodDecorator { @@ -58,12 +58,12 @@ export function Post(): MethodDecorator; /** * Makes the method for the defined path a POST request handler. * - * @param path Route path. Supports Express.js style [route matching](https://github.com/storyofams/next-api-decorators#route-matching) + * @param path Route path. Supports Express.js style [route matching](https://next-api-decorators.vercel.app/docs/routing/route-matching) * including route parameters (e.g. `'/:id'`) and regular expressions. * * @remarks * `path-to-regexp` needs to be installed, otherwise request handlers with non-empty path parameters will not be handled. - * More information: [route matching](https://github.com/storyofams/next-api-decorators#route-matching) + * More information: [route matching](https://next-api-decorators.vercel.app/docs/routing/route-matching) */ export function Post(path: string): MethodDecorator; export function Post(path: string = '/'): MethodDecorator { @@ -75,12 +75,12 @@ export function Put(): MethodDecorator; /** * Makes the method for the defined path a PUT request handler. * - * @param path Route path. Supports Express.js style [route matching](https://github.com/storyofams/next-api-decorators#route-matching) + * @param path Route path. Supports Express.js style [route matching](https://next-api-decorators.vercel.app/docs/routing/route-matching) * including route parameters (e.g. `'/:id'`) and regular expressions. * * @remarks * `path-to-regexp` needs to be installed, otherwise request handlers with non-empty path parameters will not be handled. - * More information: [route matching](https://github.com/storyofams/next-api-decorators#route-matching) + * More information: [route matching](https://next-api-decorators.vercel.app/docs/routing/route-matching) */ export function Put(path: string): MethodDecorator; export function Put(path: string = '/'): MethodDecorator { @@ -92,12 +92,12 @@ export function Delete(): MethodDecorator; /** * Makes the method for the defined path a DELETE request handler. * - * @param path Route path. Supports Express.js style [route matching](https://github.com/storyofams/next-api-decorators#route-matching) + * @param path Route path. Supports Express.js style [route matching](https://next-api-decorators.vercel.app/docs/routing/route-matching) * including route parameters (e.g. `'/:id'`) and regular expressions. * * @remarks * `path-to-regexp` needs to be installed, otherwise request handlers with non-empty path parameters will not be handled. - * More information: [route matching](https://github.com/storyofams/next-api-decorators#route-matching) + * More information: [route matching](https://next-api-decorators.vercel.app/docs/routing/route-matching) */ export function Delete(path: string): MethodDecorator; export function Delete(path: string = '/'): MethodDecorator { @@ -109,12 +109,12 @@ export function Patch(): MethodDecorator; /** * Makes the method for the defined path a PATCH request handler. * - * @param path Route path. Supports Express.js style [route matching](https://github.com/storyofams/next-api-decorators#route-matching) + * @param path Route path. Supports Express.js style [route matching](https://next-api-decorators.vercel.app/docs/routing/route-matching) * including route parameters (e.g. `'/:id'`) and regular expressions. * * @remarks * `path-to-regexp` needs to be installed, otherwise request handlers with non-empty path parameters will not be handled. - * More information: [route matching](https://github.com/storyofams/next-api-decorators#route-matching) + * More information: [route matching](https://next-api-decorators.vercel.app/docs/routing/route-matching) */ export function Patch(path: string): MethodDecorator; export function Patch(path: string = '/'): MethodDecorator { diff --git a/lib/internals/getCallerInfo.spec.ts b/lib/internals/getCallerInfo.spec.ts index ddbe515c..4dfe4cdd 100644 --- a/lib/internals/getCallerInfo.spec.ts +++ b/lib/internals/getCallerInfo.spec.ts @@ -15,8 +15,8 @@ describe('getCallerInfo', () => { providedStack ?? (nextJsVersion === 12_0_9 ? `Error - at Object.getCallerInfo (/unix-example-path/node_modules/@storyofams/next-api-decorators/dist/internals/getCallerInfo.js:9:30) - at createHandler (/unix-example-path/node_modules/@storyofams/next-api-decorators/dist/createHandler.js:30:51) + at Object.getCallerInfo (/unix-example-path/node_modules/@instantcommerce/next-api-decorators/dist/internals/getCallerInfo.js:9:30) + at createHandler (/unix-example-path/node_modules/@instantcommerce/next-api-decorators/dist/createHandler.js:30:51) at eval (webpack-internal:///(api)/./${path}.ts:91:144) at Object.(api)/./${path}.ts (/unix-example-path/.next/server/${path}.js:32:1) at __webpack_require__ (/unix-example-path/.next/server/webpack-api-runtime.js:33:42) @@ -26,8 +26,8 @@ describe('getCallerInfo', () => { at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)` : `Error - at Object.getCallerInfo (/unix-example-path/node_modules/@storyofams/next-api-decorators/dist/internals/getCallerInfo.js:9:30) - at createHandler (/unix-example-path/node_modules/@storyofams/next-api-decorators/dist/createHandler.js:30:51) + at Object.getCallerInfo (/unix-example-path/node_modules/@instantcommerce/next-api-decorators/dist/internals/getCallerInfo.js:9:30) + at createHandler (/unix-example-path/node_modules/@instantcommerce/next-api-decorators/dist/createHandler.js:30:51) at eval (webpack-internal:///./${path}.ts:91:144) at Object../${path}.ts (/unix-example-path/.next/server/${path}.js:32:1) at __webpack_require__ (/unix-example-path/.next/server/webpack-api-runtime.js:33:42) @@ -116,8 +116,8 @@ describe('getCallerInfo', () => { 'pages/api/users/deep/[[...params]]', undefined, 'Error\n' + - ' at Object.getCallerInfo (C:/Users/exampleuser/project/route-matching/node_modules/@storyofams/next-api-decorators/dist/internals/getCallerInfo.js:9:30)\n' + - ' at createHandler (C:/Users/exampleuser/project/route-matching/node_modules/@storyofams/next-api-decorators/dist/createHandler.js:30:51)\n' + + ' at Object.getCallerInfo (C:/Users/exampleuser/project/route-matching/node_modules/@instantcommerce/next-api-decorators/dist/internals/getCallerInfo.js:9:30)\n' + + ' at createHandler (C:/Users/exampleuser/project/route-matching/node_modules/@instantcommerce/next-api-decorators/dist/createHandler.js:30:51)\n' + ' at Object../pages/api/users/deep/[[...params]].ts (C:/Users/exampleuser/project/route-matching/.next/server/pages/api/users/deep/[[...params]].js:287:142)\n' + ' at __webpack_require__ (C:/Users/exampleuser/project/route-matching/.next/server/webpack-runtime.js:25:42)\n' + ' at __webpack_exec__ (C:/Users/exampleuser/project/route-matching/.next/server/pages/api/users/deep/[[...params]].js:319:52)\n' + diff --git a/lib/internals/validateObject.spec.ts b/lib/internals/validateObject.spec.ts index 886dc568..be6d7a22 100644 --- a/lib/internals/validateObject.spec.ts +++ b/lib/internals/validateObject.spec.ts @@ -15,9 +15,9 @@ describe('validateObject', () => { public email!: string; } - const result = await validateObject(Dto, { secondaryEmail: 'dev@storyofams.com' }); + const result = await validateObject(Dto, { secondaryEmail: 'dev@instantcommerce.io' }); - expect(result).toHaveProperty('secondaryEmail', 'dev@storyofams.com'); + expect(result).toHaveProperty('secondaryEmail', 'dev@instantcommerce.io'); spy.mockRestore(); }); @@ -32,9 +32,9 @@ describe('validateObject', () => { public email!: string; } - const result = await validateObject(Dto, { secondaryEmail: 'dev@storyofams.com' }); + const result = await validateObject(Dto, { secondaryEmail: 'dev@instantcommerce.io' }); - expect(result).toHaveProperty('secondaryEmail', 'dev@storyofams.com'); + expect(result).toHaveProperty('secondaryEmail', 'dev@instantcommerce.io'); spy.mockRestore(); }); @@ -48,13 +48,13 @@ describe('validateObject', () => { const result = await validateObject( Dto, - { email: 'dev@storyofams.com', secondaryEmail: 'hello@storyofams.com' }, + { email: 'dev@instantcommerce.io', secondaryEmail: 'hello@instantcommerce.io' }, { transformOptions: { excludeExtraneousValues: true } } ); - expect(result).toHaveProperty('email', 'dev@storyofams.com'); - expect(result).not.toHaveProperty('secondaryEmail', 'hello@storyofams.com'); + expect(result).toHaveProperty('email', 'dev@instantcommerce.io'); + expect(result).not.toHaveProperty('secondaryEmail', 'hello@instantcommerce.io'); }); }); diff --git a/lib/pipes/validators/validation.pipe.spec.ts b/lib/pipes/validators/validation.pipe.spec.ts index 4cac7e26..ade51cbe 100644 --- a/lib/pipes/validators/validation.pipe.spec.ts +++ b/lib/pipes/validators/validation.pipe.spec.ts @@ -77,7 +77,7 @@ describe('ValidationPipe', () => { } expect( - ValidationPipe()('{"email":"hello@storyofams.com","name":"Hello world"}', { metaType: DTO }) + ValidationPipe()('{"email":"hello@instantcommerce.io","name":"Hello world"}', { metaType: DTO }) ).rejects.toThrowError(BadRequestException); }); }); diff --git a/lib/pipes/validators/validation.pipe.ts b/lib/pipes/validators/validation.pipe.ts index 8a7b1cfd..d1c15c20 100644 --- a/lib/pipes/validators/validation.pipe.ts +++ b/lib/pipes/validators/validation.pipe.ts @@ -14,14 +14,14 @@ export interface ValidationPipeOptions extends ValidatorOptions { * * @remarks * `class-validator` and `class-transformer` need to be installed. - * More information: [data transfer object](https://github.com/storyofams/next-api-decorators#data-transfer-object) + * More information: [data transfer object](https://next-api-decorators.vercel.app/docs/validation) */ export function ValidationPipe(options?: ValidationPipeOptions): ParameterPipe { if (process.env.NODE_ENV === 'development') { (['class-validator', 'class-transformer'] as const).forEach(requiredPackage => loadPackage(requiredPackage, { context: 'ValidationPipe', - docsUrl: 'https://github.com/storyofams/next-api-decorators#data-transfer-object' + docsUrl: 'https://next-api-decorators.vercel.app/docs/validation' }) ); } diff --git a/package.json b/package.json index 67e2e885..16f8ddba 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,20 @@ { - "name": "@storyofams/next-api-decorators", + "name": "@instantcommerce/next-api-decorators", "description": "Collection of decorators to create typed Next.js API routes, with easy request validation and transformation.", "version": "0.0.0-development", "author": { - "name": "Story of AMS", - "url": "https://storyofams.com", - "email": "dev@storyofams.com" + "name": "Instant Commerce", + "url": "https://instantcommerce.io", + "email": "dev@instantcommerce.io" }, "main": "dist/index.js", "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/storyofams/next-api-decorators" + "url": "https://github.com/instantcommerce/next-api-decorators" }, "bugs": { - "url": "https://github.com/storyofams/next-api-decorators/issues" + "url": "https://github.com/instantcommerce/next-api-decorators/issues" }, "keywords": [ "typescript", diff --git a/website/docs/api/create-param-decorator.md b/website/docs/api/create-param-decorator.md index ce35f381..6c829ed7 100644 --- a/website/docs/api/create-param-decorator.md +++ b/website/docs/api/create-param-decorator.md @@ -11,7 +11,7 @@ As a basic example, let's get the browser information of the client via a decora First we create our decorator: ```ts -import { createParamDecorator } from '@storyofams/next-api-decorators'; +import { createParamDecorator } from '@instantcommerce/next-api-decorators'; export const UserAgent = createParamDecorator( req => req.headers['user-agent'] diff --git a/website/docs/basics.md b/website/docs/basics.md index e4a4f8c6..77961448 100644 --- a/website/docs/basics.md +++ b/website/docs/basics.md @@ -17,7 +17,7 @@ We provide the following built-in decorators for you to handle the HTTP method t Since Next.js expects the default export to be a request handler, we provide the `createHandler` function which accepts a class as the only parameter. ```ts -import { createHandler, Get } from '@storyofams/next-api-decorators'; +import { createHandler, Get } from '@instantcommerce/next-api-decorators'; class UserHandler { @Get() @@ -38,7 +38,7 @@ There is the `@Request()` decorator as well, which is an alias to the `@Req()` d ::: ```ts -import { createHandler, Get, Req } from '@storyofams/next-api-decorators'; +import { createHandler, Get, Req } from '@instantcommerce/next-api-decorators'; import { NextApiRequest } from 'next'; class UserHandler { @@ -58,7 +58,7 @@ In most cases, you won't need to access the request object since we provide deco By default, the response status code is `200`, unless the returned value is `null` or `undefined`. In that case, the response status code is `204`. However, it's possible to change it per route. ```ts -import { createHandler, Post, HttpCode } from '@storyofams/next-api-decorators'; +import { createHandler, Post, HttpCode } from '@instantcommerce/next-api-decorators'; class UserHandler { @Post() @@ -76,7 +76,7 @@ export default createHandler(UserHandler); Depending on your use case, you may either want to read a header value, set a custom one or do both. We provide `@Header` parameter decorator to read, and `@SetHeader` to set. ```ts -import { createHandler, Get, Header, SetHeader } from '@storyofams/next-api-decorators'; +import { createHandler, Get, Header, SetHeader } from '@instantcommerce/next-api-decorators'; class UserHandler { @Get() @@ -94,7 +94,7 @@ export default createHandler(UserHandler); In the [example](#status-code) above we created a `POST` request handler but we didn't expect the client to send any payload. Let's say, now we do want some data from the client, so first we need to determine the shape of the payload we expect. In order to do that we will use classes, which are part of the ES6 standard. ```ts -import { createHandler, Post, Body } from '@storyofams/next-api-decorators'; +import { createHandler, Post, Body } from '@instantcommerce/next-api-decorators'; class CreateUserInput { email: string; @@ -132,7 +132,7 @@ Usage in a handler: ```ts // src/pages/api/files/[[...params]].ts import { createReadStream } from 'fs'; -import { createHandler, Download, Get } from '@storyofams/next-api-decorators'; +import { createHandler, Download, Get } from '@instantcommerce/next-api-decorators'; class FileHandler { @Get('/whitepaper') @@ -192,7 +192,7 @@ export default async (req: NextApiRequest, res: NextApiResponse) => { However, with `next-api-decorators` you can write the same handler in a declarative manner: ```ts -import { createHandler, Body, Get, HttpCode, NotFoundException, Post, Query } from '@storyofams/next-api-decorators'; +import { createHandler, Body, Get, HttpCode, NotFoundException, Post, Query } from '@instantcommerce/next-api-decorators'; class User { // GET /api/user diff --git a/website/docs/exceptions.md b/website/docs/exceptions.md index 691f691f..1e62b1af 100644 --- a/website/docs/exceptions.md +++ b/website/docs/exceptions.md @@ -21,7 +21,7 @@ The following common exceptions are provided by this package. Any exception class that extends the base `HttpException` will be handled by the built-in error handler. ```ts -import { HttpException } from '@storyofams/next-api-decorators'; +import { HttpException } from '@instantcommerce/next-api-decorators'; export class MethodNotAllowedException extends HttpException { public constructor(message?: string = 'Method Not Allowed') { @@ -50,7 +50,7 @@ Even though we already have a built-in exception handler, you may need more cont Let's create an exception handler for the `MethodNotAllowedException` we created above. ```ts -import { Catch } from '@storyofams/next-api-decorators'; +import { Catch } from '@instantcommerce/next-api-decorators'; function methodNotAllowedExceptionHandler( error: MethodNotAllowedException, @@ -75,7 +75,7 @@ class Events { In case you need the exception handler to catch all errors, you can pass only the handler function to the `@Catch` decorator: ```ts -import { Catch } from '@storyofams/next-api-decorators'; +import { Catch } from '@instantcommerce/next-api-decorators'; function exceptionHandler( error: unknown, diff --git a/website/docs/getting-started.md b/website/docs/getting-started.md index 342f326c..1f95d8b8 100755 --- a/website/docs/getting-started.md +++ b/website/docs/getting-started.md @@ -6,7 +6,7 @@ slug: / ## Basic usage ```ts -import { createHandler, Get } from '@storyofams/next-api-decorators'; +import { createHandler, Get } from '@instantcommerce/next-api-decorators'; class UserHandler { @Get() @@ -34,7 +34,7 @@ If you are not familiar with Next.js or NestJS and want some more information (o ## Installation ```bash npm2yarn -npm install @storyofams/next-api-decorators +npm install @instantcommerce/next-api-decorators ``` ### Using with SWC @@ -75,4 +75,4 @@ Your tsconfig.json needs the following flag in the `compilerOptions` section: ## Examples -Please see [the examples](https://github.com/storyofams/next-api-decorators/tree/master/examples) to see how this library can be used. +Please see [the examples](https://github.com/instantcommerce/next-api-decorators/tree/master/examples) to see how this library can be used. diff --git a/website/docs/middlewares.md b/website/docs/middlewares.md index 12a31c23..a54d005f 100644 --- a/website/docs/middlewares.md +++ b/website/docs/middlewares.md @@ -50,5 +50,5 @@ class SecureHandler { ``` :::info -`NextFunction` type is exported from `@storyofams/next-api-decorators`. +`NextFunction` type is exported from `@instantcommerce/next-api-decorators`. ::: \ No newline at end of file diff --git a/website/docs/route-matching.md b/website/docs/route-matching.md index 6b6f829f..3f22420c 100644 --- a/website/docs/route-matching.md +++ b/website/docs/route-matching.md @@ -13,7 +13,7 @@ Then you can define your routes in your handler like: ```ts // pages/api/user/[[...params]].ts -import { createHandler, Get, Param } from '@storyofams/next-api-decorators'; +import { createHandler, Get, Param } from '@instantcommerce/next-api-decorators'; class UserHandler { @Get() diff --git a/website/docs/validation.md b/website/docs/validation.md index 1149d81c..92d0984c 100644 --- a/website/docs/validation.md +++ b/website/docs/validation.md @@ -50,7 +50,7 @@ export default createHandler(UserHandler); When your application expects a nested JSON object, you can easily define its shape in your DTOs and validate the incoming data against it. ```ts -import { createHandler, Body, Post, ValidationPipe } from '@storyofams/next-api-decorators'; +import { createHandler, Body, Post, ValidationPipe } from '@instantcommerce/next-api-decorators'; import { Type } from 'class-transformer'; import { IsNotEmpty, IsNumber, MinLength, ValidateNested } from 'class-validator'; diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 1fc6e745..dda6907d 100755 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -3,18 +3,18 @@ module.exports = { title: 'Next.js API Decorators', tagline: 'Collection of decorators to create typed Next.js API routes, with easy request validation and transformation.', - url: 'https://storyblok-toolkit.vercel.com', + url: 'https://next-api-decorators.vercel.com', baseUrl: '/', onBrokenLinks: 'throw', onBrokenMarkdownLinks: 'warn', favicon: 'img/favicon.ico', - organizationName: 'storyofams', + organizationName: 'instantcommerce', projectName: 'next-api-decorators', themeConfig: { navbar: { title: 'Next.js API Decorators', logo: { - alt: 'Story of AMS Logo', + alt: 'Instant Commerce Logo', src: 'img/logo.png', srcDark: 'img/logo-dark.png', }, @@ -36,7 +36,7 @@ module.exports = { position: 'right', }, { - href: 'https://github.com/storyofams/next-api-decorators', + href: 'https://github.com/instantcommerce/next-api-decorators', label: 'GitHub', position: 'right', }, @@ -59,12 +59,12 @@ module.exports = { items: [ { label: 'GitHub', - href: 'https://github.com/storyofams/next-api-decorators', + href: 'https://github.com/instantcommerce/next-api-decorators', }, ], }, ], - copyright: `Copyright © ${new Date().getFullYear()} Story of AMS.`, + copyright: `Copyright © ${new Date().getFullYear()} Instant Commerce.`, }, }, presets: [ @@ -74,7 +74,7 @@ module.exports = { docs: { sidebarPath: require.resolve('./sidebars.js'), editUrl: - 'https://github.com/storyofams/next-api-decorators/edit/master/website/', + 'https://github.com/instantcommerce/next-api-decorators/edit/master/website/', remarkPlugins: [ [require('@docusaurus/remark-plugin-npm2yarn'), { sync: true }], ], diff --git a/website/src/css/custom.css b/website/src/css/custom.css index 8d347254..e2aacdfd 100755 --- a/website/src/css/custom.css +++ b/website/src/css/custom.css @@ -7,19 +7,30 @@ /* You can override the default Infima variables here. */ :root { - --ifm-color-primary: #0cba96; - --ifm-color-primary-dark: #12d8af; - --ifm-color-primary-darker: #11cca5; - --ifm-color-primary-darkest: #0ea888; - --ifm-color-primary-light: #30eec7; - --ifm-color-primary-lighter: #3cefca; - --ifm-color-primary-lightest: #60f2d4; + --ifm-color-primary: #777; + --ifm-color-primary-dark: #444; + --ifm-color-primary-darker: #333; + --ifm-color-primary-darkest: #111; + --ifm-color-primary-light: #999; + --ifm-color-primary-lighter: #ccc; + --ifm-color-primary-lightest: #ddd; --ifm-code-font-size: 95%; --hero-title: #111; --hero-subtitle: #666; --hero-background: #fff; } +html[data-theme="dark"]:root { + --ifm-color-primary: #FDE77C; + --ifm-color-primary-dark: #FBCC26; + --ifm-color-primary-darker: #AF8904; + --ifm-color-primary-darkest: #312D00; + --ifm-color-primary-light: #FCF2CD; + --ifm-color-primary-lighter: #FEF9E6; + --ifm-color-primary-lightest: #FEF9E6; + --ifm-menu-color-background-active: var(--ifm-color-primary-darkest); +} + html[data-theme="dark"] { --hero-title: #fff; --hero-subtitle: #fff; diff --git a/website/src/pages/index.jsx b/website/src/pages/index.jsx index 24eed243..bf36605b 100755 --- a/website/src/pages/index.jsx +++ b/website/src/pages/index.jsx @@ -12,7 +12,7 @@ export default function Home() { return (
diff --git a/website/static/img/favicon.ico b/website/static/img/favicon.ico old mode 100755 new mode 100644 index ffb1094cd6ee6ce47b6be6ac8b5e7b721d41b5db..de26f733a780167d68f49c2e8a395385e5264c54 GIT binary patch literal 9662 zcmd^EL2lbH5ZoY#9C}EB0zK9S8c8|k2ksN{1plD@KzI$}%O$g28xE8T6QxMD1`n%cTr(grAEG!0$fX1OTrA;2aA!!4M0z z+v5!2)r+DO4gcr&`S^FgKQ%8kvkxZAVIO&D0N((J2dKZKJkj?(N_vk$^Fe+-js zq?H5Oe;uZoiIU}&Mh>I{vY$%uZAl?p-61}pxuh{Bm3?42C|n!<`2e+`FeYvK0QI0S zCY61lF(z&KKw(U(`oQX0QJ&=Tf#skmCT;sbS4?vIKvzt1`9M=ls`bG$#iS^iU%gH9 z%U$xDIv-d)dyYv_x_mErCgKk)(_oTcH}Punf#u*iCIyr1Q;CDknJe`zUU>eta?Sd_ z=g5<2-0JM<)b2S?D(1v~Ir!eY(LSrwSo1#3b?+{5VILbjdiUV6qkEhGy;}=CueI8a z7jp0zljvDZdX6w&(Ojc@bVm! zXkD(KAB#&Dhq^Y>v0djq&Lgs=R?o@eOP#HU)=ulG%MZR|W7l!1)dJ4(u6_Exk8?K4 zgG#Z}tz+M|wS8VCSG7Da-VEE`e+buA^-TYD9D-fD*nl=q%kxN!j)mivo^hR$b6Sw~ z%v#o^V;SSJp0(*%I7qIlQOCkTax`r^7W>zFR;Xj)aF%56$PZH2h_tq8)v=7XcKi3W z&o%Y{Fbn#DmZZqd%J`A-1LFhZJ>yI;w*8x@0b{Sgxgd6k&o}uAd4~V8$5^SXLJpgCxDo7KsX2J5#|7=ge!oPG8&j4Q{9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M*IA|hv(bq#+WJg-!?VEW+P;$*3)r_S_w>7Keufwc zcC3Q2|1$XWYfEEfUdnP$-PY#~b*sp%!{gA=9B7=}Uu3r1bw}Na)*bCE4cE@dJj*|& zEi;aB-Zj=$U0G|$=2~Nxf6YnjcTJr`+h^9m5wvR#wBG2SW%;L0Cv#66(QqD0-%0X4 z$-71_YNc6+e4lVHYVAp~&A)4mZY}17omdN8i)EbNMH50do0)morCisyOL>Y0`YGcn zApdu!#qs|a15ga}^i7}ihi?`Kz~4lk=#Di>+&T;4_as=~fld-jeUsp}wds2NTPuUb z?UljO_R97W|FML_)H4ote3WskIPmj)VKdMB8+m^23i$0jzj7`zK6~&JhZtX9@a-kf zx0mut;wOs8{7%8o63gK9okDLrw3QIgc)o+Kf$xg_eMmCtKJXu4>iG8oBuV|Rqs%_? z^I(#-KaINjsY|l`7XLf+t%Ki<%re_(&lspnl5fdR(MFxWqm)0}MjeuDY?*P(hIyb* zvc}CmJ2q5DXfJB~8y)H?NA#oEe?*x&Wu$mGW*;x^;`gKcSgf;+eI)6IT6n6B`eFQ8 z_8Q8}oyUV@A4$5Qw)=S*O|)U$8V}o=NVun=D4&`OwvnV0YUNL^Kbv!wwI<6gcDKHW zCXSuV^1R88)0P|K!1>ps667=FSoUp=#=%bZ7h!*~&i?CPox6VBxy^;ZTZ{N%{$Aj} TmT(~h4^{&2tYT90A+!E3c*33; diff --git a/website/static/img/logo-dark.png b/website/static/img/logo-dark.png old mode 100755 new mode 100644 index f21d68a25482a245abe6519061baee3e22aa511b..986b16f26a5fe72044b0eff5a843bccf6f5b932f GIT binary patch literal 3574 zcmXAsdpy(oAIIksi^<$pk&s)-J?6(TF%r4vpt9CR%*M#AEpo{vDN&JRJ1*hSNn;r! zj$Fz?EQHwBDy2!%1?9NZexDtGe81n%=lOlVU+>H3^ZD+v%f8-+739?AAP|UxyPJz2 zc+$c33n~NdCda8^;ITEv?L<5Ta=b`H4!i+Y*tD(=9nw#6c0~%d6i@&>$iN zGQ(*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-uy1~nBo8c002ovPDHLkV1ic_MxX!y From d34959b586484241884d7bea93e6efd0d1dfaea0 Mon Sep 17 00:00:00 2001 From: ggurkal Date: Mon, 15 Aug 2022 17:25:36 +0200 Subject: [PATCH 2/6] refactor: unscope --- README.md | 6 +++--- examples/route-matching/README.md | 4 ++-- examples/route-matching/package.json | 2 +- examples/route-matching/pages/api/postman.ts | 2 +- .../pages/api/users/[[...params]].ts | 2 +- examples/route-matching/postman.json | 2 +- examples/route-matching/yarn.lock | 2 +- examples/with-next-auth/README.md | 4 ++-- examples/with-next-auth/package.json | 2 +- .../pages/api/users/[[...params]].ts | 2 +- examples/with-next-auth/postman.json | 2 +- examples/with-next-auth/yarn.lock | 2 +- lib/createHandler.ts | 2 +- lib/internals/getCallerInfo.spec.ts | 12 ++++++------ package.json | 2 +- website/docs/api/create-param-decorator.md | 2 +- website/docs/basics.md | 14 +++++++------- website/docs/exceptions.md | 6 +++--- website/docs/getting-started.md | 4 ++-- website/docs/middlewares.md | 2 +- website/docs/route-matching.md | 2 +- website/docs/validation.md | 2 +- 22 files changed, 40 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index d516c9f1..e632a321 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,13 @@ Instant Commerce -

@instantcommerce/next-api-decorators

+

next-api-decorators

- - + + diff --git a/examples/route-matching/README.md b/examples/route-matching/README.md index 7e783417..60b56fc3 100755 --- a/examples/route-matching/README.md +++ b/examples/route-matching/README.md @@ -1,6 +1,6 @@ -# @instantcommerce/next-api-decorators/example +# next-api-decorators/example -Example usage of the `@instantcommerce/next-api-decorators` with Next.js +Example usage of the `next-api-decorators` with Next.js ## Getting started diff --git a/examples/route-matching/package.json b/examples/route-matching/package.json index 7437c64d..4d614982 100644 --- a/examples/route-matching/package.json +++ b/examples/route-matching/package.json @@ -9,7 +9,7 @@ "type-check": "tsc" }, "dependencies": { - "@instantcommerce/next-api-decorators": "../../dist", + "next-api-decorators": "../../dist", "class-transformer": "^0.4.0", "class-validator": "^0.13.1", "next": "^12.1.0", diff --git a/examples/route-matching/pages/api/postman.ts b/examples/route-matching/pages/api/postman.ts index d3d4fe82..e4333202 100644 --- a/examples/route-matching/pages/api/postman.ts +++ b/examples/route-matching/pages/api/postman.ts @@ -4,7 +4,7 @@ import { Download, DownloadFileResult, createHandler, -} from '@instantcommerce/next-api-decorators'; +} from 'next-api-decorators'; class Postman { private pathToFile = `${process.cwd()}/postman.json`; diff --git a/examples/route-matching/pages/api/users/[[...params]].ts b/examples/route-matching/pages/api/users/[[...params]].ts index e612a62e..093d71cd 100644 --- a/examples/route-matching/pages/api/users/[[...params]].ts +++ b/examples/route-matching/pages/api/users/[[...params]].ts @@ -12,7 +12,7 @@ import { ParseNumberPipe, DefaultValuePipe, NotFoundException, -} from '@instantcommerce/next-api-decorators'; +} from 'next-api-decorators'; import { User, sampleUserData } from '../../../data'; import { CreateUserInput, UpdateUserInput } from '../../../dto'; diff --git a/examples/route-matching/postman.json b/examples/route-matching/postman.json index 577f0b32..6c0e39ad 100644 --- a/examples/route-matching/postman.json +++ b/examples/route-matching/postman.json @@ -1,6 +1,6 @@ { "info": { - "name": "@instantcommerce/next-api-decorators/example", + "name": "next-api-decorators/example", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ diff --git a/examples/route-matching/yarn.lock b/examples/route-matching/yarn.lock index 5b6c6e49..f35c36f0 100644 --- a/examples/route-matching/yarn.lock +++ b/examples/route-matching/yarn.lock @@ -320,7 +320,7 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@instantcommerce/next-api-decorators@../../dist": +"next-api-decorators@../../dist": version "0.0.0" "@mdx-js/util@1.6.22": diff --git a/examples/with-next-auth/README.md b/examples/with-next-auth/README.md index efdf618f..024e05d1 100755 --- a/examples/with-next-auth/README.md +++ b/examples/with-next-auth/README.md @@ -1,6 +1,6 @@ -# `@instantcommerce/next-api-decorators` example with `next-auth` +# `next-api-decorators` example with `next-auth` -Example usage of the `@instantcommerce/next-api-decorators` with `next-auth`. This example only covers logging in via Github, for more providers please refer to `next-auth` documentation [here](https://next-auth.js.org/configuration/providers). +Example usage of the `next-api-decorators` with `next-auth`. This example only covers logging in via Github, for more providers please refer to `next-auth` documentation [here](https://next-auth.js.org/configuration/providers). ## Getting started diff --git a/examples/with-next-auth/package.json b/examples/with-next-auth/package.json index e7febeaf..4ef349a2 100644 --- a/examples/with-next-auth/package.json +++ b/examples/with-next-auth/package.json @@ -9,7 +9,7 @@ "type-check": "tsc" }, "dependencies": { - "@instantcommerce/next-api-decorators": "../../dist", + "next-api-decorators": "../../dist", "class-transformer": "^0.4.0", "class-validator": "^0.13.1", "next": "^12.1.0", diff --git a/examples/with-next-auth/pages/api/users/[[...params]].ts b/examples/with-next-auth/pages/api/users/[[...params]].ts index a6102bf4..125b13aa 100644 --- a/examples/with-next-auth/pages/api/users/[[...params]].ts +++ b/examples/with-next-auth/pages/api/users/[[...params]].ts @@ -8,7 +8,7 @@ import { NextFunction, UnauthorizedException, SetHeader, -} from '@instantcommerce/next-api-decorators'; +} from 'next-api-decorators'; import { NextApiRequest, NextApiResponse } from 'next'; import { getToken } from 'next-auth/jwt'; import { User, sampleUserData } from '../../../data'; diff --git a/examples/with-next-auth/postman.json b/examples/with-next-auth/postman.json index 577f0b32..6c0e39ad 100644 --- a/examples/with-next-auth/postman.json +++ b/examples/with-next-auth/postman.json @@ -1,6 +1,6 @@ { "info": { - "name": "@instantcommerce/next-api-decorators/example", + "name": "next-api-decorators/example", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ diff --git a/examples/with-next-auth/yarn.lock b/examples/with-next-auth/yarn.lock index 8ce0a87a..1909591a 100644 --- a/examples/with-next-auth/yarn.lock +++ b/examples/with-next-auth/yarn.lock @@ -320,7 +320,7 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@instantcommerce/next-api-decorators@../../dist": +"next-api-decorators@../../dist": version "0.0.0" "@mdx-js/util@1.6.22": diff --git a/lib/createHandler.ts b/lib/createHandler.ts index 807b8905..a8a42ada 100644 --- a/lib/createHandler.ts +++ b/lib/createHandler.ts @@ -12,7 +12,7 @@ import { parseRequestUrl } from './internals/parseRequestUrl'; * * @example * ```ts - * import { createHandler, Get } from '@instantcommerce/next-api-decorators'; + * import { createHandler, Get } from 'next-api-decorators'; * * class Events { * Get() diff --git a/lib/internals/getCallerInfo.spec.ts b/lib/internals/getCallerInfo.spec.ts index 4dfe4cdd..002b05fb 100644 --- a/lib/internals/getCallerInfo.spec.ts +++ b/lib/internals/getCallerInfo.spec.ts @@ -15,8 +15,8 @@ describe('getCallerInfo', () => { providedStack ?? (nextJsVersion === 12_0_9 ? `Error - at Object.getCallerInfo (/unix-example-path/node_modules/@instantcommerce/next-api-decorators/dist/internals/getCallerInfo.js:9:30) - at createHandler (/unix-example-path/node_modules/@instantcommerce/next-api-decorators/dist/createHandler.js:30:51) + at Object.getCallerInfo (/unix-example-path/node_modules/next-api-decorators/dist/internals/getCallerInfo.js:9:30) + at createHandler (/unix-example-path/node_modules/next-api-decorators/dist/createHandler.js:30:51) at eval (webpack-internal:///(api)/./${path}.ts:91:144) at Object.(api)/./${path}.ts (/unix-example-path/.next/server/${path}.js:32:1) at __webpack_require__ (/unix-example-path/.next/server/webpack-api-runtime.js:33:42) @@ -26,8 +26,8 @@ describe('getCallerInfo', () => { at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)` : `Error - at Object.getCallerInfo (/unix-example-path/node_modules/@instantcommerce/next-api-decorators/dist/internals/getCallerInfo.js:9:30) - at createHandler (/unix-example-path/node_modules/@instantcommerce/next-api-decorators/dist/createHandler.js:30:51) + at Object.getCallerInfo (/unix-example-path/node_modules/next-api-decorators/dist/internals/getCallerInfo.js:9:30) + at createHandler (/unix-example-path/node_modules/next-api-decorators/dist/createHandler.js:30:51) at eval (webpack-internal:///./${path}.ts:91:144) at Object../${path}.ts (/unix-example-path/.next/server/${path}.js:32:1) at __webpack_require__ (/unix-example-path/.next/server/webpack-api-runtime.js:33:42) @@ -116,8 +116,8 @@ describe('getCallerInfo', () => { 'pages/api/users/deep/[[...params]]', undefined, 'Error\n' + - ' at Object.getCallerInfo (C:/Users/exampleuser/project/route-matching/node_modules/@instantcommerce/next-api-decorators/dist/internals/getCallerInfo.js:9:30)\n' + - ' at createHandler (C:/Users/exampleuser/project/route-matching/node_modules/@instantcommerce/next-api-decorators/dist/createHandler.js:30:51)\n' + + ' at Object.getCallerInfo (C:/Users/exampleuser/project/route-matching/node_modules/next-api-decorators/dist/internals/getCallerInfo.js:9:30)\n' + + ' at createHandler (C:/Users/exampleuser/project/route-matching/node_modules/next-api-decorators/dist/createHandler.js:30:51)\n' + ' at Object../pages/api/users/deep/[[...params]].ts (C:/Users/exampleuser/project/route-matching/.next/server/pages/api/users/deep/[[...params]].js:287:142)\n' + ' at __webpack_require__ (C:/Users/exampleuser/project/route-matching/.next/server/webpack-runtime.js:25:42)\n' + ' at __webpack_exec__ (C:/Users/exampleuser/project/route-matching/.next/server/pages/api/users/deep/[[...params]].js:319:52)\n' + diff --git a/package.json b/package.json index 16f8ddba..10eaf8ce 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@instantcommerce/next-api-decorators", + "name": "next-api-decorators", "description": "Collection of decorators to create typed Next.js API routes, with easy request validation and transformation.", "version": "0.0.0-development", "author": { diff --git a/website/docs/api/create-param-decorator.md b/website/docs/api/create-param-decorator.md index 6c829ed7..9ffcb3f4 100644 --- a/website/docs/api/create-param-decorator.md +++ b/website/docs/api/create-param-decorator.md @@ -11,7 +11,7 @@ As a basic example, let's get the browser information of the client via a decora First we create our decorator: ```ts -import { createParamDecorator } from '@instantcommerce/next-api-decorators'; +import { createParamDecorator } from 'next-api-decorators'; export const UserAgent = createParamDecorator( req => req.headers['user-agent'] diff --git a/website/docs/basics.md b/website/docs/basics.md index 77961448..9a464ba7 100644 --- a/website/docs/basics.md +++ b/website/docs/basics.md @@ -17,7 +17,7 @@ We provide the following built-in decorators for you to handle the HTTP method t Since Next.js expects the default export to be a request handler, we provide the `createHandler` function which accepts a class as the only parameter. ```ts -import { createHandler, Get } from '@instantcommerce/next-api-decorators'; +import { createHandler, Get } from 'next-api-decorators'; class UserHandler { @Get() @@ -38,7 +38,7 @@ There is the `@Request()` decorator as well, which is an alias to the `@Req()` d ::: ```ts -import { createHandler, Get, Req } from '@instantcommerce/next-api-decorators'; +import { createHandler, Get, Req } from 'next-api-decorators'; import { NextApiRequest } from 'next'; class UserHandler { @@ -58,7 +58,7 @@ In most cases, you won't need to access the request object since we provide deco By default, the response status code is `200`, unless the returned value is `null` or `undefined`. In that case, the response status code is `204`. However, it's possible to change it per route. ```ts -import { createHandler, Post, HttpCode } from '@instantcommerce/next-api-decorators'; +import { createHandler, Post, HttpCode } from 'next-api-decorators'; class UserHandler { @Post() @@ -76,7 +76,7 @@ export default createHandler(UserHandler); Depending on your use case, you may either want to read a header value, set a custom one or do both. We provide `@Header` parameter decorator to read, and `@SetHeader` to set. ```ts -import { createHandler, Get, Header, SetHeader } from '@instantcommerce/next-api-decorators'; +import { createHandler, Get, Header, SetHeader } from 'next-api-decorators'; class UserHandler { @Get() @@ -94,7 +94,7 @@ export default createHandler(UserHandler); In the [example](#status-code) above we created a `POST` request handler but we didn't expect the client to send any payload. Let's say, now we do want some data from the client, so first we need to determine the shape of the payload we expect. In order to do that we will use classes, which are part of the ES6 standard. ```ts -import { createHandler, Post, Body } from '@instantcommerce/next-api-decorators'; +import { createHandler, Post, Body } from 'next-api-decorators'; class CreateUserInput { email: string; @@ -132,7 +132,7 @@ Usage in a handler: ```ts // src/pages/api/files/[[...params]].ts import { createReadStream } from 'fs'; -import { createHandler, Download, Get } from '@instantcommerce/next-api-decorators'; +import { createHandler, Download, Get } from 'next-api-decorators'; class FileHandler { @Get('/whitepaper') @@ -192,7 +192,7 @@ export default async (req: NextApiRequest, res: NextApiResponse) => { However, with `next-api-decorators` you can write the same handler in a declarative manner: ```ts -import { createHandler, Body, Get, HttpCode, NotFoundException, Post, Query } from '@instantcommerce/next-api-decorators'; +import { createHandler, Body, Get, HttpCode, NotFoundException, Post, Query } from 'next-api-decorators'; class User { // GET /api/user diff --git a/website/docs/exceptions.md b/website/docs/exceptions.md index 1e62b1af..1bcf1d07 100644 --- a/website/docs/exceptions.md +++ b/website/docs/exceptions.md @@ -21,7 +21,7 @@ The following common exceptions are provided by this package. Any exception class that extends the base `HttpException` will be handled by the built-in error handler. ```ts -import { HttpException } from '@instantcommerce/next-api-decorators'; +import { HttpException } from 'next-api-decorators'; export class MethodNotAllowedException extends HttpException { public constructor(message?: string = 'Method Not Allowed') { @@ -50,7 +50,7 @@ Even though we already have a built-in exception handler, you may need more cont Let's create an exception handler for the `MethodNotAllowedException` we created above. ```ts -import { Catch } from '@instantcommerce/next-api-decorators'; +import { Catch } from 'next-api-decorators'; function methodNotAllowedExceptionHandler( error: MethodNotAllowedException, @@ -75,7 +75,7 @@ class Events { In case you need the exception handler to catch all errors, you can pass only the handler function to the `@Catch` decorator: ```ts -import { Catch } from '@instantcommerce/next-api-decorators'; +import { Catch } from 'next-api-decorators'; function exceptionHandler( error: unknown, diff --git a/website/docs/getting-started.md b/website/docs/getting-started.md index 1f95d8b8..9663bd91 100755 --- a/website/docs/getting-started.md +++ b/website/docs/getting-started.md @@ -6,7 +6,7 @@ slug: / ## Basic usage ```ts -import { createHandler, Get } from '@instantcommerce/next-api-decorators'; +import { createHandler, Get } from 'next-api-decorators'; class UserHandler { @Get() @@ -34,7 +34,7 @@ If you are not familiar with Next.js or NestJS and want some more information (o ## Installation ```bash npm2yarn -npm install @instantcommerce/next-api-decorators +npm install next-api-decorators ``` ### Using with SWC diff --git a/website/docs/middlewares.md b/website/docs/middlewares.md index a54d005f..c21cdfa4 100644 --- a/website/docs/middlewares.md +++ b/website/docs/middlewares.md @@ -50,5 +50,5 @@ class SecureHandler { ``` :::info -`NextFunction` type is exported from `@instantcommerce/next-api-decorators`. +`NextFunction` type is exported from `next-api-decorators`. ::: \ No newline at end of file diff --git a/website/docs/route-matching.md b/website/docs/route-matching.md index 3f22420c..78936a03 100644 --- a/website/docs/route-matching.md +++ b/website/docs/route-matching.md @@ -13,7 +13,7 @@ Then you can define your routes in your handler like: ```ts // pages/api/user/[[...params]].ts -import { createHandler, Get, Param } from '@instantcommerce/next-api-decorators'; +import { createHandler, Get, Param } from 'next-api-decorators'; class UserHandler { @Get() diff --git a/website/docs/validation.md b/website/docs/validation.md index 92d0984c..503bea8c 100644 --- a/website/docs/validation.md +++ b/website/docs/validation.md @@ -50,7 +50,7 @@ export default createHandler(UserHandler); When your application expects a nested JSON object, you can easily define its shape in your DTOs and validate the incoming data against it. ```ts -import { createHandler, Body, Post, ValidationPipe } from '@instantcommerce/next-api-decorators'; +import { createHandler, Body, Post, ValidationPipe } from 'next-api-decorators'; import { Type } from 'class-transformer'; import { IsNotEmpty, IsNumber, MinLength, ValidateNested } from 'class-validator'; From 0ec580afd10d7eb7c4cb16e950ef5d449f331f62 Mon Sep 17 00:00:00 2001 From: ggurkal Date: Wed, 17 Aug 2022 12:41:32 +0200 Subject: [PATCH 3/6] chore(website): default to dark mode --- website/docusaurus.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index dda6907d..f3ccd689 100755 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -66,6 +66,9 @@ module.exports = { ], copyright: `Copyright © ${new Date().getFullYear()} Instant Commerce.`, }, + colorMode: { + defaultMode: 'dark' + } }, presets: [ [ From 2fb5c3cfd37250525a8383de8955071956a661fc Mon Sep 17 00:00:00 2001 From: ggurkal <36651475+ggurkal@users.noreply.github.com> Date: Wed, 17 Aug 2022 13:01:48 +0200 Subject: [PATCH 4/6] chore: make github domain lowercase --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e632a321..43205c9f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

next-api-decorators

- + From 0a67d96522df563b4773d12a0988aa4cefd3e82e Mon Sep 17 00:00:00 2001 From: ggurkal <36651475+ggurkal@users.noreply.github.com> Date: Wed, 17 Aug 2022 15:34:51 +0200 Subject: [PATCH 5/6] chore(website): prefer os theme --- website/docusaurus.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index f3ccd689..06f38fdf 100755 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -67,7 +67,8 @@ module.exports = { copyright: `Copyright © ${new Date().getFullYear()} Instant Commerce.`, }, colorMode: { - defaultMode: 'dark' + defaultMode: 'dark', + respectPrefersColorScheme: true } }, presets: [ From 374eb1d8131bd2a1b422423214f073d1b50f77f3 Mon Sep 17 00:00:00 2001 From: ggurkal <36651475+ggurkal@users.noreply.github.com> Date: Wed, 17 Aug 2022 18:27:11 +0200 Subject: [PATCH 6/6] chore(website): add commas --- website/docusaurus.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 06f38fdf..52fc685b 100755 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -68,8 +68,8 @@ module.exports = { }, colorMode: { defaultMode: 'dark', - respectPrefersColorScheme: true - } + respectPrefersColorScheme: true, + }, }, presets: [ [