@suss/packs 0.22.3 → 0.23.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/fastapi.js CHANGED
@@ -51,12 +51,53 @@ function fastapiFramework(options = {}) {
51
51
  statusArgument: 0
52
52
  }
53
53
  ],
54
+ // A route may respond by returning one of these built with a status.
55
+ responseConstructors: [
56
+ { callee: "fastapi.Response", statusKeyword: "status_code" },
57
+ {
58
+ callee: "starlette.responses.Response",
59
+ statusKeyword: "status_code"
60
+ },
61
+ {
62
+ callee: "fastapi.responses.JSONResponse",
63
+ statusKeyword: "status_code"
64
+ },
65
+ {
66
+ callee: "starlette.responses.JSONResponse",
67
+ statusKeyword: "status_code"
68
+ }
69
+ ],
54
70
  routerComposition: {
55
71
  routerConstructorName: "APIRouter",
56
72
  includeMethodName: "include_router",
57
73
  routerKeyword: "router",
58
74
  prefixKeyword: "prefix"
59
- }
75
+ },
76
+ wrappers: [
77
+ {
78
+ type: "dependency",
79
+ callees: ["Depends", "Security"],
80
+ keyword: "dependencies",
81
+ registrars: [
82
+ { constructorName: "FastAPI", covers: "everyRoute" },
83
+ { constructorName: "APIRouter", covers: "ownRoutes" }
84
+ ]
85
+ },
86
+ {
87
+ type: "decoratedWrapper",
88
+ attribute: "middleware",
89
+ registrars: [{ constructorName: "FastAPI", covers: "everyRoute" }],
90
+ // `async def m(request, call_next)`.
91
+ continuationParam: 1
92
+ },
93
+ {
94
+ type: "decoratedWrapper",
95
+ attribute: "exception_handler",
96
+ registrars: [{ constructorName: "FastAPI", covers: "everyRoute" }],
97
+ // `async def h(request, exc)`.
98
+ throwParam: 1
99
+ }
100
+ ]
60
101
  }
61
102
  ]
62
103
  };
@@ -65,6 +65,39 @@ function flaskRestxFramework(options = {}) {
65
65
  { callee: "flask_restx.abort", statusArgument: 0 },
66
66
  { callee: "flask.abort", statusArgument: 0 },
67
67
  { callee: "werkzeug.exceptions.abort", statusArgument: 0 }
68
+ ],
69
+ wrappers: [
70
+ {
71
+ type: "decoratedWrapper",
72
+ attribute: "before_request",
73
+ // A blueprint's own hook is not read: a route is decorated on
74
+ // a namespace, and the blueprint it is served under is a mount.
75
+ registrars: [
76
+ {
77
+ constructorName: "Flask",
78
+ importModule: ["flask"],
79
+ covers: "everyRoute"
80
+ }
81
+ ],
82
+ // Flask sends whatever a before_request hook returns, and
83
+ // goes on to the view only when it returns None.
84
+ returnedValueResponds: true
85
+ },
86
+ {
87
+ type: "decoratedWrapper",
88
+ attribute: "errorhandler",
89
+ registrars: [
90
+ {
91
+ constructorName: "Flask",
92
+ importModule: ["flask"],
93
+ covers: "everyRoute"
94
+ },
95
+ { constructorName: "Api", covers: "everyRoute" },
96
+ { constructorName: "Namespace", covers: "ownRoutes" }
97
+ ],
98
+ // `def handle(error)`.
99
+ throwParam: 0
100
+ }
68
101
  ]
69
102
  }
70
103
  ]
package/dist/hono.js CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  wrapperDiscovery
7
7
  } from "@suss/extractor";
