kysely 0.2.4 → 0.2.5

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 (166) hide show
  1. package/README.md +1 -1
  2. package/lib/dialect/postgres/postgres-dialect.js +5 -4
  3. package/lib/index.d.ts +66 -2
  4. package/lib/index.js +66 -2
  5. package/lib/kysely.d.ts +15 -14
  6. package/lib/kysely.js +17 -16
  7. package/lib/migration/migration.js +2 -2
  8. package/lib/operation-node/add-column-node.d.ts +6 -19
  9. package/lib/operation-node/add-column-node.js +5 -14
  10. package/lib/operation-node/add-constraint-node.d.ts +4 -4
  11. package/lib/operation-node/add-constraint-node.js +3 -0
  12. package/lib/operation-node/alias-node.d.ts +4 -2
  13. package/lib/operation-node/alias-node.js +3 -0
  14. package/lib/operation-node/alter-column-node.d.ts +6 -1
  15. package/lib/operation-node/alter-column-node.js +11 -2
  16. package/lib/operation-node/alter-table-node.d.ts +5 -0
  17. package/lib/operation-node/alter-table-node.js +9 -0
  18. package/lib/operation-node/and-node.d.ts +3 -0
  19. package/lib/operation-node/and-node.js +3 -0
  20. package/lib/operation-node/check-constraint-node.d.ts +3 -0
  21. package/lib/operation-node/check-constraint-node.js +3 -0
  22. package/lib/operation-node/column-definition-node.d.ts +29 -0
  23. package/lib/operation-node/column-definition-node.js +30 -0
  24. package/lib/operation-node/column-node.d.ts +3 -0
  25. package/lib/operation-node/column-node.js +3 -0
  26. package/lib/operation-node/column-update-node.d.ts +3 -0
  27. package/lib/operation-node/column-update-node.js +3 -0
  28. package/lib/operation-node/common-table-expression-node.d.ts +3 -0
  29. package/lib/operation-node/common-table-expression-node.js +3 -0
  30. package/lib/operation-node/constraint-node.d.ts +5 -0
  31. package/lib/operation-node/constraint-node.js +2 -0
  32. package/lib/operation-node/create-index-node.d.ts +3 -0
  33. package/lib/operation-node/create-index-node.js +3 -0
  34. package/lib/operation-node/create-schema-node.d.ts +3 -0
  35. package/lib/operation-node/create-schema-node.js +3 -0
  36. package/lib/operation-node/create-table-node.d.ts +9 -9
  37. package/lib/operation-node/create-table-node.js +23 -5
  38. package/lib/operation-node/data-type-node.d.ts +3 -0
  39. package/lib/operation-node/data-type-node.js +3 -0
  40. package/lib/operation-node/delete-query-node.d.ts +3 -0
  41. package/lib/operation-node/delete-query-node.js +3 -0
  42. package/lib/operation-node/drop-column-node.d.ts +3 -0
  43. package/lib/operation-node/drop-column-node.js +3 -0
  44. package/lib/operation-node/drop-constraint-node.d.ts +3 -0
  45. package/lib/operation-node/drop-constraint-node.js +3 -0
  46. package/lib/operation-node/drop-index-node.d.ts +3 -0
  47. package/lib/operation-node/drop-index-node.js +3 -0
  48. package/lib/operation-node/drop-schema-node.d.ts +3 -0
  49. package/lib/operation-node/drop-schema-node.js +3 -0
  50. package/lib/operation-node/drop-table-node.d.ts +5 -2
  51. package/lib/operation-node/drop-table-node.js +3 -0
  52. package/lib/operation-node/filter-node.d.ts +3 -0
  53. package/lib/operation-node/filter-node.js +3 -0
  54. package/lib/operation-node/foreign-key-constraint-node.d.ts +5 -1
  55. package/lib/operation-node/foreign-key-constraint-node.js +6 -2
  56. package/lib/operation-node/from-node.d.ts +3 -0
  57. package/lib/operation-node/from-node.js +3 -0
  58. package/lib/operation-node/group-by-item-node.d.ts +3 -0
  59. package/lib/operation-node/group-by-item-node.js +3 -0
  60. package/lib/operation-node/group-by-node.d.ts +3 -0
  61. package/lib/operation-node/group-by-node.js +3 -0
  62. package/lib/operation-node/having-node.d.ts +3 -0
  63. package/lib/operation-node/having-node.js +3 -0
  64. package/lib/operation-node/identifier-node.d.ts +3 -0
  65. package/lib/operation-node/identifier-node.js +3 -0
  66. package/lib/operation-node/insert-query-node.d.ts +3 -0
  67. package/lib/operation-node/insert-query-node.js +3 -0
  68. package/lib/operation-node/join-node.d.ts +3 -0
  69. package/lib/operation-node/join-node.js +3 -0
  70. package/lib/operation-node/limit-node.d.ts +3 -0
  71. package/lib/operation-node/limit-node.js +3 -0
  72. package/lib/operation-node/list-node.d.ts +3 -0
  73. package/lib/operation-node/list-node.js +3 -0
  74. package/lib/operation-node/offset-node.d.ts +3 -0
  75. package/lib/operation-node/offset-node.js +3 -0
  76. package/lib/operation-node/on-conflict-node.d.ts +3 -0
  77. package/lib/operation-node/on-conflict-node.js +3 -0
  78. package/lib/operation-node/operation-node-transformer.d.ts +2 -0
  79. package/lib/operation-node/operation-node-transformer.js +12 -6
  80. package/lib/operation-node/operation-node-visitor.d.ts +2 -0
  81. package/lib/operation-node/operation-node-visitor.js +12 -1
  82. package/lib/operation-node/operation-node.d.ts +1 -1
  83. package/lib/operation-node/operator-node.d.ts +3 -0
  84. package/lib/operation-node/operator-node.js +3 -0
  85. package/lib/operation-node/or-node.d.ts +3 -0
  86. package/lib/operation-node/or-node.js +3 -0
  87. package/lib/operation-node/order-by-item-node.d.ts +3 -0
  88. package/lib/operation-node/order-by-item-node.js +3 -0
  89. package/lib/operation-node/order-by-node.d.ts +3 -0
  90. package/lib/operation-node/order-by-node.js +3 -0
  91. package/lib/operation-node/parens-node.d.ts +3 -0
  92. package/lib/operation-node/parens-node.js +3 -0
  93. package/lib/operation-node/primary-constraint-node.d.ts +3 -0
  94. package/lib/operation-node/primary-constraint-node.js +3 -0
  95. package/lib/operation-node/primitive-value-list-node.d.ts +3 -0
  96. package/lib/operation-node/primitive-value-list-node.js +3 -0
  97. package/lib/operation-node/query-node.d.ts +3 -0
  98. package/lib/operation-node/query-node.js +3 -0
  99. package/lib/operation-node/raw-node.d.ts +3 -0
  100. package/lib/operation-node/raw-node.js +3 -0
  101. package/lib/operation-node/reference-node.d.ts +3 -0
  102. package/lib/operation-node/reference-node.js +3 -0
  103. package/lib/operation-node/references-node.d.ts +5 -2
  104. package/lib/operation-node/references-node.js +5 -2
  105. package/lib/operation-node/rename-column-node.d.ts +4 -1
  106. package/lib/operation-node/rename-column-node.js +5 -2
  107. package/lib/operation-node/returning-node.d.ts +3 -0
  108. package/lib/operation-node/returning-node.js +3 -0
  109. package/lib/operation-node/select-all-node.d.ts +3 -0
  110. package/lib/operation-node/select-all-node.js +3 -0
  111. package/lib/operation-node/select-query-node.d.ts +3 -0
  112. package/lib/operation-node/select-query-node.js +3 -0
  113. package/lib/operation-node/selection-node.d.ts +3 -0
  114. package/lib/operation-node/selection-node.js +3 -0
  115. package/lib/operation-node/table-node.d.ts +3 -0
  116. package/lib/operation-node/table-node.js +3 -0
  117. package/lib/operation-node/unique-constraint-node.d.ts +3 -0
  118. package/lib/operation-node/unique-constraint-node.js +3 -0
  119. package/lib/operation-node/update-query-node.d.ts +3 -0
  120. package/lib/operation-node/update-query-node.js +3 -0
  121. package/lib/operation-node/value-list-node.d.ts +3 -0
  122. package/lib/operation-node/value-list-node.js +3 -0
  123. package/lib/operation-node/value-node.d.ts +3 -0
  124. package/lib/operation-node/value-node.js +3 -0
  125. package/lib/operation-node/where-node.d.ts +3 -0
  126. package/lib/operation-node/where-node.js +3 -0
  127. package/lib/operation-node/with-node.d.ts +3 -0
  128. package/lib/operation-node/with-node.js +3 -0
  129. package/lib/parser/with-parser.js +1 -1
  130. package/lib/query-builder/query-builder.d.ts +9 -9
  131. package/lib/query-builder/query-builder.js +6 -6
  132. package/lib/query-builder/sub-query-builder.d.ts +1 -1
  133. package/lib/query-builder/sub-query-builder.js +1 -1
  134. package/lib/query-compiler/default-query-compiler.d.ts +3 -1
  135. package/lib/query-compiler/default-query-compiler.js +10 -9
  136. package/lib/query-compiler/query-compiler.d.ts +2 -1
  137. package/lib/query-creator.d.ts +2 -2
  138. package/lib/query-creator.js +1 -1
  139. package/lib/{util → query-executor}/query-executor.d.ts +0 -0
  140. package/lib/{util → query-executor}/query-executor.js +1 -1
  141. package/lib/raw-builder/raw-builder.d.ts +2 -2
  142. package/lib/raw-builder/raw-builder.js +4 -4
  143. package/lib/schema/alter-table-builder.d.ts +64 -0
  144. package/lib/schema/alter-table-builder.js +236 -0
  145. package/lib/schema/{add-column-builder.d.ts → column-definition-builder.d.ts} +23 -13
  146. package/lib/schema/column-definition-builder.js +66 -0
  147. package/lib/schema/create-index-builder.d.ts +2 -2
  148. package/lib/schema/create-index-builder.js +3 -3
  149. package/lib/schema/create-schema-builder.d.ts +2 -2
  150. package/lib/schema/create-schema-builder.js +3 -3
  151. package/lib/schema/create-table-builder.d.ts +20 -6
  152. package/lib/schema/create-table-builder.js +27 -8
  153. package/lib/schema/drop-index-builder.d.ts +2 -2
  154. package/lib/schema/drop-index-builder.js +3 -3
  155. package/lib/schema/drop-schema-builder.d.ts +2 -2
  156. package/lib/schema/drop-schema-builder.js +3 -3
  157. package/lib/schema/drop-table-builder.d.ts +2 -2
  158. package/lib/schema/drop-table-builder.js +3 -3
  159. package/lib/schema/schema.d.ts +17 -3
  160. package/lib/schema/schema.js +22 -2
  161. package/lib/transformers/with-schema-transformer.d.ts +2 -0
  162. package/lib/transformers/with-schema-transformer.js +3 -0
  163. package/lib/util/object-utils.d.ts +1 -0
  164. package/lib/util/object-utils.js +13 -1
  165. package/package.json +2 -2
  166. package/lib/schema/add-column-builder.js +0 -116
