baasix 0.1.3 → 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 +21 -0
- package/package.json +1 -1
- package/src/commands/generate.ts +27 -1
package/dist/index.mjs
CHANGED
|
@@ -1462,6 +1462,27 @@ async function generateAction(opts) {
|
|
|
1462
1462
|
}
|
|
1463
1463
|
} catch (error) {
|
|
1464
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
|
+
}
|
|
1465
1486
|
if (error instanceof Error) {
|
|
1466
1487
|
log2.error(error.message);
|
|
1467
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 {
|