@rpcbase/api 0.34.0 → 0.35.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/{handler-D7eudoVU.js → handler-BgIfr0Vh.js} +1 -1
- package/dist/{handler-v8WUNWbe.js → handler-D-HYO2Rb.js} +1 -1
- package/dist/{index-Cvr_AVid.js → index-DNsXQO-7.js} +7 -5
- package/dist/index.js +1 -1
- package/dist/initApi.d.ts +5 -1
- package/dist/initApi.d.ts.map +1 -1
- package/dist/{isValidNumber-R0qDZ-qD.js → isValidNumber-D_h4CKEH.js} +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isValidNumber, a as isEmail } from "./isValidNumber-
|
|
1
|
+
import { i as isValidNumber, a as isEmail } from "./isValidNumber-D_h4CKEH.js";
|
|
2
2
|
import { o as object, b as boolean, s as string } from "./schemas-DKK0lkQz.js";
|
|
3
3
|
const Route = "/api/rb/auth/sign-in";
|
|
4
4
|
const requestSchema = object({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import require$$0 from "crypto";
|
|
2
|
-
import { i as isValidNumber, a as isEmail } from "./isValidNumber-
|
|
2
|
+
import { i as isValidNumber, a as isEmail } from "./isValidNumber-D_h4CKEH.js";
|
|
3
3
|
import { loadModel } from "@rpcbase/api";
|
|
4
4
|
import { hashPassword } from "@rpcbase/server";
|
|
5
5
|
import { o as object, s as string, b as boolean } from "./schemas-DKK0lkQz.js";
|
|
@@ -33042,7 +33042,7 @@ process.env = {
|
|
|
33042
33042
|
...__rb_env__,
|
|
33043
33043
|
...process.env
|
|
33044
33044
|
};
|
|
33045
|
-
const initApi = async (app) => {
|
|
33045
|
+
const initApi = async (app, opts) => {
|
|
33046
33046
|
await initApiClient({ app });
|
|
33047
33047
|
const registerHandler = (method, path, handler) => {
|
|
33048
33048
|
assert(path.startsWith("/api"), "API routes must start with /api");
|
|
@@ -33071,15 +33071,17 @@ const initApi = async (app) => {
|
|
|
33071
33071
|
app.use("/api", function __FIRST_API_MIDDLEWARE__(_req, _res, next) {
|
|
33072
33072
|
next();
|
|
33073
33073
|
});
|
|
33074
|
-
const routes = {
|
|
33075
|
-
|
|
33076
|
-
.../* @__PURE__ */ Object.assign({ "../../auth/src/api/sign-in/handler.ts": () => import("./handler-D7eudoVU.js"), "../../auth/src/api/sign-out/handler.ts": () => import("./handler-rzI-pkuD.js"), "../../auth/src/api/sign-up/handler.ts": () => import("./handler-v8WUNWbe.js") }),
|
|
33077
|
-
// @ts-expect-error: Property 'glob' does not exist on type 'ImportMeta'.
|
|
33074
|
+
const routes = opts?.routes ?? {
|
|
33075
|
+
.../* @__PURE__ */ Object.assign({ "../../auth/src/api/sign-in/handler.ts": () => import("./handler-BgIfr0Vh.js"), "../../auth/src/api/sign-out/handler.ts": () => import("./handler-rzI-pkuD.js"), "../../auth/src/api/sign-up/handler.ts": () => import("./handler-D-HYO2Rb.js") }),
|
|
33078
33076
|
.../* @__PURE__ */ Object.assign({})
|
|
33079
33077
|
};
|
|
33080
33078
|
const routeEntries = Object.entries(routes);
|
|
33081
33079
|
const loadRoute = async ([routePath, loadFn]) => {
|
|
33082
33080
|
const routeModule = await loadFn();
|
|
33081
|
+
if (typeof routeModule.default !== "function") {
|
|
33082
|
+
console.warn(`skipping api module without default export: ${routePath}`);
|
|
33083
|
+
return;
|
|
33084
|
+
}
|
|
33083
33085
|
routeModule.default(api);
|
|
33084
33086
|
const loggedPath = routePath.startsWith("../../") ? routePath.replace("../../", "@rpcbase/") : routePath;
|
|
33085
33087
|
const GRAY = "\x1B[90m";
|
package/dist/index.js
CHANGED
package/dist/initApi.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { Application } from 'express';
|
|
2
|
-
|
|
2
|
+
type InitApiOptions = {
|
|
3
|
+
routes?: Record<string, () => Promise<any>>;
|
|
4
|
+
};
|
|
5
|
+
export declare const initApi: (app: Application, opts?: InitApiOptions) => Promise<void>;
|
|
6
|
+
export {};
|
|
3
7
|
//# sourceMappingURL=initApi.d.ts.map
|
package/dist/initApi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initApi.d.ts","sourceRoot":"","sources":["../src/initApi.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAS,MAAM,SAAS,CAAA;AAiB5C,eAAO,MAAM,OAAO,GAAU,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"initApi.d.ts","sourceRoot":"","sources":["../src/initApi.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAS,MAAM,SAAS,CAAA;AAiB5C,KAAK,cAAc,GAAG;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;CAC5C,CAAA;AAED,eAAO,MAAM,OAAO,GAAU,KAAK,WAAW,EAAE,OAAO,cAAc,kBAiFpE,CAAA"}
|