nestjsplus / cookies Goto Github PK
View Code? Open in Web Editor NEWDecorators for Managing Cookies with NestJS
License: MIT License
Decorators for Managing Cookies with NestJS
License: MIT License
export declare function ClearCookies(...cookies: string[] | undefined): (target: any, propertyKey: any, descriptor: any) => void;
error TS2370: A rest parameter must be of an array type.
...cookies (rest parameter) can not be undefined.
I wasn't able to get this import statement working: import { Cookies } from '@nestjsplus/cookies'
It does work with: import { Cookies } from '@nestjsplus/cookies/dist/decorators/get-cookies.decorator';
Not sure if this was intentional but probably worth updating in the docs unless there is some additional importing required by nest.
PR #1 fix this. But package in npm still has old clear-cookies.decorator.d.ts.
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
/home/███/WebstormProjects/█████/node_modules/@nestjsplus/cookies/index.ts:1
export * from './dist';
^^^^^^
SyntaxError: Unexpected token 'export'
at compileFunction (<anonymous>)
39 | import { AuthService } from '../../auth/auth.service';
40 | import { AllowedRoles } from '../../auth/decorators/roles.decorator';
> 41 | import { Cookies } from '@nestjsplus/cookies';
| ^
42 | import { IpAddress } from '../../../utils/ip-address.decorator';
43 | import * as express from 'express';
44 |
at Runtime._execModule (../../../node_modules/@jest/core/node_modules/jest-runtime/build/index.js:988:58)
at Object.<anonymous> (../src/application/api/controllers/auth.controller.ts:41:1)
As a hotfix for those, who has same issue: just replace import to absolute, for example:
import { Cookies } from '@nestjsplus/cookies/dist/decorators/get-cookies.decorator';
Nest just released version 7.0.0, through which decorators now have access to the context. Will you be upgrading, or keep it the same, as I assume the interceptors will be merged into the decorators now?
Any chance you'd mind if I make a PR to switch the interceptor to using RxJS methods instead of switching the Observable to a promise?
Error: Cannot find module '@nestjs/graphql'
Require stack:
- /home/tristan957/Projects/myma-store/server/node_modules/@nestjsplus/cookies/dist/interceptors/clear-cookies.interceptor.js
- /home/tristan957/Projects/myma-store/server/node_modules/@nestjsplus/cookies/dist/decorators/clear-cookies.decorator.js
- /home/tristan957/Projects/myma-store/server/node_modules/@nestjsplus/cookies/dist/decorators/index.js
- /home/tristan957/Projects/myma-store/server/node_modules/@nestjsplus/cookies/dist/index.js
- /home/tristan957/Projects/myma-store/server/node_modules/@nestjsplus/cookies/index.js
- /home/tristan957/Projects/myma-store/server/src/authentication/authentication.controller.ts
- /home/tristan957/Projects/myma-store/server/src/authentication/authentication.module.ts
- /home/tristan957/Projects/myma-store/server/src/app.module.ts
- /home/tristan957/Projects/myma-store/server/src/index.ts
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/home/tristan957/Projects/myma-store/server/node_modules/@nestjsplus/cookies/dist/interceptors/clear-cookies.interceptor.js:11:19)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
Looks like the dependency on the graphql package somehow bubbled up even when I am not using graphql in my project. I checked the package.json but I didn't see why this would happen.
In branch Nest7 GraphQL package is required by default even project don't use GraphQL.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.