@dbcube/cli 1.1.2 → 1.1.4
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/.lh/.lhignore +6 -6
- package/.lh/package.json.json +25 -25
- package/package.json +3 -3
- package/src/commands/run/trigger/fresh.js +75 -75
package/.lh/.lhignore
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# list file to not track by the local-history extension. comment line starts with a '#' character
|
|
2
|
-
# each line describe a regular expression pattern (search for 'Javascript regex')
|
|
3
|
-
# it will relate to the workspace directory root. for example:
|
|
4
|
-
# '.*\.txt' ignores any file with 'txt' extension
|
|
5
|
-
# '/test/.*' ignores all the files under the 'test' directory
|
|
6
|
-
# '.*/test/.*' ignores all the files under any 'test' directory (even under sub-folders)
|
|
1
|
+
# list file to not track by the local-history extension. comment line starts with a '#' character
|
|
2
|
+
# each line describe a regular expression pattern (search for 'Javascript regex')
|
|
3
|
+
# it will relate to the workspace directory root. for example:
|
|
4
|
+
# '.*\.txt' ignores any file with 'txt' extension
|
|
5
|
+
# '/test/.*' ignores all the files under the 'test' directory
|
|
6
|
+
# '.*/test/.*' ignores all the files under any 'test' directory (even under sub-folders)
|
package/.lh/package.json.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
{
|
|
2
|
-
"sourceFile": "package.json",
|
|
3
|
-
"activeCommit": 0,
|
|
4
|
-
"commits": [
|
|
5
|
-
{
|
|
6
|
-
"activePatchIndex": 2,
|
|
7
|
-
"patches": [
|
|
8
|
-
{
|
|
9
|
-
"date": 1756705588331,
|
|
10
|
-
"content": "Index: \n===================================================================\n--- \n+++ \n"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"date": 1756705654448,
|
|
14
|
-
"content": "Index: \n===================================================================\n--- \n+++ \n@@ -13,9 +13,8 @@\n \"author\": \"\",\n \"license\": \"ISC\",\n \"description\": \"\",\n \"dependencies\": {\n- \"@dbcube/schema-builder\": \"^1.0.0\",\n \"@inquirer/prompts\": \"^7.4.1\",\n \"alwait\": \"^1.0.0\",\n \"chalk\": \"^5.4.1\",\n \"dotenv\": \"^17.0.1\",\n"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"date": 1756706224795,
|
|
18
|
-
"content": "Index: \n===================================================================\n--- \n+++ \n@@ -2,9 +2,8 @@\n \"name\": \"dbcube\",\n \"version\": \"1.0.1\",\n \"main\": \"index.js\",\n \"scripts\": {\n- \"start\": \"node example.js\",\n \"dbcube\": \"node src/index.js\"\n },\n \"bin\": {\n \"dbcube\": \"./src/index.js\"\n"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"date": 1756705588331,
|
|
22
|
-
"name": "Commit-0",
|
|
23
|
-
"content": "{\n \"name\": \"dbcube\",\n \"version\": \"1.0.0\",\n \"main\": \"index.js\",\n \"scripts\": {\n \"start\": \"node example.js\",\n \"dbcube\": \"node src/index.js\"\n },\n \"bin\": {\n \"dbcube\": \"./src/index.js\"\n },\n \"keywords\": [],\n \"author\": \"\",\n \"license\": \"ISC\",\n \"description\": \"\",\n \"dependencies\": {\n \"@inquirer/prompts\": \"^7.4.1\",\n \"alwait\": \"^1.0.0\",\n \"chalk\": \"^5.4.1\",\n \"dotenv\": \"^17.0.1\",\n \"fs-extra\": \"^11.3.0\",\n \"glob\": \"^11.0.1\",\n \"ora\": \"^8.2.0\"\n }\n}\n"
|
|
24
|
-
}
|
|
25
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"sourceFile": "package.json",
|
|
3
|
+
"activeCommit": 0,
|
|
4
|
+
"commits": [
|
|
5
|
+
{
|
|
6
|
+
"activePatchIndex": 2,
|
|
7
|
+
"patches": [
|
|
8
|
+
{
|
|
9
|
+
"date": 1756705588331,
|
|
10
|
+
"content": "Index: \n===================================================================\n--- \n+++ \n"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"date": 1756705654448,
|
|
14
|
+
"content": "Index: \n===================================================================\n--- \n+++ \n@@ -13,9 +13,8 @@\n \"author\": \"\",\n \"license\": \"ISC\",\n \"description\": \"\",\n \"dependencies\": {\n- \"@dbcube/schema-builder\": \"^1.0.0\",\n \"@inquirer/prompts\": \"^7.4.1\",\n \"alwait\": \"^1.0.0\",\n \"chalk\": \"^5.4.1\",\n \"dotenv\": \"^17.0.1\",\n"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"date": 1756706224795,
|
|
18
|
+
"content": "Index: \n===================================================================\n--- \n+++ \n@@ -2,9 +2,8 @@\n \"name\": \"dbcube\",\n \"version\": \"1.0.1\",\n \"main\": \"index.js\",\n \"scripts\": {\n- \"start\": \"node example.js\",\n \"dbcube\": \"node src/index.js\"\n },\n \"bin\": {\n \"dbcube\": \"./src/index.js\"\n"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"date": 1756705588331,
|
|
22
|
+
"name": "Commit-0",
|
|
23
|
+
"content": "{\n \"name\": \"dbcube\",\n \"version\": \"1.0.0\",\n \"main\": \"index.js\",\n \"scripts\": {\n \"start\": \"node example.js\",\n \"dbcube\": \"node src/index.js\"\n },\n \"bin\": {\n \"dbcube\": \"./src/index.js\"\n },\n \"keywords\": [],\n \"author\": \"\",\n \"license\": \"ISC\",\n \"description\": \"\",\n \"dependencies\": {\n \"@inquirer/prompts\": \"^7.4.1\",\n \"alwait\": \"^1.0.0\",\n \"chalk\": \"^5.4.1\",\n \"dotenv\": \"^17.0.1\",\n \"fs-extra\": \"^11.3.0\",\n \"glob\": \"^11.0.1\",\n \"ora\": \"^8.2.0\"\n }\n}\n"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbcube/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dbcube": "node src/index.js"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"description": "",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@dbcube/schema-builder": "^1.0.
|
|
16
|
+
"@dbcube/schema-builder": "^1.0.5",
|
|
17
17
|
"@inquirer/prompts": "^7.8.4",
|
|
18
18
|
"alwait": "^1.0.0",
|
|
19
19
|
"chalk": "^5.6.0",
|
|
@@ -22,4 +22,4 @@
|
|
|
22
22
|
"glob": "^11.0.3",
|
|
23
23
|
"ora": "^8.2.0"
|
|
24
24
|
}
|
|
25
|
-
}
|
|
25
|
+
}
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
const { default: Schema } = require('@dbcube/schema-builder');
|
|
2
|
-
const ConfigFileUtils = require('./../../../utils/ConfigFileUtils');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const FileUtils = require('./../../../utils/FileUtils');
|
|
6
|
-
const { default: chalk } = require('chalk');
|
|
7
|
-
const { default: ora } = require('ora');
|
|
8
|
-
const { default: alwait } = require('alwait');
|
|
9
|
-
|
|
10
|
-
async function main() {
|
|
11
|
-
// Suprimir logs de dotenv
|
|
12
|
-
process.env.DOTENV_SILENT = 'true';
|
|
13
|
-
|
|
14
|
-
console.clear();
|
|
15
|
-
console.log(`\n⚡ ${chalk.green("Ejecutando triggers...")}`);
|
|
16
|
-
try {
|
|
17
|
-
// Verificar y leer archivos de la carpeta cubes
|
|
18
|
-
const spinner = ora('Preparando ejecución de triggers...').start();
|
|
19
|
-
await alwait(500);
|
|
20
|
-
const cubesDir = path.join(process.cwd(), 'dbcube', 'cubes');
|
|
21
|
-
|
|
22
|
-
// Verificar si la carpeta existe
|
|
23
|
-
if (!fs.existsSync(cubesDir)) {
|
|
24
|
-
spinner.fail('Carpeta de cubes no encontrada');
|
|
25
|
-
throw new Error('❌ The cubes folder does not exist');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Leer todos los archivos en la carpeta
|
|
29
|
-
const cubeFiles = FileUtils.getCubeFilesRecursively('dbcube', 'table.cube')
|
|
30
|
-
|
|
31
|
-
if (cubeFiles.length === 0) {
|
|
32
|
-
spinner.fail('No hay cubes para ejecutar');
|
|
33
|
-
throw new Error('❌ There are no cubes to execute');
|
|
34
|
-
} else {
|
|
35
|
-
spinner.succeed('Cubes encontrados correctamente');
|
|
36
|
-
|
|
37
|
-
const loadingSpinner = ora('Cargando configuraciones de base de datos...').start();
|
|
38
|
-
let countTableCreated = 0;
|
|
39
|
-
const configuredDatabases = await ConfigFileUtils.getConfiguredDatabases();
|
|
40
|
-
loadingSpinner.succeed(`Configuraciones cargadas (${configuredDatabases.length} bases de datos)`);
|
|
41
|
-
|
|
42
|
-
// Recorrer cada archivo y mostrar su contenido
|
|
43
|
-
for (const config of configuredDatabases) {
|
|
44
|
-
const triggerSpinner = ora(`Ejecutando triggers para: ${config.name} (${config.type})...`).start();
|
|
45
|
-
const schema = new Schema(config.name);
|
|
46
|
-
await schema.executeTriggers();
|
|
47
|
-
triggerSpinner.succeed(`Triggers ejecutados para: ${config.name}`);
|
|
48
|
-
countTableCreated++;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if(countTableCreated==0) {
|
|
52
|
-
console.log(`\n⚠️ ${chalk.yellow('No hay triggers para ejecutar.')}`);
|
|
53
|
-
} else {
|
|
54
|
-
console.log(`\n🎉 ${chalk.green(`Triggers ejecutados exitosamente en ${countTableCreated} base(s) de datos!`)}`);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
} catch (error) {
|
|
59
|
-
if(error.message.includes("reading 'init'")){
|
|
60
|
-
console.error('❌ Configuracion de base de datos no encontrada\n');
|
|
61
|
-
console.error('Ejecute el comando para crear una nueva base de datos:');
|
|
62
|
-
console.error(`\tdbcube run create:database`);
|
|
63
|
-
console.error('\nO verifique que la base de datos este configurada en el archivo dbcube.config.js\n');
|
|
64
|
-
process.exit(1);
|
|
65
|
-
} else if(error.message.includes("reading 'getDatabase'")){
|
|
66
|
-
console.error('- Se sugiere cambiar el linea o crear la base de datos a la que se hace referencia.');
|
|
67
|
-
}else{
|
|
68
|
-
console.error('Error aqui:', error);
|
|
69
|
-
console.error('Error aqui:', error.message);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
console.log('\n');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Ejecutar el ejemplo
|
|
1
|
+
const { default: Schema } = require('@dbcube/schema-builder');
|
|
2
|
+
const ConfigFileUtils = require('./../../../utils/ConfigFileUtils');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const FileUtils = require('./../../../utils/FileUtils');
|
|
6
|
+
const { default: chalk } = require('chalk');
|
|
7
|
+
const { default: ora } = require('ora');
|
|
8
|
+
const { default: alwait } = require('alwait');
|
|
9
|
+
|
|
10
|
+
async function main() {
|
|
11
|
+
// Suprimir logs de dotenv
|
|
12
|
+
process.env.DOTENV_SILENT = 'true';
|
|
13
|
+
|
|
14
|
+
console.clear();
|
|
15
|
+
console.log(`\n⚡ ${chalk.green("Ejecutando triggers...")}`);
|
|
16
|
+
try {
|
|
17
|
+
// Verificar y leer archivos de la carpeta cubes
|
|
18
|
+
const spinner = ora('Preparando ejecución de triggers...').start();
|
|
19
|
+
await alwait(500);
|
|
20
|
+
const cubesDir = path.join(process.cwd(), 'dbcube', 'cubes');
|
|
21
|
+
|
|
22
|
+
// Verificar si la carpeta existe
|
|
23
|
+
if (!fs.existsSync(cubesDir)) {
|
|
24
|
+
spinner.fail('Carpeta de cubes no encontrada');
|
|
25
|
+
throw new Error('❌ The cubes folder does not exist');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Leer todos los archivos en la carpeta
|
|
29
|
+
const cubeFiles = FileUtils.getCubeFilesRecursively('dbcube', 'table.cube')
|
|
30
|
+
|
|
31
|
+
if (cubeFiles.length === 0) {
|
|
32
|
+
spinner.fail('No hay cubes para ejecutar');
|
|
33
|
+
throw new Error('❌ There are no cubes to execute');
|
|
34
|
+
} else {
|
|
35
|
+
spinner.succeed('Cubes encontrados correctamente');
|
|
36
|
+
|
|
37
|
+
const loadingSpinner = ora('Cargando configuraciones de base de datos...').start();
|
|
38
|
+
let countTableCreated = 0;
|
|
39
|
+
const configuredDatabases = await ConfigFileUtils.getConfiguredDatabases();
|
|
40
|
+
loadingSpinner.succeed(`Configuraciones cargadas (${configuredDatabases.length} bases de datos)`);
|
|
41
|
+
|
|
42
|
+
// Recorrer cada archivo y mostrar su contenido
|
|
43
|
+
for (const config of configuredDatabases) {
|
|
44
|
+
const triggerSpinner = ora(`Ejecutando triggers para: ${config.name} (${config.type})...`).start();
|
|
45
|
+
const schema = new Schema(config.name);
|
|
46
|
+
await schema.executeTriggers();
|
|
47
|
+
triggerSpinner.succeed(`Triggers ejecutados para: ${config.name}`);
|
|
48
|
+
countTableCreated++;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if(countTableCreated==0) {
|
|
52
|
+
console.log(`\n⚠️ ${chalk.yellow('No hay triggers para ejecutar.')}`);
|
|
53
|
+
} else {
|
|
54
|
+
console.log(`\n🎉 ${chalk.green(`Triggers ejecutados exitosamente en ${countTableCreated} base(s) de datos!`)}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
} catch (error) {
|
|
59
|
+
if(error.message.includes("reading 'init'")){
|
|
60
|
+
console.error('❌ Configuracion de base de datos no encontrada\n');
|
|
61
|
+
console.error('Ejecute el comando para crear una nueva base de datos:');
|
|
62
|
+
console.error(`\tdbcube run create:database`);
|
|
63
|
+
console.error('\nO verifique que la base de datos este configurada en el archivo dbcube.config.js\n');
|
|
64
|
+
process.exit(1);
|
|
65
|
+
} else if(error.message.includes("reading 'getDatabase'")){
|
|
66
|
+
console.error('- Se sugiere cambiar el linea o crear la base de datos a la que se hace referencia.');
|
|
67
|
+
}else{
|
|
68
|
+
console.error('Error aqui:', error);
|
|
69
|
+
console.error('Error aqui:', error.message);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
console.log('\n');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Ejecutar el ejemplo
|
|
76
76
|
main().catch(console.error);
|