@onyx.dev/onyx-database 0.1.7 → 0.2.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/README.md +1 -1
- package/dist/index.cjs +15 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -926,6 +926,17 @@ function clearCacheConfig() {
|
|
|
926
926
|
function toSingleCondition(criteria) {
|
|
927
927
|
return { conditionType: "SingleCondition", criteria };
|
|
928
928
|
}
|
|
929
|
+
function flattenStrings(values) {
|
|
930
|
+
const flat = [];
|
|
931
|
+
for (const value of values) {
|
|
932
|
+
if (Array.isArray(value)) {
|
|
933
|
+
flat.push(...value);
|
|
934
|
+
} else if (typeof value === "string") {
|
|
935
|
+
flat.push(value);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
return flat;
|
|
939
|
+
}
|
|
929
940
|
function toCondition(input) {
|
|
930
941
|
if (typeof input.toCondition === "function") {
|
|
931
942
|
return input.toCondition();
|
|
@@ -1005,7 +1016,7 @@ var OnyxDatabaseImpl = class {
|
|
|
1005
1016
|
null,
|
|
1006
1017
|
this.defaultPartition
|
|
1007
1018
|
);
|
|
1008
|
-
qb.
|
|
1019
|
+
qb.select(...fields);
|
|
1009
1020
|
return qb;
|
|
1010
1021
|
}
|
|
1011
1022
|
cascade(...relationships) {
|
|
@@ -1212,13 +1223,13 @@ var QueryBuilderImpl = class {
|
|
|
1212
1223
|
this.table = table;
|
|
1213
1224
|
return this;
|
|
1214
1225
|
}
|
|
1215
|
-
|
|
1216
|
-
const flat = fields
|
|
1226
|
+
select(...fields) {
|
|
1227
|
+
const flat = flattenStrings(fields);
|
|
1217
1228
|
this.fields = flat.length > 0 ? flat : null;
|
|
1218
1229
|
return this;
|
|
1219
1230
|
}
|
|
1220
1231
|
resolve(...values) {
|
|
1221
|
-
const flat = values
|
|
1232
|
+
const flat = flattenStrings(values);
|
|
1222
1233
|
this.resolvers = flat.length > 0 ? flat : null;
|
|
1223
1234
|
return this;
|
|
1224
1235
|
}
|