@adonisjs/http-server 5.12.0 → 6.0.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.
Files changed (169) hide show
  1. package/README.md +15 -38
  2. package/build/index.d.ts +16 -0
  3. package/build/index.js +16 -0
  4. package/build/src/cookies/client.d.ts +12 -0
  5. package/build/src/cookies/client.js +42 -0
  6. package/build/src/cookies/drivers/encrypted.d.ts +4 -0
  7. package/build/src/cookies/drivers/encrypted.js +16 -0
  8. package/build/src/cookies/drivers/plain.d.ts +3 -0
  9. package/build/src/cookies/drivers/plain.js +13 -0
  10. package/build/src/cookies/drivers/signed.d.ts +4 -0
  11. package/build/src/cookies/drivers/signed.js +16 -0
  12. package/build/src/cookies/parser.d.ts +9 -0
  13. package/build/src/cookies/parser.js +69 -0
  14. package/build/src/cookies/serializer.d.ts +11 -0
  15. package/build/src/cookies/serializer.js +39 -0
  16. package/build/src/debug.d.ts +3 -0
  17. package/build/src/debug.js +2 -0
  18. package/build/src/define_config.d.ts +2 -0
  19. package/build/src/define_config.js +40 -0
  20. package/build/src/define_middleware.d.ts +4 -0
  21. package/build/src/define_middleware.js +6 -0
  22. package/build/src/exceptions/abort_exception.d.ts +5 -0
  23. package/build/src/exceptions/abort_exception.js +6 -0
  24. package/build/src/exceptions/cannot_lookup_route.d.ts +5 -0
  25. package/build/src/exceptions/cannot_lookup_route.js +5 -0
  26. package/build/src/exceptions/http_exception.d.ts +6 -0
  27. package/build/src/exceptions/http_exception.js +20 -0
  28. package/build/src/exceptions/route_not_found.d.ts +5 -0
  29. package/build/src/exceptions/route_not_found.js +5 -0
  30. package/build/src/helpers.d.ts +6 -67
  31. package/build/src/helpers.js +13 -168
  32. package/build/src/http_context/local_storage.d.ts +9 -0
  33. package/build/src/http_context/local_storage.js +14 -0
  34. package/build/src/http_context/main.d.ts +20 -0
  35. package/build/src/http_context/main.js +49 -0
  36. package/build/src/middleware/store.d.ts +11 -0
  37. package/build/src/middleware/store.js +33 -0
  38. package/build/src/qs.d.ts +7 -0
  39. package/build/src/qs.js +13 -0
  40. package/build/src/redirect.d.ts +18 -0
  41. package/build/src/redirect.js +80 -0
  42. package/build/src/request.d.ts +81 -0
  43. package/build/src/request.js +315 -0
  44. package/build/src/response.d.ts +108 -0
  45. package/build/src/response.js +587 -0
  46. package/build/src/router/brisk.d.ts +18 -0
  47. package/build/src/router/brisk.js +35 -0
  48. package/build/src/router/executor.d.ts +4 -0
  49. package/build/src/router/executor.js +16 -0
  50. package/build/src/router/group.d.ts +19 -0
  51. package/build/src/router/group.js +117 -0
  52. package/build/src/router/lookup_store/main.d.ts +17 -0
  53. package/build/src/router/lookup_store/main.js +37 -0
  54. package/build/src/router/lookup_store/route_finder.d.ts +8 -0
  55. package/build/src/router/lookup_store/route_finder.js +28 -0
  56. package/build/src/router/lookup_store/url_builder.d.ts +16 -0
  57. package/build/src/router/lookup_store/url_builder.js +111 -0
  58. package/build/src/router/main.d.ts +36 -0
  59. package/build/src/router/main.js +161 -0
  60. package/build/src/router/matchers.d.ts +14 -0
  61. package/build/src/router/matchers.js +15 -0
  62. package/build/src/router/resource.d.ts +27 -0
  63. package/build/src/router/resource.js +124 -0
  64. package/build/src/router/route.d.ts +28 -0
  65. package/build/src/router/route.js +135 -0
  66. package/build/src/router/store.d.ts +12 -0
  67. package/build/src/router/store.js +87 -0
  68. package/build/src/server/factories/final_handler.d.ts +4 -0
  69. package/build/src/server/factories/final_handler.js +17 -0
  70. package/build/src/server/factories/middleware_handler.d.ts +5 -0
  71. package/build/src/server/factories/middleware_handler.js +5 -0
  72. package/build/src/server/factories/use_return_value.d.ts +2 -0
  73. package/build/src/server/factories/use_return_value.js +9 -0
  74. package/build/src/server/factories/write_response.d.ts +2 -0
  75. package/build/src/server/factories/write_response.js +12 -0
  76. package/build/src/server/main.d.ts +23 -0
  77. package/build/src/server/main.js +124 -0
  78. package/build/src/types/base.d.ts +5 -0
  79. package/build/src/types/base.js +1 -0
  80. package/build/src/types/middleware.d.ts +14 -0
  81. package/build/src/types/middleware.js +1 -0
  82. package/build/src/types/qs.d.ts +15 -0
  83. package/build/src/types/qs.js +1 -0
  84. package/build/src/types/request.d.ts +7 -0
  85. package/build/src/types/request.js +1 -0
  86. package/build/src/types/response.d.ts +18 -0
  87. package/build/src/types/response.js +1 -0
  88. package/build/src/types/route.d.ts +74 -0
  89. package/build/src/types/route.js +1 -0
  90. package/build/src/types/server.d.ts +13 -0
  91. package/build/src/types/server.js +1 -0
  92. package/package.json +88 -86
  93. package/build/adonis-typings/container.d.ts +0 -24
  94. package/build/adonis-typings/container.js +0 -8
  95. package/build/adonis-typings/context.d.ts +0 -73
  96. package/build/adonis-typings/context.js +0 -8
  97. package/build/adonis-typings/cookie-client.d.ts +0 -34
  98. package/build/adonis-typings/cookie-client.js +0 -8
  99. package/build/adonis-typings/http-server.d.ts +0 -98
  100. package/build/adonis-typings/http-server.js +0 -8
  101. package/build/adonis-typings/index.d.ts +0 -16
  102. package/build/adonis-typings/index.js +0 -16
  103. package/build/adonis-typings/middleware.d.ts +0 -95
  104. package/build/adonis-typings/middleware.js +0 -8
  105. package/build/adonis-typings/request.d.ts +0 -556
  106. package/build/adonis-typings/request.js +0 -8
  107. package/build/adonis-typings/response.d.ts +0 -440
  108. package/build/adonis-typings/response.js +0 -8
  109. package/build/adonis-typings/route.d.ts +0 -559
  110. package/build/adonis-typings/route.js +0 -8
  111. package/build/exceptions.json +0 -110
  112. package/build/providers/HttpServerProvider.d.ts +0 -46
  113. package/build/providers/HttpServerProvider.js +0 -100
  114. package/build/src/Cookie/Client/index.d.ts +0 -39
  115. package/build/src/Cookie/Client/index.js +0 -108
  116. package/build/src/Cookie/Drivers/Encrypted.d.ts +0 -24
  117. package/build/src/Cookie/Drivers/Encrypted.js +0 -42
  118. package/build/src/Cookie/Drivers/Plain.d.ts +0 -23
  119. package/build/src/Cookie/Drivers/Plain.js +0 -40
  120. package/build/src/Cookie/Drivers/Signed.d.ts +0 -24
  121. package/build/src/Cookie/Drivers/Signed.js +0 -42
  122. package/build/src/Cookie/Parser/index.d.ts +0 -61
  123. package/build/src/Cookie/Parser/index.js +0 -174
  124. package/build/src/Cookie/Serializer/index.d.ts +0 -46
  125. package/build/src/Cookie/Serializer/index.js +0 -88
  126. package/build/src/Exceptions/HttpException.d.ts +0 -20
  127. package/build/src/Exceptions/HttpException.js +0 -36
  128. package/build/src/Exceptions/RouterException.d.ts +0 -36
  129. package/build/src/Exceptions/RouterException.js +0 -76
  130. package/build/src/HttpContext/LocalStorage/index.d.ts +0 -24
  131. package/build/src/HttpContext/LocalStorage/index.js +0 -28
  132. package/build/src/HttpContext/index.d.ts +0 -90
  133. package/build/src/HttpContext/index.js +0 -181
  134. package/build/src/MiddlewareStore/index.d.ts +0 -92
  135. package/build/src/MiddlewareStore/index.js +0 -133
  136. package/build/src/Redirect/index.d.ts +0 -71
  137. package/build/src/Redirect/index.js +0 -139
  138. package/build/src/Request/index.d.ts +0 -619
  139. package/build/src/Request/index.js +0 -862
  140. package/build/src/Response/index.d.ts +0 -414
  141. package/build/src/Response/index.js +0 -1010
  142. package/build/src/Router/BriskRoute.d.ts +0 -53
  143. package/build/src/Router/BriskRoute.js +0 -74
  144. package/build/src/Router/Group.d.ts +0 -101
  145. package/build/src/Router/Group.js +0 -165
  146. package/build/src/Router/LookupStore.d.ts +0 -122
  147. package/build/src/Router/LookupStore.js +0 -264
  148. package/build/src/Router/Matchers.d.ts +0 -31
  149. package/build/src/Router/Matchers.js +0 -43
  150. package/build/src/Router/Resource.d.ts +0 -95
  151. package/build/src/Router/Resource.js +0 -182
  152. package/build/src/Router/Route.d.ts +0 -138
  153. package/build/src/Router/Route.js +0 -204
  154. package/build/src/Router/Store.d.ts +0 -93
  155. package/build/src/Router/Store.js +0 -211
  156. package/build/src/Router/index.d.ts +0 -142
  157. package/build/src/Router/index.js +0 -333
  158. package/build/src/Server/ExceptionManager/index.d.ts +0 -49
  159. package/build/src/Server/ExceptionManager/index.js +0 -96
  160. package/build/src/Server/Hooks/index.d.ts +0 -43
  161. package/build/src/Server/Hooks/index.js +0 -77
  162. package/build/src/Server/PreCompiler/index.d.ts +0 -60
  163. package/build/src/Server/PreCompiler/index.js +0 -143
  164. package/build/src/Server/RequestHandler/index.d.ts +0 -39
  165. package/build/src/Server/RequestHandler/index.js +0 -87
  166. package/build/src/Server/index.d.ts +0 -90
  167. package/build/src/Server/index.js +0 -175
  168. package/build/standalone.d.ts +0 -14
  169. package/build/standalone.js +0 -23