@@ -0,0 +1,29 @@
1
+ import { CheckConstraintNode } from './check-constraint-node';
2
+ import { ColumnNode } from './column-node';
3
+ import { DataTypeNode } from './data-type-node';
4
+ import { OperationNode } from './operation-node';
5
+ import { RawNode } from './raw-node';
6
+ import { ReferencesNode } from './references-node';
7
+ import { ValueNode } from './value-node';
8
+ export declare type ColumnDefinitionNodeParams = Omit<Partial<ColumnDefinitionNode>, 'kind'>;
9
+ export declare type ColumnDataTypeNode = DataTypeNode | RawNode;
10
+ export interface ColumnDefinitionNode extends OperationNode {
11
+ readonly kind: 'ColumnDefinitionNode';
12
+ readonly column: ColumnNode;
13
+ readonly dataType: ColumnDataTypeNode;
14
+ readonly references?: ReferencesNode;
15
+ readonly isPrimaryKey: boolean;
16
+ readonly isAutoIncrementing: boolean;
17
+ readonly isUnique: boolean;
18
+ readonly isNullable: boolean;
19
+ readonly defaultTo?: ValueNode | RawNode;
20
+ readonly check?: CheckConstraintNode;
21
+ }
22
+ /**
23
+ * @internal
24
+ */
25
+ export declare const columnDefinitionNode: Readonly<{
26
+ is(node: OperationNode): node is ColumnDefinitionNode;
27
+ create(column: string, dataType: ColumnDataTypeNode): ColumnDefinitionNode;
28
+ cloneWith(node: ColumnDefinitionNode, params: ColumnDefinitionNodeParams): ColumnDefinitionNode;
29
+ }>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.columnDefinitionNode = void 0;
4
+ const object_utils_1 = require("../util/object-utils");
5
+ const column_node_1 = require("./column-node");
6
+ /**
7
+ * @internal
8
+ */
9
+ exports.columnDefinitionNode = object_utils_1.freeze({
10
+ is(node) {
11
+ return node.kind === 'ColumnDefinitionNode';
12
+ },
13
+ create(column, dataType) {
14
+ return object_utils_1.freeze({
15
+ kind: 'ColumnDefinitionNode',
16
+ column: column_node_1.columnNode.create(column),
17
+ dataType,
18
+ isPrimaryKey: false,
19
+ isAutoIncrementing: false,
20
+ isUnique: false,
21
+ isNullable: true,
22
+ });
23
+ },
24
+ cloneWith(node, params) {
25
+ return object_utils_1.freeze({
26
+ ...node,
27
+ ...params,
28
+ });
29
+ },
30
+ });
@@ -4,6 +4,9 @@ export interface ColumnNode extends OperationNode {
4
4
  readonly kind: 'ColumnNode';
5
5
  readonly column: IdentifierNode;
6
6
  }
