@gustavo-valsechi/node 1.0.2 → 1.0.3
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/dist/index.js
CHANGED
|
@@ -43,7 +43,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
43
43
|
var import_config = require("dotenv/config");
|
|
44
44
|
var import_os = require("os");
|
|
45
45
|
var import_typeorm = require("typeorm");
|
|
46
|
-
var databaseInit = (
|
|
46
|
+
var databaseInit = (entities) => {
|
|
47
47
|
const type = process.env.DB_TYPE;
|
|
48
48
|
const host = process.env.DB_HOST;
|
|
49
49
|
const port = process.env.DB_PORT;
|
|
@@ -56,7 +56,6 @@ var databaseInit = (options) => {
|
|
|
56
56
|
if (!password) throw new Error("DB_PASSWORD is required!");
|
|
57
57
|
if (!database) throw new Error("DB_DATABASE is required!");
|
|
58
58
|
const DB = new import_typeorm.DataSource({
|
|
59
|
-
...options || {},
|
|
60
59
|
type: type || "postgres",
|
|
61
60
|
host,
|
|
62
61
|
port: Number(port),
|
|
@@ -68,7 +67,8 @@ var databaseInit = (options) => {
|
|
|
68
67
|
logging: "all",
|
|
69
68
|
logger: "advanced-console",
|
|
70
69
|
migrations: [__dirname + "/**/migrations/*{.js,.ts}"],
|
|
71
|
-
applicationName: (0, import_os.hostname)()
|
|
70
|
+
applicationName: (0, import_os.hostname)(),
|
|
71
|
+
entities
|
|
72
72
|
});
|
|
73
73
|
DB.initialize().then(() => console.log("Data Source has been initialized!")).catch((err) => console.error("Error during Data Source initialization", err));
|
|
74
74
|
return DB;
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "dotenv/config";
|
|
3
3
|
import { hostname } from "os";
|
|
4
4
|
import { DataSource } from "typeorm";
|
|
5
|
-
var databaseInit = (
|
|
5
|
+
var databaseInit = (entities) => {
|
|
6
6
|
const type = process.env.DB_TYPE;
|
|
7
7
|
const host = process.env.DB_HOST;
|
|
8
8
|
const port = process.env.DB_PORT;
|
|
@@ -15,7 +15,6 @@ var databaseInit = (options) => {
|
|
|
15
15
|
if (!password) throw new Error("DB_PASSWORD is required!");
|
|
16
16
|
if (!database) throw new Error("DB_DATABASE is required!");
|
|
17
17
|
const DB = new DataSource({
|
|
18
|
-
...options || {},
|
|
19
18
|
type: type || "postgres",
|
|
20
19
|
host,
|
|
21
20
|
port: Number(port),
|
|
@@ -27,7 +26,8 @@ var databaseInit = (options) => {
|
|
|
27
26
|
logging: "all",
|
|
28
27
|
logger: "advanced-console",
|
|
29
28
|
migrations: [__dirname + "/**/migrations/*{.js,.ts}"],
|
|
30
|
-
applicationName: hostname()
|
|
29
|
+
applicationName: hostname(),
|
|
30
|
+
entities
|
|
31
31
|
});
|
|
32
32
|
DB.initialize().then(() => console.log("Data Source has been initialized!")).catch((err) => console.error("Error during Data Source initialization", err));
|
|
33
33
|
return DB;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataSource } from 'typeorm';
|
|
2
2
|
|
|
3
|
-
declare const databaseInit: (
|
|
3
|
+
declare const databaseInit: (entities: Array<any>) => DataSource;
|
|
4
4
|
|
|
5
5
|
export { databaseInit };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataSource } from 'typeorm';
|
|
2
2
|
|
|
3
|
-
declare const databaseInit: (
|
|
3
|
+
declare const databaseInit: (entities: Array<any>) => DataSource;
|
|
4
4
|
|
|
5
5
|
export { databaseInit };
|
|
@@ -26,7 +26,7 @@ module.exports = __toCommonJS(database_exports);
|
|
|
26
26
|
var import_config = require("dotenv/config");
|
|
27
27
|
var import_os = require("os");
|
|
28
28
|
var import_typeorm = require("typeorm");
|
|
29
|
-
var databaseInit = (
|
|
29
|
+
var databaseInit = (entities) => {
|
|
30
30
|
const type = process.env.DB_TYPE;
|
|
31
31
|
const host = process.env.DB_HOST;
|
|
32
32
|
const port = process.env.DB_PORT;
|
|
@@ -39,7 +39,6 @@ var databaseInit = (options) => {
|
|
|
39
39
|
if (!password) throw new Error("DB_PASSWORD is required!");
|
|
40
40
|
if (!database) throw new Error("DB_DATABASE is required!");
|
|
41
41
|
const DB = new import_typeorm.DataSource({
|
|
42
|
-
...options || {},
|
|
43
42
|
type: type || "postgres",
|
|
44
43
|
host,
|
|
45
44
|
port: Number(port),
|
|
@@ -51,7 +50,8 @@ var databaseInit = (options) => {
|
|
|
51
50
|
logging: "all",
|
|
52
51
|
logger: "advanced-console",
|
|
53
52
|
migrations: [__dirname + "/**/migrations/*{.js,.ts}"],
|
|
54
|
-
applicationName: (0, import_os.hostname)()
|
|
53
|
+
applicationName: (0, import_os.hostname)(),
|
|
54
|
+
entities
|
|
55
55
|
});
|
|
56
56
|
DB.initialize().then(() => console.log("Data Source has been initialized!")).catch((err) => console.error("Error during Data Source initialization", err));
|
|
57
57
|
return DB;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "dotenv/config";
|
|
3
3
|
import { hostname } from "os";
|
|
4
4
|
import { DataSource } from "typeorm";
|
|
5
|
-
var databaseInit = (
|
|
5
|
+
var databaseInit = (entities) => {
|
|
6
6
|
const type = process.env.DB_TYPE;
|
|
7
7
|
const host = process.env.DB_HOST;
|
|
8
8
|
const port = process.env.DB_PORT;
|
|
@@ -15,7 +15,6 @@ var databaseInit = (options) => {
|
|
|
15
15
|
if (!password) throw new Error("DB_PASSWORD is required!");
|
|
16
16
|
if (!database) throw new Error("DB_DATABASE is required!");
|
|
17
17
|
const DB = new DataSource({
|
|
18
|
-
...options || {},
|
|
19
18
|
type: type || "postgres",
|
|
20
19
|
host,
|
|
21
20
|
port: Number(port),
|
|
@@ -27,7 +26,8 @@ var databaseInit = (options) => {
|
|
|
27
26
|
logging: "all",
|
|
28
27
|
logger: "advanced-console",
|
|
29
28
|
migrations: [__dirname + "/**/migrations/*{.js,.ts}"],
|
|
30
|
-
applicationName: hostname()
|
|
29
|
+
applicationName: hostname(),
|
|
30
|
+
entities
|
|
31
31
|
});
|
|
32
32
|
DB.initialize().then(() => console.log("Data Source has been initialized!")).catch((err) => console.error("Error during Data Source initialization", err));
|
|
33
33
|
return DB;
|