@aurabase/gen 0.6.2 → 0.7.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/cli.cjs CHANGED
@@ -345,7 +345,7 @@ export type Enums<
345
345
  }
346
346
 
347
347
  // src/cli.ts
348
- var VERSION = "0.6.2";
348
+ var VERSION = "0.7.0";
349
349
  function loadEnvFiles() {
350
350
  const envCandidates = [".env.local", ".env.development.local", ".env.development", ".env"];
351
351
  for (const file of envCandidates) {
@@ -380,11 +380,11 @@ function loadEnvFiles() {
380
380
  }
381
381
  function diagnostiquerSchema(tables) {
382
382
  if (tables.length === 0) {
383
- return "Sch\xE9ma vide : aucune table. Les types g\xE9n\xE9r\xE9s seraient inutilisables.";
383
+ return "Empty schema: no table. The generated types would be unusable.";
384
384
  }
385
385
  const vides = tables.filter((t) => !t.columns || t.columns.length === 0).map((t) => t.name);
386
386
  if (vides.length > 0) {
387
- return `Tables sans aucune colonne : ${vides.join(", ")}. Les types g\xE9n\xE9r\xE9s pour elles seraient \xAB Row: {} \xBB \u2014 sans garantie : ils acceptent n'importe quel champ et n'en garantissent aucun. C'est le cas d'un projet MongoDB, dont le sch\xE9ma n'est pas d\xE9clar\xE9. Utilisez --allow-empty pour g\xE9n\xE9rer quand m\xEAme.`;
387
+ return `Tables without any column: ${vides.join(", ")}. The generated types for them would be "Row: {}", with no guarantee: they accept any field and guarantee none. This is the case of a MongoDB project, whose schema is not declared. Use --allow-empty to generate anyway.`;
388
388
  }
389
389
  return null;
390
390
  }
@@ -434,30 +434,30 @@ function parseArgs(argv) {
434
434
  return a;
435
435
  }
436
436
  var HELP_TEXT = `
437
- aurabase-gen (v${VERSION}) \u2014 G\xE9n\xE9rateur de types TypeScript pour Aurabase
437
+ aurabase-gen (v${VERSION}) \u2014 TypeScript type generator for Aurabase
438
438
 
439
- USAGE :
439
+ USAGE:
440
440
  npx @aurabase/gen [options]
441
- aurabase-gen --url <projectUrl> --key <apiKey> [--out <fichier>]
441
+ aurabase-gen --url <projectUrl> --key <apiKey> [--out <file>]
442
442
 
443
- OPTIONS :
444
- --url <url> URL du projet Aurabase (ex: https://mon-projet.aurabase.cloud)
445
- [Auto-d\xE9tection : NEXT_PUBLIC_AURABASE_URL]
446
- --key <cle> Cl\xE9 API du projet (anon ou service_role)
447
- [Auto-d\xE9tection : AURABASE_SERVICE_ROLE_KEY, puis NEXT_PUBLIC_AURABASE_ANON_KEY]
448
- -o, --out <fichier> Fichier de destination (ex: src/types/database.types.ts)
449
- Si omis, le r\xE9sultat est \xE9crit sur stdout.
450
- -s, --schema <nom> Nom du sch\xE9ma de base de donn\xE9es (d\xE9faut : 'public')
451
- -t, --type-name <t> Nom de l'interface principale g\xE9n\xE9r\xE9e (d\xE9faut : 'Database')
452
- --allow-empty G\xE9n\xE9rer les types m\xEAme si des tables n'ont pas de colonnes d\xE9clar\xE9es
453
- -h, --help Afficher cette aide
454
- -v, --version Afficher la version
443
+ OPTIONS:
444
+ --url <url> Aurabase project URL (e.g. https://my-project.aurabase.cloud)
445
+ [Auto-detected: NEXT_PUBLIC_AURABASE_URL]
446
+ --key <key> Project API key (anon or service_role)
447
+ [Auto-detected: AURABASE_SERVICE_ROLE_KEY, then NEXT_PUBLIC_AURABASE_ANON_KEY]
448
+ -o, --out <file> Output file (e.g. src/types/database.types.ts)
449
+ If omitted, the result is written to stdout.
450
+ -s, --schema <name> Database schema name (default: 'public')
451
+ -t, --type-name <t> Name of the main generated interface (default: 'Database')
452
+ --allow-empty Generate the types even if some tables have no declared columns
453
+ -h, --help Show this help
454
+ -v, --version Show the version
455
455
 
456
- EXEMPLES :
457
- # G\xE9n\xE9ration avec lecture automatique des variables d'environnement (.env / .env.local) :
456
+ EXAMPLES:
457
+ # Generation reading the environment variables automatically (.env / .env.local):
458
458
  npx @aurabase/gen --out src/types/database.types.ts
459
459
 
460
- # Param\xE8tres explicites :
460
+ # Explicit parameters:
461
461
  npx @aurabase/gen --url https://xyz.aurabase.cloud --key aura_anon_123 --out db.types.ts
462
462
  `;
463
463
  async function main() {
@@ -474,11 +474,11 @@ async function main() {
474
474
  const url = args.url ?? process.env.NEXT_PUBLIC_AURABASE_URL;
475
475
  const key = args.key ?? process.env.AURABASE_SERVICE_ROLE_KEY ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY;
476
476
  if (!url || !key) {
477
- console.error("[aurabase-gen] Erreur : URL et/ou cl\xE9 API du projet manquantes.\n");
478
- console.error("Sp\xE9cifiez-les via les arguments CLI (--url et --key) ou dans vos variables d\u2019environnement (.env / .env.local) :");
477
+ console.error("[aurabase-gen] Error: the project URL and/or API key is missing.\n");
478
+ console.error("Provide them through the CLI arguments (--url and --key) or in your environment variables (.env / .env.local):");
479
479
  console.error(" NEXT_PUBLIC_AURABASE_URL=https://<slug>.aurabase.cloud");
480
480
  console.error(" NEXT_PUBLIC_AURABASE_ANON_KEY=aura_anon_...\n");
481
- console.error("Ex\xE9cutez `npx @aurabase/gen --help` pour afficher toutes les options disponibles.");
481
+ console.error("Run `npx @aurabase/gen --help` to see all the available options.");
482
482
  process.exit(1);
483
483
  }
484
484
  const schemaName = args.schema ?? process.env.AURABASE_SCHEMA ?? "public";
@@ -486,7 +486,7 @@ async function main() {
486
486
  const client = aurabaseJs.createClient(url, key);
487
487
  const { data, error } = await client.db.schema();
488
488
  if (error) {
489
- console.error(`[aurabase-gen] Erreur de r\xE9cup\xE9ration du sch\xE9ma : ${error.message}`);
489
+ console.error(`[aurabase-gen] Error fetching the schema: ${error.message}`);
490
490
  process.exit(1);
491
491
  }
492
492
  const tables = data?.tables ?? [];
@@ -510,7 +510,7 @@ async function main() {
510
510
  if (outPath) {
511
511
  fs.writeFileSync(outPath, output);
512
512
  console.error(
513
- `[aurabase-gen] \u2713 Types \xE9crits dans ${outPath} (${tables.length} table(s), ${functions.length} fonction(s), ${enums.length} enum(s), ${views.length} vue(s)).`
513
+ `[aurabase-gen] \u2713 Types written to ${outPath} (${tables.length} table(s), ${functions.length} function(s), ${enums.length} enum(s), ${views.length} view(s)).`
514
514
  );
515
515
  } else {
516
516
  process.stdout.write(output);
package/dist/cli.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- declare const VERSION = "0.6.2";
2
+ declare const VERSION = "0.7.0";
3
3
  /**
4
4
  * Charge les fichiers .env locaux s'ils existent dans le répertoire courant.
5
5
  * Tente .env.local, .env.development.local, .env.development, .env par ordre de priorité.
package/dist/cli.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- declare const VERSION = "0.6.2";
2
+ declare const VERSION = "0.7.0";
3
3
  /**
4
4
  * Charge les fichiers .env locaux s'ils existent dans le répertoire courant.
5
5
  * Tente .env.local, .env.development.local, .env.development, .env par ordre de priorité.
package/dist/cli.js CHANGED
@@ -343,7 +343,7 @@ export type Enums<
343
343
  }
344
344
 
345
345
  // src/cli.ts
346
- var VERSION = "0.6.2";
346
+ var VERSION = "0.7.0";
347
347
  function loadEnvFiles() {
348
348
  const envCandidates = [".env.local", ".env.development.local", ".env.development", ".env"];
349
349
  for (const file of envCandidates) {
@@ -378,11 +378,11 @@ function loadEnvFiles() {
378
378
  }
379
379
  function diagnostiquerSchema(tables) {
380
380
  if (tables.length === 0) {
381
- return "Sch\xE9ma vide : aucune table. Les types g\xE9n\xE9r\xE9s seraient inutilisables.";
381
+ return "Empty schema: no table. The generated types would be unusable.";
382
382
  }
383
383
  const vides = tables.filter((t) => !t.columns || t.columns.length === 0).map((t) => t.name);
384
384
  if (vides.length > 0) {
385
- return `Tables sans aucune colonne : ${vides.join(", ")}. Les types g\xE9n\xE9r\xE9s pour elles seraient \xAB Row: {} \xBB \u2014 sans garantie : ils acceptent n'importe quel champ et n'en garantissent aucun. C'est le cas d'un projet MongoDB, dont le sch\xE9ma n'est pas d\xE9clar\xE9. Utilisez --allow-empty pour g\xE9n\xE9rer quand m\xEAme.`;
385
+ return `Tables without any column: ${vides.join(", ")}. The generated types for them would be "Row: {}", with no guarantee: they accept any field and guarantee none. This is the case of a MongoDB project, whose schema is not declared. Use --allow-empty to generate anyway.`;
386
386
  }
387
387
  return null;
388
388
  }
@@ -432,30 +432,30 @@ function parseArgs(argv) {
432
432
  return a;
433
433
  }
434
434
  var HELP_TEXT = `
435
- aurabase-gen (v${VERSION}) \u2014 G\xE9n\xE9rateur de types TypeScript pour Aurabase
435
+ aurabase-gen (v${VERSION}) \u2014 TypeScript type generator for Aurabase
436
436
 
437
- USAGE :
437
+ USAGE:
438
438
  npx @aurabase/gen [options]
439
- aurabase-gen --url <projectUrl> --key <apiKey> [--out <fichier>]
439
+ aurabase-gen --url <projectUrl> --key <apiKey> [--out <file>]
440
440
 
441
- OPTIONS :
442
- --url <url> URL du projet Aurabase (ex: https://mon-projet.aurabase.cloud)
443
- [Auto-d\xE9tection : NEXT_PUBLIC_AURABASE_URL]
444
- --key <cle> Cl\xE9 API du projet (anon ou service_role)
445
- [Auto-d\xE9tection : AURABASE_SERVICE_ROLE_KEY, puis NEXT_PUBLIC_AURABASE_ANON_KEY]
446
- -o, --out <fichier> Fichier de destination (ex: src/types/database.types.ts)
447
- Si omis, le r\xE9sultat est \xE9crit sur stdout.
448
- -s, --schema <nom> Nom du sch\xE9ma de base de donn\xE9es (d\xE9faut : 'public')
449
- -t, --type-name <t> Nom de l'interface principale g\xE9n\xE9r\xE9e (d\xE9faut : 'Database')
450
- --allow-empty G\xE9n\xE9rer les types m\xEAme si des tables n'ont pas de colonnes d\xE9clar\xE9es
451
- -h, --help Afficher cette aide
452
- -v, --version Afficher la version
441
+ OPTIONS:
442
+ --url <url> Aurabase project URL (e.g. https://my-project.aurabase.cloud)
443
+ [Auto-detected: NEXT_PUBLIC_AURABASE_URL]
444
+ --key <key> Project API key (anon or service_role)
445
+ [Auto-detected: AURABASE_SERVICE_ROLE_KEY, then NEXT_PUBLIC_AURABASE_ANON_KEY]
446
+ -o, --out <file> Output file (e.g. src/types/database.types.ts)
447
+ If omitted, the result is written to stdout.
448
+ -s, --schema <name> Database schema name (default: 'public')
449
+ -t, --type-name <t> Name of the main generated interface (default: 'Database')
450
+ --allow-empty Generate the types even if some tables have no declared columns
451
+ -h, --help Show this help
452
+ -v, --version Show the version
453
453
 
454
- EXEMPLES :
455
- # G\xE9n\xE9ration avec lecture automatique des variables d'environnement (.env / .env.local) :
454
+ EXAMPLES:
455
+ # Generation reading the environment variables automatically (.env / .env.local):
456
456
  npx @aurabase/gen --out src/types/database.types.ts
457
457
 
458
- # Param\xE8tres explicites :
458
+ # Explicit parameters:
459
459
  npx @aurabase/gen --url https://xyz.aurabase.cloud --key aura_anon_123 --out db.types.ts
460
460
  `;
461
461
  async function main() {
@@ -472,11 +472,11 @@ async function main() {
472
472
  const url = args.url ?? process.env.NEXT_PUBLIC_AURABASE_URL;
473
473
  const key = args.key ?? process.env.AURABASE_SERVICE_ROLE_KEY ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY;
474
474
  if (!url || !key) {
475
- console.error("[aurabase-gen] Erreur : URL et/ou cl\xE9 API du projet manquantes.\n");
476
- console.error("Sp\xE9cifiez-les via les arguments CLI (--url et --key) ou dans vos variables d\u2019environnement (.env / .env.local) :");
475
+ console.error("[aurabase-gen] Error: the project URL and/or API key is missing.\n");
476
+ console.error("Provide them through the CLI arguments (--url and --key) or in your environment variables (.env / .env.local):");
477
477
  console.error(" NEXT_PUBLIC_AURABASE_URL=https://<slug>.aurabase.cloud");
478
478
  console.error(" NEXT_PUBLIC_AURABASE_ANON_KEY=aura_anon_...\n");
479
- console.error("Ex\xE9cutez `npx @aurabase/gen --help` pour afficher toutes les options disponibles.");
479
+ console.error("Run `npx @aurabase/gen --help` to see all the available options.");
480
480
  process.exit(1);
481
481
  }
482
482
  const schemaName = args.schema ?? process.env.AURABASE_SCHEMA ?? "public";
@@ -484,7 +484,7 @@ async function main() {
484
484
  const client = createClient(url, key);
485
485
  const { data, error } = await client.db.schema();
486
486
  if (error) {
487
- console.error(`[aurabase-gen] Erreur de r\xE9cup\xE9ration du sch\xE9ma : ${error.message}`);
487
+ console.error(`[aurabase-gen] Error fetching the schema: ${error.message}`);
488
488
  process.exit(1);
489
489
  }
490
490
  const tables = data?.tables ?? [];
@@ -508,7 +508,7 @@ async function main() {
508
508
  if (outPath) {
509
509
  writeFileSync(outPath, output);
510
510
  console.error(
511
- `[aurabase-gen] \u2713 Types \xE9crits dans ${outPath} (${tables.length} table(s), ${functions.length} fonction(s), ${enums.length} enum(s), ${views.length} vue(s)).`
511
+ `[aurabase-gen] \u2713 Types written to ${outPath} (${tables.length} table(s), ${functions.length} function(s), ${enums.length} enum(s), ${views.length} view(s)).`
512
512
  );
513
513
  } else {
514
514
  process.stdout.write(output);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurabase/gen",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "Générateur de types TypeScript Database pour le SDK Aurabase (CLI aurabase-gen)",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -49,8 +49,8 @@
49
49
  "types"
50
50
  ],
51
51
  "dependencies": {
52
- "@aurabase/aurabase-js": "0.6.2",
53
- "@aurabase/core": "0.6.2"
52
+ "@aurabase/core": "0.7.0",
53
+ "@aurabase/aurabase-js": "0.7.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "tsup": "^8.0.0",