generated from AthennaIO/Template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from AthennaIO/develop
feat: add facades to project
- Loading branch information
Showing
14 changed files
with
81 additions
and
126 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@athenna/core", | ||
"version": "1.1.9", | ||
"version": "1.2.0", | ||
"description": "", | ||
"license": "MIT", | ||
"author": "João Lenon <[email protected]>", | ||
|
@@ -149,10 +149,6 @@ | |
"src/*.d.ts", | ||
"src/**/*.js", | ||
"src/**/*.d.ts", | ||
"container/*.js", | ||
"container/*.d.ts", | ||
"container/**/*.js", | ||
"container/**/*.d.ts", | ||
"*.js", | ||
"*.d.ts" | ||
], | ||
|
@@ -165,7 +161,7 @@ | |
"@athenna/config": "1.0.8", | ||
"@athenna/ioc": "1.1.2", | ||
"@athenna/logger": "1.1.4", | ||
"@athenna/http": "1.1.9", | ||
"@athenna/http": "1.2.0", | ||
"@secjs/utils": "1.8.3", | ||
"reflect-metadata": "0.1.13", | ||
"tscpaths": "0.0.9" | ||
|
This file contains 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
This file contains 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,38 @@ | ||
/** | ||
* @athenna/core | ||
* | ||
* (c) João Lenon <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
export class ProxyHandler { | ||
private readonly alias: any | ||
|
||
public constructor(alias: any) { | ||
this.alias = alias | ||
} | ||
|
||
get(_object: any, key: string) { | ||
const provider = ioc.use(this.alias) | ||
|
||
if (!provider) { | ||
return () => {} | ||
} | ||
|
||
return provider[key] | ||
} | ||
} | ||
|
||
export class Facade { | ||
/** | ||
* Creates a new facade for alias. | ||
* | ||
* @param alias | ||
* @return any | ||
*/ | ||
static createFor<Provider = any>(alias: string): Provider { | ||
return new Proxy(this, new ProxyHandler(alias)) | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
|
@@ -45,5 +45,5 @@ export default { | |
| | ||
*/ | ||
|
||
log: Env('APP_DEBUG', true), | ||
log: Env('APP_DEBUG', false), | ||
} |
This file contains 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
Oops, something went wrong.