typed-http-headers 1.0.7 → 1.0.9
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 +41 -0
- package/README.md +45 -3
- package/index.d.ts +31 -3
- package/index.js +7 -1
- package/index.js.map +1 -1
- package/lib/request/standard.d.ts +9 -0
- package/lib/request/standard.js +9 -0
- package/lib/request/standard.js.map +1 -1
- package/lib/response/standard.d.ts +7 -1
- package/lib/response/standard.js +7 -1
- package/lib/response/standard.js.map +1 -1
- package/package.json +18 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,47 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.9](https://github.com/bluelovers/ws-ts-type/compare/typed-http-headers@1.0.8...typed-http-headers@1.0.9) (2026-03-07)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### 📚 Documentation
|
|
11
|
+
|
|
12
|
+
* enhance documentation and JSDoc comments across multiple packages ([88ee99b](https://github.com/bluelovers/ws-ts-type/commit/88ee99b3a489645ca53093357cc3523dbe7996e0))
|
|
13
|
+
* **ts-type:** add bilingual JSDoc comments to helper types and test files ([5893036](https://github.com/bluelovers/ws-ts-type/commit/58930369f50f454595241e5573bdcc03dea4654b))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### 🛠 Build System
|
|
17
|
+
|
|
18
|
+
* 更新多個套件的 test 指令為 jest ([61ea53b](https://github.com/bluelovers/ws-ts-type/commit/61ea53bf15fc3ed0e216793200604ae5a52079c9))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### ♻️ Chores
|
|
22
|
+
|
|
23
|
+
* migrate from yarn to pnpm and enhance test infrastructure ([8a5daa2](https://github.com/bluelovers/ws-ts-type/commit/8a5daa2f2022eaf025c3349d4fe5dc8971f8c077))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## [1.0.8](https://github.com/bluelovers/ws-ts-type/compare/typed-http-headers@1.0.7...typed-http-headers@1.0.8) (2022-10-10)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### 🛠 Build System
|
|
32
|
+
|
|
33
|
+
* update typescript ([eb59d89](https://github.com/bluelovers/ws-ts-type/commit/eb59d897c2888c7a45406ffcad4b9033608b0b66))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### 📌 Dependencies
|
|
37
|
+
|
|
38
|
+
* update deps ([ab5f3e4](https://github.com/bluelovers/ws-ts-type/commit/ab5f3e48da1f10ddd4445ba6dda9a0a68c5f656f))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### 🔖 Miscellaneous
|
|
42
|
+
|
|
43
|
+
* . ([9219017](https://github.com/bluelovers/ws-ts-type/commit/92190178fcf30f881c1d0d36fb141a3394ab3b38))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
6
47
|
## [1.0.7](https://github.com/bluelovers/ws-ts-type/compare/typed-http-headers@1.0.6...typed-http-headers@1.0.7) (2020-06-01)
|
|
7
48
|
|
|
8
49
|
**Note:** Version bump only for package typed-http-headers
|
package/README.md
CHANGED
|
@@ -1,7 +1,49 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ts-http-header
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
標準 HTTP 請求與回應標頭的 TypeScript 類型定義
|
|
4
4
|
|
|
5
|
+
TypeScript type definitions for standard HTTP request and response headers
|
|
6
|
+
|
|
7
|
+
## 功能特點 / Features
|
|
8
|
+
|
|
9
|
+
- 完整的 HTTP 請求標頭類型定義
|
|
10
|
+
- Complete HTTP request header type definitions
|
|
11
|
+
- 完整的 HTTP 回應標頭類型定義
|
|
12
|
+
- Complete HTTP response header type definitions
|
|
13
|
+
- 參考 RFC 7231 標準
|
|
14
|
+
- Reference RFC 7231 standard
|
|
15
|
+
- 支援標準與非標準標頭
|
|
16
|
+
- Support standard and non-standard headers
|
|
17
|
+
|
|
18
|
+
## 安裝 / Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
yarn add ts-http-header
|
|
22
|
+
yarn-tool add ts-http-header
|
|
23
|
+
yt add ts-http-header
|
|
5
24
|
```
|
|
6
|
-
|
|
25
|
+
|
|
26
|
+
## 使用範例 / Usage Example
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { IRequestHeaders, IResponseHeaders, IHeaders } from 'ts-http-header';
|
|
30
|
+
|
|
31
|
+
// 使用請求標頭類型
|
|
32
|
+
const requestHeaders: IRequestHeaders = {
|
|
33
|
+
'Content-Type': 'application/json',
|
|
34
|
+
'Authorization': 'Bearer token123',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// 使用回應標頭類型
|
|
38
|
+
const responseHeaders: IResponseHeaders = {
|
|
39
|
+
'Content-Type': 'application/json',
|
|
40
|
+
'Content-Length': '1024',
|
|
41
|
+
'Cache-Control': 'max-age=3600',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// 合併標頭類型
|
|
45
|
+
const allHeaders: IHeaders = {
|
|
46
|
+
...requestHeaders,
|
|
47
|
+
...responseHeaders,
|
|
48
|
+
};
|
|
7
49
|
```
|
package/index.d.ts
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* HTTP 請求與回應標頭類型定義
|
|
3
|
+
* HTTP Request and Response Header type definitions
|
|
4
|
+
*
|
|
5
|
+
* 包含標準 HTTP 請求和回應標頭的類型定義
|
|
6
|
+
* Contains type definitions for standard HTTP request and response headers
|
|
7
|
+
*
|
|
8
|
+
* @package
|
|
3
9
|
*/
|
|
4
10
|
import IRequestHeaders from './lib/request';
|
|
5
11
|
import IResponseHeaders from './lib/response';
|
|
6
12
|
import { ITSPartialRecord } from 'ts-type';
|
|
13
|
+
/**
|
|
14
|
+
* 請求標頭介面
|
|
15
|
+
* Request headers interface
|
|
16
|
+
*/
|
|
7
17
|
export { IRequestHeaders, IResponseHeaders };
|
|
8
|
-
|
|
18
|
+
/**
|
|
19
|
+
* HTTP 標頭值類型
|
|
20
|
+
* HTTP header value types
|
|
21
|
+
*
|
|
22
|
+
* 支援字串、數字、布林值或字串陣列
|
|
23
|
+
* Supports string, number, boolean, or string array
|
|
24
|
+
*/
|
|
25
|
+
export type IHttpHeaderValues = string | number | boolean | string[];
|
|
26
|
+
/**
|
|
27
|
+
* 合併請求與回應標頭的完整標頭介面
|
|
28
|
+
* Combined request and response headers interface
|
|
29
|
+
*/
|
|
9
30
|
export interface IHeaders extends IRequestHeaders, IResponseHeaders {
|
|
10
31
|
}
|
|
11
|
-
|
|
32
|
+
/**
|
|
33
|
+
* 載入的標頭類型(可選鍵值)
|
|
34
|
+
* Loaded headers type (optional key-value)
|
|
35
|
+
*
|
|
36
|
+
* @typeParam T - 標頭鍵名類型 / Header key type
|
|
37
|
+
* @typeParam V - 標頭值類型 / Header value type
|
|
38
|
+
*/
|
|
39
|
+
export type ILazyHeaders<T extends string = string, V = IHttpHeaderValues> = ITSPartialRecord<T, V>;
|
|
12
40
|
export default IHeaders;
|
package/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* HTTP 請求與回應標頭類型定義
|
|
4
|
+
* HTTP Request and Response Header type definitions
|
|
5
|
+
*
|
|
6
|
+
* 包含標準 HTTP 請求和回應標頭的類型定義
|
|
7
|
+
* Contains type definitions for standard HTTP request and response headers
|
|
8
|
+
*
|
|
9
|
+
* @package
|
|
4
10
|
*/
|
|
5
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
12
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * HTTP 請求與回應標頭類型定義\n * HTTP Request and Response Header type definitions\n *\n * 包含標準 HTTP 請求和回應標頭的類型定義\n * Contains type definitions for standard HTTP request and response headers\n *\n * @package\n */\n\nimport IRequestHeaders from './lib/request';\nimport IResponseHeaders from './lib/response';\nimport { ITSPartialRecord } from 'ts-type';\n\n/**\n * 請求標頭介面\n * Request headers interface\n */\nexport { IRequestHeaders, IResponseHeaders };\n\n/**\n * HTTP 標頭值類型\n * HTTP header value types\n *\n * 支援字串、數字、布林值或字串陣列\n * Supports string, number, boolean, or string array\n */\nexport type IHttpHeaderValues = string | number | boolean | string[];\n\n/**\n * 合併請求與回應標頭的完整標頭介面\n * Combined request and response headers interface\n */\nexport interface IHeaders extends IRequestHeaders, IResponseHeaders\n{\n\n}\n\n/**\n * 載入的標頭類型(可選鍵值)\n * Loaded headers type (optional key-value)\n *\n * @typeParam T - 標頭鍵名類型 / Header key type\n * @typeParam V - 標頭值類型 / Header value type\n */\nexport type ILazyHeaders<T extends string = string, V = IHttpHeaderValues> = ITSPartialRecord<T, V>;\n\nexport default IHeaders;\n"]}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 標準 HTTP 請求標頭欄位定義
|
|
3
|
+
* Standard HTTP Request Header Fields Definition
|
|
4
|
+
*
|
|
5
|
+
* 參考 RFC 7231 定義的 HTTP 請求標頭
|
|
6
|
+
* Reference RFC 7231 for HTTP request header definitions
|
|
7
|
+
*
|
|
8
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
|
|
9
|
+
*/
|
|
1
10
|
export interface IStandardRequestFields {
|
|
2
11
|
'A-IM'?: string;
|
|
3
12
|
'Accept'?: string;
|
package/lib/request/standard.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 標準 HTTP 請求標頭欄位定義
|
|
4
|
+
* Standard HTTP Request Header Fields Definition
|
|
5
|
+
*
|
|
6
|
+
* 參考 RFC 7231 定義的 HTTP 請求標頭
|
|
7
|
+
* Reference RFC 7231 for HTTP request header definitions
|
|
8
|
+
*
|
|
9
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
|
|
10
|
+
*/
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
//# sourceMappingURL=standard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard.js","sourceRoot":"","sources":["standard.ts"],"names":[],"mappings":"","sourcesContent":["\n\nexport interface IStandardRequestFields\n{\n\t'A-IM'?: string,\n\t'Accept'?: string,\n\t'Accept-Charset'?: string,\n\t'Accept-Encoding'?: string,\n\t'Accept-Language'?: string,\n\t'Accept-Datetime'?: string,\n\t'Access-Control-Request-Method'?: string,\n\t'Access-Control-Request-Headers'?: string,\n\t'Authorization'?: string,\n\t'Cache-Control'?: string,\n\t'Connection'?: string,\n\t'Content-Length'?: string,\n\t'Content-MD5'?: string,\n\t'Content-Type'?: string,\n\t'Cookie'?: string,\n\t'Date'?: string,\n\t'Expect'?: string,\n\t'Forwarded'?: string,\n\t'From'?: string,\n\t'Host'?: string,\n\t'HTTP2-Settings'?: string,\n\t'If-Match'?: string,\n\t'If-Modified-Since'?: string,\n\t'If-None-Match'?: string,\n\t'If-Range'?: string,\n\t'If-Unmodified-Since'?: string,\n\t'Max-Forwards'?: string,\n\t'Origin'?: string,\n\t'Pragma'?: string,\n\t'Proxy-Authorization'?: string,\n\t'Range'?: string,\n\t'Referer'?: string,\n\t'TE'?: string,\n\t'User-Agent'?: string,\n\t'Upgrade'?: string,\n\t'Via'?: string,\n\t'Warning'?: string,\n}\n\nexport default IStandardRequestFields;\n"]}
|
|
1
|
+
{"version":3,"file":"standard.js","sourceRoot":"","sources":["standard.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * 標準 HTTP 請求標頭欄位定義\n * Standard HTTP Request Header Fields Definition\n *\n * 參考 RFC 7231 定義的 HTTP 請求標頭\n * Reference RFC 7231 for HTTP request header definitions\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers\n */\n\nexport interface IStandardRequestFields\n{\n\t'A-IM'?: string,\n\t'Accept'?: string,\n\t'Accept-Charset'?: string,\n\t'Accept-Encoding'?: string,\n\t'Accept-Language'?: string,\n\t'Accept-Datetime'?: string,\n\t'Access-Control-Request-Method'?: string,\n\t'Access-Control-Request-Headers'?: string,\n\t'Authorization'?: string,\n\t'Cache-Control'?: string,\n\t'Connection'?: string,\n\t'Content-Length'?: string,\n\t'Content-MD5'?: string,\n\t'Content-Type'?: string,\n\t'Cookie'?: string,\n\t'Date'?: string,\n\t'Expect'?: string,\n\t'Forwarded'?: string,\n\t'From'?: string,\n\t'Host'?: string,\n\t'HTTP2-Settings'?: string,\n\t'If-Match'?: string,\n\t'If-Modified-Since'?: string,\n\t'If-None-Match'?: string,\n\t'If-Range'?: string,\n\t'If-Unmodified-Since'?: string,\n\t'Max-Forwards'?: string,\n\t'Origin'?: string,\n\t'Pragma'?: string,\n\t'Proxy-Authorization'?: string,\n\t'Range'?: string,\n\t'Referer'?: string,\n\t'TE'?: string,\n\t'User-Agent'?: string,\n\t'Upgrade'?: string,\n\t'Via'?: string,\n\t'Warning'?: string,\n}\n\nexport default IStandardRequestFields;\n"]}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 標準 HTTP 回應標頭欄位定義
|
|
3
|
+
* Standard HTTP Response Header Fields Definition
|
|
4
|
+
*
|
|
5
|
+
* 參考 RFC 7231 定義的 HTTP 回應標頭
|
|
6
|
+
* Reference RFC 7231 for HTTP response header definitions
|
|
7
|
+
*
|
|
8
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
|
|
3
9
|
*/
|
|
4
10
|
export interface IStandardResponseFields {
|
|
5
11
|
'Access-Control-Allow-Origin'?: string;
|
package/lib/response/standard.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* 標準 HTTP 回應標頭欄位定義
|
|
4
|
+
* Standard HTTP Response Header Fields Definition
|
|
5
|
+
*
|
|
6
|
+
* 參考 RFC 7231 定義的 HTTP 回應標頭
|
|
7
|
+
* Reference RFC 7231 for HTTP response header definitions
|
|
8
|
+
*
|
|
9
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
|
|
4
10
|
*/
|
|
5
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
12
|
//# sourceMappingURL=standard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard.js","sourceRoot":"","sources":["standard.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"standard.js","sourceRoot":"","sources":["standard.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * 標準 HTTP 回應標頭欄位定義\n * Standard HTTP Response Header Fields Definition\n *\n * 參考 RFC 7231 定義的 HTTP 回應標頭\n * Reference RFC 7231 for HTTP response header definitions\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers\n */\n\nexport interface IStandardResponseFields\n{\n\t'Access-Control-Allow-Origin'?: string,\n\t'Access-Control-Allow-Credentials'?: string,\n\t'Access-Control-Expose-Headers'?: string,\n\t'Access-Control-Max-Age'?: string,\n\t'Access-Control-Allow-Methods'?: string,\n\t'Access-Control-Allow-Headers'?: string,\n\t'Accept-Patch'?: string,\n\t'Accept-Ranges'?: string,\n\t'Age'?: string,\n\t'Allow'?: string,\n\t'Alt-Svc'?: string,\n\t'Cache-Control'?: string,\n\t'Connection'?: string,\n\t'Content-Disposition'?: string,\n\t'Content-Encoding'?: string,\n\t'Content-Language'?: string,\n\t'Content-Length'?: string,\n\t'Content-Location'?: string,\n\t'Content-MD5'?: string,\n\t'Content-Range'?: string,\n\t'Content-Type'?: string,\n\t'Date'?: string,\n\t'Delta-Base'?: string,\n\t'ETag'?: string,\n\t'Expires'?: string,\n\t'IM'?: string,\n\t'Last-Modified'?: string,\n\t'Link'?: string,\n\t'Location'?: string,\n\t'P3P'?: string,\n\t'Pragma'?: string,\n\t'Proxy-Authenticate'?: string,\n\t'Public-Key-Pins'?: string,\n\t'Retry-After'?: string,\n\t'Server'?: string,\n\t'Set-Cookie'?: string,\n\t'Strict-Transport-Security'?: string,\n\t'Trailer'?: string,\n\t'Transfer-Encoding'?: string,\n\t'Tk'?: string,\n\t'Upgrade'?: string,\n\t'Vary'?: string,\n\t'Via'?: string,\n\t'Warning'?: string,\n\t'WWW-Authenticate'?: string,\n\t'X-Frame-Options'?: string,\n}\n\nexport default IStandardResponseFields;\n"]}
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typed-http-headers",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"homepage": "https://github.com/bluelovers/ws-ts-type#readme",
|
|
3
|
+
"version": "1.0.9",
|
|
4
|
+
"description": "標準 HTTP 請求與回應標頭的 TypeScript 類型定義 | TypeScript type definitions for standard HTTP request and response headers",
|
|
5
|
+
"homepage": "https://github.com/bluelovers/ws-ts-type/tree/master/packages/ts-http-header#readme",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/bluelovers/ws-ts-type/issues"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/bluelovers/ws-ts-type.git"
|
|
11
|
+
"url": "git+https://github.com/bluelovers/ws-ts-type.git",
|
|
12
|
+
"directory": "packages/ts-http-header"
|
|
12
13
|
},
|
|
13
14
|
"license": "ISC",
|
|
14
15
|
"author": "",
|
|
@@ -16,11 +17,21 @@
|
|
|
16
17
|
"scripts": {
|
|
17
18
|
"coverage": "npx nyc npm run test",
|
|
18
19
|
"lint": "npx eslint **/*.ts",
|
|
19
|
-
"test": "
|
|
20
|
+
"test": "jest --passWithNoTests",
|
|
21
|
+
"test:jest": "jest --passWithNoTests",
|
|
22
|
+
"test:jest:coverage": "node --run test:jest -- --coverage",
|
|
23
|
+
"test:jest:snapshot": "yarn run test:jest -- -u",
|
|
24
|
+
"test:snapshot": "yarn run test -- -u",
|
|
25
|
+
"test:tsd": "ynpx tsd",
|
|
26
|
+
"preversion": "yarn run test",
|
|
20
27
|
"prepublishOnly": "npm run ncu && npm run sort-package-json",
|
|
21
28
|
"postpublish_": "git commit -m \"publish new version\" .",
|
|
22
29
|
"ncu": "npx yarn-tool ncu -u",
|
|
23
|
-
"sort-package-json": "npx yarn-tool sort"
|
|
30
|
+
"sort-package-json": "npx yarn-tool sort",
|
|
31
|
+
"tsc:showConfig": "ynpx get-current-tsconfig -p"
|
|
24
32
|
},
|
|
25
|
-
"
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"ts-type": "^3.0.2"
|
|
35
|
+
},
|
|
36
|
+
"gitHead": "57f82cba146cfef0d0f3f138e5ec736cd17f040d"
|
|
26
37
|
}
|