baasix 0.1.2 → 0.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/dist/index.mjs +22 -2
- package/package.json +1 -1
- package/src/commands/generate.ts +27 -1
- package/src/commands/init.ts +1 -2
package/dist/index.mjs
CHANGED
|
@@ -402,7 +402,7 @@ function generateEnvContent(config, secretKey) {
|
|
|
402
402
|
lines.push("PORT=8056");
|
|
403
403
|
lines.push("HOST=localhost");
|
|
404
404
|
lines.push("NODE_ENV=development");
|
|
405
|
-
lines.push("
|
|
405
|
+
lines.push("LOG_LEVEL=info");
|
|
406
406
|
lines.push("");
|
|
407
407
|
lines.push("#-----------------------------------");
|
|
408
408
|
lines.push("# Database");
|
|
@@ -410,7 +410,6 @@ function generateEnvContent(config, secretKey) {
|
|
|
410
410
|
lines.push(`DATABASE_URL="${config.databaseUrl}"`);
|
|
411
411
|
lines.push("DATABASE_LOGGING=false");
|
|
412
412
|
lines.push("DATABASE_POOL_MAX=20");
|
|
413
|
-
lines.push("DATABASE_POOL_MIN=0");
|
|
414
413
|
lines.push("");
|
|
415
414
|
lines.push("#-----------------------------------");
|
|
416
415
|
lines.push("# Security");
|
|
@@ -1463,6 +1462,27 @@ async function generateAction(opts) {
|
|
|
1463
1462
|
}
|
|
1464
1463
|
} catch (error) {
|
|
1465
1464
|
s.stop("Failed to generate types");
|
|
1465
|
+
if (error?.response?.status === 403 || error?.status === 403) {
|
|
1466
|
+
log2.error("Schema access denied (403 Forbidden)");
|
|
1467
|
+
console.log();
|
|
1468
|
+
console.log(chalk2.yellow("Possible causes:"));
|
|
1469
|
+
console.log(chalk2.dim(" 1. SCHEMAS_PUBLIC=false is set on the server"));
|
|
1470
|
+
console.log(chalk2.dim(" 2. You don't have read permission on baasix_SchemaDefinition"));
|
|
1471
|
+
console.log();
|
|
1472
|
+
console.log(chalk2.yellow("Solutions:"));
|
|
1473
|
+
console.log(chalk2.dim(" \u2022 Set SCHEMAS_PUBLIC=true in server .env (allows all authenticated users)"));
|
|
1474
|
+
console.log(chalk2.dim(" \u2022 Use admin credentials in CLI config (.env or baasix.config.json)"));
|
|
1475
|
+
console.log(chalk2.dim(" \u2022 Grant read permission to your role for baasix_SchemaDefinition collection"));
|
|
1476
|
+
process.exit(1);
|
|
1477
|
+
}
|
|
1478
|
+
if (error?.response?.status === 401 || error?.status === 401) {
|
|
1479
|
+
log2.error("Authentication required (401 Unauthorized)");
|
|
1480
|
+
console.log();
|
|
1481
|
+
console.log(chalk2.yellow("Add credentials to your config:"));
|
|
1482
|
+
console.log(chalk2.dim(" \u2022 Create .env with BAASIX_EMAIL and BAASIX_PASSWORD"));
|
|
1483
|
+
console.log(chalk2.dim(" \u2022 Or use BAASIX_TOKEN for token-based auth"));
|
|
1484
|
+
process.exit(1);
|
|
1485
|
+
}
|
|
1466
1486
|
if (error instanceof Error) {
|
|
1467
1487
|
log2.error(error.message);
|
|
1468
1488
|
} else {
|
package/package.json
CHANGED
package/src/commands/generate.ts
CHANGED
|
@@ -171,8 +171,34 @@ async function generateAction(opts: GenerateOptions) {
|
|
|
171
171
|
console.log();
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
} catch (error) {
|
|
174
|
+
} catch (error: any) {
|
|
175
175
|
s.stop("Failed to generate types");
|
|
176
|
+
|
|
177
|
+
// Check for 403 Forbidden - schema access denied
|
|
178
|
+
if (error?.response?.status === 403 || error?.status === 403) {
|
|
179
|
+
log.error("Schema access denied (403 Forbidden)");
|
|
180
|
+
console.log();
|
|
181
|
+
console.log(chalk.yellow("Possible causes:"));
|
|
182
|
+
console.log(chalk.dim(" 1. SCHEMAS_PUBLIC=false is set on the server"));
|
|
183
|
+
console.log(chalk.dim(" 2. You don't have read permission on baasix_SchemaDefinition"));
|
|
184
|
+
console.log();
|
|
185
|
+
console.log(chalk.yellow("Solutions:"));
|
|
186
|
+
console.log(chalk.dim(" • Set SCHEMAS_PUBLIC=true in server .env (allows all authenticated users)"));
|
|
187
|
+
console.log(chalk.dim(" • Use admin credentials in CLI config (.env or baasix.config.json)"));
|
|
188
|
+
console.log(chalk.dim(" • Grant read permission to your role for baasix_SchemaDefinition collection"));
|
|
189
|
+
process.exit(1);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Check for 401 Unauthorized
|
|
193
|
+
if (error?.response?.status === 401 || error?.status === 401) {
|
|
194
|
+
log.error("Authentication required (401 Unauthorized)");
|
|
195
|
+
console.log();
|
|
196
|
+
console.log(chalk.yellow("Add credentials to your config:"));
|
|
197
|
+
console.log(chalk.dim(" • Create .env with BAASIX_EMAIL and BAASIX_PASSWORD"));
|
|
198
|
+
console.log(chalk.dim(" • Or use BAASIX_TOKEN for token-based auth"));
|
|
199
|
+
process.exit(1);
|
|
200
|
+
}
|
|
201
|
+
|
|
176
202
|
if (error instanceof Error) {
|
|
177
203
|
log.error(error.message);
|
|
178
204
|
} else {
|
package/src/commands/init.ts
CHANGED
|
@@ -477,7 +477,7 @@ function generateEnvContent(config: ProjectConfig, secretKey: string): string {
|
|
|
477
477
|
lines.push("PORT=8056");
|
|
478
478
|
lines.push("HOST=localhost");
|
|
479
479
|
lines.push("NODE_ENV=development");
|
|
480
|
-
lines.push("
|
|
480
|
+
lines.push("LOG_LEVEL=info");
|
|
481
481
|
lines.push("");
|
|
482
482
|
|
|
483
483
|
// Database section
|
|
@@ -487,7 +487,6 @@ function generateEnvContent(config: ProjectConfig, secretKey: string): string {
|
|
|
487
487
|
lines.push(`DATABASE_URL="${config.databaseUrl}"`);
|
|
488
488
|
lines.push("DATABASE_LOGGING=false");
|
|
489
489
|
lines.push("DATABASE_POOL_MAX=20");
|
|
490
|
-
lines.push("DATABASE_POOL_MIN=0");
|
|
491
490
|
lines.push("");
|
|
492
491
|
|
|
493
492
|
// Security section
|