kiro-memory 3.0.0 → 3.1.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/package.json +1 -1
- package/plugin/dist/cli/contextkit.js +27 -3
- package/plugin/dist/hooks/agentSpawn.js +27 -3
- package/plugin/dist/hooks/kiro-hooks.js +27 -3
- package/plugin/dist/hooks/postToolUse.js +27 -3
- package/plugin/dist/hooks/stop.js +27 -3
- package/plugin/dist/hooks/userPromptSubmit.js +27 -3
- package/plugin/dist/index.js +28 -4
- package/plugin/dist/sdk/index.js +27 -3
- package/plugin/dist/services/sqlite/Database.js +27 -3
- package/plugin/dist/services/sqlite/index.js +27 -3
- package/plugin/dist/viewer.css +1 -1
- package/plugin/dist/viewer.js +12 -12
- package/plugin/dist/viewer.js.map +3 -3
- package/plugin/dist/worker-service.js +15 -15
- package/plugin/dist/worker-service.js.map +3 -3
package/package.json
CHANGED
|
@@ -2028,23 +2028,47 @@ var BunQueryCompat = class {
|
|
|
2028
2028
|
constructor(db, sql) {
|
|
2029
2029
|
this._stmt = db.prepare(sql);
|
|
2030
2030
|
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Adatta parametri named da formato bun:sqlite a better-sqlite3.
|
|
2033
|
+
* bun:sqlite: chiavi CON prefisso (es. { $todayStart: 123 })
|
|
2034
|
+
* better-sqlite3: chiavi SENZA prefisso (es. { todayStart: 123 })
|
|
2035
|
+
*/
|
|
2036
|
+
_adaptParams(params) {
|
|
2037
|
+
if (params.length !== 1 || typeof params[0] !== "object" || params[0] === null || Array.isArray(params[0])) {
|
|
2038
|
+
return params;
|
|
2039
|
+
}
|
|
2040
|
+
const obj = params[0];
|
|
2041
|
+
const keys = Object.keys(obj);
|
|
2042
|
+
if (keys.length === 0) return params;
|
|
2043
|
+
if (!keys[0].startsWith("$") && !keys[0].startsWith("@") && !keys[0].startsWith(":")) {
|
|
2044
|
+
return params;
|
|
2045
|
+
}
|
|
2046
|
+
const adapted = {};
|
|
2047
|
+
for (const key of keys) {
|
|
2048
|
+
adapted[key.slice(1)] = obj[key];
|
|
2049
|
+
}
|
|
2050
|
+
return [adapted];
|
|
2051
|
+
}
|
|
2031
2052
|
/**
|
|
2032
2053
|
* Returns all rows
|
|
2033
2054
|
*/
|
|
2034
2055
|
all(...params) {
|
|
2035
|
-
|
|
2056
|
+
if (params.length === 0) return this._stmt.all();
|
|
2057
|
+
return this._stmt.all(...this._adaptParams(params));
|
|
2036
2058
|
}
|
|
2037
2059
|
/**
|
|
2038
2060
|
* Returns the first row or null
|
|
2039
2061
|
*/
|
|
2040
2062
|
get(...params) {
|
|
2041
|
-
|
|
2063
|
+
if (params.length === 0) return this._stmt.get();
|
|
2064
|
+
return this._stmt.get(...this._adaptParams(params));
|
|
2042
2065
|
}
|
|
2043
2066
|
/**
|
|
2044
2067
|
* Execute without results
|
|
2045
2068
|
*/
|
|
2046
2069
|
run(...params) {
|
|
2047
|
-
|
|
2070
|
+
if (params.length === 0) return this._stmt.run();
|
|
2071
|
+
return this._stmt.run(...this._adaptParams(params));
|
|
2048
2072
|
}
|
|
2049
2073
|
};
|
|
2050
2074
|
|
|
@@ -957,23 +957,47 @@ var BunQueryCompat = class {
|
|
|
957
957
|
constructor(db, sql) {
|
|
958
958
|
this._stmt = db.prepare(sql);
|
|
959
959
|
}
|
|
960
|
+
/**
|
|
961
|
+
* Adatta parametri named da formato bun:sqlite a better-sqlite3.
|
|
962
|
+
* bun:sqlite: chiavi CON prefisso (es. { $todayStart: 123 })
|
|
963
|
+
* better-sqlite3: chiavi SENZA prefisso (es. { todayStart: 123 })
|
|
964
|
+
*/
|
|
965
|
+
_adaptParams(params) {
|
|
966
|
+
if (params.length !== 1 || typeof params[0] !== "object" || params[0] === null || Array.isArray(params[0])) {
|
|
967
|
+
return params;
|
|
968
|
+
}
|
|
969
|
+
const obj = params[0];
|
|
970
|
+
const keys = Object.keys(obj);
|
|
971
|
+
if (keys.length === 0) return params;
|
|
972
|
+
if (!keys[0].startsWith("$") && !keys[0].startsWith("@") && !keys[0].startsWith(":")) {
|
|
973
|
+
return params;
|
|
974
|
+
}
|
|
975
|
+
const adapted = {};
|
|
976
|
+
for (const key of keys) {
|
|
977
|
+
adapted[key.slice(1)] = obj[key];
|
|
978
|
+
}
|
|
979
|
+
return [adapted];
|
|
980
|
+
}
|
|
960
981
|
/**
|
|
961
982
|
* Returns all rows
|
|
962
983
|
*/
|
|
963
984
|
all(...params) {
|
|
964
|
-
|
|
985
|
+
if (params.length === 0) return this._stmt.all();
|
|
986
|
+
return this._stmt.all(...this._adaptParams(params));
|
|
965
987
|
}
|
|
966
988
|
/**
|
|
967
989
|
* Returns the first row or null
|
|
968
990
|
*/
|
|
969
991
|
get(...params) {
|
|
970
|
-
|
|
992
|
+
if (params.length === 0) return this._stmt.get();
|
|
993
|
+
return this._stmt.get(...this._adaptParams(params));
|
|
971
994
|
}
|
|
972
995
|
/**
|
|
973
996
|
* Execute without results
|
|
974
997
|
*/
|
|
975
998
|
run(...params) {
|
|
976
|
-
|
|
999
|
+
if (params.length === 0) return this._stmt.run();
|
|
1000
|
+
return this._stmt.run(...this._adaptParams(params));
|
|
977
1001
|
}
|
|
978
1002
|
};
|
|
979
1003
|
|
|
@@ -769,23 +769,47 @@ var BunQueryCompat = class {
|
|
|
769
769
|
constructor(db, sql) {
|
|
770
770
|
this._stmt = db.prepare(sql);
|
|
771
771
|
}
|
|
772
|
+
/**
|
|
773
|
+
* Adatta parametri named da formato bun:sqlite a better-sqlite3.
|
|
774
|
+
* bun:sqlite: chiavi CON prefisso (es. { $todayStart: 123 })
|
|
775
|
+
* better-sqlite3: chiavi SENZA prefisso (es. { todayStart: 123 })
|
|
776
|
+
*/
|
|
777
|
+
_adaptParams(params) {
|
|
778
|
+
if (params.length !== 1 || typeof params[0] !== "object" || params[0] === null || Array.isArray(params[0])) {
|
|
779
|
+
return params;
|
|
780
|
+
}
|
|
781
|
+
const obj = params[0];
|
|
782
|
+
const keys = Object.keys(obj);
|
|
783
|
+
if (keys.length === 0) return params;
|
|
784
|
+
if (!keys[0].startsWith("$") && !keys[0].startsWith("@") && !keys[0].startsWith(":")) {
|
|
785
|
+
return params;
|
|
786
|
+
}
|
|
787
|
+
const adapted = {};
|
|
788
|
+
for (const key of keys) {
|
|
789
|
+
adapted[key.slice(1)] = obj[key];
|
|
790
|
+
}
|
|
791
|
+
return [adapted];
|
|
792
|
+
}
|
|
772
793
|
/**
|
|
773
794
|
* Returns all rows
|
|
774
795
|
*/
|
|
775
796
|
all(...params) {
|
|
776
|
-
|
|
797
|
+
if (params.length === 0) return this._stmt.all();
|
|
798
|
+
return this._stmt.all(...this._adaptParams(params));
|
|
777
799
|
}
|
|
778
800
|
/**
|
|
779
801
|
* Returns the first row or null
|
|
780
802
|
*/
|
|
781
803
|
get(...params) {
|
|
782
|
-
|
|
804
|
+
if (params.length === 0) return this._stmt.get();
|
|
805
|
+
return this._stmt.get(...this._adaptParams(params));
|
|
783
806
|
}
|
|
784
807
|
/**
|
|
785
808
|
* Execute without results
|
|
786
809
|
*/
|
|
787
810
|
run(...params) {
|
|
788
|
-
|
|
811
|
+
if (params.length === 0) return this._stmt.run();
|
|
812
|
+
return this._stmt.run(...this._adaptParams(params));
|
|
789
813
|
}
|
|
790
814
|
};
|
|
791
815
|
|
|
@@ -932,23 +932,47 @@ var BunQueryCompat = class {
|
|
|
932
932
|
constructor(db, sql) {
|
|
933
933
|
this._stmt = db.prepare(sql);
|
|
934
934
|
}
|
|
935
|
+
/**
|
|
936
|
+
* Adatta parametri named da formato bun:sqlite a better-sqlite3.
|
|
937
|
+
* bun:sqlite: chiavi CON prefisso (es. { $todayStart: 123 })
|
|
938
|
+
* better-sqlite3: chiavi SENZA prefisso (es. { todayStart: 123 })
|
|
939
|
+
*/
|
|
940
|
+
_adaptParams(params) {
|
|
941
|
+
if (params.length !== 1 || typeof params[0] !== "object" || params[0] === null || Array.isArray(params[0])) {
|
|
942
|
+
return params;
|
|
943
|
+
}
|
|
944
|
+
const obj = params[0];
|
|
945
|
+
const keys = Object.keys(obj);
|
|
946
|
+
if (keys.length === 0) return params;
|
|
947
|
+
if (!keys[0].startsWith("$") && !keys[0].startsWith("@") && !keys[0].startsWith(":")) {
|
|
948
|
+
return params;
|
|
949
|
+
}
|
|
950
|
+
const adapted = {};
|
|
951
|
+
for (const key of keys) {
|
|
952
|
+
adapted[key.slice(1)] = obj[key];
|
|
953
|
+
}
|
|
954
|
+
return [adapted];
|
|
955
|
+
}
|
|
935
956
|
/**
|
|
936
957
|
* Returns all rows
|
|
937
958
|
*/
|
|
938
959
|
all(...params) {
|
|
939
|
-
|
|
960
|
+
if (params.length === 0) return this._stmt.all();
|
|
961
|
+
return this._stmt.all(...this._adaptParams(params));
|
|
940
962
|
}
|
|
941
963
|
/**
|
|
942
964
|
* Returns the first row or null
|
|
943
965
|
*/
|
|
944
966
|
get(...params) {
|
|
945
|
-
|
|
967
|
+
if (params.length === 0) return this._stmt.get();
|
|
968
|
+
return this._stmt.get(...this._adaptParams(params));
|
|
946
969
|
}
|
|
947
970
|
/**
|
|
948
971
|
* Execute without results
|
|
949
972
|
*/
|
|
950
973
|
run(...params) {
|
|
951
|
-
|
|
974
|
+
if (params.length === 0) return this._stmt.run();
|
|
975
|
+
return this._stmt.run(...this._adaptParams(params));
|
|
952
976
|
}
|
|
953
977
|
};
|
|
954
978
|
|
|
@@ -932,23 +932,47 @@ var BunQueryCompat = class {
|
|
|
932
932
|
constructor(db, sql) {
|
|
933
933
|
this._stmt = db.prepare(sql);
|
|
934
934
|
}
|
|
935
|
+
/**
|
|
936
|
+
* Adatta parametri named da formato bun:sqlite a better-sqlite3.
|
|
937
|
+
* bun:sqlite: chiavi CON prefisso (es. { $todayStart: 123 })
|
|
938
|
+
* better-sqlite3: chiavi SENZA prefisso (es. { todayStart: 123 })
|
|
939
|
+
*/
|
|
940
|
+
_adaptParams(params) {
|
|
941
|
+
if (params.length !== 1 || typeof params[0] !== "object" || params[0] === null || Array.isArray(params[0])) {
|
|
942
|
+
return params;
|
|
943
|
+
}
|
|
944
|
+
const obj = params[0];
|
|
945
|
+
const keys = Object.keys(obj);
|
|
946
|
+
if (keys.length === 0) return params;
|
|
947
|
+
if (!keys[0].startsWith("$") && !keys[0].startsWith("@") && !keys[0].startsWith(":")) {
|
|
948
|
+
return params;
|
|
949
|
+
}
|
|
950
|
+
const adapted = {};
|
|
951
|
+
for (const key of keys) {
|
|
952
|
+
adapted[key.slice(1)] = obj[key];
|
|
953
|
+
}
|
|
954
|
+
return [adapted];
|
|
955
|
+
}
|
|
935
956
|
/**
|
|
936
957
|
* Returns all rows
|
|
937
958
|
*/
|
|
938
959
|
all(...params) {
|
|
939
|
-
|
|
960
|
+
if (params.length === 0) return this._stmt.all();
|
|
961
|
+
return this._stmt.all(...this._adaptParams(params));
|
|
940
962
|
}
|
|
941
963
|
/**
|
|
942
964
|
* Returns the first row or null
|
|
943
965
|
*/
|
|
944
966
|
get(...params) {
|
|
945
|
-
|
|
967
|
+
if (params.length === 0) return this._stmt.get();
|
|
968
|
+
return this._stmt.get(...this._adaptParams(params));
|
|
946
969
|
}
|
|
947
970
|
/**
|
|
948
971
|
* Execute without results
|
|
949
972
|
*/
|
|
950
973
|
run(...params) {
|
|
951
|
-
|
|
974
|
+
if (params.length === 0) return this._stmt.run();
|
|
975
|
+
return this._stmt.run(...this._adaptParams(params));
|
|
952
976
|
}
|
|
953
977
|
};
|
|
954
978
|
|
|
@@ -932,23 +932,47 @@ var BunQueryCompat = class {
|
|
|
932
932
|
constructor(db, sql) {
|
|
933
933
|
this._stmt = db.prepare(sql);
|
|
934
934
|
}
|
|
935
|
+
/**
|
|
936
|
+
* Adatta parametri named da formato bun:sqlite a better-sqlite3.
|
|
937
|
+
* bun:sqlite: chiavi CON prefisso (es. { $todayStart: 123 })
|
|
938
|
+
* better-sqlite3: chiavi SENZA prefisso (es. { todayStart: 123 })
|
|
939
|
+
*/
|
|
940
|
+
_adaptParams(params) {
|
|
941
|
+
if (params.length !== 1 || typeof params[0] !== "object" || params[0] === null || Array.isArray(params[0])) {
|
|
942
|
+
return params;
|
|
943
|
+
}
|
|
944
|
+
const obj = params[0];
|
|
945
|
+
const keys = Object.keys(obj);
|
|
946
|
+
if (keys.length === 0) return params;
|
|
947
|
+
if (!keys[0].startsWith("$") && !keys[0].startsWith("@") && !keys[0].startsWith(":")) {
|
|
948
|
+
return params;
|
|
949
|
+
}
|
|
950
|
+
const adapted = {};
|
|
951
|
+
for (const key of keys) {
|
|
952
|
+
adapted[key.slice(1)] = obj[key];
|
|
953
|
+
}
|
|
954
|
+
return [adapted];
|
|
955
|
+
}
|
|
935
956
|
/**
|
|
936
957
|
* Returns all rows
|
|
937
958
|
*/
|
|
938
959
|
all(...params) {
|
|
939
|
-
|
|
960
|
+
if (params.length === 0) return this._stmt.all();
|
|
961
|
+
return this._stmt.all(...this._adaptParams(params));
|
|
940
962
|
}
|
|
941
963
|
/**
|
|
942
964
|
* Returns the first row or null
|
|
943
965
|
*/
|
|
944
966
|
get(...params) {
|
|
945
|
-
|
|
967
|
+
if (params.length === 0) return this._stmt.get();
|
|
968
|
+
return this._stmt.get(...this._adaptParams(params));
|
|
946
969
|
}
|
|
947
970
|
/**
|
|
948
971
|
* Execute without results
|
|
949
972
|
*/
|
|
950
973
|
run(...params) {
|
|
951
|
-
|
|
974
|
+
if (params.length === 0) return this._stmt.run();
|
|
975
|
+
return this._stmt.run(...this._adaptParams(params));
|
|
952
976
|
}
|
|
953
977
|
};
|
|
954
978
|
|
package/plugin/dist/index.js
CHANGED
|
@@ -769,23 +769,47 @@ var BunQueryCompat = class {
|
|
|
769
769
|
constructor(db, sql) {
|
|
770
770
|
this._stmt = db.prepare(sql);
|
|
771
771
|
}
|
|
772
|
+
/**
|
|
773
|
+
* Adatta parametri named da formato bun:sqlite a better-sqlite3.
|
|
774
|
+
* bun:sqlite: chiavi CON prefisso (es. { $todayStart: 123 })
|
|
775
|
+
* better-sqlite3: chiavi SENZA prefisso (es. { todayStart: 123 })
|
|
776
|
+
*/
|
|
777
|
+
_adaptParams(params) {
|
|
778
|
+
if (params.length !== 1 || typeof params[0] !== "object" || params[0] === null || Array.isArray(params[0])) {
|
|
779
|
+
return params;
|
|
780
|
+
}
|
|
781
|
+
const obj = params[0];
|
|
782
|
+
const keys = Object.keys(obj);
|
|
783
|
+
if (keys.length === 0) return params;
|
|
784
|
+
if (!keys[0].startsWith("$") && !keys[0].startsWith("@") && !keys[0].startsWith(":")) {
|
|
785
|
+
return params;
|
|
786
|
+
}
|
|
787
|
+
const adapted = {};
|
|
788
|
+
for (const key of keys) {
|
|
789
|
+
adapted[key.slice(1)] = obj[key];
|
|
790
|
+
}
|
|
791
|
+
return [adapted];
|
|
792
|
+
}
|
|
772
793
|
/**
|
|
773
794
|
* Returns all rows
|
|
774
795
|
*/
|
|
775
796
|
all(...params) {
|
|
776
|
-
|
|
797
|
+
if (params.length === 0) return this._stmt.all();
|
|
798
|
+
return this._stmt.all(...this._adaptParams(params));
|
|
777
799
|
}
|
|
778
800
|
/**
|
|
779
801
|
* Returns the first row or null
|
|
780
802
|
*/
|
|
781
803
|
get(...params) {
|
|
782
|
-
|
|
804
|
+
if (params.length === 0) return this._stmt.get();
|
|
805
|
+
return this._stmt.get(...this._adaptParams(params));
|
|
783
806
|
}
|
|
784
807
|
/**
|
|
785
808
|
* Execute without results
|
|
786
809
|
*/
|
|
787
810
|
run(...params) {
|
|
788
|
-
|
|
811
|
+
if (params.length === 0) return this._stmt.run();
|
|
812
|
+
return this._stmt.run(...this._adaptParams(params));
|
|
789
813
|
}
|
|
790
814
|
};
|
|
791
815
|
|
|
@@ -3039,7 +3063,7 @@ async function runHook(name, handler) {
|
|
|
3039
3063
|
}
|
|
3040
3064
|
|
|
3041
3065
|
// src/index.ts
|
|
3042
|
-
var VERSION = "3.
|
|
3066
|
+
var VERSION = "3.1.0";
|
|
3043
3067
|
export {
|
|
3044
3068
|
KiroMemoryDatabase,
|
|
3045
3069
|
KiroMemorySDK,
|
package/plugin/dist/sdk/index.js
CHANGED
|
@@ -769,23 +769,47 @@ var BunQueryCompat = class {
|
|
|
769
769
|
constructor(db, sql) {
|
|
770
770
|
this._stmt = db.prepare(sql);
|
|
771
771
|
}
|
|
772
|
+
/**
|
|
773
|
+
* Adatta parametri named da formato bun:sqlite a better-sqlite3.
|
|
774
|
+
* bun:sqlite: chiavi CON prefisso (es. { $todayStart: 123 })
|
|
775
|
+
* better-sqlite3: chiavi SENZA prefisso (es. { todayStart: 123 })
|
|
776
|
+
*/
|
|
777
|
+
_adaptParams(params) {
|
|
778
|
+
if (params.length !== 1 || typeof params[0] !== "object" || params[0] === null || Array.isArray(params[0])) {
|
|
779
|
+
return params;
|
|
780
|
+
}
|
|
781
|
+
const obj = params[0];
|
|
782
|
+
const keys = Object.keys(obj);
|
|
783
|
+
if (keys.length === 0) return params;
|
|
784
|
+
if (!keys[0].startsWith("$") && !keys[0].startsWith("@") && !keys[0].startsWith(":")) {
|
|
785
|
+
return params;
|
|
786
|
+
}
|
|
787
|
+
const adapted = {};
|
|
788
|
+
for (const key of keys) {
|
|
789
|
+
adapted[key.slice(1)] = obj[key];
|
|
790
|
+
}
|
|
791
|
+
return [adapted];
|
|
792
|
+
}
|
|
772
793
|
/**
|
|
773
794
|
* Returns all rows
|
|
774
795
|
*/
|
|
775
796
|
all(...params) {
|
|
776
|
-
|
|
797
|
+
if (params.length === 0) return this._stmt.all();
|
|
798
|
+
return this._stmt.all(...this._adaptParams(params));
|
|
777
799
|
}
|
|
778
800
|
/**
|
|
779
801
|
* Returns the first row or null
|
|
780
802
|
*/
|
|
781
803
|
get(...params) {
|
|
782
|
-
|
|
804
|
+
if (params.length === 0) return this._stmt.get();
|
|
805
|
+
return this._stmt.get(...this._adaptParams(params));
|
|
783
806
|
}
|
|
784
807
|
/**
|
|
785
808
|
* Execute without results
|
|
786
809
|
*/
|
|
787
810
|
run(...params) {
|
|
788
|
-
|
|
811
|
+
if (params.length === 0) return this._stmt.run();
|
|
812
|
+
return this._stmt.run(...this._adaptParams(params));
|
|
789
813
|
}
|
|
790
814
|
};
|
|
791
815
|
|
|
@@ -50,23 +50,47 @@ var BunQueryCompat = class {
|
|
|
50
50
|
constructor(db, sql) {
|
|
51
51
|
this._stmt = db.prepare(sql);
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Adatta parametri named da formato bun:sqlite a better-sqlite3.
|
|
55
|
+
* bun:sqlite: chiavi CON prefisso (es. { $todayStart: 123 })
|
|
56
|
+
* better-sqlite3: chiavi SENZA prefisso (es. { todayStart: 123 })
|
|
57
|
+
*/
|
|
58
|
+
_adaptParams(params) {
|
|
59
|
+
if (params.length !== 1 || typeof params[0] !== "object" || params[0] === null || Array.isArray(params[0])) {
|
|
60
|
+
return params;
|
|
61
|
+
}
|
|
62
|
+
const obj = params[0];
|
|
63
|
+
const keys = Object.keys(obj);
|
|
64
|
+
if (keys.length === 0) return params;
|
|
65
|
+
if (!keys[0].startsWith("$") && !keys[0].startsWith("@") && !keys[0].startsWith(":")) {
|
|
66
|
+
return params;
|
|
67
|
+
}
|
|
68
|
+
const adapted = {};
|
|
69
|
+
for (const key of keys) {
|
|
70
|
+
adapted[key.slice(1)] = obj[key];
|
|
71
|
+
}
|
|
72
|
+
return [adapted];
|
|
73
|
+
}
|
|
53
74
|
/**
|
|
54
75
|
* Returns all rows
|
|
55
76
|
*/
|
|
56
77
|
all(...params) {
|
|
57
|
-
|
|
78
|
+
if (params.length === 0) return this._stmt.all();
|
|
79
|
+
return this._stmt.all(...this._adaptParams(params));
|
|
58
80
|
}
|
|
59
81
|
/**
|
|
60
82
|
* Returns the first row or null
|
|
61
83
|
*/
|
|
62
84
|
get(...params) {
|
|
63
|
-
|
|
85
|
+
if (params.length === 0) return this._stmt.get();
|
|
86
|
+
return this._stmt.get(...this._adaptParams(params));
|
|
64
87
|
}
|
|
65
88
|
/**
|
|
66
89
|
* Execute without results
|
|
67
90
|
*/
|
|
68
91
|
run(...params) {
|
|
69
|
-
|
|
92
|
+
if (params.length === 0) return this._stmt.run();
|
|
93
|
+
return this._stmt.run(...this._adaptParams(params));
|
|
70
94
|
}
|
|
71
95
|
};
|
|
72
96
|
|
|
@@ -50,23 +50,47 @@ var BunQueryCompat = class {
|
|
|
50
50
|
constructor(db, sql) {
|
|
51
51
|
this._stmt = db.prepare(sql);
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Adatta parametri named da formato bun:sqlite a better-sqlite3.
|
|
55
|
+
* bun:sqlite: chiavi CON prefisso (es. { $todayStart: 123 })
|
|
56
|
+
* better-sqlite3: chiavi SENZA prefisso (es. { todayStart: 123 })
|
|
57
|
+
*/
|
|
58
|
+
_adaptParams(params) {
|
|
59
|
+
if (params.length !== 1 || typeof params[0] !== "object" || params[0] === null || Array.isArray(params[0])) {
|
|
60
|
+
return params;
|
|
61
|
+
}
|
|
62
|
+
const obj = params[0];
|
|
63
|
+
const keys = Object.keys(obj);
|
|
64
|
+
if (keys.length === 0) return params;
|
|
65
|
+
if (!keys[0].startsWith("$") && !keys[0].startsWith("@") && !keys[0].startsWith(":")) {
|
|
66
|
+
return params;
|
|
67
|
+
}
|
|
68
|
+
const adapted = {};
|
|
69
|
+
for (const key of keys) {
|
|
70
|
+
adapted[key.slice(1)] = obj[key];
|
|
71
|
+
}
|
|
72
|
+
return [adapted];
|
|
73
|
+
}
|
|
53
74
|
/**
|
|
54
75
|
* Returns all rows
|
|
55
76
|
*/
|
|
56
77
|
all(...params) {
|
|
57
|
-
|
|
78
|
+
if (params.length === 0) return this._stmt.all();
|
|
79
|
+
return this._stmt.all(...this._adaptParams(params));
|
|
58
80
|
}
|
|
59
81
|
/**
|
|
60
82
|
* Returns the first row or null
|
|
61
83
|
*/
|
|
62
84
|
get(...params) {
|
|
63
|
-
|
|
85
|
+
if (params.length === 0) return this._stmt.get();
|
|
86
|
+
return this._stmt.get(...this._adaptParams(params));
|
|
64
87
|
}
|
|
65
88
|
/**
|
|
66
89
|
* Execute without results
|
|
67
90
|
*/
|
|
68
91
|
run(...params) {
|
|
69
|
-
|
|
92
|
+
if (params.length === 0) return this._stmt.run();
|
|
93
|
+
return this._stmt.run(...this._adaptParams(params));
|
|
70
94
|
}
|
|
71
95
|
};
|
|
72
96
|
|