@spfn/core 0.1.0-alpha.27 → 0.1.0-alpha.29
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/codegen/index.js +20 -3
- package/dist/codegen/index.js.map +1 -1
- package/dist/db/index.d.ts +2 -2
- package/dist/db/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{postgres-errors-CVlVmKjx.d.ts → postgres-errors-CJdZW_FZ.d.ts} +2 -2
- package/dist/scripts/index.js +20 -3
- package/dist/scripts/index.js.map +1 -1
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
package/dist/codegen/index.js
CHANGED
|
@@ -194,13 +194,30 @@ function extractResourceName(path) {
|
|
|
194
194
|
if (staticSegments.length === 0) {
|
|
195
195
|
return "root";
|
|
196
196
|
}
|
|
197
|
+
const first = toCamelCase(staticSegments[0], false);
|
|
197
198
|
if (staticSegments.length === 1) {
|
|
198
|
-
return
|
|
199
|
+
return first;
|
|
199
200
|
}
|
|
200
|
-
const result = [
|
|
201
|
+
const result = [first];
|
|
201
202
|
for (let i = 1; i < staticSegments.length; i++) {
|
|
202
203
|
const seg = staticSegments[i];
|
|
203
|
-
result.push(seg
|
|
204
|
+
result.push(toCamelCase(seg, true));
|
|
205
|
+
}
|
|
206
|
+
return result.join("");
|
|
207
|
+
}
|
|
208
|
+
function toCamelCase(str, capitalize) {
|
|
209
|
+
const parts = str.split(/[-_]/);
|
|
210
|
+
if (parts.length === 1) {
|
|
211
|
+
return capitalize ? str.charAt(0).toUpperCase() + str.slice(1) : str;
|
|
212
|
+
}
|
|
213
|
+
const result = [];
|
|
214
|
+
for (let i = 0; i < parts.length; i++) {
|
|
215
|
+
const part = parts[i];
|
|
216
|
+
if (i === 0 && !capitalize) {
|
|
217
|
+
result.push(part);
|
|
218
|
+
} else {
|
|
219
|
+
result.push(part.charAt(0).toUpperCase() + part.slice(1));
|
|
220
|
+
}
|
|
204
221
|
}
|
|
205
222
|
return result.join("");
|
|
206
223
|
}
|