fastypest 1.4.104 → 1.4.107
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/core/config.js +12 -4
- package/dist/core/config.js.map +1 -1
- package/dist/core/fastypest.js +150 -161
- package/dist/core/fastypest.js.map +1 -1
- package/dist/core/index.js +18 -16
- package/dist/core/index.js.map +1 -1
- package/dist/core/sql-script/index.js +18 -16
- package/dist/core/sql-script/index.js.map +1 -1
- package/dist/core/sql-script/queries/cockroachdb.json +13 -13
- package/dist/core/sql-script/queries/index.js +23 -13
- package/dist/core/sql-script/queries/index.js.map +1 -1
- package/dist/core/sql-script/queries/mysql.query.json +13 -13
- package/dist/core/sql-script/queries/postgres.query.json +13 -13
- package/dist/core/sql-script/sql-script.js +35 -15
- package/dist/core/sql-script/sql-script.js.map +1 -1
- package/dist/core/sql-script/types/index.js +18 -16
- package/dist/core/sql-script/types/index.js.map +1 -1
- package/dist/core/sql-script/types/query-path.js +4 -1
- package/dist/core/sql-script/types/query-path.js.map +1 -1
- package/dist/core/types.js +4 -1
- package/dist/core/types.js.map +1 -1
- package/dist/index.js +18 -16
- package/dist/index.js.map +1 -1
- package/package.json +15 -13
package/dist/core/config.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "INDEX_OFFSET_CONFIG", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return INDEX_OFFSET_CONFIG;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const INDEX_OFFSET_CONFIG = {
|
|
5
12
|
postgres: 1,
|
|
6
|
-
cockroachdb: 0
|
|
13
|
+
cockroachdb: 0
|
|
7
14
|
};
|
|
15
|
+
|
|
8
16
|
//# sourceMappingURL=config.js.map
|
package/dist/core/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/core/config.ts"],"sourcesContent":["import { DBType } from \"./types\";\n\nexport const INDEX_OFFSET_CONFIG: Partial<Record<DBType, number>> = {\n postgres: 1,\n cockroachdb: 0,\n};\n"],"names":["INDEX_OFFSET_CONFIG","postgres","cockroachdb"],"mappings":";;;;+BAEaA;;;eAAAA;;;AAAN,MAAMA,sBAAuD;IAClEC,UAAU;IACVC,aAAa;AACf"}
|
package/dist/core/fastypest.js
CHANGED
|
@@ -1,191 +1,180 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.restoreInOder = false;
|
|
21
|
-
this.manager = connection.manager;
|
|
22
|
-
}
|
|
23
|
-
init() {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
yield this.manager.transaction((em) => __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
yield this.detectTables(em);
|
|
27
|
-
yield this.calculateDependencyTables(em);
|
|
28
|
-
const tables = [...this.tables];
|
|
29
|
-
yield Promise.all([
|
|
30
|
-
this.createTempTable(em, tables),
|
|
31
|
-
this.detectTablesWithAutoIncrement(em, tables),
|
|
32
|
-
]);
|
|
33
|
-
}));
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "Fastypest", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return Fastypest;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _config = require("./config");
|
|
12
|
+
const _sqlscript = require("./sql-script");
|
|
13
|
+
function _define_property(obj, key, value) {
|
|
14
|
+
if (key in obj) {
|
|
15
|
+
Object.defineProperty(obj, key, {
|
|
16
|
+
value: value,
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true
|
|
34
20
|
});
|
|
21
|
+
} else {
|
|
22
|
+
obj[key] = value;
|
|
35
23
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
24
|
+
return obj;
|
|
25
|
+
}
|
|
26
|
+
class Fastypest extends _sqlscript.SQLScript {
|
|
27
|
+
async init() {
|
|
28
|
+
await this.manager.transaction(async (em)=>{
|
|
29
|
+
await this.detectTables(em);
|
|
30
|
+
await this.calculateDependencyTables(em);
|
|
31
|
+
const tables = [
|
|
32
|
+
...this.tables
|
|
33
|
+
];
|
|
34
|
+
await Promise.all([
|
|
35
|
+
this.createTempTable(em, tables),
|
|
36
|
+
this.detectTablesWithAutoIncrement(em, tables)
|
|
37
|
+
]);
|
|
41
38
|
});
|
|
42
39
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
});
|
|
40
|
+
async createTempTable(em, tables) {
|
|
41
|
+
await Promise.all(tables.map(async (tableName)=>{
|
|
42
|
+
await this.execQuery(em, "createTempTable", {
|
|
43
|
+
tableName
|
|
44
|
+
});
|
|
45
|
+
}));
|
|
49
46
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return;
|
|
55
|
-
for (const column of columns) {
|
|
56
|
-
yield this.processColumn(em, tableName, column);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
47
|
+
async detectTablesWithAutoIncrement(em, tables) {
|
|
48
|
+
for (const tableName of tables){
|
|
49
|
+
await this.processTable(em, tableName);
|
|
50
|
+
}
|
|
59
51
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
async processTable(em, tableName) {
|
|
53
|
+
const columns = await this.getColumnsWithAutoIncrement(em, tableName);
|
|
54
|
+
if (!columns) return;
|
|
55
|
+
for (const column of columns){
|
|
56
|
+
await this.processColumn(em, tableName, column);
|
|
57
|
+
}
|
|
65
58
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
59
|
+
async getColumnsWithAutoIncrement(em, tableName) {
|
|
60
|
+
const columns = await this.execQuery(em, "getColumnsWithAutoIncrement", {
|
|
61
|
+
tableName
|
|
62
|
+
});
|
|
63
|
+
return Array.isArray(columns) ? columns : null;
|
|
64
|
+
}
|
|
65
|
+
async processColumn(em, tableName, column) {
|
|
66
|
+
const stat = await this.getMaxColumnIndex(em, tableName, column.column_name);
|
|
67
|
+
const sequenceName = this.getSequenceName(column.column_default);
|
|
68
|
+
if (!sequenceName) return;
|
|
69
|
+
const index = Number(stat?.maxindex) || 0;
|
|
70
|
+
this.updateTablesWithAutoIncrement(tableName, {
|
|
71
|
+
column: column.column_name,
|
|
72
|
+
sequenceName,
|
|
73
|
+
index: String(index + (_config.INDEX_OFFSET_CONFIG[this.getType()] ?? 0))
|
|
79
74
|
});
|
|
80
75
|
}
|
|
81
|
-
getMaxColumnIndex(em, tableName, columnName) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
column_name: columnName,
|
|
86
|
-
});
|
|
87
|
-
return stat || null;
|
|
76
|
+
async getMaxColumnIndex(em, tableName, columnName) {
|
|
77
|
+
const [stat] = await this.execQuery(em, "getMaxColumnIndex", {
|
|
78
|
+
tableName,
|
|
79
|
+
column_name: columnName
|
|
88
80
|
});
|
|
81
|
+
return stat || null;
|
|
89
82
|
}
|
|
90
83
|
getSequenceName(columnDefault) {
|
|
91
|
-
|
|
92
|
-
return ((_a = columnDefault.match(/'([^']+)'/)) === null || _a === void 0 ? void 0 : _a[1]) || null;
|
|
84
|
+
return columnDefault.match(/'([^']+)'/)?.[1] || null;
|
|
93
85
|
}
|
|
94
86
|
updateTablesWithAutoIncrement(tableName, data) {
|
|
95
|
-
var _a;
|
|
96
87
|
if (!this.tablesWithAutoIncrement.has(tableName)) {
|
|
97
88
|
this.tablesWithAutoIncrement.set(tableName, []);
|
|
98
89
|
}
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
restoreData() {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
yield foreignKey.enable();
|
|
108
|
-
}));
|
|
90
|
+
this.tablesWithAutoIncrement.get(tableName)?.push(data);
|
|
91
|
+
}
|
|
92
|
+
async restoreData() {
|
|
93
|
+
await this.manager.transaction(async (em)=>{
|
|
94
|
+
const { foreignKey, restoreOrder } = await this.restoreManager(em);
|
|
95
|
+
await foreignKey.disable();
|
|
96
|
+
await restoreOrder();
|
|
97
|
+
await foreignKey.enable();
|
|
109
98
|
});
|
|
110
99
|
}
|
|
111
|
-
restoreManager(em) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
manager.
|
|
129
|
-
|
|
100
|
+
async restoreManager(em) {
|
|
101
|
+
if (this.tables.size === 0) {
|
|
102
|
+
await this.detectTables(em);
|
|
103
|
+
}
|
|
104
|
+
const manager = {
|
|
105
|
+
foreignKey: {
|
|
106
|
+
disable: async ()=>Promise.resolve(),
|
|
107
|
+
enable: async ()=>Promise.resolve()
|
|
108
|
+
},
|
|
109
|
+
restoreOrder: async ()=>Promise.resolve()
|
|
110
|
+
};
|
|
111
|
+
const typesWithForeignKey = [
|
|
112
|
+
"postgres",
|
|
113
|
+
"mariadb",
|
|
114
|
+
"mysql"
|
|
115
|
+
];
|
|
116
|
+
if (typesWithForeignKey.includes(this.getType())) {
|
|
117
|
+
manager.foreignKey.disable = async ()=>this.execQuery(em, "foreignKey.disable");
|
|
118
|
+
manager.foreignKey.enable = async ()=>this.execQuery(em, "foreignKey.enable");
|
|
119
|
+
}
|
|
120
|
+
manager.restoreOrder = ()=>this.restoreOrder(em);
|
|
121
|
+
return manager;
|
|
122
|
+
}
|
|
123
|
+
async calculateDependencyTables(em) {
|
|
124
|
+
const dependencyTree = await this.execQuery(em, "dependencyTree");
|
|
125
|
+
if (!dependencyTree.length) {
|
|
126
|
+
this.restoreInOder = false;
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const sortedTables = new Set(dependencyTree.map((row)=>row.table_name));
|
|
130
|
+
this.tables.clear();
|
|
131
|
+
this.tables = sortedTables;
|
|
132
|
+
this.restoreInOder = true;
|
|
133
|
+
}
|
|
134
|
+
async detectTables(em) {
|
|
135
|
+
const tables = await this.execQuery(em, "getTables");
|
|
136
|
+
if (!tables) return;
|
|
137
|
+
tables.forEach((row)=>{
|
|
138
|
+
this.tables.add(row.name);
|
|
130
139
|
});
|
|
131
140
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
this.restoreInOder = false;
|
|
137
|
-
return;
|
|
141
|
+
async restoreOrder(em) {
|
|
142
|
+
if (this.restoreInOder) {
|
|
143
|
+
for (const tableName of this.tables){
|
|
144
|
+
await this.recreateData(em, tableName);
|
|
138
145
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
this.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return;
|
|
150
|
-
tables.forEach((row) => {
|
|
151
|
-
this.tables.add(row.name);
|
|
152
|
-
});
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const tables = [
|
|
149
|
+
...this.tables
|
|
150
|
+
];
|
|
151
|
+
await Promise.all(tables.map((tableName)=>this.recreateData(em, tableName)));
|
|
152
|
+
}
|
|
153
|
+
async recreateData(em, tableName) {
|
|
154
|
+
await this.execQuery(em, "truncateTable", {
|
|
155
|
+
tableName
|
|
153
156
|
});
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
-
if (this.restoreInOder) {
|
|
158
|
-
for (const tableName of this.tables) {
|
|
159
|
-
yield this.recreateData(em, tableName);
|
|
160
|
-
}
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
const tables = [...this.tables];
|
|
164
|
-
yield Promise.all(tables.map((tableName) => this.recreateData(em, tableName)));
|
|
157
|
+
await this.execQuery(em, "restoreData", {
|
|
158
|
+
tableName
|
|
165
159
|
});
|
|
160
|
+
await this.resetAutoIncrementColumns(em, tableName);
|
|
166
161
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
162
|
+
async resetAutoIncrementColumns(em, tableName) {
|
|
163
|
+
const tables = this.tablesWithAutoIncrement.get(tableName);
|
|
164
|
+
if (!tables) return;
|
|
165
|
+
for (const { column, sequenceName, index } of tables){
|
|
166
|
+
await this.execQuery(em, "resetAutoIncrementColumn", {
|
|
167
|
+
tableName,
|
|
168
|
+
column,
|
|
169
|
+
sequenceName,
|
|
170
|
+
index
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
173
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (!tables)
|
|
178
|
-
return;
|
|
179
|
-
for (const { column, sequenceName, index } of tables) {
|
|
180
|
-
yield this.execQuery(em, "resetAutoIncrementColumn", {
|
|
181
|
-
tableName,
|
|
182
|
-
column,
|
|
183
|
-
sequenceName,
|
|
184
|
-
index,
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
});
|
|
174
|
+
constructor(connection){
|
|
175
|
+
super(connection.options.type), _define_property(this, "manager", void 0), _define_property(this, "tables", new Set()), _define_property(this, "tablesWithAutoIncrement", new Map()), _define_property(this, "restoreInOder", false);
|
|
176
|
+
this.manager = connection.manager;
|
|
188
177
|
}
|
|
189
178
|
}
|
|
190
|
-
|
|
179
|
+
|
|
191
180
|
//# sourceMappingURL=fastypest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastypest.js","sourceRoot":"","sources":["../../src/core/fastypest.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAA+C;AAC/C,6CAAyC;AAUzC,MAAa,SAAU,SAAQ,sBAAS;IAMtC,YAAY,UAAmC;QAC7C,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QALzB,WAAM,GAAgB,IAAI,GAAG,EAAE,CAAC;QAChC,4BAAuB,GAAmC,IAAI,GAAG,EAAE,CAAC;QACpE,kBAAa,GAAY,KAAK,CAAC;QAIrC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;IACpC,CAAC;IAEY,IAAI;;YACf,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAO,EAAiB,EAAE,EAAE;gBACzD,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;gBAC5B,MAAM,IAAI,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAC;gBACzC,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;gBAChC,MAAM,OAAO,CAAC,GAAG,CAAC;oBAChB,IAAI,CAAC,eAAe,CAAC,EAAE,EAAE,MAAM,CAAC;oBAChC,IAAI,CAAC,6BAA6B,CAAC,EAAE,EAAE,MAAM,CAAC;iBAC/C,CAAC,CAAC;YACL,CAAC,CAAA,C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,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;YAChC,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAC5D,CAAC;QACJ,CAAC;KAAA;IAEa,YAAY,CACxB,EAAiB,EACjB,SAAiB;;YAEjB,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,eAAe,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;YACzD,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,aAAa,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;YACvD,MAAM,IAAI,CAAC,yBAAyB,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;QACtD,CAAC;KAAA;IAEa,yBAAyB,CACrC,EAAiB,EACjB,SAAiB;;YAEjB,MAAM,MAAM,GAAG,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAC3D,IAAI,CAAC,MAAM;gBAAE,OAAO;YAEpB,KAAK,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,MAAM,EAAE,CAAC;gBACrD,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,0BAA0B,EAAE;oBACnD,SAAS;oBACT,MAAM;oBACN,YAAY;oBACZ,KAAK;iBACN,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KAAA;CACF;AAxND,8BAwNC"}
|
|
1
|
+
{"version":3,"sources":["../../src/core/fastypest.ts"],"sourcesContent":["import { Connection, DataSource, EntityManager, Table } from \"typeorm\";\nimport { INDEX_OFFSET_CONFIG } from \"./config\";\nimport { SQLScript } from \"./sql-script\";\nimport type {\n ColumnStat,\n ColumnsWithAutoIncrement,\n DBType,\n DependencyTreeQueryOut,\n IncrementDetail,\n Manager,\n} from \"./types\";\n\nexport class Fastypest extends SQLScript {\n private manager: EntityManager;\n private tables: Set<string> = new Set();\n private tablesWithAutoIncrement: Map<string, IncrementDetail[]> = new Map();\n private restoreInOder: boolean = false;\n\n constructor(connection: DataSource | Connection) {\n super(connection.options.type);\n this.manager = connection.manager;\n }\n\n public async init(): Promise<void> {\n await this.manager.transaction(async (em: EntityManager) => {\n await this.detectTables(em);\n await this.calculateDependencyTables(em);\n const tables = [...this.tables];\n await Promise.all([\n this.createTempTable(em, tables),\n this.detectTablesWithAutoIncrement(em, tables),\n ]);\n });\n }\n\n private async createTempTable(\n em: EntityManager,\n tables: string[]\n ): Promise<void> {\n await Promise.all(\n tables.map(async (tableName) => {\n await this.execQuery(em, \"createTempTable\", { tableName });\n })\n );\n }\n\n private async detectTablesWithAutoIncrement(\n em: EntityManager,\n tables: string[]\n ): Promise<void> {\n for (const tableName of tables) {\n await this.processTable(em, tableName);\n }\n }\n\n private async processTable(\n em: EntityManager,\n tableName: string\n ): Promise<void> {\n const columns = await this.getColumnsWithAutoIncrement(em, tableName);\n if (!columns) return;\n\n for (const column of columns) {\n await this.processColumn(em, tableName, column);\n }\n }\n\n private async getColumnsWithAutoIncrement(\n em: EntityManager,\n tableName: string\n ): Promise<ColumnsWithAutoIncrement[] | null> {\n const columns = await this.execQuery<ColumnsWithAutoIncrement>(\n em,\n \"getColumnsWithAutoIncrement\",\n { tableName }\n );\n return Array.isArray(columns) ? columns : null;\n }\n\n private async processColumn(\n em: EntityManager,\n tableName: string,\n column: ColumnsWithAutoIncrement\n ): Promise<void> {\n const stat = await this.getMaxColumnIndex(\n em,\n tableName,\n column.column_name\n );\n const sequenceName = this.getSequenceName(column.column_default);\n if (!sequenceName) return;\n\n const index = Number(stat?.maxindex) || 0;\n this.updateTablesWithAutoIncrement(tableName, {\n column: column.column_name,\n sequenceName,\n index: String(index + (INDEX_OFFSET_CONFIG[this.getType()] ?? 0)),\n });\n }\n\n private async getMaxColumnIndex(\n em: EntityManager,\n tableName: string,\n columnName: string\n ): Promise<ColumnStat | null> {\n const [stat] = await this.execQuery<ColumnStat>(em, \"getMaxColumnIndex\", {\n tableName,\n column_name: columnName,\n });\n return stat || null;\n }\n\n private getSequenceName(columnDefault: string): string | null {\n return columnDefault.match(/'([^']+)'/)?.[1] || null;\n }\n\n private updateTablesWithAutoIncrement(\n tableName: string,\n data: { column: string; sequenceName: string; index: string }\n ): void {\n if (!this.tablesWithAutoIncrement.has(tableName)) {\n this.tablesWithAutoIncrement.set(tableName, []);\n }\n\n this.tablesWithAutoIncrement.get(tableName)?.push(data);\n }\n\n public async restoreData(): Promise<void> {\n await this.manager.transaction(async (em: EntityManager) => {\n const { foreignKey, restoreOrder } = await this.restoreManager(em);\n await foreignKey.disable();\n await restoreOrder();\n await foreignKey.enable();\n });\n }\n\n protected async restoreManager(em: EntityManager): Promise<Manager> {\n if (this.tables.size === 0) {\n await this.detectTables(em);\n }\n\n const manager: Manager = {\n foreignKey: {\n disable: async () => Promise.resolve(),\n enable: async () => Promise.resolve(),\n },\n restoreOrder: async () => Promise.resolve(),\n };\n\n const typesWithForeignKey: DBType[] = [\"postgres\", \"mariadb\", \"mysql\"];\n if (typesWithForeignKey.includes(this.getType())) {\n manager.foreignKey.disable = async (): Promise<void> =>\n this.execQuery(em, \"foreignKey.disable\");\n manager.foreignKey.enable = async (): Promise<void> =>\n this.execQuery(em, \"foreignKey.enable\");\n }\n\n manager.restoreOrder = (): Promise<void> => this.restoreOrder(em);\n\n return manager;\n }\n\n private async calculateDependencyTables(em: EntityManager): Promise<void> {\n const dependencyTree = await this.execQuery<DependencyTreeQueryOut>(\n em,\n \"dependencyTree\"\n );\n\n if (!dependencyTree.length) {\n this.restoreInOder = false;\n return;\n }\n\n const sortedTables = new Set(dependencyTree.map((row) => row.table_name));\n this.tables.clear();\n this.tables = sortedTables;\n this.restoreInOder = true;\n }\n\n private async detectTables(em: EntityManager): Promise<void> {\n const tables = await this.execQuery<Table>(em, \"getTables\");\n if(!tables) return;\n\n tables.forEach((row) => {\n this.tables.add(row.name);\n });\n }\n\n private async restoreOrder(em: EntityManager): Promise<void> {\n if (this.restoreInOder) {\n for (const tableName of this.tables) {\n await this.recreateData(em, tableName);\n }\n\n return;\n }\n\n const tables = [...this.tables];\n await Promise.all(\n tables.map((tableName) => this.recreateData(em, tableName))\n );\n }\n\n private async recreateData(\n em: EntityManager,\n tableName: string\n ): Promise<void> {\n await this.execQuery(em, \"truncateTable\", { tableName });\n await this.execQuery(em, \"restoreData\", { tableName });\n await this.resetAutoIncrementColumns(em, tableName);\n }\n\n private async resetAutoIncrementColumns(\n em: EntityManager,\n tableName: string\n ): Promise<void> {\n const tables = this.tablesWithAutoIncrement.get(tableName);\n if (!tables) return;\n\n for (const { column, sequenceName, index } of tables) {\n await this.execQuery(em, \"resetAutoIncrementColumn\", {\n tableName,\n column,\n sequenceName,\n index,\n });\n }\n }\n}\n"],"names":["Fastypest","SQLScript","init","manager","transaction","em","detectTables","calculateDependencyTables","tables","Promise","all","createTempTable","detectTablesWithAutoIncrement","map","tableName","execQuery","processTable","columns","getColumnsWithAutoIncrement","column","processColumn","Array","isArray","stat","getMaxColumnIndex","column_name","sequenceName","getSequenceName","column_default","index","Number","maxindex","updateTablesWithAutoIncrement","String","INDEX_OFFSET_CONFIG","getType","columnName","columnDefault","match","data","tablesWithAutoIncrement","has","set","get","push","restoreData","foreignKey","restoreOrder","restoreManager","disable","enable","size","resolve","typesWithForeignKey","includes","dependencyTree","length","restoreInOder","sortedTables","Set","row","table_name","clear","forEach","add","name","recreateData","resetAutoIncrementColumns","constructor","connection","options","type","Map"],"mappings":";;;;+BAYaA;;;eAAAA;;;wBAXuB;2BACV;;;;;;;;;;;;;;AAUnB,MAAMA,kBAAkBC,oBAAS;IAWtC,MAAaC,OAAsB;QACjC,MAAM,IAAI,CAACC,OAAO,CAACC,WAAW,CAAC,OAAOC;YACpC,MAAM,IAAI,CAACC,YAAY,CAACD;YACxB,MAAM,IAAI,CAACE,yBAAyB,CAACF;YACrC,MAAMG,SAAS;mBAAI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oD,aACZ7D,EAAiB,EACjBS,SAAiB,EACF;QACf,MAAM,IAAI,CAACC,SAAS,CAACV,IAAI,iBAAiB;YAAES;QAAU;QACtD,MAAM,IAAI,CAACC,SAAS,CAACV,IAAI,eAAe;YAAES;QAAU;QACpD,MAAM,IAAI,CAACqD,yBAAyB,CAAC9D,IAAIS;IAC3C;IAEA,MAAcqD,0BACZ9D,EAAiB,EACjBS,SAAiB,EACF;QACf,MAAMN,SAAS,IAAI,CAACgC,uBAAuB,CAACG,GAAG,CAAC7B;QAChD,IAAI,CAACN,QAAQ;QAEb,KAAK,MAAM,EAAEW,MAAM,EAAEO,YAAY,EAAEG,KAAK,EAAE,IAAIrB,OAAQ;YACpD,MAAM,IAAI,CAACO,SAAS,CAACV,IAAI,4BAA4B;gBACnDS;gBACAK;gBACAO;gBACAG;YACF;QACF;IACF;IAjNAuC,YAAYC,UAAmC,CAAE;QAC/C,KAAK,CAACA,WAAWC,OAAO,CAACC,IAAI,GAN/B,uBAAQpE,WAAR,KAAA,IACA,uBAAQK,UAAsB,IAAImD,QAClC,uBAAQnB,2BAA0D,IAAIgC,QACtE,uBAAQf,iBAAyB;QAI/B,IAAI,CAACtD,OAAO,GAAGkE,WAAWlE,OAAO;IACnC;AA+MF"}
|
package/dist/core/index.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./fastypest"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
19
|
+
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["export * from \"./fastypest\";\n"],"names":[],"mappings":";;;;qBAAc"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./sql-script"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
19
|
+
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/core/sql-script/index.ts"],"sourcesContent":["export * from \"./sql-script\";\n"],"names":[],"mappings":";;;;qBAAc"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
"dependencyTree": "WITH RECURSIVE dependency_tree AS (SELECT table_name, 0 AS level FROM information_schema.tables WHERE table_schema = 'public' AND table_name NOT IN (SELECT DISTINCT ccu.table_name FROM information_schema.table_constraints tc JOIN information_schema.constraint_column_usage ccu ON ccu.constraint_name = tc.constraint_name WHERE constraint_type = 'FOREIGN KEY' AND tc.table_schema = 'public') UNION ALL SELECT ccu.table_name, dt.level + 1 AS level FROM information_schema.table_constraints tc JOIN information_schema.constraint_column_usage ccu ON ccu.constraint_name = tc.constraint_name JOIN dependency_tree dt ON dt.table_name = tc.table_name WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_schema = 'public') SELECT table_name FROM dependency_tree ORDER BY level DESC, table_name",
|
|
3
|
+
"foreignKey": {
|
|
4
|
+
"disable": "-- NOT USED",
|
|
5
|
+
"enable": "-- NOT USED"
|
|
6
|
+
},
|
|
7
|
+
"getTables": "SELECT table_name AS name FROM information_schema.tables WHERE table_catalog = CURRENT_DATABASE() AND table_schema = 'public' AND table_type = 'BASE TABLE'",
|
|
8
|
+
"createTempTable": "SET experimental_enable_temp_tables=on; CREATE TEMPORARY TABLE \"{{tableName}}_temp\" AS SELECT * FROM \"{{tableName}}\"",
|
|
9
|
+
"dropTempTable": "DROP TABLE IF EXISTS \"{{tableName}}_temp\"",
|
|
10
|
+
"restoreData": "INSERT INTO \"{{tableName}}\" SELECT * FROM \"{{tableName}}_temp\";",
|
|
11
|
+
"truncateTable": "TRUNCATE TABLE \"{{tableName}}\" CASCADE;",
|
|
12
|
+
"getColumnsWithAutoIncrement": "SELECT column_name, column_default FROM information_schema.columns WHERE table_schema = 'public' AND column_default LIKE 'nextval%' AND table_name = '{{tableName}}'",
|
|
13
|
+
"resetAutoIncrementColumn": "SELECT setval('{{sequenceName}}',{{index}});",
|
|
14
|
+
"getMaxColumnIndex": "SELECT MAX({{column_name}}) AS maxindex FROM \"{{tableName}}\""
|
|
15
15
|
}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "DB_QUERIES", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return DB_QUERIES;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _cockroachdbjson = /*#__PURE__*/ _interop_require_default(require("./cockroachdb.json"));
|
|
12
|
+
const _mysqlqueryjson = /*#__PURE__*/ _interop_require_default(require("./mysql.query.json"));
|
|
13
|
+
const _postgresqueryjson = /*#__PURE__*/ _interop_require_default(require("./postgres.query.json"));
|
|
14
|
+
function _interop_require_default(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : {
|
|
16
|
+
default: obj
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const DB_QUERIES = {
|
|
20
|
+
mysql: _mysqlqueryjson.default,
|
|
21
|
+
mariadb: _mysqlqueryjson.default,
|
|
22
|
+
postgres: _postgresqueryjson.default,
|
|
23
|
+
cockroachdb: _cockroachdbjson.default
|
|
15
24
|
};
|
|
25
|
+
|
|
16
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/sql-script/queries/index.ts"],"sourcesContent":["import COCKROACHDB_QUERIES from \"./cockroachdb.json\";\nimport MYSQL_QUERIES from \"./mysql.query.json\";\nimport POSTGRES_QUERIES from \"./postgres.query.json\";\n\nexport const DB_QUERIES = {\n mysql: MYSQL_QUERIES,\n mariadb: MYSQL_QUERIES,\n postgres: POSTGRES_QUERIES,\n cockroachdb: COCKROACHDB_QUERIES,\n};\n\nexport type AllowedDataBases = keyof typeof DB_QUERIES;\nexport type Queries = (typeof DB_QUERIES)[AllowedDataBases];\n"],"names":["DB_QUERIES","mysql","MYSQL_QUERIES","mariadb","postgres","POSTGRES_QUERIES","cockroachdb","COCKROACHDB_QUERIES"],"mappings":";;;;+BAIaA;;;eAAAA;;;wEAJmB;uEACN;0EACG;;;;;;AAEtB,MAAMA,aAAa;IACxBC,OAAOC,uBAAa;IACpBC,SAASD,uBAAa;IACtBE,UAAUC,0BAAgB;IAC1BC,aAAaC,wBAAmB;AAClC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
"dependencyTree": "-- NOT USED",
|
|
3
|
+
"foreignKey": {
|
|
4
|
+
"disable": "SET FOREIGN_KEY_CHECKS=0",
|
|
5
|
+
"enable": "SET FOREIGN_KEY_CHECKS=1"
|
|
6
|
+
},
|
|
7
|
+
"getTables": "SELECT table_name AS name FROM information_schema.tables WHERE table_schema = DATABASE() AND table_type = 'BASE TABLE'",
|
|
8
|
+
"createTempTable": "CREATE TEMPORARY TABLE {{tableName}}_temp AS SELECT * FROM {{tableName}}",
|
|
9
|
+
"dropTempTable": "DROP TEMPORARY TABLE {{tableName}}_temp",
|
|
10
|
+
"restoreData": "INSERT INTO {{tableName}} SELECT * FROM {{tableName}}_temp",
|
|
11
|
+
"truncateTable": "TRUNCATE TABLE {{tableName}}",
|
|
12
|
+
"getColumnsWithAutoIncrement": "-- NOT USED",
|
|
13
|
+
"resetAutoIncrementColumn": "-- NOT USED",
|
|
14
|
+
"getMaxColumnIndex": "-- NOT USED"
|
|
15
15
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
"dependencyTree": "-- NOT USED",
|
|
3
|
+
"foreignKey": {
|
|
4
|
+
"disable": "DO $$ DECLARE table_name text; BEGIN FOR table_name IN (SELECT tablename FROM pg_tables WHERE schemaname = current_schema()) LOOP EXECUTE 'ALTER TABLE \"' || table_name || '\" DISABLE TRIGGER ALL;'; END LOOP; END $$;",
|
|
5
|
+
"enable": "DO $$ DECLARE table_name text; BEGIN FOR table_name IN (SELECT tablename FROM pg_tables WHERE schemaname = current_schema()) LOOP EXECUTE 'ALTER TABLE \"' || table_name || '\" ENABLE TRIGGER ALL;'; END LOOP; END $$;"
|
|
6
|
+
},
|
|
7
|
+
"getTables": "SELECT table_name AS name FROM information_schema.tables WHERE table_schema = CURRENT_SCHEMA() AND table_type = 'BASE TABLE'",
|
|
8
|
+
"createTempTable": "CREATE TEMPORARY TABLE \"{{tableName}}_temp\" AS SELECT * FROM \"{{tableName}}\"",
|
|
9
|
+
"dropTempTable": "DROP TABLE IF EXISTS \"{{tableName}}_temp\"",
|
|
10
|
+
"restoreData": "INSERT INTO \"{{tableName}}\" SELECT * FROM \"{{tableName}}_temp\";",
|
|
11
|
+
"truncateTable": "TRUNCATE TABLE \"{{tableName}}\" RESTART IDENTITY CASCADE",
|
|
12
|
+
"getColumnsWithAutoIncrement": "SELECT column_name, column_default FROM information_schema.columns WHERE table_schema = 'public' AND column_default LIKE 'nextval%' AND table_name = '{{tableName}}'",
|
|
13
|
+
"resetAutoIncrementColumn": "ALTER SEQUENCE \"{{sequenceName}}\" RESTART WITH {{index}};",
|
|
14
|
+
"getMaxColumnIndex": "SELECT MAX({{column_name}}) AS maxindex FROM \"{{tableName}}\""
|
|
15
15
|
}
|
|
@@ -1,28 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
throw new Error(`The database type provided is not supported. Please choose from the following: ${Object.keys(queries_1.DB_QUERIES)}`);
|
|
10
|
-
}
|
|
11
|
-
this.queries = queries_1.DB_QUERIES[this.type];
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "SQLScript", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return SQLScript;
|
|
12
9
|
}
|
|
10
|
+
});
|
|
11
|
+
const _queries = require("./queries");
|
|
12
|
+
function _define_property(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value: value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
25
|
+
class SQLScript {
|
|
13
26
|
getType() {
|
|
14
27
|
return this.type;
|
|
15
28
|
}
|
|
16
29
|
execQuery(em, queryPath, values) {
|
|
17
|
-
const queryObj = queryPath
|
|
18
|
-
.split(".")
|
|
19
|
-
.reduce((obj, key) => obj[key], this.queries);
|
|
30
|
+
const queryObj = queryPath.split(".").reduce((obj, key)=>obj[key], this.queries);
|
|
20
31
|
let query = queryObj;
|
|
21
|
-
for
|
|
32
|
+
for(const key in values){
|
|
22
33
|
query = query.replace(new RegExp(`{{\\s*${key}\\s*}}`, "g"), values[key]);
|
|
23
34
|
}
|
|
24
35
|
return em.query(query);
|
|
25
36
|
}
|
|
37
|
+
constructor(type){
|
|
38
|
+
_define_property(this, "type", void 0);
|
|
39
|
+
_define_property(this, "queries", void 0);
|
|
40
|
+
this.type = type;
|
|
41
|
+
if (!(this.type in _queries.DB_QUERIES)) {
|
|
42
|
+
throw new Error(`The database type provided is not supported. Please choose from the following: ${Object.keys(_queries.DB_QUERIES)}`);
|
|
43
|
+
}
|
|
44
|
+
this.queries = _queries.DB_QUERIES[this.type];
|
|
45
|
+
}
|
|
26
46
|
}
|
|
27
|
-
|
|
47
|
+
|
|
28
48
|
//# sourceMappingURL=sql-script.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/core/sql-script/sql-script.ts"],"sourcesContent":["import { DataSourceOptions, EntityManager } from \"typeorm\";\nimport { AllowedDataBases, DB_QUERIES, Queries } from \"./queries\";\nimport { QueryPath } from \"./types\";\n\ntype DBTypes = DataSourceOptions[\"type\"];\n\nexport class SQLScript {\n private queries: Queries;\n\n protected constructor(private readonly type: DBTypes) {\n if (!(this.type in DB_QUERIES)) {\n throw new Error(\n `The database type provided is not supported. Please choose from the following: ${Object.keys(\n DB_QUERIES\n )}`\n );\n }\n\n this.queries = DB_QUERIES[this.type as AllowedDataBases];\n }\n\n protected getType(): DBTypes {\n return this.type;\n }\n\n protected execQuery<T = void>(\n em: EntityManager,\n queryPath: QueryPath<Queries>,\n values?: Record<string, string>\n ): T extends void ? Promise<void> : Promise<T[]> {\n const queryObj = queryPath\n .split(\".\")\n .reduce((obj: any, key) => obj[key], this.queries);\n\n let query = queryObj;\n\n for (const key in values) {\n query = query.replace(new RegExp(`{{\\\\s*${key}\\\\s*}}`, \"g\"), values[key]);\n }\n\n return em.query(query) as T extends void ? Promise<void> : Promise<T[]>;\n }\n}\n"],"names":["SQLScript","getType","type","execQuery","em","queryPath","values","queryObj","split","reduce","obj","key","queries","query","replace","RegExp","DB_QUERIES","Error","Object","keys"],"mappings":";;;;+BAMaA;;;eAAAA;;;yBALyC;;;;;;;;;;;;;;AAK/C,MAAMA;IAeDC,UAAmB;QAC3B,OAAO,IAAI,CAACC,IAAI;IAClB;IAEUC,UACRC,EAAiB,EACjBC,SAA6B,EAC7BC,MAA+B,EACgB;QAC/C,MAAMC,WAAWF,UACdG,KAAK,CAAC,KACNC,MAAM,CAAC,CAACC,KAAUC,MAAQD,GAAG,CAACC,IAAI,EAAE,IAAI,CAACC,OAAO;QAEnD,IAAIC,QAAQN;QAEZ,IAAK,MAAMI,OAAOL,OAAQ;YACxBO,QAAQA,MAAMC,OAAO,CAAC,IAAIC,OAAO,CAAC,MAAM,EAAEJ,IAAI,MAAM,CAAC,EAAE,MAAML,MAAM,CAACK,IAAI;QAC1E;QAEA,OAAOP,GAAGS,KAAK,CAACA;IAClB;IAhCA,YAAsB,AAAiBX,IAAa,CAAE;;QAFtD,uBAAQU,WAAR,KAAA;aAEuCV,OAAAA;QACrC,IAAI,CAAE,CAAA,IAAI,CAACA,IAAI,IAAIc,mBAAU,AAAD,GAAI;YAC9B,MAAM,IAAIC,MACR,CAAC,+EAA+E,EAAEC,OAAOC,IAAI,CAC3FH,mBAAU,GACT;QAEP;QAEA,IAAI,CAACJ,OAAO,GAAGI,mBAAU,CAAC,IAAI,CAACd,IAAI,CAAqB;IAC1D;AAuBF"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./query-path"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
19
|
+
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/sql-script/types/index.ts"],"sourcesContent":["export * from \"./query-path\";\n"],"names":[],"mappings":";;;;qBAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/sql-script/types/query-path.ts"],"names":[],"mappings":""}
|
package/dist/core/types.js
CHANGED
package/dist/core/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/core/types.ts"],"names":[],"mappings":""}
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./core"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
19
|
+
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./core\";\n"],"names":[],"mappings":";;;;qBAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastypest",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.107",
|
|
4
4
|
"description": "Restores the database automatically after each test. Allows serial execution of tests without having to delete and restore the database having to stop the application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"setup": "lefthook install",
|
|
17
17
|
"prebuild": "rimraf dist",
|
|
18
|
-
"build": "tsc",
|
|
18
|
+
"build": "swc ./src -d ./dist --strip-leading-paths && tsc --emitDeclarationOnly --outDir dist && cpy \"src/**/*.json\" dist --parents && rimraf dist/src",
|
|
19
19
|
"eslint": "eslint --fix",
|
|
20
|
-
"test:ci": "jest --runInBand --forceExit --verbose --showSeed --config ./tests/jest.config.json",
|
|
20
|
+
"test:ci": "jest --ci --runInBand --forceExit --verbose --showSeed --config ./tests/jest.config.json",
|
|
21
21
|
"test": "yarn build && yarn test:ci",
|
|
22
22
|
"docker": "ts-node -r tsconfig-paths/register scripts/prepare-docker.ts",
|
|
23
23
|
"release": "standard-version"
|
|
@@ -51,22 +51,26 @@
|
|
|
51
51
|
"homepage": "https://github.com/juanjoGonDev/fastypest#readme",
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@eslint/js": "^9.27.0",
|
|
54
|
-
"@
|
|
54
|
+
"@swc-node/jest": "^1.8.13",
|
|
55
|
+
"@swc/cli": "^0.7.7",
|
|
56
|
+
"@swc/core": "^1.11.29",
|
|
57
|
+
"@swc/helpers": "^0.5.17",
|
|
55
58
|
"@types/jest": "^29.5.14",
|
|
56
|
-
"@types/node": "^22.15.
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
58
|
-
"@typescript-eslint/parser": "^8.
|
|
59
|
-
"
|
|
59
|
+
"@types/node": "^22.15.24",
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^8.33.0",
|
|
61
|
+
"@typescript-eslint/parser": "^8.33.0",
|
|
62
|
+
"cpy-cli": "^5.0.0",
|
|
60
63
|
"eslint": "^9.27.0",
|
|
61
64
|
"eslint-config-standard-with-typescript": "^43.0.1",
|
|
62
65
|
"eslint-plugin-import": "^2.31.0",
|
|
63
66
|
"eslint-plugin-n": "^17.18.0",
|
|
64
67
|
"eslint-plugin-prettier": "^5.4.0",
|
|
65
68
|
"eslint-plugin-promise": "^7.2.1",
|
|
66
|
-
"
|
|
69
|
+
"execa": "^9.6.0",
|
|
70
|
+
"globals": "^16.2.0",
|
|
67
71
|
"jest": "^29.7.0",
|
|
68
72
|
"lefthook": "^1.11.13",
|
|
69
|
-
"lint-staged": "^16.
|
|
73
|
+
"lint-staged": "^16.1.0",
|
|
70
74
|
"mariadb": "^3.4.2",
|
|
71
75
|
"mysql": "^2.18.1",
|
|
72
76
|
"pg": "^8.16.0",
|
|
@@ -74,12 +78,10 @@
|
|
|
74
78
|
"reflect-metadata": "^0.2.2",
|
|
75
79
|
"rimraf": "^6.0.1",
|
|
76
80
|
"standard-version": "^9.5.0",
|
|
77
|
-
"ts-jest": "^29.3.4",
|
|
78
|
-
"ts-node": "^10.9.2",
|
|
79
81
|
"tsconfig-paths": "^4.2.0",
|
|
80
82
|
"typeorm": "^0.3.24",
|
|
81
83
|
"typescript": "^5.8.3",
|
|
82
|
-
"typescript-eslint": "^8.
|
|
84
|
+
"typescript-eslint": "^8.33.0"
|
|
83
85
|
},
|
|
84
86
|
"peerDependencies": {
|
|
85
87
|
"typeorm": "^0.3.24"
|