true-pg 0.4.1 → 0.4.3
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/lib/extractor/adapter.js
CHANGED
package/lib/extractor/index.js
CHANGED
@@ -33,6 +33,16 @@ const populatorMap = {
|
|
33
33
|
domain: extractDomain,
|
34
34
|
range: extractRange,
|
35
35
|
};
|
36
|
+
const supported_kinds = [
|
37
|
+
"table",
|
38
|
+
"view",
|
39
|
+
"materializedView",
|
40
|
+
"enum",
|
41
|
+
"composite",
|
42
|
+
"function",
|
43
|
+
"domain",
|
44
|
+
"range",
|
45
|
+
];
|
36
46
|
export class Extractor {
|
37
47
|
db;
|
38
48
|
/**
|
@@ -103,11 +113,11 @@ export class Extractor {
|
|
103
113
|
}
|
104
114
|
const pgTypes = await fetchTypes(db, schemaNames);
|
105
115
|
const filtered = options?.typeFilter ? pgTypes.filter(element => options.typeFilter(element)) : pgTypes;
|
106
|
-
const typesToExtract = filtered.filter(x => x.kind);
|
107
|
-
const skipped = filtered.filter(x => !x.kind).map(x => x.
|
116
|
+
const typesToExtract = filtered.filter(x => supported_kinds.includes(x.kind));
|
117
|
+
const skipped = filtered.filter(x => !supported_kinds.includes(x.kind)).map(x => `${x} (${x.kind})`);
|
108
118
|
if (skipped.length) {
|
109
119
|
console.warn("Skipping types of unsupported kinds:", skipped.join(", "));
|
110
|
-
console.warn("This is a bug!");
|
120
|
+
console.warn("This is a bug! Proceeding as if nothing happened.");
|
111
121
|
}
|
112
122
|
options?.onProgressStart?.(typesToExtract.length);
|
113
123
|
const populated = (await Promise.all(typesToExtract.map(async (pgType) => {
|