create-cellsweb-rpc-api 1.0.7 → 1.0.9
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/bin/create.js
CHANGED
|
@@ -130,7 +130,7 @@ async function main() {
|
|
|
130
130
|
"create:middleware": "tsx scripts/create-middleware.ts",
|
|
131
131
|
},
|
|
132
132
|
dependencies: {
|
|
133
|
-
"@cellsweb/rpc-core": "^1.0.
|
|
133
|
+
"@cellsweb/rpc-core": "^1.0.3",
|
|
134
134
|
"@aws-sdk/client-s3": "^3.700.0",
|
|
135
135
|
"@paralleldrive/cuid2": "^2.2.2",
|
|
136
136
|
"@sentry/node": "^8.40.0",
|
|
@@ -213,7 +213,9 @@ async function main() {
|
|
|
213
213
|
// ── 8. Install ────────────────────────────────────────────────────────────
|
|
214
214
|
console.log(` ${dim("Installing dependencies with")} ${bold(pm)} ...\n`);
|
|
215
215
|
try {
|
|
216
|
-
|
|
216
|
+
const installCmd =
|
|
217
|
+
pm === "pnpm" ? "pnpm install --config.onlyBuiltDependencies=esbuild" : `${pm} install`;
|
|
218
|
+
execSync(installCmd, { cwd: targetDir, stdio: "inherit" });
|
|
217
219
|
} catch {
|
|
218
220
|
console.log(` ${yellow("⚠")} Install failed — run ${bold(`${pm} install`)} manually.\n`);
|
|
219
221
|
}
|
package/package.json
CHANGED
|
@@ -4,12 +4,12 @@ export type UserRole = "user" | "admin" | "staff" | "vendor" | "dev";
|
|
|
4
4
|
|
|
5
5
|
export const metadata = {
|
|
6
6
|
name: "auth",
|
|
7
|
-
description: "Validates
|
|
7
|
+
description: "Validates bearer token and enforces allowed roles: {{roles}}",
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const headersSchema = Type.Object({
|
|
11
|
-
authorization: Type.Optional(Type.String()),
|
|
12
|
-
token: Type.Optional(Type.String()),
|
|
11
|
+
authorization: Type.Optional(Type.String({ description: "Bearer JWT token for authentication" })),
|
|
12
|
+
token: Type.Optional(Type.String({ description: "Alternative token header" })),
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
export const optionsSchema = Type.Object({
|
|
@@ -22,6 +22,7 @@ export const optionsSchema = Type.Object({
|
|
|
22
22
|
Type.Literal("staff"),
|
|
23
23
|
Type.Literal("dev"),
|
|
24
24
|
]),
|
|
25
|
+
{ description: "Allowed user roles for this endpoint" },
|
|
25
26
|
),
|
|
26
27
|
),
|
|
27
28
|
});
|
|
@@ -2,10 +2,10 @@ import { Type } from "@sinclair/typebox";
|
|
|
2
2
|
|
|
3
3
|
export const metadata = {
|
|
4
4
|
name: "rateLimit",
|
|
5
|
-
description: "Enforces per-function rate
|
|
5
|
+
description: "Enforces per-function rate limit of {{maxRequests}} requests per {{windowSeconds}}s window",
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export const optionsSchema = Type.Object({
|
|
9
|
-
windowSeconds: Type.Number({ minimum: 1, default: 60 }),
|
|
10
|
-
maxRequests: Type.Number({ minimum: 1, default: 100 }),
|
|
9
|
+
windowSeconds: Type.Number({ minimum: 1, default: 60, description: "Time window duration in seconds" }),
|
|
10
|
+
maxRequests: Type.Number({ minimum: 1, default: 100, description: "Maximum requests allowed within window" }),
|
|
11
11
|
});
|