kysely 0.14.0 → 0.15.2

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 (73) hide show
  1. package/README.md +95 -39
  2. package/dist/cjs/dialect/mysql/mysql-introspector.js +3 -3
  3. package/dist/cjs/dialect/postgres/postgres-introspector.js +3 -3
  4. package/dist/cjs/dialect/sqlite/sqlite-introspector.js +3 -3
  5. package/dist/cjs/index-nodeless.d.ts +148 -0
  6. package/dist/cjs/index-nodeless.js +149 -0
  7. package/dist/cjs/index.d.ts +6 -150
  8. package/dist/cjs/index.js +6 -139
  9. package/dist/cjs/kysely.d.ts +7 -39
  10. package/dist/cjs/kysely.js +8 -40
  11. package/dist/cjs/migration/file-migration-provider.d.ts +52 -0
  12. package/dist/cjs/migration/file-migration-provider.js +52 -0
  13. package/dist/cjs/migration/{migration.d.ts → migrator.d.ts} +159 -134
  14. package/dist/cjs/migration/{migration.js → migrator.js} +166 -57
  15. package/dist/cjs/parser/insert-values-parser.d.ts +4 -4
  16. package/dist/cjs/parser/insert-values-parser.js +2 -3
  17. package/dist/cjs/parser/reference-parser.d.ts +4 -3
  18. package/dist/cjs/parser/select-parser.d.ts +10 -4
  19. package/dist/cjs/parser/update-set-parser.d.ts +2 -1
  20. package/dist/cjs/query-builder/delete-query-builder.d.ts +2 -4
  21. package/dist/cjs/query-builder/insert-query-builder.d.ts +5 -21
  22. package/dist/cjs/query-builder/insert-query-builder.js +2 -7
  23. package/dist/cjs/query-builder/on-conflict-builder.d.ts +5 -3
  24. package/dist/cjs/query-builder/on-conflict-builder.js +2 -2
  25. package/dist/cjs/query-builder/returning-interface.d.ts +2 -4
  26. package/dist/cjs/query-builder/select-query-builder.d.ts +1 -1
  27. package/dist/cjs/query-builder/update-query-builder.d.ts +2 -4
  28. package/dist/cjs/query-creator.d.ts +0 -2
  29. package/dist/cjs/query-creator.js +0 -2
  30. package/dist/cjs/util/column-type.d.ts +165 -0
  31. package/dist/cjs/util/column-type.js +2 -0
  32. package/dist/cjs/util/private-symbols.d.ts +5 -0
  33. package/dist/cjs/util/private-symbols.js +8 -0
  34. package/dist/cjs/util/type-utils.d.ts +6 -42
  35. package/dist/esm/dialect/mysql/mysql-introspector.js +1 -1
  36. package/dist/esm/dialect/postgres/postgres-introspector.js +1 -1
  37. package/dist/esm/dialect/sqlite/sqlite-introspector.js +1 -1
  38. package/dist/esm/index-nodeless.d.ts +148 -0
  39. package/dist/esm/index-nodeless.js +137 -0
  40. package/dist/esm/index.d.ts +6 -150
  41. package/dist/esm/index.js +6 -139
  42. package/dist/esm/kysely.d.ts +7 -39
  43. package/dist/esm/kysely.js +8 -40
  44. package/dist/esm/migration/file-migration-provider.d.ts +52 -0
  45. package/dist/esm/migration/file-migration-provider.js +48 -0
  46. package/dist/esm/migration/{migration.d.ts → migrator.d.ts} +159 -134
  47. package/dist/esm/migration/{migration.js → migrator.js} +165 -56
  48. package/dist/esm/parser/insert-values-parser.d.ts +4 -4
  49. package/dist/esm/parser/insert-values-parser.js +2 -3
  50. package/dist/esm/parser/reference-parser.d.ts +4 -3
  51. package/dist/esm/parser/select-parser.d.ts +10 -4
  52. package/dist/esm/parser/update-set-parser.d.ts +2 -1
  53. package/dist/esm/query-builder/delete-query-builder.d.ts +2 -4
  54. package/dist/esm/query-builder/insert-query-builder.d.ts +5 -21
  55. package/dist/esm/query-builder/insert-query-builder.js +1 -6
  56. package/dist/esm/query-builder/on-conflict-builder.d.ts +5 -3
  57. package/dist/esm/query-builder/on-conflict-builder.js +2 -2
  58. package/dist/esm/query-builder/returning-interface.d.ts +2 -4
  59. package/dist/esm/query-builder/select-query-builder.d.ts +1 -1
  60. package/dist/esm/query-builder/update-query-builder.d.ts +2 -4
  61. package/dist/esm/query-creator.d.ts +0 -2
  62. package/dist/esm/query-creator.js +0 -2
  63. package/dist/esm/util/column-type.d.ts +165 -0
  64. package/dist/esm/util/column-type.js +1 -0
  65. package/dist/esm/util/private-symbols.d.ts +5 -0
  66. package/dist/esm/util/private-symbols.js +5 -0
  67. package/dist/esm/util/type-utils.d.ts +6 -42
  68. package/package.json +1 -1
  69. package/test.js +3 -0
  70. package/dist/cjs/util/generated-placeholder.d.ts +0 -3
  71. package/dist/cjs/util/generated-placeholder.js +0 -11
  72. package/dist/esm/util/generated-placeholder.d.ts +0 -3
  73. package/dist/esm/util/generated-placeholder.js +0 -7
