@fastify/cookie 6.0.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,10 +14,9 @@ jobs:
14
14
  strategy:
15
15
  matrix:
16
16
  node-version:
17
- - 10
18
- - 12
19
17
  - 14
20
18
  - 16
19
+ - 18
21
20
  os:
22
21
  - macos-latest
23
22
  - ubuntu-latest
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # fastify-cookie
1
+ # @fastify/cookie
2
2
 
3
3
  ![CI](https://github.com/fastify/fastify-cookie/workflows/CI/badge.svg)
4
- [![NPM version](https://img.shields.io/npm/v/fastify-cookie.svg?style=flat)](https://www.npmjs.com/package/fastify-cookie)
4
+ [![NPM version](https://img.shields.io/npm/v/@fastify/cookie.svg?style=flat)](https://www.npmjs.com/package/@fastify/cookie)
5
5
  [![Known Vulnerabilities](https://snyk.io/test/github/fastify/fastify-cookie/badge.svg)](https://snyk.io/test/github/fastify/fastify-cookie)
6
6
  [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
7
7
 
@@ -12,16 +12,27 @@ This plugin's cookie parsing works via Fastify's `onRequest` hook. Therefore,
12
12
  you should register it prior to any other `onRequest` hooks that will depend
13
13
  upon this plugin's actions.
14
14
 
15
- `fastify-cookie` [v2.x](https://github.com/fastify/fastify-cookie/tree/v2.x)
15
+ `@fastify/cookie` [v2.x](https://github.com/fastify/fastify-cookie/tree/v2.x)
16
16
  supports both Fastify@1 and Fastify@2.
17
- `fastify-cookie` v3 only supports Fastify@2.
17
+ `@fastify/cookie` v3 only supports Fastify@2.
18
+
19
+ ## Installation
20
+ ```sh
21
+ npm i @fastify/cookie
22
+ ```
23
+
24
+ or
25
+
26
+ ```sh
27
+ yarn add @fastify/cookie
28
+ ```
18
29
 
19
30
  ## Example
20
31
 
21
32
  ```js
22
33
  const fastify = require('fastify')()
23
34
 
24
- fastify.register(require('fastify-cookie'), {
35
+ fastify.register(require('@fastify/cookie'), {
25
36
  secret: "my-secret", // for cookies signature
26
37
  parseOptions: {} // options for parsing cookies
27
38
  })
@@ -47,8 +58,8 @@ fastify.get('/', (req, reply) => {
47
58
  ## TypeScript Example
48
59
 
49
60
  ```ts
50
- import { FastifyCookieOptions } from 'fastify-cookie'
51
- import cookie from 'fastify-cookie'
61
+ import { FastifyCookieOptions } from '@fastify/cookie'
62
+ import cookie from '@fastify/cookie'
52
63
  import fastify from 'fastify'
53
64
 
54
65
  const app = fastify()
@@ -126,7 +137,7 @@ Key rotation is when an encryption key is retired and replaced by generating a n
126
137
 
127
138
  **Example:**
128
139
  ```js
129
- fastify.register(require('fastify-cookie'), {
140
+ fastify.register(require('@fastify/cookie'), {
130
141
  secret: [key1, key2]
131
142
  })
132
143
  ```
@@ -161,7 +172,7 @@ The `secret` option optionally accepts an object with `sign` and `unsign` functi
161
172
 
162
173
  **Example:**
163
174
  ```js
164
- fastify.register(require('fastify-cookie'), {
175
+ fastify.register(require('@fastify/cookie'), {
165
176
  secret: {
166
177
  sign: (value) => {
167
178
  // sign using custom logic
@@ -188,7 +199,7 @@ the provided signer's (or the default signer if no custom implementation is prov
188
199
  **Example:**
189
200
 
190
201
  ```js
191
- fastify.register(require('fastify-cookie'), { secret: 'my-secret' })
202
+ fastify.register(require('@fastify/cookie'), { secret: 'my-secret' })
192
203
 
193
204
  fastify.get('/', (req, rep) => {
194
205
  if (fastify.unsign(req.cookie.foo).valid === false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastify/cookie",
3
- "version": "6.0.0",
3
+ "version": "7.0.0",
4
4
  "description": "Plugin for fastify to add support for cookies",
5
5
  "main": "plugin.js",
6
6
  "types": "plugin.d.ts",
@@ -40,9 +40,9 @@
40
40
  "homepage": "https://github.com/fastify/fastify-cookie#readme",
41
41
  "devDependencies": {
42
42
  "@types/node": "^17.0.16",
43
- "fastify": "^3.27.1",
43
+ "fastify": "^4.0.0-rc.2",
44
44
  "pre-commit": "^1.2.2",
45
- "sinon": "^13.0.1",
45
+ "sinon": "^14.0.0",
46
46
  "snazzy": "^9.0.0",
47
47
  "standard": "^17.0.0",
48
48
  "tap": "^16.0.0",
package/plugin.js CHANGED
@@ -91,8 +91,8 @@ function plugin (fastify, options, next) {
91
91
  }
92
92
 
93
93
  const fastifyCookie = fp(plugin, {
94
- fastify: '>=3',
95
- name: 'fastify-cookie'
94
+ fastify: '4.x',
95
+ name: '@fastify/cookie'
96
96
  })
97
97
 
98
98
  /**