@dungarees/datasource 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fake.d.ts +35 -0
- package/fake.js +51 -0
- package/fake.test.d.ts +1 -0
- package/fake.test.js +558 -0
- package/helpers.d.ts +2 -0
- package/helpers.js +4 -0
- package/migration/inmemory-migrator.d.ts +2 -0
- package/migration/inmemory-migrator.js +126 -0
- package/migration/kysely-migrator.d.ts +2 -0
- package/migration/kysely-migrator.js +6 -0
- package/migration/migration.d.ts +4 -0
- package/migration/migration.js +5 -0
- package/migration/provider.d.ts +5 -0
- package/migration/provider.js +39 -0
- package/migration/service.d.ts +2 -0
- package/migration/service.js +24 -0
- package/migration/type.d.ts +48 -0
- package/migration/type.js +1 -0
- package/package.json +510 -0
- package/postgres/fake.d.ts +2 -0
- package/postgres/fake.js +45 -0
- package/postgres/service.d.ts +11 -0
- package/postgres/service.js +23 -0
- package/service.d.ts +2 -0
- package/service.js +1 -0
- package/service.test.d.ts +1 -0
- package/service.test.js +37 -0
- package/test-migrations/001-test-migration.d.ts +2 -0
- package/test-migrations/001-test-migration.js +13 -0
- package/test-migrations/002-test-migration.d.ts +2 -0
- package/test-migrations/002-test-migration.js +9 -0
- package/test-migrations/003-test-migration.d.ts +2 -0
- package/test-migrations/003-test-migration.js +9 -0
- package/test-migrations-with-error/001-test-migration.d.ts +2 -0
- package/test-migrations-with-error/001-test-migration.js +13 -0
- package/test-migrations-with-error/002-test-migration.d.ts +2 -0
- package/test-migrations-with-error/002-test-migration.js +10 -0
- package/type.d.ts +5 -0
- package/type.js +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dungarees/datasource",
|
|
3
|
+
"engines": {
|
|
4
|
+
"node": ">=25.0.0"
|
|
5
|
+
},
|
|
6
|
+
"scripts": {
|
|
7
|
+
"type-check": "tsc --noEmit"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@dungarees/core": "*",
|
|
12
|
+
"kysely": "^0.29.5",
|
|
13
|
+
"pg": "^8.23.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/pg": "^8.11.10",
|
|
17
|
+
"pg-mem": "^3.0.14",
|
|
18
|
+
"typescript": "^5.9.3",
|
|
19
|
+
"vitest": "^3.0.2"
|
|
20
|
+
},
|
|
21
|
+
"author": "info@productkind.com",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"version": "0.11.4",
|
|
24
|
+
"exports": {
|
|
25
|
+
"./fake.test.ts": {
|
|
26
|
+
"import": "./fake.test.js",
|
|
27
|
+
"types": "./fake.test.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./fake.ts": {
|
|
30
|
+
"import": "./fake.js",
|
|
31
|
+
"types": "./fake.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./helpers.ts": {
|
|
34
|
+
"import": "./helpers.js",
|
|
35
|
+
"types": "./helpers.d.ts"
|
|
36
|
+
},
|
|
37
|
+
"./migration/inmemory-migrator.ts": {
|
|
38
|
+
"import": "./migration/inmemory-migrator.js",
|
|
39
|
+
"types": "./migration/inmemory-migrator.d.ts"
|
|
40
|
+
},
|
|
41
|
+
"./migration/kysely-migrator.ts": {
|
|
42
|
+
"import": "./migration/kysely-migrator.js",
|
|
43
|
+
"types": "./migration/kysely-migrator.d.ts"
|
|
44
|
+
},
|
|
45
|
+
"./migration/migration.ts": {
|
|
46
|
+
"import": "./migration/migration.js",
|
|
47
|
+
"types": "./migration/migration.d.ts"
|
|
48
|
+
},
|
|
49
|
+
"./migration/provider.ts": {
|
|
50
|
+
"import": "./migration/provider.js",
|
|
51
|
+
"types": "./migration/provider.d.ts"
|
|
52
|
+
},
|
|
53
|
+
"./migration/service.ts": {
|
|
54
|
+
"import": "./migration/service.js",
|
|
55
|
+
"types": "./migration/service.d.ts"
|
|
56
|
+
},
|
|
57
|
+
"./migration/type.ts": {
|
|
58
|
+
"import": "./migration/type.js",
|
|
59
|
+
"types": "./migration/type.d.ts"
|
|
60
|
+
},
|
|
61
|
+
"./node_modules/typescript/lib/lib.d.ts": {
|
|
62
|
+
"import": "./node_modules/typescript/lib/lib.d.js",
|
|
63
|
+
"types": "./node_modules/typescript/lib/lib.d.d.ts"
|
|
64
|
+
},
|
|
65
|
+
"./node_modules/typescript/lib/lib.decorators.d.ts": {
|
|
66
|
+
"import": "./node_modules/typescript/lib/lib.decorators.d.js",
|
|
67
|
+
"types": "./node_modules/typescript/lib/lib.decorators.d.d.ts"
|
|
68
|
+
},
|
|
69
|
+
"./node_modules/typescript/lib/lib.decorators.legacy.d.ts": {
|
|
70
|
+
"import": "./node_modules/typescript/lib/lib.decorators.legacy.d.js",
|
|
71
|
+
"types": "./node_modules/typescript/lib/lib.decorators.legacy.d.d.ts"
|
|
72
|
+
},
|
|
73
|
+
"./node_modules/typescript/lib/lib.dom.asynciterable.d.ts": {
|
|
74
|
+
"import": "./node_modules/typescript/lib/lib.dom.asynciterable.d.js",
|
|
75
|
+
"types": "./node_modules/typescript/lib/lib.dom.asynciterable.d.d.ts"
|
|
76
|
+
},
|
|
77
|
+
"./node_modules/typescript/lib/lib.dom.d.ts": {
|
|
78
|
+
"import": "./node_modules/typescript/lib/lib.dom.d.js",
|
|
79
|
+
"types": "./node_modules/typescript/lib/lib.dom.d.d.ts"
|
|
80
|
+
},
|
|
81
|
+
"./node_modules/typescript/lib/lib.dom.iterable.d.ts": {
|
|
82
|
+
"import": "./node_modules/typescript/lib/lib.dom.iterable.d.js",
|
|
83
|
+
"types": "./node_modules/typescript/lib/lib.dom.iterable.d.d.ts"
|
|
84
|
+
},
|
|
85
|
+
"./node_modules/typescript/lib/lib.es2015.collection.d.ts": {
|
|
86
|
+
"import": "./node_modules/typescript/lib/lib.es2015.collection.d.js",
|
|
87
|
+
"types": "./node_modules/typescript/lib/lib.es2015.collection.d.d.ts"
|
|
88
|
+
},
|
|
89
|
+
"./node_modules/typescript/lib/lib.es2015.core.d.ts": {
|
|
90
|
+
"import": "./node_modules/typescript/lib/lib.es2015.core.d.js",
|
|
91
|
+
"types": "./node_modules/typescript/lib/lib.es2015.core.d.d.ts"
|
|
92
|
+
},
|
|
93
|
+
"./node_modules/typescript/lib/lib.es2015.d.ts": {
|
|
94
|
+
"import": "./node_modules/typescript/lib/lib.es2015.d.js",
|
|
95
|
+
"types": "./node_modules/typescript/lib/lib.es2015.d.d.ts"
|
|
96
|
+
},
|
|
97
|
+
"./node_modules/typescript/lib/lib.es2015.generator.d.ts": {
|
|
98
|
+
"import": "./node_modules/typescript/lib/lib.es2015.generator.d.js",
|
|
99
|
+
"types": "./node_modules/typescript/lib/lib.es2015.generator.d.d.ts"
|
|
100
|
+
},
|
|
101
|
+
"./node_modules/typescript/lib/lib.es2015.iterable.d.ts": {
|
|
102
|
+
"import": "./node_modules/typescript/lib/lib.es2015.iterable.d.js",
|
|
103
|
+
"types": "./node_modules/typescript/lib/lib.es2015.iterable.d.d.ts"
|
|
104
|
+
},
|
|
105
|
+
"./node_modules/typescript/lib/lib.es2015.promise.d.ts": {
|
|
106
|
+
"import": "./node_modules/typescript/lib/lib.es2015.promise.d.js",
|
|
107
|
+
"types": "./node_modules/typescript/lib/lib.es2015.promise.d.d.ts"
|
|
108
|
+
},
|
|
109
|
+
"./node_modules/typescript/lib/lib.es2015.proxy.d.ts": {
|
|
110
|
+
"import": "./node_modules/typescript/lib/lib.es2015.proxy.d.js",
|
|
111
|
+
"types": "./node_modules/typescript/lib/lib.es2015.proxy.d.d.ts"
|
|
112
|
+
},
|
|
113
|
+
"./node_modules/typescript/lib/lib.es2015.reflect.d.ts": {
|
|
114
|
+
"import": "./node_modules/typescript/lib/lib.es2015.reflect.d.js",
|
|
115
|
+
"types": "./node_modules/typescript/lib/lib.es2015.reflect.d.d.ts"
|
|
116
|
+
},
|
|
117
|
+
"./node_modules/typescript/lib/lib.es2015.symbol.d.ts": {
|
|
118
|
+
"import": "./node_modules/typescript/lib/lib.es2015.symbol.d.js",
|
|
119
|
+
"types": "./node_modules/typescript/lib/lib.es2015.symbol.d.d.ts"
|
|
120
|
+
},
|
|
121
|
+
"./node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts": {
|
|
122
|
+
"import": "./node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.js",
|
|
123
|
+
"types": "./node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.d.ts"
|
|
124
|
+
},
|
|
125
|
+
"./node_modules/typescript/lib/lib.es2016.array.include.d.ts": {
|
|
126
|
+
"import": "./node_modules/typescript/lib/lib.es2016.array.include.d.js",
|
|
127
|
+
"types": "./node_modules/typescript/lib/lib.es2016.array.include.d.d.ts"
|
|
128
|
+
},
|
|
129
|
+
"./node_modules/typescript/lib/lib.es2016.d.ts": {
|
|
130
|
+
"import": "./node_modules/typescript/lib/lib.es2016.d.js",
|
|
131
|
+
"types": "./node_modules/typescript/lib/lib.es2016.d.d.ts"
|
|
132
|
+
},
|
|
133
|
+
"./node_modules/typescript/lib/lib.es2016.full.d.ts": {
|
|
134
|
+
"import": "./node_modules/typescript/lib/lib.es2016.full.d.js",
|
|
135
|
+
"types": "./node_modules/typescript/lib/lib.es2016.full.d.d.ts"
|
|
136
|
+
},
|
|
137
|
+
"./node_modules/typescript/lib/lib.es2016.intl.d.ts": {
|
|
138
|
+
"import": "./node_modules/typescript/lib/lib.es2016.intl.d.js",
|
|
139
|
+
"types": "./node_modules/typescript/lib/lib.es2016.intl.d.d.ts"
|
|
140
|
+
},
|
|
141
|
+
"./node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts": {
|
|
142
|
+
"import": "./node_modules/typescript/lib/lib.es2017.arraybuffer.d.js",
|
|
143
|
+
"types": "./node_modules/typescript/lib/lib.es2017.arraybuffer.d.d.ts"
|
|
144
|
+
},
|
|
145
|
+
"./node_modules/typescript/lib/lib.es2017.d.ts": {
|
|
146
|
+
"import": "./node_modules/typescript/lib/lib.es2017.d.js",
|
|
147
|
+
"types": "./node_modules/typescript/lib/lib.es2017.d.d.ts"
|
|
148
|
+
},
|
|
149
|
+
"./node_modules/typescript/lib/lib.es2017.date.d.ts": {
|
|
150
|
+
"import": "./node_modules/typescript/lib/lib.es2017.date.d.js",
|
|
151
|
+
"types": "./node_modules/typescript/lib/lib.es2017.date.d.d.ts"
|
|
152
|
+
},
|
|
153
|
+
"./node_modules/typescript/lib/lib.es2017.full.d.ts": {
|
|
154
|
+
"import": "./node_modules/typescript/lib/lib.es2017.full.d.js",
|
|
155
|
+
"types": "./node_modules/typescript/lib/lib.es2017.full.d.d.ts"
|
|
156
|
+
},
|
|
157
|
+
"./node_modules/typescript/lib/lib.es2017.intl.d.ts": {
|
|
158
|
+
"import": "./node_modules/typescript/lib/lib.es2017.intl.d.js",
|
|
159
|
+
"types": "./node_modules/typescript/lib/lib.es2017.intl.d.d.ts"
|
|
160
|
+
},
|
|
161
|
+
"./node_modules/typescript/lib/lib.es2017.object.d.ts": {
|
|
162
|
+
"import": "./node_modules/typescript/lib/lib.es2017.object.d.js",
|
|
163
|
+
"types": "./node_modules/typescript/lib/lib.es2017.object.d.d.ts"
|
|
164
|
+
},
|
|
165
|
+
"./node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts": {
|
|
166
|
+
"import": "./node_modules/typescript/lib/lib.es2017.sharedmemory.d.js",
|
|
167
|
+
"types": "./node_modules/typescript/lib/lib.es2017.sharedmemory.d.d.ts"
|
|
168
|
+
},
|
|
169
|
+
"./node_modules/typescript/lib/lib.es2017.string.d.ts": {
|
|
170
|
+
"import": "./node_modules/typescript/lib/lib.es2017.string.d.js",
|
|
171
|
+
"types": "./node_modules/typescript/lib/lib.es2017.string.d.d.ts"
|
|
172
|
+
},
|
|
173
|
+
"./node_modules/typescript/lib/lib.es2017.typedarrays.d.ts": {
|
|
174
|
+
"import": "./node_modules/typescript/lib/lib.es2017.typedarrays.d.js",
|
|
175
|
+
"types": "./node_modules/typescript/lib/lib.es2017.typedarrays.d.d.ts"
|
|
176
|
+
},
|
|
177
|
+
"./node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts": {
|
|
178
|
+
"import": "./node_modules/typescript/lib/lib.es2018.asyncgenerator.d.js",
|
|
179
|
+
"types": "./node_modules/typescript/lib/lib.es2018.asyncgenerator.d.d.ts"
|
|
180
|
+
},
|
|
181
|
+
"./node_modules/typescript/lib/lib.es2018.asynciterable.d.ts": {
|
|
182
|
+
"import": "./node_modules/typescript/lib/lib.es2018.asynciterable.d.js",
|
|
183
|
+
"types": "./node_modules/typescript/lib/lib.es2018.asynciterable.d.d.ts"
|
|
184
|
+
},
|
|
185
|
+
"./node_modules/typescript/lib/lib.es2018.d.ts": {
|
|
186
|
+
"import": "./node_modules/typescript/lib/lib.es2018.d.js",
|
|
187
|
+
"types": "./node_modules/typescript/lib/lib.es2018.d.d.ts"
|
|
188
|
+
},
|
|
189
|
+
"./node_modules/typescript/lib/lib.es2018.full.d.ts": {
|
|
190
|
+
"import": "./node_modules/typescript/lib/lib.es2018.full.d.js",
|
|
191
|
+
"types": "./node_modules/typescript/lib/lib.es2018.full.d.d.ts"
|
|
192
|
+
},
|
|
193
|
+
"./node_modules/typescript/lib/lib.es2018.intl.d.ts": {
|
|
194
|
+
"import": "./node_modules/typescript/lib/lib.es2018.intl.d.js",
|
|
195
|
+
"types": "./node_modules/typescript/lib/lib.es2018.intl.d.d.ts"
|
|
196
|
+
},
|
|
197
|
+
"./node_modules/typescript/lib/lib.es2018.promise.d.ts": {
|
|
198
|
+
"import": "./node_modules/typescript/lib/lib.es2018.promise.d.js",
|
|
199
|
+
"types": "./node_modules/typescript/lib/lib.es2018.promise.d.d.ts"
|
|
200
|
+
},
|
|
201
|
+
"./node_modules/typescript/lib/lib.es2018.regexp.d.ts": {
|
|
202
|
+
"import": "./node_modules/typescript/lib/lib.es2018.regexp.d.js",
|
|
203
|
+
"types": "./node_modules/typescript/lib/lib.es2018.regexp.d.d.ts"
|
|
204
|
+
},
|
|
205
|
+
"./node_modules/typescript/lib/lib.es2019.array.d.ts": {
|
|
206
|
+
"import": "./node_modules/typescript/lib/lib.es2019.array.d.js",
|
|
207
|
+
"types": "./node_modules/typescript/lib/lib.es2019.array.d.d.ts"
|
|
208
|
+
},
|
|
209
|
+
"./node_modules/typescript/lib/lib.es2019.d.ts": {
|
|
210
|
+
"import": "./node_modules/typescript/lib/lib.es2019.d.js",
|
|
211
|
+
"types": "./node_modules/typescript/lib/lib.es2019.d.d.ts"
|
|
212
|
+
},
|
|
213
|
+
"./node_modules/typescript/lib/lib.es2019.full.d.ts": {
|
|
214
|
+
"import": "./node_modules/typescript/lib/lib.es2019.full.d.js",
|
|
215
|
+
"types": "./node_modules/typescript/lib/lib.es2019.full.d.d.ts"
|
|
216
|
+
},
|
|
217
|
+
"./node_modules/typescript/lib/lib.es2019.intl.d.ts": {
|
|
218
|
+
"import": "./node_modules/typescript/lib/lib.es2019.intl.d.js",
|
|
219
|
+
"types": "./node_modules/typescript/lib/lib.es2019.intl.d.d.ts"
|
|
220
|
+
},
|
|
221
|
+
"./node_modules/typescript/lib/lib.es2019.object.d.ts": {
|
|
222
|
+
"import": "./node_modules/typescript/lib/lib.es2019.object.d.js",
|
|
223
|
+
"types": "./node_modules/typescript/lib/lib.es2019.object.d.d.ts"
|
|
224
|
+
},
|
|
225
|
+
"./node_modules/typescript/lib/lib.es2019.string.d.ts": {
|
|
226
|
+
"import": "./node_modules/typescript/lib/lib.es2019.string.d.js",
|
|
227
|
+
"types": "./node_modules/typescript/lib/lib.es2019.string.d.d.ts"
|
|
228
|
+
},
|
|
229
|
+
"./node_modules/typescript/lib/lib.es2019.symbol.d.ts": {
|
|
230
|
+
"import": "./node_modules/typescript/lib/lib.es2019.symbol.d.js",
|
|
231
|
+
"types": "./node_modules/typescript/lib/lib.es2019.symbol.d.d.ts"
|
|
232
|
+
},
|
|
233
|
+
"./node_modules/typescript/lib/lib.es2020.bigint.d.ts": {
|
|
234
|
+
"import": "./node_modules/typescript/lib/lib.es2020.bigint.d.js",
|
|
235
|
+
"types": "./node_modules/typescript/lib/lib.es2020.bigint.d.d.ts"
|
|
236
|
+
},
|
|
237
|
+
"./node_modules/typescript/lib/lib.es2020.d.ts": {
|
|
238
|
+
"import": "./node_modules/typescript/lib/lib.es2020.d.js",
|
|
239
|
+
"types": "./node_modules/typescript/lib/lib.es2020.d.d.ts"
|
|
240
|
+
},
|
|
241
|
+
"./node_modules/typescript/lib/lib.es2020.date.d.ts": {
|
|
242
|
+
"import": "./node_modules/typescript/lib/lib.es2020.date.d.js",
|
|
243
|
+
"types": "./node_modules/typescript/lib/lib.es2020.date.d.d.ts"
|
|
244
|
+
},
|
|
245
|
+
"./node_modules/typescript/lib/lib.es2020.full.d.ts": {
|
|
246
|
+
"import": "./node_modules/typescript/lib/lib.es2020.full.d.js",
|
|
247
|
+
"types": "./node_modules/typescript/lib/lib.es2020.full.d.d.ts"
|
|
248
|
+
},
|
|
249
|
+
"./node_modules/typescript/lib/lib.es2020.intl.d.ts": {
|
|
250
|
+
"import": "./node_modules/typescript/lib/lib.es2020.intl.d.js",
|
|
251
|
+
"types": "./node_modules/typescript/lib/lib.es2020.intl.d.d.ts"
|
|
252
|
+
},
|
|
253
|
+
"./node_modules/typescript/lib/lib.es2020.number.d.ts": {
|
|
254
|
+
"import": "./node_modules/typescript/lib/lib.es2020.number.d.js",
|
|
255
|
+
"types": "./node_modules/typescript/lib/lib.es2020.number.d.d.ts"
|
|
256
|
+
},
|
|
257
|
+
"./node_modules/typescript/lib/lib.es2020.promise.d.ts": {
|
|
258
|
+
"import": "./node_modules/typescript/lib/lib.es2020.promise.d.js",
|
|
259
|
+
"types": "./node_modules/typescript/lib/lib.es2020.promise.d.d.ts"
|
|
260
|
+
},
|
|
261
|
+
"./node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts": {
|
|
262
|
+
"import": "./node_modules/typescript/lib/lib.es2020.sharedmemory.d.js",
|
|
263
|
+
"types": "./node_modules/typescript/lib/lib.es2020.sharedmemory.d.d.ts"
|
|
264
|
+
},
|
|
265
|
+
"./node_modules/typescript/lib/lib.es2020.string.d.ts": {
|
|
266
|
+
"import": "./node_modules/typescript/lib/lib.es2020.string.d.js",
|
|
267
|
+
"types": "./node_modules/typescript/lib/lib.es2020.string.d.d.ts"
|
|
268
|
+
},
|
|
269
|
+
"./node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts": {
|
|
270
|
+
"import": "./node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.js",
|
|
271
|
+
"types": "./node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.d.ts"
|
|
272
|
+
},
|
|
273
|
+
"./node_modules/typescript/lib/lib.es2021.d.ts": {
|
|
274
|
+
"import": "./node_modules/typescript/lib/lib.es2021.d.js",
|
|
275
|
+
"types": "./node_modules/typescript/lib/lib.es2021.d.d.ts"
|
|
276
|
+
},
|
|
277
|
+
"./node_modules/typescript/lib/lib.es2021.full.d.ts": {
|
|
278
|
+
"import": "./node_modules/typescript/lib/lib.es2021.full.d.js",
|
|
279
|
+
"types": "./node_modules/typescript/lib/lib.es2021.full.d.d.ts"
|
|
280
|
+
},
|
|
281
|
+
"./node_modules/typescript/lib/lib.es2021.intl.d.ts": {
|
|
282
|
+
"import": "./node_modules/typescript/lib/lib.es2021.intl.d.js",
|
|
283
|
+
"types": "./node_modules/typescript/lib/lib.es2021.intl.d.d.ts"
|
|
284
|
+
},
|
|
285
|
+
"./node_modules/typescript/lib/lib.es2021.promise.d.ts": {
|
|
286
|
+
"import": "./node_modules/typescript/lib/lib.es2021.promise.d.js",
|
|
287
|
+
"types": "./node_modules/typescript/lib/lib.es2021.promise.d.d.ts"
|
|
288
|
+
},
|
|
289
|
+
"./node_modules/typescript/lib/lib.es2021.string.d.ts": {
|
|
290
|
+
"import": "./node_modules/typescript/lib/lib.es2021.string.d.js",
|
|
291
|
+
"types": "./node_modules/typescript/lib/lib.es2021.string.d.d.ts"
|
|
292
|
+
},
|
|
293
|
+
"./node_modules/typescript/lib/lib.es2021.weakref.d.ts": {
|
|
294
|
+
"import": "./node_modules/typescript/lib/lib.es2021.weakref.d.js",
|
|
295
|
+
"types": "./node_modules/typescript/lib/lib.es2021.weakref.d.d.ts"
|
|
296
|
+
},
|
|
297
|
+
"./node_modules/typescript/lib/lib.es2022.array.d.ts": {
|
|
298
|
+
"import": "./node_modules/typescript/lib/lib.es2022.array.d.js",
|
|
299
|
+
"types": "./node_modules/typescript/lib/lib.es2022.array.d.d.ts"
|
|
300
|
+
},
|
|
301
|
+
"./node_modules/typescript/lib/lib.es2022.d.ts": {
|
|
302
|
+
"import": "./node_modules/typescript/lib/lib.es2022.d.js",
|
|
303
|
+
"types": "./node_modules/typescript/lib/lib.es2022.d.d.ts"
|
|
304
|
+
},
|
|
305
|
+
"./node_modules/typescript/lib/lib.es2022.error.d.ts": {
|
|
306
|
+
"import": "./node_modules/typescript/lib/lib.es2022.error.d.js",
|
|
307
|
+
"types": "./node_modules/typescript/lib/lib.es2022.error.d.d.ts"
|
|
308
|
+
},
|
|
309
|
+
"./node_modules/typescript/lib/lib.es2022.full.d.ts": {
|
|
310
|
+
"import": "./node_modules/typescript/lib/lib.es2022.full.d.js",
|
|
311
|
+
"types": "./node_modules/typescript/lib/lib.es2022.full.d.d.ts"
|
|
312
|
+
},
|
|
313
|
+
"./node_modules/typescript/lib/lib.es2022.intl.d.ts": {
|
|
314
|
+
"import": "./node_modules/typescript/lib/lib.es2022.intl.d.js",
|
|
315
|
+
"types": "./node_modules/typescript/lib/lib.es2022.intl.d.d.ts"
|
|
316
|
+
},
|
|
317
|
+
"./node_modules/typescript/lib/lib.es2022.object.d.ts": {
|
|
318
|
+
"import": "./node_modules/typescript/lib/lib.es2022.object.d.js",
|
|
319
|
+
"types": "./node_modules/typescript/lib/lib.es2022.object.d.d.ts"
|
|
320
|
+
},
|
|
321
|
+
"./node_modules/typescript/lib/lib.es2022.regexp.d.ts": {
|
|
322
|
+
"import": "./node_modules/typescript/lib/lib.es2022.regexp.d.js",
|
|
323
|
+
"types": "./node_modules/typescript/lib/lib.es2022.regexp.d.d.ts"
|
|
324
|
+
},
|
|
325
|
+
"./node_modules/typescript/lib/lib.es2022.string.d.ts": {
|
|
326
|
+
"import": "./node_modules/typescript/lib/lib.es2022.string.d.js",
|
|
327
|
+
"types": "./node_modules/typescript/lib/lib.es2022.string.d.d.ts"
|
|
328
|
+
},
|
|
329
|
+
"./node_modules/typescript/lib/lib.es2023.array.d.ts": {
|
|
330
|
+
"import": "./node_modules/typescript/lib/lib.es2023.array.d.js",
|
|
331
|
+
"types": "./node_modules/typescript/lib/lib.es2023.array.d.d.ts"
|
|
332
|
+
},
|
|
333
|
+
"./node_modules/typescript/lib/lib.es2023.collection.d.ts": {
|
|
334
|
+
"import": "./node_modules/typescript/lib/lib.es2023.collection.d.js",
|
|
335
|
+
"types": "./node_modules/typescript/lib/lib.es2023.collection.d.d.ts"
|
|
336
|
+
},
|
|
337
|
+
"./node_modules/typescript/lib/lib.es2023.d.ts": {
|
|
338
|
+
"import": "./node_modules/typescript/lib/lib.es2023.d.js",
|
|
339
|
+
"types": "./node_modules/typescript/lib/lib.es2023.d.d.ts"
|
|
340
|
+
},
|
|
341
|
+
"./node_modules/typescript/lib/lib.es2023.full.d.ts": {
|
|
342
|
+
"import": "./node_modules/typescript/lib/lib.es2023.full.d.js",
|
|
343
|
+
"types": "./node_modules/typescript/lib/lib.es2023.full.d.d.ts"
|
|
344
|
+
},
|
|
345
|
+
"./node_modules/typescript/lib/lib.es2023.intl.d.ts": {
|
|
346
|
+
"import": "./node_modules/typescript/lib/lib.es2023.intl.d.js",
|
|
347
|
+
"types": "./node_modules/typescript/lib/lib.es2023.intl.d.d.ts"
|
|
348
|
+
},
|
|
349
|
+
"./node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts": {
|
|
350
|
+
"import": "./node_modules/typescript/lib/lib.es2024.arraybuffer.d.js",
|
|
351
|
+
"types": "./node_modules/typescript/lib/lib.es2024.arraybuffer.d.d.ts"
|
|
352
|
+
},
|
|
353
|
+
"./node_modules/typescript/lib/lib.es2024.collection.d.ts": {
|
|
354
|
+
"import": "./node_modules/typescript/lib/lib.es2024.collection.d.js",
|
|
355
|
+
"types": "./node_modules/typescript/lib/lib.es2024.collection.d.d.ts"
|
|
356
|
+
},
|
|
357
|
+
"./node_modules/typescript/lib/lib.es2024.d.ts": {
|
|
358
|
+
"import": "./node_modules/typescript/lib/lib.es2024.d.js",
|
|
359
|
+
"types": "./node_modules/typescript/lib/lib.es2024.d.d.ts"
|
|
360
|
+
},
|
|
361
|
+
"./node_modules/typescript/lib/lib.es2024.full.d.ts": {
|
|
362
|
+
"import": "./node_modules/typescript/lib/lib.es2024.full.d.js",
|
|
363
|
+
"types": "./node_modules/typescript/lib/lib.es2024.full.d.d.ts"
|
|
364
|
+
},
|
|
365
|
+
"./node_modules/typescript/lib/lib.es2024.object.d.ts": {
|
|
366
|
+
"import": "./node_modules/typescript/lib/lib.es2024.object.d.js",
|
|
367
|
+
"types": "./node_modules/typescript/lib/lib.es2024.object.d.d.ts"
|
|
368
|
+
},
|
|
369
|
+
"./node_modules/typescript/lib/lib.es2024.promise.d.ts": {
|
|
370
|
+
"import": "./node_modules/typescript/lib/lib.es2024.promise.d.js",
|
|
371
|
+
"types": "./node_modules/typescript/lib/lib.es2024.promise.d.d.ts"
|
|
372
|
+
},
|
|
373
|
+
"./node_modules/typescript/lib/lib.es2024.regexp.d.ts": {
|
|
374
|
+
"import": "./node_modules/typescript/lib/lib.es2024.regexp.d.js",
|
|
375
|
+
"types": "./node_modules/typescript/lib/lib.es2024.regexp.d.d.ts"
|
|
376
|
+
},
|
|
377
|
+
"./node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts": {
|
|
378
|
+
"import": "./node_modules/typescript/lib/lib.es2024.sharedmemory.d.js",
|
|
379
|
+
"types": "./node_modules/typescript/lib/lib.es2024.sharedmemory.d.d.ts"
|
|
380
|
+
},
|
|
381
|
+
"./node_modules/typescript/lib/lib.es2024.string.d.ts": {
|
|
382
|
+
"import": "./node_modules/typescript/lib/lib.es2024.string.d.js",
|
|
383
|
+
"types": "./node_modules/typescript/lib/lib.es2024.string.d.d.ts"
|
|
384
|
+
},
|
|
385
|
+
"./node_modules/typescript/lib/lib.es5.d.ts": {
|
|
386
|
+
"import": "./node_modules/typescript/lib/lib.es5.d.js",
|
|
387
|
+
"types": "./node_modules/typescript/lib/lib.es5.d.d.ts"
|
|
388
|
+
},
|
|
389
|
+
"./node_modules/typescript/lib/lib.es6.d.ts": {
|
|
390
|
+
"import": "./node_modules/typescript/lib/lib.es6.d.js",
|
|
391
|
+
"types": "./node_modules/typescript/lib/lib.es6.d.d.ts"
|
|
392
|
+
},
|
|
393
|
+
"./node_modules/typescript/lib/lib.esnext.array.d.ts": {
|
|
394
|
+
"import": "./node_modules/typescript/lib/lib.esnext.array.d.js",
|
|
395
|
+
"types": "./node_modules/typescript/lib/lib.esnext.array.d.d.ts"
|
|
396
|
+
},
|
|
397
|
+
"./node_modules/typescript/lib/lib.esnext.collection.d.ts": {
|
|
398
|
+
"import": "./node_modules/typescript/lib/lib.esnext.collection.d.js",
|
|
399
|
+
"types": "./node_modules/typescript/lib/lib.esnext.collection.d.d.ts"
|
|
400
|
+
},
|
|
401
|
+
"./node_modules/typescript/lib/lib.esnext.d.ts": {
|
|
402
|
+
"import": "./node_modules/typescript/lib/lib.esnext.d.js",
|
|
403
|
+
"types": "./node_modules/typescript/lib/lib.esnext.d.d.ts"
|
|
404
|
+
},
|
|
405
|
+
"./node_modules/typescript/lib/lib.esnext.decorators.d.ts": {
|
|
406
|
+
"import": "./node_modules/typescript/lib/lib.esnext.decorators.d.js",
|
|
407
|
+
"types": "./node_modules/typescript/lib/lib.esnext.decorators.d.d.ts"
|
|
408
|
+
},
|
|
409
|
+
"./node_modules/typescript/lib/lib.esnext.disposable.d.ts": {
|
|
410
|
+
"import": "./node_modules/typescript/lib/lib.esnext.disposable.d.js",
|
|
411
|
+
"types": "./node_modules/typescript/lib/lib.esnext.disposable.d.d.ts"
|
|
412
|
+
},
|
|
413
|
+
"./node_modules/typescript/lib/lib.esnext.error.d.ts": {
|
|
414
|
+
"import": "./node_modules/typescript/lib/lib.esnext.error.d.js",
|
|
415
|
+
"types": "./node_modules/typescript/lib/lib.esnext.error.d.d.ts"
|
|
416
|
+
},
|
|
417
|
+
"./node_modules/typescript/lib/lib.esnext.float16.d.ts": {
|
|
418
|
+
"import": "./node_modules/typescript/lib/lib.esnext.float16.d.js",
|
|
419
|
+
"types": "./node_modules/typescript/lib/lib.esnext.float16.d.d.ts"
|
|
420
|
+
},
|
|
421
|
+
"./node_modules/typescript/lib/lib.esnext.full.d.ts": {
|
|
422
|
+
"import": "./node_modules/typescript/lib/lib.esnext.full.d.js",
|
|
423
|
+
"types": "./node_modules/typescript/lib/lib.esnext.full.d.d.ts"
|
|
424
|
+
},
|
|
425
|
+
"./node_modules/typescript/lib/lib.esnext.intl.d.ts": {
|
|
426
|
+
"import": "./node_modules/typescript/lib/lib.esnext.intl.d.js",
|
|
427
|
+
"types": "./node_modules/typescript/lib/lib.esnext.intl.d.d.ts"
|
|
428
|
+
},
|
|
429
|
+
"./node_modules/typescript/lib/lib.esnext.iterator.d.ts": {
|
|
430
|
+
"import": "./node_modules/typescript/lib/lib.esnext.iterator.d.js",
|
|
431
|
+
"types": "./node_modules/typescript/lib/lib.esnext.iterator.d.d.ts"
|
|
432
|
+
},
|
|
433
|
+
"./node_modules/typescript/lib/lib.esnext.promise.d.ts": {
|
|
434
|
+
"import": "./node_modules/typescript/lib/lib.esnext.promise.d.js",
|
|
435
|
+
"types": "./node_modules/typescript/lib/lib.esnext.promise.d.d.ts"
|
|
436
|
+
},
|
|
437
|
+
"./node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts": {
|
|
438
|
+
"import": "./node_modules/typescript/lib/lib.esnext.sharedmemory.d.js",
|
|
439
|
+
"types": "./node_modules/typescript/lib/lib.esnext.sharedmemory.d.d.ts"
|
|
440
|
+
},
|
|
441
|
+
"./node_modules/typescript/lib/lib.scripthost.d.ts": {
|
|
442
|
+
"import": "./node_modules/typescript/lib/lib.scripthost.d.js",
|
|
443
|
+
"types": "./node_modules/typescript/lib/lib.scripthost.d.d.ts"
|
|
444
|
+
},
|
|
445
|
+
"./node_modules/typescript/lib/lib.webworker.asynciterable.d.ts": {
|
|
446
|
+
"import": "./node_modules/typescript/lib/lib.webworker.asynciterable.d.js",
|
|
447
|
+
"types": "./node_modules/typescript/lib/lib.webworker.asynciterable.d.d.ts"
|
|
448
|
+
},
|
|
449
|
+
"./node_modules/typescript/lib/lib.webworker.d.ts": {
|
|
450
|
+
"import": "./node_modules/typescript/lib/lib.webworker.d.js",
|
|
451
|
+
"types": "./node_modules/typescript/lib/lib.webworker.d.d.ts"
|
|
452
|
+
},
|
|
453
|
+
"./node_modules/typescript/lib/lib.webworker.importscripts.d.ts": {
|
|
454
|
+
"import": "./node_modules/typescript/lib/lib.webworker.importscripts.d.js",
|
|
455
|
+
"types": "./node_modules/typescript/lib/lib.webworker.importscripts.d.d.ts"
|
|
456
|
+
},
|
|
457
|
+
"./node_modules/typescript/lib/lib.webworker.iterable.d.ts": {
|
|
458
|
+
"import": "./node_modules/typescript/lib/lib.webworker.iterable.d.js",
|
|
459
|
+
"types": "./node_modules/typescript/lib/lib.webworker.iterable.d.d.ts"
|
|
460
|
+
},
|
|
461
|
+
"./node_modules/typescript/lib/tsserverlibrary.d.ts": {
|
|
462
|
+
"import": "./node_modules/typescript/lib/tsserverlibrary.d.js",
|
|
463
|
+
"types": "./node_modules/typescript/lib/tsserverlibrary.d.d.ts"
|
|
464
|
+
},
|
|
465
|
+
"./node_modules/typescript/lib/typescript.d.ts": {
|
|
466
|
+
"import": "./node_modules/typescript/lib/typescript.d.js",
|
|
467
|
+
"types": "./node_modules/typescript/lib/typescript.d.d.ts"
|
|
468
|
+
},
|
|
469
|
+
"./postgres/fake.ts": {
|
|
470
|
+
"import": "./postgres/fake.js",
|
|
471
|
+
"types": "./postgres/fake.d.ts"
|
|
472
|
+
},
|
|
473
|
+
"./postgres/service.ts": {
|
|
474
|
+
"import": "./postgres/service.js",
|
|
475
|
+
"types": "./postgres/service.d.ts"
|
|
476
|
+
},
|
|
477
|
+
"./service.test.ts": {
|
|
478
|
+
"import": "./service.test.js",
|
|
479
|
+
"types": "./service.test.d.ts"
|
|
480
|
+
},
|
|
481
|
+
"./service.ts": {
|
|
482
|
+
"import": "./service.js",
|
|
483
|
+
"types": "./service.d.ts"
|
|
484
|
+
},
|
|
485
|
+
"./test-migrations-with-error/001-test-migration.ts": {
|
|
486
|
+
"import": "./test-migrations-with-error/001-test-migration.js",
|
|
487
|
+
"types": "./test-migrations-with-error/001-test-migration.d.ts"
|
|
488
|
+
},
|
|
489
|
+
"./test-migrations-with-error/002-test-migration.ts": {
|
|
490
|
+
"import": "./test-migrations-with-error/002-test-migration.js",
|
|
491
|
+
"types": "./test-migrations-with-error/002-test-migration.d.ts"
|
|
492
|
+
},
|
|
493
|
+
"./test-migrations/001-test-migration.ts": {
|
|
494
|
+
"import": "./test-migrations/001-test-migration.js",
|
|
495
|
+
"types": "./test-migrations/001-test-migration.d.ts"
|
|
496
|
+
},
|
|
497
|
+
"./test-migrations/002-test-migration.ts": {
|
|
498
|
+
"import": "./test-migrations/002-test-migration.js",
|
|
499
|
+
"types": "./test-migrations/002-test-migration.d.ts"
|
|
500
|
+
},
|
|
501
|
+
"./test-migrations/003-test-migration.ts": {
|
|
502
|
+
"import": "./test-migrations/003-test-migration.js",
|
|
503
|
+
"types": "./test-migrations/003-test-migration.d.ts"
|
|
504
|
+
},
|
|
505
|
+
"./type.ts": {
|
|
506
|
+
"import": "./type.js",
|
|
507
|
+
"types": "./type.d.ts"
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
package/postgres/fake.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CamelCasePlugin } from 'kysely';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { DataType, newDb } from 'pg-mem';
|
|
4
|
+
// The registrations below fill in the few things pg-mem does not implement itself.
|
|
5
|
+
export const createInMemoryPostgresConnectionBuilder = () => {
|
|
6
|
+
const mem = newDb();
|
|
7
|
+
const catalog = mem.getSchema('pg_catalog');
|
|
8
|
+
catalog.registerOperator({
|
|
9
|
+
operator: '!~',
|
|
10
|
+
left: DataType.text,
|
|
11
|
+
right: DataType.text,
|
|
12
|
+
returns: DataType.bool,
|
|
13
|
+
// '!~' is "does not match", so the result of the match is negated.
|
|
14
|
+
implementation: (value, pattern) => !new RegExp(String(pattern)).test(String(value)),
|
|
15
|
+
});
|
|
16
|
+
catalog.registerOperator({
|
|
17
|
+
operator: '*',
|
|
18
|
+
left: DataType.integer,
|
|
19
|
+
right: DataType.interval,
|
|
20
|
+
returns: DataType.interval,
|
|
21
|
+
implementation: (factor, interval) => {
|
|
22
|
+
const totalMinutes = interval.minutes * factor;
|
|
23
|
+
return {
|
|
24
|
+
years: interval.years,
|
|
25
|
+
months: interval.months,
|
|
26
|
+
days: interval.days,
|
|
27
|
+
// The parenthesis matters: hours carried out of the multiplied minutes have to be added to
|
|
28
|
+
// the interval's own hours, not discarded when it happens to have some.
|
|
29
|
+
hours: (interval.hours ?? 0) + Math.floor(totalMinutes / 60),
|
|
30
|
+
minutes: totalMinutes % 60,
|
|
31
|
+
seconds: interval.seconds,
|
|
32
|
+
milliseconds: interval.milliseconds,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
mem.public.registerFunction({
|
|
37
|
+
name: 'gen_random_uuid',
|
|
38
|
+
implementation: () => randomUUID(),
|
|
39
|
+
});
|
|
40
|
+
return () => mem.adapters.createKysely(undefined, {
|
|
41
|
+
plugins: [new CamelCasePlugin()],
|
|
42
|
+
// pg-mem's adapter is typed against its own loose schema; this is the boundary at which the
|
|
43
|
+
// application's schema is declared.
|
|
44
|
+
});
|
|
45
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ConnectionBuilder } from '../type.ts';
|
|
2
|
+
export type ConnectionConfig = {
|
|
3
|
+
user: string;
|
|
4
|
+
database: string;
|
|
5
|
+
password?: string | undefined;
|
|
6
|
+
host?: string | undefined;
|
|
7
|
+
port?: number | undefined;
|
|
8
|
+
maxPoolSize?: number | undefined;
|
|
9
|
+
ssl?: boolean | undefined;
|
|
10
|
+
};
|
|
11
|
+
export declare const createPostgresConnectionBuilder: ({ user, database, password, host, port, maxPoolSize, ssl, }: ConnectionConfig) => ConnectionBuilder;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CamelCasePlugin, Kysely, PostgresDialect } from 'kysely';
|
|
2
|
+
import pg from 'pg';
|
|
3
|
+
// pg hands NUMERIC back as a string to avoid losing precision on values wider than a double. The
|
|
4
|
+
// applications here treat them as numbers, so this converts once at the driver rather than at
|
|
5
|
+
// every read site.
|
|
6
|
+
pg.types.setTypeParser(pg.types.builtins.NUMERIC, (value) => Number(value));
|
|
7
|
+
export const createPostgresConnectionBuilder = ({ user, database, password, host, port, maxPoolSize, ssl, }) => {
|
|
8
|
+
const dialect = new PostgresDialect({
|
|
9
|
+
pool: new pg.Pool({
|
|
10
|
+
user,
|
|
11
|
+
password,
|
|
12
|
+
ssl: ssl === true,
|
|
13
|
+
database,
|
|
14
|
+
host,
|
|
15
|
+
port,
|
|
16
|
+
max: maxPoolSize,
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
return () => new Kysely({
|
|
20
|
+
dialect,
|
|
21
|
+
plugins: [new CamelCasePlugin()],
|
|
22
|
+
});
|
|
23
|
+
};
|
package/service.d.ts
ADDED
package/service.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const createDatasource = (dbConnectionBuilder) => dbConnectionBuilder();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/service.test.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createFakeDbConnectionBuilder, createTestDatasource } from './fake.js';
|
|
2
|
+
import { createInMemoryPostgresConnectionBuilder } from './postgres/fake.js';
|
|
3
|
+
import { createDatasource } from './service.js';
|
|
4
|
+
import { expect, test } from 'vitest';
|
|
5
|
+
const TEST_TABLE = 'table-name';
|
|
6
|
+
test('createDatasource builds the datasource the connection builder hands it', () => {
|
|
7
|
+
const { connectionBuilder, queries } = createFakeDbConnectionBuilder();
|
|
8
|
+
const datasource = createDatasource(connectionBuilder);
|
|
9
|
+
datasource.selectFrom(TEST_TABLE);
|
|
10
|
+
expect(queries).toEqual([TEST_TABLE]);
|
|
11
|
+
});
|
|
12
|
+
test('a datasource over the in-memory postgres runs real SQL', async () => {
|
|
13
|
+
const datasource = createDatasource(createInMemoryPostgresConnectionBuilder());
|
|
14
|
+
await datasource.schema
|
|
15
|
+
.createTable('table1')
|
|
16
|
+
.addColumn('id', 'serial', (col) => col.primaryKey())
|
|
17
|
+
.addColumn('name', 'varchar', (col) => col.notNull())
|
|
18
|
+
.execute();
|
|
19
|
+
await datasource.insertInto('table1').values({ name: 'written' }).execute();
|
|
20
|
+
expect(await datasource.selectFrom('table1').selectAll().execute()).toEqual([
|
|
21
|
+
{ id: 1, name: 'written' },
|
|
22
|
+
]);
|
|
23
|
+
});
|
|
24
|
+
test('a datasource rejects a query against a table that does not exist', async () => {
|
|
25
|
+
const datasource = createTestDatasource();
|
|
26
|
+
await expect(datasource.selectFrom('table1').selectAll().execute()).rejects.toThrow();
|
|
27
|
+
});
|
|
28
|
+
test('each in-memory datasource is isolated from the others', async () => {
|
|
29
|
+
const first = createTestDatasource();
|
|
30
|
+
await first.schema
|
|
31
|
+
.createTable('table1')
|
|
32
|
+
.addColumn('id', 'serial', (col) => col.primaryKey())
|
|
33
|
+
.addColumn('name', 'varchar', (col) => col.notNull())
|
|
34
|
+
.execute();
|
|
35
|
+
const second = createTestDatasource();
|
|
36
|
+
await expect(second.selectFrom('table1').selectAll().execute()).rejects.toThrow();
|
|
37
|
+
});
|