@@ -1,152 +1,8 @@
1
- export * from './kysely.js';
2
- export * from './query-creator.js';
3
- export * from './query-builder/where-interface.js';
4
- export * from './query-builder/join-interface.js';
5
- export * from './query-builder/returning-interface.js';
6
- export * from './query-builder/having-interface.js';
7
- export * from './query-builder/select-query-builder.js';
8
- export * from './query-builder/insert-query-builder.js';
9
- export * from './query-builder/update-query-builder.js';
10
- export * from './query-builder/delete-query-builder.js';
11
- export * from './query-builder/no-result-error.js';
12
- export * from './query-builder/join-builder.js';
13
- export * from './query-builder/expression-builder.js';
14
- export * from './query-builder/function-builder.js';
15
- export * from './query-builder/insert-result.js';
16
- export * from './query-builder/delete-result.js';
17
- export * from './query-builder/update-result.js';
18
- export * from './raw-builder/raw-builder.js';
19
- export * from './query-executor/query-executor.js';
20
- export * from './query-executor/default-query-executor.js';
21
- export * from './query-executor/noop-query-executor.js';
22
- export * from './query-compiler/default-query-compiler.js';
23
- export * from './query-compiler/compiled-query.js';
24
- export * from './schema/schema.js';
25
- export * from './schema/create-table-builder.js';
26
- export * from './schema/drop-table-builder.js';
27
- export * from './schema/create-index-builder.js';
28
- export * from './schema/drop-index-builder.js';
29
- export * from './schema/create-schema-builder.js';
30
- export * from './schema/drop-schema-builder.js';
31
- export * from './schema/column-definition-builder.js';
32
- export * from './schema/foreign-key-constraint-builder.js';
33
- export * from './schema/alter-table-builder.js';
34
- export * from './schema/create-view-builder.js';
35
- export * from './schema/drop-view-builder.js';
36
- export * from './dynamic/dynamic.js';
37
- export * from './driver/driver.js';
38
- export * from './driver/database-connection.js';
39
- export * from './driver/connection-provider.js';
40
- export * from './driver/default-connection-provider.js';
41
- export * from './driver/single-connection-provider.js';
42
- export * from './dialect/postgres/postgres-dialect.js';
43
- export * from './dialect/postgres/postgres-query-compiler.js';
44
- export * from './dialect/postgres/postgres-driver.js';
45
- export * from './dialect/postgres/postgres-introspector.js';
46
- export * from './dialect/postgres/postgres-adapter.js';
47
- export * from './dialect/mysql/mysql-dialect.js';
48
- export * from './dialect/mysql/mysql-query-compiler.js';
49
- export * from './dialect/mysql/mysql-driver.js';
50
- export * from './dialect/mysql/mysql-introspector.js';
51
- export * from './dialect/mysql/mysql-adapter.js';
1
+ export * from './index-nodeless.js';
2
+ export * from './migration/file-migration-provider.js';
52
3
  export * from './dialect/sqlite/sqlite-dialect.js';
53
- export * from './dialect/sqlite/sqlite-query-compiler.js';
54
4
  export * from './dialect/sqlite/sqlite-driver.js';
