Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dummy for FileLogger, ConnectionOptionsReaders, and update gulpfile
- Loading branch information
1 parent
b55a417
commit 49e8cfa
Showing
7 changed files
with
124 additions
and
34 deletions.
There are no files selected for viewing
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 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,55 @@ | ||
/** | ||
* Dummy class for replacement via `package.json` in browser builds. | ||
* | ||
* If we don't include these functions typeorm will throw an error on runtime | ||
* as well as during webpack builds. | ||
*/ | ||
export class ConnectionOptionsEnvReader { | ||
async read() { | ||
throw new Error(`Cannot read connection options in a browser context.`); | ||
} | ||
} | ||
|
||
/** | ||
* Dummy class for replacement via `package.json` in browser builds. | ||
* | ||
* If we don't include these functions typeorm will throw an error on runtime | ||
* as well as during webpack builds. | ||
*/ | ||
export class ConnectionOptionsXmlReader { | ||
async read(path: string) { | ||
throw new Error(`Cannot read connection options in a browser context.`); | ||
} | ||
} | ||
|
||
/** | ||
* Dummy class for replacement via `package.json` in browser builds. | ||
* | ||
* If we don't include these functions typeorm will throw an error on runtime | ||
* as well as during webpack builds. | ||
*/ | ||
export class ConnectionOptionsYmlReader { | ||
async read(path: string) { | ||
throw new Error(`Cannot read connection options in a browser context.`); | ||
} | ||
} | ||
|
||
/** | ||
* Dummy class for replacement via `package.json` in browser builds. | ||
* | ||
* If we don't include these functions typeorm will throw an error on runtime | ||
* as well as during webpack builds. | ||
*/ | ||
export class ConnectionOptionsReader { | ||
async all() { | ||
throw new Error(`Cannot read connection options in a browser context.`); | ||
} | ||
|
||
async get() { | ||
throw new Error(`Cannot read connection options in a browser context.`); | ||
} | ||
|
||
async has() { | ||
throw new Error(`Cannot read connection options in a browser context.`); | ||
} | ||
} |
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,50 @@ | ||
/** | ||
* Performs logging of the events in TypeORM. | ||
* This version of logger logs everything into ormlogs.log file. | ||
*/ | ||
export class DummyLogger { | ||
/** | ||
* Logs query and parameters used in it. | ||
*/ | ||
logQuery() { | ||
throw new Error('This logger is not applicable in a browser context'); | ||
} | ||
|
||
/** | ||
* Logs query that is failed. | ||
*/ | ||
logQueryError() { | ||
throw new Error('This logger is not applicable in a browser context'); | ||
} | ||
|
||
/** | ||
* Logs query that is slow. | ||
*/ | ||
logQuerySlow() { | ||
throw new Error('This logger is not applicable in a browser context'); | ||
} | ||
|
||
/** | ||
* Logs events from the schema build process. | ||
*/ | ||
logSchemaBuild() { | ||
throw new Error('This logger is not applicable in a browser context'); | ||
} | ||
|
||
/** | ||
* Logs events from the migrations run process. | ||
*/ | ||
logMigration() { | ||
throw new Error('This logger is not applicable in a browser context'); | ||
} | ||
|
||
/** | ||
* Perform logging using given logger, or by default to the console. | ||
* Log has its own level and message. | ||
*/ | ||
log() { | ||
throw new Error('This logger is not applicable in a browser context'); | ||
} | ||
} | ||
|
||
export class FileLogger extends DummyLogger {} |