-
-
Notifications
You must be signed in to change notification settings - Fork 0
v0.0.1 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
v0.0.1 #1
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a8cbf35
Initial commit.
sciborrudnicki 9546244
docs(README.md): update links.
sciborrudnicki 5452afe
test: update.
sciborrudnicki 7ff3afa
docs(README.md): update.
sciborrudnicki fa269b0
refactor(`Middleware`): add `args` to `onComplete()`.
sciborrudnicki 2eeea7a
test: update.
sciborrudnicki 2d4afd4
docs(README.md): update.
sciborrudnicki 9aaf2c4
test: update.
sciborrudnicki 1a56bbb
docs(README.md): update examples.
sciborrudnicki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # These are supported funding model platforms | ||
|
|
||
| github: [angular-package] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] | ||
| patreon: angularpackage # Replace with a single Patreon username | ||
| open_collective: # Replace with a single Open Collective username | ||
| ko_fi: # Replace with a single Ko-fi username | ||
| tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
| community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
| liberapay: # Replace with a single Liberapay username | ||
| issuehunt: # Replace with a single IssueHunt username | ||
| otechie: # Replace with a single Otechie username | ||
| custom: [ | ||
| 'https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29', | ||
| 'https://donate.stripe.com/dR614hfDZcJE3wAcMM' | ||
| ] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. | ||
|
|
||
| # Compiled output | ||
| /dist | ||
| /tmp | ||
| /out-tsc | ||
| /bazel-out | ||
|
|
||
| # Node | ||
| /node_modules | ||
| npm-debug.log | ||
| yarn-error.log | ||
|
|
||
| # IDEs and editors | ||
| .idea/ | ||
| .project | ||
| .classpath | ||
| .c9/ | ||
| *.launch | ||
| .settings/ | ||
| *.sublime-workspace | ||
|
|
||
| # Visual Studio Code | ||
| .vscode/* | ||
| !.vscode/settings.json | ||
| !.vscode/tasks.json | ||
| !.vscode/launch.json | ||
| !.vscode/extensions.json | ||
| .history/* | ||
|
|
||
| # Miscellaneous | ||
| /.angular/cache | ||
| .sass-cache/ | ||
| /connect.lock | ||
| /coverage | ||
| /libpeerconnection.log | ||
| testem.log | ||
| /typings | ||
|
|
||
| # System files | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| *.ignore* | ||
| temp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,199 @@ | ||||||
|
|
||||||
| <a href="https://www.typescriptlang.org/"> | ||||||
| <img | ||||||
| src="https://raw.githubusercontent.com/typescript-package/core/refs/heads/main/ts-package-barcode-logo-512.png" | ||||||
| width="20%" | ||||||
| title="@typescript-package/middleware - A lightweight TypeScript library for middleware." | ||||||
| /> | ||||||
| </a> | ||||||
|
|
||||||
| ## @typescript-package/middleware | ||||||
|
|
||||||
| <!-- npm badge --> | ||||||
| [![npm version][typescript-package-npm-badge-svg]][typescript-package-npm-badge] | ||||||
| [![GitHub issues][typescript-package-badge-issues]][typescript-package-issues] | ||||||
| [![GitHub license][typescript-package-badge-license]][typescript-package-license] | ||||||
|
|
||||||
| A **lightweight** TypeScript library for middleware. | ||||||
|
|
||||||
| ## Features | ||||||
|
|
||||||
| ## Table of contents | ||||||
|
|
||||||
| - [Installation](#installation) | ||||||
| - [Api](#api) | ||||||
| - Class | ||||||
| - [`Middleware`](#middleware) | ||||||
| - [Contributing](#contributing) | ||||||
| - [Support](#support) | ||||||
| - [Code of Conduct](code-of-conduct) | ||||||
sciborrudnicki marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| - [Git](#git) | ||||||
| - [Commit](#commit) | ||||||
| - [Versioning](#versioning) | ||||||
| - [License](#license) | ||||||
| - [Related packages](#related-packages) | ||||||
|
|
||||||
| ## Installation | ||||||
|
|
||||||
| ### 1. Install the package | ||||||
|
|
||||||
| ```bash | ||||||
| npm install @typescript-package/middleware --save-peer | ||||||
| ``` | ||||||
|
|
||||||
| ## Api | ||||||
|
|
||||||
| ### `Middleware` | ||||||
|
|
||||||
| ```typescript | ||||||
| import { Middleware } from '@typescript-package/middleware'; | ||||||
|
|
||||||
| // Initialize. | ||||||
| const middleware = new Middleware(); | ||||||
|
|
||||||
| // Add middleware. | ||||||
| middleware.use((args, next) => { | ||||||
| console.log('Middleware 1 executed with args:', args); | ||||||
|
|
||||||
| // Modify args. | ||||||
| args[0].newKey = 'newValue'; | ||||||
|
|
||||||
| // Execute next. | ||||||
| next(); | ||||||
| }); | ||||||
|
|
||||||
| middleware.use((args, next) => { | ||||||
| console.log('Middleware 2 executed with args:', args); | ||||||
|
|
||||||
| // Execute next. | ||||||
| next(); | ||||||
| }); | ||||||
|
|
||||||
| // logs | ||||||
| // Middleware 1 executed with args: [ { key: 'value' } ] | ||||||
| // Middleware 2 executed with args: [ { key: 'value', newKey: 'newValue' } ] | ||||||
| middleware.execute({ key: 'value' }); | ||||||
|
|
||||||
|
|
||||||
| // Async | ||||||
| middleware.use(async (args, next) => { | ||||||
| console.log('Async middleware 1 start with args:', args); | ||||||
| args[0].newKey = 'newValue'; | ||||||
| await new Promise(resolve => setTimeout(resolve, 2000)); | ||||||
| console.log('Async middleware end'); | ||||||
| next(); | ||||||
| }); | ||||||
|
|
||||||
| middleware.use(async (args, next) => { | ||||||
| console.log('Async middleware 2 start with args:', args); | ||||||
| next(); | ||||||
| }); | ||||||
|
|
||||||
| middleware.onComplete((args) => { | ||||||
| console.log('All middlewares completed with args:', args); | ||||||
| }); | ||||||
|
|
||||||
| middleware.executeAsync({ key: 'value' }); | ||||||
| ``` | ||||||
|
|
||||||
| ## Contributing | ||||||
|
|
||||||
| Your contributions are valued! If you'd like to contribute, please feel free to submit a pull request. Help is always appreciated. | ||||||
|
|
||||||
| ## Support | ||||||
|
|
||||||
| If you find this package useful and would like to support its and general development, you can contribute through one of the following payment methods. Your support helps maintain the packages and continue adding new. | ||||||
|
|
||||||
| Support via: | ||||||
|
|
||||||
| - [Stripe](https://donate.stripe.com/dR614hfDZcJE3wAcMM) | ||||||
| - [Revolut](https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29) | ||||||
| - [GitHub](https://github.com/sponsors/angular-package/sponsorships?sponsor=sciborrudnicki&tier_id=83618) | ||||||
| - [DonorBox](https://donorbox.org/become-a-sponsor-to-the-angular-package?default_interval=o) | ||||||
| - [Patreon](https://www.patreon.com/checkout/angularpackage?rid=0&fan_landing=true&view_as=public) | ||||||
|
|
||||||
| or via Trust Wallet | ||||||
|
|
||||||
| - [XLM](https://link.trustwallet.com/send?coin=148&address=GAFFFB7H3LG42O6JA63FJDRK4PP4JCNEOPHLGLLFH625X2KFYQ4UYVM4) | ||||||
| - [USDT (BEP20)](https://link.trustwallet.com/send?coin=20000714&address=0xA0c22A2bc7E37C1d5992dFDFFeD5E6f9298E1b94&token_id=0x55d398326f99059fF775485246999027B3197955) | ||||||
| - [ETH](https://link.trustwallet.com/send?coin=60&address=0xA0c22A2bc7E37C1d5992dFDFFeD5E6f9298E1b94) | ||||||
| - [BTC](https://link.trustwallet.com/send?coin=0&address=bc1qnf709336tfl57ta5mfkf4t9fndhx7agxvv9svn) | ||||||
| - [BNB](https://link.trustwallet.com/send?coin=20000714&address=0xA0c22A2bc7E37C1d5992dFDFFeD5E6f9298E1b94) | ||||||
|
|
||||||
| ## Code of Conduct | ||||||
|
|
||||||
| By participating in this project, you agree to follow **[Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/)**. | ||||||
|
|
||||||
| ## GIT | ||||||
|
|
||||||
| ### Commit | ||||||
|
|
||||||
| Please follow the following commit message conventions: | ||||||
|
|
||||||
| - [AngularJS Git Commit Message Conventions][git-commit-angular] | ||||||
| - [Karma Git Commit Msg][git-commit-karma] | ||||||
| - [Conventional Commits][git-commit-conventional] | ||||||
|
|
||||||
| ### Versioning | ||||||
|
|
||||||
| The package follows [Semantic Versioning 2.0.0][git-semver] for all releases. The versioning format is: | ||||||
|
|
||||||
| **Given a version number MAJOR.MINOR.PATCH, increment the:** | ||||||
|
|
||||||
| - MAJOR version when you make incompatible API changes, | ||||||
| - MINOR version when you add functionality in a backwards-compatible manner, and | ||||||
| - PATCH version when you make backwards-compatible bug fixes. | ||||||
|
|
||||||
| Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format. | ||||||
|
|
||||||
| **FAQ** | ||||||
| How should I deal with revisions in the 0.y.z initial development phase? | ||||||
|
|
||||||
| > The simplest thing to do is start your initial development release at 0.1.0 and then increment the minor version for each subsequent release. | ||||||
|
|
||||||
| How do I know when to release 1.0.0? | ||||||
|
|
||||||
| > If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backwards compatibility, you should probably already be 1.0.0. | ||||||
|
|
||||||
| ## License | ||||||
|
|
||||||
| MIT © typescript-package ([license][typescript-package-license]) | ||||||
|
|
||||||
| ## Related packages | ||||||
|
|
||||||
| - **[@typescript-package/chain-descriptor](https://github.com/typescript-package/chain-descriptor)**: A **TypeScript** library for chain property descriptor. | ||||||
| - **[@typescript-package/controller](https://github.com/typescript-package/controller)**: A **TypeScript** package with for various kind of controllers. | ||||||
| - **[@typescript-package/descriptor](https://github.com/typescript-package/descriptor)**: A **TypeScript** library for property descriptor. | ||||||
| - **[@typescript-package/descriptor-chain](https://github.com/typescript-package/descriptor-chain)**: A **TypeScript** library for property descriptor chain. | ||||||
| - **[@typescript-package/descriptors](https://github.com/typescript-package/descriptors)**: A **TypeScript** library for property descriptors. | ||||||
| - **[@typescript-package/property](https://github.com/typescript-package/property)**: A **TypeScript** package with features to handle object properties. | ||||||
| - **[@typescript-package/wrap-descriptor](https://github.com/typescript-package/wrap-descriptor)**: A **TypeScript** package for wrapping object descriptors. | ||||||
| - **[@typescript-package/wrap-property](https://github.com/typescript-package/wrap-property)**: A **TypeScript** package for wrapping object properties. | ||||||
| - **[@typescript-package/wrapped-descriptor](https://github.com/typescript-package/wrapped-descriptor)**: A **TypeScript** library for wrapped property descriptor. | ||||||
| - **[@xtypescript/property](https://github.com/xtypescript/property)** - A comprehensive, reactive **TypeScript** library for precise and extensible object property control. | ||||||
|
|
||||||
| <!-- This package: typescript-package --> | ||||||
| <!-- GitHub: badges --> | ||||||
| [typescript-package-badge-issues]: https://img.shields.io/github/issues/typescript-package/middleware | ||||||
| [isscript-package-badge-forks]: https://img.shields.io/github/forks/typescript-package/middleware | ||||||
|
||||||
| [isscript-package-badge-forks]: https://img.shields.io/github/forks/typescript-package/middleware | |
| [typescript-package-badge-forks]: https://img.shields.io/github/forks/typescript-package/middleware |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", | ||
| "dest": "../../dist/middleware", | ||
| "lib": { | ||
| "entryFile": "src/public-api.ts" | ||
| }, | ||
| "keepLifecycleScripts": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| "name": "@typescript-package/middleware", | ||
| "version": "0.0.1", | ||
| "author": "wwwdev.io <dev@wwwdev.io>", | ||
| "description": "A lightweight TypeScript library for middleware.", | ||
| "license": "MIT", | ||
| "publishConfig": { | ||
| "access": "public", | ||
| "registry": "https://registry.npmjs.org" | ||
| }, | ||
| "devDependencies": {}, | ||
| "peerDependencies": {}, | ||
sciborrudnicki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "scripts": { | ||
| "prepublishOnly": "npm run pkg && npm run clean", | ||
| "pkg": "npm pkg delete dependencies", | ||
| "clean": "npm pkg delete scripts" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/typescript-package/middleware.git" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/typescript-package/middleware/issues" | ||
| }, | ||
| "keywords": [ | ||
| "@typescript-package", | ||
| "@typescript-package/middleware" | ||
| ], | ||
| "funding": [ | ||
| { | ||
| "type": "individual", | ||
| "url": "https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29" | ||
| } | ||
| ], | ||
| "sideEffects": false | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { Middleware } from './middleware.class'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.