55
- export * from './dialect/sqlite/sqlite-introspector.js';
56
- export * from './dialect/sqlite/sqlite-adapter.js';
57
- export * from './query-compiler/default-query-compiler.js';
58
- export * from './query-compiler/query-compiler.js';
59
- export * from './migration/migration.js';
60
- export * from './dialect/dialect.js';
61
- export * from './dialect/dialect-adapter.js';
62
- export * from './dialect/dialect-adapter-base.js';
63
- export * from './plugin/kysely-plugin.js';
64
- export * from './plugin/camel-case/camel-case-plugin.js';
65
- export * from './operation-node/add-column-node.js';
66
- export * from './operation-node/add-constraint-node.js';
67
- export * from './operation-node/alias-node.js';
68
- export * from './operation-node/alter-column-node.js';
69
- export * from './operation-node/alter-table-node.js';
70
- export * from './operation-node/and-node.js';
71
- export * from './operation-node/check-constraint-node.js';
72
- export * from './operation-node/column-definition-node.js';
73
- export * from './operation-node/column-node.js';
74
- export * from './operation-node/column-update-node.js';
75
- export * from './operation-node/common-table-expression-node.js';
76
- export * from './operation-node/common-table-expression-name-node.js';
77
- export * from './operation-node/constraint-node.js';
78
- export * from './operation-node/create-index-node.js';
79
- export * from './operation-node/create-schema-node.js';
80
- export * from './operation-node/create-table-node.js';
81
- export * from './operation-node/create-view-node.js';
82
- export * from './operation-node/data-type-node.js';
83
- export * from './operation-node/default-value-node.js';
84
- export * from './operation-node/delete-query-node.js';
85
- export * from './operation-node/drop-column-node.js';
86
- export * from './operation-node/drop-constraint-node.js';
87
- export * from './operation-node/drop-index-node.js';
88
- export * from './operation-node/drop-schema-node.js';
89
- export * from './operation-node/drop-table-node.js';
90
- export * from './operation-node/drop-view-node.js';
91
- export * from './operation-node/filter-node.js';
92
- export * from './operation-node/foreign-key-constraint-node.js';
93
- export * from './operation-node/from-node.js';
94
- export * from './operation-node/generated-node.js';
95
- export * from './operation-node/group-by-item-node.js';
96
- export * from './operation-node/group-by-node.js';
97
- export * from './operation-node/having-node.js';
98
- export * from './operation-node/identifier-node.js';
99
- export * from './operation-node/insert-query-node.js';
100
- export * from './operation-node/join-node.js';
101
- export * from './operation-node/limit-node.js';
102
- export * from './operation-node/list-node.js';
103
- export * from './operation-node/modify-column-node.js';
104
- export * from './operation-node/offset-node.js';
105
- export * from './operation-node/on-conflict-node.js';
106
- export * from './operation-node/on-duplicate-key-node.js';
107
- export * from './operation-node/on-node.js';
108
- export * from './operation-node/operation-node-source.js';
109
- export * from './operation-node/operation-node-transformer.js';
110
- export * from './operation-node/operation-node-utils.js';
111
- export * from './operation-node/operation-node-visitor.js';
112
- export * from './operation-node/operation-node.js';
113
- export * from './operation-node/operator-node.js';
114
- export * from './operation-node/or-node.js';
115
- export * from './operation-node/order-by-item-node.js';
116
- export * from './operation-node/order-by-node.js';
117
- export * from './operation-node/parens-node.js';
118
- export * from './operation-node/primary-constraint-node.js';
119
- export * from './operation-node/primitive-value-list-node.js';
120
- export * from './operation-node/query-node.js';
121
- export * from './operation-node/raw-node.js';
122
- export * from './operation-node/reference-node.js';
123
- export * from './operation-node/references-node.js';
124
- export * from './operation-node/rename-column-node.js';
125
- export * from './operation-node/returning-node.js';
126
- export * from './operation-node/select-all-node.js';
127
- export * from './operation-node/select-query-node.js';
128
- export * from './operation-node/select-query-node.js';
129
- export * from './operation-node/selection-node.js';
130
- export * from './operation-node/table-node.js';
131
- export * from './operation-node/union-node.js';
132
- export * from './operation-node/unique-constraint-node.js';
133
- export * from './operation-node/update-query-node.js';
134
- export * from './operation-node/value-list-node.js';
135
- export * from './operation-node/value-node.js';
136
- export * from './operation-node/values-node.js';
137
- export * from './operation-node/where-node.js';
138
- export * from './operation-node/with-node.js';
139
- export * from './dialect/database-introspector.js';
140
- export * from './util/compilable.js';
141
- export * from './util/log.js';
142
- export { AnyColumn, UnknownRow, AnySelectQueryBuilder, } from './util/type-utils.js';
143
- export { SelectExpression, SelectExpressionOrList, Selection, } from './parser/select-parser.js';
144
- export { ReferenceExpression, ReferenceExpressionOrList, } from './parser/reference-parser.js';
145
- export { ValueExpression, ValueExpressionOrList, } from './parser/value-parser.js';
146
- export { FilterValueExpression, FilterValueExpressionOrList, ExistsExpression, FilterOperator, } from './parser/filter-parser.js';
147
- export { TableExpression, TableExpressionOrList, } from './parser/table-parser.js';
148
- export { JoinReferenceExpression, JoinCallbackExpression, } from './parser/join-parser.js';
149
- export { InsertObject } from './parser/insert-values-parser.js';
150
- export { MutationObject } from './parser/update-set-parser.js';
151
- export { OrderByExpression, OrderByDirectionExpression, } from './parser/order-by-parser.js';
152
- export { UnionExpression } from './parser/union-parser.js';
5
+ export * from './dialect/mysql/mysql-dialect.js';
6
+ export * from './dialect/mysql/mysql-driver.js';
7
+ export * from './dialect/postgres/postgres-driver.js';
8
+ export * from './dialect/postgres/postgres-dialect.js';
package/dist/cjs/index.js CHANGED
@@ -10,144 +10,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./kysely.js"), exports);
14
- __exportStar(require("./query-creator.js"), exports);
15
- __exportStar(require("./query-builder/where-interface.js"), exports);
16
- __exportStar(require("./query-builder/join-interface.js"), exports);
17
- __exportStar(require("./query-builder/returning-interface.js"), exports);
18
- __exportStar(require("./query-builder/having-interface.js"), exports);
19
- __exportStar(require("./query-builder/select-query-builder.js"), exports);
20
- __exportStar(require("./query-builder/insert-query-builder.js"), exports);
21
- __exportStar(require("./query-builder/update-query-builder.js"), exports);
22
- __exportStar(require("./query-builder/delete-query-builder.js"), exports);
23
- __exportStar(require("./query-builder/no-result-error.js"), exports);
24
- __exportStar(require("./query-builder/join-builder.js"), exports);
25
- __exportStar(require("./query-builder/expression-builder.js"), exports);
26
- __exportStar(require("./query-builder/function-builder.js"), exports);
27
- __exportStar(require("./query-builder/insert-result.js"), exports);
28
- __exportStar(require("./query-builder/delete-result.js"), exports);
29
- __exportStar(require("./query-builder/update-result.js"), exports);
30
- __exportStar(require("./raw-builder/raw-builder.js"), exports);
31
- __exportStar(require("./query-executor/query-executor.js"), exports);
32
- __exportStar(require("./query-executor/default-query-executor.js"), exports);
33
- __exportStar(require("./query-executor/noop-query-executor.js"), exports);
34
- __exportStar(require("./query-compiler/default-query-compiler.js"), exports);
35
- __exportStar(require("./query-compiler/compiled-query.js"), exports);
36
- __exportStar(require("./schema/schema.js"), exports);
37
- __exportStar(require("./schema/create-table-builder.js"), exports);
38
- __exportStar(require("./schema/drop-table-builder.js"), exports);
39
- __exportStar(require("./schema/create-index-builder.js"), exports);
40
- __exportStar(require("./schema/drop-index-builder.js"), exports);
41
- __exportStar(require("./schema/create-schema-builder.js"), exports);
42
- __exportStar(require("./schema/drop-schema-builder.js"), exports);
43
- __exportStar(require("./schema/column-definition-builder.js"), exports);
44
- __exportStar(require("./schema/foreign-key-constraint-builder.js"), exports);
45
- __exportStar(require("./schema/alter-table-builder.js"), exports);
46
- __exportStar(require("./schema/create-view-builder.js"), exports);
47
- __exportStar(require("./schema/drop-view-builder.js"), exports);
48
- __exportStar(require("./dynamic/dynamic.js"), exports);
49
- __exportStar(require("./driver/driver.js"), exports);
50
- __exportStar(require("./driver/database-connection.js"), exports);
51
- __exportStar(require("./driver/connection-provider.js"), exports);
52
- __exportStar(require("./driver/default-connection-provider.js"), exports);
53
- __exportStar(require("./driver/single-connection-provider.js"), exports);
54
- __exportStar(require("./dialect/postgres/postgres-dialect.js"), exports);
55
- __exportStar(require("./dialect/postgres/postgres-query-compiler.js"), exports);
56
- __exportStar(require("./dialect/postgres/postgres-driver.js"), exports);
57
- __exportStar(require("./dialect/postgres/postgres-introspector.js"), exports);
58
- __exportStar(require("./dialect/postgres/postgres-adapter.js"), exports);
59
- __exportStar(require("./dialect/mysql/mysql-dialect.js"), exports);
60
- __exportStar(require("./dialect/mysql/mysql-query-compiler.js"), exports);
61
- __exportStar(require("./dialect/mysql/mysql-driver.js"), exports);
62
- __exportStar(require("./dialect/mysql/mysql-introspector.js"), exports);
63
- __exportStar(require("./dialect/mysql/mysql-adapter.js"), exports);
13
+ __exportStar(require("./index-nodeless.js"), exports);
14
+ __exportStar(require("./migration/file-migration-provider.js"), exports);
64
15
  __exportStar(require("./dialect/sqlite/sqlite-dialect.js"), exports);
