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.
Files changed (134) hide show
  1. package/README.md +313 -83
  2. package/dist/comments/comment-converter.d.ts +54 -0
  3. package/dist/comments/comment-converter.js +185 -0
  4. package/dist/comments/index.d.ts +2 -0
  5. package/dist/comments/index.js +18 -0
  6. package/dist/comments/prettify-comment.d.ts +1 -0
  7. package/dist/comments/prettify-comment.js +18 -0
  8. package/dist/config/connection-options.d.ts +14 -0
  9. package/dist/config/connection-options.js +42 -0
  10. package/dist/config/create-relation-options.d.ts +22 -0
  11. package/dist/config/create-relation-options.js +60 -0
  12. package/dist/config/default-type-mappings.d.ts +13 -0
  13. package/dist/config/default-type-mappings.js +16 -0
  14. package/dist/config/entity-data.d.ts +6 -0
  15. package/dist/config/entity-data.js +8 -0
  16. package/dist/config/function-options.d.ts +23 -0
  17. package/dist/config/function-options.js +74 -0
  18. package/dist/config/general-options.d.ts +7 -0
  19. package/dist/config/general-options.js +75 -0
  20. package/dist/config/index.d.ts +123 -0
  21. package/dist/config/index.js +43 -0
  22. package/dist/config/materialized-view-options.d.ts +24 -0
  23. package/dist/config/materialized-view-options.js +5 -0
  24. package/dist/config/output-options.d.ts +8 -0
  25. package/dist/config/output-options.js +40 -0
  26. package/dist/config/table-options.d.ts +24 -0
  27. package/dist/config/table-options.js +5 -0
  28. package/dist/config/view-options.d.ts +24 -0
  29. package/dist/config/view-options.js +5 -0
  30. package/dist/enums/enum-data.d.ts +9 -0
  31. package/dist/enums/enum-data.js +11 -0
  32. package/dist/enums/enum-definition.d.ts +7 -0
  33. package/dist/enums/enum-definition.js +24 -0
  34. package/dist/enums/index.d.ts +4 -0
  35. package/dist/enums/index.js +20 -0
  36. package/dist/enums/is-enum-replaced-with-custom-type.d.ts +3 -0
  37. package/dist/enums/is-enum-replaced-with-custom-type.js +9 -0
  38. package/dist/enums/read-enum-data.d.ts +3 -0
  39. package/dist/enums/read-enum-data.js +57 -0
  40. package/dist/functions/function-data.d.ts +26 -0
  41. package/dist/functions/function-data.js +27 -0
  42. package/dist/functions/function-definition.d.ts +7 -0
  43. package/dist/functions/function-definition.js +21 -0
  44. package/dist/functions/index.d.ts +9 -0
  45. package/dist/functions/index.js +25 -0
  46. package/dist/functions/overload-type-definition.d.ts +8 -0
  47. package/dist/functions/overload-type-definition.js +21 -0
  48. package/dist/functions/parameter-type-definition-builder.d.ts +16 -0
  49. package/dist/functions/parameter-type-definition-builder.js +41 -0
  50. package/dist/functions/parameter-type-definition.d.ts +9 -0
  51. package/dist/functions/parameter-type-definition.js +28 -0
  52. package/dist/functions/read-function-data.d.ts +4 -0
  53. package/dist/functions/read-function-data.js +93 -0
  54. package/dist/functions/return-type-definition.d.ts +7 -0
  55. package/dist/functions/return-type-definition.js +20 -0
  56. package/dist/functions/should-include-function.d.ts +2 -0
  57. package/dist/functions/should-include-function.js +6 -0
  58. package/dist/functions/should-include-overload.d.ts +2 -0
  59. package/dist/functions/should-include-overload.js +23 -0
  60. package/dist/index.d.ts +3 -2
  61. package/dist/index.js +7 -1
  62. package/dist/introspeql.d.ts +7 -0
  63. package/dist/introspeql.js +161 -0
  64. package/dist/relations/abstract-relation-definition.d.ts +11 -0
  65. package/dist/relations/abstract-relation-definition.js +43 -0
  66. package/dist/relations/column-data.d.ts +14 -0
  67. package/dist/relations/column-data.js +16 -0
  68. package/dist/relations/column-definition.d.ts +8 -0
  69. package/dist/relations/column-definition.js +19 -0
  70. package/dist/relations/column-type-definition.d.ts +7 -0
  71. package/dist/relations/column-type-definition.js +19 -0
  72. package/dist/relations/index.d.ts +11 -0
  73. package/dist/relations/index.js +27 -0
  74. package/dist/relations/materialized-view-definition.d.ts +4 -0
  75. package/dist/relations/materialized-view-definition.js +29 -0
  76. package/dist/relations/read-column-data.d.ts +3 -0
  77. package/dist/relations/read-column-data.js +55 -0
  78. package/dist/relations/read-relation-data.d.ts +4 -0
  79. package/dist/relations/read-relation-data.js +87 -0
  80. package/dist/relations/relation-data.d.ts +8 -0
  81. package/dist/relations/relation-data.js +10 -0
  82. package/dist/relations/should-include-relation.d.ts +10 -0
  83. package/dist/relations/should-include-relation.js +24 -0
  84. package/dist/relations/table-definition.d.ts +4 -0
  85. package/dist/relations/table-definition.js +29 -0
  86. package/dist/relations/view-definition.d.ts +4 -0
  87. package/dist/relations/view-definition.js +29 -0
  88. package/dist/schemas/index.d.ts +3 -0
  89. package/dist/schemas/index.js +19 -0
  90. package/dist/schemas/read-schema-data.d.ts +17 -0
  91. package/dist/schemas/read-schema-data.js +219 -0
  92. package/dist/schemas/schema-definition-factory.d.ts +15 -0
  93. package/dist/schemas/schema-definition-factory.js +177 -0
  94. package/dist/schemas/schema-definition.d.ts +13 -0
  95. package/dist/schemas/schema-definition.js +52 -0
  96. package/dist/shared/capitalize.d.ts +1 -0
  97. package/dist/shared/capitalize.js +6 -0
  98. package/dist/shared/convert-pg-identifier-to-ts-identifier.d.ts +19 -0
  99. package/dist/shared/convert-pg-identifier-to-ts-identifier.js +55 -0
  100. package/dist/shared/directives.d.ts +12 -0
  101. package/dist/shared/directives.js +16 -0
  102. package/dist/shared/get-tokens.d.ts +1 -0
  103. package/dist/shared/get-tokens.js +7 -0
  104. package/dist/shared/indent.d.ts +1 -0
  105. package/dist/shared/indent.js +9 -0
  106. package/dist/shared/index.d.ts +6 -0
  107. package/dist/shared/index.js +22 -0
  108. package/dist/shared/parsing-error.d.ts +3 -0
  109. package/dist/shared/parsing-error.js +26 -0
  110. package/dist/types/index.d.ts +1 -0
  111. package/dist/types/index.js +17 -0
  112. package/dist/types/lookup-type.d.ts +15 -0
  113. package/dist/types/lookup-type.js +25 -0
  114. package/package.json +32 -17
  115. package/dist/append-schema.d.ts +0 -8
  116. package/dist/append-schema.js +0 -96
  117. package/dist/generate-types.d.ts +0 -8
  118. package/dist/generate-types.js +0 -110
  119. package/dist/introspect-columns.d.ts +0 -21
  120. package/dist/introspect-columns.js +0 -53
  121. package/dist/introspect-enum.d.ts +0 -20
  122. package/dist/introspect-enum.js +0 -24
  123. package/dist/introspect-procedures.d.ts +0 -53
  124. package/dist/introspect-procedures.js +0 -129
  125. package/dist/introspect-tables.d.ts +0 -19
  126. package/dist/introspect-tables.js +0 -43
  127. package/dist/introspeql-config.d.ts +0 -40
  128. package/dist/introspeql-config.js +0 -104
  129. package/dist/prepare-data-for-writing.d.ts +0 -38
  130. package/dist/prepare-data-for-writing.js +0 -145
  131. package/dist/snake-case-to-pascal-case.d.ts +0 -8
  132. package/dist/snake-case-to-pascal-case.js +0 -17
  133. package/dist/write-header.d.ts +0 -2
  134. package/dist/write-header.js +0 -10
