sql-typechecker 0.0.53 → 0.0.55
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 +40 -9
- package/out/cli.js.map +2 -2
- package/package.json +2 -4
package/out/cli.js
CHANGED
|
@@ -235922,7 +235922,10 @@ function normalizeTypeName(s) {
|
|
|
235922
235922
|
if (s === "bool") {
|
|
235923
235923
|
return "boolean";
|
|
235924
235924
|
}
|
|
235925
|
-
if (s === "
|
|
235925
|
+
if (s === "float4") {
|
|
235926
|
+
return "real";
|
|
235927
|
+
}
|
|
235928
|
+
if (s === "float" || s === "float8") {
|
|
235926
235929
|
return "double";
|
|
235927
235930
|
}
|
|
235928
235931
|
if (s === "double precision") {
|
|
@@ -241354,7 +241357,14 @@ var builtinoperatorsFromSchema = [
|
|
|
241354
241357
|
var builtinoperators = builtinoperatorsFromSyntax.concat(builtinoperatorsFromSchema);
|
|
241355
241358
|
|
|
241356
241359
|
// src/builtinunaryoperators.ts
|
|
241357
|
-
var builtinunaryoperatorsFromSyntax = [
|
|
241360
|
+
var builtinunaryoperatorsFromSyntax = [
|
|
241361
|
+
{
|
|
241362
|
+
name: {name: "NOT"},
|
|
241363
|
+
operand: {kind: "scalar", name: {name: "boolean"}},
|
|
241364
|
+
result: {kind: "scalar", name: {name: "boolean"}},
|
|
241365
|
+
description: ""
|
|
241366
|
+
}
|
|
241367
|
+
];
|
|
241358
241368
|
var builtinunaryoperatorsFromSchema = [
|
|
241359
241369
|
{
|
|
241360
241370
|
name: {name: "!"},
|
|
@@ -242060,8 +242070,21 @@ function doCreateTable(g, s) {
|
|
|
242060
242070
|
})
|
|
242061
242071
|
};
|
|
242062
242072
|
}
|
|
242063
|
-
function doCreateView(
|
|
242064
|
-
|
|
242073
|
+
function doCreateView(g, s) {
|
|
242074
|
+
const sel = elabSelect(g, {
|
|
242075
|
+
froms: [],
|
|
242076
|
+
decls: []
|
|
242077
|
+
}, Array.isArray(s.query) ? s.query[0] : s.query);
|
|
242078
|
+
if (sel.kind === "void") {
|
|
242079
|
+
throw new ErrorWithLocation(s._location, "View returns void");
|
|
242080
|
+
}
|
|
242081
|
+
return {
|
|
242082
|
+
...g,
|
|
242083
|
+
views: g.views.concat({
|
|
242084
|
+
name: s.name,
|
|
242085
|
+
rel: sel
|
|
242086
|
+
})
|
|
242087
|
+
};
|
|
242065
242088
|
}
|
|
242066
242089
|
function doAlterTable(_g, s) {
|
|
242067
242090
|
return notImplementedYet(s);
|
|
@@ -242453,7 +242476,8 @@ ${JSON.stringify(node)} @ ${node._location}` : "";
|
|
|
242453
242476
|
var UnknownField = class extends ErrorWithLocation {
|
|
242454
242477
|
constructor(e, s, n) {
|
|
242455
242478
|
super(e._location, `UnknownField ${n.name}.
|
|
242456
|
-
Keys present:
|
|
242479
|
+
Keys present:
|
|
242480
|
+
${s.fields.map((f) => (f.name?.name || "") + ": " + showType(f.type)).join("\n")}`);
|
|
242457
242481
|
}
|
|
242458
242482
|
};
|
|
242459
242483
|
var UnknownIdentifier = class extends ErrorWithLocation {
|
|
@@ -242912,7 +242936,11 @@ function elabCall(g, c, e) {
|
|
|
242912
242936
|
}
|
|
242913
242937
|
if (eqQNames(e.function, {name: "array_agg"})) {
|
|
242914
242938
|
if (e.args.length === 1) {
|
|
242915
|
-
|
|
242939
|
+
const subt = argTypes[0];
|
|
242940
|
+
if (subt.kind === "record") {
|
|
242941
|
+
throw new ErrorWithLocation(e.args[0]._location, "Can't have record type inside array");
|
|
242942
|
+
}
|
|
242943
|
+
return BuiltinTypeConstructors.Nullable(BuiltinTypeConstructors.Array(subt));
|
|
242916
242944
|
} else {
|
|
242917
242945
|
throw new InvalidArguments(e, e.function, argTypes);
|
|
242918
242946
|
}
|
|
@@ -243251,7 +243279,7 @@ function elabExpr(g, c, e) {
|
|
|
243251
243279
|
function inferNullability(c, e) {
|
|
243252
243280
|
if (e.type === "unary") {
|
|
243253
243281
|
if (e.op === "NOT") {
|
|
243254
|
-
return inferNullability(c, e).map((judg) => ({
|
|
243282
|
+
return inferNullability(c, e.operand).map((judg) => ({
|
|
243255
243283
|
...judg,
|
|
243256
243284
|
isNull: !judg.isNull
|
|
243257
243285
|
}));
|
|
@@ -243342,8 +243370,8 @@ function unnullify(s) {
|
|
|
243342
243370
|
return s;
|
|
243343
243371
|
}
|
|
243344
243372
|
}
|
|
243345
|
-
function checkAllCasesHandled(
|
|
243346
|
-
throw new Error(
|
|
243373
|
+
function checkAllCasesHandled(r) {
|
|
243374
|
+
throw new Error(`Oops didn't expect that, ${JSON.stringify(r)}`);
|
|
243347
243375
|
}
|
|
243348
243376
|
function showQName(n) {
|
|
243349
243377
|
return n.schema ? n.schema + "." + n.name : n.name;
|
|
@@ -243729,6 +243757,9 @@ async function go() {
|
|
|
243729
243757
|
const functionsOutFile = await prepOutFile(outFileName);
|
|
243730
243758
|
await fs.appendFile(outFileName, mkImportDomainsStatement(g.domains, outFileName, typesFile), "utf8");
|
|
243731
243759
|
for (let st of createFunctionStatements) {
|
|
243760
|
+
if (st.language?.name.toLowerCase() !== "sql") {
|
|
243761
|
+
continue;
|
|
243762
|
+
}
|
|
243732
243763
|
try {
|
|
243733
243764
|
const res = doCreateFunction(g, {decls: [], froms: []}, st);
|
|
243734
243765
|
const writing = prettier.format(functionToTypescript(res), {
|