65
- __exportStar(require("./dialect/sqlite/sqlite-query-compiler.js"), exports);
66
16
  __exportStar(require("./dialect/sqlite/sqlite-driver.js"), exports);
67
- __exportStar(require("./dialect/sqlite/sqlite-introspector.js"), exports);
68
- __exportStar(require("./dialect/sqlite/sqlite-adapter.js"), exports);
69
- __exportStar(require("./query-compiler/default-query-compiler.js"), exports);
70
- __exportStar(require("./query-compiler/query-compiler.js"), exports);
71
- __exportStar(require("./migration/migration.js"), exports);
72
- __exportStar(require("./dialect/dialect.js"), exports);
73
- __exportStar(require("./dialect/dialect-adapter.js"), exports);
74
- __exportStar(require("./dialect/dialect-adapter-base.js"), exports);
75
- __exportStar(require("./plugin/kysely-plugin.js"), exports);
76
- __exportStar(require("./plugin/camel-case/camel-case-plugin.js"), exports);
77
- __exportStar(require("./operation-node/add-column-node.js"), exports);
78
- __exportStar(require("./operation-node/add-constraint-node.js"), exports);
79
- __exportStar(require("./operation-node/alias-node.js"), exports);
80
- __exportStar(require("./operation-node/alter-column-node.js"), exports);
81
- __exportStar(require("./operation-node/alter-table-node.js"), exports);
82
- __exportStar(require("./operation-node/and-node.js"), exports);
83
- __exportStar(require("./operation-node/check-constraint-node.js"), exports);
84
- __exportStar(require("./operation-node/column-definition-node.js"), exports);
85
- __exportStar(require("./operation-node/column-node.js"), exports);
86
- __exportStar(require("./operation-node/column-update-node.js"), exports);
87
- __exportStar(require("./operation-node/common-table-expression-node.js"), exports);
88
- __exportStar(require("./operation-node/common-table-expression-name-node.js"), exports);
89
- __exportStar(require("./operation-node/constraint-node.js"), exports);
90
- __exportStar(require("./operation-node/create-index-node.js"), exports);
91
- __exportStar(require("./operation-node/create-schema-node.js"), exports);
92
- __exportStar(require("./operation-node/create-table-node.js"), exports);
93
- __exportStar(require("./operation-node/create-view-node.js"), exports);
94
- __exportStar(require("./operation-node/data-type-node.js"), exports);
95
- __exportStar(require("./operation-node/default-value-node.js"), exports);
96
- __exportStar(require("./operation-node/delete-query-node.js"), exports);
97
- __exportStar(require("./operation-node/drop-column-node.js"), exports);
98
- __exportStar(require("./operation-node/drop-constraint-node.js"), exports);
99
- __exportStar(require("./operation-node/drop-index-node.js"), exports);
100
- __exportStar(require("./operation-node/drop-schema-node.js"), exports);
101
- __exportStar(require("./operation-node/drop-table-node.js"), exports);
102
- __exportStar(require("./operation-node/drop-view-node.js"), exports);
103
- __exportStar(require("./operation-node/filter-node.js"), exports);
104
- __exportStar(require("./operation-node/foreign-key-constraint-node.js"), exports);
105
- __exportStar(require("./operation-node/from-node.js"), exports);
106
- __exportStar(require("./operation-node/generated-node.js"), exports);
107
- __exportStar(require("./operation-node/group-by-item-node.js"), exports);
108
- __exportStar(require("./operation-node/group-by-node.js"), exports);
109
- __exportStar(require("./operation-node/having-node.js"), exports);
110
- __exportStar(require("./operation-node/identifier-node.js"), exports);
111
- __exportStar(require("./operation-node/insert-query-node.js"), exports);
112
- __exportStar(require("./operation-node/join-node.js"), exports);
113
- __exportStar(require("./operation-node/limit-node.js"), exports);
114
- __exportStar(require("./operation-node/list-node.js"), exports);
115
- __exportStar(require("./operation-node/modify-column-node.js"), exports);
116
- __exportStar(require("./operation-node/offset-node.js"), exports);
117
- __exportStar(require("./operation-node/on-conflict-node.js"), exports);
118
- __exportStar(require("./operation-node/on-duplicate-key-node.js"), exports);
119
- __exportStar(require("./operation-node/on-node.js"), exports);
120
- __exportStar(require("./operation-node/operation-node-source.js"), exports);
121
- __exportStar(require("./operation-node/operation-node-transformer.js"), exports);
122
- __exportStar(require("./operation-node/operation-node-utils.js"), exports);
123
- __exportStar(require("./operation-node/operation-node-visitor.js"), exports);
124
- __exportStar(require("./operation-node/operation-node.js"), exports);
125
- __exportStar(require("./operation-node/operator-node.js"), exports);
126
- __exportStar(require("./operation-node/or-node.js"), exports);
127
- __exportStar(require("./operation-node/order-by-item-node.js"), exports);
128
- __exportStar(require("./operation-node/order-by-node.js"), exports);
129
- __exportStar(require("./operation-node/parens-node.js"), exports);
130
- __exportStar(require("./operation-node/primary-constraint-node.js"), exports);
131
- __exportStar(require("./operation-node/primitive-value-list-node.js"), exports);
132
- __exportStar(require("./operation-node/query-node.js"), exports);
133
- __exportStar(require("./operation-node/raw-node.js"), exports);
134
- __exportStar(require("./operation-node/reference-node.js"), exports);
135
- __exportStar(require("./operation-node/references-node.js"), exports);
136
- __exportStar(require("./operation-node/rename-column-node.js"), exports);
137
- __exportStar(require("./operation-node/returning-node.js"), exports);
138
- __exportStar(require("./operation-node/select-all-node.js"), exports);
139
- __exportStar(require("./operation-node/select-query-node.js"), exports);
140
- __exportStar(require("./operation-node/select-query-node.js"), exports);
141
- __exportStar(require("./operation-node/selection-node.js"), exports);
142
- __exportStar(require("./operation-node/table-node.js"), exports);
143
- __exportStar(require("./operation-node/union-node.js"), exports);
144
- __exportStar(require("./operation-node/unique-constraint-node.js"), exports);
145
- __exportStar(require("./operation-node/update-query-node.js"), exports);
146
- __exportStar(require("./operation-node/value-list-node.js"), exports);
147
- __exportStar(require("./operation-node/value-node.js"), exports);
148
- __exportStar(require("./operation-node/values-node.js"), exports);
149
- __exportStar(require("./operation-node/where-node.js"), exports);
150
- __exportStar(require("./operation-node/with-node.js"), exports);
151
- __exportStar(require("./dialect/database-introspector.js"), exports);
152
- __exportStar(require("./util/compilable.js"), exports);
153
- __exportStar(require("./util/log.js"), exports);
17
+ __exportStar(require("./dialect/mysql/mysql-dialect.js"), exports);
18
+ __exportStar(require("./dialect/mysql/mysql-driver.js"), exports);
19
+ __exportStar(require("./dialect/postgres/postgres-driver.js"), exports);
20
+ __exportStar(require("./dialect/postgres/postgres-dialect.js"), exports);
@@ -1,16 +1,16 @@
1
1
  import { Dialect } from './dialect/dialect.js';
