@torpor/build 0.2.0 → 0.3.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.
- package/CHANGELOG.md +31 -0
- package/dist/RouteType-g8Ce5gOd.js +107 -0
- package/dist/RouteType-g8Ce5gOd.js.map +1 -0
- package/dist/Server-CSpY_-Ba.d.ts +78 -0
- package/dist/Server-CSpY_-Ba.d.ts.map +1 -0
- package/dist/ServerEvent-2-CnAy1W.js +74 -0
- package/dist/ServerEvent-2-CnAy1W.js.map +1 -0
- package/dist/Site-D4x1l0p5.d.ts +67 -0
- package/dist/Site-D4x1l0p5.d.ts.map +1 -0
- package/dist/_page-CsdPubw4.js +33 -0
- package/dist/_page-CsdPubw4.js.map +1 -0
- package/dist/bin/index.d.ts +1 -1
- package/dist/bin/index.js +14 -19
- package/dist/bin/index.js.map +1 -1
- package/dist/connectMiddleware-DbLj0St1.js +252 -0
- package/dist/connectMiddleware-DbLj0St1.js.map +1 -0
- package/dist/index.d.ts +188 -179
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -145
- package/dist/index.js.map +1 -1
- package/dist/nav.d.ts +14 -0
- package/dist/nav.d.ts.map +1 -0
- package/dist/nav.js +184 -0
- package/dist/nav.js.map +1 -0
- package/dist/pathToRegex-CTgx7hQP.js +11 -0
- package/dist/pathToRegex-CTgx7hQP.js.map +1 -0
- package/dist/response-D-XpIuMH.js +307 -0
- package/dist/response-D-XpIuMH.js.map +1 -0
- package/dist/response.d.ts +336 -151
- package/dist/response.d.ts.map +1 -0
- package/dist/response.js +4 -37
- package/dist/run-CNdaKSPR.js +331 -0
- package/dist/run-CNdaKSPR.js.map +1 -0
- package/dist/run.d.ts +11 -8
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +8 -18
- package/dist/seeOther-BmehiI4C.js +110 -0
- package/dist/seeOther-BmehiI4C.js.map +1 -0
- package/dist/server.d.ts +12 -11
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +5 -18
- package/dist/state.d.ts +14 -10
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +3 -7
- package/dist/test.d.ts +12 -11
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +152 -225
- package/dist/test.js.map +1 -1
- package/package.json +25 -29
- package/src/bin/index.ts +9 -11
- package/src/index.ts +3 -0
- package/src/nav/load.ts +9 -0
- package/src/nav/loadData.ts +121 -0
- package/src/nav/navigate.ts +154 -0
- package/src/nav/reload.ts +9 -0
- package/src/nav.ts +4 -0
- package/src/response/badRequest.ts +9 -4
- package/src/response/created.ts +10 -3
- package/src/response/forbidden.ts +11 -4
- package/src/response/found.ts +30 -0
- package/src/response/methodNotAllowed.ts +8 -4
- package/src/response/movedPermanently.ts +25 -0
- package/src/response/notFound.ts +14 -7
- package/src/response/notModified.ts +24 -4
- package/src/response/ok.ts +19 -10
- package/src/response/permanentRedirect.ts +30 -0
- package/src/response/seeOther.ts +9 -3
- package/src/response/serverError.ts +14 -2
- package/src/response/temporaryRedirect.ts +31 -0
- package/src/response/unauthorized.ts +11 -4
- package/src/response/unprocessable.ts +8 -2
- package/src/response.ts +8 -4
- package/src/{site → run}/prepareTemplate.ts +1 -1
- package/src/{site → run}/run.ts +1 -1
- package/src/{site → run}/runBuild.ts +2 -2
- package/src/{site → run}/runDev.ts +2 -2
- package/src/{site → run}/runPreview.ts +1 -1
- package/src/run.ts +4 -4
- package/src/server/Routerx.ts +3 -3
- package/src/server/Server.ts +3 -3
- package/src/server/connect/connectMiddleware.ts +2 -1
- package/src/server/connect/nodeMessageToNodeResponse.ts +2 -2
- package/src/site/Router.ts +3 -3
- package/src/site/clientEntry.ts +11 -269
- package/src/site/defaultAdapter.ts +1 -1
- package/src/site/serverEntry.ts +67 -44
- package/src/state/$page.ts +3 -12
- package/src/state/client.ts +6 -0
- package/src/state/internal.ts +45 -0
- package/src/test/runTest.ts +1 -1
- package/src/types/Adapter.ts +2 -4
- package/src/types/ClientState.ts +8 -0
- package/src/types/InternalState.ts +7 -0
- package/src/types/LayoutHandler.ts +2 -4
- package/src/types/LayoutPath.ts +10 -0
- package/src/types/ManifestRoute.ts +2 -4
- package/src/types/PageEndPoint.ts +2 -4
- package/src/types/PageLoadEvent.ts +2 -4
- package/src/types/PageServerEndPoint.ts +2 -4
- package/src/types/PageState.ts +8 -0
- package/src/types/RouteHandler.ts +2 -4
- package/src/types/RouteLayoutHandler.ts +2 -4
- package/src/types/RouteMatchResult.ts +2 -4
- package/src/types/ServerHook.ts +3 -7
- package/src/types/ServerLoadEvent.ts +2 -4
- package/src/{site → utils}/pathToRegex.ts +1 -1
- package/{tsup.config.ts → tsdown.config.ts} +3 -4
- package/dist/Server-CNZWh5ca.d.cts +0 -71
- package/dist/Server-CNZWh5ca.d.ts +0 -71
- package/dist/Site-C2020GV_.d.ts +0 -63
- package/dist/Site-DQojGpE-.d.cts +0 -63
- package/dist/bin/index.cjs +0 -778
- package/dist/bin/index.cjs.map +0 -1
- package/dist/bin/index.d.cts +0 -1
- package/dist/chunk-565UOT3F.js +0 -18
- package/dist/chunk-565UOT3F.js.map +0 -1
- package/dist/chunk-B2UNTYN5.js +0 -68
- package/dist/chunk-B2UNTYN5.js.map +0 -1
- package/dist/chunk-CZHJQCPI.js +0 -286
- package/dist/chunk-CZHJQCPI.js.map +0 -1
- package/dist/chunk-PTVHEJZ5.js +0 -152
- package/dist/chunk-PTVHEJZ5.js.map +0 -1
- package/dist/chunk-SJVHHGVW.js +0 -13
- package/dist/chunk-SJVHHGVW.js.map +0 -1
- package/dist/chunk-TDOXEXG6.js +0 -85
- package/dist/chunk-TDOXEXG6.js.map +0 -1
- package/dist/chunk-WVXAN4IV.js +0 -50
- package/dist/chunk-WVXAN4IV.js.map +0 -1
- package/dist/chunk-YRBEYKQM.js +0 -372
- package/dist/chunk-YRBEYKQM.js.map +0 -1
- package/dist/index.cjs +0 -322
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -199
- package/dist/metafile-cjs.json +0 -1
- package/dist/metafile-esm.json +0 -1
- package/dist/response.cjs +0 -150
- package/dist/response.cjs.map +0 -1
- package/dist/response.d.cts +0 -166
- package/dist/response.js.map +0 -1
- package/dist/run.cjs +0 -787
- package/dist/run.cjs.map +0 -1
- package/dist/run.d.cts +0 -14
- package/dist/run.js.map +0 -1
- package/dist/server.cjs +0 -398
- package/dist/server.cjs.map +0 -1
- package/dist/server.d.cts +0 -17
- package/dist/server.js.map +0 -1
- package/dist/state.cjs +0 -44
- package/dist/state.cjs.map +0 -1
- package/dist/state.d.cts +0 -11
- package/dist/state.js.map +0 -1
- package/dist/test.cjs +0 -538
- package/dist/test.cjs.map +0 -1
- package/dist/test.d.cts +0 -15
- package/src/response/moved.ts +0 -16
- package/src/response/redirect.ts +0 -17
- package/src/state/Page.ts +0 -8
package/dist/response.d.ts
CHANGED
|
@@ -1,166 +1,351 @@
|
|
|
1
|
+
//#region src/response/badRequest.d.ts
|
|
1
2
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
* 400 Bad Request
|
|
4
|
+
*
|
|
5
|
+
* The HTTP 400 Bad Request client error response status code indicates that the
|
|
6
|
+
* server would not process the request due to something the server considered
|
|
7
|
+
* to be a client error. The reason for a 400 response is typically due to
|
|
8
|
+
* malformed request syntax, invalid request message framing, or deceptive
|
|
9
|
+
* request routing.
|
|
10
|
+
*
|
|
11
|
+
* Clients that receive a 400 response should expect that repeating the request
|
|
12
|
+
* without modification will fail with the same error.
|
|
13
|
+
*
|
|
14
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/400
|
|
15
|
+
*/
|
|
10
16
|
declare function badRequest(body?: object | string): Response;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/response/created.d.ts
|
|
19
|
+
/**
|
|
20
|
+
* 201 Created
|
|
21
|
+
*
|
|
22
|
+
* The HTTP 201 Created successful response status code indicates that the HTTP
|
|
23
|
+
* request has led to the creation of a resource. This status code is commonly
|
|
24
|
+
* sent as the result of a POST request.
|
|
25
|
+
*
|
|
26
|
+
* The new resource, or a description and link to the new resource, is created
|
|
27
|
+
* before the response is returned. The newly-created items can be returned in
|
|
28
|
+
* the body of the response message, but must be locatable by the URL of the
|
|
29
|
+
* initiating request or by the URL in the value of the Location header provided
|
|
30
|
+
* with the response.
|
|
31
|
+
*
|
|
32
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/201
|
|
33
|
+
*/
|
|
20
34
|
declare function created(body?: object | string): Response;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/response/forbidden.d.ts
|
|
37
|
+
/**
|
|
38
|
+
* 403 Forbidden
|
|
39
|
+
*
|
|
40
|
+
* The HTTP 403 Forbidden client error response status code indicates that the
|
|
41
|
+
* server understood the request but refused to process it. This status is
|
|
42
|
+
* similar to 401, except that for 403 Forbidden responses, authenticating or
|
|
43
|
+
* re-authenticating makes no difference. The request failure is tied to
|
|
44
|
+
* application logic, such as insufficient permissions to a resource or action.
|
|
45
|
+
*
|
|
46
|
+
* Clients that receive a 403 response should expect that repeating the request
|
|
47
|
+
* without modification will fail with the same error. Server owners may decide
|
|
48
|
+
* to send a 404 response instead of a 403 if acknowledging the existence of a
|
|
49
|
+
* resource to clients with insufficient privileges is not desired.
|
|
50
|
+
*
|
|
51
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/403
|
|
52
|
+
*/
|
|
31
53
|
declare function forbidden(body?: object | string): Response;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/response/found.d.ts
|
|
56
|
+
/**
|
|
57
|
+
* 302 Found
|
|
58
|
+
*
|
|
59
|
+
* The HTTP 302 Found redirection response status code indicates that the
|
|
60
|
+
* requested resource has been temporarily moved to the URL in the Location
|
|
61
|
+
* header.
|
|
62
|
+
*
|
|
63
|
+
* A browser receiving this status will automatically request the resource at
|
|
64
|
+
* the URL in the Location header, redirecting the user to the new page. Search
|
|
65
|
+
* engines receiving this response will not attribute links to the original URL
|
|
66
|
+
* to the new resource, meaning no SEO value is transferred to the new URL.
|
|
67
|
+
*
|
|
68
|
+
* > Note: In the Fetch Standard, when a user agent receives a 302 in response
|
|
69
|
+
* > to a POST request, it uses the GET method in the subsequent redirection
|
|
70
|
+
* > request, as permitted by the HTTP specification. To avoid user agents
|
|
71
|
+
* > modifying the request, use 307 Temporary Redirect instead, as altering the
|
|
72
|
+
* > method after a 307 response is prohibited.
|
|
73
|
+
*
|
|
74
|
+
* > In cases where you want any request method to be changed to GET, use 303
|
|
75
|
+
* > See Other. This is useful when you want to give a response to a PUT method
|
|
76
|
+
* > that is not the uploaded resource but a confirmation message such as: "you
|
|
77
|
+
* > successfully uploaded XYZ".
|
|
78
|
+
*
|
|
79
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/302
|
|
80
|
+
*/
|
|
81
|
+
declare function permRedirect(location: string): Response;
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/response/methodNotAllowed.d.ts
|
|
84
|
+
/**
|
|
85
|
+
* 405 Method Not Allowed
|
|
86
|
+
*
|
|
87
|
+
* The HTTP 405 Method Not Allowed client error response status code indicates
|
|
88
|
+
* that the server knows the request method, but the target resource doesn't
|
|
89
|
+
* support this method. The server must generate an Allow header in a 405
|
|
90
|
+
* response with a list of methods that the target resource currently supports.
|
|
91
|
+
*
|
|
92
|
+
* Improper server-side permissions set on files or directories may cause a 405
|
|
93
|
+
* response when the request would otherwise be expected to succeed.
|
|
94
|
+
*
|
|
95
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/405
|
|
96
|
+
*/
|
|
42
97
|
declare function methodNotAllowed(body?: object | string): Response;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/response/movedPermanently.d.ts
|
|
100
|
+
/**
|
|
101
|
+
* 301 Moved Permanently
|
|
102
|
+
*
|
|
103
|
+
* The HTTP 301 Moved Permanently redirection response status code indicates
|
|
104
|
+
* that the requested resource has been permanently moved to the URL in the
|
|
105
|
+
* Location header.
|
|
106
|
+
*
|
|
107
|
+
* A browser receiving this status will automatically request the resource at
|
|
108
|
+
* the URL in the Location header, redirecting the user to the new page. Search
|
|
109
|
+
* engines receiving this response will attribute links to the original URL to
|
|
110
|
+
* the redirected resource, passing the SEO ranking to the new URL.
|
|
111
|
+
*
|
|
112
|
+
* > Note: In the Fetch Standard, when a user agent receives a 301 in response
|
|
113
|
+
* > to a POST request, it uses the GET method in the subsequent redirection
|
|
114
|
+
* > request, as permitted by the HTTP specification. To avoid user agents
|
|
115
|
+
* > modifying the request, use 308 Permanent Redirect instead, as altering the
|
|
116
|
+
* > method after a 308 response is prohibited.
|
|
117
|
+
*
|
|
118
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/301
|
|
119
|
+
*/
|
|
120
|
+
declare function permRedirect$1(location: string): Response;
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/response/notFound.d.ts
|
|
123
|
+
/**
|
|
124
|
+
* 404 Not Found
|
|
125
|
+
*
|
|
126
|
+
* The HTTP 404 Not Found client error response status code indicates that the
|
|
127
|
+
* server cannot find the requested resource. Links that lead to a 404 page are
|
|
128
|
+
* often called broken or dead links and can be subject to link rot.
|
|
129
|
+
*
|
|
130
|
+
* A 404 status code only indicates that the resource is missing without
|
|
131
|
+
* indicating if this is temporary or permanent. If a resource is permanently
|
|
132
|
+
* removed, servers should send the 410 Gone status instead.
|
|
133
|
+
*
|
|
134
|
+
* 404 errors on a website can lead to a poor user experience for your visitors,
|
|
135
|
+
* so the number of broken links (internal and external) should be minimized to
|
|
136
|
+
* prevent frustration for readers. Common causes of 404 responses are mistyped
|
|
137
|
+
* URLs or pages that are moved or deleted without redirection. For more
|
|
138
|
+
* information, see the Redirections in HTTP guide.
|
|
139
|
+
*
|
|
140
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/404
|
|
141
|
+
*/
|
|
69
142
|
declare function notFound(body?: object | string): Response;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/response/notModified.d.ts
|
|
145
|
+
/**
|
|
146
|
+
* 304 Not Modified
|
|
147
|
+
*
|
|
148
|
+
* The HTTP 304 Not Modified redirection response status code indicates that
|
|
149
|
+
* there is no need to retransmit the requested resources.
|
|
150
|
+
*
|
|
151
|
+
* This response code is sent when the request is a conditional GET or HEAD
|
|
152
|
+
* request with an If-None-Match or an If-Modified-Since header and the
|
|
153
|
+
* condition evaluates to 'false'. It confirms that the resource cached by the
|
|
154
|
+
* client is still valid and that the server would have sent a 200 OK response
|
|
155
|
+
* with the resource if the condition evaluated to 'true'. See HTTP caching for
|
|
156
|
+
* more information.
|
|
157
|
+
*
|
|
158
|
+
* The response must not contain a body and must include the headers that would
|
|
159
|
+
* have been sent in an equivalent 200 response, such as:
|
|
160
|
+
*
|
|
161
|
+
* - Cache-Control
|
|
162
|
+
* - Content-Location
|
|
163
|
+
* - Date
|
|
164
|
+
* - ETag
|
|
165
|
+
* - Expires
|
|
166
|
+
* - Vary
|
|
167
|
+
*
|
|
168
|
+
* > Note: Many developer tools' network panels of browsers create extraneous
|
|
169
|
+
* > requests leading to 304 responses, so that access to the local cache is
|
|
170
|
+
* > visible to developers.
|
|
171
|
+
*
|
|
172
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/304
|
|
173
|
+
*/
|
|
80
174
|
declare function notModified(location: string): Response;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/response/ok.d.ts
|
|
177
|
+
/**
|
|
178
|
+
* 200 OK
|
|
179
|
+
*
|
|
180
|
+
* The HTTP 200 OK successful response status code indicates that a request has
|
|
181
|
+
* succeeded. A 200 OK response is cacheable by default.
|
|
182
|
+
*
|
|
183
|
+
* A 200 OK response has a different meaning and format depending on the HTTP
|
|
184
|
+
* request method. Here's how they vary for different methods:
|
|
185
|
+
*
|
|
186
|
+
* - GET: A resource was retrieved by the server and included in the response
|
|
187
|
+
* body.
|
|
188
|
+
* - POST: An action succeeded; the response has a message body describing the
|
|
189
|
+
* result.
|
|
190
|
+
* - HEAD: Identical to GET, except there is no message body.
|
|
191
|
+
* - TRACE: The response has a message body containing the request as received
|
|
192
|
+
* by the server.
|
|
193
|
+
*
|
|
194
|
+
* Although possible, successful PUT or DELETE requests often do not result in a
|
|
195
|
+
* 200 OK response. It is more common to see 201 Created if the resource is
|
|
196
|
+
* uploaded or created for the first time, or 204 No Content upon successful
|
|
197
|
+
* deletion of a resource.
|
|
198
|
+
*
|
|
199
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/200
|
|
200
|
+
*/
|
|
97
201
|
declare function ok(body?: object | string): Response;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/response/permanentRedirect.d.ts
|
|
204
|
+
/**
|
|
205
|
+
* 308 Permanent Redirect
|
|
206
|
+
*
|
|
207
|
+
* The HTTP 308 Permanent Redirect redirection response status code indicates
|
|
208
|
+
* that the requested resource has been permanently moved to the URL given by
|
|
209
|
+
* the Location header.
|
|
210
|
+
*
|
|
211
|
+
* A browser receiving this status will automatically request the resource at
|
|
212
|
+
* the URL in the Location header, redirecting the user to the new page. Search
|
|
213
|
+
* engines receiving this response will attribute links to the original URL to
|
|
214
|
+
* the redirected resource, passing the SEO ranking to the new URL.
|
|
215
|
+
*
|
|
216
|
+
* The request method and the body will not be modified by the client in the
|
|
217
|
+
* redirected request. A 301 Moved Permanently requires the request method and
|
|
218
|
+
* the body to remain unchanged when redirection is performed, but this is
|
|
219
|
+
* incorrectly handled by older clients to use the GET method instead.
|
|
220
|
+
*
|
|
221
|
+
* > Note: Some Web applications may use the 308 Permanent Redirect in a
|
|
222
|
+
* > non-standard way and for different purposes. For example, Google Drive uses
|
|
223
|
+
* > a 308 Resume Incomplete response to indicate to the client when an
|
|
224
|
+
* > unfinished upload has stalled. See Perform a resumable download on the
|
|
225
|
+
* > Google Drive documentation for more information.
|
|
226
|
+
*
|
|
227
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/308
|
|
228
|
+
*/
|
|
229
|
+
declare function permanentRedirect(location: string): Response;
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/response/response.d.ts
|
|
232
|
+
/**
|
|
233
|
+
* Creates a response with the supplied status code and optional body.
|
|
234
|
+
*
|
|
235
|
+
* If the body is an object, it will be converted to JSON and the content-type
|
|
236
|
+
* header set to "application/json". Otherwise, if the body is a string, the
|
|
237
|
+
* content-type header will be set to "text/plain".
|
|
238
|
+
*/
|
|
120
239
|
declare function response(status: number, body?: object | string): Response;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/response/seeOther.d.ts
|
|
242
|
+
/**
|
|
243
|
+
* 303 See Other
|
|
244
|
+
*
|
|
245
|
+
* The HTTP 303 See Other redirection response status code indicates that the
|
|
246
|
+
* browser should redirect to the URL in the Location header instead of
|
|
247
|
+
* rendering the requested resource.
|
|
248
|
+
*
|
|
249
|
+
* This response code is often sent back as a result of PUT or POST methods so
|
|
250
|
+
* the client may retrieve a confirmation, or view a representation of a
|
|
251
|
+
* real-world object (see HTTP range-14). The method to retrieve the redirected
|
|
252
|
+
* resource is always GET.
|
|
253
|
+
*
|
|
254
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/303
|
|
255
|
+
*/
|
|
130
256
|
declare function seeOther(location: string): Response;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/response/serverError.d.ts
|
|
259
|
+
/**
|
|
260
|
+
* 500 Server Error
|
|
261
|
+
*
|
|
262
|
+
* The HTTP 500 Internal Server Error server error response status code
|
|
263
|
+
* indicates that the server encountered an unexpected condition that prevented
|
|
264
|
+
* it from fulfilling the request. This error is a generic "catch-all" response
|
|
265
|
+
* to server issues, indicating that the server cannot find a more appropriate
|
|
266
|
+
* 5XX error to respond with.
|
|
267
|
+
*
|
|
268
|
+
* If you're a visitor seeing 500 errors on a web page, these issues require
|
|
269
|
+
* investigation by server owners or administrators. There are many possible
|
|
270
|
+
* causes of 500 errors, including: improper server configuration, out-of-memory
|
|
271
|
+
* (OOM) issues, unhandled exceptions, improper file permissions, or other
|
|
272
|
+
* complex factors. Server administrators may proactively log occurrences of
|
|
273
|
+
* server error responses, like the 500 status code, with details about the
|
|
274
|
+
* initiating requests to improve the stability of a service in the future.
|
|
275
|
+
*
|
|
276
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/500
|
|
277
|
+
*/
|
|
139
278
|
declare function serverError(body?: object | string): Response;
|
|
140
|
-
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/response/temporaryRedirect.d.ts
|
|
141
281
|
/**
|
|
142
|
-
|
|
143
|
-
|
|
282
|
+
* 307 Temporary Redirect
|
|
283
|
+
*
|
|
284
|
+
* The HTTP 307 Temporary Redirect redirection response status code indicates
|
|
285
|
+
* that the resource requested has been temporarily moved to the URL in the
|
|
286
|
+
* Location header.
|
|
287
|
+
*
|
|
288
|
+
* A browser receiving this status will automatically request the resource at
|
|
289
|
+
* the URL in the Location header, redirecting the user to the new page. Search
|
|
290
|
+
* engines receiving this response will not attribute links to the original URL
|
|
291
|
+
* to the new resource, meaning no SEO value is transferred to the new URL.
|
|
292
|
+
*
|
|
293
|
+
* The method and the body of the original request are reused to perform the
|
|
294
|
+
* redirected request. In the cases where you want the request method to be
|
|
295
|
+
* changed to GET, use 303 See Other instead. This is useful when you want to
|
|
296
|
+
* give an answer to a successful PUT request that is not the uploaded resource,
|
|
297
|
+
* but a status monitor or confirmation message like "You have successfully
|
|
298
|
+
* uploaded XYZ".
|
|
299
|
+
*
|
|
300
|
+
* The difference between 307 and 302 is that 307 guarantees that the client
|
|
301
|
+
* will not change the request method and body when the redirected request is
|
|
302
|
+
* made. With 302, older clients incorrectly changed the method to GET. 307 and
|
|
303
|
+
* 302 responses are identical when the request method is GET.
|
|
304
|
+
*
|
|
305
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/307
|
|
306
|
+
*/
|
|
307
|
+
declare function temporaryRedirect(location: string): Response;
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region src/response/transfer.d.ts
|
|
310
|
+
/**
|
|
311
|
+
* Creates a redirect response with the supplied status code.
|
|
312
|
+
*/
|
|
144
313
|
declare function transfer(status: 300 | 301 | 302 | 303 | 304 | 307 | 308, location: string): Response;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region src/response/unauthorized.d.ts
|
|
316
|
+
/**
|
|
317
|
+
* 401 Unauthorized
|
|
318
|
+
*
|
|
319
|
+
* The HTTP 401 Unauthorized client error response status code indicates that a
|
|
320
|
+
* request was not successful because it lacks valid authentication credentials
|
|
321
|
+
* for the requested resource. This status code is sent with an HTTP
|
|
322
|
+
* WWW-Authenticate response header that contains information on the
|
|
323
|
+
* authentication scheme the server expects the client to include to make the
|
|
324
|
+
* request successfully.
|
|
325
|
+
*
|
|
326
|
+
* A 401 Unauthorized is similar to the 403 Forbidden response, except that a
|
|
327
|
+
* 403 is returned when a request contains valid credentials, but the client
|
|
328
|
+
* does not have permissions to perform a certain action.
|
|
329
|
+
*
|
|
330
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/401
|
|
331
|
+
*/
|
|
155
332
|
declare function unauthorized(body?: object | string): Response;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region src/response/unprocessable.d.ts
|
|
335
|
+
/**
|
|
336
|
+
* 422 Unprocessable Content
|
|
337
|
+
*
|
|
338
|
+
* The HTTP 422 Unprocessable Content client error response status code
|
|
339
|
+
* indicates that the server understood the content type of the request content,
|
|
340
|
+
* and the syntax of the request content was correct, but it was unable to
|
|
341
|
+
* process the contained instructions.
|
|
342
|
+
*
|
|
343
|
+
* Clients that receive a 422 response should expect that repeating the request
|
|
344
|
+
* without modification will fail with the same error.
|
|
345
|
+
*
|
|
346
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/422
|
|
347
|
+
*/
|
|
164
348
|
declare function unprocessable(body?: object | string): Response;
|
|
165
|
-
|
|
166
|
-
export { badRequest, created, forbidden, methodNotAllowed,
|
|
349
|
+
//#endregion
|
|
350
|
+
export { badRequest, created, forbidden, permRedirect as found, methodNotAllowed, permRedirect$1 as movedPermanently, notFound, notModified, ok, permanentRedirect, response, seeOther, serverError, temporaryRedirect, transfer, unauthorized, unprocessable };
|
|
351
|
+
//# sourceMappingURL=response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response.d.ts","names":[],"sources":["../src/response/badRequest.ts","../src/response/created.ts","../src/response/forbidden.ts","../src/response/found.ts","../src/response/methodNotAllowed.ts","../src/response/movedPermanently.ts","../src/response/notFound.ts","../src/response/notModified.ts","../src/response/ok.ts","../src/response/permanentRedirect.ts","../src/response/response.ts","../src/response/seeOther.ts","../src/response/serverError.ts","../src/response/temporaryRedirect.ts","../src/response/transfer.ts","../src/response/unauthorized.ts","../src/response/unprocessable.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;iBAgBwB,UAAA,0BAAoC;;;;;;;;;;;;;;;;;;iBCCpC,OAAA,0BAAiC;;;;;;;;;;;;;;;;;;;iBCCjC,SAAA,0BAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIGnC,iBHMA,YAAA,CGNkC,QAAA,EAAA,MAAA,CAAA,EHMF,QGNE;;;;;;;;;;;;;;;;AHMlC,iBCZA,gBAAA,CDYgC,IAAA,CAAA,EAAA,MAAA,GAAA,MAAA,CAAA,ECZU,QDYV;;;;;;;;;;;;;;;;;;;;;;;iBELhC,cAAA,oBAAgC;;;;;;;;;;;;;;;;;;;;;;iBCDhC,QAAA,0BAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACUlC,iBAAA,WAAA,CAA+B,QAAA,EAAA,MAAA,CAAA,EAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCL/B,EAAA,0BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;AFL5B,iBGMA,iBAAA,CHNkC,QAAA,EAAA,MAAA,CAAA,EGMG,QHNH;;;;;;;;;;iBIdlC,QAAA,0CAAkD;;;;;;;;;;;;;;;;;iBCSlD,QAAA,oBAA4B;;;;;;;;;;;;;;;;;;;;;;iBCK5B,WAAA,0BAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCOrC,iBAAA,oBAAqC;;;;;;iBCzBrC,QAAA,qEAGrB;;;;;;;;;;;;;;;;;;;iBCYqB,YAAA,0BAAsC;;;;;;;;;;;;;;;;AZStC,iBaZA,aAAA,CbYgC,IAAA,CAAA,EAAA,MAAA,GAAA,MAAA,CAAA,EaZO,QbYP"}
|
package/dist/response.js
CHANGED
|
@@ -1,37 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
methodNotAllowed,
|
|
6
|
-
moved,
|
|
7
|
-
notModified,
|
|
8
|
-
redirect,
|
|
9
|
-
serverError,
|
|
10
|
-
unauthorized,
|
|
11
|
-
unprocessable
|
|
12
|
-
} from "./chunk-B2UNTYN5.js";
|
|
13
|
-
import {
|
|
14
|
-
notFound,
|
|
15
|
-
ok,
|
|
16
|
-
response,
|
|
17
|
-
seeOther,
|
|
18
|
-
transfer
|
|
19
|
-
} from "./chunk-WVXAN4IV.js";
|
|
20
|
-
export {
|
|
21
|
-
badRequest,
|
|
22
|
-
created,
|
|
23
|
-
forbidden,
|
|
24
|
-
methodNotAllowed,
|
|
25
|
-
moved,
|
|
26
|
-
notFound,
|
|
27
|
-
notModified,
|
|
28
|
-
ok,
|
|
29
|
-
redirect,
|
|
30
|
-
response,
|
|
31
|
-
seeOther,
|
|
32
|
-
serverError,
|
|
33
|
-
transfer,
|
|
34
|
-
unauthorized,
|
|
35
|
-
unprocessable
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=response.js.map
|
|
1
|
+
import { notFound, ok, response, seeOther, transfer } from "./seeOther-BmehiI4C.js";
|
|
2
|
+
import { badRequest, created, forbidden, methodNotAllowed, notModified, permRedirect as permRedirect$1, permRedirect$1 as permRedirect, permanentRedirect, serverError, temporaryRedirect, unauthorized, unprocessable } from "./response-D-XpIuMH.js";
|
|
3
|
+
|
|
4
|
+
export { badRequest, created, forbidden, permRedirect as found, methodNotAllowed, permRedirect$1 as movedPermanently, notFound, notModified, ok, permanentRedirect, response, seeOther, serverError, temporaryRedirect, transfer, unauthorized, unprocessable };
|