kysely 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/check-esm-imports.js +38 -0
- package/dist/cjs/parser/on-conflict-parser.js +4 -4
- package/dist/cjs/util/generated-placeholder.d.ts +1 -1
- package/dist/cjs/util/generated-placeholder.js +3 -3
- package/dist/esm/parser/on-conflict-parser.js +1 -1
- package/dist/esm/util/generated-placeholder.d.ts +1 -1
- package/dist/esm/util/generated-placeholder.js +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
let errorsFound = false
|
|
5
|
+
|
|
6
|
+
function checkFolder(folder) {
|
|
7
|
+
for (const file of fs.readdirSync(folder)) {
|
|
8
|
+
if (file === '.' || file === '..') {
|
|
9
|
+
continue
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const filePath = path.join(folder, file)
|
|
13
|
+
|
|
14
|
+
if (isDir(filePath)) {
|
|
15
|
+
checkFolder(filePath)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (file.endsWith('.ts')) {
|
|
19
|
+
for (const row of fs.readFileSync(filePath).toString().split('\n')) {
|
|
20
|
+
if (row.includes("from '.") && !row.endsWith(".js'")) {
|
|
21
|
+
console.log(`invalid import in file ${filePath}`)
|
|
22
|
+
console.log(row)
|
|
23
|
+
errorsFound = true
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function isDir(file) {
|
|
31
|
+
return fs.lstatSync(file).isDirectory()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
checkFolder(path.join(__dirname, 'src'))
|
|
35
|
+
|
|
36
|
+
if (errorsFound) {
|
|
37
|
+
process.exit(1)
|
|
38
|
+
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseOnConflictUpdate = exports.parseOnConflictDoNothing = void 0;
|
|
4
4
|
const identifier_node_js_1 = require("../operation-node/identifier-node.js");
|
|
5
5
|
const on_conflict_node_js_1 = require("../operation-node/on-conflict-node.js");
|
|
6
|
-
const
|
|
6
|
+
const object_utils_js_1 = require("../util/object-utils.js");
|
|
7
7
|
const reference_parser_js_1 = require("./reference-parser.js");
|
|
8
8
|
const update_set_parser_js_1 = require("./update-set-parser.js");
|
|
9
9
|
function parseOnConflictDoNothing(target) {
|
|
@@ -21,12 +21,12 @@ function parseOnConflictUpdate(target, updates) {
|
|
|
21
21
|
}
|
|
22
22
|
exports.parseOnConflictUpdate = parseOnConflictUpdate;
|
|
23
23
|
function parseConflictTarget(target) {
|
|
24
|
-
if (
|
|
24
|
+
if (object_utils_js_1.isString(target) || object_utils_js_1.isReadonlyArray(target)) {
|
|
25
25
|
return {
|
|
26
|
-
columns:
|
|
26
|
+
columns: object_utils_js_1.asReadonlyArray(target).map(reference_parser_js_1.parseColumnName),
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
if (
|
|
29
|
+
if (object_utils_js_1.isObject(target) && !object_utils_js_1.isReadonlyArray(target)) {
|
|
30
30
|
return {
|
|
31
31
|
constraint: identifier_node_js_1.IdentifierNode.create(target.constraint),
|
|
32
32
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { GeneratedPlaceholder } from '../query-builder/type-utils';
|
|
1
|
+
import { GeneratedPlaceholder } from '../query-builder/type-utils.js';
|
|
2
2
|
export declare const generatedPlaceholder: GeneratedPlaceholder;
|
|
3
3
|
export declare function isGeneratedPlaceholder(obj: unknown): obj is GeneratedPlaceholder;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isGeneratedPlaceholder = exports.generatedPlaceholder = void 0;
|
|
4
|
-
const
|
|
5
|
-
exports.generatedPlaceholder =
|
|
4
|
+
const object_utils_js_1 = require("./object-utils.js");
|
|
5
|
+
exports.generatedPlaceholder = object_utils_js_1.freeze({
|
|
6
6
|
__isGeneratedPlaceholder__: true,
|
|
7
7
|
});
|
|
8
8
|
function isGeneratedPlaceholder(obj) {
|
|
9
|
-
return
|
|
9
|
+
return object_utils_js_1.isObject(obj) && obj.__isGeneratedPlaceholder__ === true;
|
|
10
10
|
}
|
|
11
11
|
exports.isGeneratedPlaceholder = isGeneratedPlaceholder;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IdentifierNode } from '../operation-node/identifier-node.js';
|
|
2
2
|
import { OnConflictNode } from '../operation-node/on-conflict-node.js';
|
|
3
|
-
import { asReadonlyArray, isObject, isReadonlyArray, isString, } from '../util/object-utils';
|
|
3
|
+
import { asReadonlyArray, isObject, isReadonlyArray, isString, } from '../util/object-utils.js';
|
|
4
4
|
import { parseColumnName } from './reference-parser.js';
|
|
5
5
|
import { parseUpdateObject } from './update-set-parser.js';
|
|
6
6
|
export function parseOnConflictDoNothing(target) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { GeneratedPlaceholder } from '../query-builder/type-utils';
|
|
1
|
+
import { GeneratedPlaceholder } from '../query-builder/type-utils.js';
|
|
2
2
|
export declare const generatedPlaceholder: GeneratedPlaceholder;
|
|
3
3
|
export declare function isGeneratedPlaceholder(obj: unknown): obj is GeneratedPlaceholder;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kysely",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Type safe SQL query builder",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"test:build": "rm -rf test/lib && tsc -p test",
|
|
19
19
|
"clean": "rm -rf dist && rm -rf test/dist",
|
|
20
|
-
"test": "npm run clean && npm run build:cjs && npm run test:build && npm run test:integration && npm run test:typings",
|
|
20
|
+
"test": "npm run clean && npm run build:cjs && npm run test:build && npm run test:integration && npm run test:typings && npm run test:esmimports",
|
|
21
21
|
"test:integration": "mocha --timeout 5000 test/dist/**/*.test.js",
|
|
22
22
|
"test:typings": "tsd test/typings",
|
|
23
|
+
"test:esmimports": "node check-esm-imports.js",
|
|
23
24
|
"prettier": "prettier --write src/**/*.ts test/**/*.ts",
|
|
24
25
|
"build": "npm run clean && npm run build:esm && npm run build:cjs && ./module-fixup.sh",
|
|
25
26
|
"build:esm": "tsc -p tsconfig.json",
|