UNPKG

4.71 kBJavaScriptView Raw
1'use strict'
2
3const { createDeprecation, createWarning } = require('process-warning')
4
5const FSTDEP005 = createDeprecation({
6 code: 'FSTDEP005',
7 message: 'You are accessing the deprecated "request.connection" property. Use "request.socket" instead.'
8})
9
10const FSTDEP006 = createDeprecation({
11 code: 'FSTDEP006',
12 message: 'You are decorating Request/Reply with a reference type. This reference is shared amongst all requests. Use onRequest hook instead. Property: %s'
13})
14
15const FSTDEP007 = createDeprecation({
16 code: 'FSTDEP007',
17 message: 'You are trying to set a HEAD route using "exposeHeadRoute" route flag when a sibling route is already set. See documentation for more info.'
18})
19
20const FSTDEP008 = createDeprecation({
21 code: 'FSTDEP008',
22 message: 'You are using route constraints via the route { version: "..." } option, use { constraints: { version: "..." } } option instead.'
23})
24
25const FSTDEP009 = createDeprecation({
26 code: 'FSTDEP009',
27 message: 'You are using a custom route versioning strategy via the server { versioning: "..." } option, use { constraints: { version: "..." } } option instead.'
28})
29
30const FSTDEP010 = createDeprecation({
31 code: 'FSTDEP010',
32 message: 'Modifying the "reply.sent" property is deprecated. Use the "reply.hijack()" method instead.'
33})
34
35const FSTDEP011 = createDeprecation({
36 code: 'FSTDEP011',
37 message: 'Variadic listen method is deprecated. Please use ".listen(optionsObject)" instead. The variadic signature will be removed in `fastify@5`.'
38})
39
40const FSTDEP012 = createDeprecation({
41 code: 'FSTDEP012',
42 message: 'request.context property access is deprecated. Please use "request.routeOptions.config" or "request.routeOptions.schema" instead for accessing Route settings. The "request.context" will be removed in `fastify@5`.'
43})
44
45const FSTDEP013 = createDeprecation({
46 code: 'FSTDEP013',
47 message: 'Direct return of "trailers" function is deprecated. Please use "callback" or "async-await" for return value. The support of direct return will removed in `fastify@5`.'
48})
49
50const FSTDEP014 = createDeprecation({
51 code: 'FSTDEP014',
52 message: 'You are trying to set/access the default route. This property is deprecated. Please, use setNotFoundHandler if you want to custom a 404 handler or the wildcard (*) to match all routes.'
53})
54
55const FSTDEP015 = createDeprecation({
56 code: 'FSTDEP015',
57 message: 'You are accessing the deprecated "request.routeSchema" property. Use "request.routeOptions.schema" instead. Property "req.routeSchema" will be removed in `fastify@5`.'
58})
59
60const FSTDEP016 = createDeprecation({
61 code: 'FSTDEP016',
62 message: 'You are accessing the deprecated "request.routeConfig" property. Use "request.routeOptions.config" instead. Property "req.routeConfig" will be removed in `fastify@5`.'
63})
64
65const FSTDEP017 = createDeprecation({
66 code: 'FSTDEP017',
67 message: 'You are accessing the deprecated "request.routerPath" property. Use "request.routeOptions.url" instead. Property "req.routerPath" will be removed in `fastify@5`.'
68})
69
70const FSTDEP018 = createDeprecation({
71 code: 'FSTDEP018',
72 message: 'You are accessing the deprecated "request.routerMethod" property. Use "request.routeOptions.method" instead. Property "req.routerMethod" will be removed in `fastify@5`.'
73})
74
75const FSTDEP019 = createDeprecation({
76 code: 'FSTDEP019',
77 message: 'reply.context property access is deprecated. Please use "request.routeOptions.config" or "request.routeOptions.schema" instead for accessing Route settings. The "reply.context" will be removed in `fastify@5`.'
78})
79
80const FSTDEP020 = createDeprecation({
81 code: 'FSTDEP020',
82 message: 'You are using the deprecated "reply.getResponseTime()" method. Use the "reply.elapsedTime" property instead. Method "reply.getResponseTime()" will be removed in `fastify@5`.'
83})
84
85const FSTDEP021 = createDeprecation({
86 code: 'FSTDEP021',
87 message: 'The `reply.redirect()` method has a new signature: `reply.redirect(url: string, code?: number)`. It will be enforced in `fastify@v5`'
88})
89
90const FSTWRN001 = createWarning({
91 name: 'FastifyWarning',
92 code: 'FSTWRN001',
93 message: 'The %s schema for %s: %s is missing. This may indicate the schema is not well specified.',
94 unlimited: true
95})
96
97const FSTWRN002 = createWarning({
98 name: 'FastifyWarning',
99 code: 'FSTWRN002',
100 message: 'The %s plugin being registered mixes async and callback styles, which will result in an error in `fastify@5`',
101 unlimited: true
102})
103
104module.exports = {
105 FSTDEP005,
106 FSTDEP006,
107 FSTDEP007,
108 FSTDEP008,
109 FSTDEP009,
110 FSTDEP010,
111 FSTDEP011,
112 FSTDEP012,
113 FSTDEP013,
114 FSTDEP014,
115 FSTDEP015,
116 FSTDEP016,
117 FSTDEP017,
118 FSTDEP018,
119 FSTDEP019,
120 FSTDEP020,
121 FSTDEP021,
122 FSTWRN001,
123 FSTWRN002
124}