@technicity/data-service-generator 0.4.7 → 0.5.0
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/{generate.d.ts → generation/generate.d.ts} +1 -1
- package/dist/{generate.js → generation/generate.js} +82 -63
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{CustomError.d.ts → lib/CustomError.d.ts} +0 -0
- package/dist/{CustomError.js → lib/CustomError.js} +0 -0
- package/dist/{getDuplicates.d.ts → lib/getDuplicates.d.ts} +0 -0
- package/dist/{getDuplicates.js → lib/getDuplicates.js} +0 -0
- package/dist/{isNotNullOrUndefined.d.ts → lib/isNotNullOrUndefined.d.ts} +0 -0
- package/dist/{isNotNullOrUndefined.js → lib/isNotNullOrUndefined.js} +0 -0
- package/dist/runtime/IRuntime.d.ts +156 -43
- package/dist/runtime/RuntimeKSQL.d.ts +11 -11
- package/dist/runtime/RuntimeKSQL.js +28 -23
- package/dist/runtime/RuntimeMSSQL.d.ts +6 -11
- package/dist/runtime/RuntimeMSSQL.js +16 -53
- package/dist/runtime/RuntimeMySQL.d.ts +5 -10
- package/dist/runtime/RuntimeMySQL.js +19 -49
- package/dist/runtime/{__MSSQL.d.ts → lib/MSSQL.d.ts} +0 -0
- package/dist/runtime/{__MSSQL.js → lib/MSSQL.js} +0 -0
- package/dist/{SDKNotFoundError.d.ts → runtime/lib/SDKNotFoundError.d.ts} +1 -1
- package/dist/{SDKNotFoundError.js → runtime/lib/SDKNotFoundError.js} +1 -1
- package/dist/{addNullFallbacks.d.ts → runtime/lib/addNullFallbacks.d.ts} +0 -0
- package/dist/{addNullFallbacks.js → runtime/lib/addNullFallbacks.js} +0 -0
- package/dist/{cursor.d.ts → runtime/lib/cursor.d.ts} +0 -0
- package/dist/{cursor.js → runtime/lib/cursor.js} +0 -0
- package/dist/{getDateTimeStringMySQL.d.ts → runtime/lib/getDateTimeStringMySQL.d.ts} +0 -0
- package/dist/{getDateTimeStringMySQL.js → runtime/lib/getDateTimeStringMySQL.js} +0 -0
- package/dist/{getOrderBy.d.ts → runtime/lib/getOrderBy.d.ts} +1 -1
- package/dist/{getOrderBy.js → runtime/lib/getOrderBy.js} +0 -0
- package/dist/{getSqlAst.d.ts → runtime/lib/getSqlAst.d.ts} +1 -1
- package/dist/{getSqlAst.js → runtime/lib/getSqlAst.js} +0 -0
- package/dist/{getWhere.d.ts → runtime/lib/getWhere.d.ts} +1 -1
- package/dist/{getWhere.js → runtime/lib/getWhere.js} +0 -0
- package/dist/{runTransforms.d.ts → runtime/lib/runTransforms.d.ts} +1 -1
- package/dist/{runTransforms.js → runtime/lib/runTransforms.js} +0 -0
- package/dist/runtime/lib/shared.d.ts +12 -0
- package/dist/runtime/{__shared.js → lib/shared.js} +139 -94
- package/dist/{stringifyWhere.d.ts → runtime/lib/stringifyWhere.d.ts} +1 -1
- package/dist/{stringifyWhere.js → runtime/lib/stringifyWhere.js} +0 -0
- package/dist/runtime/{__typeCastMSSQL.d.ts → lib/typeCastMSSQL.d.ts} +0 -0
- package/dist/runtime/{__typeCastMSSQL.js → lib/typeCastMSSQL.js} +0 -0
- package/package.json +2 -1
- package/dist/runtime/__shared.d.ts +0 -32
- package/dist/types.d.ts +0 -142
- package/dist/types.js +0 -2
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type { IRuntime,
|
|
2
|
-
import type { IArtifacts, ISupplementClientOpts } from "../types";
|
|
1
|
+
import type { IRuntime, TMiddleware, TResolveParams, IArtifacts, ISupplementClientOpts } from "./IRuntime";
|
|
3
2
|
import { KSQL } from "../ksql";
|
|
4
|
-
import { MSSQL } from "./
|
|
3
|
+
import { MSSQL } from "./lib/MSSQL";
|
|
5
4
|
export declare class RuntimeKSQL implements IRuntime {
|
|
6
5
|
#private;
|
|
7
6
|
constructor(clientOpts: ConstructorParameters<typeof KSQL>[0], otherOpts: {
|
|
8
7
|
mssql: ConstructorParameters<typeof MSSQL>[0];
|
|
9
8
|
supplementClientOpts?: ISupplementClientOpts;
|
|
10
9
|
}, artifacts: IArtifacts);
|
|
11
|
-
resolve(input:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
resolve(input: TResolveParams): Promise<any>;
|
|
11
|
+
$use(middleware: TMiddleware): Promise<void>;
|
|
12
|
+
$whereNeedsProcessing(where: any): boolean;
|
|
13
|
+
$prepareWhere(artifacts: IArtifacts, table: string, data: any): Promise<{}>;
|
|
14
|
+
private post;
|
|
15
|
+
private patch;
|
|
16
|
+
private patchList;
|
|
17
|
+
private del;
|
|
18
|
+
private deleteList;
|
|
19
19
|
}
|
|
@@ -12,23 +12,25 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
}
|
|
13
13
|
return privateMap.get(receiver);
|
|
14
14
|
};
|
|
15
|
-
var _ksql, _mssqlClient, _tableKeyMap;
|
|
15
|
+
var _ksql, _mssqlClient, _middlewareHandler, _tableKeyMap;
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.RuntimeKSQL = void 0;
|
|
18
18
|
const SqlString = require("sqlstring");
|
|
19
|
-
const
|
|
20
|
-
const getWhere_1 = require("
|
|
19
|
+
const shared_1 = require("./lib/shared");
|
|
20
|
+
const getWhere_1 = require("./lib/getWhere");
|
|
21
21
|
const ksql_1 = require("../ksql");
|
|
22
|
-
const SDKNotFoundError_1 = require("
|
|
23
|
-
const
|
|
24
|
-
const
|
|
22
|
+
const SDKNotFoundError_1 = require("./lib/SDKNotFoundError");
|
|
23
|
+
const MSSQL_1 = require("./lib/MSSQL");
|
|
24
|
+
const typeCastMSSQL_1 = require("./lib/typeCastMSSQL");
|
|
25
25
|
class RuntimeKSQL {
|
|
26
26
|
constructor(clientOpts, otherOpts, artifacts) {
|
|
27
27
|
_ksql.set(this, void 0);
|
|
28
28
|
_mssqlClient.set(this, void 0);
|
|
29
|
+
_middlewareHandler.set(this, void 0);
|
|
29
30
|
_tableKeyMap.set(this, void 0);
|
|
30
31
|
__classPrivateFieldSet(this, _ksql, new ksql_1.KSQL(clientOpts));
|
|
31
|
-
__classPrivateFieldSet(this, _mssqlClient, new
|
|
32
|
+
__classPrivateFieldSet(this, _mssqlClient, new MSSQL_1.MSSQL(otherOpts.mssql, otherOpts?.supplementClientOpts ? typeCastMSSQL_1.typeCastMSSQL() : undefined));
|
|
33
|
+
__classPrivateFieldSet(this, _middlewareHandler, new shared_1.MiddlewareHandler());
|
|
32
34
|
__classPrivateFieldSet(this, _tableKeyMap, {});
|
|
33
35
|
for (let table in artifacts) {
|
|
34
36
|
let map = {};
|
|
@@ -39,35 +41,35 @@ class RuntimeKSQL {
|
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
async resolve(input) {
|
|
42
|
-
if (input.
|
|
43
|
-
const primaryKey = input.artifacts[input.
|
|
44
|
+
if (input.action === "findMany" || input.action === "findManyPaginated") {
|
|
45
|
+
const primaryKey = input.artifacts[input.resource].primaryKey;
|
|
44
46
|
// Overwrite
|
|
45
47
|
input.fields = [primaryKey];
|
|
46
|
-
const resolved = await
|
|
47
|
-
const keys = input.
|
|
48
|
+
const resolved = await shared_1.resolve(input, __classPrivateFieldGet(this, _mssqlClient).dbCall.bind(__classPrivateFieldGet(this, _mssqlClient)), __classPrivateFieldGet(this, _mssqlClient).formatQuery.bind(__classPrivateFieldGet(this, _mssqlClient)), "mssql", __classPrivateFieldGet(this, _middlewareHandler));
|
|
49
|
+
const keys = input.action === "findMany"
|
|
48
50
|
? resolved.map((x) => x[primaryKey])
|
|
49
51
|
: resolved.results.map((x) => x[primaryKey]);
|
|
50
52
|
if (keys.length === 0) {
|
|
51
53
|
return resolved;
|
|
52
54
|
}
|
|
53
55
|
const sql = SqlString.format("SELECT * FROM ?? WHERE ?? IN (?);", [
|
|
54
|
-
getKSQLTablename(input.
|
|
56
|
+
getKSQLTablename(input.resource),
|
|
55
57
|
primaryKey.toLocaleUpperCase(),
|
|
56
58
|
keys,
|
|
57
59
|
]);
|
|
58
60
|
const results = await __classPrivateFieldGet(this, _ksql).streamQuery(sql);
|
|
59
61
|
for (let x of results) {
|
|
60
|
-
mapKeys(x, __classPrivateFieldGet(this, _tableKeyMap)[input.
|
|
62
|
+
mapKeys(x, __classPrivateFieldGet(this, _tableKeyMap)[input.resource]);
|
|
61
63
|
}
|
|
62
|
-
if (input.
|
|
64
|
+
if (input.action == "findMany") {
|
|
63
65
|
return results;
|
|
64
66
|
}
|
|
65
67
|
resolved.results = results;
|
|
66
68
|
return resolved;
|
|
67
69
|
}
|
|
68
70
|
else {
|
|
69
|
-
const table = input.
|
|
70
|
-
const tableKSQL = getKSQLTablename(input.
|
|
71
|
+
const table = input.resource;
|
|
72
|
+
const tableKSQL = getKSQLTablename(input.resource);
|
|
71
73
|
if (input.args?.$where) {
|
|
72
74
|
for (let k in input.args.$where) {
|
|
73
75
|
input.args.$where[k.toLocaleUpperCase()] = input.args.$where[k];
|
|
@@ -89,6 +91,15 @@ class RuntimeKSQL {
|
|
|
89
91
|
return out;
|
|
90
92
|
}
|
|
91
93
|
}
|
|
94
|
+
async $use(middleware) {
|
|
95
|
+
__classPrivateFieldGet(this, _middlewareHandler).register(middleware);
|
|
96
|
+
}
|
|
97
|
+
$whereNeedsProcessing(where) {
|
|
98
|
+
return shared_1.whereNeedsProcessing(where);
|
|
99
|
+
}
|
|
100
|
+
async $prepareWhere(artifacts, table, data) {
|
|
101
|
+
return shared_1._prepareWhere(artifacts, table, data, __classPrivateFieldGet(this, _mssqlClient).dbCall.bind(__classPrivateFieldGet(this, _mssqlClient)), __classPrivateFieldGet(this, _mssqlClient).formatQuery.bind(__classPrivateFieldGet(this, _mssqlClient)));
|
|
102
|
+
}
|
|
92
103
|
async post(input) {
|
|
93
104
|
throw new Error("Not implemented.");
|
|
94
105
|
}
|
|
@@ -104,15 +115,9 @@ class RuntimeKSQL {
|
|
|
104
115
|
async deleteList(input) {
|
|
105
116
|
throw new Error("Not implemented.");
|
|
106
117
|
}
|
|
107
|
-
whereNeedsProcessing(where) {
|
|
108
|
-
return __shared_1.whereNeedsProcessing(where);
|
|
109
|
-
}
|
|
110
|
-
async _prepareWhere(artifacts, table, data) {
|
|
111
|
-
return __shared_1._prepareWhere(artifacts, table, data, __classPrivateFieldGet(this, _mssqlClient).dbCall.bind(__classPrivateFieldGet(this, _mssqlClient)), __classPrivateFieldGet(this, _mssqlClient).formatQuery.bind(__classPrivateFieldGet(this, _mssqlClient)));
|
|
112
|
-
}
|
|
113
118
|
}
|
|
114
119
|
exports.RuntimeKSQL = RuntimeKSQL;
|
|
115
|
-
_ksql = new WeakMap(), _mssqlClient = new WeakMap(), _tableKeyMap = new WeakMap();
|
|
120
|
+
_ksql = new WeakMap(), _mssqlClient = new WeakMap(), _middlewareHandler = new WeakMap(), _tableKeyMap = new WeakMap();
|
|
116
121
|
function getKSQLTablename(tablename) {
|
|
117
122
|
return `${tablename.toLocaleUpperCase()}_TAB`;
|
|
118
123
|
}
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import * as mssql from "mssql";
|
|
2
|
-
import type { IRuntime,
|
|
3
|
-
import
|
|
4
|
-
import { typeCastMSSQL } from "./__typeCastMSSQL";
|
|
2
|
+
import type { IRuntime, TMiddleware, TResolveParams, IArtifacts, ISupplementClientOpts } from "./IRuntime";
|
|
3
|
+
import { typeCastMSSQL } from "./lib/typeCastMSSQL";
|
|
5
4
|
export declare class RuntimeMSSQL implements IRuntime {
|
|
6
5
|
#private;
|
|
7
6
|
constructor(clientOpts: mssql.config, otherOpts: {
|
|
8
7
|
supplementClientOpts?: ISupplementClientOpts;
|
|
9
8
|
typeCast?: Parameters<typeof typeCastMSSQL>[0];
|
|
10
9
|
}, artifacts: IArtifacts);
|
|
11
|
-
resolve(input:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
del(input: TDelInput): Promise<boolean>;
|
|
16
|
-
deleteList(input: TDeleteListInput): Promise<boolean>;
|
|
17
|
-
whereNeedsProcessing(where: any): boolean;
|
|
18
|
-
_prepareWhere(artifacts: IArtifacts, table: string, data: any): Promise<{}>;
|
|
10
|
+
resolve(input: TResolveParams): Promise<any>;
|
|
11
|
+
$use(middleware: TMiddleware): Promise<void>;
|
|
12
|
+
$whereNeedsProcessing(where: any): boolean;
|
|
13
|
+
$prepareWhere(artifacts: IArtifacts, table: string, data: any): Promise<{}>;
|
|
19
14
|
private dbCall;
|
|
20
15
|
private formatQuery;
|
|
21
16
|
}
|
|
@@ -12,70 +12,33 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
}
|
|
13
13
|
return privateMap.get(receiver);
|
|
14
14
|
};
|
|
15
|
-
var _dialect, _mssqlClient;
|
|
15
|
+
var _dialect, _mssqlClient, _middlewareHandler;
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.RuntimeMSSQL = void 0;
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
18
|
+
const shared_1 = require("./lib/shared");
|
|
19
|
+
const MSSQL_1 = require("./lib/MSSQL");
|
|
20
|
+
const typeCastMSSQL_1 = require("./lib/typeCastMSSQL");
|
|
21
21
|
class RuntimeMSSQL {
|
|
22
22
|
constructor(clientOpts, otherOpts, artifacts) {
|
|
23
23
|
_dialect.set(this, "mssql");
|
|
24
24
|
_mssqlClient.set(this, void 0);
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
_middlewareHandler.set(this, void 0);
|
|
26
|
+
__classPrivateFieldSet(this, _mssqlClient, new MSSQL_1.MSSQL(clientOpts, otherOpts?.supplementClientOpts
|
|
27
|
+
? typeCastMSSQL_1.typeCastMSSQL(otherOpts?.typeCast)
|
|
27
28
|
: undefined));
|
|
29
|
+
__classPrivateFieldSet(this, _middlewareHandler, new shared_1.MiddlewareHandler());
|
|
28
30
|
}
|
|
29
31
|
async resolve(input) {
|
|
30
|
-
return
|
|
31
|
-
dialect: __classPrivateFieldGet(this, _dialect),
|
|
32
|
-
});
|
|
32
|
+
return shared_1.resolve(input, this.dbCall.bind(this), this.formatQuery.bind(this), __classPrivateFieldGet(this, _dialect), __classPrivateFieldGet(this, _middlewareHandler));
|
|
33
33
|
}
|
|
34
|
-
async
|
|
35
|
-
|
|
36
|
-
...input,
|
|
37
|
-
dbCall: this.dbCall.bind(this),
|
|
38
|
-
formatQuery: this.formatQuery.bind(this),
|
|
39
|
-
dialect: __classPrivateFieldGet(this, _dialect),
|
|
40
|
-
});
|
|
34
|
+
async $use(middleware) {
|
|
35
|
+
__classPrivateFieldGet(this, _middlewareHandler).register(middleware);
|
|
41
36
|
}
|
|
42
|
-
|
|
43
|
-
return
|
|
44
|
-
...input,
|
|
45
|
-
dbCall: this.dbCall.bind(this),
|
|
46
|
-
formatQuery: this.formatQuery.bind(this),
|
|
47
|
-
dialect: __classPrivateFieldGet(this, _dialect),
|
|
48
|
-
});
|
|
37
|
+
$whereNeedsProcessing(where) {
|
|
38
|
+
return shared_1.whereNeedsProcessing(where);
|
|
49
39
|
}
|
|
50
|
-
async
|
|
51
|
-
return
|
|
52
|
-
...input,
|
|
53
|
-
dbCall: this.dbCall.bind(this),
|
|
54
|
-
formatQuery: this.formatQuery.bind(this),
|
|
55
|
-
dialect: __classPrivateFieldGet(this, _dialect),
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
async del(input) {
|
|
59
|
-
return __shared_1.del({
|
|
60
|
-
...input,
|
|
61
|
-
dbCall: this.dbCall.bind(this),
|
|
62
|
-
formatQuery: this.formatQuery.bind(this),
|
|
63
|
-
dialect: __classPrivateFieldGet(this, _dialect),
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
async deleteList(input) {
|
|
67
|
-
return __shared_1.deleteList({
|
|
68
|
-
...input,
|
|
69
|
-
dbCall: this.dbCall.bind(this),
|
|
70
|
-
formatQuery: this.formatQuery.bind(this),
|
|
71
|
-
dialect: __classPrivateFieldGet(this, _dialect),
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
whereNeedsProcessing(where) {
|
|
75
|
-
return __shared_1.whereNeedsProcessing(where);
|
|
76
|
-
}
|
|
77
|
-
async _prepareWhere(artifacts, table, data) {
|
|
78
|
-
return __shared_1._prepareWhere(artifacts, table, data, this.dbCall.bind(this), this.formatQuery.bind(this));
|
|
40
|
+
async $prepareWhere(artifacts, table, data) {
|
|
41
|
+
return shared_1._prepareWhere(artifacts, table, data, this.dbCall.bind(this), this.formatQuery.bind(this));
|
|
79
42
|
}
|
|
80
43
|
async dbCall(q) {
|
|
81
44
|
return __classPrivateFieldGet(this, _mssqlClient).dbCall(q);
|
|
@@ -85,4 +48,4 @@ class RuntimeMSSQL {
|
|
|
85
48
|
}
|
|
86
49
|
}
|
|
87
50
|
exports.RuntimeMSSQL = RuntimeMSSQL;
|
|
88
|
-
_dialect = new WeakMap(), _mssqlClient = new WeakMap();
|
|
51
|
+
_dialect = new WeakMap(), _mssqlClient = new WeakMap(), _middlewareHandler = new WeakMap();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { IRuntime,
|
|
2
|
-
import type { IArtifacts, ISupplementClientOpts } from "../types";
|
|
1
|
+
import type { IRuntime, TMiddleware, TResolveParams, IArtifacts, ISupplementClientOpts } from "./IRuntime";
|
|
3
2
|
export declare class RuntimeMySQL implements IRuntime {
|
|
4
3
|
#private;
|
|
5
4
|
constructor(clientOpts: {
|
|
@@ -7,14 +6,10 @@ export declare class RuntimeMySQL implements IRuntime {
|
|
|
7
6
|
}, otherOpts: {
|
|
8
7
|
supplementClientOpts?: ISupplementClientOpts;
|
|
9
8
|
}, artifacts: IArtifacts);
|
|
10
|
-
resolve(input:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
del(input: TDelInput): Promise<boolean>;
|
|
15
|
-
deleteList(input: TDeleteListInput): Promise<boolean>;
|
|
16
|
-
whereNeedsProcessing(where: any): boolean;
|
|
17
|
-
_prepareWhere(artifacts: IArtifacts, table: string, data: any): Promise<{}>;
|
|
9
|
+
resolve(input: TResolveParams): Promise<any>;
|
|
10
|
+
$use(middleware: TMiddleware): Promise<void>;
|
|
11
|
+
$whereNeedsProcessing(where: any): boolean;
|
|
12
|
+
$prepareWhere(artifacts: IArtifacts, table: string, data: any): Promise<{}>;
|
|
18
13
|
private dbCall;
|
|
19
14
|
private formatQuery;
|
|
20
15
|
}
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
|
|
3
|
+
if (!privateMap.has(receiver)) {
|
|
4
|
+
throw new TypeError("attempted to set private field on non-instance");
|
|
5
|
+
}
|
|
6
|
+
privateMap.set(receiver, value);
|
|
7
|
+
return value;
|
|
8
|
+
};
|
|
2
9
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
|
|
3
10
|
if (!privateMap.has(receiver)) {
|
|
4
11
|
throw new TypeError("attempted to get private field on non-instance");
|
|
5
12
|
}
|
|
6
13
|
return privateMap.get(receiver);
|
|
7
14
|
};
|
|
8
|
-
var _dialect;
|
|
15
|
+
var _dialect, _middlewareHandler;
|
|
9
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
17
|
exports.RuntimeMySQL = void 0;
|
|
11
18
|
const SqlString = require("sqlstring");
|
|
12
19
|
const mysql_1 = require("../mysql");
|
|
13
|
-
const
|
|
20
|
+
const shared_1 = require("./lib/shared");
|
|
14
21
|
class RuntimeMySQL {
|
|
15
22
|
constructor(clientOpts, otherOpts, artifacts) {
|
|
16
23
|
_dialect.set(this, "mysql");
|
|
24
|
+
_middlewareHandler.set(this, void 0);
|
|
25
|
+
__classPrivateFieldSet(this, _middlewareHandler, new shared_1.MiddlewareHandler());
|
|
17
26
|
if (otherOpts.supplementClientOpts) {
|
|
18
27
|
clientOpts = {
|
|
19
28
|
supportBigNumbers: true,
|
|
@@ -56,55 +65,16 @@ class RuntimeMySQL {
|
|
|
56
65
|
mysql_1.init(clientOpts);
|
|
57
66
|
}
|
|
58
67
|
async resolve(input) {
|
|
59
|
-
return
|
|
60
|
-
dialect: __classPrivateFieldGet(this, _dialect),
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
async post(input) {
|
|
64
|
-
return __shared_1.post({
|
|
65
|
-
...input,
|
|
66
|
-
dbCall: this.dbCall.bind(this),
|
|
67
|
-
formatQuery: this.formatQuery.bind(this),
|
|
68
|
-
dialect: __classPrivateFieldGet(this, _dialect),
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
async patch(input) {
|
|
72
|
-
return __shared_1.patch({
|
|
73
|
-
...input,
|
|
74
|
-
dbCall: this.dbCall.bind(this),
|
|
75
|
-
formatQuery: this.formatQuery.bind(this),
|
|
76
|
-
dialect: __classPrivateFieldGet(this, _dialect),
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
async patchList(input) {
|
|
80
|
-
return __shared_1.patchList({
|
|
81
|
-
...input,
|
|
82
|
-
dbCall: this.dbCall.bind(this),
|
|
83
|
-
formatQuery: this.formatQuery.bind(this),
|
|
84
|
-
dialect: __classPrivateFieldGet(this, _dialect),
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
async del(input) {
|
|
88
|
-
return __shared_1.del({
|
|
89
|
-
...input,
|
|
90
|
-
dbCall: this.dbCall.bind(this),
|
|
91
|
-
formatQuery: this.formatQuery.bind(this),
|
|
92
|
-
dialect: __classPrivateFieldGet(this, _dialect),
|
|
93
|
-
});
|
|
68
|
+
return shared_1.resolve(input, this.dbCall.bind(this), this.formatQuery.bind(this), __classPrivateFieldGet(this, _dialect), __classPrivateFieldGet(this, _middlewareHandler));
|
|
94
69
|
}
|
|
95
|
-
async
|
|
96
|
-
|
|
97
|
-
...input,
|
|
98
|
-
dbCall: this.dbCall.bind(this),
|
|
99
|
-
formatQuery: this.formatQuery.bind(this),
|
|
100
|
-
dialect: __classPrivateFieldGet(this, _dialect),
|
|
101
|
-
});
|
|
70
|
+
async $use(middleware) {
|
|
71
|
+
__classPrivateFieldGet(this, _middlewareHandler).register(middleware);
|
|
102
72
|
}
|
|
103
|
-
whereNeedsProcessing(where) {
|
|
104
|
-
return
|
|
73
|
+
$whereNeedsProcessing(where) {
|
|
74
|
+
return shared_1.whereNeedsProcessing(where);
|
|
105
75
|
}
|
|
106
|
-
async
|
|
107
|
-
return
|
|
76
|
+
async $prepareWhere(artifacts, table, data) {
|
|
77
|
+
return shared_1._prepareWhere(artifacts, table, data, this.dbCall.bind(this), this.formatQuery.bind(this));
|
|
108
78
|
}
|
|
109
79
|
dbCall(q) {
|
|
110
80
|
return mysql_1.query(q);
|
|
@@ -114,4 +84,4 @@ class RuntimeMySQL {
|
|
|
114
84
|
}
|
|
115
85
|
}
|
|
116
86
|
exports.RuntimeMySQL = RuntimeMySQL;
|
|
117
|
-
_dialect = new WeakMap();
|
|
87
|
+
_dialect = new WeakMap(), _middlewareHandler = new WeakMap();
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SDKNotFoundError = void 0;
|
|
4
|
-
const CustomError_1 = require("
|
|
4
|
+
const CustomError_1 = require("../../lib/CustomError");
|
|
5
5
|
class SDKNotFoundError extends CustomError_1.CustomError {
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Not found");
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IGetSQLASTInput } from "
|
|
1
|
+
import { IGetSQLASTInput } from "../IRuntime";
|
|
2
2
|
export declare function getSqlAst(input: IGetSQLASTInput): any;
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { IOrderBy, IDialect } from "
|
|
1
|
+
import type { IOrderBy, IDialect } from "../IRuntime";
|
|
2
2
|
export declare function getWhere(table: string, args: any, dialect: IDialect, orderBy?: IOrderBy | undefined, rowWithMatchingCursor?: any): string | null;
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { IGetSQLASTInput } from "
|
|
1
|
+
import type { IGetSQLASTInput } from "../IRuntime";
|
|
2
2
|
export declare function runTransforms(data: any, fields: IGetSQLASTInput["fields"]): void;
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IArtifacts, IDialect, TDbCall, TFormatQuery } from "../IRuntime";
|
|
2
|
+
import type { TMiddleware, TResolveParams } from "../IRuntime";
|
|
3
|
+
export declare function resolve(input: TResolveParams, dbCall: TDbCall, formatQuery: TFormatQuery, dialect: IDialect, middlewareHandler: MiddlewareHandler<TMiddleware>): Promise<any>;
|
|
4
|
+
export declare class MiddlewareHandler<M extends Function> {
|
|
5
|
+
private _middlewares;
|
|
6
|
+
register(middleware: M): void;
|
|
7
|
+
get(id: number): M | undefined;
|
|
8
|
+
has(id: number): boolean;
|
|
9
|
+
length(): number;
|
|
10
|
+
}
|
|
11
|
+
export declare function whereNeedsProcessing(where: any): boolean;
|
|
12
|
+
export declare function _prepareWhere(artifacts: IArtifacts, table: string, data: any, dbCall: TDbCall, formatQuery: TFormatQuery): Promise<{}>;
|