2
2
  import { SchemaModule } from './schema/schema.js';
3
3
  import { DynamicModule } from './dynamic/dynamic.js';
4
- import { MigrationModule } from './migration/migration.js';
5
4
  import { QueryExecutor } from './query-executor/query-executor.js';
6
5
  import { QueryCreator } from './query-creator.js';
7
6
  import { KyselyPlugin } from './plugin/kysely-plugin.js';
8
- import { GeneratedPlaceholder } from './util/type-utils.js';
9
7
  import { DatabaseIntrospector } from './dialect/database-introspector.js';
10
8
  import { Driver, IsolationLevel } from './driver/driver.js';
11
9
  import { ParseContext } from './parser/parse-context.js';
12
10
  import { FunctionBuilder } from './query-builder/function-builder.js';
13
11
  import { LogConfig } from './util/log.js';
12
+ import { PRIVATE_ADAPTER } from './util/private-symbols.js';
13
+ import { DialectAdapter } from './dialect/dialect-adapter.js';
14
14
  /**
15
15
  * The main Kysely class.
16
16
  *
@@ -60,10 +60,6 @@ export declare class Kysely<DB> extends QueryCreator<DB> {
60
60
  * Returns the {@link SchemaModule} module for building database schema.
61
61
  */
62
62
  get schema(): SchemaModule;
