rhythia-api 45.0.0 → 56.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 CHANGED
@@ -1,3 +1,12 @@
1
- export { Schema as CreateUser } from "./api/createUser"
2
- export { Schema as EditUser } from "./api/editUser"
1
+ import { handleApi } from "./handleApi"
2
+
3
+ // ./api/createUser.ts API
4
+ import { Schema as CreateUser } from "./api/createUser"
5
+ export { Schema as SchemaCreateUser } from "./api/createUser"
6
+ export const createUser = handleApi(CreateUser)
7
+
8
+ // ./api/editUser.ts API
9
+ import { Schema as EditUser } from "./api/editUser"
10
+ export { Schema as SchemaEditUser } from "./api/editUser"
11
+ export const editUser = handleApi(EditUser)
3
12
  export { handleApi } from "./handleApi"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "45.0.0",
3
+ "version": "56.0.0",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "update": "bun scripts/update.ts",
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 Schema${upperFirst(apiName)} } from "./api/${apiName}"`
35
+ );
36
+
25
37
  exports.push(
26
- `export { Schema as ${upperFirst(path.parse(api).name)} } from "./api/${
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"`);