@@ -0,0 +1,18 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ /// <reference types="node" resolution-mode="require"/>
3
+ export type CookieOptions = {
4
+ domain: string;
5
+ expires: Date | (() => Date);
6
+ httpOnly: boolean;
7
+ maxAge: number | string;
8
+ path: string;
9
+ sameSite: boolean | 'lax' | 'none' | 'strict';
10
+ secure: boolean;
11
+ };
12
+ export type CastableHeader = string | number | boolean | string[] | number[] | boolean[];
13
+ export type ResponseConfig = {
14
+ etag: boolean;
15
+ jsonpCallbackName: string;
16
+ cookie: Partial<CookieOptions>;
17
+ };
18
+ export type ResponseStream = NodeJS.ReadStream | NodeJS.ReadWriteStream | NodeJS.ReadableStream;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,74 @@
1
+ import type Middleware from '@poppinss/middleware';
2
+ import type { ContainerResolver } from '@adonisjs/fold';
3
+ import type { HttpContext } from '../http_context/main.js';
4
+ import type { MiddlewareFn, ParsedGlobalMiddleware } from './middleware.js';
5
+ export type MatchItRouteToken = RouteMatcher & {
6
+ old: string;
7
+ type: 0 | 1 | 2 | 3;
8
+ val: string;
9
+ end: string;
10
+ };
11
+ export type RouteFn = (ctx: HttpContext) => any;
12
+ export type StoreRouteHandler = RouteFn | {
13
+ name: string;
14
+ handle: (resolver: ContainerResolver, ...args: [ctx: HttpContext, ...injections: any[]]) => any;
15
+ };
16
+ export type StoreRouteMiddleware = MiddlewareFn | ({
17
+ name?: string;
18
+ args?: any[];
19
+ } & ParsedGlobalMiddleware);
20
+ export type StoreRouteNode = {
21
+ execute: (route: StoreRouteNode, resolver: ContainerResolver, ctx: HttpContext) => any;
22
+ name?: string;
23
+ pattern: string;
24
+ handler: StoreRouteHandler;
25
+ middleware: Middleware<StoreRouteMiddleware>;
26
+ meta: Record<string, any>;
27
+ };
28
+ export type StoreMethodNode = {
29
+ tokens: MatchItRouteToken[][];
30
+ routeKeys: {
31
+ [pattern: string]: string;
32
+ };
33
+ routes: {
34
+ [pattern: string]: StoreRouteNode;
35
+ };
36
+ };
37
+ export type StoreDomainNode = {
38
+ [method: string]: StoreMethodNode;
39
+ };
40
+ export type StoreRoutesTree = {
41
+ tokens: MatchItRouteToken[][];
42
+ domains: {
43
+ [domain: string]: StoreDomainNode;
44
+ };
45
+ };
46
+ export type MatchedRoute = {
47
+ route: StoreRouteNode;
48
+ routeKey: string;
49
+ params: Record<string, any>;
50
+ subdomains: Record<string, any>;
51
+ };
52
+ export type RouteMatcher = {
53
+ match?: RegExp;
54
+ cast?: (value: string) => any;
55
+ };
56
+ export type RouteMatchers = {
57
+ [param: string]: RouteMatcher;
58
+ };
59
+ export type RouteJSON = StoreRouteNode & {
60
+ methods: string[];
61
+ domain: string;
62
+ matchers: RouteMatchers;
63
+ };
64
+ export type ResourceActionNames = 'create' | 'index' | 'store' | 'show' | 'edit' | 'update' | 'destroy';
65
+ export type MakeUrlOptions = {
66
+ qs?: Record<string, any>;
67
+ domain?: string;
68
+ prefixUrl?: string;
69
+ disableRouteLookup?: boolean;
70
+ };
71
+ export type MakeSignedUrlOptions = MakeUrlOptions & {
72
+ expiresIn?: string | number;
73
+ purpose?: string;
74
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { Constructor } from './base.js';
2
+ import type { RequestConfig } from './request.js';
3
+ import type { ResponseConfig } from './response.js';
4
+ import type { HttpContext } from '../http_context/main.js';
5
+ import { QSParserConfig } from './qs.js';
6
+ export type ServerErrorHandler = {
7
+ handle: (error: any, ctx: HttpContext) => any;
8
+ };
9
+ export type ErrorHandlerAsAClass = Constructor<ServerErrorHandler>;
10
+ export type ServerConfig = RequestConfig & ResponseConfig & {
11
+ useAsyncLocalStorage: boolean;
12
+ qs: QSParserConfig;
13
+ };
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,33 +1,34 @@
1
1
  {
2
2
  "name": "@adonisjs/http-server",
3
- "version": "5.12.0",
3
+ "version": "6.0.0-0",
4
4
  "description": "AdonisJS HTTP server with support packed with Routing and Cookies",
5
- "main": "build/providers/HttpServerProvider.js",
5
+ "main": "build/index.js",
6
+ "type": "module",
6
7
  "files": [
7
- "build/adonis-typings",
8
- "build/providers",
9
8
  "build/src",
10
- "build/exceptions.json",
11
- "build/standalone.d.ts",
12
- "build/standalone.js"
9
+ "build/index.d.ts",
10
+ "build/index.js"
13
11
  ],
12
+ "exports": {
13
+ ".": "./build/index.js",
14
+ "./types": "./build/src/types.js"
15
+ },
14
16
  "scripts": {
15
- "mrm": "mrm --preset=@adonisjs/mrm-preset",
16
17
  "pretest": "npm run lint",
17
- "test": "node -r ts-node/register/transpile-only bin/test.ts",
18
+ "test": "cross-env NODE_DEBUG=adonisjs:http c8 npm run vscode:test",
18
19
  "clean": "del-cli build",
19
20
  "compile": "npm run lint && npm run clean && tsc",
20
21
  "build": "npm run compile",
21
- "benchmark": "ENV_SILENT=true node build/benchmarks/index.js",
22
- "build:tmp": "npm run compile",
23
- "commit": "git-cz",
24
- "release": "np --message=\"chore(release): %s\"",
22
+ "prebenchmark": "npm run build",
23
+ "benchmark": "node --experimental-import-meta-resolve build/benchmarks/index.js",
24
+ "release": "np",
25
25
  "version": "npm run build",
26
+ "format": "prettier --write .",
26
27
  "prepublishOnly": "npm run build",
27
28
  "lint": "eslint . --ext=.ts",
28
- "format": "prettier --write .",
29
- "sync-labels": "github-label-sync --labels ./node_modules/@adonisjs/mrm-preset/gh-labels.json adonisjs/http-server",
30
- "prepare": "husky install"
29
+ "sync-labels": "github-label-sync --labels .github/labels.json adonisjs/http-server",
30
+ "test:watch": "node --watch --loader=ts-node/esm --experimental-import-meta-resolve bin/test.ts",
31
+ "vscode:test": "node --loader=ts-node/esm --experimental-import-meta-resolve bin/test.ts"
31
32
  },
32
33
  "keywords": [
33
34
  "http",
@@ -36,92 +37,86 @@
36
37
  "author": "virk,adonisjs",
37
38
  "license": "MIT",
38
39
  "devDependencies": {
39
- "@adonisjs/application": "^5.2.5",
40
- "@adonisjs/encryption": "^4.0.8",
41
- "@adonisjs/mrm-preset": "^5.0.3",
42
- "@adonisjs/require-ts": "^2.0.13",
40
+ "@adonisjs/application": "^6.1.2-0",
41
+ "@adonisjs/config": "^4.1.1-0",
42
+ "@adonisjs/encryption": "^5.0.1-0",
43
+ "@adonisjs/env": "^4.0.3-0",
44
+ "@adonisjs/fold": "^9.4.1-0",
45
+ "@adonisjs/logger": "^5.0.2-0",
46
+ "@commitlint/cli": "^17.3.0",
47
+ "@commitlint/config-conventional": "^17.3.0",
48
+ "@fastify/middie": "^8.0.0",
49
+ "@japa/api-client": "^1.4.2",
43
50
  "@japa/assert": "^1.3.6",
51
+ "@japa/expect-type": "^1.0.2",
44
52
  "@japa/run-failed-tests": "^1.1.0",
45
53
  "@japa/runner": "^2.2.2",
46
54
  "@japa/spec-reporter": "^1.3.2",
47
- "@poppinss/dev-utils": "^2.0.3",
55
+ "@swc/core": "^1.3.21",
56
+ "@types/accepts": "^1.3.5",
57
+ "@types/content-disposition": "^0.5.5",
48
58
  "@types/cookie": "^0.5.1",
49
- "@types/ms": "^0.7.31",
50
- "@types/node": "^18.11.0",
51
- "@types/pluralize": "0.0.29",
59
+ "@types/destroy": "^1.0.0",
60
+ "@types/encodeurl": "^1.0.0",
61
+ "@types/etag": "^1.8.1",
62
+ "@types/fresh": "^0.5.0",
63
+ "@types/fs-extra": "^9.0.13",
64
+ "@types/http-status-codes": "^1.2.0",
65
+ "@types/mime-types": "^2.1.1",
66
+ "@types/on-finished": "^2.3.1",
67
+ "@types/pem": "^1.9.6",
52
68
  "@types/proxy-addr": "^2.0.0",
53
69
  "@types/qs": "^6.9.7",
54
70
  "@types/supertest": "^2.0.12",
71
+ "@types/type-is": "^1.6.3",
72
+ "@types/vary": "^1.1.0",
55
73
  "autocannon": "^7.10.0",
56
- "commitizen": "^4.2.5",
74
+ "c8": "^7.12.0",
57
75
  "cross-env": "^7.0.3",
58
- "cz-conventional-changelog": "^3.3.0",
59
76
  "del-cli": "^5.0.0",
60
- "eslint": "^8.25.0",
77
+ "eslint": "^8.28.0",
61
78
  "eslint-config-prettier": "^8.5.0",
62
- "eslint-plugin-adonis": "^2.1.1",
79
+ "eslint-plugin-adonis": "^3.0.3",
63
80
  "eslint-plugin-prettier": "^4.2.1",
64
- "fastify": "^4.9.0",
81
+ "fastify": "^4.10.2",
82
+ "fs-extra": "^11.1.0",
65
83
  "github-label-sync": "^2.2.0",
66
84
  "http-status-codes": "^2.2.0",
67
- "husky": "^8.0.1",
68
- "middie": "^7.1.0",
69
- "mrm": "^4.1.7",
85
+ "husky": "^8.0.2",
70
86
  "np": "^7.6.2",
71
87
  "pem": "^1.14.6",
72
- "prettier": "^2.7.1",
88
+ "prettier": "^2.8.0",
73
89
  "reflect-metadata": "^0.1.13",
74
- "supertest": "^6.3.0",
90
+ "supertest": "^6.3.1",
75
91
  "ts-node": "^10.9.1",
76
- "typescript": "^4.8.4"
77
- },
78
- "peerDependencies": {
79
- "@adonisjs/application": "^5.0.0",
80
- "@adonisjs/encryption": "^4.0.0"
81
- },
82
- "nyc": {
83
- "exclude": [
84
- "test"
85
- ],
86
- "extension": [
87
- ".ts"
88
- ]
89
- },
90
- "config": {
91
- "commitizen": {
92
- "path": "cz-conventional-changelog"
93
- }
94
- },
95
- "np": {
96
- "contents": ".",
97
- "anyBranch": false
92
+ "typescript": "^4.9.3"
98
93
  },
99
94
  "dependencies": {
95
+ "@poppinss/macroable": "^1.0.0-0",
100
96
  "@poppinss/matchit": "^3.1.2",
101
- "@poppinss/utils": "^5.0.0",
97
+ "@poppinss/middleware": "^3.0.0",
98
+ "@poppinss/utils": "^6.1.0-0",
99
+ "@sindresorhus/is": "^5.3.0",
102
100
  "accepts": "^1.3.8",
103
- "co-compose": "^7.0.2",
104
101
  "content-disposition": "^0.5.4",
105
102
  "cookie": "^0.5.0",
103
+ "cuid": "^2.1.8",
106
104
  "destroy": "^1.2.0",
107
105
  "encodeurl": "^1.0.2",
108
106
  "etag": "^1.8.1",
109
107
  "fresh": "^0.5.2",
110
- "haye": "^3.0.0",
111
- "macroable": "^7.0.2",
112
108
  "mime-types": "^2.1.35",
113
- "ms": "^2.1.3",
114
109
  "on-finished": "^2.4.1",
115
- "pluralize": "^8.0.0",
116
110
  "proxy-addr": "^2.0.7",
117
111
  "qs": "^6.11.0",
118
112
  "tmp-cache": "^1.1.0",
119
113
  "type-is": "^1.6.18",
120
114
  "vary": "^1.1.2"
121
115
  },
122
- "directories": {
123
- "doc": "docs",
124
- "test": "test"
116
+ "peerDependencies": {
117
+ "@adonisjs/application": "^6.1.2-0",
118
+ "@adonisjs/encryption": "^5.0.1-0",
119
+ "@adonisjs/fold": "^9.4.1-0"
125
120
  },
126
121
  "repository": {
127
122
  "type": "git",
@@ -131,26 +126,6 @@
131
126
  "url": "https://github.com/adonisjs/http-server/issues"
132
127
  },
133
128
  "homepage": "https://github.com/adonisjs/http-server#readme",
134
- "adonisjs": {
135
- "exceptions": "./build/exceptions.json"
136
- },
137
- "publishConfig": {
138
- "access": "public",
139
- "tag": "latest"
140
- },
141
- "mrmConfig": {
142
- "core": true,
143
- "license": "MIT",
144
- "services": [
145
- "github-actions"
146
- ],
147
- "minNodeVersion": "14.15.4",
148
- "probotApps": [
149
- "stale",
150
- "lock"
151
- ],
152
- "runGhActionsOnWindows": false
153
- },
154
129
  "eslintConfig": {
155
130
  "extends": [
156
131
  "plugin:adonis/typescriptPackage",
@@ -169,7 +144,8 @@
169
144
  }
170
145
  },
171
146
  "eslintIgnore": [
172
- "build"
147
+ "build",
148
+ "backup"
173
149
  ],
174
150
  "prettier": {
175
151
  "trailingComma": "es5",
@@ -180,5 +156,31 @@
180
156
  "bracketSpacing": true,
181
157
  "arrowParens": "always",
182
158
  "printWidth": 100
159
+ },
160
+ "commitlint": {
161
+ "extends": [
162
+ "@commitlint/config-conventional"
163
+ ]
164
+ },
165
+ "publishConfig": {
166
+ "access": "public",
167
+ "tag": "next"
168
+ },
169
+ "np": {
170
+ "message": "chore(release): %s",
171
+ "tag": "next",
172
+ "branch": "main",
173
+ "anyBranch": false
174
+ },
175
+ "c8": {
176
+ "reporter": [
177
+ "text",
178
+ "html"
179
+ ],
180
+ "exclude": [
181
+ "tests/**",
182
+ "test_factories/**",
183
+ ".yalc/**"
184
+ ]
183
185
  }
184
186
  }
@@ -1,24 +0,0 @@
1
- /**
2
- * @adonisjs/http-server
3
- *
4
- * (c) Harminder Virk <virk@adonisjs.com>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- declare module '@ioc:Adonis/Core/Application' {
10
- import { RouterContract } from '@ioc:Adonis/Core/Route';
11
- import { ServerContract } from '@ioc:Adonis/Core/Server';
12
- import { CookieClientContract } from '@ioc:Adonis/Core/CookieClient';
13
- import { RequestConstructorContract } from '@ioc:Adonis/Core/Request';
14
- import { ResponseConstructorContract } from '@ioc:Adonis/Core/Response';
15
- import { HttpContextConstructorContract } from '@ioc:Adonis/Core/HttpContext';
16
- interface ContainerBindings {
17
- 'Adonis/Core/Route': RouterContract;
18
- 'Adonis/Core/Server': ServerContract;
19
- 'Adonis/Core/CookieClient': CookieClientContract;
20
- 'Adonis/Core/Request': RequestConstructorContract;
21
- 'Adonis/Core/Response': ResponseConstructorContract;
22
- 'Adonis/Core/HttpContext': HttpContextConstructorContract;
23
- }
24
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * @adonisjs/http-server
3
- *
4
- * (c) Harminder Virk <virk@adonisjs.com>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
@@ -1,73 +0,0 @@
1
- /**
2
- * @adonisjs/http-server
3
- *
4
- * (c) Harminder Virk <virk@adonisjs.com>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- /// <reference types="@adonisjs/logger/build/adonis-typings/logger" />
10
- /// <reference types="@adonisjs/profiler/build/adonis-typings/profiler" />
11
- /// <reference types="node" />
12
- declare module '@ioc:Adonis/Core/HttpContext' {
13
- import { RouteNode } from '@ioc:Adonis/Core/Route';
14
- import { IncomingMessage, ServerResponse } from 'http';
15
- import { MacroableConstructorContract } from 'macroable';
16
- import { LoggerContract } from '@ioc:Adonis/Core/Logger';
17
- import { RequestContract } from '@ioc:Adonis/Core/Request';
18
- import { ResponseContract } from '@ioc:Adonis/Core/Response';
19
- import { ProfilerRowContract } from '@ioc:Adonis/Core/Profiler';
20
- import { ApplicationContract } from '@ioc:Adonis/Core/Application';
21
- /**
22
- * Http request context passed to all middleware
23
- * and route handler
24
- */
25
- export interface HttpContextContract {
26
- /**
27
- * A helper to see top level properties on the context object
28
- */
29
- inspect(): any;
30
- request: RequestContract;
31
- response: ResponseContract;
32
- logger: LoggerContract;
33
- profiler: ProfilerRowContract;
34
- route?: RouteNode & {
35
- params: string[];
36
- };
37
- routeKey: string;
38
- params: Record<string, any>;
39
- subdomains: Record<string, any>;
40
- }
41
- /**
42
- * Shape of the constructor. We export the constructor and not
43
- * the context instance, since that is passed to the HTTP
44
- * lifecycle
45
- */
46
- export interface HttpContextConstructorContract extends MacroableConstructorContract<HttpContextContract> {
47
- app?: ApplicationContract;
48
- /**
49
- * Find if ALS is enabled inside the config/app.ts file
50
- */
51
- readonly usingAsyncLocalStorage: boolean;
52
- /**
53
- * Returns the current HTTP context or null if there is none.
54
- */
55
- get(): HttpContextContract | null;
56
- /**
57
- * Returns the current HTTP context or throws if there is none.
58
- */
59
- getOrFail(): HttpContextContract;
60
- /**
61
- * Run a method that doesn't have access to HTTP context from
62
- * the async local storage.
63
- */
64
- runOutsideContext<T>(callback: (...args: any[]) => T, ...args: any[]): T;
65
- /**
66
- * Creates a new fake context instance for a given route.
67
- */
68
- create(routePattern: string, routeParams: Record<string, any>, req?: IncomingMessage, res?: ServerResponse): HttpContextContract;
69
- new (request: RequestContract, response: ResponseContract, logger: LoggerContract, profiler: ProfilerRowContract): HttpContextContract;
70
- }
71
- const HttpContext: HttpContextConstructorContract;
72
- export default HttpContext;
73
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * @adonisjs/http-server
3
- *
4
- * (c) Harminder Virk <virk@adonisjs.com>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
@@ -1,34 +0,0 @@
1
- declare module '@ioc:Adonis/Core/CookieClient' {
2
- export interface CookieClientContract {
3
- /**
4
- * Encrypt a key value pair to be sent in the cookie header
5
- */
6
- encrypt(key: string, value: any): string | null;
7
- /**
8
- * Sign a key value pair to be sent in the cookie header
9
- */
10
- sign(key: string, value: any): string | null;
11
- /**
12
- * Encode a key value pair to be sent in the cookie header
13
- */
14
- encode(key: string, value: any): string | null;
15
- /**
16
- * Parse the set-cookie header
17
- */
18
- parse(key: string, value: string): any | null;
19
- /**
20
- * Unsign a signed cookie value
21
- */
22
- unsign(key: string, value: string): any | null;
23
- /**
24
- * Decrypt an encrypted cookie value
25
- */
26
- decrypt(key: string, value: string): any | null;
27
- /**
28
- * Decode an encoded cookie value
29
- */
30
- decode(key: string, value: string): any | null;
31
- }
32
- const CookieClient: CookieClientContract;
33
- export default CookieClient;
34
- }
@@ -1,8 +0,0 @@
1
- /*
2
- * @adonisjs/http-server
3
- *
4
- * (c) Harminder Virk <virk@adonisjs.com>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
@@ -1,98 +0,0 @@
1
- /**
2
- * @adonisjs/http-server
3
- *
4
- * (c) Harminder Virk <virk@adonisjs.com>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- /// <reference types="node" />
10
- /// <reference types="node" />
11
- declare module '@ioc:Adonis/Core/Server' {
12
- import { Server as HttpsServer } from 'https';
13
- import { RouterContract } from '@ioc:Adonis/Core/Route';
14
- import { RequestConfig } from '@ioc:Adonis/Core/Request';
15
- import { ResponseConfig } from '@ioc:Adonis/Core/Response';
16
- import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
17
- import { MiddlewareStoreContract } from '@ioc:Adonis/Core/Middleware';
18
- import { IncomingMessage, ServerResponse, Server as HttpServer } from 'http';
19
- /**
20
- * Before hooks are executed before finding the route or finding
21
- * middleware
22
- */
23
- export type HookHandler = (ctx: HttpContextContract) => Promise<void>;
24
- /**
25
- * Error handler node
26
- */
27
- export type ErrorHandler = string | ((error: any, ctx: HttpContextContract) => Promise<any>);
28
- /**
29
- * Shape of resolved error handler node
30
- */
31
- export type ResolvedErrorHandler = {
32
- type: 'function';
33
- value: Exclude<ErrorHandler, string>;
34
- } | {
35
- type: 'alias' | 'binding';
36
- namespace: string;
37
- method: string;
38
- };
39
- /**
40
- * Shape of the public methods for the hooks contract. By `public`
41
- * the one we want to expose to the end user
42
- */
43
- export interface HooksContract {
44
- /**
45
- * Register before hook
46
- */
47
- before(cb: HookHandler): this;
48
- /**
49
- * Register after hook
50
- */
51
- after(cb: HookHandler): this;
52
- }
53
- /**
54
- * HTTP server
55
- */
56
- export interface ServerContract {
57
- /**
58
- * The server itself doesn't create the http server instance. However, the consumer
59
- * of this class can create one and set the instance for further reference. This
60
- * is what ignitor does.
61
- */
62
- instance?: HttpServer | HttpsServer;
63
- /**
64
- * The route to register routes
65
- */
66
- router: RouterContract;
67
- /**
68
- * Server before/after hooks
69
- */
70
- hooks: HooksContract;
71
- /**
72
- * The middleware store to register global and named middleware
73
- */
74
- middleware: MiddlewareStoreContract;
75
- /**
76
- * Define custom error handler to handler all errors
77
- * occurred during HTTP request
78
- */
79
- errorHandler(handler: ErrorHandler): this;
80
- /**
81
- * Handles a given HTTP request. This method can be attached to any HTTP
82
- * server
83
- */
84
- handle(req: IncomingMessage, res: ServerResponse): Promise<void>;
85
- /**
86
- * Optimizes internal handlers, based upon the existence of
87
- * before handlers and global middleware. This helps in
88
- * increasing throughput by 10%
89
- */
90
- optimize(): void;
91
- }
92
- /**
93
- * Config requried by request and response
94
- */
95
- export type ServerConfig = RequestConfig & ResponseConfig;
96
- const Server: ServerContract;
97
- export default Server;
98
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * @adonisjs/http-server
3
- *
4
- * (c) Harminder Virk <virk@adonisjs.com>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
@@ -1,16 +0,0 @@
1
- /**
2
- * @adonisjs/http-server
3
- *
4
- * (c) Harminder Virk <virk@adonisjs.com>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- /// <reference path="container.d.ts" />
10
- /// <reference path="context.d.ts" />
11
- /// <reference path="http-server.d.ts" />
12
- /// <reference path="middleware.d.ts" />
13
- /// <reference path="request.d.ts" />
14
- /// <reference path="response.d.ts" />
15
- /// <reference path="route.d.ts" />
16
- /// <reference path="cookie-client.d.ts" />