rhythia-api 45.0.0 → 55.0.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/index.ts +9 -0
- package/package.json +1 -1
- package/scripts/update.ts +14 -4
package/index.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import { handleApi } from "./handleApi"
|
|
2
|
+
|
|
3
|
+
// ./api/createUser.ts API
|
|
4
|
+
import { Schema as CreateUser } from "./api/createUser"
|
|
1
5
|
export { Schema as CreateUser } from "./api/createUser"
|
|
6
|
+
export const createUser = handleApi(CreateUser)
|
|
7
|
+
|
|
8
|
+
// ./api/editUser.ts API
|
|
9
|
+
import { Schema as EditUser } from "./api/editUser"
|
|
2
10
|
export { Schema as EditUser } from "./api/editUser"
|
|
11
|
+
export const editUser = handleApi(EditUser)
|
|
3
12
|
export { handleApi } from "./handleApi"
|
package/package.json
CHANGED
package/scripts/update.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $ } from "bun";
|
|
2
2
|
import { readdirSync, readFileSync, writeFileSync } from "fs";
|
|
3
|
-
import { upperFirst } from "lodash";
|
|
3
|
+
import { lowerFirst, upperFirst } from "lodash";
|
|
4
4
|
import path from "path";
|
|
5
5
|
const packageJson = JSON.parse(readFileSync("./package.json", "utf-8"));
|
|
6
6
|
|
|
@@ -14,6 +14,8 @@ writeFileSync("./package.json", JSON.stringify(packageJson, null, 2));
|
|
|
14
14
|
const apis = readdirSync("./api");
|
|
15
15
|
|
|
16
16
|
const exports: string[] = [];
|
|
17
|
+
exports.push(`import { handleApi } from "./handleApi"`);
|
|
18
|
+
|
|
17
19
|
for (const api of apis) {
|
|
18
20
|
if (
|
|
19
21
|
!readFileSync(path.join("./api", api), "utf-8").includes(
|
|
@@ -22,10 +24,18 @@ for (const api of apis) {
|
|
|
22
24
|
) {
|
|
23
25
|
continue;
|
|
24
26
|
}
|
|
27
|
+
exports.push(`\n// ./api/${api} API`);
|
|
28
|
+
|
|
29
|
+
const apiName = path.parse(api).name;
|
|
30
|
+
exports.push(
|
|
31
|
+
`import { Schema as ${upperFirst(apiName)} } from "./api/${apiName}"`
|
|
32
|
+
);
|
|
33
|
+
exports.push(
|
|
34
|
+
`export { Schema as ${upperFirst(apiName)} } from "./api/${apiName}"`
|
|
35
|
+
);
|
|
36
|
+
|
|
25
37
|
exports.push(
|
|
26
|
-
`export {
|
|
27
|
-
path.parse(api).name
|
|
28
|
-
}"`
|
|
38
|
+
`export const ${lowerFirst(apiName)} = handleApi(${upperFirst(apiName)})`
|
|
29
39
|
);
|
|
30
40
|
}
|
|
31
41
|
exports.push(`export { handleApi } from "./handleApi"`);
|