@@ -0,0 +1,18 @@
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("./comment-converter"), exports);
18
+ __exportStar(require("./prettify-comment"), exports);
@@ -0,0 +1 @@
1
+ export declare function prettifyComment(comment: string): string;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.prettifyComment = prettifyComment;
7
+ var sync_1 = __importDefault(require("@prettier/sync"));
8
+ function prettifyComment(comment) {
9
+ return sync_1.default
10
+ .format(comment, {
11
+ parser: 'typescript',
12
+ plugins: [require.resolve('prettier-plugin-jsdoc')],
13
+ printWidth: 80,
14
+ tsDoc: true,
15
+ jsdocPreferCodeFences: true,
16
+ })
17
+ .trim();
18
+ }
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ export declare const connectionOptions: z.ZodUnion<readonly [z.ZodObject<{
3
+ dbConnectionString: z.ZodString;
4
+ dbConnectionParams: z.ZodOptional<z.ZodUndefined>;
5
+ }, z.core.$strip>, z.ZodObject<{
6
+ dbConnectionParams: z.ZodObject<{
7
+ user: z.ZodOptional<z.ZodString>;
8
+ password: z.ZodOptional<z.ZodString>;
9
+ host: z.ZodOptional<z.ZodString>;
10
+ port: z.ZodOptional<z.ZodNumber>;
11
+ database: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ dbConnectionString: z.ZodOptional<z.ZodUndefined>;
14
+ }, z.core.$strip>]>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.connectionOptions = void 0;
4
+ var zod_1 = require("zod");
5
+ exports.connectionOptions = zod_1.z.union([
6
+ zod_1.z.object({
7
+ /**
8
+ * A PostgreSQL connection string specifying the database to connect to.
9
+ * Useful if you are already storing such a string as an environment variable.
10
+ * Only valid if `dbConnectionParams` is not supplied.
11
+ */
12
+ dbConnectionString: zod_1.z.string(),
13
+ /**
14
+ * An object containing the components of a PostgreSQL connection string that
15
+ * together specify the database to connect to. Useful if you are already
16
+ * storing such values as individual environment variables. Only valid if
17
+ * `dbConnectionString` is not supplied.
18
+ */
19
+ dbConnectionParams: zod_1.z.undefined().optional(),
20
+ }),
21
+ zod_1.z.object({
22
+ /**
23
+ * An object containing the components of a PostgreSQL connection string that
24
+ * together specify the database to connect to. Useful if you are already
25
+ * storing such values as individual environment variables. Only valid if
26
+ * `dbConnectionString` is not supplied.
27
+ */
28
+ dbConnectionParams: zod_1.z.object({
29
+ user: zod_1.z.string().optional(),
30
+ password: zod_1.z.string().optional(),
31
+ host: zod_1.z.string().optional(),
32
+ port: zod_1.z.number().optional(),
33
+ database: zod_1.z.string().optional(),
34
+ }),
35
+ /**
36
+ * A PostgreSQL connection string specifying the database to connect to.
37
+ * Useful if you are already storing such a string as an environment variable.
38
+ * Only valid if `dbConnectionParams` is not supplied.
39
+ */
40
+ dbConnectionString: zod_1.z.undefined().optional(),
41
+ }),
42
+ ]);
@@ -0,0 +1,22 @@
1
+ import { z, ZodDefault, ZodLiteral, ZodOptional } from 'zod';
2
+ /**
3
+ * Creates a Zod object that can parse IntrospeQL configuration options for
4
+ * database objects described in the pg_class table, including tables, views,
5
+ * and materialized views.
6
+ */
7
+ export declare function createRelationOptions<T extends 'table' | 'view' | 'materializedView'>(relationName: T): z.ZodIntersection<z.ZodObject<{
8
+ mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
9
+ inclusive: "inclusive";
10
+ exclusive: "exclusive";
11
+ }>>>;
12
+ }, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
13
+ mode: ZodDefault<ZodOptional<ZodLiteral<"inclusive">>>;
14
+ } & { [K in `exclude${Capitalize<T>}s`]: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
15
+ schema: z.ZodString;
16
+ name: z.ZodString;
17
+ }, z.core.$strip>>>>; } & { [K_1 in `include${Capitalize<T>}s`]: z.ZodOptional<z.ZodUndefined>; }, z.core.$strip>, z.ZodObject<{
18
+ mode: ZodLiteral<"exclusive">;
19
+ } & { [K_2 in `include${Capitalize<T>}s`]: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
20
+ schema: z.ZodString;
21
+ name: z.ZodString;
22
+ }, z.core.$strip>>>>; } & { [K_3 in `exclude${Capitalize<T>}s`]: z.ZodOptional<z.ZodUndefined>; }, z.core.$strip>]>>;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRelationOptions = createRelationOptions;
4
+ var zod_1 = require("zod");
5
+ var entity_data_1 = require("./entity-data");
6
+ var capitalize_1 = require("../shared/capitalize");
7
+ /**
8
+ * Creates a Zod object that can parse IntrospeQL configuration options for
9
+ * database objects described in the pg_class table, including tables, views,
10
+ * and materialized views.
11
+ */
12
+ function createRelationOptions(relationName) {
13
+ var _a, _b;
14
+ var includeRelationsPropertyKey = "include".concat((0, capitalize_1.capitalize)(relationName), "s");
15
+ var excludeRelationsPropertyKey = "exclude".concat((0, capitalize_1.capitalize)(relationName), "s");
16
+ return zod_1.z
17
+ .object({
18
+ /**
19
+ * Determines the default behavior for including and excluding relations.
20
+ *
21
+ * If `mode` is set to `'inclusive'` (the default), all relations will be
22
+ * included in the output, except those explictly excluded with
23
+ * configuration options or those that include `"@introspeql-exclude"` in
24
+ * their PostgreSQL comments.
25
+ *
26
+ * If `mode` is set to `'exclusive'`, only relations explictly included
27
+ * with configuration options or those that include `"@introspeql-include"`
28
+ * in their PostgreSQL comment will be included in the output.
29
+ */
30
+ mode: zod_1.z.enum(['inclusive', 'exclusive']).optional().default('inclusive'),
31
+ })
32
+ .and(zod_1.z.union([
33
+ zod_1.z.object((_a = {
34
+ mode: zod_1.z.literal('inclusive').optional().default('inclusive')
35
+ },
36
+ /**
37
+ * An array of relations for which type definitions should not be
38
+ * generated. Only valid if `mode` is `'inclusive'`.
39
+ */
40
+ _a[excludeRelationsPropertyKey] = entity_data_1.entityData
41
+ .array()
42
+ .optional()
43
+ .default(function () { return []; }),
44
+ _a[includeRelationsPropertyKey] = zod_1.z.undefined().optional(),
45
+ _a)),
46
+ zod_1.z.object((_b = {
47
+ mode: zod_1.z.literal('exclusive')
48
+ },
49
+ /**
50
+ * An array of relations for which type definitions should be
51
+ * generated. Only valid if `mode` is `'exclusive'`.
52
+ */
53
+ _b[includeRelationsPropertyKey] = entity_data_1.entityData
54
+ .array()
55
+ .optional()
56
+ .default(function () { return []; }),
57
+ _b[excludeRelationsPropertyKey] = zod_1.z.undefined().optional(),
58
+ _b)),
59
+ ]));
60
+ }
@@ -0,0 +1,13 @@
1
+ export declare const DEFAULT_TYPE_MAPPINGS: {
2
+ 'pg_catalog.bool': string;
3
+ 'pg_catalog.int2': string;
4
+ 'pg_catalog.int4': string;
5
+ 'pg_catalog.float4': string;
6
+ 'pg_catalog.float8': string;
7
+ 'pg_catalog.json': string;
8
+ 'pg_catalog.jsonb': string;
9
+ 'pg_catalog.date': string;
10
+ 'pg_catalog.timestamp': string;
11
+ 'pg_catalog.timestamptz': string;
12
+ 'pg_catalog.bytea': string;
13
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_TYPE_MAPPINGS = void 0;
4
+ exports.DEFAULT_TYPE_MAPPINGS = {
5
+ 'pg_catalog.bool': 'boolean',
6
+ 'pg_catalog.int2': 'number',
7
+ 'pg_catalog.int4': 'number',
8
+ 'pg_catalog.float4': 'number',
9
+ 'pg_catalog.float8': 'number',
10
+ 'pg_catalog.json': 'object',
11
+ 'pg_catalog.jsonb': 'object',
12
+ 'pg_catalog.date': 'Date',
13
+ 'pg_catalog.timestamp': 'Date',
14
+ 'pg_catalog.timestamptz': 'Date',
15
+ 'pg_catalog.bytea': 'Buffer',
16
+ };
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ export declare const entityData: z.ZodObject<{
3
+ schema: z.ZodString;
4
+ name: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export type EntityData = z.infer<typeof entityData>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.entityData = void 0;
4
+ var zod_1 = require("zod");
5
+ exports.entityData = zod_1.z.object({
6
+ schema: zod_1.z.string(),
7
+ name: zod_1.z.string(),
8
+ });
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ export declare const functionOptions: z.ZodIntersection<z.ZodObject<{
3
+ mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
4
+ inclusive: "inclusive";
5
+ exclusive: "exclusive";
6
+ }>>>;
7
+ nullableArgs: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
8
+ nullableReturnTypes: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
9
+ }, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
10
+ mode: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"inclusive">>>;
11
+ excludeFunctions: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
12
+ schema: z.ZodString;
13
+ name: z.ZodString;
14
+ }, z.core.$strip>>>>;
15
+ includeFunctions: z.ZodOptional<z.ZodUndefined>;
16
+ }, z.core.$strip>, z.ZodObject<{
17
+ mode: z.ZodLiteral<"exclusive">;
18
+ includeFunctions: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
19
+ schema: z.ZodString;
20
+ name: z.ZodString;
21
+ }, z.core.$strip>>>>;
22
+ excludeFunctions: z.ZodOptional<z.ZodUndefined>;
23
+ }, z.core.$strip>]>>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.functionOptions = void 0;
4
+ var zod_1 = require("zod");
5
+ var entity_data_1 = require("./entity-data");
6
+ exports.functionOptions = zod_1.z
7
+ .object({
8
+ /**
9
+ * Determines the default behavior for including and excluding functions.
10
+ *
11
+ * If `mode` is set to `'inclusive'` (the default), all functions will be
12
+ * included in the output, except those listed in the `excludeFunctions`
13
+ * configuration option, or those that include `"@introspeql-exclude"` in
14
+ * their PostgreSQL comments.
15
+ *
16
+ * If `mode` is set to `'exclusive'`, only functions listed in the
17
+ * `'includeFunctions'` configuration option or those that include
18
+ * `"@introspeql-include"` in their PostgreSQL comment will be included in
19
+ * the output.
20
+ *
21
+ * If leveraging directives to opt out of the behavior configured here,
22
+ * each overload that you wish to include or exclude must be marked with the
23
+ * appropriate directive.
24
+ */
25
+ mode: zod_1.z.enum(['inclusive', 'exclusive']).optional().default('inclusive'),
26
+ /**
27
+ * PostgreSQL is unlike TypeScript in that argument types cannot be
28
+ * explicitly marked non-nullable. If you expect to leverage this behavior
29
+ * and potentially call a function with null arguments, set this
30
+ * option to `true`. This will cause all argument types to be transformed
31
+ * into type unions including `null`.
32
+ *
33
+ * To opt out of this behavior when this option is enabled, a function can
34
+ * include `"@introspeql-disable-nullable-args"` in its PostgreSQL comment.
35
+ *
36
+ * To opt into this behavior when this option is disabled, a function can
37
+ * include `"@introspeql-enable-nullable-args"` in its PostgreSQL comment.
38
+ */
39
+ nullableArgs: zod_1.z.boolean().optional().default(false),
40
+ /**
41
+ * Virtually any PostgreSQL function may potentially return `null`,
42
+ * regardless of its specified return type. Void functions without the
43
+ * `STRICT` modifier are perhaps one of the very few exceptions to this
44
+ * rule.
45
+ *
46
+ * Therefore, all function return types are nullable by default. To
47
+ * disable this behavior, set this option to false.
48
+ *
49
+ * To opt into this behavior when it is disabled, a function can include
50
+ * `"@introspeql-enable-nullable-return-types"` in its PostgreSQL comment.
51
+ *
52
+ * To opt out of this behavior when it is enabled, a function can include
53
+ * `"@introspeql-disable-nullable-return-types"` in its PostgreSQL comment.
54
+ */
55
+ nullableReturnTypes: zod_1.z.boolean().optional().default(true),
56
+ })
57
+ .and(zod_1.z.union([
58
+ zod_1.z.object({
59
+ mode: zod_1.z.literal('inclusive').optional().default('inclusive'),
60
+ excludeFunctions: entity_data_1.entityData
61
+ .array()
62
+ .optional()
63
+ .default(function () { return []; }),
64
+ includeFunctions: zod_1.z.undefined().optional(),
65
+ }),
66
+ zod_1.z.object({
67
+ mode: zod_1.z.literal('exclusive'),
68
+ includeFunctions: entity_data_1.entityData
69
+ .array()
70
+ .optional()
71
+ .default(function () { return []; }),
72
+ excludeFunctions: zod_1.z.undefined().optional(),
73
+ }),
74
+ ]));
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ export declare const generalOptions: z.ZodObject<{
3
+ schemas: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
4
+ header: z.ZodOptional<z.ZodString>;
5
+ types: z.ZodPipe<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>, z.ZodTransform<Record<string, string>, Record<string, string>>>;
6
+ copyComments: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
7
+ }, z.core.$strip>;
@@ -0,0 +1,75 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.generalOptions = void 0;
15
+ var zod_1 = require("zod");
16
+ var default_type_mappings_1 = require("./default-type-mappings");
17
+ exports.generalOptions = zod_1.z.object({
18
+ /**
19
+ * The database schemas from which types should be generated. At least one
20
+ * schema must be specified. The default value is `['public']`.
21
+ */
22
+ schemas: zod_1.z
23
+ .string()
24
+ .array()
25
+ .nonempty({
26
+ message: 'Please provide at least one schema.',
27
+ })
28
+ .optional()
29
+ .default(function () { return ['public']; }),
30
+ /**
31
+ * An optional header that will be written to the generated type definition
32
+ * file before the types. Useful when you want to define or import types
33
+ * directly in the generated file.
34
+ */
35
+ header: zod_1.z.string().optional(),
36
+ /**
37
+ * Custom type mappings. Default settings align with transformations applied
38
+ * by node-postgres. To override these settings for a type, provide the
39
+ * name of the schema in which the type is defined and the name of the type
40
+ * (separated by a dot) as the key, and a string representation of the
41
+ * desired type as the value.
42
+ *
43
+ * @example
44
+ * ```
45
+ * {
46
+ * types: {
47
+ * "pg_catalog.int8" : "bigint"
48
+ * }
49
+ * }
50
+ * ```
51
+ */
52
+ types: zod_1.z
53
+ .record(zod_1.z.string(), zod_1.z.string())
54
+ .optional()
55
+ .transform(function (t) { return (__assign(__assign({}, default_type_mappings_1.DEFAULT_TYPE_MAPPINGS), t)); }),
56
+ /**
57
+ * If `true` (the default), comments attached to tables, columns, and
58
+ * enums will be included as TSDoc-style comments in the output
59
+ * (`"@introspeQL-"` directives within those comments will be removed).
60
+ *
61
+ * To opt out of this behavior when it is enabled, a table, enum, or column
62
+ * can include `"@introspeql-disable-tsdoc-comments"` in its comment.
63
+ *
64
+ * To opt into this behavior when it is disabled, a table, column, or enum
65
+ * can include `"@introspeql-enable-tsdoc-comments"` in its comment.
66
+ *
67
+ * By default, the behavior applied to a table will dictate the behavior
68
+ * applied to its columns unless the comment on a particular column includes
69
+ * one of the above directives.
70
+ *
71
+ * To include only certain sections of a comment, enclose them with
72
+ * `"@introspeql-begin-tsdoc-comment"` and `"@introspeql-end-tsdoc-comment"`.
73
+ */
74
+ copyComments: zod_1.z.boolean().optional().default(true),
75
+ });
@@ -0,0 +1,123 @@
1
+ import { z } from 'zod';
2
+ declare const introspeqlConfigSchema: z.ZodIntersection<z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
3
+ schemas: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
4
+ header: z.ZodOptional<z.ZodString>;
5
+ types: z.ZodPipe<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>, z.ZodTransform<Record<string, string>, Record<string, string>>>;
6
+ copyComments: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
7
+ }, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
8
+ dbConnectionString: z.ZodString;
9
+ dbConnectionParams: z.ZodOptional<z.ZodUndefined>;
10
+ }, z.core.$strip>, z.ZodObject<{
11
+ dbConnectionParams: z.ZodObject<{
12
+ user: z.ZodOptional<z.ZodString>;
13
+ password: z.ZodOptional<z.ZodString>;
14
+ host: z.ZodOptional<z.ZodString>;
15
+ port: z.ZodOptional<z.ZodNumber>;
16
+ database: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ dbConnectionString: z.ZodOptional<z.ZodUndefined>;
19
+ }, z.core.$strip>]>>, z.ZodUnion<readonly [z.ZodObject<{
20
+ writeToDisk: z.ZodDefault<z.ZodOptional<z.ZodLiteral<true>>>;
21
+ outFile: z.ZodString;
22
+ }, z.core.$strip>, z.ZodObject<{
23
+ writeToDisk: z.ZodLiteral<false>;
24
+ outFile: z.ZodOptional<z.ZodUndefined>;
25
+ }, z.core.$strip>]>>, z.ZodObject<{
26
+ tables: z.ZodDefault<z.ZodOptional<z.ZodIntersection<z.ZodObject<{
27
+ mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
28
+ inclusive: "inclusive";
29
+ exclusive: "exclusive";
30
+ }>>>;
31
+ }, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
32
+ mode: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"inclusive">>>;
33
+ } & {
34
+ excludeTables: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ schema: z.ZodString;
36
+ name: z.ZodString;
37
+ }, z.core.$strip>>>>;
38
+ } & {
39
+ includeTables: z.ZodOptional<z.ZodUndefined>;
40
+ }, z.core.$strip>, z.ZodObject<{
41
+ mode: z.ZodLiteral<"exclusive">;
42
+ } & {
43
+ includeTables: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
44
+ schema: z.ZodString;
45
+ name: z.ZodString;
46
+ }, z.core.$strip>>>>;
47
+ } & {
48
+ excludeTables: z.ZodOptional<z.ZodUndefined>;
49
+ }, z.core.$strip>]>>>>;
50
+ functions: z.ZodDefault<z.ZodOptional<z.ZodIntersection<z.ZodObject<{
51
+ mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
52
+ inclusive: "inclusive";
53
+ exclusive: "exclusive";
54
+ }>>>;
55
+ nullableArgs: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
56
+ nullableReturnTypes: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
57
+ }, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
58
+ mode: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"inclusive">>>;
59
+ excludeFunctions: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
60
+ schema: z.ZodString;
61
+ name: z.ZodString;
62
+ }, z.core.$strip>>>>;
63
+ includeFunctions: z.ZodOptional<z.ZodUndefined>;
64
+ }, z.core.$strip>, z.ZodObject<{
65
+ mode: z.ZodLiteral<"exclusive">;
66
+ includeFunctions: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
67
+ schema: z.ZodString;
68
+ name: z.ZodString;
69
+ }, z.core.$strip>>>>;
70
+ excludeFunctions: z.ZodOptional<z.ZodUndefined>;
71
+ }, z.core.$strip>]>>>>;
72
+ views: z.ZodDefault<z.ZodOptional<z.ZodIntersection<z.ZodObject<{
73
+ mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
74
+ inclusive: "inclusive";
75
+ exclusive: "exclusive";
76
+ }>>>;
77
+ }, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
78
+ mode: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"inclusive">>>;
79
+ } & {
80
+ excludeViews: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
81
+ schema: z.ZodString;
82
+ name: z.ZodString;
83
+ }, z.core.$strip>>>>;
84
+ } & {
85
+ includeViews: z.ZodOptional<z.ZodUndefined>;
86
+ }, z.core.$strip>, z.ZodObject<{
87
+ mode: z.ZodLiteral<"exclusive">;
88
+ } & {
89
+ includeViews: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
90
+ schema: z.ZodString;
91
+ name: z.ZodString;
92
+ }, z.core.$strip>>>>;
93
+ } & {
94
+ excludeViews: z.ZodOptional<z.ZodUndefined>;
95
+ }, z.core.$strip>]>>>>;
96
+ materializedViews: z.ZodDefault<z.ZodOptional<z.ZodIntersection<z.ZodObject<{
97
+ mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
98
+ inclusive: "inclusive";
99
+ exclusive: "exclusive";
100
+ }>>>;
101
+ }, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
102
+ mode: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"inclusive">>>;
103
+ } & {
104
+ excludeMaterializedViews: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
105
+ schema: z.ZodString;
106
+ name: z.ZodString;
107
+ }, z.core.$strip>>>>;
108
+ } & {
109
+ includeMaterializedViews: z.ZodOptional<z.ZodUndefined>;
110
+ }, z.core.$strip>, z.ZodObject<{
111
+ mode: z.ZodLiteral<"exclusive">;
112
+ } & {
113
+ includeMaterializedViews: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
114
+ schema: z.ZodString;
115
+ name: z.ZodString;
116
+ }, z.core.$strip>>>>;
117
+ } & {
118
+ excludeMaterializedViews: z.ZodOptional<z.ZodUndefined>;
119
+ }, z.core.$strip>]>>>>;
120
+ }, z.core.$strip>>;
121
+ type IntrospeQLConfig = z.input<typeof introspeqlConfigSchema>;
122
+ type ParsedConfig = z.infer<typeof introspeqlConfigSchema>;
123
+ export { introspeqlConfigSchema, type IntrospeQLConfig, type ParsedConfig };
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.introspeqlConfigSchema = void 0;
4
+ var zod_1 = require("zod");
5
+ var connection_options_1 = require("./connection-options");
6
+ var function_options_1 = require("./function-options");
7
+ var general_options_1 = require("./general-options");
8
+ var materialized_view_options_1 = require("./materialized-view-options");
9
+ var output_options_1 = require("./output-options");
10
+ var table_options_1 = require("./table-options");
11
+ var view_options_1 = require("./view-options");
12
+ var introspeqlConfigSchema = general_options_1.generalOptions
13
+ .and(connection_options_1.connectionOptions)
14
+ .and(output_options_1.outputOptions)
15
+ .and(zod_1.z.object({
16
+ tables: table_options_1.tableOptions.optional().default(function () {
17
+ return {
18
+ mode: 'inclusive',
19
+ excludeTables: [],
20
+ };
21
+ }),
22
+ functions: function_options_1.functionOptions.optional().default(function () {
23
+ return {
24
+ mode: 'inclusive',
25
+ excludeFunctions: [],
26
+ nullableArgs: false,
27
+ nullableReturnTypes: true,
28
+ };
29
+ }),
30
+ views: view_options_1.viewOptions.optional().default(function () {
31
+ return {
32
+ mode: 'inclusive',
33
+ excludeViews: [],
34
+ };
35
+ }),
36
+ materializedViews: materialized_view_options_1.materializedViewOptions.optional().default(function () {
37
+ return {
38
+ mode: 'inclusive',
39
+ excludeMaterializedViews: [],
40
+ };
41
+ }),
42
+ }));
43
+ exports.introspeqlConfigSchema = introspeqlConfigSchema;
@@ -0,0 +1,24 @@
1
+ export declare const materializedViewOptions: 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
+ excludeMaterializedViews: 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
+ includeMaterializedViews: import("zod").ZodOptional<import("zod").ZodUndefined>;
15
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
16
+ mode: import("zod").ZodLiteral<"exclusive">;
17
+ } & {
18
+ includeMaterializedViews: 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
+ excludeMaterializedViews: import("zod").ZodOptional<import("zod").ZodUndefined>;
24
+ }, import("zod/v4/core").$strip>]>>;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.materializedViewOptions = void 0;
4
+ var create_relation_options_1 = require("./create-relation-options");
5
+ exports.materializedViewOptions = (0, create_relation_options_1.createRelationOptions)('materializedView');
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ export declare const outputOptions: z.ZodUnion<readonly [z.ZodObject<{
3
+ writeToDisk: z.ZodDefault<z.ZodOptional<z.ZodLiteral<true>>>;
4
+ outFile: z.ZodString;
5
+ }, z.core.$strip>, z.ZodObject<{
6
+ writeToDisk: z.ZodLiteral<false>;
7
+ outFile: z.ZodOptional<z.ZodUndefined>;
8
+ }, z.core.$strip>]>;