create-cellsweb-rpc-api 1.0.9 → 1.0.10
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.5",
|
|
134
134
|
"@aws-sdk/client-s3": "^3.700.0",
|
|
135
135
|
"@paralleldrive/cuid2": "^2.2.2",
|
|
136
136
|
"@sentry/node": "^8.40.0",
|
package/package.json
CHANGED
|
@@ -23,21 +23,25 @@ function tplConstants(name: string): string {
|
|
|
23
23
|
* MIDDLEWARE CONTRACT & METADATA
|
|
24
24
|
*
|
|
25
25
|
* WHAT TO TOUCH:
|
|
26
|
-
* - metadata:
|
|
27
|
-
* - headersSchema: Optional headers this middleware requires/reads.
|
|
28
|
-
* - optionsSchema: Config options passed in function middlewares.ts.
|
|
26
|
+
* - metadata: Human-readable description displayed in /docs.
|
|
27
|
+
* - headersSchema: Optional headers this middleware requires/reads. Include description in Type properties!
|
|
28
|
+
* - optionsSchema: Config options passed in function middlewares.ts. Include description & default in Type properties!
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
import { Type } from "@sinclair/typebox";
|
|
32
32
|
|
|
33
33
|
export const metadata = {
|
|
34
34
|
name: "${name}",
|
|
35
|
-
description: "
|
|
35
|
+
description: "Enforces security policies or request transformations for ${name}",
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
export const headersSchema = Type.Object({
|
|
38
|
+
export const headersSchema = Type.Object({
|
|
39
|
+
// e.g. "x-${name}-token": Type.String({ description: "Authentication token for ${name}" })
|
|
40
|
+
}, { additionalProperties: true });
|
|
39
41
|
|
|
40
|
-
export const optionsSchema = Type.Object({
|
|
42
|
+
export const optionsSchema = Type.Object({
|
|
43
|
+
// e.g. enabled: Type.Boolean({ default: true, description: "Enable ${name} middleware processing" })
|
|
44
|
+
}, { additionalProperties: false });
|
|
41
45
|
`;
|
|
42
46
|
}
|
|
43
47
|
|
|
@@ -4,7 +4,7 @@ export type UserRole = "user" | "admin" | "staff" | "vendor" | "dev";
|
|
|
4
4
|
|
|
5
5
|
export const metadata = {
|
|
6
6
|
name: "auth",
|
|
7
|
-
description: "Validates bearer token and enforces
|
|
7
|
+
description: "Validates bearer token and enforces role-based access control",
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const headersSchema = Type.Object({
|
|
@@ -2,7 +2,7 @@ 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 limits keyed on IP + namespace + functionName",
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export const optionsSchema = Type.Object({
|