8
8
  var HONO_WRAPPERS = [
9
+ { method: "use", targetPosition: 0, continuationParam: 1 },
9
10
  {
10
11
  method: "use",
11
12
  scopePosition: 0,
@@ -14,6 +15,10 @@ var HONO_WRAPPERS = [
14
15
  },
15
16
  { method: "onError", targetPosition: 0, throwParam: 0 }
16
17
  ];
18
+ var ZOD_OPENAPI_WRAPPERS = [
19
+ ...HONO_WRAPPERS,
20
+ { constructorOption: "defaultHook", targetPosition: 0, resultParam: 0 }
21
+ ];
17
22
  var HTTP_EXCEPTION_CODES = {
18
23
  HTTPException: 500
19
24
  };
@@ -94,7 +99,7 @@ function honoFramework(_options = {}) {
94
99
  ...wrapperDiscovery({
95
100
  importModule: "@hono/zod-openapi",
96
101
  importNames: ["OpenAPIHono"],
97
- wraps: HONO_WRAPPERS
102
+ wraps: ZOD_OPENAPI_WRAPPERS
98
103
  })
99
104
  ],
100
105
  // A route a project helper registers is read from the helper's own
package/dist/rails.js CHANGED
@@ -445,6 +445,19 @@ var RESPONSE_STATUS_CALLS = [
445
445
  { name: "redirect_to", statusKeyword: "status", defaultStatusCode: 302 },
446
446
  { name: "redirect_back", statusKeyword: "status", defaultStatusCode: 302 }
447
447
  ];
448
+ var CONTROLLER_FILTERS = [
449
+ {
450
+ name: "before_action",
451
+ methodFrom: "argument",
452
+ skippedBy: "skip_before_action",
453
+ actionKeywords: { include: "only", exclude: "except" }
454
+ },
455
+ {
456
+ name: "rescue_from",
457
+ methodFrom: "withKeyword",
458
+ onThrow: true
459
+ }
460
+ ];
448
461
  var RAILS_CONTROLLER_METHODS = [
449
462
  "params",
450
463
  "request",
@@ -518,6 +531,7 @@ function railsFramework(options = {}) {
518
531
  ...options.inheritedMethodNames ?? []
519
532
  ],
520
533
  routesFile,
534
+ filters: CONTROLLER_FILTERS,
521
535
  routeFor: (controllerQualifiedName, actionName) => {
522
536
  const key = controllerKeyFromQualified(controllerQualifiedName);
523
537
  const found = routeTable();
package/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "@suss/packs",
3
- "version": "0.22.3",
3
+ "version": "0.23.0",
4
4
  "type": "module",
5
- "description": "Every pack suss ships, as one package with a subpath per pack.",
5
+ "description": "Every pack suss ships in one install, so it can read Express, Hono, NestJS, FastAPI, Rails, Prisma, OpenAPI and the rest.",
6
6
  "keywords": [
7
7
  "suss",
8
- "behavioral-summary",
9
- "packs"
8
+ "static-analysis",
9
+ "express",
10
+ "fastapi",
11
+ "rails",
12
+ "prisma",
13
+ "openapi",
14
+ "api-contract"
10
15
  ],
11
16
  "license": "Apache-2.0",
12
17
  "author": "Nimbus Cloud AI LLC",
@@ -189,15 +194,15 @@
189
194
  "ts-morph": "^23.0.0"
190
195
  },
191
196
  "dependencies": {
192
- "@suss/adapter-python": "0.22.3",
193
- "@suss/adapter-ruby": "0.22.3",
194
- "@suss/adapter-typescript": "0.22.3",
195
- "@suss/behavioral-ir": "0.22.3",
196
- "@suss/contract-graphql": "0.22.3",
197
- "@suss/extractor": "0.22.3",
198
- "@suss/manifest-aws": "0.22.3",
199
- "@suss/recognize": "0.22.3",
200
- "@suss/sql": "0.22.3",
197
+ "@suss/adapter-python": "0.23.0",
198
+ "@suss/adapter-ruby": "0.23.0",
199
+ "@suss/adapter-typescript": "0.23.0",
200
+ "@suss/behavioral-ir": "0.23.0",
201
+ "@suss/contract-graphql": "0.23.0",
202
+ "@suss/extractor": "0.23.0",
203
+ "@suss/manifest-aws": "0.23.0",
204
+ "@suss/recognize": "0.23.0",
205
+ "@suss/sql": "0.23.0",
201
206
  "zod": "^4.0.0"
202
207
  },
203
208
  "devDependencies": {