sql-typechecker 0.0.15 → 0.0.16

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/out/cli.js CHANGED
@@ -243279,6 +243279,10 @@ CREATE FUNCTION ${f.name.name}(${argsForCreateFunction}) RETURNS ${f.multipleRow
243279
243279
  $$${f.code}$$ LANGUAGE ${f.language};
243280
243280
  `;
243281
243281
  const funcInvocation = `${f.name.name}(${f.inputs.map((inp, i) => "$" + (i + 1) + "::" + showTypeDroppingNullable(inp.type))})${asExpression}`;
243282
+ const deserializationAndReturn = f.returns.kind === "void" ? "" : `
243283
+ const rows = res.rows.map(row => ${genDeserialization(f.returns, "row")});
243284
+ return rows${f.multipleRows ? "" : "[0]"};
243285
+ `;
243282
243286
  return `
243283
243287
  export async function ${f.name.name}(pool: Pool, args: ${argsType})
243284
243288
  : Promise<${returnTypeAsString}>{
@@ -243288,8 +243292,7 @@ export async function ${f.name.name}(pool: Pool, args: ${argsType})
243288
243292
  values: [${argsAsList}],
243289
243293
  rowMode: "array",
243290
243294
  });
243291
- const rows = res.rows.map(row => ${genDeserialization(f.returns, "row")});
243292
- return rows${f.multipleRows ? "" : "[0]"};
243295
+ ${deserializationAndReturn}
243293
243296
  }
243294
243297
  `;
243295
243298
  }
@@ -243442,13 +243445,7 @@ async function go() {
243442
243445
  }
243443
243446
  await fs.appendFile(domainFile, `
243444
243447
  `, "utf-8");
243445
- const tablesIndexFile = path.format({
243446
- dir: outDir,
243447
- name: "tables",
243448
- ext: ".ts"
243449
- });
243450
243448
  await fs.mkdir(path.join(outDir, "tables"), {recursive: true});
243451
- await prepOutFile(tablesIndexFile);
243452
243449
  for (let table of g.tables) {
243453
243450
  const tableOutFile = path.format({
243454
243451
  dir: path.join(outDir, "tables"),
@@ -243459,8 +243456,6 @@ async function go() {
243459
243456
  const text = genCrudOperations(table);
243460
243457
  await fs.appendFile(tableOutFile, mkImportDomainsStatement(g.domains, tableOutFile, domainFile), "utf8");
243461
243458
  await fs.appendFile(tableOutFile, prettier.format(text, {parser: "typescript"}), "utf-8");
243462
- await fs.appendFile(tablesIndexFile, `export * as ${table.name.name} from "./tables/${table.name.name}";
243463
- `);
243464
243459
  }
243465
243460
  for (let f of allStatements) {
243466
243461
  const createFunctionStatements = f.statements.filter(isCreateFunctionStatement);
@@ -243483,7 +243478,7 @@ async function go() {
243483
243478
  } catch (err) {
243484
243479
  if (err instanceof ErrorWithLocation && err.l !== void 0) {
243485
243480
  debugger;
243486
- const found = findCode(st.code, err.l);
243481
+ const found = findCode(st.code || "", err.l);
243487
243482
  if (found) {
243488
243483
  console.error("");
243489
243484
  console.error(`Found error at line ${found.lineNumber}`);
@@ -243539,7 +243534,7 @@ function findInArgs(opts) {
243539
243534
  function mkImportDomainsStatement(domains, thisFile, domainFile) {
243540
243535
  const p = path.relative(path.dirname(thisFile), path.dirname(domainFile));
243541
243536
  const formatted = path.format({
243542
- dir: p,
243537
+ dir: p || ".",
243543
243538
  name: "domains",
243544
243539
  ext: ""
243545
243540
  });