@pdg/drizzle-mssql 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +410 -2
- package/dist/@types/MsSqlConditions.d.cts +20 -0
- package/dist/@types/MsSqlConditions.d.ts +20 -0
- package/dist/@types/MsSqlInsertValues.d.cts +21 -0
- package/dist/@types/MsSqlInsertValues.d.ts +21 -0
- package/dist/@types/MsSqlUpdateValues.d.cts +34 -0
- package/dist/@types/MsSqlUpdateValues.d.ts +34 -0
- package/dist/@types/common.d.cts +16 -0
- package/dist/@types/common.d.ts +16 -0
- package/dist/@types/index.d.cts +4 -0
- package/dist/@types/index.d.ts +4 -0
- package/dist/MsSqlQuery.d.cts +259 -0
- package/dist/MsSqlQuery.d.ts +259 -0
- package/dist/alias.d.cts +6 -0
- package/dist/alias.d.ts +6 -0
- package/dist/columns.d.cts +90 -0
- package/dist/columns.d.ts +90 -0
- package/dist/conditions.d.cts +106 -0
- package/dist/conditions.d.ts +106 -0
- package/dist/drizzleMsSql.d.cts +166 -0
- package/dist/drizzleMsSql.d.ts +166 -0
- package/dist/index.cjs +700 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.esm.js +700 -0
- package/dist/mssqlTable.d.cts +71 -0
- package/dist/mssqlTable.d.ts +71 -0
- package/package.json +88 -4
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,700 @@
|
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nodeMssql=require('drizzle-orm/node-mssql'),native=require('drizzle-orm'),node_async_hooks=require('node:async_hooks'),alias=require('drizzle-orm/mssql-core/alias'),mssqlCore=require('drizzle-orm/mssql-core'),columnBuilder=require('drizzle-orm/column-builder');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var native__namespace=/*#__PURE__*/_interopNamespaceDefault(native);function createAlias(schema) {
|
|
2
|
+
/********************************************************************************************************************
|
|
3
|
+
* getDefaultAlias
|
|
4
|
+
* ******************************************************************************************************************/
|
|
5
|
+
const getDefaultAlias = (tableName) => { var _a; return `${tableName[0]}${((_a = tableName.slice(1).match(/[A-Z]/g)) !== null && _a !== void 0 ? _a : []).join('')}`.toLowerCase(); };
|
|
6
|
+
/********************************************************************************************************************
|
|
7
|
+
* createAlias
|
|
8
|
+
* ******************************************************************************************************************/
|
|
9
|
+
const createAlias = (tableName) => (alias$1 = getDefaultAlias(tableName)) => alias.alias(schema[tableName], alias$1);
|
|
10
|
+
/********************************************************************************************************************
|
|
11
|
+
* alias
|
|
12
|
+
* ******************************************************************************************************************/
|
|
13
|
+
const alias$1 = Object.fromEntries(Object.keys(schema).map((tableName) => [tableName, createAlias(tableName)]));
|
|
14
|
+
return alias$1;
|
|
15
|
+
}function createConditions(schema) {
|
|
16
|
+
const resolveTable = (table) => {
|
|
17
|
+
if (typeof table !== 'string')
|
|
18
|
+
return table;
|
|
19
|
+
if (!Object.hasOwn(schema, table)) {
|
|
20
|
+
throw new Error(`Condition: unknown table "${table}".`);
|
|
21
|
+
}
|
|
22
|
+
return schema[table];
|
|
23
|
+
};
|
|
24
|
+
const getColumn = (table, name) => {
|
|
25
|
+
const columns = native__namespace.getTableColumns(table);
|
|
26
|
+
if (!Object.hasOwn(columns, name)) {
|
|
27
|
+
throw new Error(`Condition: unknown column "${name}".`);
|
|
28
|
+
}
|
|
29
|
+
return columns[name];
|
|
30
|
+
};
|
|
31
|
+
const recordEntries = (values) => {
|
|
32
|
+
if (typeof values !== 'object' || values === null || Array.isArray(values)) {
|
|
33
|
+
throw new Error('Condition: expected a column/value object.');
|
|
34
|
+
}
|
|
35
|
+
return Object.entries(values);
|
|
36
|
+
};
|
|
37
|
+
const compareValue = (column, value, operator) => {
|
|
38
|
+
if (value === null) {
|
|
39
|
+
if (operator === 'eq')
|
|
40
|
+
return native__namespace.isNull(column);
|
|
41
|
+
if (operator === 'ne')
|
|
42
|
+
return native__namespace.isNotNull(column);
|
|
43
|
+
throw new Error(`${operator}: column "${column.name}" must not be null.`);
|
|
44
|
+
}
|
|
45
|
+
switch (operator) {
|
|
46
|
+
case 'eq':
|
|
47
|
+
return native__namespace.eq(column, value);
|
|
48
|
+
case 'ne':
|
|
49
|
+
return native__namespace.ne(column, value);
|
|
50
|
+
case 'gt':
|
|
51
|
+
return native__namespace.gt(column, value);
|
|
52
|
+
case 'gte':
|
|
53
|
+
return native__namespace.gte(column, value);
|
|
54
|
+
case 'lt':
|
|
55
|
+
return native__namespace.lt(column, value);
|
|
56
|
+
case 'lte':
|
|
57
|
+
return native__namespace.lte(column, value);
|
|
58
|
+
case 'inArray':
|
|
59
|
+
case 'notInArray':
|
|
60
|
+
if (!Array.isArray(value))
|
|
61
|
+
throw new Error(`${operator}: expected an array.`);
|
|
62
|
+
return operator === 'inArray' ? native__namespace.inArray(column, value) : native__namespace.notInArray(column, value);
|
|
63
|
+
case 'between':
|
|
64
|
+
case 'notBetween':
|
|
65
|
+
if (!Array.isArray(value) || value.length !== 2 || value.some((item) => item == null)) {
|
|
66
|
+
throw new Error(`${operator}: expected two non-null bounds.`);
|
|
67
|
+
}
|
|
68
|
+
return operator === 'between'
|
|
69
|
+
? native__namespace.between(column, value[0], value[1])
|
|
70
|
+
: native__namespace.notBetween(column, value[0], value[1]);
|
|
71
|
+
default:
|
|
72
|
+
if (typeof value !== 'string')
|
|
73
|
+
throw new Error(`${operator}: expected a string pattern.`);
|
|
74
|
+
return native__namespace[operator](column, value);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const valueConditions = (table, values, operator) => {
|
|
78
|
+
const conditions = [];
|
|
79
|
+
for (const [name, value] of recordEntries(values)) {
|
|
80
|
+
const column = getColumn(table, name);
|
|
81
|
+
if (value !== undefined)
|
|
82
|
+
conditions.push(compareValue(column, value, operator));
|
|
83
|
+
}
|
|
84
|
+
return conditions;
|
|
85
|
+
};
|
|
86
|
+
function extendOperator(original, objectOperator) {
|
|
87
|
+
return (...args) => {
|
|
88
|
+
if (typeof args[0] === 'string' || native__namespace.is(args[0], mssqlCore.MsSqlTable)) {
|
|
89
|
+
const table = typeof args[0] === 'string' ? resolveTable(args[0]) : args[0];
|
|
90
|
+
return objectOperator(table, args[1]);
|
|
91
|
+
}
|
|
92
|
+
return Reflect.apply(original, undefined, args);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const objectOperator = (operator) => (table, values) => native__namespace.and(...valueConditions(resolveTable(table), values, operator));
|
|
96
|
+
// Tables use object dispatch at runtime, not the native SQLWrapper/unknown overload.
|
|
97
|
+
const binaryOperator = (operator) => extendOperator(native__namespace[operator], objectOperator(operator));
|
|
98
|
+
const nullOperator = (operator) => ((table, input) => {
|
|
99
|
+
const names = typeof input === 'string' ? [input] : input === undefined ? [] : input;
|
|
100
|
+
if (!Array.isArray(names))
|
|
101
|
+
throw new Error(`${operator}: expected column names.`);
|
|
102
|
+
const conditions = [];
|
|
103
|
+
for (const name of names) {
|
|
104
|
+
if (name === undefined)
|
|
105
|
+
continue;
|
|
106
|
+
if (typeof name !== 'string')
|
|
107
|
+
throw new Error(`${operator}: expected a column name.`);
|
|
108
|
+
conditions.push(native__namespace[operator](getColumn(resolveTable(table), name)));
|
|
109
|
+
}
|
|
110
|
+
return native__namespace.and(...conditions);
|
|
111
|
+
});
|
|
112
|
+
const groupOperator = (operator) => (input, options) => {
|
|
113
|
+
const table = resolveTable(input);
|
|
114
|
+
const sqlConditions = [];
|
|
115
|
+
for (const [name, values] of recordEntries(options)) {
|
|
116
|
+
if (!Object.hasOwn(conditions, name) || name === 'and' || name === 'or') {
|
|
117
|
+
throw new Error(`Condition: unknown operator "${name}".`);
|
|
118
|
+
}
|
|
119
|
+
if (values === undefined)
|
|
120
|
+
continue;
|
|
121
|
+
if (name === 'isNull' || name === 'isNotNull') {
|
|
122
|
+
const condition = nullOperator(name)(table, values);
|
|
123
|
+
if (condition !== undefined)
|
|
124
|
+
sqlConditions.push(condition);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
const group = native__namespace.and(...valueConditions(table, values, name));
|
|
128
|
+
if (group !== undefined)
|
|
129
|
+
sqlConditions.push(group);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return native__namespace[operator](...sqlConditions);
|
|
133
|
+
};
|
|
134
|
+
const logicalOperator = (operator) => extendOperator((...conditions) => native__namespace[operator](...conditions.filter((condition) => condition !== false && condition !== undefined)), groupOperator(operator));
|
|
135
|
+
const conditions = {
|
|
136
|
+
eq: binaryOperator('eq'),
|
|
137
|
+
ne: binaryOperator('ne'),
|
|
138
|
+
gt: binaryOperator('gt'),
|
|
139
|
+
gte: binaryOperator('gte'),
|
|
140
|
+
lt: binaryOperator('lt'),
|
|
141
|
+
lte: binaryOperator('lte'),
|
|
142
|
+
inArray: extendOperator(native__namespace.inArray, objectOperator('inArray')),
|
|
143
|
+
notInArray: extendOperator(native__namespace.notInArray, objectOperator('notInArray')),
|
|
144
|
+
between: extendOperator(native__namespace.between, objectOperator('between')),
|
|
145
|
+
notBetween: extendOperator(native__namespace.notBetween, objectOperator('notBetween')),
|
|
146
|
+
like: extendOperator(native__namespace.like, objectOperator('like')),
|
|
147
|
+
notLike: extendOperator(native__namespace.notLike, objectOperator('notLike')),
|
|
148
|
+
ilike: extendOperator(native__namespace.ilike, objectOperator('ilike')),
|
|
149
|
+
notIlike: extendOperator(native__namespace.notIlike, objectOperator('notIlike')),
|
|
150
|
+
isNull: extendOperator(native__namespace.isNull, nullOperator('isNull')),
|
|
151
|
+
isNotNull: extendOperator(native__namespace.isNotNull, nullOperator('isNotNull')),
|
|
152
|
+
and: logicalOperator('and'),
|
|
153
|
+
or: logicalOperator('or'),
|
|
154
|
+
};
|
|
155
|
+
return conditions;
|
|
156
|
+
}function TableColumns(first, ...rest) {
|
|
157
|
+
var _a, _b;
|
|
158
|
+
if (Array.isArray(first) && native.isTable(first[0])) {
|
|
159
|
+
const result = {};
|
|
160
|
+
for (const group of [first, ...rest]) {
|
|
161
|
+
if (!Array.isArray(group) || !native.isTable(group[0])) {
|
|
162
|
+
throw new Error('columns: expected a table/column-name tuple.');
|
|
163
|
+
}
|
|
164
|
+
Object.assign(result, TableColumns(group[0], ...group.slice(1)));
|
|
165
|
+
}
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
if (native.isTable(first)) {
|
|
169
|
+
const tableColumns = native.getTableColumns(first);
|
|
170
|
+
if (rest.length === 0)
|
|
171
|
+
return Object.fromEntries(Object.values(tableColumns).map((column) => [column.name, column]));
|
|
172
|
+
const selected = {};
|
|
173
|
+
for (const selection of rest) {
|
|
174
|
+
if (typeof selection !== 'string') {
|
|
175
|
+
throw new Error('columns: expected a column name.');
|
|
176
|
+
}
|
|
177
|
+
const match = /^(.+?)\s+as\s+(.+)$/i.exec(selection.trim());
|
|
178
|
+
const name = ((_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : selection).trim();
|
|
179
|
+
const alias = (_b = match === null || match === void 0 ? void 0 : match[2]) === null || _b === void 0 ? void 0 : _b.trim();
|
|
180
|
+
if (!Object.hasOwn(tableColumns, name)) {
|
|
181
|
+
throw new Error(`columns: unknown column "${name}".`);
|
|
182
|
+
}
|
|
183
|
+
if (alias)
|
|
184
|
+
selected[alias] = native.sql `${tableColumns[name]}`.as(alias);
|
|
185
|
+
else
|
|
186
|
+
selected[tableColumns[name].name] = tableColumns[name];
|
|
187
|
+
}
|
|
188
|
+
return selected;
|
|
189
|
+
}
|
|
190
|
+
const columns = (Array.isArray(first) ? first : [first, ...rest]);
|
|
191
|
+
return Object.fromEntries(columns.map((column) => {
|
|
192
|
+
if (typeof column === 'string' || Array.isArray(column))
|
|
193
|
+
throw new Error('columns: expected a column object.');
|
|
194
|
+
return [column.name, column];
|
|
195
|
+
}));
|
|
196
|
+
}const policies = new WeakMap();
|
|
197
|
+
for (const [method, policy] of Object.entries({
|
|
198
|
+
insertBlocked: { insert: 'blocked' },
|
|
199
|
+
insertAllowed: { insert: 'allowed' },
|
|
200
|
+
updateBlocked: { update: 'blocked' },
|
|
201
|
+
updateAllowed: { update: 'allowed' },
|
|
202
|
+
updateRequired: { update: 'required' },
|
|
203
|
+
createdAt: { timestamp: 'created' },
|
|
204
|
+
updatedAt: { timestamp: 'updated' },
|
|
205
|
+
})) {
|
|
206
|
+
Object.defineProperty(columnBuilder.ColumnBuilder.prototype, method, {
|
|
207
|
+
configurable: true,
|
|
208
|
+
value: function () {
|
|
209
|
+
policies.set(this, Object.assign(Object.assign({}, policies.get(this)), policy));
|
|
210
|
+
return this;
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
const tableMutationPolicies = new WeakMap();
|
|
215
|
+
const tablePolicies = new WeakMap();
|
|
216
|
+
function getColumnPolicies(table) {
|
|
217
|
+
var _a;
|
|
218
|
+
return (_a = tablePolicies.get(table)) !== null && _a !== void 0 ? _a : {};
|
|
219
|
+
}
|
|
220
|
+
function getTablePolicy(table) {
|
|
221
|
+
var _a;
|
|
222
|
+
return (_a = tableMutationPolicies.get(table)) !== null && _a !== void 0 ? _a : {};
|
|
223
|
+
}
|
|
224
|
+
function mssqlTable(name, columns, extraConfigOrPolicy, policy) {
|
|
225
|
+
const extraConfig = typeof extraConfigOrPolicy === 'function' ? extraConfigOrPolicy : undefined;
|
|
226
|
+
const mutationPolicy = typeof extraConfigOrPolicy === 'object' ? extraConfigOrPolicy : policy;
|
|
227
|
+
let builders = {};
|
|
228
|
+
const table = typeof columns === 'function'
|
|
229
|
+
? mssqlCore.mssqlTable(name, (types) => (builders = columns(types)), extraConfig)
|
|
230
|
+
: mssqlCore.mssqlTable(name, (builders = columns), extraConfig);
|
|
231
|
+
tablePolicies.set(table, Object.fromEntries(Object.entries(builders).map(([key, builder]) => { var _a; return [key, (_a = policies.get(builder)) !== null && _a !== void 0 ? _a : {}]; })));
|
|
232
|
+
tableMutationPolicies.set(table, Object.assign({}, mutationPolicy));
|
|
233
|
+
return table;
|
|
234
|
+
}/********************************************************************************************************************
|
|
235
|
+
* MsSqlQuery
|
|
236
|
+
* ******************************************************************************************************************/
|
|
237
|
+
class MsSqlQuery {
|
|
238
|
+
/********************************************************************************************************************
|
|
239
|
+
* constructor
|
|
240
|
+
* ******************************************************************************************************************/
|
|
241
|
+
constructor(table, current, getTimestamp) {
|
|
242
|
+
this.current = current;
|
|
243
|
+
this.getTimestamp = getTimestamp;
|
|
244
|
+
this.drizzle = Object.assign(Object.assign({}, createConditions({})), { sqlNumber: (value) => native.sql `${value}`.mapWith(Number) });
|
|
245
|
+
this.t = table;
|
|
246
|
+
}
|
|
247
|
+
/********************************************************************************************************************
|
|
248
|
+
* (PROTECTED) getTx
|
|
249
|
+
* ******************************************************************************************************************/
|
|
250
|
+
getTx() {
|
|
251
|
+
return this.current();
|
|
252
|
+
}
|
|
253
|
+
columns(...names) {
|
|
254
|
+
const table = this.t;
|
|
255
|
+
return TableColumns(table, ...names);
|
|
256
|
+
}
|
|
257
|
+
resolveFields(fields, table = this.t) {
|
|
258
|
+
if (Array.isArray(fields) && fields.length > 0 && fields.every((field) => typeof field === 'string')) {
|
|
259
|
+
return TableColumns(table, ...fields);
|
|
260
|
+
}
|
|
261
|
+
if (typeof fields !== 'function')
|
|
262
|
+
return normalizeFields(fields);
|
|
263
|
+
const query = {
|
|
264
|
+
t: table,
|
|
265
|
+
columns: (...names) => TableColumns(table, ...names),
|
|
266
|
+
};
|
|
267
|
+
return normalizeFields(fields(query));
|
|
268
|
+
}
|
|
269
|
+
select(fieldsOrAlias, fields) {
|
|
270
|
+
const tx = this.getTx();
|
|
271
|
+
const isAlias = native.isTable(fieldsOrAlias);
|
|
272
|
+
const table = isAlias ? fieldsOrAlias : this.t;
|
|
273
|
+
const selectedFields = this.resolveFields(isAlias ? fields : fieldsOrAlias, table);
|
|
274
|
+
return tx.select(selectedFields !== null && selectedFields !== void 0 ? selectedFields : TableColumns(table)).from(table);
|
|
275
|
+
}
|
|
276
|
+
async find(aliasOrFieldsOrWhere, fieldsOrWhere, where) {
|
|
277
|
+
const hasAlias = native.isTable(aliasOrFieldsOrWhere);
|
|
278
|
+
const fieldsOrCondition = hasAlias ? fieldsOrWhere : aliasOrFieldsOrWhere;
|
|
279
|
+
const hasFields = arguments.length === (hasAlias ? 3 : 2);
|
|
280
|
+
const isCondition = (value) => native.is(value, native.SQL) || typeof value === 'function';
|
|
281
|
+
const table = hasAlias ? aliasOrFieldsOrWhere : this.t;
|
|
282
|
+
const selectedFields = this.resolveFields(!hasFields && isCondition(fieldsOrCondition) ? undefined : fieldsOrCondition, table);
|
|
283
|
+
const conditionInput = !hasFields && isCondition(fieldsOrCondition)
|
|
284
|
+
? fieldsOrCondition
|
|
285
|
+
: hasAlias
|
|
286
|
+
? where
|
|
287
|
+
: isCondition(fieldsOrWhere)
|
|
288
|
+
? fieldsOrWhere
|
|
289
|
+
: undefined;
|
|
290
|
+
const condition = typeof conditionInput === 'function' ? conditionInput(this) : conditionInput;
|
|
291
|
+
if (condition !== undefined && !native.is(condition, native.SQL)) {
|
|
292
|
+
throw new Error('find: the where callback must return SQL or undefined.');
|
|
293
|
+
}
|
|
294
|
+
const builder = (() => {
|
|
295
|
+
if (hasAlias) {
|
|
296
|
+
const alias = aliasOrFieldsOrWhere;
|
|
297
|
+
if (selectedFields === undefined) {
|
|
298
|
+
return this.select(alias);
|
|
299
|
+
}
|
|
300
|
+
return this.select(alias, selectedFields);
|
|
301
|
+
}
|
|
302
|
+
return selectedFields === undefined
|
|
303
|
+
? this.select()
|
|
304
|
+
: this.select(selectedFields);
|
|
305
|
+
})();
|
|
306
|
+
const [result] = await builder
|
|
307
|
+
.where(condition)
|
|
308
|
+
.orderBy(native.sql `(select 0)`)
|
|
309
|
+
.offset(0)
|
|
310
|
+
.fetch(1);
|
|
311
|
+
return result;
|
|
312
|
+
}
|
|
313
|
+
async findByPrimaryKey(fieldsOrKey, key) {
|
|
314
|
+
const hasFields = arguments.length === 2;
|
|
315
|
+
const primaryKeyValue = hasFields ? key : fieldsOrKey;
|
|
316
|
+
const condition = this.primaryKeyCondition(primaryKeyValue, 'findByPrimaryKey');
|
|
317
|
+
if (hasFields) {
|
|
318
|
+
return this.find(this.resolveFields(fieldsOrKey), condition);
|
|
319
|
+
}
|
|
320
|
+
return this.find(condition);
|
|
321
|
+
}
|
|
322
|
+
/********************************************************************************************************************
|
|
323
|
+
* primaryKeyCondition
|
|
324
|
+
* ******************************************************************************************************************/
|
|
325
|
+
primaryKeyCondition(primaryKeyValue, method) {
|
|
326
|
+
// 固定された MsSqlTable 型で取得し、ジェネリックによる型の拡大を避ける。
|
|
327
|
+
const table = this.t;
|
|
328
|
+
const config = mssqlCore.getTableConfig(table);
|
|
329
|
+
const columns = native.getTableColumns(table);
|
|
330
|
+
const primaryColumns = new Set(config.columns.filter((column) => column.primary));
|
|
331
|
+
for (const primaryKey of config.primaryKeys) {
|
|
332
|
+
for (const column of primaryKey.columns) {
|
|
333
|
+
primaryColumns.add(column);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
const primaryEntries = Object.entries(columns).filter(([, column]) => primaryColumns.has(column));
|
|
337
|
+
if (primaryEntries.length === 0) {
|
|
338
|
+
throw new Error(`${method}: ${config.name} has no primary key.`);
|
|
339
|
+
}
|
|
340
|
+
const isKeyObject = typeof primaryKeyValue === 'object' && primaryKeyValue !== null && !Array.isArray(primaryKeyValue);
|
|
341
|
+
if (primaryEntries.length > 1 && !isKeyObject) {
|
|
342
|
+
throw new Error(`${method}: ${config.name} requires a composite key object.`);
|
|
343
|
+
}
|
|
344
|
+
const keyObject = isKeyObject ? primaryKeyValue : undefined;
|
|
345
|
+
if (keyObject &&
|
|
346
|
+
Object.keys(keyObject).some((name) => !primaryEntries.some(([primaryName]) => primaryName === name))) {
|
|
347
|
+
throw new Error(`${method}: ${config.name} received an unknown primary key field.`);
|
|
348
|
+
}
|
|
349
|
+
const conditions = primaryEntries.map(([name, column]) => {
|
|
350
|
+
if (keyObject && !Object.hasOwn(keyObject, name)) {
|
|
351
|
+
throw new Error(`${method}: missing primary key field "${name}".`);
|
|
352
|
+
}
|
|
353
|
+
const value = keyObject ? keyObject[name] : primaryKeyValue;
|
|
354
|
+
if (value === undefined || value === null) {
|
|
355
|
+
throw new Error(`${method}: primary key field "${name}" must have a value.`);
|
|
356
|
+
}
|
|
357
|
+
return native.eq(column, value);
|
|
358
|
+
});
|
|
359
|
+
const condition = native.and(...conditions);
|
|
360
|
+
if (!condition) {
|
|
361
|
+
throw new Error(`${method}: failed to build the primary key condition.`);
|
|
362
|
+
}
|
|
363
|
+
return condition;
|
|
364
|
+
}
|
|
365
|
+
/********************************************************************************************************************
|
|
366
|
+
* exists
|
|
367
|
+
* ******************************************************************************************************************/
|
|
368
|
+
async exists(where) {
|
|
369
|
+
const condition = typeof where === 'function' ? where(this) : where;
|
|
370
|
+
if (condition !== undefined && !native.is(condition, native.SQL)) {
|
|
371
|
+
throw new Error('exists: the where callback must return SQL or undefined.');
|
|
372
|
+
}
|
|
373
|
+
const [result] = await this.select({ matched: this.drizzle.sqlNumber(1) })
|
|
374
|
+
.where(condition)
|
|
375
|
+
.orderBy(native.sql `(select 0)`)
|
|
376
|
+
.offset(0)
|
|
377
|
+
.fetch(1);
|
|
378
|
+
return result !== undefined;
|
|
379
|
+
}
|
|
380
|
+
/********************************************************************************************************************
|
|
381
|
+
* existsByPrimarykey
|
|
382
|
+
* ******************************************************************************************************************/
|
|
383
|
+
async existsByPrimaryKey(key) {
|
|
384
|
+
const result = await this.findByPrimaryKey({ matched: this.drizzle.sqlNumber(1) }, key);
|
|
385
|
+
return result !== undefined;
|
|
386
|
+
}
|
|
387
|
+
/********************************************************************************************************************
|
|
388
|
+
* notExists
|
|
389
|
+
* ******************************************************************************************************************/
|
|
390
|
+
async notExists(where) {
|
|
391
|
+
return !(await this.exists(where));
|
|
392
|
+
}
|
|
393
|
+
/********************************************************************************************************************
|
|
394
|
+
* notExistsByPrimaryKey
|
|
395
|
+
* ******************************************************************************************************************/
|
|
396
|
+
async notExistsByPrimaryKey(key) {
|
|
397
|
+
return !(await this.existsByPrimaryKey(key));
|
|
398
|
+
}
|
|
399
|
+
/********************************************************************************************************************
|
|
400
|
+
* count
|
|
401
|
+
* ******************************************************************************************************************/
|
|
402
|
+
async count(where) {
|
|
403
|
+
const condition = typeof where === 'function' ? where(this) : where;
|
|
404
|
+
if (condition !== undefined && !native.is(condition, native.SQL)) {
|
|
405
|
+
throw new Error('count: the where callback must return SQL or undefined.');
|
|
406
|
+
}
|
|
407
|
+
const [{ cnt }] = await this.select({ cnt: native.count() }).where(condition);
|
|
408
|
+
return cnt;
|
|
409
|
+
}
|
|
410
|
+
prepareValues(input, operation) {
|
|
411
|
+
var _a, _b;
|
|
412
|
+
const values = Object.assign({}, input);
|
|
413
|
+
const columns = native.getTableColumns(this.t);
|
|
414
|
+
const policies = getColumnPolicies(this.t);
|
|
415
|
+
let timestamp;
|
|
416
|
+
let generated = false;
|
|
417
|
+
for (const [key, column] of Object.entries(columns)) {
|
|
418
|
+
const policy = (_a = policies[key]) !== null && _a !== void 0 ? _a : {};
|
|
419
|
+
const auto = 'identity' in column && column.identity !== undefined;
|
|
420
|
+
const rule = operation === 'insert' ? policy.insert : policy.update;
|
|
421
|
+
const primary = column.primary;
|
|
422
|
+
const blocked = (operation === 'update' && policy.timestamp === 'created') ||
|
|
423
|
+
rule === 'blocked' ||
|
|
424
|
+
(operation === 'update' && primary && rule !== 'allowed') ||
|
|
425
|
+
(auto && rule !== 'allowed' && rule !== 'required');
|
|
426
|
+
if (blocked && Object.hasOwn(values, key))
|
|
427
|
+
throw new Error(`${operation}: column "${key}" is blocked.`);
|
|
428
|
+
if (operation === 'update' &&
|
|
429
|
+
!blocked &&
|
|
430
|
+
rule === 'required' &&
|
|
431
|
+
policy.timestamp !== 'updated' &&
|
|
432
|
+
values[key] === undefined) {
|
|
433
|
+
throw new Error(`update: column "${key}" is required.`);
|
|
434
|
+
}
|
|
435
|
+
if (policy.timestamp &&
|
|
436
|
+
values[key] === undefined &&
|
|
437
|
+
(operation === 'insert' || policy.timestamp === 'updated')) {
|
|
438
|
+
if (!generated) {
|
|
439
|
+
const getTimestamp = (_b = this.getTimestamp) !== null && _b !== void 0 ? _b : this.current.getTimestamp;
|
|
440
|
+
if (!getTimestamp)
|
|
441
|
+
throw new Error('timestamp generator is not configured');
|
|
442
|
+
timestamp = getTimestamp();
|
|
443
|
+
generated = true;
|
|
444
|
+
}
|
|
445
|
+
values[key] = timestamp;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return values;
|
|
449
|
+
}
|
|
450
|
+
/********************************************************************************************************************
|
|
451
|
+
* (PRIVATE) executeInsert
|
|
452
|
+
* ******************************************************************************************************************/
|
|
453
|
+
async executeInsert(value) {
|
|
454
|
+
const tx = this.getTx();
|
|
455
|
+
const autoIncrementColumn = mssqlCore.getTableConfig(this.t).columns.find((column) => 'identity' in column && column.identity !== undefined);
|
|
456
|
+
const hasAutoIncrement = !!autoIncrementColumn;
|
|
457
|
+
const autoIncrementKey = autoIncrementColumn &&
|
|
458
|
+
Object.keys(native.getTableColumns(this.t)).find((key) => native.getTableColumns(this.t)[key] === autoIncrementColumn);
|
|
459
|
+
if (hasAutoIncrement) {
|
|
460
|
+
if (Array.isArray(value)) {
|
|
461
|
+
const addedItems = (await tx.insert(this.t).output().values(value));
|
|
462
|
+
return addedItems.map((item) => item[autoIncrementKey]);
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
const [item] = (await tx.insert(this.t).output().values(value));
|
|
466
|
+
return item[autoIncrementKey];
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
if (Array.isArray(value)) {
|
|
471
|
+
await tx.insert(this.t).values(value);
|
|
472
|
+
return Array(value.length).fill(undefined);
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
await tx.insert(this.t).values(value);
|
|
476
|
+
return undefined;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
insertValues(values) {
|
|
481
|
+
return values;
|
|
482
|
+
}
|
|
483
|
+
/********************************************************************************************************************
|
|
484
|
+
* updateValues
|
|
485
|
+
* ******************************************************************************************************************/
|
|
486
|
+
updateValues(values) {
|
|
487
|
+
return values;
|
|
488
|
+
}
|
|
489
|
+
add(value) {
|
|
490
|
+
const items = Array.isArray(value) ? value : [value];
|
|
491
|
+
const values = items.map((item) => this.prepareValues(item, 'insert'));
|
|
492
|
+
return this.executeInsert((Array.isArray(value) ? values : values[0]));
|
|
493
|
+
}
|
|
494
|
+
/********************************************************************************************************************
|
|
495
|
+
* edit
|
|
496
|
+
* ******************************************************************************************************************/
|
|
497
|
+
edit(set, where) {
|
|
498
|
+
this.assertMutationAllowed('update', 'edit');
|
|
499
|
+
const condition = typeof where === 'function' ? where(this) : where;
|
|
500
|
+
if (!native.is(condition, native.SQL)) {
|
|
501
|
+
throw new Error('edit: a SQL where condition is required.');
|
|
502
|
+
}
|
|
503
|
+
const tx = this.getTx();
|
|
504
|
+
return tx.update(this.t).set(this.prepareValues(set, 'update')).where(condition);
|
|
505
|
+
}
|
|
506
|
+
/********************************************************************************************************************
|
|
507
|
+
* editByPrimaryKey
|
|
508
|
+
* ******************************************************************************************************************/
|
|
509
|
+
editByPrimaryKey(set, key) {
|
|
510
|
+
this.assertMutationAllowed('update', 'editByPrimaryKey');
|
|
511
|
+
return this.edit(set, this.primaryKeyCondition(key, 'editByPrimaryKey'));
|
|
512
|
+
}
|
|
513
|
+
/********************************************************************************************************************
|
|
514
|
+
* remove
|
|
515
|
+
* ******************************************************************************************************************/
|
|
516
|
+
remove(where) {
|
|
517
|
+
this.assertMutationAllowed('delete', 'remove');
|
|
518
|
+
const condition = typeof where === 'function' ? where(this) : where;
|
|
519
|
+
if (!native.is(condition, native.SQL)) {
|
|
520
|
+
throw new Error('remove: a SQL where condition is required.');
|
|
521
|
+
}
|
|
522
|
+
const tx = this.getTx();
|
|
523
|
+
return tx.delete(this.t).where(condition);
|
|
524
|
+
}
|
|
525
|
+
/********************************************************************************************************************
|
|
526
|
+
* removeByPrimaryKey
|
|
527
|
+
* ******************************************************************************************************************/
|
|
528
|
+
removeByPrimaryKey(key) {
|
|
529
|
+
this.assertMutationAllowed('delete', 'removeByPrimaryKey');
|
|
530
|
+
return this.remove(this.primaryKeyCondition(key, 'removeByPrimaryKey'));
|
|
531
|
+
}
|
|
532
|
+
assertMutationAllowed(operation, method) {
|
|
533
|
+
const policy = getTablePolicy(this.t);
|
|
534
|
+
if (operation === 'update' ? policy.updateBlocked : policy.deleteBlocked) {
|
|
535
|
+
throw new Error(`${method}: ${operation} is blocked for table "${mssqlCore.getTableConfig(this.t).name}".`);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
/********************************************************************************************************************
|
|
539
|
+
* eq
|
|
540
|
+
* ******************************************************************************************************************/
|
|
541
|
+
eq(values) {
|
|
542
|
+
return this.drizzle.eq(this.t, values);
|
|
543
|
+
}
|
|
544
|
+
/********************************************************************************************************************
|
|
545
|
+
* ne
|
|
546
|
+
* ******************************************************************************************************************/
|
|
547
|
+
ne(values) {
|
|
548
|
+
return this.drizzle.ne(this.t, values);
|
|
549
|
+
}
|
|
550
|
+
/********************************************************************************************************************
|
|
551
|
+
* gt
|
|
552
|
+
* ******************************************************************************************************************/
|
|
553
|
+
gt(values) {
|
|
554
|
+
return this.drizzle.gt(this.t, values);
|
|
555
|
+
}
|
|
556
|
+
/********************************************************************************************************************
|
|
557
|
+
* gte
|
|
558
|
+
* ******************************************************************************************************************/
|
|
559
|
+
gte(values) {
|
|
560
|
+
return this.drizzle.gte(this.t, values);
|
|
561
|
+
}
|
|
562
|
+
/********************************************************************************************************************
|
|
563
|
+
* lt
|
|
564
|
+
* ******************************************************************************************************************/
|
|
565
|
+
lt(values) {
|
|
566
|
+
return this.drizzle.lt(this.t, values);
|
|
567
|
+
}
|
|
568
|
+
/********************************************************************************************************************
|
|
569
|
+
* lte
|
|
570
|
+
* ******************************************************************************************************************/
|
|
571
|
+
lte(values) {
|
|
572
|
+
return this.drizzle.lte(this.t, values);
|
|
573
|
+
}
|
|
574
|
+
/********************************************************************************************************************
|
|
575
|
+
* lte
|
|
576
|
+
* ******************************************************************************************************************/
|
|
577
|
+
inArray(values) {
|
|
578
|
+
return this.drizzle.inArray(this.t, values);
|
|
579
|
+
}
|
|
580
|
+
/********************************************************************************************************************
|
|
581
|
+
* notInArray
|
|
582
|
+
* ******************************************************************************************************************/
|
|
583
|
+
notInArray(values) {
|
|
584
|
+
return this.drizzle.notInArray(this.t, values);
|
|
585
|
+
}
|
|
586
|
+
/********************************************************************************************************************
|
|
587
|
+
* between
|
|
588
|
+
* ******************************************************************************************************************/
|
|
589
|
+
between(values) {
|
|
590
|
+
return this.drizzle.between(this.t, values);
|
|
591
|
+
}
|
|
592
|
+
/********************************************************************************************************************
|
|
593
|
+
* notBetween
|
|
594
|
+
* ******************************************************************************************************************/
|
|
595
|
+
notBetween(values) {
|
|
596
|
+
return this.drizzle.notBetween(this.t, values);
|
|
597
|
+
}
|
|
598
|
+
/********************************************************************************************************************
|
|
599
|
+
* like
|
|
600
|
+
* ******************************************************************************************************************/
|
|
601
|
+
like(values) {
|
|
602
|
+
return this.drizzle.like(this.t, values);
|
|
603
|
+
}
|
|
604
|
+
/********************************************************************************************************************
|
|
605
|
+
* notLike
|
|
606
|
+
* ******************************************************************************************************************/
|
|
607
|
+
notLike(values) {
|
|
608
|
+
return this.drizzle.notLike(this.t, values);
|
|
609
|
+
}
|
|
610
|
+
/********************************************************************************************************************
|
|
611
|
+
* ilike
|
|
612
|
+
* ******************************************************************************************************************/
|
|
613
|
+
ilike(values) {
|
|
614
|
+
return this.drizzle.ilike(this.t, values);
|
|
615
|
+
}
|
|
616
|
+
/********************************************************************************************************************
|
|
617
|
+
* notIlike
|
|
618
|
+
* ******************************************************************************************************************/
|
|
619
|
+
notIlike(values) {
|
|
620
|
+
return this.drizzle.notIlike(this.t, values);
|
|
621
|
+
}
|
|
622
|
+
isNull(names) {
|
|
623
|
+
return this.drizzle.isNull(this.t, names);
|
|
624
|
+
}
|
|
625
|
+
isNotNull(names) {
|
|
626
|
+
return this.drizzle.isNotNull(this.t, names);
|
|
627
|
+
}
|
|
628
|
+
/********************************************************************************************************************
|
|
629
|
+
* and
|
|
630
|
+
* ******************************************************************************************************************/
|
|
631
|
+
and(options) {
|
|
632
|
+
return this.drizzle.and(this.t, options);
|
|
633
|
+
}
|
|
634
|
+
/********************************************************************************************************************
|
|
635
|
+
* or
|
|
636
|
+
* ******************************************************************************************************************/
|
|
637
|
+
or(options) {
|
|
638
|
+
return this.drizzle.or(this.t, options);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
const normalizeFields = (fields) => {
|
|
642
|
+
if (fields === undefined)
|
|
643
|
+
return undefined;
|
|
644
|
+
const groups = Array.isArray(fields) ? fields : [fields];
|
|
645
|
+
const result = {};
|
|
646
|
+
for (const group of groups) {
|
|
647
|
+
if (Array.isArray(fields) && (group === false || group === undefined))
|
|
648
|
+
continue;
|
|
649
|
+
if (typeof group !== 'object' || group === null || Array.isArray(group) || native.isTable(group) || native.is(group, native.SQL)) {
|
|
650
|
+
throw new Error('fields: expected a selection object or an array of selection objects.');
|
|
651
|
+
}
|
|
652
|
+
Object.assign(result, group);
|
|
653
|
+
}
|
|
654
|
+
for (const [name, field] of Object.entries(result)) {
|
|
655
|
+
if (native.is(field, mssqlCore.MsSqlColumn) && field.name !== name) {
|
|
656
|
+
result[name] = native.sql `${field}`.mapWith(field).as(name);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return result;
|
|
660
|
+
};function drizzleMsSql(options) {
|
|
661
|
+
const raw = nodeMssql.drizzle({ connection: options.url, relations: native.defineRelations(options.schema) });
|
|
662
|
+
const context = new node_async_hooks.AsyncLocalStorage();
|
|
663
|
+
const current = Object.assign(() => { var _a; return (_a = context.getStore()) !== null && _a !== void 0 ? _a : raw; }, { getTimestamp: options.getTimestamp });
|
|
664
|
+
const trans = (callback) => {
|
|
665
|
+
const parent = context.getStore();
|
|
666
|
+
const execute = (tx) => context.run(tx, callback);
|
|
667
|
+
return parent ? parent.transaction(execute) : raw.transaction(execute);
|
|
668
|
+
};
|
|
669
|
+
const paginate = async (builder, page, limit) => {
|
|
670
|
+
var _a;
|
|
671
|
+
if (!Number.isInteger(page) || page < 1 || !Number.isInteger(limit) || limit < 1) {
|
|
672
|
+
throw new RangeError('page and limit must be positive integers');
|
|
673
|
+
}
|
|
674
|
+
const offset = (page - 1) * limit;
|
|
675
|
+
// Drizzle의 SQL Server 빌더는 offset/fetch가 호출된 빌더의 설정을 직접 변경한다.
|
|
676
|
+
// 집계와 데이터 조회 모두 SQL Server 2012의 ORDER BY ... OFFSET 문법을 따라야 한다.
|
|
677
|
+
const config = builder.config;
|
|
678
|
+
const tail = config.setOperators.length ? config.setOperators[config.setOperators.length - 1] : config;
|
|
679
|
+
if (!((_a = tail.orderBy) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
680
|
+
builder.orderBy(native.sql `(select 0)`);
|
|
681
|
+
}
|
|
682
|
+
// 같은 빌더로 재호출할 때 이전 페이지의 FETCH가 전체 건수에 섞이지 않도록 한다.
|
|
683
|
+
tail.fetch = undefined;
|
|
684
|
+
const [{ total }] = await current().select({ total: native.count() }).from(builder.offset(0).as('a'));
|
|
685
|
+
const data = await builder.offset(offset).fetch(limit);
|
|
686
|
+
return {
|
|
687
|
+
data,
|
|
688
|
+
paging: {
|
|
689
|
+
current_page: page,
|
|
690
|
+
per_page: limit,
|
|
691
|
+
last_page: Math.ceil(total / limit),
|
|
692
|
+
total,
|
|
693
|
+
from: offset,
|
|
694
|
+
to: offset + data.length,
|
|
695
|
+
},
|
|
696
|
+
};
|
|
697
|
+
};
|
|
698
|
+
return Object.assign(Object.assign({ asc: native__namespace.asc, desc: native__namespace.desc, count: native__namespace.count, countDistinct: native__namespace.countDistinct, avg: native__namespace.avg, avgDistinct: native__namespace.avgDistinct, sum: native__namespace.sum, sumDistinct: native__namespace.sumDistinct, max: native__namespace.max, min: native__namespace.min, not: native__namespace.not, exists: native__namespace.exists, notExists: native__namespace.notExists, arrayContains: native__namespace.arrayContains, arrayContained: native__namespace.arrayContained, arrayOverlaps: native__namespace.arrayOverlaps, s: options.schema, a: createAlias(options.schema) }, createConditions(options.schema)), { columns: TableColumns, sql: native.sql, sqlNumber: (value) => (native.is(value, native.SQL) ? value : native.sql `${value}`).mapWith(Number), sqlString: (value) => (native.is(value, native.SQL) ? value : native.sql `${value}`).mapWith(String), sqlBoolean: (value) => (native.is(value, native.SQL) ? value : native.sql `${value}`).mapWith((v) => v === true || v === 1), current, query: (table) => new MsSqlQuery(table, current), trans,
|
|
699
|
+
paginate, close: async () => (await raw.$client.$instance()).close() });
|
|
700
|
+
}Object.defineProperty(exports,"asc",{enumerable:true,get:function(){return native.asc}});Object.defineProperty(exports,"avg",{enumerable:true,get:function(){return native.avg}});Object.defineProperty(exports,"avgDistinct",{enumerable:true,get:function(){return native.avgDistinct}});Object.defineProperty(exports,"count",{enumerable:true,get:function(){return native.count}});Object.defineProperty(exports,"countDistinct",{enumerable:true,get:function(){return native.countDistinct}});Object.defineProperty(exports,"desc",{enumerable:true,get:function(){return native.desc}});Object.defineProperty(exports,"exists",{enumerable:true,get:function(){return native.exists}});Object.defineProperty(exports,"max",{enumerable:true,get:function(){return native.max}});Object.defineProperty(exports,"min",{enumerable:true,get:function(){return native.min}});Object.defineProperty(exports,"not",{enumerable:true,get:function(){return native.not}});Object.defineProperty(exports,"notExists",{enumerable:true,get:function(){return native.notExists}});Object.defineProperty(exports,"sum",{enumerable:true,get:function(){return native.sum}});Object.defineProperty(exports,"sumDistinct",{enumerable:true,get:function(){return native.sumDistinct}});Object.defineProperty(exports,"bigint",{enumerable:true,get:function(){return mssqlCore.bigint}});Object.defineProperty(exports,"binary",{enumerable:true,get:function(){return mssqlCore.binary}});Object.defineProperty(exports,"bit",{enumerable:true,get:function(){return mssqlCore.bit}});Object.defineProperty(exports,"char",{enumerable:true,get:function(){return mssqlCore.char}});Object.defineProperty(exports,"check",{enumerable:true,get:function(){return mssqlCore.check}});Object.defineProperty(exports,"customType",{enumerable:true,get:function(){return mssqlCore.customType}});Object.defineProperty(exports,"date",{enumerable:true,get:function(){return mssqlCore.date}});Object.defineProperty(exports,"datetime",{enumerable:true,get:function(){return mssqlCore.datetime}});Object.defineProperty(exports,"datetime2",{enumerable:true,get:function(){return mssqlCore.datetime2}});Object.defineProperty(exports,"datetimeoffset",{enumerable:true,get:function(){return mssqlCore.datetimeoffset}});Object.defineProperty(exports,"decimal",{enumerable:true,get:function(){return mssqlCore.decimal}});Object.defineProperty(exports,"float",{enumerable:true,get:function(){return mssqlCore.float}});Object.defineProperty(exports,"foreignKey",{enumerable:true,get:function(){return mssqlCore.foreignKey}});Object.defineProperty(exports,"index",{enumerable:true,get:function(){return mssqlCore.index}});Object.defineProperty(exports,"int",{enumerable:true,get:function(){return mssqlCore.int}});Object.defineProperty(exports,"mssqlSchema",{enumerable:true,get:function(){return mssqlCore.mssqlSchema}});Object.defineProperty(exports,"mssqlTableCreator",{enumerable:true,get:function(){return mssqlCore.mssqlTableCreator}});Object.defineProperty(exports,"mssqlView",{enumerable:true,get:function(){return mssqlCore.mssqlView}});Object.defineProperty(exports,"nchar",{enumerable:true,get:function(){return mssqlCore.nchar}});Object.defineProperty(exports,"ntext",{enumerable:true,get:function(){return mssqlCore.ntext}});Object.defineProperty(exports,"numeric",{enumerable:true,get:function(){return mssqlCore.numeric}});Object.defineProperty(exports,"nvarchar",{enumerable:true,get:function(){return mssqlCore.nvarchar}});Object.defineProperty(exports,"primaryKey",{enumerable:true,get:function(){return mssqlCore.primaryKey}});Object.defineProperty(exports,"real",{enumerable:true,get:function(){return mssqlCore.real}});Object.defineProperty(exports,"smallint",{enumerable:true,get:function(){return mssqlCore.smallint}});Object.defineProperty(exports,"text",{enumerable:true,get:function(){return mssqlCore.text}});Object.defineProperty(exports,"time",{enumerable:true,get:function(){return mssqlCore.time}});Object.defineProperty(exports,"tinyint",{enumerable:true,get:function(){return mssqlCore.tinyint}});Object.defineProperty(exports,"unique",{enumerable:true,get:function(){return mssqlCore.unique}});Object.defineProperty(exports,"uniqueIndex",{enumerable:true,get:function(){return mssqlCore.uniqueIndex}});Object.defineProperty(exports,"varbinary",{enumerable:true,get:function(){return mssqlCore.varbinary}});Object.defineProperty(exports,"varchar",{enumerable:true,get:function(){return mssqlCore.varchar}});exports.MsSqlQuery=MsSqlQuery;exports.TableColumns=TableColumns;exports.createConditions=createConditions;exports.default=drizzleMsSql;exports.drizzleMsSql=drizzleMsSql;exports.mssqlTable=mssqlTable;
|