63
- /**
64
- * Returns the {@link MigrationModule} module for managing and running migrations.
65
- */
66
- get migration(): MigrationModule;
67
63
  /**
68
64
  * Returns a the {@link DynamicModule} module.
69
65
  *
@@ -75,31 +71,6 @@ export declare class Kysely<DB> extends QueryCreator<DB> {
75
71
  * Returns a {@link DatabaseIntrospector | database introspector}.
76
72
  */
77
73
  get introspection(): DatabaseIntrospector;
78
- /**
79
- * A value to be used in place of columns that are generated in the database
80
- * when inserting rows.
81
- *
82
- * ### Examples
83
- *
84
- * In this example the `Person` table has non-null properties `id` and `created_at`
85
- * which are both automatically genereted by the database. Since their types are
86
- * `number` and `string` respectively instead of `number | null` and `string | null`
87
- * the `values` method requires you to give a value for them. the `generated`
88
- * placeholder can be used in these cases.
89
- *
90
- * ```ts
91
- * await db.insertInto('person')
92
- * .values({
93
- * id: db.generated,
94
- * created_at: db.generated,
95
- * first_name: 'Jennifer',
96
- * last_name: 'Aniston',
97
- * gender: 'female'
98
- * })
99
- * .execute()
100
- * ```
101
- */
102
- get generated(): GeneratedPlaceholder;
103
74
  /**
104
75
  * Returns a {@link FunctionBuilder} that can be used to write type safe function
105
76
  * calls.
@@ -149,7 +120,6 @@ export declare class Kysely<DB> extends QueryCreator<DB> {
149
120
  * const catto = await db.transaction().execute(async (trx) => {
150
121
  * const jennifer = await trx.insertInto('person')
151
122
  * .values({
152
- * id: db.generated,
153
123
  * first_name: 'Jennifer',
154
124
  * last_name: 'Aniston',
155
125
  * })
@@ -160,7 +130,6 @@ export declare class Kysely<DB> extends QueryCreator<DB> {
160
130
  *
161
131
  * return await trx.insertInto('pet')
162
132
  * .values({
163
- * id: db.generated,
164
133
  * user_id: jennifer.id,
165
134
  * name: 'Catto',
166
135
  * species: 'cat'
@@ -251,6 +220,11 @@ export declare class Kysely<DB> extends QueryCreator<DB> {
251
220
  * You can also use `db instanceof Transaction`.
252
221
  */
253
222
  get isTransaction(): boolean;
223
+ /**
224
+ * @internal
225
+ * @private
226
+ */
227
+ get [PRIVATE_ADAPTER](): DialectAdapter;
254
228
  }
