@teamkeel/functions-runtime 0.455.2 → 0.456.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/index.cjs +35 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -150,7 +150,10 @@ var KeelCamelCasePlugin = class {
|
|
|
150
150
|
}
|
|
151
151
|
constructor(opt) {
|
|
152
152
|
this.opt = opt;
|
|
153
|
-
this.CamelCasePlugin = new CamelCasePlugin(
|
|
153
|
+
this.CamelCasePlugin = new CamelCasePlugin({
|
|
154
|
+
...opt,
|
|
155
|
+
underscoreBeforeDigits: true
|
|
156
|
+
});
|
|
154
157
|
}
|
|
155
158
|
transformQuery(args) {
|
|
156
159
|
return this.CamelCasePlugin.transformQuery(args);
|
|
@@ -994,18 +997,34 @@ __name(isReferencingExistingRecord, "isReferencingExistingRecord");
|
|
|
994
997
|
import { sql as sql2 } from "kysely";
|
|
995
998
|
|
|
996
999
|
// src/casing.js
|
|
997
|
-
import {
|
|
1000
|
+
import {
|
|
1001
|
+
snakeCase as snakeCaseBase,
|
|
1002
|
+
camelCase as camelCaseBase
|
|
1003
|
+
} from "change-case";
|
|
1004
|
+
var splitRegexp = [
|
|
1005
|
+
/([a-z0-9])([A-Z])/g,
|
|
1006
|
+
/([A-Z])([A-Z][a-z])/g,
|
|
1007
|
+
/([a-zA-Z])([0-9])/g
|
|
1008
|
+
];
|
|
1009
|
+
function camelCaseTransform(input, index) {
|
|
1010
|
+
if (index === 0) return input.toLowerCase();
|
|
1011
|
+
const firstChar = input.charAt(0);
|
|
1012
|
+
const lowerChars = input.substr(1).toLowerCase();
|
|
1013
|
+
return `${firstChar.toUpperCase()}${lowerChars}`;
|
|
1014
|
+
}
|
|
1015
|
+
__name(camelCaseTransform, "camelCaseTransform");
|
|
1016
|
+
function snakeCase(str) {
|
|
1017
|
+
return snakeCaseBase(str, { splitRegexp });
|
|
1018
|
+
}
|
|
1019
|
+
__name(snakeCase, "snakeCase");
|
|
1020
|
+
function camelCase(str) {
|
|
1021
|
+
return camelCaseBase(str, { transform: camelCaseTransform, splitRegexp });
|
|
1022
|
+
}
|
|
1023
|
+
__name(camelCase, "camelCase");
|
|
998
1024
|
function camelCaseObject(obj = {}) {
|
|
999
1025
|
const r = {};
|
|
1000
1026
|
for (const key of Object.keys(obj)) {
|
|
1001
|
-
r[camelCase(key
|
|
1002
|
-
transform: camelCaseTransform,
|
|
1003
|
-
splitRegexp: [
|
|
1004
|
-
/([a-z0-9])([A-Z])/g,
|
|
1005
|
-
/([A-Z])([A-Z][a-z])/g,
|
|
1006
|
-
/([a-zA-Z])([0-9])/g
|
|
1007
|
-
]
|
|
1008
|
-
})] = obj[key];
|
|
1027
|
+
r[camelCase(key)] = obj[key];
|
|
1009
1028
|
}
|
|
1010
1029
|
return r;
|
|
1011
1030
|
}
|
|
@@ -1013,13 +1032,7 @@ __name(camelCaseObject, "camelCaseObject");
|
|
|
1013
1032
|
function snakeCaseObject(obj) {
|
|
1014
1033
|
const r = {};
|
|
1015
1034
|
for (const key of Object.keys(obj)) {
|
|
1016
|
-
r[snakeCase(key
|
|
1017
|
-
splitRegexp: [
|
|
1018
|
-
/([a-z0-9])([A-Z])/g,
|
|
1019
|
-
/([A-Z])([A-Z][a-z])/g,
|
|
1020
|
-
/([a-zA-Z])([0-9])/g
|
|
1021
|
-
]
|
|
1022
|
-
})] = obj[key];
|
|
1035
|
+
r[snakeCase(key)] = obj[key];
|
|
1023
1036
|
}
|
|
1024
1037
|
return r;
|
|
1025
1038
|
}
|
|
@@ -1029,13 +1042,6 @@ function upperCamelCase(s) {
|
|
|
1029
1042
|
return s[0].toUpperCase() + s.substring(1);
|
|
1030
1043
|
}
|
|
1031
1044
|
__name(upperCamelCase, "upperCamelCase");
|
|
1032
|
-
function camelCaseTransform(input, index) {
|
|
1033
|
-
if (index === 0) return input.toLowerCase();
|
|
1034
|
-
const firstChar = input.charAt(0);
|
|
1035
|
-
const lowerChars = input.substr(1).toLowerCase();
|
|
1036
|
-
return `${firstChar.toUpperCase()}${lowerChars}`;
|
|
1037
|
-
}
|
|
1038
|
-
__name(camelCaseTransform, "camelCaseTransform");
|
|
1039
1045
|
|
|
1040
1046
|
// src/TimePeriod.js
|
|
1041
1047
|
var TimePeriod = class _TimePeriod {
|