sql-typechecker 0.0.15 → 0.0.18

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
@@ -242811,6 +242811,9 @@ function elabCall(g, c, e) {
242811
242811
  throw new InvalidArguments(e, e.function, argTypes);
242812
242812
  }
242813
242813
  }
242814
+ if (eqQNames(e.function, {name: "nextval"})) {
242815
+ return unifyCallGeneral(e, argTypes, [BuiltinTypes.Text], BuiltinTypes.Bigint);
242816
+ }
242814
242817
  if (eqQNames(e.function, {name: "any"}) || eqQNames(e.function, {name: "some"}) || eqQNames(e.function, {name: "all"})) {
242815
242818
  if (e.args.length !== 1) {
242816
242819
  throw new InvalidArguments(e, e.function, argTypes);
@@ -243279,6 +243282,10 @@ CREATE FUNCTION ${f.name.name}(${argsForCreateFunction}) RETURNS ${f.multipleRow
243279
243282
  $$${f.code}$$ LANGUAGE ${f.language};
243280
243283
  `;
243281
243284
  const funcInvocation = `${f.name.name}(${f.inputs.map((inp, i) => "$" + (i + 1) + "::" + showTypeDroppingNullable(inp.type))})${asExpression}`;
243285
+ const deserializationAndReturn = f.returns.kind === "void" ? "" : `
243286
+ const rows = res.rows.map(row => ${genDeserialization(f.returns, "row")});
243287
+ return rows${f.multipleRows ? "" : "[0]"};
243288
+ `;
243282
243289
  return `
243283
243290
  export async function ${f.name.name}(pool: Pool, args: ${argsType})
243284
243291
  : Promise<${returnTypeAsString}>{
@@ -243288,8 +243295,7 @@ export async function ${f.name.name}(pool: Pool, args: ${argsType})
243288
243295
  values: [${argsAsList}],
243289
243296
  rowMode: "array",
243290
243297
  });
243291
- const rows = res.rows.map(row => ${genDeserialization(f.returns, "row")});
243292
- return rows${f.multipleRows ? "" : "[0]"};
243298
+ ${deserializationAndReturn}
243293
243299
  }
243294
243300
  `;
243295
243301
  }
@@ -243442,13 +243448,7 @@ async function go() {
243442
243448
  }
243443
243449
  await fs.appendFile(domainFile, `
243444
243450
  `, "utf-8");
243445
- const tablesIndexFile = path.format({
243446
- dir: outDir,
243447
- name: "tables",
243448
- ext: ".ts"
243449
- });
243450
243451
  await fs.mkdir(path.join(outDir, "tables"), {recursive: true});
243451
- await prepOutFile(tablesIndexFile);
243452
243452
  for (let table of g.tables) {
243453
243453
  const tableOutFile = path.format({
243454
243454
  dir: path.join(outDir, "tables"),
@@ -243459,8 +243459,6 @@ async function go() {
243459
243459
  const text = genCrudOperations(table);
243460
243460
  await fs.appendFile(tableOutFile, mkImportDomainsStatement(g.domains, tableOutFile, domainFile), "utf8");
243461
243461
  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
243462
  }
243465
243463
  for (let f of allStatements) {
243466
243464
  const createFunctionStatements = f.statements.filter(isCreateFunctionStatement);
@@ -243483,7 +243481,7 @@ async function go() {
243483
243481
  } catch (err) {
243484
243482
  if (err instanceof ErrorWithLocation && err.l !== void 0) {
243485
243483
  debugger;
243486
- const found = findCode(st.code, err.l);
243484
+ const found = findCode(st.code || "", err.l);
243487
243485
  if (found) {
243488
243486
  console.error("");
243489
243487
  console.error(`Found error at line ${found.lineNumber}`);
@@ -243539,7 +243537,7 @@ function findInArgs(opts) {
243539
243537
  function mkImportDomainsStatement(domains, thisFile, domainFile) {
243540
243538
  const p = path.relative(path.dirname(thisFile), path.dirname(domainFile));
243541
243539
  const formatted = path.format({
243542
- dir: p,
243540
+ dir: p || ".",
243543
243541
  name: "domains",
243544
243542
  ext: ""
243545
243543
  });