255
229
  export declare class Transaction<DB> extends Kysely<DB> {
256
230
  #private;
@@ -261,10 +235,6 @@ export declare class Transaction<DB> extends Kysely<DB> {
261
235
  * You can also use `db instanceof Transaction`.
262
236
  */
263
237
  get isTransaction(): true;
264
- /**
265
- * Returns the {@link MigrationModule} module for managing and running migrations.
266
- */
267
- get migration(): MigrationModule;
268
238
  /**
269
239
  * Creates a {@link TransactionBuilder} that can be used to run queries inside a transaction.
270
240
  *
@@ -285,7 +255,6 @@ export declare class Transaction<DB> extends Kysely<DB> {
285
255
  * const catto = await db.transaction().execute(async (trx) => {
286
256
  * const jennifer = await trx.insertInto('person')
287
257
  * .values({
288
- * id: db.generated,
289
258
  * first_name: 'Jennifer',
290
259
  * last_name: 'Aniston',
291
260
  * })
@@ -296,7 +265,6 @@ export declare class Transaction<DB> extends Kysely<DB> {
296
265
  *
297
266
  * return await trx.insertInto('pet')
298
267
  * .values({
299
- * id: db.generated,
300
268
  * user_id: jennifer.id,
301
269
  * name: 'Catto',
302
270
  * species: 'cat'
@@ -4,9 +4,7 @@ exports.TransactionBuilder = exports.ConnectionBuilder = exports.isKyselyProps =
4
4
  const schema_js_1 = require("./schema/schema.js");
5
5
  const dynamic_js_1 = require("./dynamic/dynamic.js");
6
6
  const default_connection_provider_js_1 = require("./driver/default-connection-provider.js");
7
- const migration_js_1 = require("./migration/migration.js");
8
7
  const query_creator_js_1 = require("./query-creator.js");
9
- const generated_placeholder_js_1 = require("./util/generated-placeholder.js");
10
8
  const default_query_executor_js_1 = require("./query-executor/default-query-executor.js");
11
9
  const object_utils_js_1 = require("./util/object-utils.js");
12
10
  const runtime_driver_js_1 = require("./driver/runtime-driver.js");
@@ -16,6 +14,7 @@ const prevent_await_js_1 = require("./util/prevent-await.js");
16
14
  const parse_context_js_1 = require("./parser/parse-context.js");
17
15
  const function_builder_js_1 = require("./query-builder/function-builder.js");
18
16
  const log_js_1 = require("./util/log.js");
17
+ const private_symbols_js_1 = require("./util/private-symbols.js");
19
18
  /**
20
19
  * The main Kysely class.
21
20
  *
@@ -90,12 +89,6 @@ class Kysely extends query_creator_js_1.QueryCreator {
90
89
  get schema() {
91
90
  return new schema_js_1.SchemaModule(this.#props.executor);
92
91
  }
93
- /**
94
- * Returns the {@link MigrationModule} module for managing and running migrations.
95
- */
96
- get migration() {
97
- return new migration_js_1.MigrationModule(this, this.#props.parseContext.adapter);
98
- }
99
92
  /**
100
93
  * Returns a the {@link DynamicModule} module.
101
94
  *
@@ -111,33 +104,6 @@ class Kysely extends query_creator_js_1.QueryCreator {
111
104
  get introspection() {
112
105
  return this.#props.dialect.createIntrospector(this.withoutPlugins());
113
106
  }
114
- /**
115
- * A value to be used in place of columns that are generated in the database
116
- * when inserting rows.
117
- *
118
- * ### Examples
119
- *
120
- * In this example the `Person` table has non-null properties `id` and `created_at`
121
- * which are both automatically genereted by the database. Since their types are
122
- * `number` and `string` respectively instead of `number | null` and `string | null`
123
- * the `values` method requires you to give a value for them. the `generated`
124
- * placeholder can be used in these cases.
125
- *
126
- * ```ts
127
- * await db.insertInto('person')
128
- * .values({
129
- * id: db.generated,
130
- * created_at: db.generated,
131
- * first_name: 'Jennifer',
132
- * last_name: 'Aniston',
133
- * gender: 'female'
134
- * })
135
- * .execute()
136
- * ```
137
- */
138
- get generated() {
139
- return generated_placeholder_js_1.GENERATED_PLACEHOLDER;
140
- }
141
107
  /**
142
108
  * Returns a {@link FunctionBuilder} that can be used to write type safe function
143
109
  * calls.
@@ -189,7 +155,6 @@ class Kysely extends query_creator_js_1.QueryCreator {
189
155
  * const catto = await db.transaction().execute(async (trx) => {
190
156
  * const jennifer = await trx.insertInto('person')
191
157
  * .values({
192
- * id: db.generated,
193
158
  * first_name: 'Jennifer',
194
159
  * last_name: 'Aniston',
195
160
  * })
@@ -200,7 +165,6 @@ class Kysely extends query_creator_js_1.QueryCreator {
200
165
  *
201
166
  * return await trx.insertInto('pet')
202
167
  * .values({
203
- * id: db.generated,
204
168
  * user_id: jennifer.id,
205
169
  * name: 'Catto',
206
170
  * species: 'cat'
@@ -311,6 +275,13 @@ class Kysely extends query_creator_js_1.QueryCreator {
311
275
  get isTransaction() {
312
276
  return false;
313
277
  }
278
+ /**
279
+ * @internal
280
+ * @private
281
+ */
282
+ get [private_symbols_js_1.PRIVATE_ADAPTER]() {
283
+ return this.#props.parseContext.adapter;
284
+ }
314
285
  }
315
286
  exports.Kysely = Kysely;
316
287
  class Transaction extends Kysely {
@@ -325,9 +296,6 @@ class Transaction extends Kysely {
325
296
  get isTransaction() {
326
297
  return true;
327
298
  }
328
- get migration() {
329
- throw new Error('the migration module is not available for a transaction. Use the main Kysely instance to run migrations');
330
- }
331
299
  transaction() {
332
300
  throw new Error('calling the transaction method for a Transaction is not supported');
333
301
  }
@@ -0,0 +1,52 @@
1
+ import { Migration, MigrationProvider } from './migrator.js';
2
+ /**
3
+ * A function that takes a folder path and returns names of the
4
+ * files insider that folder.
5
+ */
6
+ export declare type ReadDir = (migrationFolderPath: string) => Promise<string[]>;
7
+ /**
8
+ * A function that combines two file path parts into a single file path.
9
+ *
10
+ * ```ts
11
+ * joinPath('/some/path', 'file.ts')
12
+ * // ==> '/some/path/file.ts'
13
+ * ```
14
+ */
15
+ export declare type JoinPath = (part1: string, part2: string) => string;
16
+ /**
17
+ * Reads all migrations from a folder.
18
+ *
19
+ * You need to provide a function for reading files in a folder and a function for
20
+ * joining file paths together. The API is like this to make Kysely independent of
21
+ * node.js or any other environment. See the example usage on node.js below.
22
+ *
23
+ * ### Examples
24
+ *
25
+ * ```ts
26
+ * import * as path from 'path'
27
+ * import * as fs from 'fs/promises'
28
+ *
29
+ * new FileMigrationProvider(
30
+ * fs.readdir,
31
+ * path.join,
32
+ * path.join(__dirname, 'migrations')
33
+ * )
34
+ * ```
35
+ */
36
+ export declare class FileMigrationProvider implements MigrationProvider {
37
+ #private;
38
+ constructor(readDir: ReadDir, joinPath: JoinPath, migrationFolderPath: string);
39
+ /**
40
+ * Returns all migrations, old and new.
41
+ *
42
+ * For example if you have your migrations in a folder as separate files,
43
+ * you can use the {@link FileMigrationProvider} that implements this
44
+ * method to return all migrations in a folder.
45
+ *
46
+ * The keys of the returned object are migration names and values are the
47
+ * migrations. The order of the migrations is determined by the alphabetical
48
+ * order of the migration names. The items in the object don't need to be
49
+ * sorted, they are sorted by Kysely.
50
+ */
51
+ getMigrations(): Promise<Record<string, Migration>>;
52
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileMigrationProvider = void 0;
4
+ const object_utils_js_1 = require("../util/object-utils.js");
5
+ /**
6
+ * Reads all migrations from a folder.
7
+ *
8
+ * You need to provide a function for reading files in a folder and a function for
9
+ * joining file paths together. The API is like this to make Kysely independent of
10
+ * node.js or any other environment. See the example usage on node.js below.
11
+ *
12
+ * ### Examples
13
+ *
14
+ * ```ts
15
+ * import * as path from 'path'
16
+ * import * as fs from 'fs/promises'
17
+ *
18
+ * new FileMigrationProvider(
19
+ * fs.readdir,
20
+ * path.join,
21
+ * path.join(__dirname, 'migrations')
22
+ * )
23
+ * ```
24
+ */
25
+ class FileMigrationProvider {
26
+ #readDir;
27
+ #joinPath;
28
+ #migrationFolderPath;
29
+ constructor(readDir, joinPath, migrationFolderPath) {
30
+ this.#readDir = readDir;
31
+ this.#joinPath = joinPath;
32
+ this.#migrationFolderPath = migrationFolderPath;
33
+ }
34
+ async getMigrations() {
35
+ const migrations = {};
36
+ const files = await this.#readDir(this.#migrationFolderPath);
37
+ for (const fileName of files) {
38
+ if ((fileName.endsWith('.js') || fileName.endsWith('.ts')) &&
39
+ !fileName.endsWith('.d.ts')) {
40
+ const migration = await Promise.resolve().then(() => require(this.#joinPath(this.#migrationFolderPath, fileName)));
41
+ if (isMigration(migration)) {
42
+ migrations[fileName.substring(0, fileName.length - 3)] = migration;
43
+ }
44
+ }
45
+ }
46
+ return migrations;
47
+ }
48
+ }
49
+ exports.FileMigrationProvider = FileMigrationProvider;
50
+ function isMigration(obj) {
51
+ return (0, object_utils_js_1.isObject)(obj) && (0, object_utils_js_1.isFunction)(obj.up);
52
+ }