baasix 0.1.3 → 0.1.5
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 +26 -2
- package/package.json +1 -1
- package/src/commands/generate.ts +27 -1
- package/src/commands/init.ts +5 -2
package/dist/index.mjs
CHANGED
|
@@ -341,12 +341,15 @@ async function createApiProject(projectPath, config) {
|
|
|
341
341
|
version: "0.1.0",
|
|
342
342
|
type: "module",
|
|
343
343
|
scripts: {
|
|
344
|
-
dev: "
|
|
345
|
-
start: "
|
|
344
|
+
dev: "tsx watch server.js",
|
|
345
|
+
start: "tsx server.js"
|
|
346
346
|
},
|
|
347
347
|
dependencies: {
|
|
348
348
|
"@tspvivek/baasix": "latest",
|
|
349
349
|
"dotenv": "^16.3.1"
|
|
350
|
+
},
|
|
351
|
+
devDependencies: {
|
|
352
|
+
"tsx": "^4.16.0"
|
|
350
353
|
}
|
|
351
354
|
};
|
|
352
355
|
await fs.writeFile(
|
|
@@ -1462,6 +1465,27 @@ async function generateAction(opts) {
|
|
|
1462
1465
|
}
|
|
1463
1466
|
} catch (error) {
|
|
1464
1467
|
s.stop("Failed to generate types");
|
|
1468
|
+
if (error?.response?.status === 403 || error?.status === 403) {
|
|
1469
|
+
log2.error("Schema access denied (403 Forbidden)");
|
|
1470
|
+
console.log();
|
|
1471
|
+
console.log(chalk2.yellow("Possible causes:"));
|
|
1472
|
+
console.log(chalk2.dim(" 1. SCHEMAS_PUBLIC=false is set on the server"));
|
|
1473
|
+
console.log(chalk2.dim(" 2. You don't have read permission on baasix_SchemaDefinition"));
|
|
1474
|
+
console.log();
|
|
1475
|
+
console.log(chalk2.yellow("Solutions:"));
|
|
1476
|
+
console.log(chalk2.dim(" \u2022 Set SCHEMAS_PUBLIC=true in server .env (allows all authenticated users)"));
|
|
1477
|
+
console.log(chalk2.dim(" \u2022 Use admin credentials in CLI config (.env or baasix.config.json)"));
|
|
1478
|
+
console.log(chalk2.dim(" \u2022 Grant read permission to your role for baasix_SchemaDefinition collection"));
|
|
1479
|
+
process.exit(1);
|
|
1480
|
+
}
|
|
1481
|
+
if (error?.response?.status === 401 || error?.status === 401) {
|
|
1482
|
+
log2.error("Authentication required (401 Unauthorized)");
|
|
1483
|
+
console.log();
|
|
1484
|
+
console.log(chalk2.yellow("Add credentials to your config:"));
|
|
1485
|
+
console.log(chalk2.dim(" \u2022 Create .env with BAASIX_EMAIL and BAASIX_PASSWORD"));
|
|
1486
|
+
console.log(chalk2.dim(" \u2022 Or use BAASIX_TOKEN for token-based auth"));
|
|
1487
|
+
process.exit(1);
|
|
1488
|
+
}
|
|
1465
1489
|
if (error instanceof Error) {
|
|
1466
1490
|
log2.error(error.message);
|
|
1467
1491
|
} 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
|
@@ -394,13 +394,16 @@ async function createApiProject(projectPath: string, config: ProjectConfig) {
|
|
|
394
394
|
version: "0.1.0",
|
|
395
395
|
type: "module",
|
|
396
396
|
scripts: {
|
|
397
|
-
dev: "
|
|
398
|
-
start: "
|
|
397
|
+
dev: "tsx watch server.js",
|
|
398
|
+
start: "tsx server.js",
|
|
399
399
|
},
|
|
400
400
|
dependencies: {
|
|
401
401
|
"@tspvivek/baasix": "latest",
|
|
402
402
|
"dotenv": "^16.3.1",
|
|
403
403
|
},
|
|
404
|
+
devDependencies: {
|
|
405
|
+
"tsx": "^4.16.0",
|
|
406
|
+
},
|
|
404
407
|
};
|
|
405
408
|
|
|
406
409
|
await fs.writeFile(
|