kysely 0.16.7 → 0.16.8
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/dist/cjs/query-executor/query-executor.js +3 -2
- package/dist/cjs/raw-builder/raw-builder.d.ts +2 -2
- package/dist/cjs/raw-builder/raw-builder.js +8 -1
- package/dist/esm/query-executor/query-executor.js +3 -2
- package/dist/esm/raw-builder/raw-builder.d.ts +2 -2
- package/dist/esm/raw-builder/raw-builder.js +8 -1
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.QueryExecutor = void 0;
|
|
4
4
|
const object_utils_js_1 = require("../util/object-utils.js");
|
|
5
|
+
const NO_PLUGINS = (0, object_utils_js_1.freeze)([]);
|
|
5
6
|
/**
|
|
6
7
|
* This class abstracts away the details of how to compile a query into SQL
|
|
7
8
|
* and execute it. Instead of passing around all those details, {@link SelectQueryBuilder}
|
|
@@ -10,8 +11,8 @@ const object_utils_js_1 = require("../util/object-utils.js");
|
|
|
10
11
|
*/
|
|
11
12
|
class QueryExecutor {
|
|
12
13
|
#plugins;
|
|
13
|
-
constructor(plugins
|
|
14
|
-
this.#plugins =
|
|
14
|
+
constructor(plugins) {
|
|
15
|
+
this.#plugins = plugins ?? NO_PLUGINS;
|
|
15
16
|
}
|
|
16
17
|
get plugins() {
|
|
17
18
|
return this.#plugins;
|
|
@@ -40,8 +40,8 @@ export declare class AliasedRawBuilder<O = unknown, A extends string = never> im
|
|
|
40
40
|
constructor(rawBuilder: RawBuilder<O>, alias: A);
|
|
41
41
|
}
|
|
42
42
|
export interface RawBuilderProps {
|
|
43
|
-
readonly queryId
|
|
44
|
-
readonly executor
|
|
43
|
+
readonly queryId?: QueryId;
|
|
44
|
+
readonly executor?: QueryExecutor;
|
|
45
45
|
readonly sql: string;
|
|
46
46
|
readonly parameters?: ReadonlyArray<unknown>;
|
|
47
47
|
}
|
|
@@ -7,11 +7,18 @@ const raw_node_js_1 = require("../operation-node/raw-node.js");
|
|
|
7
7
|
const value_node_js_1 = require("../operation-node/value-node.js");
|
|
8
8
|
const reference_parser_js_1 = require("../parser/reference-parser.js");
|
|
9
9
|
const prevent_await_js_1 = require("../util/prevent-await.js");
|
|
10
|
+
const query_id_js_1 = require("../util/query-id.js");
|
|
10
11
|
const object_utils_js_1 = require("../util/object-utils.js");
|
|
12
|
+
const noop_query_executor_js_1 = require("../query-executor/noop-query-executor.js");
|
|
11
13
|
class RawBuilder {
|
|
12
14
|
#props;
|
|
13
15
|
constructor(props) {
|
|
14
|
-
this.#props = (0, object_utils_js_1.freeze)(
|
|
16
|
+
this.#props = (0, object_utils_js_1.freeze)({
|
|
17
|
+
queryId: props.queryId ?? (0, query_id_js_1.createQueryId)(),
|
|
18
|
+
executor: props.executor ?? new noop_query_executor_js_1.NoopQueryExecutor(),
|
|
19
|
+
sql: props.sql,
|
|
20
|
+
parameters: props.parameters,
|
|
21
|
+
});
|
|
15
22
|
}
|
|
16
23
|
as(alias) {
|
|
17
24
|
return new AliasedRawBuilder(this, alias);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="./query-executor.d.ts" />
|
|
2
2
|
import { freeze } from '../util/object-utils.js';
|
|
3
|
+
const NO_PLUGINS = freeze([]);
|
|
3
4
|
/**
|
|
4
5
|
* This class abstracts away the details of how to compile a query into SQL
|
|
5
6
|
* and execute it. Instead of passing around all those details, {@link SelectQueryBuilder}
|
|
@@ -8,8 +9,8 @@ import { freeze } from '../util/object-utils.js';
|
|
|
8
9
|
*/
|
|
9
10
|
export class QueryExecutor {
|
|
10
11
|
#plugins;
|
|
11
|
-
constructor(plugins
|
|
12
|
-
this.#plugins =
|
|
12
|
+
constructor(plugins) {
|
|
13
|
+
this.#plugins = plugins ?? NO_PLUGINS;
|
|
13
14
|
}
|
|
14
15
|
get plugins() {
|
|
15
16
|
return this.#plugins;
|
|
@@ -40,8 +40,8 @@ export declare class AliasedRawBuilder<O = unknown, A extends string = never> im
|
|
|
40
40
|
constructor(rawBuilder: RawBuilder<O>, alias: A);
|
|
41
41
|
}
|
|
42
42
|
export interface RawBuilderProps {
|
|
43
|
-
readonly queryId
|
|
44
|
-
readonly executor
|
|
43
|
+
readonly queryId?: QueryId;
|
|
44
|
+
readonly executor?: QueryExecutor;
|
|
45
45
|
readonly sql: string;
|
|
46
46
|
readonly parameters?: ReadonlyArray<unknown>;
|
|
47
47
|
}
|
|
@@ -5,11 +5,18 @@ import { RawNode } from '../operation-node/raw-node.js';
|
|
|
5
5
|
import { ValueNode } from '../operation-node/value-node.js';
|
|
6
6
|
import { parseStringReference } from '../parser/reference-parser.js';
|
|
7
7
|
import { preventAwait } from '../util/prevent-await.js';
|
|
8
|
+
import { createQueryId } from '../util/query-id.js';
|
|
8
9
|
import { freeze } from '../util/object-utils.js';
|
|
10
|
+
import { NoopQueryExecutor } from '../query-executor/noop-query-executor.js';
|
|
9
11
|
export class RawBuilder {
|
|
10
12
|
#props;
|
|
11
13
|
constructor(props) {
|
|
12
|
-
this.#props = freeze(
|
|
14
|
+
this.#props = freeze({
|
|
15
|
+
queryId: props.queryId ?? createQueryId(),
|
|
16
|
+
executor: props.executor ?? new NoopQueryExecutor(),
|
|
17
|
+
sql: props.sql,
|
|
18
|
+
parameters: props.parameters,
|
|
19
|
+
});
|
|
13
20
|
}
|
|
14
21
|
as(alias) {
|
|
15
22
|
return new AliasedRawBuilder(this, alias);
|