typed-http-headers 1.0.8 → 1.0.10

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 CHANGED
@@ -3,6 +3,35 @@
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.10](https://github.com/bluelovers/ws-ts-type/compare/typed-http-headers@1.0.9...typed-http-headers@1.0.10) (2026-03-07)
7
+
8
+ **Note:** Version bump only for package typed-http-headers
9
+
10
+
11
+
12
+
13
+
14
+ ## [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)
15
+
16
+
17
+
18
+ ### 📚 Documentation
19
+
20
+ * enhance documentation and JSDoc comments across multiple packages ([88ee99b](https://github.com/bluelovers/ws-ts-type/commit/88ee99b3a489645ca53093357cc3523dbe7996e0))
21
+ * **ts-type:** add bilingual JSDoc comments to helper types and test files ([5893036](https://github.com/bluelovers/ws-ts-type/commit/58930369f50f454595241e5573bdcc03dea4654b))
22
+
23
+
24
+ ### 🛠 Build System
25
+
26
+ * 更新多個套件的 test 指令為 jest ([61ea53b](https://github.com/bluelovers/ws-ts-type/commit/61ea53bf15fc3ed0e216793200604ae5a52079c9))
27
+
28
+
29
+ ### ♻️ Chores
30
+
31
+ * migrate from yarn to pnpm and enhance test infrastructure ([8a5daa2](https://github.com/bluelovers/ws-ts-type/commit/8a5daa2f2022eaf025c3349d4fe5dc8971f8c077))
32
+
33
+
34
+
6
35
  ## [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)
7
36
 
8
37
 
package/README.md CHANGED
@@ -1,7 +1,49 @@
1
- # README
1
+ # ts-http-header
2
2
 
3
- typed http headers
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
- yarn add typed-http-headers
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
- * Created by user on 2019/6/9.
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 };
18
+ /**
19
+ * HTTP 標頭值類型
20
+ * HTTP header value types
21
+ *
22
+ * 支援字串、數字、布林值或字串陣列
23
+ * Supports string, number, boolean, or string array
24
+ */
8
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
  }
32
+ /**
33
+ * 載入的標頭類型(可選鍵值)
34
+ * Loaded headers type (optional key-value)
35
+ *
36
+ * @typeParam T - 標頭鍵名類型 / Header key type
37
+ * @typeParam V - 標頭值類型 / Header value type
38
+ */
11
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
- * Created by user on 2019/6/9.
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;;GAEG","sourcesContent":["/**\n * Created by user on 2019/6/9.\n */\n\nimport IRequestHeaders from './lib/request';\nimport IResponseHeaders from './lib/response';\nimport { ITSPartialRecord } from 'ts-type';\n\nexport { IRequestHeaders, IResponseHeaders };\n\nexport type IHttpHeaderValues = string | number | boolean | string[];\n\nexport interface IHeaders extends IRequestHeaders, IResponseHeaders\n{\n\n}\n\nexport type ILazyHeaders<T extends string = string, V = IHttpHeaderValues> = ITSPartialRecord<T, V>;\n\nexport default IHeaders;\n"]}
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;
@@ -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
- * Created by user on 2019/6/9.
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;
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  /**
3
- * Created by user on 2019/6/9.
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;;GAEG","sourcesContent":["/**\n * Created by user on 2019/6/9.\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"]}
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,7 +1,7 @@
1
1
  {
2
2
  "name": "typed-http-headers",
3
- "version": "1.0.8",
4
- "description": "typed http headers",
3
+ "version": "1.0.10",
4
+ "description": "標準 HTTP 請求與回應標頭的 TypeScript 類型定義 | TypeScript type definitions for standard HTTP request and response headers",
5
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"
@@ -17,8 +17,9 @@
17
17
  "scripts": {
18
18
  "coverage": "npx nyc npm run test",
19
19
  "lint": "npx eslint **/*.ts",
20
- "test": "echo \"Error: no test specified\"",
20
+ "test": "jest --passWithNoTests",
21
21
  "test:jest": "jest --passWithNoTests",
22
+ "test:jest:coverage": "node --run test:jest -- --coverage",
22
23
  "test:jest:snapshot": "yarn run test:jest -- -u",
23
24
  "test:snapshot": "yarn run test -- -u",
24
25
  "test:tsd": "ynpx tsd",
@@ -26,7 +27,11 @@
26
27
  "prepublishOnly": "npm run ncu && npm run sort-package-json",
27
28
  "postpublish_": "git commit -m \"publish new version\" .",
28
29
  "ncu": "npx yarn-tool ncu -u",
29
- "sort-package-json": "npx yarn-tool sort"
30
+ "sort-package-json": "npx yarn-tool sort",
31
+ "tsc:showConfig": "ynpx get-current-tsconfig -p"
30
32
  },
31
- "gitHead": "fa34eea119b9bcbb363061ddffcfe9d78c2d0ddd"
33
+ "dependencies": {
34
+ "ts-type": "^3.0.3"
35
+ },
36
+ "gitHead": "4ef633a04245358fed59633c9d9ceff0607d30d3"
32
37
  }