7
+ /**
8
+ * @internal
9
+ */
7
10
  export declare const columnNode: Readonly<{
8
11
  is(node: OperationNode): node is ColumnNode;
9
12
  create(column: string): ColumnNode;
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.columnNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
5
  const identifier_node_1 = require("./identifier-node");
6
+ /**
7
+ * @internal
8
+ */
6
9
  exports.columnNode = object_utils_1.freeze({
7
10
  is(node) {
8
11
  return node.kind === 'ColumnNode';
@@ -6,6 +6,9 @@ export interface ColumnUpdateNode extends OperationNode {
6
6
  readonly column: ColumnNode;
7
7
  readonly value: ValueExpressionNode;
8
8
  }
9
+ /**
10
+ * @internal
11
+ */
9
12
  export declare const columnUpdateNode: Readonly<{
10
13
  is(node: OperationNode): node is ColumnUpdateNode;
11
14
  create(column: ColumnNode, value: ValueExpressionNode): ColumnUpdateNode;
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.columnUpdateNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
+ /**
6
+ * @internal
7
+ */
5
8
  exports.columnUpdateNode = object_utils_1.freeze({
6
9
  is(node) {
7
10
  return node.kind === 'ColumnUpdateNode';
@@ -7,6 +7,9 @@ export interface CommonTableExpressionNode extends OperationNode {
7
7
  readonly name: IdentifierNode;
8
8
  readonly expression: QueryNode | RawNode;
9
9
  }
10
+ /**
11
+ * @internal
12
+ */
10
13
  export declare const commonTableExpressionNode: Readonly<{
11
14
  is(node: OperationNode): node is CommonTableExpressionNode;
12
15
  create(name: IdentifierNode, expression: QueryNode | RawNode): CommonTableExpressionNode;
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.commonTableExpressionNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
+ /**
6
+ * @internal
7
+ */
5
8
  exports.commonTableExpressionNode = object_utils_1.freeze({
6
9
  is(node) {
7
10
  return node.kind === 'CommonTableExpressionNode';
@@ -0,0 +1,5 @@
1
+ import { CheckConstraintNode } from "./check-constraint-node";
2
+ import { ForeignKeyConstraintNode } from "./foreign-key-constraint-node";
3
+ import { PrimaryKeyConstraintNode } from "./primary-constraint-node";
4
+ import { UniqueConstraintNode } from "./unique-constraint-node";
5
+ export declare type ConstraintNode = PrimaryKeyConstraintNode | UniqueConstraintNode | CheckConstraintNode | ForeignKeyConstraintNode;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -14,6 +14,9 @@ export interface CreateIndexNode extends OperationNode {
14
14
  readonly unique?: boolean;
15
15
  readonly using?: RawNode;
16
16
  }
17
+ /**
18
+ * @internal
19
+ */
17
20
  export declare const createIndexNode: Readonly<{
18
21
  is(node: OperationNode): node is CreateIndexNode;
19
22
  create(name: string): CreateIndexNode;
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createIndexNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
5
  const identifier_node_1 = require("./identifier-node");
6
+ /**
7
+ * @internal
8
+ */
6
9
  exports.createIndexNode = object_utils_1.freeze({
7
10
  is(node) {
8
11
  return node.kind === 'CreateIndexNode';
@@ -7,6 +7,9 @@ export interface CreateSchemaNode extends OperationNode {
7
7
  readonly schema: IdentifierNode;
8
8
  readonly modifier?: CreateSchemaNodeModifier;
9
9
  }
10
+ /**
11
+ * @internal
12
+ */
10
13
  export declare const createSchemaNode: Readonly<{
11
14
  is(node: OperationNode): node is CreateSchemaNode;
12
15
  create(schema: string, params?: CreateSchemaNodeParams | undefined): CreateSchemaNode;
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createSchemaNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
5
  const identifier_node_1 = require("./identifier-node");
6
+ /**
7
+ * @internal
8
+ */
6
9
  exports.createSchemaNode = object_utils_1.freeze({
7
10
  is(node) {
8
11
  return node.kind === 'CreateSchemaNode';
@@ -1,25 +1,25 @@
1
- import { CheckConstraintNode } from './check-constraint-node';
2
- import { AddColumnNode } from './add-column-node';
3
1
  import { OperationNode } from './operation-node';
4
2
  import { TableNode } from './table-node';
5
- import { PrimaryKeyConstraintNode } from './primary-constraint-node';
6
- import { UniqueConstraintNode } from './unique-constraint-node';
3
+ import { ConstraintNode } from './constraint-node';
4
+ import { ColumnDefinitionNode } from './column-definition-node';
7
5
  export declare type CreateTableNodeModifier = 'IfNotExists';
8
6
  export interface CreateTableNode extends OperationNode {
9
7
  readonly kind: 'CreateTableNode';
10
8
  readonly table: TableNode;
11
- readonly columns: ReadonlyArray<AddColumnNode>;
9
+ readonly columns: ReadonlyArray<ColumnDefinitionNode>;
12
10
  readonly modifier?: CreateTableNodeModifier;
13
- readonly primaryKeyConstraint?: PrimaryKeyConstraintNode;
14
- readonly uniqueConstraints?: ReadonlyArray<UniqueConstraintNode>;
15
- readonly checkConstraints?: ReadonlyArray<CheckConstraintNode>;
11
+ readonly constraints?: ReadonlyArray<ConstraintNode>;
16
12
  }
13
+ /**
14
+ * @internal
15
+ */
17
16
  export declare const createTableNode: Readonly<{
18
17
  is(node: OperationNode): node is CreateTableNode;
19
18
  create(table: TableNode): CreateTableNode;
20
- cloneWithColumn(createTable: CreateTableNode, column: AddColumnNode): CreateTableNode;
19
+ cloneWithColumn(createTable: CreateTableNode, column: ColumnDefinitionNode): CreateTableNode;
21
20
  cloneWithModifier(createTable: CreateTableNode, modifier: CreateTableNodeModifier): CreateTableNode;
22
21
  cloneWithPrimaryKeyConstraint(createTable: CreateTableNode, constraintName: string, columns: string[]): CreateTableNode;
23
22
  cloneWithUniqueConstraint(createTable: CreateTableNode, constraintName: string, columns: string[]): CreateTableNode;
24
23
  cloneWithCheckConstraint(createTable: CreateTableNode, constraintName: string, sql: string): CreateTableNode;
24
+ cloneWithForeignKeyConstraint(createTable: CreateTableNode, constraintName: string, sourceColumns: string[], targetTable: string, targetColumns: string[]): CreateTableNode;
25
25
  }>;
@@ -3,8 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createTableNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
5
  const check_constraint_node_1 = require("./check-constraint-node");
6
+ const table_node_1 = require("./table-node");
6
7
  const primary_constraint_node_1 = require("./primary-constraint-node");
7
8
  const unique_constraint_node_1 = require("./unique-constraint-node");
9
+ const foreign_key_constraint_node_1 = require("./foreign-key-constraint-node");
10
+ const column_node_1 = require("./column-node");
11
+ /**
12
+ * @internal
13
+ */
8
14
  exports.createTableNode = object_utils_1.freeze({
9
15
  is(node) {
10
16
  return node.kind === 'CreateTableNode';
@@ -29,17 +35,20 @@ exports.createTableNode = object_utils_1.freeze({
29
35
  });
30
36
  },
31
37
  cloneWithPrimaryKeyConstraint(createTable, constraintName, columns) {
38
+ const constraint = primary_constraint_node_1.primaryConstraintNode.create(columns, constraintName);
32
39
  return object_utils_1.freeze({
33
40
  ...createTable,
34
- primaryKeyConstraint: primary_constraint_node_1.primaryConstraintNode.create(columns, constraintName),
41
+ constraints: createTable.constraints
42
+ ? object_utils_1.freeze([...createTable.constraints, constraint])
43
+ : object_utils_1.freeze([constraint]),
35
44
  });
36
45
  },
37
46
  cloneWithUniqueConstraint(createTable, constraintName, columns) {
38
47
  const constraint = unique_constraint_node_1.uniqueConstraintNode.create(columns, constraintName);
39
48
  return object_utils_1.freeze({
40
49
  ...createTable,
41
- uniqueConstraints: createTable.uniqueConstraints
42
- ? object_utils_1.freeze([...createTable.uniqueConstraints, constraint])
50
+ constraints: createTable.constraints
51
+ ? object_utils_1.freeze([...createTable.constraints, constraint])
43
52
  : object_utils_1.freeze([constraint]),
44
53
  });
45
54
  },
@@ -47,8 +56,17 @@ exports.createTableNode = object_utils_1.freeze({
47
56
  const constraint = check_constraint_node_1.checkConstraintNode.create(sql, constraintName);
48
57
  return object_utils_1.freeze({
49
58
  ...createTable,
50
- checkConstraints: createTable.checkConstraints
51
- ? object_utils_1.freeze([...createTable.checkConstraints, constraint])
59
+ constraints: createTable.constraints
60
+ ? object_utils_1.freeze([...createTable.constraints, constraint])
61
+ : object_utils_1.freeze([constraint]),
62
+ });
63
+ },
64
+ cloneWithForeignKeyConstraint(createTable, constraintName, sourceColumns, targetTable, targetColumns) {
65
+ const constraint = foreign_key_constraint_node_1.foreignKeyConstraintNode.create(sourceColumns.map(column_node_1.columnNode.create), table_node_1.tableNode.create(targetTable), targetColumns.map(column_node_1.columnNode.create), constraintName);
66
+ return object_utils_1.freeze({
67
+ ...createTable,
68
+ constraints: createTable.constraints
69
+ ? object_utils_1.freeze([...createTable.constraints, constraint])
52
70
  : object_utils_1.freeze([constraint]),
53
71
  });
54
72
  },
@@ -5,6 +5,9 @@ export interface DataTypeNode extends OperationNode {
5
5
  readonly kind: 'DataTypeNode';
6
6
  readonly dataType: ColumnDataType;
7
7
  }
8
+ /**
9
+ * @internal
10
+ */
8
11
  export declare const dataTypeNode: Readonly<{
9
12
  is(node: OperationNode): node is DataTypeNode;
10
13
  create(dataType: ColumnDataType): DataTypeNode;
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dataTypeNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
+ /**
6
+ * @internal
7
+ */
5
8
  exports.dataTypeNode = object_utils_1.freeze({
6
9
  is(node) {
7
10
  return node.kind === 'DataTypeNode';
@@ -13,6 +13,9 @@ export interface DeleteQueryNode extends OperationNode {
13
13
  readonly returning?: ReturningNode;
14
14
  readonly with?: WithNode;
15
15
  }
16
+ /**
17
+ * @internal
18
+ */
16
19
  export declare const deleteQueryNode: Readonly<{
17
20
  is(node: OperationNode): node is DeleteQueryNode;
18
21
  create(fromItem: TableExpressionNode, withNode?: WithNode | undefined): DeleteQueryNode;
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deleteQueryNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
5
  const from_node_1 = require("./from-node");
6
+ /**
7
+ * @internal
8
+ */
6
9
  exports.deleteQueryNode = object_utils_1.freeze({
7
10
  is(node) {
8
11
  return node.kind === 'DeleteQueryNode';
@@ -4,6 +4,9 @@ export interface DropColumnNode extends OperationNode {
4
4
  readonly kind: 'DropColumnNode';
5
5
  readonly column: ColumnNode;
6
6
  }
7
+ /**
8
+ * @internal
9
+ */
7
10
  export declare const dropColumnNode: Readonly<{
8
11
  is(node: OperationNode): node is DropColumnNode;
9
12
  create(column: string): DropColumnNode;
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dropColumnNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
5
  const column_node_1 = require("./column-node");
6
+ /**
7
+ * @internal
8
+ */
6
9
  exports.dropColumnNode = object_utils_1.freeze({
7
10
  is(node) {
8
11
  return node.kind === 'DropColumnNode';
@@ -4,6 +4,9 @@ export interface DropConstraintNode extends OperationNode {
4
4
  readonly kind: 'DropConstraintNode';
5
5
  readonly constraintName: IdentifierNode;
6
6
  }
7
+ /**
8
+ * @internal
9
+ */
7
10
  export declare const dropConstraintNode: Readonly<{
8
11
  is(node: OperationNode): node is DropConstraintNode;
9
12
  create(constraintName: string): DropConstraintNode;
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dropConstraintNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
5
  const identifier_node_1 = require("./identifier-node");
6
+ /**
7
+ * @internal
8
+ */
6
9
  exports.dropConstraintNode = object_utils_1.freeze({
7
10
  is(node) {
8
11
  return node.kind === 'DropConstraintNode';
@@ -7,6 +7,9 @@ export interface DropIndexNode extends OperationNode {
7
7
  readonly name: IdentifierNode;
8
8
  readonly modifier?: DropIndexNodeModifier;
9
9
  }
10
+ /**
11
+ * @internal
12
+ */
10
13
  export declare const dropIndexNode: Readonly<{
11
14
  is(node: OperationNode): node is DropIndexNode;
12
15
  create(name: string, params?: DropIndexNodeParams | undefined): DropIndexNode;
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dropIndexNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
5
  const identifier_node_1 = require("./identifier-node");
6
+ /**
7
+ * @internal
8
+ */
6
9
  exports.dropIndexNode = object_utils_1.freeze({
7
10
  is(node) {
8
11
  return node.kind === 'DropIndexNode';
@@ -7,6 +7,9 @@ export interface DropSchemaNode extends OperationNode {
7
7
  readonly schema: IdentifierNode;
8
8
  readonly modifier?: DropSchemaNodeModifier;
9
9
  }
10
+ /**
11
+ * @internal
12
+ */
10
13
  export declare const dropSchemaNode: Readonly<{
11
14
  is(node: OperationNode): node is DropSchemaNode;
12
15
  create(schema: string, params?: DropSchemaNodeParams | undefined): DropSchemaNode;
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dropSchemaNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
5
  const identifier_node_1 = require("./identifier-node");
6
+ /**
7
+ * @internal
8
+ */
6
9
  exports.dropSchemaNode = object_utils_1.freeze({
7
10
  is(node) {
8
11
  return node.kind === 'DropSchemaNode';
@@ -1,14 +1,17 @@
1
1
  import { OperationNode } from './operation-node';
2
2
  import { TableNode } from './table-node';
3
- export declare type DropIndexNodeParams = Omit<Partial<DropTableNode>, 'kind' | 'table'>;
3
+ export declare type DropTablexNodeParams = Omit<Partial<DropTableNode>, 'kind' | 'table'>;
4
4
  export declare type DropTableNodeModifier = 'IfExists';
5
5
  export interface DropTableNode extends OperationNode {
6
6
  readonly kind: 'DropTableNode';
7
7
  readonly table: TableNode;
8
8
  readonly modifier?: DropTableNodeModifier;
9
9
  }
10
+ /**
11
+ * @internal
12
+ */
10
13
  export declare const dropTableNode: Readonly<{
11
14
  is(node: OperationNode): node is DropTableNode;
12
- create(table: TableNode, params?: DropIndexNodeParams | undefined): DropTableNode;
15
+ create(table: TableNode, params?: DropTablexNodeParams | undefined): DropTableNode;
13
16
  cloneWithModifier(dropIndex: DropTableNode, modifier: DropTableNodeModifier): DropTableNode;
14
17
  }>;
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dropTableNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
+ /**
6
+ * @internal
7
+ */
5
8
  exports.dropTableNode = object_utils_1.freeze({
6
9
  is(node) {
7
10
  return node.kind === 'DropTableNode';
@@ -9,6 +9,9 @@ export interface FilterNode extends OperationNode {
9
9
  readonly op: OperatorNode | RawNode;
10
10
  readonly right: ValueExpressionNode;
11
11
  }
12
+ /**
13
+ * @internal
14
+ */
12
15
  export declare const filterNode: Readonly<{
13
16
  is(node: OperationNode): node is FilterNode;
14
17
  create(left: ReferenceExpressionNode | undefined, op: OperatorNode | RawNode, right: ValueExpressionNode): FilterNode;
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.filterNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
+ /**
6
+ * @internal
7
+ */
5
8
  exports.filterNode = object_utils_1.freeze({
6
9
  is(node) {
7
10
  return node.kind === 'FilterNode';
@@ -5,10 +5,14 @@ import { ReferencesNode } from './references-node';
5
5
  import { TableNode } from './table-node';
6
6
  export interface ForeignKeyConstraintNode extends OperationNode {
7
7
  readonly kind: 'ForeignKeyConstraintNode';
8
+ readonly columns: ReadonlyArray<ColumnNode>;
8
9
  readonly references: ReferencesNode;
9
10
  readonly name?: IdentifierNode;
10
11
  }
12
+ /**
13
+ * @internal
14
+ */
11
15
  export declare const foreignKeyConstraintNode: Readonly<{
12
16
  is(node: OperationNode): node is ForeignKeyConstraintNode;
13
- create(table: TableNode, column: ColumnNode, constraintName?: string | undefined): ForeignKeyConstraintNode;
17
+ create(sourceColumns: ReadonlyArray<ColumnNode>, targetTable: TableNode, targetColumns: ReadonlyArray<ColumnNode>, constraintName?: string | undefined): ForeignKeyConstraintNode;
14
18
  }>;
@@ -4,14 +4,18 @@ exports.foreignKeyConstraintNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
5
  const identifier_node_1 = require("./identifier-node");
6
6
  const references_node_1 = require("./references-node");
7
+ /**
8
+ * @internal
9
+ */
7
10
  exports.foreignKeyConstraintNode = object_utils_1.freeze({
8
11
  is(node) {
9
12
  return node.kind === 'ForeignKeyConstraintNode';
10
13
  },
11
- create(table, column, constraintName) {
14
+ create(sourceColumns, targetTable, targetColumns, constraintName) {
12
15
  return object_utils_1.freeze({
13
16
  kind: 'ForeignKeyConstraintNode',
14
- references: references_node_1.referencesNode.create(table, column),
17
+ columns: sourceColumns,
18
+ references: references_node_1.referencesNode.create(targetTable, targetColumns),
15
19
  name: constraintName ? identifier_node_1.identifierNode.create(constraintName) : undefined,
16
20
  });
17
21
  },
@@ -4,6 +4,9 @@ export interface FromNode extends OperationNode {
4
4
  readonly kind: 'FromNode';
5
5
  readonly froms: ReadonlyArray<TableExpressionNode>;
6
6
  }
7
+ /**
8
+ * @internal
9
+ */
7
10
  export declare const fromNode: Readonly<{
8
11
  is(node: OperationNode): node is FromNode;
9
12
  create(froms: ReadonlyArray<TableExpressionNode>): FromNode;
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fromNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
+ /**
6
+ * @internal
7
+ */
5
8
  exports.fromNode = object_utils_1.freeze({
6
9
  is(node) {
7
10
  return node.kind === 'FromNode';
@@ -4,6 +4,9 @@ export interface GroupByItemNode extends OperationNode {
4
4
  readonly kind: 'GroupByItemNode';
5
5
  readonly groupBy: ReferenceExpressionNode;
6
6
  }
7
+ /**
8
+ * @internal
9
+ */
7
10
  export declare const groupByItemNode: Readonly<{
8
11
  is(node: OperationNode): node is GroupByItemNode;
9
12
  create(groupBy: ReferenceExpressionNode): GroupByItemNode;
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.groupByItemNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
+ /**
6
+ * @internal
7
+ */
5
8
  exports.groupByItemNode = object_utils_1.freeze({
6
9
  is(node) {
7
10
  return node.kind === 'GroupByItemNode';
@@ -4,6 +4,9 @@ export interface GroupByNode extends OperationNode {
4
4
  readonly kind: 'GroupByNode';
5
5
  readonly items: ReadonlyArray<GroupByItemNode>;
6
6
  }
7
+ /**
8
+ * @internal
9
+ */
7
10
  export declare const groupByNode: Readonly<{
8
11
  is(node: OperationNode): node is GroupByNode;
9
12
  create(items: ReadonlyArray<GroupByItemNode>): GroupByNode;
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.groupByNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
+ /**
6
+ * @internal
7
+ */
5
8
  exports.groupByNode = object_utils_1.freeze({
6
9
  is(node) {
7
10
  return node.kind === 'GroupByNode';
@@ -8,6 +8,9 @@ export interface HavingNode extends OperationNode {
8
8
  readonly kind: 'HavingNode';
9
9
  readonly having: HavingNodeChild;
10
10
  }
11
+ /**
12
+ * @internal
13
+ */
11
14
  export declare const havingNode: Readonly<{
12
15
  is(node: OperationNode): node is HavingNode;
13
16
  create(filter: HavingNodeChild): HavingNode;
@@ -4,6 +4,9 @@ exports.havingNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
5
  const and_node_1 = require("./and-node");
6
6
  const or_node_1 = require("./or-node");
7
+ /**
8
+ * @internal
9
+ */
7
10
  exports.havingNode = object_utils_1.freeze({
8
11
  is(node) {
9
12
  return node.kind === 'HavingNode';
@@ -3,6 +3,9 @@ export interface IdentifierNode extends OperationNode {
3
3
  readonly kind: 'IdentifierNode';
4
4
  readonly identifier: string;
5
5
  }
6
+ /**
7
+ * @internal
8
+ */
6
9
  export declare const identifierNode: Readonly<{
7
10
  is(node: OperationNode): node is IdentifierNode;
8
11
  create(identifier: string): IdentifierNode;
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.identifierNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
+ /**
6
+ * @internal
7
+ */
5
8
  exports.identifierNode = object_utils_1.freeze({
6
9
  is(node) {
7
10
  return node.kind === 'IdentifierNode';
@@ -17,6 +17,9 @@ export interface InsertQueryNode extends OperationNode {
17
17
  readonly onConflict?: OnConflictNode;
18
18
  readonly with?: WithNode;
19
19
  }
20
+ /**
21
+ * @internal
22
+ */
20
23
  export declare const insertQueryNode: Readonly<{
21
24
  is(node: OperationNode): node is InsertQueryNode;
22
25
  create(into: TableNode, withNode?: WithNode | undefined): InsertQueryNode;
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.insertQueryNode = void 0;
4
4
  const object_utils_1 = require("../util/object-utils");
5
5
  const on_conflict_node_1 = require("./on-conflict-node");
6
+ /**
7
+ * @internal
8
+ */
6
9
  exports.insertQueryNode = object_utils_1.freeze({
7
10
  is(node) {
8
11
  return node.kind === 'InsertQueryNode';