@suss/packs 0.22.4 → 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/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,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/packs",
3
- "version": "0.22.4",
3
+ "version": "0.23.0",
4
4
  "type": "module",
5
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": [
@@ -194,15 +194,15 @@
194
194
  "ts-morph": "^23.0.0"
195
195
  },
196
196
  "dependencies": {
197
- "@suss/adapter-python": "0.22.4",
198
- "@suss/adapter-ruby": "0.22.4",
199
- "@suss/adapter-typescript": "0.22.4",
200
- "@suss/behavioral-ir": "0.22.4",
201
- "@suss/contract-graphql": "0.22.4",
202
- "@suss/extractor": "0.22.4",
203
- "@suss/manifest-aws": "0.22.4",
204
- "@suss/recognize": "0.22.4",
205
- "@suss/sql": "0.22.4",
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",
206
206
  "zod": "^4.0.0"
207
207
  },
208
208
  "devDependencies": {