@omnibase/cli 0.0.1 → 0.1.0
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/commands/auth.d.ts +6 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +98 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/cloud.d.ts +10 -0
- package/dist/commands/cloud.d.ts.map +1 -0
- package/dist/commands/cloud.js +435 -0
- package/dist/commands/cloud.js.map +1 -0
- package/dist/commands/db.d.ts +10 -0
- package/dist/commands/db.d.ts.map +1 -0
- package/dist/commands/db.js +373 -0
- package/dist/commands/db.js.map +1 -0
- package/dist/commands/email.d.ts +4 -0
- package/dist/commands/email.d.ts.map +1 -1
- package/dist/commands/email.js +59 -28
- package/dist/commands/email.js.map +1 -1
- package/dist/commands/environment.d.ts.map +1 -1
- package/dist/commands/environment.js +7 -52
- package/dist/commands/environment.js.map +1 -1
- package/dist/commands/migrate.d.ts +6 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +204 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/permissions.d.ts +7 -17
- package/dist/commands/permissions.d.ts.map +1 -1
- package/dist/commands/permissions.js +133 -104
- package/dist/commands/permissions.js.map +1 -1
- package/dist/commands/restart.d.ts +3 -0
- package/dist/commands/restart.d.ts.map +1 -0
- package/dist/commands/restart.js +245 -0
- package/dist/commands/restart.js.map +1 -0
- package/dist/commands/stripe.d.ts +4 -0
- package/dist/commands/stripe.d.ts.map +1 -1
- package/dist/commands/stripe.js +150 -98
- package/dist/commands/stripe.js.map +1 -1
- package/dist/commands/sync.d.ts +3 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +144 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/workers.d.ts +3 -0
- package/dist/commands/workers.d.ts.map +1 -0
- package/dist/commands/workers.js +133 -0
- package/dist/commands/workers.js.map +1 -0
- package/dist/config/services.d.ts +19 -0
- package/dist/config/services.d.ts.map +1 -0
- package/dist/config/services.js +34 -0
- package/dist/config/services.js.map +1 -0
- package/dist/index.js +48 -32
- package/dist/index.js.map +1 -1
- package/dist/utils/api-client.d.ts +16 -0
- package/dist/utils/api-client.d.ts.map +1 -0
- package/dist/utils/api-client.js +66 -0
- package/dist/utils/api-client.js.map +1 -0
- package/dist/utils/context.d.ts +22 -0
- package/dist/utils/context.d.ts.map +1 -0
- package/dist/utils/context.js +30 -0
- package/dist/utils/context.js.map +1 -0
- package/dist/utils/credentials.d.ts +19 -0
- package/dist/utils/credentials.d.ts.map +1 -0
- package/dist/utils/credentials.js +77 -0
- package/dist/utils/credentials.js.map +1 -0
- package/dist/utils/environment.d.ts +14 -4
- package/dist/utils/environment.d.ts.map +1 -1
- package/dist/utils/environment.js +65 -21
- package/dist/utils/environment.js.map +1 -1
- package/dist/utils/errors.d.ts +3 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +30 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +66 -0
- package/dist/utils/logger.js.map +1 -0
- package/docker/db/{001-seed.sql → 000001_seed.up.sql} +1 -0
- package/docker/db/{002-rls.sql → 000002_rls.up.sql} +53 -5
- package/docker/db/000003_keto.up.sql +1 -0
- package/docker/db/000005_neon_rls.up.sql +23 -0
- package/docker/db/000006_db_events.up.sql +28 -0
- package/docker/db/000007_add_rbac_system.up.sql +33 -0
- package/docker/db/000008_stripe_id_history.up.sql +2 -0
- package/docker/db/000009_not_null_fix.up.sql +15 -0
- package/docker/db/000010_add_role_templates.up.sql +29 -0
- package/docker/db/000011_add_subject_relations.up.sql +7 -0
- package/docker/docker-compose.dev.yml +40 -50
- package/docker/docker-compose.yml +82 -75
- package/docker/permissions/namespaces/2025-12-11T03:42:51.799Z-permissions.ts +101 -0
- package/package.json +12 -7
- package/templates/.omnibase-config +1 -1
- package/templates/db/README.md +91 -0
- package/templates/environments/.env.dev +8 -31
- package/templates/environments/.env.local +35 -0
- package/templates/environments/.env.prod +8 -9
- package/templates/environments/.env.staging +8 -9
- package/templates/permissions/roles.config.json +38 -0
- package/templates/permissions/tenants.ts +20 -12
- package/templates/{edge → workers}/package.json +1 -0
- package/templates/{edge → workers}/src/index.ts +3 -1
- package/docker/db/003-keto.sql +0 -1
- package/templates/edge/dev.ts +0 -13
- /package/docker/db/{004-email.sql → 000004_email.up.sql} +0 -0
- /package/templates/{stripe.config.json → payments/example.config.json} +0 -0
- /package/templates/{edge → workers}/bun.lock +0 -0
- /package/templates/{edge → workers}/tsconfig.json +0 -0
- /package/templates/{edge → workers}/wrangler.toml +0 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.addDbCommands = addDbCommands;
|
|
40
|
+
exports.pushDbMigrations = pushDbMigrations;
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
// @ts-ignore - adm-zip doesn't have types
|
|
44
|
+
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
45
|
+
const environment_1 = require("../utils/environment");
|
|
46
|
+
const logger_1 = require("../utils/logger");
|
|
47
|
+
const errors_1 = require("../utils/errors");
|
|
48
|
+
const context_1 = require("../utils/context");
|
|
49
|
+
/**
|
|
50
|
+
* Add database commands to the CLI
|
|
51
|
+
*/
|
|
52
|
+
function addDbCommands(program) {
|
|
53
|
+
const db = program.command("db").description("Database management commands");
|
|
54
|
+
// Migration subcommands
|
|
55
|
+
const migrate = db
|
|
56
|
+
.command("migrate")
|
|
57
|
+
.description("Database migration commands");
|
|
58
|
+
migrate
|
|
59
|
+
.command("new")
|
|
60
|
+
.description("Create a new migration file")
|
|
61
|
+
.option("-d, --dir <directory>", "Directory to create migration file in", "omnibase/db")
|
|
62
|
+
.option("-n, --name <name>", "Migration name (will prompt if not provided)")
|
|
63
|
+
.action(async (options) => {
|
|
64
|
+
try {
|
|
65
|
+
await createMigration(options.dir, options.name);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
(0, errors_1.handleCommandError)(error);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
migrate
|
|
72
|
+
.command("push")
|
|
73
|
+
.description("Push migrations from the db directory")
|
|
74
|
+
.option("-d, --dir <directory>", "Directory containing migration files", "omnibase/db")
|
|
75
|
+
.action(async (options) => {
|
|
76
|
+
try {
|
|
77
|
+
const ctx = await (0, context_1.getCommandContextWithEnv)(program);
|
|
78
|
+
logger_1.logger.info(`Using environment: ${ctx.env.name}`);
|
|
79
|
+
if (!ctx.env.omnibaseServiceKey) {
|
|
80
|
+
throw new Error("OMNIBASE_SERVICE_KEY not found in environment configuration");
|
|
81
|
+
}
|
|
82
|
+
await applyMigrations(ctx.env.omnibaseApiUrl, ctx.env.omnibaseServiceKey, options.dir);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
(0, errors_1.handleCommandError)(error);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
migrate
|
|
89
|
+
.command("reset")
|
|
90
|
+
.description("Reset database: drop all tables and re-apply migrations (DESTRUCTIVE)")
|
|
91
|
+
.option("-d, --dir <directory>", "Directory containing migration files", "omnibase/db")
|
|
92
|
+
.option("-y, --yes", "Skip confirmation prompt")
|
|
93
|
+
.action(async (options) => {
|
|
94
|
+
try {
|
|
95
|
+
const ctx = await (0, context_1.getCommandContextWithEnv)(program);
|
|
96
|
+
logger_1.logger.info(`Using environment: ${ctx.env.name}`);
|
|
97
|
+
if (!ctx.env.omnibaseServiceKey) {
|
|
98
|
+
throw new Error("OMNIBASE_SERVICE_KEY not found in environment configuration");
|
|
99
|
+
}
|
|
100
|
+
// Confirm with user unless --yes flag is provided
|
|
101
|
+
if (!options.yes) {
|
|
102
|
+
const readline = await Promise.resolve().then(() => __importStar(require("readline")));
|
|
103
|
+
const rl = readline.createInterface({
|
|
104
|
+
input: process.stdin,
|
|
105
|
+
output: process.stdout,
|
|
106
|
+
});
|
|
107
|
+
const confirmed = await new Promise((resolve) => {
|
|
108
|
+
rl.question("\x1b[31mWARNING: This will DROP ALL TABLES and re-apply migrations.\x1b[0m\nAll data will be lost. Are you sure? (yes/no): ", (answer) => {
|
|
109
|
+
resolve(answer.toLowerCase() === "yes");
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
rl.close();
|
|
113
|
+
if (!confirmed) {
|
|
114
|
+
logger_1.logger.info("Reset cancelled");
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
await resetMigrations(ctx.env.omnibaseApiUrl, ctx.env.omnibaseServiceKey, options.dir);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
(0, errors_1.handleCommandError)(error);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
// Typegen command
|
|
125
|
+
db.command("typegen")
|
|
126
|
+
.description("Generate TypeScript types from database schema")
|
|
127
|
+
.option("-o, --output <path>", "Output file path", "omnibase/types/database.ts")
|
|
128
|
+
.option("-s, --schema <schemas>", "Comma-separated list of schemas to include", "public")
|
|
129
|
+
.action(async (options) => {
|
|
130
|
+
try {
|
|
131
|
+
const ctx = await (0, context_1.getCommandContextWithEnv)(program);
|
|
132
|
+
logger_1.logger.info(`Using environment: ${ctx.env.name}`);
|
|
133
|
+
await generateTypes(ctx.env, options.output, options.schema);
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
(0, errors_1.handleCommandError)(error);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Create a new migration file with timestamp prefix
|
|
142
|
+
*/
|
|
143
|
+
async function createMigration(migrationsDir, name) {
|
|
144
|
+
const projectRoot = (0, environment_1.findOmnibaseRoot)();
|
|
145
|
+
const migrationsPath = path.join(projectRoot, migrationsDir);
|
|
146
|
+
// Ensure migrations directory exists
|
|
147
|
+
if (!fs.existsSync(migrationsPath)) {
|
|
148
|
+
fs.mkdirSync(migrationsPath, { recursive: true });
|
|
149
|
+
logger_1.logger.info(`Created migrations directory: ${migrationsPath}`);
|
|
150
|
+
}
|
|
151
|
+
// Get migration name from user if not provided
|
|
152
|
+
let migrationName = name;
|
|
153
|
+
if (!migrationName) {
|
|
154
|
+
const readline = await Promise.resolve().then(() => __importStar(require("readline")));
|
|
155
|
+
const rl = readline.createInterface({
|
|
156
|
+
input: process.stdin,
|
|
157
|
+
output: process.stdout,
|
|
158
|
+
});
|
|
159
|
+
migrationName = await new Promise((resolve) => {
|
|
160
|
+
rl.question("Enter migration name: ", resolve);
|
|
161
|
+
});
|
|
162
|
+
rl.close();
|
|
163
|
+
if (!migrationName || migrationName.trim() === "") {
|
|
164
|
+
throw new Error("Migration name cannot be empty");
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Clean the migration name (remove special characters, replace spaces with underscores)
|
|
168
|
+
const cleanName = migrationName
|
|
169
|
+
.trim()
|
|
170
|
+
.toLowerCase()
|
|
171
|
+
.replace(/[^a-z0-9_\s-]/g, "")
|
|
172
|
+
.replace(/[\s-]+/g, "_");
|
|
173
|
+
// Generate timestamp (Unix timestamp in seconds for simplicity)
|
|
174
|
+
const timestamp = Math.floor(Date.now() / 1000);
|
|
175
|
+
// Create filename
|
|
176
|
+
const filename = `${timestamp}_${cleanName}.sql`;
|
|
177
|
+
const filePath = path.join(migrationsPath, filename);
|
|
178
|
+
// Create migration file with template content
|
|
179
|
+
const template = `-- Migration: ${migrationName}
|
|
180
|
+
-- Created: ${new Date().toISOString()}
|
|
181
|
+
|
|
182
|
+
-- Add your SQL migration here
|
|
183
|
+
-- Example:
|
|
184
|
+
-- CREATE TABLE IF NOT EXISTS example (
|
|
185
|
+
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
186
|
+
-- name TEXT NOT NULL,
|
|
187
|
+
-- created_at TIMESTAMP DEFAULT NOW()
|
|
188
|
+
-- );
|
|
189
|
+
`;
|
|
190
|
+
fs.writeFileSync(filePath, template);
|
|
191
|
+
logger_1.logger.succeed(`Created migration file: ${filename}`);
|
|
192
|
+
logger_1.logger.log(` Location: ${filePath}`);
|
|
193
|
+
logger_1.logger.log(` Edit the file to add your SQL migration commands`);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Push database migrations (exported for sync command)
|
|
197
|
+
*/
|
|
198
|
+
async function pushDbMigrations(envOverride) {
|
|
199
|
+
const env = await (0, environment_1.selectEnvironment)(envOverride);
|
|
200
|
+
if (!env.omnibaseServiceKey) {
|
|
201
|
+
throw new Error("OMNIBASE_SERVICE_KEY not found in environment configuration");
|
|
202
|
+
}
|
|
203
|
+
await applyMigrations(env.omnibaseApiUrl, env.omnibaseServiceKey, "omnibase/db");
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Apply migrations by zipping SQL files and sending to API
|
|
207
|
+
*/
|
|
208
|
+
async function applyMigrations(apiUrl, apiKey, migrationsDir) {
|
|
209
|
+
const projectRoot = (0, environment_1.findOmnibaseRoot)();
|
|
210
|
+
const migrationsPath = path.join(projectRoot, migrationsDir);
|
|
211
|
+
// Verify migrations directory exists
|
|
212
|
+
if (!fs.existsSync(migrationsPath)) {
|
|
213
|
+
throw new Error(`Migrations directory not found: ${migrationsPath}\n` +
|
|
214
|
+
`Please ensure the directory exists and contains .sql migration files.`);
|
|
215
|
+
}
|
|
216
|
+
// Get all .sql files from the directory
|
|
217
|
+
const sqlFiles = fs
|
|
218
|
+
.readdirSync(migrationsPath)
|
|
219
|
+
.filter((file) => file.endsWith(".sql"))
|
|
220
|
+
.sort();
|
|
221
|
+
if (sqlFiles.length === 0) {
|
|
222
|
+
throw new Error(`No .sql files found in ${migrationsPath}\n` +
|
|
223
|
+
`Please add migration files (e.g., 001-seed.sql, 002-rls.sql)`);
|
|
224
|
+
}
|
|
225
|
+
logger_1.logger.log(`Found ${sqlFiles.length} migration file(s):`);
|
|
226
|
+
sqlFiles.forEach((file) => logger_1.logger.log(` - ${file}`));
|
|
227
|
+
// Create zip file
|
|
228
|
+
const zip = new adm_zip_1.default();
|
|
229
|
+
for (const file of sqlFiles) {
|
|
230
|
+
const filePath = path.join(migrationsPath, file);
|
|
231
|
+
zip.addLocalFile(filePath);
|
|
232
|
+
}
|
|
233
|
+
// Generate zip buffer
|
|
234
|
+
const zipBuffer = zip.toBuffer();
|
|
235
|
+
logger_1.logger.log(`Created migration archive (${zipBuffer.length} bytes)`);
|
|
236
|
+
// Use axios and form-data (same as permissions.ts)
|
|
237
|
+
const FormData = require("form-data");
|
|
238
|
+
const axios = require("axios");
|
|
239
|
+
const formData = new FormData();
|
|
240
|
+
formData.append("migrations", zipBuffer, {
|
|
241
|
+
filename: "migrations.zip",
|
|
242
|
+
contentType: "application/zip",
|
|
243
|
+
});
|
|
244
|
+
// Send to API
|
|
245
|
+
const endpoint = `${apiUrl}/api/v1/database/migrations`;
|
|
246
|
+
logger_1.logger.start(`Uploading migrations to ${endpoint}...`);
|
|
247
|
+
try {
|
|
248
|
+
const headers = {
|
|
249
|
+
...formData.getHeaders(),
|
|
250
|
+
};
|
|
251
|
+
if (apiKey) {
|
|
252
|
+
headers["X-Service-Key"] = apiKey;
|
|
253
|
+
}
|
|
254
|
+
const response = await axios.post(endpoint, formData, { headers });
|
|
255
|
+
logger_1.logger.succeed(response.data.message || "Migrations applied successfully");
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
if (error instanceof Error) {
|
|
259
|
+
if (error.message.includes("fetch")) {
|
|
260
|
+
throw new Error(`Failed to connect to API at ${apiUrl}\n` +
|
|
261
|
+
`Please ensure the API is running and accessible.\n` +
|
|
262
|
+
`Original error: ${error.message}`);
|
|
263
|
+
}
|
|
264
|
+
throw error;
|
|
265
|
+
}
|
|
266
|
+
throw new Error(`Unknown error occurred: ${error}`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Reset database by dropping all tables and re-applying migrations
|
|
271
|
+
*/
|
|
272
|
+
async function resetMigrations(apiUrl, apiKey, migrationsDir) {
|
|
273
|
+
const projectRoot = (0, environment_1.findOmnibaseRoot)();
|
|
274
|
+
const migrationsPath = path.join(projectRoot, migrationsDir);
|
|
275
|
+
// Verify migrations directory exists
|
|
276
|
+
if (!fs.existsSync(migrationsPath)) {
|
|
277
|
+
throw new Error(`Migrations directory not found: ${migrationsPath}\n` +
|
|
278
|
+
`Please ensure the directory exists and contains .sql migration files.`);
|
|
279
|
+
}
|
|
280
|
+
// Get all .sql files from the directory
|
|
281
|
+
const sqlFiles = fs
|
|
282
|
+
.readdirSync(migrationsPath)
|
|
283
|
+
.filter((file) => file.endsWith(".sql"))
|
|
284
|
+
.sort();
|
|
285
|
+
if (sqlFiles.length === 0) {
|
|
286
|
+
throw new Error(`No .sql files found in ${migrationsPath}\n` +
|
|
287
|
+
`Please add migration files (e.g., 001-seed.sql, 002-rls.sql)`);
|
|
288
|
+
}
|
|
289
|
+
logger_1.logger.log(`Found ${sqlFiles.length} migration file(s):`);
|
|
290
|
+
sqlFiles.forEach((file) => logger_1.logger.log(` - ${file}`));
|
|
291
|
+
// Create zip file
|
|
292
|
+
const zip = new adm_zip_1.default();
|
|
293
|
+
for (const file of sqlFiles) {
|
|
294
|
+
const filePath = path.join(migrationsPath, file);
|
|
295
|
+
zip.addLocalFile(filePath);
|
|
296
|
+
}
|
|
297
|
+
// Generate zip buffer
|
|
298
|
+
const zipBuffer = zip.toBuffer();
|
|
299
|
+
logger_1.logger.log(`Created migration archive (${zipBuffer.length} bytes)`);
|
|
300
|
+
// Use axios and form-data
|
|
301
|
+
const FormData = require("form-data");
|
|
302
|
+
const axios = require("axios");
|
|
303
|
+
const formData = new FormData();
|
|
304
|
+
formData.append("migrations", zipBuffer, {
|
|
305
|
+
filename: "migrations.zip",
|
|
306
|
+
contentType: "application/zip",
|
|
307
|
+
});
|
|
308
|
+
// Send to API reset endpoint
|
|
309
|
+
const endpoint = `${apiUrl}/api/v1/database/migrations/reset`;
|
|
310
|
+
logger_1.logger.start(`Resetting database and applying migrations to ${endpoint}...`);
|
|
311
|
+
try {
|
|
312
|
+
const headers = {
|
|
313
|
+
...formData.getHeaders(),
|
|
314
|
+
};
|
|
315
|
+
if (apiKey) {
|
|
316
|
+
headers["X-Service-Key"] = apiKey;
|
|
317
|
+
}
|
|
318
|
+
const response = await axios.post(endpoint, formData, { headers });
|
|
319
|
+
logger_1.logger.succeed(response.data.message || "Database reset and migrations applied successfully");
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
if (error instanceof Error) {
|
|
323
|
+
if (error.message.includes("fetch")) {
|
|
324
|
+
throw new Error(`Failed to connect to API at ${apiUrl}\n` +
|
|
325
|
+
`Please ensure the API is running and accessible.\n` +
|
|
326
|
+
`Original error: ${error.message}`);
|
|
327
|
+
}
|
|
328
|
+
throw error;
|
|
329
|
+
}
|
|
330
|
+
throw new Error(`Unknown error occurred: ${error}`);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Generate TypeScript types from database schema using postgres-meta
|
|
335
|
+
*/
|
|
336
|
+
async function generateTypes(env, outputPath, schemas) {
|
|
337
|
+
const axios = require("axios");
|
|
338
|
+
const projectRoot = (0, environment_1.findOmnibaseRoot)();
|
|
339
|
+
// Get typegen API URL from environment config or default to localhost
|
|
340
|
+
const typegenApiUrl = env.typegenApiUrl;
|
|
341
|
+
logger_1.logger.start(`Fetching schema types from ${typegenApiUrl}...`);
|
|
342
|
+
logger_1.logger.log(` Included schemas: ${schemas}`);
|
|
343
|
+
try {
|
|
344
|
+
// Call postgres-meta typegen endpoint
|
|
345
|
+
const url = `${typegenApiUrl}/generators/typescript?included_schemas=${schemas}`;
|
|
346
|
+
const response = await axios.get(url);
|
|
347
|
+
if (!response.data) {
|
|
348
|
+
throw new Error("No type definitions returned from postgres-meta");
|
|
349
|
+
}
|
|
350
|
+
// Prepare output path
|
|
351
|
+
const fullOutputPath = path.join(projectRoot, outputPath);
|
|
352
|
+
const outputDir = path.dirname(fullOutputPath);
|
|
353
|
+
// Ensure output directory exists
|
|
354
|
+
if (!fs.existsSync(outputDir)) {
|
|
355
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
356
|
+
logger_1.logger.info(`Created types directory: ${outputDir}`);
|
|
357
|
+
}
|
|
358
|
+
// Write types to file
|
|
359
|
+
fs.writeFileSync(fullOutputPath, response.data);
|
|
360
|
+
logger_1.logger.succeed(`Generated TypeScript types`);
|
|
361
|
+
logger_1.logger.log(` Location: ${fullOutputPath}`);
|
|
362
|
+
logger_1.logger.log(` Import these types in your application to get type-safe database access`);
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
if (error instanceof Error) {
|
|
366
|
+
throw new Error(`Failed to generate types from ${typegenApiUrl}\n` +
|
|
367
|
+
`Please ensure postgres-meta is running and accessible.\n` +
|
|
368
|
+
`Original error: ${error.message}`);
|
|
369
|
+
}
|
|
370
|
+
throw new Error(`Unknown error occurred: ${error}`);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
//# sourceMappingURL=db.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/commands/db.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,sCA4HC;AA2ED,4CAQC;AA3ND,uCAAyB;AACzB,2CAA6B;AAC7B,0CAA0C;AAC1C,sDAA6B;AAC7B,sDAA2E;AAC3E,4CAAyC;AACzC,4CAAqD;AACrD,8CAA4D;AAE5D;;GAEG;AACH,SAAgB,aAAa,CAAC,OAAgB;IAC5C,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,8BAA8B,CAAC,CAAC;IAE7E,wBAAwB;IACxB,MAAM,OAAO,GAAG,EAAE;SACf,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,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+
*/
|
|
5
|
+
export declare function pushEmailTemplates(envOverride?: string): Promise<void>;
|
|
2
6
|
export declare function addEmailCommands(program: Command): void;
|
|
3
7
|
//# sourceMappingURL=email.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/commands/email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/commands/email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+GpC;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuC5E;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgGvD"}
|
package/dist/commands/email.js
CHANGED
|
@@ -33,19 +33,20 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.pushEmailTemplates = pushEmailTemplates;
|
|
36
37
|
exports.addEmailCommands = addEmailCommands;
|
|
37
38
|
const fs = __importStar(require("fs"));
|
|
38
39
|
const path = __importStar(require("path"));
|
|
39
40
|
const environment_1 = require("../utils/environment");
|
|
41
|
+
const logger_1 = require("../utils/logger");
|
|
40
42
|
async function makeApiRequest(endpoint, method = "GET", body, envOverride) {
|
|
41
|
-
const envConfig = (0, environment_1.
|
|
42
|
-
const url = `${envConfig.
|
|
43
|
+
const envConfig = await (0, environment_1.selectEnvironment)(envOverride);
|
|
44
|
+
const url = `${envConfig.omnibaseApiUrl}${endpoint}`;
|
|
43
45
|
const headers = {
|
|
44
46
|
"Content-Type": "application/json",
|
|
45
47
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
headers["x-api-key"] = envConfig.apiKey;
|
|
48
|
+
if (envConfig.omnibaseServiceKey) {
|
|
49
|
+
headers["X-Service-Key"] = envConfig.omnibaseServiceKey;
|
|
49
50
|
}
|
|
50
51
|
const options = {
|
|
51
52
|
method,
|
|
@@ -60,7 +61,7 @@ async function makeApiRequest(endpoint, method = "GET", body, envOverride) {
|
|
|
60
61
|
if (!response.ok) {
|
|
61
62
|
return {
|
|
62
63
|
success: false,
|
|
63
|
-
error: data.error ||
|
|
64
|
+
error: data.error || `${response.status} - ${response.statusText}`,
|
|
64
65
|
};
|
|
65
66
|
}
|
|
66
67
|
return {
|
|
@@ -87,7 +88,6 @@ function loadEmailTemplates(fileName) {
|
|
|
87
88
|
}
|
|
88
89
|
const files = fs.readdirSync(templatesPath);
|
|
89
90
|
const htmlFiles = files.filter((file) => file.endsWith(".html"));
|
|
90
|
-
// If fileName is specified, filter to just that file
|
|
91
91
|
const filesToProcess = fileName
|
|
92
92
|
? htmlFiles.filter((file) => file === `${fileName}.html` || file === fileName)
|
|
93
93
|
: htmlFiles;
|
|
@@ -100,9 +100,7 @@ function loadEmailTemplates(fileName) {
|
|
|
100
100
|
for (const file of filesToProcess) {
|
|
101
101
|
const filePath = path.join(templatesPath, file);
|
|
102
102
|
const htmlContent = fs.readFileSync(filePath, "utf8");
|
|
103
|
-
// Extract template type from filename (remove .html extension)
|
|
104
103
|
const templateType = file.replace(".html", "");
|
|
105
|
-
// Use filename as subject (this matches your requirement: filename -> subject)
|
|
106
104
|
const subject = templateType
|
|
107
105
|
.replace(/-/g, " ")
|
|
108
106
|
.replace(/\b\w/g, (l) => l.toUpperCase());
|
|
@@ -113,56 +111,88 @@ function loadEmailTemplates(fileName) {
|
|
|
113
111
|
}
|
|
114
112
|
return templates;
|
|
115
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Push email templates to API (exported for sync command)
|
|
116
|
+
*/
|
|
117
|
+
async function pushEmailTemplates(envOverride) {
|
|
118
|
+
logger_1.logger.start("Loading email templates...");
|
|
119
|
+
const templates = loadEmailTemplates();
|
|
120
|
+
logger_1.logger.succeed(`Found ${templates.size} template(s) to upload`);
|
|
121
|
+
let successCount = 0;
|
|
122
|
+
let errorCount = 0;
|
|
123
|
+
const errors = [];
|
|
124
|
+
for (const [type, template] of templates.entries()) {
|
|
125
|
+
logger_1.logger.start(`Uploading template: ${type}...`);
|
|
126
|
+
const response = await makeApiRequest("/api/v1/email/templates", "POST", {
|
|
127
|
+
type,
|
|
128
|
+
subject: template.subject,
|
|
129
|
+
html_body: template.htmlBody,
|
|
130
|
+
}, envOverride);
|
|
131
|
+
if (response.success) {
|
|
132
|
+
logger_1.logger.succeed(`Uploaded: ${type}`);
|
|
133
|
+
successCount++;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
logger_1.logger.fail(`Failed to upload ${type}: ${response.error}`);
|
|
137
|
+
errors.push(`${type}: ${response.error}`);
|
|
138
|
+
errorCount++;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
logger_1.logger.log(`Email templates: ${successCount} successful, ${errorCount} failed`);
|
|
142
|
+
if (errors.length > 0) {
|
|
143
|
+
throw new Error(`Email upload failed for: ${errors.join(", ")}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
116
146
|
function addEmailCommands(program) {
|
|
117
147
|
const email = program.command("email").description("Manage email templates");
|
|
118
|
-
// Push email templates command
|
|
119
148
|
email
|
|
120
149
|
.command("push [filename]")
|
|
121
150
|
.description("Push email templates to PostgreSQL database (leave empty to push all templates)")
|
|
122
151
|
.option("--env <environment>", "Override environment for this command")
|
|
123
152
|
.action(async (filename, options) => {
|
|
124
153
|
try {
|
|
125
|
-
|
|
154
|
+
logger_1.logger.start("Loading email templates...");
|
|
126
155
|
const templates = loadEmailTemplates(filename);
|
|
127
|
-
|
|
156
|
+
logger_1.logger.succeed(`Found ${templates.size} template(s) to upload`);
|
|
128
157
|
const envOverride = options.env || program.opts().env;
|
|
129
158
|
let successCount = 0;
|
|
130
159
|
let errorCount = 0;
|
|
131
160
|
const errors = [];
|
|
132
161
|
for (const [type, template] of templates.entries()) {
|
|
133
|
-
|
|
162
|
+
logger_1.logger.start(`Uploading template: ${type}...`);
|
|
134
163
|
const response = await makeApiRequest("/api/v1/email/templates", "POST", {
|
|
135
164
|
type,
|
|
136
165
|
subject: template.subject,
|
|
137
166
|
html_body: template.htmlBody,
|
|
138
167
|
}, envOverride);
|
|
139
168
|
if (response.success) {
|
|
140
|
-
|
|
169
|
+
logger_1.logger.succeed(`Uploaded: ${type}`);
|
|
141
170
|
successCount++;
|
|
142
171
|
}
|
|
143
172
|
else {
|
|
144
|
-
|
|
173
|
+
logger_1.logger.fail(`Failed to upload ${type}: ${response.error}`);
|
|
145
174
|
errors.push(`${type}: ${response.error}`);
|
|
146
175
|
errorCount++;
|
|
147
176
|
}
|
|
148
177
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
178
|
+
logger_1.logger.newline();
|
|
179
|
+
logger_1.logger.log("Summary:");
|
|
180
|
+
logger_1.logger.log(` Successful: ${successCount}`);
|
|
181
|
+
logger_1.logger.log(` Failed: ${errorCount}`);
|
|
152
182
|
if (errors.length > 0) {
|
|
153
|
-
|
|
183
|
+
logger_1.logger.newline();
|
|
184
|
+
logger_1.logger.log("Errors:");
|
|
154
185
|
errors.forEach((error) => {
|
|
155
|
-
|
|
186
|
+
logger_1.logger.log(` - ${error}`);
|
|
156
187
|
});
|
|
157
188
|
process.exit(1);
|
|
158
189
|
}
|
|
159
190
|
}
|
|
160
191
|
catch (error) {
|
|
161
|
-
|
|
192
|
+
logger_1.logger.fail(error instanceof Error ? error.message : String(error));
|
|
162
193
|
process.exit(1);
|
|
163
194
|
}
|
|
164
195
|
});
|
|
165
|
-
// List email templates command
|
|
166
196
|
email
|
|
167
197
|
.command("list")
|
|
168
198
|
.description("List all email templates in the project")
|
|
@@ -170,24 +200,25 @@ function addEmailCommands(program) {
|
|
|
170
200
|
try {
|
|
171
201
|
const templatesPath = getEmailTemplatesPath();
|
|
172
202
|
if (!fs.existsSync(templatesPath)) {
|
|
173
|
-
|
|
174
|
-
|
|
203
|
+
logger_1.logger.warn(`No email templates directory found at: ${templatesPath}`);
|
|
204
|
+
logger_1.logger.log("Tip: Create the directory and add .html templates");
|
|
175
205
|
return;
|
|
176
206
|
}
|
|
177
207
|
const files = fs.readdirSync(templatesPath);
|
|
178
208
|
const htmlFiles = files.filter((file) => file.endsWith(".html"));
|
|
179
209
|
if (htmlFiles.length === 0) {
|
|
180
|
-
|
|
210
|
+
logger_1.logger.warn("No email templates found");
|
|
181
211
|
return;
|
|
182
212
|
}
|
|
183
|
-
|
|
213
|
+
logger_1.logger.log(`Found ${htmlFiles.length} email template(s):`);
|
|
214
|
+
logger_1.logger.newline();
|
|
184
215
|
htmlFiles.forEach((file, index) => {
|
|
185
216
|
const templateType = file.replace(".html", "");
|
|
186
|
-
|
|
217
|
+
logger_1.logger.log(` ${index + 1}. ${templateType} (${file})`);
|
|
187
218
|
});
|
|
188
219
|
}
|
|
189
220
|
catch (error) {
|
|
190
|
-
|
|
221
|
+
logger_1.logger.fail(error instanceof Error ? error.message : String(error));
|
|
191
222
|
process.exit(1);
|
|
192
223
|
}
|
|
193
224
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.js","sourceRoot":"","sources":["../../src/commands/email.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkHA,
|
|
1
|
+
{"version":3,"file":"email.js","sourceRoot":"","sources":["../../src/commands/email.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkHA,gDAuCC;AAED,4CAgGC;AA1PD,uCAAyB;AACzB,2CAA6B;AAC7B,sDAA2E;AAC3E,4CAAyC;AAQzC,KAAK,UAAU,cAAc,CAC3B,QAAgB,EAChB,SAAyB,KAAK,EAC9B,IAAU,EACV,WAAoB;IAEpB,MAAM,SAAS,GAAG,MAAM,IAAA,+BAAiB,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KAAK,EAAE,CAAC;YACf,eAAM,CAAC,IAAI,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACpE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/commands/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/commands/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwB7D"}
|