miqro 7.2.1 → 7.2.3
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 +871 -492
- package/build/editor.bundle.js +44 -12
- package/build/esm/editor/http/admin/editor/api/fs/delete.api.d.ts +3 -2
- package/build/esm/editor/http/admin/editor/api/fs/delete.api.js +3 -3
- package/build/esm/editor/http/admin/editor/api/fs/delete.api.js.map +1 -1
- package/build/esm/editor/http/admin/editor/api/fs/read.api.d.ts +3 -1
- package/build/esm/editor/http/admin/editor/api/fs/read.api.js +3 -3
- package/build/esm/editor/http/admin/editor/api/fs/read.api.js.map +1 -1
- package/build/esm/editor/http/admin/editor/api/fs/rename.api.d.ts +4 -1
- package/build/esm/editor/http/admin/editor/api/fs/rename.api.js +3 -3
- package/build/esm/editor/http/admin/editor/api/fs/rename.api.js.map +1 -1
- package/build/esm/src/cluster.js +0 -0
- package/build/esm/src/common/jsx.d.ts +3 -3
- package/build/esm/src/common/jsx.js.map +1 -1
- package/build/esm/src/inflate/inflate-sea.js +2 -2
- package/build/esm/src/inflate/inflate-sea.js.map +1 -1
- package/build/esm/src/inflate/setup-http.js.map +1 -1
- package/build/esm/src/main.js +0 -0
- package/build/esm/src/services/editor.js.map +1 -1
- package/build/esm/src/services/utils/cluster-ws.js +2 -2
- package/build/esm/src/services/utils/cluster-ws.js.map +1 -1
- package/build/esm/src/types.d.ts +5 -4
- package/build/esm/src/types.js +4 -1
- package/build/esm/src/types.js.map +1 -1
- package/build/lib.cjs +444 -174
- package/editor/http/admin/editor/api/fs/delete.api.tsx +3 -3
- package/editor/http/admin/editor/api/fs/read.api.tsx +3 -3
- package/editor/http/admin/editor/api/fs/rename.api.tsx +3 -3
- package/package.json +12 -12
- package/sea/install-esbuild.sh +1 -1
- package/sea/install-nodejs.sh +1 -1
- package/sea/node.version.tag +1 -1
- package/src/common/jsx.ts +3 -3
- package/src/inflate/inflate-sea.ts +2 -2
- package/src/inflate/setup-http.ts +4 -4
- package/src/services/editor.tsx +1 -1
- package/src/services/utils/cluster-ws.ts +2 -2
- package/src/types.ts +21 -41
package/build/lib.cjs
CHANGED
|
@@ -640,12 +640,6 @@ var init_lib = __esm({
|
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
parse(arg, options, name = "") {
|
|
643
|
-
if (typeof options === "string") {
|
|
644
|
-
options = {
|
|
645
|
-
type: options,
|
|
646
|
-
required: true
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
643
|
const baseOption = typeof options === "string" ? {
|
|
650
644
|
type: options,
|
|
651
645
|
required: true
|
|
@@ -706,7 +700,7 @@ function ReadBuffer(options) {
|
|
|
706
700
|
limit = parseInt(limitS, 10);
|
|
707
701
|
timeout = parseInt(timeoutS, 10);
|
|
708
702
|
}
|
|
709
|
-
return async function
|
|
703
|
+
return async function ReadBuffer3(req, res) {
|
|
710
704
|
return new Promise((resolve24, reject) => {
|
|
711
705
|
try {
|
|
712
706
|
const readTimeout = setTimeout(() => {
|
|
@@ -780,7 +774,7 @@ function URLEncodedParser(options) {
|
|
|
780
774
|
const readBuffer = ReadBuffer({
|
|
781
775
|
limit
|
|
782
776
|
});
|
|
783
|
-
return async function
|
|
777
|
+
return async function URLEncodedParser3(req, res) {
|
|
784
778
|
try {
|
|
785
779
|
const isType = req.body === void 0 && req.headers["content-type"] ? req.headers["content-type"].toLocaleLowerCase().indexOf(type.toLocaleLowerCase()) !== -1 : false;
|
|
786
780
|
if (isType && !req.buffer) {
|
|
@@ -828,7 +822,7 @@ function JSONParser(options) {
|
|
|
828
822
|
const readBuffer = ReadBuffer({
|
|
829
823
|
limit
|
|
830
824
|
});
|
|
831
|
-
return async function
|
|
825
|
+
return async function JSONParser3(req, res) {
|
|
832
826
|
try {
|
|
833
827
|
const isType = req.body === void 0 && req.headers["content-type"] ? req.headers["content-type"].toLocaleLowerCase().indexOf(type.toLocaleLowerCase()) !== -1 : false;
|
|
834
828
|
if (isType && !req.buffer) {
|
|
@@ -872,7 +866,7 @@ function TextParser(options) {
|
|
|
872
866
|
const readBuffer = ReadBuffer({
|
|
873
867
|
limit
|
|
874
868
|
});
|
|
875
|
-
return async function
|
|
869
|
+
return async function TextParser3(req, res) {
|
|
876
870
|
try {
|
|
877
871
|
const isType = req.body === void 0 && req.headers["content-type"] ? req.headers["content-type"].toLocaleLowerCase().indexOf(type.toLocaleLowerCase()) !== -1 : false;
|
|
878
872
|
if (isType && !req.buffer) {
|
|
@@ -1103,7 +1097,7 @@ var init_body_parser = __esm({
|
|
|
1103
1097
|
origins = origins[0];
|
|
1104
1098
|
}
|
|
1105
1099
|
const validate = options && options.validate ? options && options.validate : isOriginAllowed;
|
|
1106
|
-
return async function
|
|
1100
|
+
return async function CORS3(req, res) {
|
|
1107
1101
|
if (!origins || origins === "*") {
|
|
1108
1102
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
1109
1103
|
res.addVaryHeader("Origin");
|
|
@@ -1206,7 +1200,7 @@ function SessionHandler(config) {
|
|
|
1206
1200
|
const tokenLocation = config.options.tokenLocation;
|
|
1207
1201
|
const tokenLocationName = config.options.tokenLocationName;
|
|
1208
1202
|
const setCookieOptions = config.options.setCookieOptions;
|
|
1209
|
-
return async function
|
|
1203
|
+
return async function SessionHandler3(req, res) {
|
|
1210
1204
|
try {
|
|
1211
1205
|
const tlN = typeof tokenLocationName === "string" ? tokenLocationName : tokenLocationName ? await tokenLocationName(req) : "";
|
|
1212
1206
|
let token = null;
|
|
@@ -1352,6 +1346,9 @@ var init_session = __esm({
|
|
|
1352
1346
|
function isMinimalRouter(obj) {
|
|
1353
1347
|
return typeof obj === "object" && typeof obj.run === "function" && typeof obj.getJSONDoc === "function";
|
|
1354
1348
|
}
|
|
1349
|
+
function defineRoute(route) {
|
|
1350
|
+
return route;
|
|
1351
|
+
}
|
|
1355
1352
|
function pathPartTokenize(token) {
|
|
1356
1353
|
const isWild = token.value[0] === ":";
|
|
1357
1354
|
const optional = token.value[token.value.length - 1] === "?";
|
|
@@ -6797,7 +6794,7 @@ var init_read_api = __esm({
|
|
|
6797
6794
|
import_node_path21 = require("node:path");
|
|
6798
6795
|
init_scan_api();
|
|
6799
6796
|
init_constants_server();
|
|
6800
|
-
read_api_default = {
|
|
6797
|
+
read_api_default = defineRoute({
|
|
6801
6798
|
method: "POST",
|
|
6802
6799
|
path: "/read",
|
|
6803
6800
|
description: "admin editor file read endpoint",
|
|
@@ -6822,7 +6819,7 @@ var init_read_api = __esm({
|
|
|
6822
6819
|
path
|
|
6823
6820
|
});
|
|
6824
6821
|
}
|
|
6825
|
-
};
|
|
6822
|
+
});
|
|
6826
6823
|
}
|
|
6827
6824
|
});
|
|
6828
6825
|
|
|
@@ -6899,7 +6896,7 @@ var init_rename_api = __esm({
|
|
|
6899
6896
|
import_node_fs21 = require("node:fs");
|
|
6900
6897
|
init_read_api();
|
|
6901
6898
|
import_node_path23 = require("node:path");
|
|
6902
|
-
rename_api_default = {
|
|
6899
|
+
rename_api_default = defineRoute({
|
|
6903
6900
|
middleware: [JSONParser()],
|
|
6904
6901
|
method: "POST",
|
|
6905
6902
|
description: "admin editor file rename endpoint",
|
|
@@ -6923,7 +6920,7 @@ var init_rename_api = __esm({
|
|
|
6923
6920
|
message: "OK"
|
|
6924
6921
|
});
|
|
6925
6922
|
}
|
|
6926
|
-
};
|
|
6923
|
+
});
|
|
6927
6924
|
}
|
|
6928
6925
|
});
|
|
6929
6926
|
|
|
@@ -6941,7 +6938,7 @@ var init_delete_api = __esm({
|
|
|
6941
6938
|
init_lib3();
|
|
6942
6939
|
import_node_fs22 = require("node:fs");
|
|
6943
6940
|
init_read_api();
|
|
6944
|
-
delete_api_default = {
|
|
6941
|
+
delete_api_default = defineRoute({
|
|
6945
6942
|
description: "admin editor file deletion endpoint",
|
|
6946
6943
|
method: "POST",
|
|
6947
6944
|
path: "/delete",
|
|
@@ -6964,7 +6961,7 @@ var init_delete_api = __esm({
|
|
|
6964
6961
|
message: "OK"
|
|
6965
6962
|
});
|
|
6966
6963
|
}
|
|
6967
|
-
};
|
|
6964
|
+
});
|
|
6968
6965
|
}
|
|
6969
6966
|
});
|
|
6970
6967
|
|
|
@@ -7145,6 +7142,7 @@ __export(lib_exports3, {
|
|
|
7145
7142
|
appendAPIModule: () => appendAPIModule,
|
|
7146
7143
|
createLogProviderOptions: () => createLogProviderOptions,
|
|
7147
7144
|
createServerInterface: () => createServerInterface,
|
|
7145
|
+
defineRoute: () => defineRoute2,
|
|
7148
7146
|
jsx: () => lib_exports,
|
|
7149
7147
|
jsx2HTML: () => jsx2HTML,
|
|
7150
7148
|
jwt: () => jwt,
|
|
@@ -8881,22 +8879,25 @@ function HTMLEncode(str) {
|
|
|
8881
8879
|
function AttributeEncode(str) {
|
|
8882
8880
|
return str.replaceAll('"', """);
|
|
8883
8881
|
}
|
|
8882
|
+
var containerMap = /* @__PURE__ */ new WeakMap();
|
|
8883
|
+
var originalChildNodesMap = /* @__PURE__ */ new WeakMap();
|
|
8884
8884
|
function runtimeDefine(runtime, tagName, component, options) {
|
|
8885
|
-
let container = null;
|
|
8886
|
-
let originalChildNodes = [];
|
|
8887
8885
|
runtime.customElementMap[tagName] = class extends SSRHTMLElement {
|
|
8888
8886
|
constructor() {
|
|
8889
8887
|
super(tagName, runtime);
|
|
8890
|
-
container = runtime.createContainer(this, {
|
|
8888
|
+
const container = runtime.createContainer(this, {
|
|
8891
8889
|
shadowInit: options?.shadowInit,
|
|
8892
8890
|
runtimeOptions: options?.runtimeOptions
|
|
8893
8891
|
});
|
|
8892
|
+
containerMap.set(this, container);
|
|
8894
8893
|
}
|
|
8895
8894
|
connectedCallback() {
|
|
8895
|
+
const container = containerMap.get(this);
|
|
8896
8896
|
if (!container) {
|
|
8897
8897
|
throw new Error("cannot find container!");
|
|
8898
8898
|
}
|
|
8899
8899
|
this.reCalculateOriginalChildren();
|
|
8900
|
+
const originalChildNodes = originalChildNodesMap.get(this);
|
|
8900
8901
|
const props = {};
|
|
8901
8902
|
const self = this;
|
|
8902
8903
|
for (const name of self.getAttributeNames()) {
|
|
@@ -8906,12 +8907,18 @@ function runtimeDefine(runtime, tagName, component, options) {
|
|
|
8906
8907
|
container.render(createElement(component, props, originalChildNodes));
|
|
8907
8908
|
}
|
|
8908
8909
|
disconnectedCallback() {
|
|
8910
|
+
const container = containerMap.get(this);
|
|
8909
8911
|
if (!container) {
|
|
8910
8912
|
throw new Error("cannot find container!");
|
|
8911
8913
|
}
|
|
8912
8914
|
container.disconnect();
|
|
8913
8915
|
}
|
|
8914
8916
|
attributeChangedCallback() {
|
|
8917
|
+
const container = containerMap.get(this);
|
|
8918
|
+
const originalChildNodes = originalChildNodesMap.get(this);
|
|
8919
|
+
if (!container || !originalChildNodesMap.has(this)) {
|
|
8920
|
+
return;
|
|
8921
|
+
}
|
|
8915
8922
|
if (!container) {
|
|
8916
8923
|
throw new Error("cannot find container!");
|
|
8917
8924
|
}
|
|
@@ -8924,13 +8931,22 @@ function runtimeDefine(runtime, tagName, component, options) {
|
|
|
8924
8931
|
container.render(createElement(component, props, originalChildNodes));
|
|
8925
8932
|
}
|
|
8926
8933
|
reCalculateOriginalChildren() {
|
|
8927
|
-
|
|
8934
|
+
if (originalChildNodesMap.has(this)) {
|
|
8935
|
+
return;
|
|
8936
|
+
}
|
|
8937
|
+
const originalChildNodes = [];
|
|
8938
|
+
if (!originalChildNodes) {
|
|
8939
|
+
return;
|
|
8940
|
+
}
|
|
8928
8941
|
const self = this;
|
|
8929
8942
|
for (let i = 0; i < self.childNodes.length; i++) {
|
|
8930
8943
|
const node = self.childNodes[i];
|
|
8931
|
-
node.remove();
|
|
8932
8944
|
originalChildNodes.push(node);
|
|
8933
8945
|
}
|
|
8946
|
+
for (const o of originalChildNodes) {
|
|
8947
|
+
o.remove();
|
|
8948
|
+
}
|
|
8949
|
+
originalChildNodesMap.set(this, originalChildNodes);
|
|
8934
8950
|
}
|
|
8935
8951
|
getProps() {
|
|
8936
8952
|
const props = {};
|
|
@@ -9825,7 +9841,7 @@ function sqlite3ExecutorPrepare(args) {
|
|
|
9825
9841
|
const where = getWhereStatement(q);
|
|
9826
9842
|
const returing = q._returning.length === 0 ? "*" : q._returning.join(",");
|
|
9827
9843
|
const whereSQL = where.sql !== "" ? ` WHERE ${where.sql}` : "";
|
|
9828
|
-
const sql = `DELETE FROM ${q._table}${whereSQL}${getOrderBy(q._orderBy)}${getLimit(q._limitBy, q._offsetBy)} RETURNING ${returing}`;
|
|
9844
|
+
const sql = `DELETE FROM "${q._table}"${whereSQL}${getOrderBy(q._orderBy)}${getLimit(q._limitBy, q._offsetBy)} RETURNING ${returing}`;
|
|
9829
9845
|
return {
|
|
9830
9846
|
sql,
|
|
9831
9847
|
values: where.values
|
|
@@ -9833,22 +9849,22 @@ function sqlite3ExecutorPrepare(args) {
|
|
|
9833
9849
|
}
|
|
9834
9850
|
case "create-database": {
|
|
9835
9851
|
const q = args;
|
|
9836
|
-
const sql = `CREATE DATABASE ${q._dbName}`;
|
|
9852
|
+
const sql = `CREATE DATABASE "${q._dbName}"`;
|
|
9837
9853
|
return sql;
|
|
9838
9854
|
}
|
|
9839
9855
|
case "create-table": {
|
|
9840
9856
|
const q = args;
|
|
9841
|
-
const sql = `CREATE TABLE${q._ignoreDuplicate ? " IF NOT EXISTS" : ""} ${q._table}${getCreateTableColumns(q._definition)}`;
|
|
9857
|
+
const sql = `CREATE TABLE${q._ignoreDuplicate ? " IF NOT EXISTS" : ""} "${q._table}"${getCreateTableColumns(q._definition)}`;
|
|
9842
9858
|
return sql;
|
|
9843
9859
|
}
|
|
9844
9860
|
case "drop-database": {
|
|
9845
9861
|
const q = args;
|
|
9846
|
-
const sql = `DROP DATABASE${q._ignoreDuplicate ? " IF EXISTS" : ""} ${q._dbName}`;
|
|
9862
|
+
const sql = `DROP DATABASE${q._ignoreDuplicate ? " IF EXISTS" : ""} "${q._dbName}"`;
|
|
9847
9863
|
return sql;
|
|
9848
9864
|
}
|
|
9849
9865
|
case "drop-table": {
|
|
9850
9866
|
const q = args;
|
|
9851
|
-
const sql = `DROP TABLE${q._ignoreDuplicate ? " IF EXISTS" : ""} ${q._table}`;
|
|
9867
|
+
const sql = `DROP TABLE${q._ignoreDuplicate ? " IF EXISTS" : ""} "${q._table}"`;
|
|
9852
9868
|
return sql;
|
|
9853
9869
|
}
|
|
9854
9870
|
case "alter-table": {
|
|
@@ -9867,17 +9883,17 @@ function sqlite3ExecutorPrepare(args) {
|
|
|
9867
9883
|
throw new Error("unsupported alter action add without definition");
|
|
9868
9884
|
}
|
|
9869
9885
|
alters.push({
|
|
9870
|
-
sql: `ALTER TABLE ${q._table} ADD COLUMN ${getCreateTableColumn(l._column, l._definition, [])}`
|
|
9886
|
+
sql: `ALTER TABLE "${q._table}" ADD COLUMN ${getCreateTableColumn(l._column, l._definition, [])}`
|
|
9871
9887
|
});
|
|
9872
9888
|
break;
|
|
9873
9889
|
case "drop":
|
|
9874
9890
|
alters.push({
|
|
9875
|
-
sql: `ALTER TABLE ${q._table} DROP COLUMN ${l._column}`
|
|
9891
|
+
sql: `ALTER TABLE "${q._table}" DROP COLUMN "${l._column}"`
|
|
9876
9892
|
});
|
|
9877
9893
|
break;
|
|
9878
9894
|
case "rename":
|
|
9879
9895
|
alters.push({
|
|
9880
|
-
sql: `ALTER TABLE ${q._table} RENAME COLUMN ${l._column} TO ${l._newName}`
|
|
9896
|
+
sql: `ALTER TABLE "${q._table}" RENAME COLUMN "${l._column}" TO "${l._newName}"`
|
|
9881
9897
|
});
|
|
9882
9898
|
break;
|
|
9883
9899
|
default:
|
|
@@ -9890,7 +9906,7 @@ function sqlite3ExecutorPrepare(args) {
|
|
|
9890
9906
|
const q = args;
|
|
9891
9907
|
const rows = getInsertValues(q._columns, q._values);
|
|
9892
9908
|
const returing = q._returning.length === 0 ? "*" : q._returning.join(",");
|
|
9893
|
-
const sql = `INSERT${q._ignoreDuplicate ? " OR IGNORE" : ""} INTO ${q._table}${getInsertColumns(q._columns)}${rows.sql} RETURNING ${returing}`;
|
|
9909
|
+
const sql = `INSERT${q._ignoreDuplicate ? " OR IGNORE" : ""} INTO "${q._table}"${getInsertColumns(q._columns)}${rows.sql} RETURNING ${returing}`;
|
|
9894
9910
|
return [{
|
|
9895
9911
|
sql,
|
|
9896
9912
|
values: rows.values
|
|
@@ -9901,7 +9917,7 @@ function sqlite3ExecutorPrepare(args) {
|
|
|
9901
9917
|
const isSelect = args._type === "select";
|
|
9902
9918
|
const q = isSelect ? args : args;
|
|
9903
9919
|
const where = getWhereStatement(q);
|
|
9904
|
-
const columnsSQL = isSelect ? `SELECT ${renderNameAS(q._columns)}` : "SELECT count(*) as count";
|
|
9920
|
+
const columnsSQL = isSelect ? `SELECT ${renderNameAS(q._columns, void 0, '"')}` : "SELECT count(*) as count";
|
|
9905
9921
|
const whereSQL = where.sql !== "" ? ` WHERE ${where.sql}` : "";
|
|
9906
9922
|
const fromSQL = ` FROM ${renderNameAS(q._selectFrom)}`;
|
|
9907
9923
|
const join15 = q._joins.map((j) => getJoin(j));
|
|
@@ -9927,8 +9943,8 @@ function sqlite3ExecutorPrepare(args) {
|
|
|
9927
9943
|
const returing = q._returning.length === 0 ? "*" : q._returning.join(",");
|
|
9928
9944
|
const where = getWhereStatement(q);
|
|
9929
9945
|
const whereSQL = where.sql !== "" ? ` WHERE ${where.sql}` : "";
|
|
9930
|
-
const setSQL = ` SET ${q._sets.map((set) => `${set.column}=?`)}`;
|
|
9931
|
-
const sql = `UPDATE ${q._table}${setSQL}${whereSQL}${getOrderBy(q._orderBy)}${getLimit(q._limitBy, q._offsetBy)} RETURNING ${returing}`;
|
|
9946
|
+
const setSQL = ` SET ${q._sets.map((set) => `${renderColumn(set.column)}=?`)}`;
|
|
9947
|
+
const sql = `UPDATE "${q._table}"${setSQL}${whereSQL}${getOrderBy(q._orderBy)}${getLimit(q._limitBy, q._offsetBy)} RETURNING ${returing}`;
|
|
9932
9948
|
return [{
|
|
9933
9949
|
sql,
|
|
9934
9950
|
values: q._sets.map((set) => set.value).concat(where.values)
|
|
@@ -10097,23 +10113,23 @@ function getCreateTableColumn(columnName, def, primaryKeyColumns) {
|
|
|
10097
10113
|
const autoIncrement = `${def.autoIncrement !== void 0 && def.autoIncrement === true ? ` AUTOINCREMENT` : ""}`;
|
|
10098
10114
|
switch (def.type) {
|
|
10099
10115
|
case "datetime":
|
|
10100
|
-
return
|
|
10116
|
+
return `"${columnName}" DATETIME${primaryKey}${notNull}${defaultValue}${autoIncrement}`;
|
|
10101
10117
|
case "boolean":
|
|
10102
|
-
return
|
|
10118
|
+
return `"${columnName}" TINYINT${primaryKey}${notNull}${defaultValue}${autoIncrement}`;
|
|
10103
10119
|
case "json":
|
|
10104
10120
|
case "string":
|
|
10105
|
-
return
|
|
10121
|
+
return `"${columnName}" TEXT${primaryKey}${notNull}${defaultValue}${autoIncrement}`;
|
|
10106
10122
|
case "real":
|
|
10107
|
-
return
|
|
10123
|
+
return `"${columnName}" REAL${primaryKey}${notNull}${defaultValue}${autoIncrement}`;
|
|
10108
10124
|
case "bigint":
|
|
10109
10125
|
case "integer":
|
|
10110
|
-
return
|
|
10126
|
+
return `"${columnName}" INTEGER${primaryKey}${notNull}${defaultValue}${autoIncrement}`;
|
|
10111
10127
|
default:
|
|
10112
10128
|
throw new Error("unsupported type " + def.type);
|
|
10113
10129
|
}
|
|
10114
10130
|
}
|
|
10115
10131
|
function getInsertColumns(columns) {
|
|
10116
|
-
return `(${columns.join(",")})`;
|
|
10132
|
+
return `(${columns.map((c) => renderColumn(c)).join(",")})`;
|
|
10117
10133
|
}
|
|
10118
10134
|
function getInsertValues(columns, values) {
|
|
10119
10135
|
let args = [];
|
|
@@ -10125,21 +10141,21 @@ function getInsertValues(columns, values) {
|
|
|
10125
10141
|
values: args
|
|
10126
10142
|
};
|
|
10127
10143
|
}
|
|
10128
|
-
function renderNameAS(input, join15 = ", ") {
|
|
10144
|
+
function renderNameAS(input, join15 = ", ", wrapper = '"') {
|
|
10129
10145
|
const list = input instanceof Array ? input : [input];
|
|
10130
|
-
return list.map((i) => typeof i === "string" ? i : `${i.name} AS ${i.as}`).join(join15);
|
|
10146
|
+
return list.map((i) => typeof i === "string" ? `${renderColumn(i, wrapper)}` : `${renderColumn(i.name, wrapper)} AS ${renderColumn(i.as, wrapper)}`).join(join15);
|
|
10131
10147
|
}
|
|
10132
|
-
function getGroupBy(groupBy) {
|
|
10133
|
-
return groupBy.length > 0 ? ` GROUP BY ${groupBy.join(",")}` : "";
|
|
10148
|
+
function getGroupBy(groupBy, wrapper = '"') {
|
|
10149
|
+
return groupBy.length > 0 ? ` GROUP BY ${groupBy.map((g) => renderColumn(g, wrapper)).join(",")}` : "";
|
|
10134
10150
|
}
|
|
10135
|
-
function getOrderBy(orderBy) {
|
|
10136
|
-
return orderBy.length > 0 ? ` ORDER BY ${orderBy.map((o) => `${o.column} ${o.mode}`).join(",")}` : "";
|
|
10151
|
+
function getOrderBy(orderBy, wrapper = '"') {
|
|
10152
|
+
return orderBy.length > 0 ? ` ORDER BY ${orderBy.map((o) => `${renderColumn(o.column, wrapper)} ${o.mode}`).join(",")}` : "";
|
|
10137
10153
|
}
|
|
10138
10154
|
function getLimit(limit, offsetBy) {
|
|
10139
10155
|
return `${limit !== void 0 ? ` LIMIT ${limit}` : ""}${offsetBy ? ` OFFSET ${offsetBy}` : ""}`;
|
|
10140
10156
|
}
|
|
10141
|
-
function renderColumn(column) {
|
|
10142
|
-
return column
|
|
10157
|
+
function renderColumn(column, wrapper = '"') {
|
|
10158
|
+
return `${column.split(".").map((c) => `${wrapper}${c}${wrapper}`).join(".")}`;
|
|
10143
10159
|
}
|
|
10144
10160
|
function mergePrepareArgs(to, merge, concatOperator = " AND ") {
|
|
10145
10161
|
return (merge instanceof Array ? merge : [merge]).reduce((current, value) => {
|
|
@@ -10209,6 +10225,77 @@ var TableSchemaSchema = {
|
|
|
10209
10225
|
dictType: "ColumnDefinition"
|
|
10210
10226
|
};
|
|
10211
10227
|
|
|
10228
|
+
// node_modules/@miqro/query/build/executors/transform.js
|
|
10229
|
+
function sqliteTransformInput(value) {
|
|
10230
|
+
if (value === null || value === void 0)
|
|
10231
|
+
return value;
|
|
10232
|
+
switch (typeof value) {
|
|
10233
|
+
case "boolean":
|
|
10234
|
+
return value ? 1 : 0;
|
|
10235
|
+
case "bigint":
|
|
10236
|
+
return value.toString();
|
|
10237
|
+
case "object":
|
|
10238
|
+
if (value instanceof Date)
|
|
10239
|
+
return value.toISOString();
|
|
10240
|
+
return JSON.stringify(value);
|
|
10241
|
+
default:
|
|
10242
|
+
return value;
|
|
10243
|
+
}
|
|
10244
|
+
}
|
|
10245
|
+
function sqliteTransformOutput(type, value) {
|
|
10246
|
+
if (value === null || value === void 0)
|
|
10247
|
+
return value;
|
|
10248
|
+
switch (type) {
|
|
10249
|
+
case "boolean":
|
|
10250
|
+
return value === 1 || value === "1" || value === "true" || value === true ? true : false;
|
|
10251
|
+
case "datetime":
|
|
10252
|
+
return value instanceof Date ? value : new Date(value);
|
|
10253
|
+
case "bigint":
|
|
10254
|
+
return BigInt(value);
|
|
10255
|
+
case "real":
|
|
10256
|
+
case "integer": {
|
|
10257
|
+
const f = parseFloat(value);
|
|
10258
|
+
return isNaN(f) ? null : f;
|
|
10259
|
+
}
|
|
10260
|
+
case "json":
|
|
10261
|
+
return typeof value === "string" ? JSON.parse(value) : value;
|
|
10262
|
+
case "string":
|
|
10263
|
+
return value;
|
|
10264
|
+
default:
|
|
10265
|
+
return value;
|
|
10266
|
+
}
|
|
10267
|
+
}
|
|
10268
|
+
function pgTransformInput(value) {
|
|
10269
|
+
if (value === null || value === void 0)
|
|
10270
|
+
return value;
|
|
10271
|
+
switch (typeof value) {
|
|
10272
|
+
case "bigint":
|
|
10273
|
+
return value.toString();
|
|
10274
|
+
case "object":
|
|
10275
|
+
if (value instanceof Date)
|
|
10276
|
+
return value;
|
|
10277
|
+
return JSON.stringify(value);
|
|
10278
|
+
default:
|
|
10279
|
+
return value;
|
|
10280
|
+
}
|
|
10281
|
+
}
|
|
10282
|
+
function pgTransformOutput(type, value) {
|
|
10283
|
+
if (value === null || value === void 0)
|
|
10284
|
+
return value;
|
|
10285
|
+
switch (type) {
|
|
10286
|
+
case "integer":
|
|
10287
|
+
return parseInt(value, 10);
|
|
10288
|
+
case "datetime":
|
|
10289
|
+
return value instanceof Date ? value : new Date(value);
|
|
10290
|
+
case "bigint":
|
|
10291
|
+
return BigInt(value);
|
|
10292
|
+
case "json":
|
|
10293
|
+
return typeof value === "string" ? JSON.parse(value) : value;
|
|
10294
|
+
default:
|
|
10295
|
+
return value;
|
|
10296
|
+
}
|
|
10297
|
+
}
|
|
10298
|
+
|
|
10212
10299
|
// node_modules/@miqro/query/build/executors/sqlite3/lib.js
|
|
10213
10300
|
var SQLITE_CONFIG_SCHEMA = {
|
|
10214
10301
|
type: "object",
|
|
@@ -10229,6 +10316,8 @@ async function sqlite3Executor(config) {
|
|
|
10229
10316
|
await driver.close();
|
|
10230
10317
|
},
|
|
10231
10318
|
prepare: sqlite3ExecutorPrepare,
|
|
10319
|
+
transformInput: sqliteTransformInput,
|
|
10320
|
+
transformOutput: sqliteTransformOutput,
|
|
10232
10321
|
query: async function sqlite3Executor2(sql, values) {
|
|
10233
10322
|
return new Promise((resolve24, reject) => {
|
|
10234
10323
|
const st = driver.prepare(sql, values, function(error2) {
|
|
@@ -10278,18 +10367,20 @@ async function postgresExecutor(config) {
|
|
|
10278
10367
|
disconnect: async function postgresExecutorDisconnect() {
|
|
10279
10368
|
await driver.end();
|
|
10280
10369
|
},
|
|
10370
|
+
transformInput: pgTransformInput,
|
|
10371
|
+
transformOutput: pgTransformOutput,
|
|
10281
10372
|
prepare: function postgresExecutorPrepare(args) {
|
|
10282
10373
|
switch (args._type) {
|
|
10283
10374
|
case "create-table": {
|
|
10284
10375
|
const q = args;
|
|
10285
|
-
const sql = `CREATE TABLE${q._ignoreDuplicate ? " IF NOT EXISTS" : ""} ${q._table}${getCreateTableColumns2(q._definition)}`;
|
|
10376
|
+
const sql = `CREATE TABLE${q._ignoreDuplicate ? " IF NOT EXISTS" : ""} "${q._table}"${getCreateTableColumns2(q._definition)}`;
|
|
10286
10377
|
return sql;
|
|
10287
10378
|
}
|
|
10288
10379
|
case "insert": {
|
|
10289
10380
|
const q = args;
|
|
10290
10381
|
const rows = getInsertValues(q._columns, q._values);
|
|
10291
10382
|
const returing = q._returning.length === 0 ? "*" : q._returning.join(",");
|
|
10292
|
-
const sql = `INSERT INTO ${q._table}${getInsertColumns(q._columns)}${rows.sql} ${q._ignoreDuplicate ? "ON CONFLICT DO NOTHING " : ""}RETURNING ${returing}`;
|
|
10383
|
+
const sql = `INSERT INTO "${q._table}"${getInsertColumns(q._columns)}${rows.sql} ${q._ignoreDuplicate ? "ON CONFLICT DO NOTHING " : ""}RETURNING ${returing}`;
|
|
10293
10384
|
return {
|
|
10294
10385
|
sql,
|
|
10295
10386
|
values: rows.values
|
|
@@ -10300,7 +10391,7 @@ async function postgresExecutor(config) {
|
|
|
10300
10391
|
let alters = [];
|
|
10301
10392
|
if (q._renameTable) {
|
|
10302
10393
|
alters.push({
|
|
10303
|
-
sql: `ALTER TABLE ${q._table} RENAME TO
|
|
10394
|
+
sql: `ALTER TABLE "${q._table}" RENAME TO "?"`,
|
|
10304
10395
|
values: [q._renameTable]
|
|
10305
10396
|
});
|
|
10306
10397
|
}
|
|
@@ -10311,17 +10402,17 @@ async function postgresExecutor(config) {
|
|
|
10311
10402
|
throw new Error("unsupported alter action add without definition");
|
|
10312
10403
|
}
|
|
10313
10404
|
alters.push({
|
|
10314
|
-
sql: `ALTER TABLE ${q._table} ADD COLUMN ${getCreateTableColumn2(l._column, l._definition, [])}`
|
|
10405
|
+
sql: `ALTER TABLE "${q._table}" ADD COLUMN ${getCreateTableColumn2(l._column, l._definition, [])}`
|
|
10315
10406
|
});
|
|
10316
10407
|
break;
|
|
10317
10408
|
case "drop":
|
|
10318
10409
|
alters.push({
|
|
10319
|
-
sql: `ALTER TABLE ${q._table} DROP COLUMN ${l._column}`
|
|
10410
|
+
sql: `ALTER TABLE "${q._table}" DROP COLUMN "${l._column}"`
|
|
10320
10411
|
});
|
|
10321
10412
|
break;
|
|
10322
10413
|
case "rename":
|
|
10323
10414
|
alters.push({
|
|
10324
|
-
sql: `ALTER TABLE ${q._table} RENAME COLUMN ${l._column} TO ${l._newName}`
|
|
10415
|
+
sql: `ALTER TABLE "${q._table}" RENAME COLUMN "${l._column}" TO "${l._newName}"`
|
|
10325
10416
|
});
|
|
10326
10417
|
break;
|
|
10327
10418
|
default:
|
|
@@ -10359,22 +10450,22 @@ function getCreateTableColumn2(columnName, def, primaryKeyColumns) {
|
|
|
10359
10450
|
const notNull = `${def.allowNull == false ? " NOT NULL" : ""}`;
|
|
10360
10451
|
const defaultValue = `${def.defaultValue !== void 0 ? ` DEFAULT '${def.defaultValue}'` : ""}`;
|
|
10361
10452
|
if (def.autoIncrement) {
|
|
10362
|
-
return
|
|
10453
|
+
return `"${columnName}" BIGSERIAL${primaryKey}`;
|
|
10363
10454
|
}
|
|
10364
10455
|
switch (def.type) {
|
|
10365
10456
|
case "datetime":
|
|
10366
|
-
return
|
|
10457
|
+
return `"${columnName}" TIMESTAMP${primaryKey}${notNull}${defaultValue}`;
|
|
10367
10458
|
case "boolean":
|
|
10368
|
-
return
|
|
10459
|
+
return `"${columnName}" BOOLEAN${primaryKey}${notNull}${defaultValue}`;
|
|
10369
10460
|
case "real":
|
|
10370
|
-
return
|
|
10461
|
+
return `"${columnName}" REAL${primaryKey}${notNull}${defaultValue}`;
|
|
10371
10462
|
case "json":
|
|
10372
10463
|
case "string":
|
|
10373
|
-
return
|
|
10464
|
+
return `"${columnName}" TEXT${primaryKey}${notNull}${defaultValue}`;
|
|
10374
10465
|
case "bigint":
|
|
10375
|
-
return
|
|
10466
|
+
return `"${columnName}" bigint${primaryKey}${notNull}${defaultValue}`;
|
|
10376
10467
|
case "integer":
|
|
10377
|
-
return
|
|
10468
|
+
return `"${columnName}" INTEGER${primaryKey}${notNull}${defaultValue}`;
|
|
10378
10469
|
default:
|
|
10379
10470
|
throw new Error("unsupported type " + def.type);
|
|
10380
10471
|
}
|
|
@@ -10401,6 +10492,15 @@ function tokens2Postgres(inSql, values) {
|
|
|
10401
10492
|
}
|
|
10402
10493
|
|
|
10403
10494
|
// node_modules/@miqro/query/build/query/utils.js
|
|
10495
|
+
function applyTransformInput(executor, stmts) {
|
|
10496
|
+
const ti = executor.transformInput.bind(executor);
|
|
10497
|
+
const list = stmts instanceof Array ? stmts : typeof stmts === "string" ? [] : [stmts];
|
|
10498
|
+
for (const stmt of list) {
|
|
10499
|
+
if (stmt.values) {
|
|
10500
|
+
stmt.values = stmt.values.map(ti);
|
|
10501
|
+
}
|
|
10502
|
+
}
|
|
10503
|
+
}
|
|
10404
10504
|
function getStatements(stmts) {
|
|
10405
10505
|
if (stmts instanceof Array) {
|
|
10406
10506
|
return stmts;
|
|
@@ -10567,7 +10667,7 @@ var AlterTable = class _AlterTable {
|
|
|
10567
10667
|
|
|
10568
10668
|
// node_modules/@miqro/query/build/query/insert.js
|
|
10569
10669
|
var Insert = class _Insert {
|
|
10570
|
-
constructor(db, _table) {
|
|
10670
|
+
constructor(db, _table, schema) {
|
|
10571
10671
|
this.db = db;
|
|
10572
10672
|
this._table = _table;
|
|
10573
10673
|
this._type = "insert";
|
|
@@ -10575,6 +10675,7 @@ var Insert = class _Insert {
|
|
|
10575
10675
|
this._returning = [];
|
|
10576
10676
|
this._values = [];
|
|
10577
10677
|
this._ignoreDuplicate = false;
|
|
10678
|
+
this._schema = schema;
|
|
10578
10679
|
}
|
|
10579
10680
|
value(value) {
|
|
10580
10681
|
this._values = this._values.concat(value);
|
|
@@ -10583,7 +10684,7 @@ var Insert = class _Insert {
|
|
|
10583
10684
|
values(value) {
|
|
10584
10685
|
return this.value(value);
|
|
10585
10686
|
}
|
|
10586
|
-
returning(column) {
|
|
10687
|
+
returning(...column) {
|
|
10587
10688
|
this._returning = this._returning.concat(column);
|
|
10588
10689
|
return this;
|
|
10589
10690
|
}
|
|
@@ -10598,14 +10699,23 @@ var Insert = class _Insert {
|
|
|
10598
10699
|
return getStatements(this.db.getExecutor().prepare(this));
|
|
10599
10700
|
}
|
|
10600
10701
|
async yield(logger) {
|
|
10601
|
-
|
|
10702
|
+
const executor = this.db.getExecutor();
|
|
10703
|
+
const ti = executor.transformInput.bind(executor);
|
|
10704
|
+
this._values = this._values.map((row) => {
|
|
10705
|
+
const out = {};
|
|
10706
|
+
for (const key of Object.keys(row)) {
|
|
10707
|
+
out[key] = ti(row[key]);
|
|
10708
|
+
}
|
|
10709
|
+
return out;
|
|
10710
|
+
});
|
|
10711
|
+
return runStatements(this.db, executor.prepare(this), logger);
|
|
10602
10712
|
}
|
|
10603
10713
|
ignoreDuplicates(ignore = true) {
|
|
10604
10714
|
this._ignoreDuplicate = ignore;
|
|
10605
10715
|
return this;
|
|
10606
10716
|
}
|
|
10607
10717
|
clone() {
|
|
10608
|
-
const ret = new _Insert(this.db, this._table);
|
|
10718
|
+
const ret = new _Insert(this.db, this._table, this._schema);
|
|
10609
10719
|
ret._columns = structuredClone(this._columns);
|
|
10610
10720
|
ret._values = structuredClone(this._values);
|
|
10611
10721
|
ret._returning = structuredClone(this._returning);
|
|
@@ -10615,11 +10725,19 @@ var Insert = class _Insert {
|
|
|
10615
10725
|
};
|
|
10616
10726
|
|
|
10617
10727
|
// node_modules/@miqro/query/build/executors/where.js
|
|
10618
|
-
var Where = class {
|
|
10728
|
+
var Where = class _Where {
|
|
10619
10729
|
constructor() {
|
|
10620
10730
|
this._orderBy = [];
|
|
10621
10731
|
this._filters = [];
|
|
10622
10732
|
}
|
|
10733
|
+
clone() {
|
|
10734
|
+
const ret = new _Where();
|
|
10735
|
+
ret._filters = structuredClone(this._filters);
|
|
10736
|
+
ret._orderBy = structuredClone(this._orderBy);
|
|
10737
|
+
ret._limitBy = this._limitBy;
|
|
10738
|
+
ret._offsetBy = this._offsetBy;
|
|
10739
|
+
return ret;
|
|
10740
|
+
}
|
|
10623
10741
|
order(column, mode) {
|
|
10624
10742
|
this._orderBy.push({ column, mode });
|
|
10625
10743
|
return this;
|
|
@@ -10747,9 +10865,167 @@ var Where = class {
|
|
|
10747
10865
|
}
|
|
10748
10866
|
};
|
|
10749
10867
|
|
|
10868
|
+
// node_modules/@miqro/query/build/query/include.js
|
|
10869
|
+
function getPrimaryKey(schema) {
|
|
10870
|
+
for (const [key, def] of Object.entries(schema)) {
|
|
10871
|
+
if (def.primaryKey)
|
|
10872
|
+
return key;
|
|
10873
|
+
}
|
|
10874
|
+
return "id";
|
|
10875
|
+
}
|
|
10876
|
+
function transformOutputRow(transformOutput, schema, row) {
|
|
10877
|
+
const out = {};
|
|
10878
|
+
for (const key of Object.keys(row)) {
|
|
10879
|
+
const def = schema[key];
|
|
10880
|
+
out[key] = def ? transformOutput(def.type, row[key]) : row[key];
|
|
10881
|
+
}
|
|
10882
|
+
return out;
|
|
10883
|
+
}
|
|
10884
|
+
function _classifyRecursive(filters, assocNames, assocFilters) {
|
|
10885
|
+
const rootFilters = [];
|
|
10886
|
+
for (const filter of filters) {
|
|
10887
|
+
if (filter._column !== void 0) {
|
|
10888
|
+
const dot = filter._column.indexOf(".");
|
|
10889
|
+
if (dot !== -1) {
|
|
10890
|
+
const prefix = filter._column.substring(0, dot);
|
|
10891
|
+
if (assocNames.has(prefix)) {
|
|
10892
|
+
assocFilters.get(prefix).push({
|
|
10893
|
+
...filter,
|
|
10894
|
+
_column: filter._column.substring(dot + 1)
|
|
10895
|
+
});
|
|
10896
|
+
continue;
|
|
10897
|
+
}
|
|
10898
|
+
}
|
|
10899
|
+
rootFilters.push(filter);
|
|
10900
|
+
} else if (filter._where !== void 0) {
|
|
10901
|
+
const nestedList = Array.isArray(filter._where) ? filter._where : [filter._where];
|
|
10902
|
+
const rebuiltList = nestedList.map((w) => ({
|
|
10903
|
+
...w,
|
|
10904
|
+
_filters: _classifyRecursive(w._filters, assocNames, assocFilters)
|
|
10905
|
+
})).filter((w) => w._filters.length > 0);
|
|
10906
|
+
if (rebuiltList.length > 0) {
|
|
10907
|
+
rootFilters.push({
|
|
10908
|
+
...filter,
|
|
10909
|
+
_where: Array.isArray(filter._where) ? rebuiltList : rebuiltList[0]
|
|
10910
|
+
});
|
|
10911
|
+
}
|
|
10912
|
+
} else {
|
|
10913
|
+
rootFilters.push(filter);
|
|
10914
|
+
}
|
|
10915
|
+
}
|
|
10916
|
+
return rootFilters;
|
|
10917
|
+
}
|
|
10918
|
+
function classifyFilters(filters, include) {
|
|
10919
|
+
const assocNames = new Set(include);
|
|
10920
|
+
const assocFilters = /* @__PURE__ */ new Map();
|
|
10921
|
+
for (const name of include)
|
|
10922
|
+
assocFilters.set(name, []);
|
|
10923
|
+
const rootFilters = _classifyRecursive(filters, assocNames, assocFilters);
|
|
10924
|
+
return { rootFilters, assocFilters };
|
|
10925
|
+
}
|
|
10926
|
+
async function yieldWithInclude(db, schema, assocMap, include, filters, orderBy, limitBy, offsetBy, rootTable, rootColumns, logger) {
|
|
10927
|
+
const { rootFilters, assocFilters } = classifyFilters(filters, include);
|
|
10928
|
+
const pk = getPrimaryKey(schema);
|
|
10929
|
+
const cols = rootColumns.includes(pk) ? rootColumns : [...rootColumns, pk];
|
|
10930
|
+
const assocNames = new Set(include);
|
|
10931
|
+
const rootOrderBy = orderBy.filter((o) => {
|
|
10932
|
+
const dot = o.column.indexOf(".");
|
|
10933
|
+
return dot === -1 || !assocNames.has(o.column.substring(0, dot));
|
|
10934
|
+
});
|
|
10935
|
+
const rootSelect = db.select().from(rootTable);
|
|
10936
|
+
for (const col of cols)
|
|
10937
|
+
rootSelect.column(col);
|
|
10938
|
+
for (const f of rootFilters)
|
|
10939
|
+
rootSelect._filters.push(f);
|
|
10940
|
+
for (const o of rootOrderBy)
|
|
10941
|
+
rootSelect._orderBy.push(o);
|
|
10942
|
+
if (limitBy !== void 0)
|
|
10943
|
+
rootSelect._limitBy = limitBy;
|
|
10944
|
+
if (offsetBy !== void 0)
|
|
10945
|
+
rootSelect._offsetBy = offsetBy;
|
|
10946
|
+
const executor = db.getExecutor();
|
|
10947
|
+
const rootStmts = executor.prepare(rootSelect);
|
|
10948
|
+
applyTransformInput(executor, rootStmts);
|
|
10949
|
+
const rootRaw = await runStatements(db, rootStmts, logger);
|
|
10950
|
+
if (rootRaw.length === 0)
|
|
10951
|
+
return [];
|
|
10952
|
+
const transformedRoots = rootRaw.map((row) => transformOutputRow(executor.transformOutput, schema, row));
|
|
10953
|
+
const rootPKs = transformedRoots.map((r) => r[pk]);
|
|
10954
|
+
const assocResults = await Promise.all(include.map(async (assocName) => {
|
|
10955
|
+
const assocDef = assocMap.get(assocName);
|
|
10956
|
+
if (!assocDef)
|
|
10957
|
+
throw new Error(`unknown association: ${assocName}`);
|
|
10958
|
+
const assocModel = assocDef.model();
|
|
10959
|
+
const assocSchema = assocModel.schema;
|
|
10960
|
+
const assocTable = assocModel.tableName;
|
|
10961
|
+
const extraFilters = assocFilters.get(assocName) ?? [];
|
|
10962
|
+
const fk = assocDef.foreignKey;
|
|
10963
|
+
const lk = assocDef.localKey ?? "id";
|
|
10964
|
+
let inColumn;
|
|
10965
|
+
let inValues;
|
|
10966
|
+
if (assocDef.type === "belongsTo") {
|
|
10967
|
+
inColumn = lk;
|
|
10968
|
+
inValues = [...new Set(transformedRoots.map((r) => r[fk]).filter((v) => v != null))];
|
|
10969
|
+
} else {
|
|
10970
|
+
inColumn = fk;
|
|
10971
|
+
inValues = rootPKs;
|
|
10972
|
+
}
|
|
10973
|
+
if (inValues.length === 0) {
|
|
10974
|
+
return { assocName, assocDef, rows: [], hadFilters: extraFilters.length > 0 };
|
|
10975
|
+
}
|
|
10976
|
+
const assocSelect = db.select().from(assocTable);
|
|
10977
|
+
for (const col of Object.keys(assocSchema))
|
|
10978
|
+
assocSelect.column(col);
|
|
10979
|
+
assocSelect._filters.push({ _type: "in", _column: inColumn, _value: inValues });
|
|
10980
|
+
for (const f of extraFilters)
|
|
10981
|
+
assocSelect._filters.push(f);
|
|
10982
|
+
const stmts = executor.prepare(assocSelect);
|
|
10983
|
+
applyTransformInput(executor, stmts);
|
|
10984
|
+
const raw = await runStatements(db, stmts, logger);
|
|
10985
|
+
const rows = raw.map((row) => transformOutputRow(executor.transformOutput, assocSchema, row));
|
|
10986
|
+
return { assocName, assocDef, rows, hadFilters: extraFilters.length > 0 };
|
|
10987
|
+
}));
|
|
10988
|
+
const result = [];
|
|
10989
|
+
for (const root of transformedRoots) {
|
|
10990
|
+
const pkVal = root[pk];
|
|
10991
|
+
const instance = { ...root };
|
|
10992
|
+
let excluded = false;
|
|
10993
|
+
for (const { assocName, assocDef, rows, hadFilters } of assocResults) {
|
|
10994
|
+
const fk = assocDef.foreignKey;
|
|
10995
|
+
const lk = assocDef.localKey ?? "id";
|
|
10996
|
+
if (assocDef.type === "hasMany") {
|
|
10997
|
+
const matched = rows.filter((r) => r[fk] === pkVal);
|
|
10998
|
+
if (hadFilters && matched.length === 0) {
|
|
10999
|
+
excluded = true;
|
|
11000
|
+
break;
|
|
11001
|
+
}
|
|
11002
|
+
instance[assocName] = matched;
|
|
11003
|
+
} else if (assocDef.type === "hasOne") {
|
|
11004
|
+
const matched = rows.find((r) => r[fk] === pkVal);
|
|
11005
|
+
if (hadFilters && matched === void 0) {
|
|
11006
|
+
excluded = true;
|
|
11007
|
+
break;
|
|
11008
|
+
}
|
|
11009
|
+
instance[assocName] = matched ?? null;
|
|
11010
|
+
} else {
|
|
11011
|
+
const localKeyVal = root[fk];
|
|
11012
|
+
const matched = rows.find((r) => r[lk] === localKeyVal);
|
|
11013
|
+
if (hadFilters && matched === void 0) {
|
|
11014
|
+
excluded = true;
|
|
11015
|
+
break;
|
|
11016
|
+
}
|
|
11017
|
+
instance[assocName] = matched ?? null;
|
|
11018
|
+
}
|
|
11019
|
+
}
|
|
11020
|
+
if (!excluded)
|
|
11021
|
+
result.push(instance);
|
|
11022
|
+
}
|
|
11023
|
+
return result;
|
|
11024
|
+
}
|
|
11025
|
+
|
|
10750
11026
|
// node_modules/@miqro/query/build/query/select.js
|
|
10751
11027
|
var Select = class _Select extends Where {
|
|
10752
|
-
constructor(db) {
|
|
11028
|
+
constructor(db, schema, associations) {
|
|
10753
11029
|
super();
|
|
10754
11030
|
this.db = db;
|
|
10755
11031
|
this._type = "select";
|
|
@@ -10758,12 +11034,20 @@ var Select = class _Select extends Where {
|
|
|
10758
11034
|
this._groupBy = [];
|
|
10759
11035
|
this._joins = [];
|
|
10760
11036
|
this._orderBy = [];
|
|
11037
|
+
this._schema = schema;
|
|
11038
|
+
if (associations) {
|
|
11039
|
+
this._assocMap = new Map(Object.entries(associations));
|
|
11040
|
+
}
|
|
11041
|
+
}
|
|
11042
|
+
include(...names) {
|
|
11043
|
+
this._include = names;
|
|
11044
|
+
return this;
|
|
10761
11045
|
}
|
|
10762
11046
|
prepare() {
|
|
10763
11047
|
return getStatements(this.db.getExecutor().prepare(this));
|
|
10764
11048
|
}
|
|
10765
11049
|
clone() {
|
|
10766
|
-
const ret = new _Select(this.db);
|
|
11050
|
+
const ret = new _Select(this.db, this._schema);
|
|
10767
11051
|
ret._filters = structuredClone(this._filters);
|
|
10768
11052
|
ret._columns = structuredClone(this._columns);
|
|
10769
11053
|
ret._groupBy = structuredClone(this._groupBy);
|
|
@@ -10772,10 +11056,29 @@ var Select = class _Select extends Where {
|
|
|
10772
11056
|
ret._joins = structuredClone(this._joins);
|
|
10773
11057
|
ret._limitBy = this._limitBy;
|
|
10774
11058
|
ret._offsetBy = this._offsetBy;
|
|
11059
|
+
ret._assocMap = this._assocMap;
|
|
11060
|
+
ret._include = this._include ? [...this._include] : void 0;
|
|
10775
11061
|
return ret;
|
|
10776
11062
|
}
|
|
10777
11063
|
async yield(logger) {
|
|
10778
|
-
|
|
11064
|
+
if (this._include && this._include.length > 0 && this._schema && this._assocMap) {
|
|
11065
|
+
return this._yieldWithInclude(logger);
|
|
11066
|
+
}
|
|
11067
|
+
const executor = this.db.getExecutor();
|
|
11068
|
+
const stmts = executor.prepare(this);
|
|
11069
|
+
applyTransformInput(executor, stmts);
|
|
11070
|
+
const rows = await runStatements(this.db, stmts, logger);
|
|
11071
|
+
if (this._schema) {
|
|
11072
|
+
const schema = this._schema;
|
|
11073
|
+
return rows.map((row) => transformOutputRow(executor.transformOutput, schema, row));
|
|
11074
|
+
}
|
|
11075
|
+
return rows;
|
|
11076
|
+
}
|
|
11077
|
+
async _yieldWithInclude(logger) {
|
|
11078
|
+
const schema = this._schema;
|
|
11079
|
+
const rootTable = this._selectFrom.length > 0 ? typeof this._selectFrom[0] === "string" ? this._selectFrom[0] : this._selectFrom[0].name : "";
|
|
11080
|
+
const rootColumns = this._columns.length > 0 ? this._columns.filter((c) => typeof c === "string") : Object.keys(schema);
|
|
11081
|
+
return yieldWithInclude(this.db, schema, this._assocMap, this._include, this._filters, this._orderBy, this._limitBy, this._offsetBy, rootTable, rootColumns, logger);
|
|
10779
11082
|
}
|
|
10780
11083
|
column(column) {
|
|
10781
11084
|
if (column instanceof Array) {
|
|
@@ -10785,8 +11088,9 @@ var Select = class _Select extends Where {
|
|
|
10785
11088
|
}
|
|
10786
11089
|
return this;
|
|
10787
11090
|
}
|
|
10788
|
-
columns(
|
|
10789
|
-
|
|
11091
|
+
columns(...cols) {
|
|
11092
|
+
this._columns = cols;
|
|
11093
|
+
return this;
|
|
10790
11094
|
}
|
|
10791
11095
|
from(from) {
|
|
10792
11096
|
if (from instanceof Array) {
|
|
@@ -10863,7 +11167,10 @@ var Count = class _Count extends Where {
|
|
|
10863
11167
|
return getStatements(this.db.getExecutor().prepare(this));
|
|
10864
11168
|
}
|
|
10865
11169
|
async yield(logger) {
|
|
10866
|
-
|
|
11170
|
+
const executor = this.db.getExecutor();
|
|
11171
|
+
const stmts = executor.prepare(this);
|
|
11172
|
+
applyTransformInput(executor, stmts);
|
|
11173
|
+
return parseCountResult(await runStatements(this.db, stmts, logger));
|
|
10867
11174
|
}
|
|
10868
11175
|
};
|
|
10869
11176
|
async function parseCountResult(rows) {
|
|
@@ -10874,22 +11181,30 @@ async function parseCountResult(rows) {
|
|
|
10874
11181
|
|
|
10875
11182
|
// node_modules/@miqro/query/build/query/update.js
|
|
10876
11183
|
var Update = class _Update extends Where {
|
|
10877
|
-
constructor(db, _table) {
|
|
11184
|
+
constructor(db, _table, schema) {
|
|
10878
11185
|
super();
|
|
10879
11186
|
this.db = db;
|
|
10880
11187
|
this._table = _table;
|
|
10881
11188
|
this._type = "update";
|
|
10882
11189
|
this._sets = [];
|
|
10883
11190
|
this._returning = [];
|
|
11191
|
+
this._schema = schema;
|
|
10884
11192
|
}
|
|
10885
11193
|
prepare() {
|
|
10886
11194
|
return getStatements(this.db.getExecutor().prepare(this));
|
|
10887
11195
|
}
|
|
10888
11196
|
async yield(logger) {
|
|
10889
|
-
|
|
11197
|
+
const executor = this.db.getExecutor();
|
|
11198
|
+
const ti = executor.transformInput.bind(executor);
|
|
11199
|
+
for (const s of this._sets) {
|
|
11200
|
+
s.value = ti(s.value);
|
|
11201
|
+
}
|
|
11202
|
+
const stmts = executor.prepare(this);
|
|
11203
|
+
applyTransformInput(executor, stmts);
|
|
11204
|
+
return runStatements(this.db, stmts, logger);
|
|
10890
11205
|
}
|
|
10891
11206
|
clone() {
|
|
10892
|
-
const ret = new _Update(this.db, this._table);
|
|
11207
|
+
const ret = new _Update(this.db, this._table, this._schema);
|
|
10893
11208
|
ret._filters = structuredClone(this._filters);
|
|
10894
11209
|
ret._orderBy = structuredClone(this._orderBy);
|
|
10895
11210
|
ret._sets = structuredClone(this._sets);
|
|
@@ -10898,36 +11213,37 @@ var Update = class _Update extends Where {
|
|
|
10898
11213
|
ret._offsetBy = this._offsetBy;
|
|
10899
11214
|
return ret;
|
|
10900
11215
|
}
|
|
10901
|
-
returning(column) {
|
|
11216
|
+
returning(...column) {
|
|
10902
11217
|
this._returning = this._returning.concat(column);
|
|
10903
11218
|
return this;
|
|
10904
11219
|
}
|
|
10905
11220
|
set(column, value) {
|
|
10906
|
-
this._sets.push({
|
|
10907
|
-
column,
|
|
10908
|
-
value
|
|
10909
|
-
});
|
|
11221
|
+
this._sets.push({ column, value });
|
|
10910
11222
|
return this;
|
|
10911
11223
|
}
|
|
10912
11224
|
};
|
|
10913
11225
|
|
|
10914
11226
|
// node_modules/@miqro/query/build/query/delete.js
|
|
10915
11227
|
var Delete = class _Delete extends Where {
|
|
10916
|
-
constructor(db, _table) {
|
|
11228
|
+
constructor(db, _table, schema) {
|
|
10917
11229
|
super();
|
|
10918
11230
|
this.db = db;
|
|
10919
11231
|
this._table = _table;
|
|
10920
11232
|
this._type = "delete";
|
|
10921
11233
|
this._returning = [];
|
|
11234
|
+
this._schema = schema;
|
|
10922
11235
|
}
|
|
10923
11236
|
prepare() {
|
|
10924
11237
|
return getStatements(this.db.getExecutor().prepare(this));
|
|
10925
11238
|
}
|
|
10926
11239
|
async yield(logger) {
|
|
10927
|
-
|
|
11240
|
+
const executor = this.db.getExecutor();
|
|
11241
|
+
const stmts = executor.prepare(this);
|
|
11242
|
+
applyTransformInput(executor, stmts);
|
|
11243
|
+
return runStatements(this.db, stmts, logger);
|
|
10928
11244
|
}
|
|
10929
11245
|
clone() {
|
|
10930
|
-
const ret = new _Delete(this.db, this._table);
|
|
11246
|
+
const ret = new _Delete(this.db, this._table, this._schema);
|
|
10931
11247
|
ret._filters = structuredClone(this._filters);
|
|
10932
11248
|
ret._orderBy = structuredClone(this._orderBy);
|
|
10933
11249
|
ret._returning = structuredClone(this._returning);
|
|
@@ -10935,7 +11251,7 @@ var Delete = class _Delete extends Where {
|
|
|
10935
11251
|
ret._offsetBy = this._offsetBy;
|
|
10936
11252
|
return ret;
|
|
10937
11253
|
}
|
|
10938
|
-
returning(column) {
|
|
11254
|
+
returning(...column) {
|
|
10939
11255
|
this._returning = this._returning.concat(column);
|
|
10940
11256
|
return this;
|
|
10941
11257
|
}
|
|
@@ -10966,74 +11282,8 @@ var DropDatabase = class _DropDatabase {
|
|
|
10966
11282
|
}
|
|
10967
11283
|
};
|
|
10968
11284
|
|
|
10969
|
-
// node_modules/@miqro/query/build/executors/sqlite3-cli/lib.js
|
|
10970
|
-
var import_child_process = require("child_process");
|
|
10971
|
-
var SQLITE_CONFIG_SCHEMA2 = {
|
|
10972
|
-
type: "object",
|
|
10973
|
-
mode: "remove_extra",
|
|
10974
|
-
properties: {
|
|
10975
|
-
storage: "string"
|
|
10976
|
-
}
|
|
10977
|
-
};
|
|
10978
|
-
async function sqlite3CLIExecutor(config) {
|
|
10979
|
-
const databaseOptions = parser2.parse(config, SQLITE_CONFIG_SCHEMA2);
|
|
10980
|
-
if (!databaseOptions) {
|
|
10981
|
-
throw new Error("config not valid");
|
|
10982
|
-
}
|
|
10983
|
-
(config.logger ? config.logger : console).error(`sqlite3-cli is affected by sql injection. do not use! only for testing!`);
|
|
10984
|
-
return {
|
|
10985
|
-
// we just use the sqlite3Executor prepare function
|
|
10986
|
-
prepare: sqlite3ExecutorPrepare,
|
|
10987
|
-
disconnect: async function sqlite3ExecutorDisconnect() {
|
|
10988
|
-
},
|
|
10989
|
-
query: async function sqlite3Executor2(sql, values) {
|
|
10990
|
-
return new Promise((resolve24, reject) => {
|
|
10991
|
-
try {
|
|
10992
|
-
let i = 0;
|
|
10993
|
-
const raw = sql.replaceAll("?", (sub) => {
|
|
10994
|
-
const value = values ? values[i] : void 0;
|
|
10995
|
-
if (value === void 0) {
|
|
10996
|
-
throw new Error("cannot convert query");
|
|
10997
|
-
}
|
|
10998
|
-
i++;
|
|
10999
|
-
return `'${value}'`;
|
|
11000
|
-
});
|
|
11001
|
-
if (values && i !== values.length) {
|
|
11002
|
-
throw new Error("cannot convert query");
|
|
11003
|
-
}
|
|
11004
|
-
(0, import_child_process.exec)(`sqlite3 -json "${databaseOptions.storage}" "${raw}"`, (error2, stdout, stderr) => {
|
|
11005
|
-
try {
|
|
11006
|
-
if (error2) {
|
|
11007
|
-
if (stderr) {
|
|
11008
|
-
reject(new Error(stderr));
|
|
11009
|
-
} else {
|
|
11010
|
-
reject(error2);
|
|
11011
|
-
}
|
|
11012
|
-
} else {
|
|
11013
|
-
if (stderr) {
|
|
11014
|
-
reject(new Error(stderr));
|
|
11015
|
-
} else {
|
|
11016
|
-
if (stdout) {
|
|
11017
|
-
resolve24(JSON.parse(stdout));
|
|
11018
|
-
} else {
|
|
11019
|
-
resolve24([]);
|
|
11020
|
-
}
|
|
11021
|
-
}
|
|
11022
|
-
}
|
|
11023
|
-
} catch (e2) {
|
|
11024
|
-
reject(e2);
|
|
11025
|
-
}
|
|
11026
|
-
});
|
|
11027
|
-
} catch (e) {
|
|
11028
|
-
reject(e);
|
|
11029
|
-
}
|
|
11030
|
-
});
|
|
11031
|
-
}
|
|
11032
|
-
};
|
|
11033
|
-
}
|
|
11034
|
-
|
|
11035
11285
|
// node_modules/@miqro/query/build/executors/sqlite-native/lib.js
|
|
11036
|
-
var
|
|
11286
|
+
var SQLITE_CONFIG_SCHEMA2 = {
|
|
11037
11287
|
type: "object",
|
|
11038
11288
|
mode: "remove_extra",
|
|
11039
11289
|
properties: {
|
|
@@ -11041,7 +11291,7 @@ var SQLITE_CONFIG_SCHEMA3 = {
|
|
|
11041
11291
|
}
|
|
11042
11292
|
};
|
|
11043
11293
|
async function nativeSqlite(config) {
|
|
11044
|
-
const databaseOptions = parser2.parse(config,
|
|
11294
|
+
const databaseOptions = parser2.parse(config, SQLITE_CONFIG_SCHEMA2);
|
|
11045
11295
|
if (!databaseOptions) {
|
|
11046
11296
|
throw new Error("config not valid");
|
|
11047
11297
|
}
|
|
@@ -11050,6 +11300,8 @@ async function nativeSqlite(config) {
|
|
|
11050
11300
|
return {
|
|
11051
11301
|
// we just use the sqlite3Executor prepare function
|
|
11052
11302
|
prepare: sqlite3ExecutorPrepare,
|
|
11303
|
+
transformInput: sqliteTransformInput,
|
|
11304
|
+
transformOutput: sqliteTransformOutput,
|
|
11053
11305
|
disconnect: async function sqlite3ExecutorDisconnect() {
|
|
11054
11306
|
return driver.close();
|
|
11055
11307
|
},
|
|
@@ -11072,13 +11324,15 @@ async function nativeSqlite(config) {
|
|
|
11072
11324
|
}
|
|
11073
11325
|
const stmt = driver.prepare(sql);
|
|
11074
11326
|
stmt.setReadBigInts(true);
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
|
|
11078
|
-
|
|
11079
|
-
|
|
11080
|
-
|
|
11081
|
-
|
|
11327
|
+
const ret = values && values.length > 0 ? stmt.all(...values) : stmt.all();
|
|
11328
|
+
resolve24(ret.map((row) => {
|
|
11329
|
+
const out = {};
|
|
11330
|
+
for (const key of Object.keys(row)) {
|
|
11331
|
+
const v = row[key];
|
|
11332
|
+
out[key] = typeof v === "bigint" && v >= Number.MIN_SAFE_INTEGER && v <= Number.MAX_SAFE_INTEGER ? Number(v) : typeof v === "number" ? Number(v) : v;
|
|
11333
|
+
}
|
|
11334
|
+
return out;
|
|
11335
|
+
}));
|
|
11082
11336
|
} catch (e) {
|
|
11083
11337
|
reject(e);
|
|
11084
11338
|
}
|
|
@@ -11169,20 +11423,20 @@ var Database = class {
|
|
|
11169
11423
|
alterTable(table, inTransaction) {
|
|
11170
11424
|
return new AlterTable(this, table, inTransaction);
|
|
11171
11425
|
}
|
|
11172
|
-
insert(table) {
|
|
11173
|
-
return new Insert(this, table);
|
|
11426
|
+
insert(table, schema) {
|
|
11427
|
+
return new Insert(this, table, schema);
|
|
11174
11428
|
}
|
|
11175
|
-
select() {
|
|
11176
|
-
return new Select(this);
|
|
11429
|
+
select(schema, associations) {
|
|
11430
|
+
return new Select(this, schema, associations);
|
|
11177
11431
|
}
|
|
11178
11432
|
count() {
|
|
11179
11433
|
return new Count(this);
|
|
11180
11434
|
}
|
|
11181
|
-
update(table) {
|
|
11182
|
-
return new Update(this, table);
|
|
11435
|
+
update(table, schema) {
|
|
11436
|
+
return new Update(this, table, schema);
|
|
11183
11437
|
}
|
|
11184
|
-
delete(table) {
|
|
11185
|
-
return new Delete(this, table);
|
|
11438
|
+
delete(table, schema) {
|
|
11439
|
+
return new Delete(this, table, schema);
|
|
11186
11440
|
}
|
|
11187
11441
|
where() {
|
|
11188
11442
|
return new Where();
|
|
@@ -11192,14 +11446,17 @@ async function getExecutor(config) {
|
|
|
11192
11446
|
switch (config.dialect) {
|
|
11193
11447
|
case "node:sqlite":
|
|
11194
11448
|
return await nativeSqlite(config);
|
|
11195
|
-
case "sqlite3-cli":
|
|
11196
|
-
return await sqlite3CLIExecutor(config);
|
|
11197
11449
|
case "pg":
|
|
11198
11450
|
return await postgresExecutor(config);
|
|
11199
11451
|
case "sqlite3":
|
|
11200
11452
|
return await sqlite3Executor(config);
|
|
11201
11453
|
default:
|
|
11202
11454
|
if (config.executor) {
|
|
11455
|
+
const e = config.executor;
|
|
11456
|
+
if (!e.transformInput)
|
|
11457
|
+
e.transformInput = (v) => v;
|
|
11458
|
+
if (!e.transformOutput)
|
|
11459
|
+
e.transformOutput = (_type, v) => v;
|
|
11203
11460
|
return config.executor;
|
|
11204
11461
|
}
|
|
11205
11462
|
throw new Error("dialect [" + config.dialect + "] not defined");
|
|
@@ -11348,6 +11605,11 @@ var down = {
|
|
|
11348
11605
|
folder: downMigrationFolder
|
|
11349
11606
|
};
|
|
11350
11607
|
|
|
11608
|
+
// src/types.ts
|
|
11609
|
+
function defineRoute2(route) {
|
|
11610
|
+
return defineRoute(route);
|
|
11611
|
+
}
|
|
11612
|
+
|
|
11351
11613
|
// src/services/utils/cluster-ws.ts
|
|
11352
11614
|
init_lib3();
|
|
11353
11615
|
var ClusterWebSocketServer2MessageType = "$$$$ClusterWebSocketServer2Message$$$$$";
|
|
@@ -11390,7 +11652,7 @@ var ClusterWebSocketServer2 = class extends WebSocketServer {
|
|
|
11390
11652
|
clientUUID: req.uuid
|
|
11391
11653
|
});
|
|
11392
11654
|
}
|
|
11393
|
-
this.logger?.
|
|
11655
|
+
this.logger?.debug("[%s] new web socket connection from (%s)", req.uuid, req.req.socket.remoteAddress);
|
|
11394
11656
|
if (options.onConnection) {
|
|
11395
11657
|
options.onConnection(req);
|
|
11396
11658
|
}
|
|
@@ -11405,7 +11667,7 @@ var ClusterWebSocketServer2 = class extends WebSocketServer {
|
|
|
11405
11667
|
clientUUID: req.uuid
|
|
11406
11668
|
});
|
|
11407
11669
|
}
|
|
11408
|
-
this.logger?.
|
|
11670
|
+
this.logger?.debug("[%s] [%s] web socket disconnection from (%s)", req.uuid, this.path, req.req.socket.remoteAddress);
|
|
11409
11671
|
if (options.onDisconnect) {
|
|
11410
11672
|
options.onDisconnect(req);
|
|
11411
11673
|
}
|
|
@@ -11467,6 +11729,9 @@ var ClusterWebSocketServer2 = class extends WebSocketServer {
|
|
|
11467
11729
|
};
|
|
11468
11730
|
this.connect();
|
|
11469
11731
|
}
|
|
11732
|
+
name;
|
|
11733
|
+
path;
|
|
11734
|
+
logger;
|
|
11470
11735
|
remoteClients = /* @__PURE__ */ new Set();
|
|
11471
11736
|
listener;
|
|
11472
11737
|
connect() {
|
|
@@ -11594,6 +11859,8 @@ var ClusterCache = class {
|
|
|
11594
11859
|
};
|
|
11595
11860
|
this.connect();
|
|
11596
11861
|
}
|
|
11862
|
+
name;
|
|
11863
|
+
logger;
|
|
11597
11864
|
localCache = /* @__PURE__ */ new Map();
|
|
11598
11865
|
//private logger: Logger;
|
|
11599
11866
|
listener;
|
|
@@ -11753,6 +12020,8 @@ var LocalCache = class {
|
|
|
11753
12020
|
this.name = name;
|
|
11754
12021
|
this.logger = logger;
|
|
11755
12022
|
}
|
|
12023
|
+
name;
|
|
12024
|
+
logger;
|
|
11756
12025
|
localCache = /* @__PURE__ */ new Map();
|
|
11757
12026
|
dispose() {
|
|
11758
12027
|
}
|
|
@@ -13264,7 +13533,7 @@ async function runMigrations(db) {
|
|
|
13264
13533
|
await migration.init(db);
|
|
13265
13534
|
${serviceMigrations.map((file) => {
|
|
13266
13535
|
const name = `${file.substring(0, file.length - (0, import_node_path14.extname)(file).length)}`;
|
|
13267
|
-
return ` await migration.up.module(db, "${file}", (await require("../${(0, import_node_path14.relative)(service, "")}/${service}/migration/${name}.cjs")).default)`;
|
|
13536
|
+
return ` await migration.up.module(db, (await require("../${(0, import_node_path14.relative)(service, "")}/${service}/migration/${name}.cjs")).default.name ?? "${file}", (await require("../${(0, import_node_path14.relative)(service, "")}/${service}/migration/${name}.cjs")).default)`;
|
|
13268
13537
|
}).join("\n")}
|
|
13269
13538
|
}
|
|
13270
13539
|
module.exports = {
|
|
@@ -13276,7 +13545,7 @@ async function runMigrations(db) {
|
|
|
13276
13545
|
await migration.init(db);
|
|
13277
13546
|
${serviceMigrations.reverse().map((file) => {
|
|
13278
13547
|
const name = `${file.substring(0, file.length - (0, import_node_path14.extname)(file).length)}`;
|
|
13279
|
-
return ` await migration.down.module(db, "${file}", (await require("../${(0, import_node_path14.relative)(service, "")}/${service}/migration/${name}.cjs")).default)`;
|
|
13548
|
+
return ` await migration.down.module(db, (await require("../${(0, import_node_path14.relative)(service, "")}/${service}/migration/${name}.cjs")).default.name ?? "${file}", (await require("../${(0, import_node_path14.relative)(service, "")}/${service}/migration/${name}.cjs")).default)`;
|
|
13280
13549
|
}).join("\n")}
|
|
13281
13550
|
}
|
|
13282
13551
|
module.exports = {
|
|
@@ -17604,6 +17873,7 @@ var JSX2 = {
|
|
|
17604
17873
|
appendAPIModule,
|
|
17605
17874
|
createLogProviderOptions,
|
|
17606
17875
|
createServerInterface,
|
|
17876
|
+
defineRoute,
|
|
17607
17877
|
jsx,
|
|
17608
17878
|
jsx2HTML,
|
|
17609
17879
|
jwt,
|