introspeql 0.0.4 → 1.1.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/README.md +313 -83
- package/dist/comments/comment-converter.d.ts +54 -0
- package/dist/comments/comment-converter.js +185 -0
- package/dist/comments/index.d.ts +2 -0
- package/dist/comments/index.js +18 -0
- package/dist/comments/prettify-comment.d.ts +1 -0
- package/dist/comments/prettify-comment.js +18 -0
- package/dist/config/connection-options.d.ts +14 -0
- package/dist/config/connection-options.js +42 -0
- package/dist/config/create-relation-options.d.ts +22 -0
- package/dist/config/create-relation-options.js +60 -0
- package/dist/config/default-type-mappings.d.ts +13 -0
- package/dist/config/default-type-mappings.js +16 -0
- package/dist/config/entity-data.d.ts +6 -0
- package/dist/config/entity-data.js +8 -0
- package/dist/config/function-options.d.ts +23 -0
- package/dist/config/function-options.js +74 -0
- package/dist/config/general-options.d.ts +7 -0
- package/dist/config/general-options.js +75 -0
- package/dist/config/index.d.ts +123 -0
- package/dist/config/index.js +43 -0
- package/dist/config/materialized-view-options.d.ts +24 -0
- package/dist/config/materialized-view-options.js +5 -0
- package/dist/config/output-options.d.ts +8 -0
- package/dist/config/output-options.js +40 -0
- package/dist/config/table-options.d.ts +24 -0
- package/dist/config/table-options.js +5 -0
- package/dist/config/view-options.d.ts +24 -0
- package/dist/config/view-options.js +5 -0
- package/dist/enums/enum-data.d.ts +9 -0
- package/dist/enums/enum-data.js +11 -0
- package/dist/enums/enum-definition.d.ts +7 -0
- package/dist/enums/enum-definition.js +24 -0
- package/dist/enums/index.d.ts +4 -0
- package/dist/enums/index.js +20 -0
- package/dist/enums/is-enum-replaced-with-custom-type.d.ts +3 -0
- package/dist/enums/is-enum-replaced-with-custom-type.js +9 -0
- package/dist/enums/read-enum-data.d.ts +3 -0
- package/dist/enums/read-enum-data.js +57 -0
- package/dist/functions/function-data.d.ts +26 -0
- package/dist/functions/function-data.js +27 -0
- package/dist/functions/function-definition.d.ts +7 -0
- package/dist/functions/function-definition.js +21 -0
- package/dist/functions/index.d.ts +9 -0
- package/dist/functions/index.js +25 -0
- package/dist/functions/overload-type-definition.d.ts +8 -0
- package/dist/functions/overload-type-definition.js +21 -0
- package/dist/functions/parameter-type-definition-builder.d.ts +16 -0
- package/dist/functions/parameter-type-definition-builder.js +41 -0
- package/dist/functions/parameter-type-definition.d.ts +9 -0
- package/dist/functions/parameter-type-definition.js +28 -0
- package/dist/functions/read-function-data.d.ts +4 -0
- package/dist/functions/read-function-data.js +93 -0
- package/dist/functions/return-type-definition.d.ts +7 -0
- package/dist/functions/return-type-definition.js +20 -0
- package/dist/functions/should-include-function.d.ts +2 -0
- package/dist/functions/should-include-function.js +6 -0
- package/dist/functions/should-include-overload.d.ts +2 -0
- package/dist/functions/should-include-overload.js +23 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +7 -1
- package/dist/introspeql.d.ts +7 -0
- package/dist/introspeql.js +161 -0
- package/dist/relations/abstract-relation-definition.d.ts +11 -0
- package/dist/relations/abstract-relation-definition.js +43 -0
- package/dist/relations/column-data.d.ts +14 -0
- package/dist/relations/column-data.js +16 -0
- package/dist/relations/column-definition.d.ts +8 -0
- package/dist/relations/column-definition.js +19 -0
- package/dist/relations/column-type-definition.d.ts +7 -0
- package/dist/relations/column-type-definition.js +19 -0
- package/dist/relations/index.d.ts +11 -0
- package/dist/relations/index.js +27 -0
- package/dist/relations/materialized-view-definition.d.ts +4 -0
- package/dist/relations/materialized-view-definition.js +29 -0
- package/dist/relations/read-column-data.d.ts +3 -0
- package/dist/relations/read-column-data.js +55 -0
- package/dist/relations/read-relation-data.d.ts +4 -0
- package/dist/relations/read-relation-data.js +87 -0
- package/dist/relations/relation-data.d.ts +8 -0
- package/dist/relations/relation-data.js +10 -0
- package/dist/relations/should-include-relation.d.ts +10 -0
- package/dist/relations/should-include-relation.js +24 -0
- package/dist/relations/table-definition.d.ts +4 -0
- package/dist/relations/table-definition.js +29 -0
- package/dist/relations/view-definition.d.ts +4 -0
- package/dist/relations/view-definition.js +29 -0
- package/dist/schemas/index.d.ts +3 -0
- package/dist/schemas/index.js +19 -0
- package/dist/schemas/read-schema-data.d.ts +17 -0
- package/dist/schemas/read-schema-data.js +219 -0
- package/dist/schemas/schema-definition-factory.d.ts +15 -0
- package/dist/schemas/schema-definition-factory.js +177 -0
- package/dist/schemas/schema-definition.d.ts +13 -0
- package/dist/schemas/schema-definition.js +52 -0
- package/dist/shared/capitalize.d.ts +1 -0
- package/dist/shared/capitalize.js +6 -0
- package/dist/shared/convert-pg-identifier-to-ts-identifier.d.ts +19 -0
- package/dist/shared/convert-pg-identifier-to-ts-identifier.js +55 -0
- package/dist/shared/directives.d.ts +12 -0
- package/dist/shared/directives.js +16 -0
- package/dist/shared/get-tokens.d.ts +1 -0
- package/dist/shared/get-tokens.js +7 -0
- package/dist/shared/indent.d.ts +1 -0
- package/dist/shared/indent.js +9 -0
- package/dist/shared/index.d.ts +6 -0
- package/dist/shared/index.js +22 -0
- package/dist/shared/parsing-error.d.ts +3 -0
- package/dist/shared/parsing-error.js +26 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +17 -0
- package/dist/types/lookup-type.d.ts +15 -0
- package/dist/types/lookup-type.js +25 -0
- package/package.json +32 -17
- package/dist/append-schema.d.ts +0 -8
- package/dist/append-schema.js +0 -96
- package/dist/generate-types.d.ts +0 -8
- package/dist/generate-types.js +0 -110
- package/dist/introspect-columns.d.ts +0 -21
- package/dist/introspect-columns.js +0 -53
- package/dist/introspect-enum.d.ts +0 -20
- package/dist/introspect-enum.js +0 -24
- package/dist/introspect-procedures.d.ts +0 -53
- package/dist/introspect-procedures.js +0 -129
- package/dist/introspect-tables.d.ts +0 -19
- package/dist/introspect-tables.js +0 -43
- package/dist/introspeql-config.d.ts +0 -40
- package/dist/introspeql-config.js +0 -104
- package/dist/prepare-data-for-writing.d.ts +0 -38
- package/dist/prepare-data-for-writing.js +0 -145
- package/dist/snake-case-to-pascal-case.d.ts +0 -8
- package/dist/snake-case-to-pascal-case.js +0 -17
- package/dist/write-header.d.ts +0 -2
- package/dist/write-header.js +0 -10
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.outputOptions = void 0;
|
|
4
|
+
var zod_1 = require("zod");
|
|
5
|
+
exports.outputOptions = zod_1.z.union([
|
|
6
|
+
zod_1.z.object({
|
|
7
|
+
/**
|
|
8
|
+
* If set to `true` (the default), IntrospeQL will save the output to the
|
|
9
|
+
* file specified in the `outFile` option.
|
|
10
|
+
*
|
|
11
|
+
* If `false`, IntrospeQL will return the output as a string as it usually
|
|
12
|
+
* would, but will not save this string to disk. Useful for testing or if
|
|
13
|
+
* further processing is required before the output is saved.
|
|
14
|
+
*/
|
|
15
|
+
writeToDisk: zod_1.z.literal(true).optional().default(true),
|
|
16
|
+
/**
|
|
17
|
+
* The path to the file to which IntrospeQL should write output. Only valid
|
|
18
|
+
* if `writeToDisk` is `true`.
|
|
19
|
+
*/
|
|
20
|
+
outFile: zod_1.z.string({
|
|
21
|
+
message: 'outFile is required if writeToDisk is true',
|
|
22
|
+
}),
|
|
23
|
+
}),
|
|
24
|
+
zod_1.z.object({
|
|
25
|
+
/**
|
|
26
|
+
* If set to `true` (the default), IntrospeQL will save the output to the
|
|
27
|
+
* file specified in the `outFile` option.
|
|
28
|
+
*
|
|
29
|
+
* If `false`, IntrospeQL will return the output as a string as it usually
|
|
30
|
+
* would, but will not save this string to disk. Useful for testing or if
|
|
31
|
+
* further processing is required before the output is saved.
|
|
32
|
+
*/
|
|
33
|
+
writeToDisk: zod_1.z.literal(false),
|
|
34
|
+
/**
|
|
35
|
+
* The path to the file to which IntrospeQL should write output. Only valid
|
|
36
|
+
* if `writeToDisk` is `true`.
|
|
37
|
+
*/
|
|
38
|
+
outFile: zod_1.z.undefined().optional(),
|
|
39
|
+
}),
|
|
40
|
+
]);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const tableOptions: import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
2
|
+
mode: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
3
|
+
inclusive: "inclusive";
|
|
4
|
+
exclusive: "exclusive";
|
|
5
|
+
}>>>;
|
|
6
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
7
|
+
mode: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodLiteral<"inclusive">>>;
|
|
8
|
+
} & {
|
|
9
|
+
excludeTables: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
10
|
+
schema: import("zod").ZodString;
|
|
11
|
+
name: import("zod").ZodString;
|
|
12
|
+
}, import("zod/v4/core").$strip>>>>;
|
|
13
|
+
} & {
|
|
14
|
+
includeTables: import("zod").ZodOptional<import("zod").ZodUndefined>;
|
|
15
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
16
|
+
mode: import("zod").ZodLiteral<"exclusive">;
|
|
17
|
+
} & {
|
|
18
|
+
includeTables: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
19
|
+
schema: import("zod").ZodString;
|
|
20
|
+
name: import("zod").ZodString;
|
|
21
|
+
}, import("zod/v4/core").$strip>>>>;
|
|
22
|
+
} & {
|
|
23
|
+
excludeTables: import("zod").ZodOptional<import("zod").ZodUndefined>;
|
|
24
|
+
}, import("zod/v4/core").$strip>]>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const viewOptions: import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
2
|
+
mode: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
3
|
+
inclusive: "inclusive";
|
|
4
|
+
exclusive: "exclusive";
|
|
5
|
+
}>>>;
|
|
6
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
7
|
+
mode: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodLiteral<"inclusive">>>;
|
|
8
|
+
} & {
|
|
9
|
+
excludeViews: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
10
|
+
schema: import("zod").ZodString;
|
|
11
|
+
name: import("zod").ZodString;
|
|
12
|
+
}, import("zod/v4/core").$strip>>>>;
|
|
13
|
+
} & {
|
|
14
|
+
includeViews: import("zod").ZodOptional<import("zod").ZodUndefined>;
|
|
15
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
16
|
+
mode: import("zod").ZodLiteral<"exclusive">;
|
|
17
|
+
} & {
|
|
18
|
+
includeViews: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
19
|
+
schema: import("zod").ZodString;
|
|
20
|
+
name: import("zod").ZodString;
|
|
21
|
+
}, import("zod/v4/core").$strip>>>>;
|
|
22
|
+
} & {
|
|
23
|
+
excludeViews: import("zod").ZodOptional<import("zod").ZodUndefined>;
|
|
24
|
+
}, import("zod/v4/core").$strip>]>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const enumDataSchema: z.ZodObject<{
|
|
3
|
+
oid: z.ZodCoercedNumber<unknown>;
|
|
4
|
+
schema: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
values: z.ZodArray<z.ZodString>;
|
|
7
|
+
comment: z.ZodNullable<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type EnumData = z.infer<typeof enumDataSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enumDataSchema = void 0;
|
|
4
|
+
var zod_1 = require("zod");
|
|
5
|
+
exports.enumDataSchema = zod_1.z.object({
|
|
6
|
+
oid: zod_1.z.coerce.number(),
|
|
7
|
+
schema: zod_1.z.string(),
|
|
8
|
+
name: zod_1.z.string(),
|
|
9
|
+
values: zod_1.z.string().array(),
|
|
10
|
+
comment: zod_1.z.string().nullable(),
|
|
11
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnumDefinition = void 0;
|
|
4
|
+
var shared_1 = require("../shared");
|
|
5
|
+
var EnumDefinition = /** @class */ (function () {
|
|
6
|
+
function EnumDefinition(pgEnumName, values, comment) {
|
|
7
|
+
this.pgEnumName = pgEnumName;
|
|
8
|
+
this.values = values;
|
|
9
|
+
this.comment = comment;
|
|
10
|
+
}
|
|
11
|
+
EnumDefinition.prototype.toString = function () {
|
|
12
|
+
var tsEnumName = (0, shared_1.convertPGIdentifierToTSIdentifier)(this.pgEnumName);
|
|
13
|
+
if (this.values.length === 0)
|
|
14
|
+
return "export type ".concat(tsEnumName, " = never;");
|
|
15
|
+
var typeDefinition = this.values.map(function (v) { return "'".concat(v, "'"); }).join(' |\n');
|
|
16
|
+
var stringified = "export type ".concat(tsEnumName, " = |\n").concat((0, shared_1.indent)(typeDefinition, 2), ";");
|
|
17
|
+
if (this.comment) {
|
|
18
|
+
stringified = this.comment + '\n' + stringified;
|
|
19
|
+
}
|
|
20
|
+
return stringified;
|
|
21
|
+
};
|
|
22
|
+
return EnumDefinition;
|
|
23
|
+
}());
|
|
24
|
+
exports.EnumDefinition = EnumDefinition;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./enum-data"), exports);
|
|
18
|
+
__exportStar(require("./enum-definition"), exports);
|
|
19
|
+
__exportStar(require("./is-enum-replaced-with-custom-type"), exports);
|
|
20
|
+
__exportStar(require("./read-enum-data"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isEnumReplacedWithCustomType = isEnumReplacedWithCustomType;
|
|
4
|
+
function isEnumReplacedWithCustomType(enumData, config) {
|
|
5
|
+
var enumIdentifier = enumData.schema + '.' + enumData.name;
|
|
6
|
+
var customTypeIdentifiers = Object.keys(config.types);
|
|
7
|
+
var enumIsReplacedWithCustomType = customTypeIdentifiers.includes(enumIdentifier);
|
|
8
|
+
return enumIsReplacedWithCustomType;
|
|
9
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.readEnumData = readEnumData;
|
|
40
|
+
var enum_data_1 = require("./enum-data");
|
|
41
|
+
function readEnumData(client, typeOID) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
+
var query, parameters, results, enumData;
|
|
44
|
+
return __generator(this, function (_a) {
|
|
45
|
+
switch (_a.label) {
|
|
46
|
+
case 0:
|
|
47
|
+
query = "\nSELECT \n t.oid AS oid,\n n.nspname AS schema,\n t.typname AS name,\n ARRAY(SELECT enumlabel FROM pg_enum WHERE enumtypid = t.oid)::text[] AS values,\n obj_description(t.oid, 'pg_type') AS comment\nFROM pg_catalog.pg_type AS t\nINNER JOIN pg_catalog.pg_namespace AS n ON t.typnamespace = n.oid\nWHERE t.oid = $1;\n";
|
|
48
|
+
parameters = [typeOID];
|
|
49
|
+
return [4 /*yield*/, client.query(query, parameters)];
|
|
50
|
+
case 1:
|
|
51
|
+
results = _a.sent();
|
|
52
|
+
enumData = enum_data_1.enumDataSchema.parse(results.rows[0]);
|
|
53
|
+
return [2 /*return*/, enumData];
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const functionDataSchema: z.ZodObject<{
|
|
3
|
+
schema: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
overloads: z.ZodArray<z.ZodObject<{
|
|
6
|
+
paramTypes: z.ZodArray<z.ZodIntersection<z.ZodObject<{
|
|
7
|
+
oid: z.ZodCoercedNumber<unknown>;
|
|
8
|
+
schema: z.ZodString;
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
isEnum: z.ZodBoolean;
|
|
11
|
+
isArray: z.ZodBoolean;
|
|
12
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
+
isOptional: z.ZodBoolean;
|
|
14
|
+
isVariadic: z.ZodBoolean;
|
|
15
|
+
}, z.core.$strip>>>;
|
|
16
|
+
returnType: z.ZodObject<{
|
|
17
|
+
oid: z.ZodCoercedNumber<unknown>;
|
|
18
|
+
schema: z.ZodString;
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
isEnum: z.ZodBoolean;
|
|
21
|
+
isArray: z.ZodBoolean;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
comment: z.ZodNullable<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export type FunctionData = z.infer<typeof functionDataSchema>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.functionDataSchema = void 0;
|
|
4
|
+
var zod_1 = require("zod");
|
|
5
|
+
var typeSchema = zod_1.z.object({
|
|
6
|
+
oid: zod_1.z.coerce.number(),
|
|
7
|
+
schema: zod_1.z.string(),
|
|
8
|
+
name: zod_1.z.string(),
|
|
9
|
+
isEnum: zod_1.z.boolean(),
|
|
10
|
+
isArray: zod_1.z.boolean(),
|
|
11
|
+
});
|
|
12
|
+
exports.functionDataSchema = zod_1.z.object({
|
|
13
|
+
schema: zod_1.z.string(),
|
|
14
|
+
name: zod_1.z.string(),
|
|
15
|
+
overloads: zod_1.z
|
|
16
|
+
.object({
|
|
17
|
+
paramTypes: typeSchema
|
|
18
|
+
.and(zod_1.z.object({
|
|
19
|
+
isOptional: zod_1.z.boolean(),
|
|
20
|
+
isVariadic: zod_1.z.boolean(),
|
|
21
|
+
}))
|
|
22
|
+
.array(),
|
|
23
|
+
returnType: typeSchema,
|
|
24
|
+
comment: zod_1.z.string().nullable(),
|
|
25
|
+
})
|
|
26
|
+
.array(),
|
|
27
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OverloadTypeDefinition } from './overload-type-definition';
|
|
2
|
+
export declare class FunctionDefinition {
|
|
3
|
+
protected pgFunctionName: string;
|
|
4
|
+
protected overloadTypeDefinitions: OverloadTypeDefinition[];
|
|
5
|
+
constructor(pgFunctionName: string, overloadTypeDefinitions: OverloadTypeDefinition[]);
|
|
6
|
+
toString(): string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FunctionDefinition = void 0;
|
|
4
|
+
var shared_1 = require("../shared");
|
|
5
|
+
var FunctionDefinition = /** @class */ (function () {
|
|
6
|
+
function FunctionDefinition(pgFunctionName, overloadTypeDefinitions) {
|
|
7
|
+
this.pgFunctionName = pgFunctionName;
|
|
8
|
+
this.overloadTypeDefinitions = overloadTypeDefinitions;
|
|
9
|
+
}
|
|
10
|
+
FunctionDefinition.prototype.toString = function () {
|
|
11
|
+
var tsNamespaceName = (0, shared_1.convertPGIdentifierToTSIdentifier)(this.pgFunctionName);
|
|
12
|
+
var overloads = this.overloadTypeDefinitions
|
|
13
|
+
.map(function (overloadTypeDef) {
|
|
14
|
+
return overloadTypeDef.toString();
|
|
15
|
+
})
|
|
16
|
+
.join(',\n');
|
|
17
|
+
return "export namespace ".concat(tsNamespaceName, " {\n export const PGFunctionName = '").concat(this.pgFunctionName, "';\n\n export type Overloads = [\n").concat((0, shared_1.indent)(overloads, 4), "\n ];\n}");
|
|
18
|
+
};
|
|
19
|
+
return FunctionDefinition;
|
|
20
|
+
}());
|
|
21
|
+
exports.FunctionDefinition = FunctionDefinition;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './function-data';
|
|
2
|
+
export * from './function-definition';
|
|
3
|
+
export * from './overload-type-definition';
|
|
4
|
+
export * from './parameter-type-definition-builder';
|
|
5
|
+
export * from './parameter-type-definition';
|
|
6
|
+
export * from './read-function-data';
|
|
7
|
+
export * from './return-type-definition';
|
|
8
|
+
export * from './should-include-function';
|
|
9
|
+
export * from './should-include-overload';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./function-data"), exports);
|
|
18
|
+
__exportStar(require("./function-definition"), exports);
|
|
19
|
+
__exportStar(require("./overload-type-definition"), exports);
|
|
20
|
+
__exportStar(require("./parameter-type-definition-builder"), exports);
|
|
21
|
+
__exportStar(require("./parameter-type-definition"), exports);
|
|
22
|
+
__exportStar(require("./read-function-data"), exports);
|
|
23
|
+
__exportStar(require("./return-type-definition"), exports);
|
|
24
|
+
__exportStar(require("./should-include-function"), exports);
|
|
25
|
+
__exportStar(require("./should-include-overload"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ParameterTypeDefinition } from './parameter-type-definition';
|
|
2
|
+
import { ReturnTypeDefinition } from './return-type-definition';
|
|
3
|
+
export declare class OverloadTypeDefinition {
|
|
4
|
+
protected parameterTypeDefinitions: ParameterTypeDefinition[];
|
|
5
|
+
protected returnTypeTypeDefinition: ReturnTypeDefinition;
|
|
6
|
+
constructor(parameterTypeDefinitions: ParameterTypeDefinition[], returnTypeTypeDefinition: ReturnTypeDefinition);
|
|
7
|
+
toString(): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OverloadTypeDefinition = void 0;
|
|
4
|
+
var shared_1 = require("../shared");
|
|
5
|
+
var OverloadTypeDefinition = /** @class */ (function () {
|
|
6
|
+
function OverloadTypeDefinition(parameterTypeDefinitions, returnTypeTypeDefinition) {
|
|
7
|
+
this.parameterTypeDefinitions = parameterTypeDefinitions;
|
|
8
|
+
this.returnTypeTypeDefinition = returnTypeTypeDefinition;
|
|
9
|
+
}
|
|
10
|
+
OverloadTypeDefinition.prototype.toString = function () {
|
|
11
|
+
var parameterTypes = 'ParameterTypes: [\n' +
|
|
12
|
+
this.parameterTypeDefinitions
|
|
13
|
+
.map(function (paramTypeDef) { return ' ' + paramTypeDef.toString(); })
|
|
14
|
+
.join(',\n') +
|
|
15
|
+
'\n]';
|
|
16
|
+
var returnType = 'ReturnType: ' + this.returnTypeTypeDefinition.toString();
|
|
17
|
+
return ('{\n' + (0, shared_1.indent)(parameterTypes, 2) + ',\n' + (0, shared_1.indent)(returnType, 2) + '\n}');
|
|
18
|
+
};
|
|
19
|
+
return OverloadTypeDefinition;
|
|
20
|
+
}());
|
|
21
|
+
exports.OverloadTypeDefinition = OverloadTypeDefinition;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ParameterTypeDefinition } from './parameter-type-definition';
|
|
2
|
+
export declare class ParameterTypeDefinitionBuilder {
|
|
3
|
+
protected tsType: string;
|
|
4
|
+
protected isArray: boolean;
|
|
5
|
+
protected isNullable: boolean;
|
|
6
|
+
protected isVariadic: boolean;
|
|
7
|
+
protected isOptional: boolean;
|
|
8
|
+
static getBuilder(): ParameterTypeDefinitionBuilder;
|
|
9
|
+
withTSType(tsType: string): ParameterTypeDefinitionBuilder;
|
|
10
|
+
withIsArray(isArray: boolean): ParameterTypeDefinitionBuilder;
|
|
11
|
+
withIsNullable(isNullable: boolean): ParameterTypeDefinitionBuilder;
|
|
12
|
+
withIsVariadic(isVariadic: boolean): ParameterTypeDefinitionBuilder;
|
|
13
|
+
withIsOptional(isOptional: boolean): ParameterTypeDefinitionBuilder;
|
|
14
|
+
build(): ParameterTypeDefinition;
|
|
15
|
+
private constructor();
|
|
16
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParameterTypeDefinitionBuilder = void 0;
|
|
4
|
+
var parameter_type_definition_1 = require("./parameter-type-definition");
|
|
5
|
+
var ParameterTypeDefinitionBuilder = /** @class */ (function () {
|
|
6
|
+
function ParameterTypeDefinitionBuilder(tsType, isArray, isNullable, isVariadic, isOptional) {
|
|
7
|
+
if (tsType === void 0) { tsType = 'unknown'; }
|
|
8
|
+
if (isArray === void 0) { isArray = false; }
|
|
9
|
+
if (isNullable === void 0) { isNullable = false; }
|
|
10
|
+
if (isVariadic === void 0) { isVariadic = false; }
|
|
11
|
+
if (isOptional === void 0) { isOptional = false; }
|
|
12
|
+
this.tsType = tsType;
|
|
13
|
+
this.isArray = isArray;
|
|
14
|
+
this.isNullable = isNullable;
|
|
15
|
+
this.isVariadic = isVariadic;
|
|
16
|
+
this.isOptional = isOptional;
|
|
17
|
+
}
|
|
18
|
+
ParameterTypeDefinitionBuilder.getBuilder = function () {
|
|
19
|
+
return new ParameterTypeDefinitionBuilder();
|
|
20
|
+
};
|
|
21
|
+
ParameterTypeDefinitionBuilder.prototype.withTSType = function (tsType) {
|
|
22
|
+
return new ParameterTypeDefinitionBuilder(tsType, this.isArray, this.isNullable, this.isVariadic, this.isOptional);
|
|
23
|
+
};
|
|
24
|
+
ParameterTypeDefinitionBuilder.prototype.withIsArray = function (isArray) {
|
|
25
|
+
return new ParameterTypeDefinitionBuilder(this.tsType, isArray, this.isNullable, this.isVariadic, this.isOptional);
|
|
26
|
+
};
|
|
27
|
+
ParameterTypeDefinitionBuilder.prototype.withIsNullable = function (isNullable) {
|
|
28
|
+
return new ParameterTypeDefinitionBuilder(this.tsType, this.isArray, isNullable, this.isVariadic, this.isOptional);
|
|
29
|
+
};
|
|
30
|
+
ParameterTypeDefinitionBuilder.prototype.withIsVariadic = function (isVariadic) {
|
|
31
|
+
return new ParameterTypeDefinitionBuilder(this.tsType, this.isArray, this.isNullable, isVariadic, this.isOptional);
|
|
32
|
+
};
|
|
33
|
+
ParameterTypeDefinitionBuilder.prototype.withIsOptional = function (isOptional) {
|
|
34
|
+
return new ParameterTypeDefinitionBuilder(this.tsType, this.isArray, this.isNullable, this.isVariadic, isOptional);
|
|
35
|
+
};
|
|
36
|
+
ParameterTypeDefinitionBuilder.prototype.build = function () {
|
|
37
|
+
return new parameter_type_definition_1.ParameterTypeDefinition(this.tsType, this.isArray, this.isNullable, this.isVariadic, this.isOptional);
|
|
38
|
+
};
|
|
39
|
+
return ParameterTypeDefinitionBuilder;
|
|
40
|
+
}());
|
|
41
|
+
exports.ParameterTypeDefinitionBuilder = ParameterTypeDefinitionBuilder;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class ParameterTypeDefinition {
|
|
2
|
+
protected tsType: string;
|
|
3
|
+
protected isArray: boolean;
|
|
4
|
+
protected isNullable: boolean;
|
|
5
|
+
protected isVariadic: boolean;
|
|
6
|
+
protected isOptional: boolean;
|
|
7
|
+
constructor(tsType: string, isArray: boolean, isNullable: boolean, isVariadic: boolean, isOptional: boolean);
|
|
8
|
+
toString(): string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParameterTypeDefinition = void 0;
|
|
4
|
+
var ParameterTypeDefinition = /** @class */ (function () {
|
|
5
|
+
function ParameterTypeDefinition(tsType, isArray, isNullable, isVariadic, isOptional) {
|
|
6
|
+
this.tsType = tsType;
|
|
7
|
+
this.isArray = isArray;
|
|
8
|
+
this.isNullable = isNullable;
|
|
9
|
+
this.isVariadic = isVariadic;
|
|
10
|
+
this.isOptional = isOptional;
|
|
11
|
+
}
|
|
12
|
+
ParameterTypeDefinition.prototype.toString = function () {
|
|
13
|
+
var type = this.tsType;
|
|
14
|
+
if (this.isVariadic) {
|
|
15
|
+
type = "...".concat(type, "[]");
|
|
16
|
+
return type;
|
|
17
|
+
}
|
|
18
|
+
if (this.isArray)
|
|
19
|
+
type = "".concat(type, "[]");
|
|
20
|
+
if (this.isNullable)
|
|
21
|
+
type = "".concat(type, " | null");
|
|
22
|
+
if (this.isOptional)
|
|
23
|
+
type = "".concat(type, " | undefined");
|
|
24
|
+
return type;
|
|
25
|
+
};
|
|
26
|
+
return ParameterTypeDefinition;
|
|
27
|
+
}());
|
|
28
|
+
exports.ParameterTypeDefinition = ParameterTypeDefinition;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
+
if (ar || !(i in from)) {
|
|
52
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
+
ar[i] = from[i];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
+
};
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.readFunctionData = readFunctionData;
|
|
60
|
+
var function_data_1 = require("./function-data");
|
|
61
|
+
var should_include_overload_1 = require("./should-include-overload");
|
|
62
|
+
var should_include_function_1 = require("./should-include-function");
|
|
63
|
+
function readFunctionData(client, config) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
+
var schemaPlaceholders, query, parameters, result, functionData;
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
switch (_a.label) {
|
|
68
|
+
case 0:
|
|
69
|
+
schemaPlaceholders = config.schemas
|
|
70
|
+
.map(function (_, i) { return "$".concat(i + 1); })
|
|
71
|
+
.join(', ');
|
|
72
|
+
query = "\nSELECT \n p1.proname AS name, \n n1.nspname AS schema,\n ARRAY(\n SELECT jsonb_build_object(\n 'paramTypes',\n\t ARRAY(\n SELECT jsonb_build_object(\n\t 'oid',\n\t t.oid,\n\t 'schema',\n\t n2.nspname,\n\t 'name',\n\t t.typname,\n\t\t 'isEnum',\n\t t.typtype = 'e',\n\t 'isArray',\n\t EXISTS(SELECT 1 FROM pg_catalog.pg_type AS t WHERE t.typarray = args.argType),\n\t\t 'isOptional',\n\t\t CASE \n\t\t WHEN args.argOrd > p2.pronargs - p2.pronargdefaults THEN TRUE\n\t\t\t ELSE FALSE\n\t\t END,\n\t\t 'isVariadic',\n\t\t CASE \n\t\t WHEN p2.provariadic > 0 AND p2.pronargs = args.argOrd THEN TRUE\n\t\t\t ELSE FALSE\n\t END\n\t ) FROM UNNEST(p2.proargtypes) WITH ORDINALITY AS args(argType, argOrd)\n\t INNER JOIN pg_catalog.pg_type as t ON \n\t CASE \n\t WHEN EXISTS(SELECT 1 FROM pg_catalog.pg_type AS t WHERE t.typarray = args.argType) \n\t\t THEN args.argType = t.typarray\n\t\t ELSE args.argType = t.oid\n\t END\n\t INNER JOIN pg_catalog.pg_namespace AS n2 ON t.typnamespace = n2.oid\n ),\n\t 'returnType',\n\t (\n\t SELECT jsonb_build_object(\n\t \t 'oid',\n\t t.oid,\n\t 'schema',\n\t n.nspname,\n\t 'name',\n\t t.typname,\n\t\t 'isEnum',\n\t t.typtype = 'e',\n\t 'isArray',\n\t EXISTS(SELECT 1 FROM pg_catalog.pg_type AS t WHERE t.typarray = p2.prorettype)\n ) FROM pg_catalog.pg_type AS t\n\t INNER JOIN pg_catalog.pg_namespace as n\n\t ON t.typnamespace = n.oid\n\t WHERE CASE \n\t WHEN EXISTS(SELECT 1 FROM pg_catalog.pg_type AS t WHERE t.typarray = p2.prorettype) \n\t\t THEN t.typarray = p2.prorettype\n\t\t ELSE t.oid = p2.prorettype\n\t END\n\t ),\n\t 'comment',\n\t obj_description(p2.oid, 'pg_proc')\n\t) FROM pg_catalog.pg_proc AS p2 WHERE p2.proname = p1.proname ORDER BY p2.oid\n) AS overloads\nFROM pg_catalog.pg_proc AS p1\nINNER JOIN pg_catalog.pg_namespace AS n1 ON p1.pronamespace = n1.oid\nWHERE p1.prokind = 'f' AND n1.nspname IN (".concat(schemaPlaceholders, ")\nGROUP BY (p1.proname, n1.nspname);\n");
|
|
73
|
+
parameters = __spreadArray([], config.schemas, true);
|
|
74
|
+
return [4 /*yield*/, client.query(query, parameters)];
|
|
75
|
+
case 1:
|
|
76
|
+
result = _a.sent();
|
|
77
|
+
functionData = function_data_1.functionDataSchema
|
|
78
|
+
.array()
|
|
79
|
+
.parse(result.rows)
|
|
80
|
+
.map(function (fd) {
|
|
81
|
+
return __assign(__assign({}, fd), { overloads: fd.overloads.filter(function (_a) {
|
|
82
|
+
var comment = _a.comment;
|
|
83
|
+
return (0, should_include_overload_1.shouldIncludeOverload)(fd.schema, fd.name, comment, config);
|
|
84
|
+
}) });
|
|
85
|
+
})
|
|
86
|
+
.filter(function (fd) {
|
|
87
|
+
return (0, should_include_function_1.shouldIncludeFunction)(fd);
|
|
88
|
+
});
|
|
89
|
+
return [2 /*return*/, functionData];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|