diff --git a/.docs/combined-usage-example.md b/.docs/combined-usage-example.md index 407ddec..877ec4d 100644 --- a/.docs/combined-usage-example.md +++ b/.docs/combined-usage-example.md @@ -1,5 +1,5 @@
- +
## Combined Usage Example diff --git a/.docs/headers.md b/.docs/headers.md index 459f1f2..cec8fec 100644 --- a/.docs/headers.md +++ b/.docs/headers.md @@ -1,5 +1,5 @@
- +
## HTTP Headers Module @@ -74,7 +74,7 @@ The static class that provides the HTTP Headers convenience methods for the head ##### `.make()` Method -Generates an HTTP Authorization header object {@link TAuthorizationHeaderObject} for authorization based on the specified token scheme {@link EMakerTokenSchemes}. So far only `Authorization` header with `Bearer` and `Basic` schemes implemented. +Generates an HTTP Authorization header object `TAuthorizationHeaderObject` for authorization based on the specified token scheme {@link EMakerTokenSchemes}. So far only `Authorization` header with `Bearer` and `Basic` schemes implemented. Signature: `public static make(header: EHTTPHeaders.Authorization, scheme: EMakerTokenSchemes, token: TAuthorizationTokenValue, _maker?: unknown): TAuthorizationHeaderObject` diff --git a/.docs/images/autocomplete.webp b/.docs/images/autocomplete.webp new file mode 100644 index 0000000..e2e0045 Binary files /dev/null and b/.docs/images/autocomplete.webp differ diff --git a/.docs/images/banner-4.jpg b/.docs/images/banner-4.jpg deleted file mode 100644 index f9a3520..0000000 Binary files a/.docs/images/banner-4.jpg and /dev/null differ diff --git a/.docs/images/banner-5.jpg b/.docs/images/banner-5.jpg deleted file mode 100644 index 256936c..0000000 Binary files a/.docs/images/banner-5.jpg and /dev/null differ diff --git a/.docs/images/banner-6.jpg b/.docs/images/banner-6.jpg deleted file mode 100644 index 2abf5b5..0000000 Binary files a/.docs/images/banner-6.jpg and /dev/null differ diff --git a/.docs/images/banner.jpg b/.docs/images/banner.jpg deleted file mode 100644 index 25d5bfb..0000000 Binary files a/.docs/images/banner.jpg and /dev/null differ diff --git a/.docs/methods.md b/.docs/methods.md index c2ce152..f7edb4c 100644 --- a/.docs/methods.md +++ b/.docs/methods.md @@ -1,5 +1,5 @@
- +
## HTTP Methods Module diff --git a/.docs/mime-types.md b/.docs/mime-types.md index c22be72..ba19507 100644 --- a/.docs/mime-types.md +++ b/.docs/mime-types.md @@ -1,5 +1,5 @@
- +
## HTTP MIME Types Module diff --git a/.docs/statuses.md b/.docs/statuses.md index 93bef4c..8e91134 100644 --- a/.docs/statuses.md +++ b/.docs/statuses.md @@ -1,5 +1,5 @@
- +
## HTTP Statuses Module diff --git a/.github/workflows/deliver.yml b/.github/workflows/deliver.yml index 067e92a..4fc2b2e 100644 --- a/.github/workflows/deliver.yml +++ b/.github/workflows/deliver.yml @@ -4,9 +4,9 @@ on: push: branches: # - never # Skip the workflow for debugging purposes; - - implement/package/ci - - develop # So far build the image from develop branch; - # - master + # - implement/package/ci + - develop # Keep this for a time being + - master # paths: # - ".github/workflows/food-service.yml" # - "implementation/**" diff --git a/.usage/demo/autocomplete.ts b/.usage/demo/autocomplete.ts new file mode 100644 index 0000000..9654956 --- /dev/null +++ b/.usage/demo/autocomplete.ts @@ -0,0 +1,23 @@ +'use strict'; + +import { EHTTPMethods, EHTTPMethodsGroupsList, GROUPED_STATUS_CODES, HTTP_STATUSES, HTTPMethodInGroups, HTTPMethodsConvenience, HTTPStatusesConvenience } from '@wherejuly/http-convenience-pack'; + +/** + * NB: Autocomplete Demo + */ + +// --- +const method = EHTTPMethods.HEAD; + +HTTPMethodsConvenience.inGroup(method, EHTTPMethodsGroupsList.PREFLIGHT); // true + +console.log(HTTPMethodInGroups.PATCH); // [EHTTPMethodsGroupsList.IDEMPOTENT] + +// --- + +const success = HTTP_STATUSES[200].code; + +console.log(GROUPED_STATUS_CODES.clienterr); + +HTTPStatusesConvenience.isAmong(success, [100]); // true + diff --git a/.usage/tsconfig.json b/.usage/tsconfig.json index a37f874..7e38b0a 100644 --- a/.usage/tsconfig.json +++ b/.usage/tsconfig.json @@ -20,6 +20,6 @@ "noUncheckedIndexedAccess": true /* Add 'undefined' to a type when accessed using an index. */, "skipLibCheck": true }, - "include": ["./tests"], + "include": ["./tests", "./demo"], "exclude": ["node_modules"] } diff --git a/package-lock.json b/package-lock.json index 81b48ca..9d28498 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wherejuly/http-convenience-pack", - "version": "0.0.18", + "version": "0.9.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wherejuly/http-convenience-pack", - "version": "0.0.18", + "version": "0.9.0", "license": "UNLICENSED", "devDependencies": { "@commitlint/cli": "^19.6.0", diff --git a/package.json b/package.json index aa95be7..88488c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@wherejuly/http-convenience-pack", - "version": "0.0.18", + "name": "http-convenience-pack", + "version": "0.9.0", "description": "HTTP Convenience Pack", "author": "valentineshi.dev@gmail.com", "type": "module", diff --git a/readme.md b/readme.md index 28e163a..d391865 100644 --- a/readme.md +++ b/readme.md @@ -4,31 +4,28 @@ -Type-safe, RFC-compliant, auto-completable HTTP constants and convenience functions to ensure standardized uniform values conveniently manipulated across your applications and services. - Use TypeScript type inference and IDE autocomplete for comfort and type safety in HTTP constants manipulations. **Summary** The small dependency-free, TypeScript HTTP convenience package. Exposes uniform standardized RFC-compliant type-safe auto-completable HTTP constants to apply across your applications' ends and services along with the convenience functionality (validate, normalize, is among, of group, in group, make, extract, transform etc.). -The new use cases / functionality suggestions are welcome either in [Discussions](https://github.com/WhereJuly/62-http-convenience-pack/discussions) or as [pull requests](#contribution). - **Package Status** ![Build Status](https://github.com/WhereJuly/62-http-convenience-pack/actions/workflows/deliver.yml/badge.svg) [![codecov](https://codecov.io/gh/WhereJuly/62-http-convenience-pack/graph/badge.svg?token=N7W0Q11DRL)](https://codecov.io/gh/WhereJuly/62-http-convenience-pack) +![npm version](https://img.shields.io/npm/v/http-convenience-pack.svg) +![npm downloads](https://img.shields.io/npm/dm/http-convenience-pack.svg) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +--> -The package is in a usage-ready state, no pending functionality. It is actively maintained. It moves to production-ready `>= v1.0.0` as the initial usage feedback confirms it has no major missing use cases. +The package is in a usage-ready state, no pending functionality. It is actively maintained. It moves to production-ready `>= v1.0.0` as the initial usage feedback confirms it has no major missing use cases. # HTTP Convenience Pack @@ -48,10 +45,11 @@ On top it has functionality that allows manipulating the application HTTP variab - [Installation](#installation) - [Autocomplete Demo](#autocomplete-demo) - [Combined Usage Example](#combined-usage-example) -- [HTTP Methods](#http-methods) -- [HTTP Statuses](#http-statuses) -- [HTTP MIME Types](#http-mime-types) -- [HTTP Headers](#http-headers) +- [Modules](#modules) + - [HTTP Methods](#http-methods) + - [HTTP Statuses](#http-statuses) + - [HTTP MIME Types](#http-mime-types) + - [HTTP Headers](#http-headers) - [Maintenance](#maintenance) - [Changelog](#changelog) - [Roadmap](#roadmap) @@ -66,7 +64,7 @@ The package is carefully documented for comfortable developer experience. From the good-named identifiers in code, thought-out autocompletion (see animated GIF [demo](#autocomplete-demo)), hover-popup doc blocks with usage examples on enums, constants classes and methods accessible with on-hover or `Ctrl-Left-click` when integrated with your IDE TypeScript setup (e.g. see [VS Code](https://code.visualstudio.com/Docs/languages/typescript)) to the detailed readme with use cases and the dedicated modules' API references. -As well there is a GitHub [Discussion](https://github.com/WhereJuly/62-http-convenience-pack/discussions) available for question, as the usual GitHub [Issues](https://github.com/WhereJuly/62-http-convenience-pack/issues) for bug reporting. +As well there is a GitHub [Discussion](https://github.com/WhereJuly/62-http-convenience-pack/discussions) available for question and requests, as the usual GitHub [Issues](https://github.com/WhereJuly/62-http-convenience-pack/issues) for bug reporting. **Code Conventions** @@ -90,18 +88,26 @@ npm install http-convenience-pack #### Autocomplete Demo -> Here make and insert the GIF with all autocomplete demonstrations. -> Hide the demo under details tag not to annoy +Here is the short demo. The autocomplete works on all published API members. See the respective API References in the modules dedicated documentation. + +
+ Watch +
+ +
+
#### [Combined Usage Example](.docs/combined-usage-example.md) -## [HTTP Methods](.docs/methods.md) +## Modules + +### [HTTP Methods](.docs/methods.md) -## [HTTP Statuses](.docs/statuses.md) +### [HTTP Statuses](.docs/statuses.md) -## [HTTP MIME Types](.docs/mime-types.md) +### [HTTP MIME Types](.docs/mime-types.md) -## [HTTP Headers](.docs/headers.md) +### [HTTP Headers](.docs/headers.md) ## Maintenance @@ -111,13 +117,13 @@ Will come with public updates. ### Roadmap -Potentially valuable use cases / functionality suggestions are welcome either in [Discussions](https://github.com/WhereJuly/62-http-convenience-pack/discussions) or as [pull requests](#contribution). - Will appear here when available. ### Contributions -If there is contribution, I would receive it on `integration` branch for discussion and manual approval. +Potentially valuable use cases / functionality suggestions are welcome either in [Discussions](https://github.com/WhereJuly/62-http-convenience-pack/discussions) or as [pull requests](#contribution). + +If there is a Pull Request contribution, I would receive it on `integration` branch for discussion and manual merge. ### License