@suss/packs 0.14.1 → 0.15.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/aws-eventbridge.js +49 -204
- package/dist/aws-sqs.js +45 -141
- package/dist/express.js +14 -8
- package/dist/fastify.js +22 -16
- package/dist/hono.js +7 -3
- package/package.json +10 -10
package/dist/aws-eventbridge.js
CHANGED
|
@@ -1,190 +1,8 @@
|
|
|
1
1
|
// ../framework/aws-eventbridge/dist/index.js
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from "
|
|
5
|
-
|
|
6
|
-
import { formatChannel, messageBusBinding } from "@suss/behavioral-ir";
|
|
7
|
-
import { unwrapJsonStringify } from "@suss/extractor";
|
|
8
|
-
var SEND_COMMANDS = {
|
|
9
|
-
PutEventsCommand: "putEvents"
|
|
10
|
-
};
|
|
11
|
-
function eventBridgeRecognizer(call, ctx) {
|
|
12
|
-
const callNode = call;
|
|
13
|
-
const recognizerCtx = ctx;
|
|
14
|
-
const resolveValue = recognizerCtx.resolveWrittenValue ?? (() => null);
|
|
15
|
-
const calleeExpr = callNode.getExpression();
|
|
16
|
-
if (!N.isPropertyAccessExpression(calleeExpr)) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
if (calleeExpr.getName() !== "send") {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
const args = callNode.getArguments();
|
|
23
|
-
if (args.length === 0) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const firstArg = args[0];
|
|
27
|
-
if (!N.isNewExpression(firstArg)) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
const ctorExpr = firstArg.getExpression();
|
|
31
|
-
const ctorLeafName = N.isPropertyAccessExpression(ctorExpr) ? ctorExpr.getName() : ctorExpr.getText();
|
|
32
|
-
if (SEND_COMMANDS[ctorLeafName] === void 0) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
const importCheckTarget = N.isPropertyAccessExpression(ctorExpr) ? rootIdentifier(ctorExpr) : ctorExpr;
|
|
36
|
-
if (importCheckTarget === null || !recognizerCtx.isImportedFrom(
|
|
37
|
-
importCheckTarget,
|
|
38
|
-
"@aws-sdk/client-eventbridge"
|
|
39
|
-
)) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
const callArgs = recognizerCtx.extractArgs();
|
|
43
|
-
const entries = readEntries(callArgs);
|
|
44
|
-
if (entries === null) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
const callee = callNode.getExpression().getText();
|
|
48
|
-
const astEntries = readAstEntries(firstArg);
|
|
49
|
-
const effects = [];
|
|
50
|
-
for (const [index, entry] of entries.entries()) {
|
|
51
|
-
const effect = buildEntryEffect(
|
|
52
|
-
entry,
|
|
53
|
-
callee,
|
|
54
|
-
astEntries?.[index],
|
|
55
|
-
resolveValue
|
|
56
|
-
);
|
|
57
|
-
if (effect !== null) {
|
|
58
|
-
effects.push(effect);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return effects.length > 0 ? effects : null;
|
|
62
|
-
}
|
|
63
|
-
function readAstEntries(command) {
|
|
64
|
-
if (!N.isNewExpression(command)) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
const input = command.getArguments()[0];
|
|
68
|
-
if (input === void 0 || !N.isObjectLiteralExpression(input)) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
for (const prop of input.getProperties()) {
|
|
72
|
-
if (!N.isPropertyAssignment(prop) || prop.getName() !== "Entries") {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const init = prop.getInitializer();
|
|
76
|
-
if (init === void 0 || !N.isArrayLiteralExpression(init)) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
return init.getElements();
|
|
80
|
-
}
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
function astField(entry, name) {
|
|
84
|
-
if (entry === void 0 || !N.isObjectLiteralExpression(entry)) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
for (const prop of entry.getProperties()) {
|
|
88
|
-
if (N.isPropertyAssignment(prop) && prop.getName() === name) {
|
|
89
|
-
return prop.getInitializer() ?? null;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
function busTokenOf(expr) {
|
|
95
|
-
if (N.isStringLiteral(expr)) {
|
|
96
|
-
const value = expr.getLiteralValue();
|
|
97
|
-
return value === "" ? null : value;
|
|
98
|
-
}
|
|
99
|
-
const match = expr.getText().match(/^process\.env\.(\w+)$/);
|
|
100
|
-
return match === null ? null : match[1] ?? null;
|
|
101
|
-
}
|
|
102
|
-
function detailTypeOf(expr) {
|
|
103
|
-
if (!N.isStringLiteral(expr)) {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
const value = expr.getLiteralValue();
|
|
107
|
-
return value === "" ? null : value;
|
|
108
|
-
}
|
|
109
|
-
function resolvedHalf(entry, name, readToken, resolve) {
|
|
110
|
-
const expr = astField(entry, name);
|
|
111
|
-
if (expr === null) {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
const direct = readToken(expr);
|
|
115
|
-
if (direct !== null) {
|
|
116
|
-
return direct;
|
|
117
|
-
}
|
|
118
|
-
const resolved = resolve(expr);
|
|
119
|
-
return resolved === null ? null : readToken(resolved);
|
|
120
|
-
}
|
|
121
|
-
function readEntries(callArgs) {
|
|
122
|
-
const commandArg = callArgs[0];
|
|
123
|
-
if (!isEffectArgOfKind(commandArg, "call")) {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
const ctorArgs = commandArg.args ?? [];
|
|
127
|
-
const inputArg = ctorArgs[0];
|
|
128
|
-
if (!isEffectArgOfKind(inputArg, "object")) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
const fields = inputArg.fields;
|
|
132
|
-
const entriesArg = fields?.Entries;
|
|
133
|
-
if (!isEffectArgOfKind(entriesArg, "array")) {
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
return entriesArg.items ?? [];
|
|
137
|
-
}
|
|
138
|
-
function buildEntryEffect(entry, callee, astEntry, resolve) {
|
|
139
|
-
if (!isEffectArgOfKind(entry, "object")) {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
const fields = entry.fields;
|
|
143
|
-
const bus = fields.EventBusName === void 0 ? readBusToken(void 0) : resolvedHalf(astEntry, "EventBusName", busTokenOf, resolve) ?? readBusToken(fields.EventBusName);
|
|
144
|
-
const detailType = resolvedHalf(astEntry, "DetailType", detailTypeOf, resolve) ?? readLiteralString(fields.DetailType);
|
|
145
|
-
const channel = bus === null || detailType === null ? null : formatChannel(bus, detailType);
|
|
146
|
-
const body = unwrapJsonStringify(fields.Detail ?? null);
|
|
147
|
-
const source = readLiteralString(fields.Source);
|
|
148
|
-
return {
|
|
149
|
-
type: "interaction",
|
|
150
|
-
binding: messageBusBinding({
|
|
151
|
-
recognition: "@suss/framework-aws-eventbridge",
|
|
152
|
-
messageBus: "eventbridge",
|
|
153
|
-
channel
|
|
154
|
-
}),
|
|
155
|
-
callee,
|
|
156
|
-
interaction: {
|
|
157
|
-
class: "message-send",
|
|
158
|
-
...body !== null ? { body } : {},
|
|
159
|
-
...source !== null ? { routingKey: source } : {}
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function readBusToken(arg) {
|
|
164
|
-
if (arg === void 0) {
|
|
165
|
-
return "default";
|
|
166
|
-
}
|
|
167
|
-
if (isEffectArgOfKind(arg, "string")) {
|
|
168
|
-
const value = arg.value;
|
|
169
|
-
return value === "" ? null : value;
|
|
170
|
-
}
|
|
171
|
-
if (isEffectArgOfKind(arg, "identifier")) {
|
|
172
|
-
const name = arg.name;
|
|
173
|
-
const match = name.match(/^process\.env\.(\w+)$/);
|
|
174
|
-
return match !== null ? match[1] : null;
|
|
175
|
-
}
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
178
|
-
function readLiteralString(arg) {
|
|
179
|
-
if (isEffectArgOfKind(arg, "string")) {
|
|
180
|
-
const value = arg.value;
|
|
181
|
-
return value === "" ? null : value;
|
|
182
|
-
}
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
function isEffectArgOfKind(arg, kind) {
|
|
186
|
-
return arg !== null && arg !== void 0 && typeof arg === "object" && arg.kind === kind;
|
|
187
|
-
}
|
|
2
|
+
import { readConfiguredCall } from "@suss/adapter-typescript";
|
|
3
|
+
import { messageBusBinding } from "@suss/behavioral-ir";
|
|
4
|
+
import { constructedFrom, messageSends, pack } from "@suss/recognize";
|
|
5
|
+
var EVENTBRIDGE = "@aws-sdk/client-eventbridge";
|
|
188
6
|
function configuredProducerRecognizer(spec) {
|
|
189
7
|
return ((call, ctx) => {
|
|
190
8
|
const read = readConfiguredCall(
|
|
@@ -214,25 +32,52 @@ function configuredProducerRecognizer(spec) {
|
|
|
214
32
|
}
|
|
215
33
|
function eventBridgeFramework(options = {}) {
|
|
216
34
|
const producers = options.producers ?? [];
|
|
217
|
-
return
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
35
|
+
return pack(
|
|
36
|
+
"eventbridge",
|
|
37
|
+
[
|
|
38
|
+
messageSends({
|
|
39
|
+
wire: "eventbridge",
|
|
40
|
+
client: constructedFrom(EVENTBRIDGE),
|
|
41
|
+
messages: { each: "in", property: "Entries" },
|
|
42
|
+
channel: [
|
|
43
|
+
{
|
|
44
|
+
property: "EventBusName",
|
|
45
|
+
whenAbsent: "default",
|
|
46
|
+
unsettled: "reference"
|
|
47
|
+
},
|
|
48
|
+
{ property: "DetailType", unsettled: "nothing" }
|
|
49
|
+
],
|
|
50
|
+
unsettledName: "nothing",
|
|
51
|
+
routingKey: "Source",
|
|
52
|
+
body: "Detail"
|
|
53
|
+
}).methods({
|
|
54
|
+
send: {
|
|
55
|
+
input: {
|
|
56
|
+
at: 0,
|
|
57
|
+
of: [
|
|
58
|
+
{
|
|
59
|
+
to: "argument",
|
|
60
|
+
at: 0,
|
|
61
|
+
origin: constructedFrom({
|
|
62
|
+
from: [EVENTBRIDGE],
|
|
63
|
+
named: ["PutEventsCommand"]
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}).example(
|
|
70
|
+
'client.send(new PutEventsCommand({ Entries: [{ DetailType: "OrderPlaced", Detail: "{}" }] }))'
|
|
71
|
+
)
|
|
230
72
|
],
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
73
|
+
{
|
|
74
|
+
languages: ["typescript", "javascript"],
|
|
75
|
+
recognizedAs: "@suss/framework-aws-eventbridge",
|
|
76
|
+
protocol: "eventbridge",
|
|
77
|
+
requiresImport: producers.map((p) => p.module),
|
|
78
|
+
recognizers: producers.map(configuredProducerRecognizer)
|
|
79
|
+
}
|
|
80
|
+
);
|
|
236
81
|
}
|
|
237
82
|
var index_default = eventBridgeFramework;
|
|
238
83
|
export {
|
package/dist/aws-sqs.js
CHANGED
|
@@ -1,130 +1,46 @@
|
|
|
1
1
|
// ../framework/aws-sqs/dist/index.js
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from "ts-morph";
|
|
5
|
-
import { readConfiguredCall, rootIdentifier } from "@suss/adapter-typescript";
|
|
2
|
+
import { Node as N } from "ts-morph";
|
|
3
|
+
import { readConfiguredCall } from "@suss/adapter-typescript";
|
|
6
4
|
import { messageBusBinding } from "@suss/behavioral-ir";
|
|
7
|
-
import {
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
const args = callNode.getArguments();
|
|
23
|
-
if (args.length === 0) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const firstArg = args[0];
|
|
27
|
-
if (!N.isNewExpression(firstArg)) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
const ctorExpr = firstArg.getExpression();
|
|
31
|
-
const ctorLeafName = N.isPropertyAccessExpression(ctorExpr) ? ctorExpr.getName() : ctorExpr.getText();
|
|
32
|
-
const operation = SEND_COMMANDS[ctorLeafName];
|
|
33
|
-
if (operation === void 0) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
const importCheckTarget = N.isPropertyAccessExpression(ctorExpr) ? rootIdentifier(ctorExpr) : ctorExpr;
|
|
37
|
-
if (importCheckTarget === null || !recognizerCtx.isImportedFrom(importCheckTarget, "@aws-sdk/client-sqs")) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
const ctorArgs = firstArg.getArguments();
|
|
41
|
-
if (ctorArgs.length === 0) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
const input = ctorArgs[0];
|
|
45
|
-
if (!N.isObjectLiteralExpression(input)) {
|
|
46
|
-
return null;
|
|
5
|
+
import { constructedFrom, messageSends, pack } from "@suss/recognize";
|
|
6
|
+
var SQS = "@aws-sdk/client-sqs";
|
|
7
|
+
var INSIDE_THE_COMMAND = (named) => ({
|
|
8
|
+
send: {
|
|
9
|
+
input: {
|
|
10
|
+
at: 0,
|
|
11
|
+
of: [
|
|
12
|
+
{
|
|
13
|
+
to: "argument",
|
|
14
|
+
at: 0,
|
|
15
|
+
origin: constructedFrom({ from: [SQS], named })
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
47
19
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
recognizerCtx.resolveWrittenValue ?? (() => null)
|
|
51
|
-
);
|
|
52
|
-
const rawBody = readPropertyArg(
|
|
53
|
-
input,
|
|
54
|
-
"MessageBody",
|
|
55
|
-
recognizerCtx.extractArgs,
|
|
56
|
-
callNode
|
|
57
|
-
);
|
|
58
|
-
const body = unwrapJsonStringify(rawBody);
|
|
20
|
+
});
|
|
21
|
+
function sendDeclarations() {
|
|
59
22
|
return [
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
23
|
+
messageSends({
|
|
24
|
+
wire: "aws_sqs",
|
|
25
|
+
client: constructedFrom(SQS),
|
|
26
|
+
messages: { each: "theInput" },
|
|
27
|
+
channel: [{ property: "QueueUrl" }],
|
|
28
|
+
body: "MessageBody"
|
|
29
|
+
}).methods(INSIDE_THE_COMMAND(["SendMessageCommand"])).example(
|
|
30
|
+
'client.send(new SendMessageCommand({ QueueUrl: "orders", MessageBody: "{}" }))'
|
|
31
|
+
),
|
|
32
|
+
messageSends({
|
|
33
|
+
wire: "aws_sqs",
|
|
34
|
+
client: constructedFrom(SQS),
|
|
35
|
+
messages: { each: "in", property: "Entries" },
|
|
36
|
+
// A batch states the queue once beside the list of messages.
|
|
37
|
+
channel: [{ property: "QueueUrl", on: "theInput" }],
|
|
38
|
+
body: "MessageBody"
|
|
39
|
+
}).methods(INSIDE_THE_COMMAND(["SendMessageBatchCommand"])).example(
|
|
40
|
+
'client.send(new SendMessageBatchCommand({ QueueUrl: "orders", Entries: [{ MessageBody: "{}" }] }))'
|
|
41
|
+
)
|
|
75
42
|
];
|
|
76
43
|
}
|
|
77
|
-
function readQueueUrlChannel(input, resolveWrittenValue) {
|
|
78
|
-
if (!N.isObjectLiteralExpression(input)) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
for (const prop of input.getProperties()) {
|
|
82
|
-
if (!N.isPropertyAssignment(prop)) {
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
if (prop.getName() !== "QueueUrl") {
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
const initializer = prop.getInitializer();
|
|
89
|
-
if (initializer === void 0) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
const named = channelNamedBy(initializer);
|
|
93
|
-
if (named !== null) {
|
|
94
|
-
return named;
|
|
95
|
-
}
|
|
96
|
-
const resolved = resolveWrittenValue(initializer);
|
|
97
|
-
return resolved === null ? null : channelNamedBy(resolved);
|
|
98
|
-
}
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
function channelNamedBy(expr) {
|
|
102
|
-
if (N.isPropertyAccessExpression(expr)) {
|
|
103
|
-
const text = expr.getText();
|
|
104
|
-
const match = text.match(/^process\.env\.(\w+)$/);
|
|
105
|
-
return match === null ? null : match[1] ?? null;
|
|
106
|
-
}
|
|
107
|
-
if (N.isStringLiteral(expr)) {
|
|
108
|
-
return expr.getLiteralValue();
|
|
109
|
-
}
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
function readPropertyArg(input, propName, extractCallArgs, callNode) {
|
|
113
|
-
const callArgs = extractCallArgs();
|
|
114
|
-
const first = callArgs[0];
|
|
115
|
-
if (first === null || typeof first !== "object" || first.kind !== "call") {
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
const ctorArgs = first.args ?? [];
|
|
119
|
-
const inputArg = ctorArgs[0];
|
|
120
|
-
if (inputArg === null || typeof inputArg !== "object" || inputArg.kind !== "object") {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
const fields = inputArg.fields ?? {};
|
|
124
|
-
void input;
|
|
125
|
-
void callNode;
|
|
126
|
-
return fields[propName] ?? null;
|
|
127
|
-
}
|
|
128
44
|
function messageReceiveRecognizer(call, ctx) {
|
|
129
45
|
const callNode = call;
|
|
130
46
|
void ctx;
|
|
@@ -265,30 +181,18 @@ function configuredProducerRecognizer(spec) {
|
|
|
265
181
|
}
|
|
266
182
|
function sqsFramework(options = {}) {
|
|
267
183
|
const producers = options.producers ?? [];
|
|
268
|
-
return {
|
|
269
|
-
name: "sqs",
|
|
270
|
-
protocol: "sqs",
|
|
184
|
+
return pack("sqs", sendDeclarations(), {
|
|
271
185
|
languages: ["typescript", "javascript"],
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
//
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
// gate spares walking SQS-irrelevant files in monorepos.
|
|
279
|
-
requiresImport: [
|
|
280
|
-
.../* @__PURE__ */ new Set([
|
|
281
|
-
"@aws-sdk/client-sqs",
|
|
282
|
-
"aws-lambda",
|
|
283
|
-
...producers.map((p) => p.module)
|
|
284
|
-
])
|
|
285
|
-
],
|
|
286
|
-
invocationRecognizers: [
|
|
287
|
-
sqsRecognizer,
|
|
186
|
+
recognizedAs: "@suss/framework-aws-sqs",
|
|
187
|
+
protocol: "sqs",
|
|
188
|
+
// The consumer side reads SQSEvent handlers, whose files import
|
|
189
|
+
// aws-lambda rather than the SQS client.
|
|
190
|
+
requiresImport: ["aws-lambda", ...producers.map((p) => p.module)],
|
|
191
|
+
recognizers: [
|
|
288
192
|
messageReceiveRecognizer,
|
|
289
193
|
...producers.map(configuredProducerRecognizer)
|
|
290
194
|
]
|
|
291
|
-
};
|
|
195
|
+
});
|
|
292
196
|
}
|
|
293
197
|
var index_default = sqsFramework;
|
|
294
198
|
export {
|
package/dist/express.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// ../framework/express/dist/index.js
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
httpRouteDiscovery,
|
|
4
|
+
registrationHelperDiscovery
|
|
5
|
+
} from "@suss/extractor";
|
|
6
|
+
function expressFramework(options = {}) {
|
|
4
7
|
return {
|
|
5
8
|
name: "express",
|
|
6
9
|
protocol: "http",
|
|
@@ -11,12 +14,15 @@ function expressFramework() {
|
|
|
11
14
|
// Either can also be mounted onto another with `app.use(prefix,
|
|
12
15
|
// router)`, so a route declared on the mounted router summarizes
|
|
13
16
|
// with the mount's prefix composed in.
|
|
14
|
-
discovery:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
discovery: [
|
|
18
|
+
...httpRouteDiscovery({
|
|
19
|
+
importModule: "express",
|
|
20
|
+
importNames: ["Router", "express"],
|
|
21
|
+
methods: [".get", ".post", ".put", ".delete", ".patch", ".all"],
|
|
22
|
+
mount: { method: "use", prefixPosition: 0, targetPosition: 1 }
|
|
23
|
+
}),
|
|
24
|
+
...registrationHelperDiscovery(options.registrationHelpers ?? [])
|
|
25
|
+
],
|
|
20
26
|
terminals: [
|
|
21
27
|
{
|
|
22
28
|
// res.status(N).json(body)
|
package/dist/fastify.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// ../framework/fastify/dist/index.js
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
httpRouteDiscovery,
|
|
4
|
+
registrationHelperDiscovery
|
|
5
|
+
} from "@suss/extractor";
|
|
6
|
+
function fastifyFramework(options = {}) {
|
|
4
7
|
return {
|
|
5
8
|
name: "fastify",
|
|
6
9
|
protocol: "http",
|
|
@@ -8,20 +11,23 @@ function fastifyFramework() {
|
|
|
8
11
|
// Fastify exposes the routable via either default `Fastify` or
|
|
9
12
|
// named `fastify()`. Both drive handler registration the same way.
|
|
10
13
|
// Unlike Express, Fastify's router supports `.head` and `.options`.
|
|
11
|
-
discovery:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
discovery: [
|
|
15
|
+
...httpRouteDiscovery({
|
|
16
|
+
importModule: "fastify",
|
|
17
|
+
importNames: ["Fastify", "fastify"],
|
|
18
|
+
methods: [
|
|
19
|
+
".get",
|
|
20
|
+
".post",
|
|
21
|
+
".put",
|
|
22
|
+
".delete",
|
|
23
|
+
".patch",
|
|
24
|
+
".head",
|
|
25
|
+
".options",
|
|
26
|
+
".all"
|
|
27
|
+
]
|
|
28
|
+
}),
|
|
29
|
+
...registrationHelperDiscovery(options.registrationHelpers ?? [])
|
|
30
|
+
],
|
|
25
31
|
terminals: [
|
|
26
32
|
{
|
|
27
33
|
// reply.code(N).send(body)
|
package/dist/hono.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// ../framework/hono/dist/index.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
httpRouteDiscovery,
|
|
4
|
+
registrationHelperDiscovery
|
|
5
|
+
} from "@suss/extractor";
|
|
3
6
|
var HTTP_EXCEPTION_CODES = {
|
|
4
7
|
HTTPException: 500
|
|
5
8
|
};
|
|
6
|
-
function honoFramework() {
|
|
9
|
+
function honoFramework(options = {}) {
|
|
7
10
|
return {
|
|
8
11
|
name: "hono",
|
|
9
12
|
protocol: "http",
|
|
@@ -74,7 +77,8 @@ function honoFramework() {
|
|
|
74
77
|
path: { type: "fromArgumentProperty", position: 0, property: "path" }
|
|
75
78
|
},
|
|
76
79
|
requiresImport: ["@hono/zod-openapi"]
|
|
77
|
-
}
|
|
80
|
+
},
|
|
81
|
+
...registrationHelperDiscovery(options.registrationHelpers ?? [])
|
|
78
82
|
],
|
|
79
83
|
// The createRoute object registered alongside the handler declares
|
|
80
84
|
// the endpoint's responses, so a handler returning a status the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/packs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Every pack suss ships, as one package with a subpath per pack.",
|
|
6
6
|
"keywords": [
|
|
@@ -157,15 +157,15 @@
|
|
|
157
157
|
"ts-morph": "^23.0.0"
|
|
158
158
|
},
|
|
159
159
|
"dependencies": {
|
|
160
|
-
"@suss/adapter-python": "0.
|
|
161
|
-
"@suss/adapter-ruby": "0.
|
|
162
|
-
"@suss/adapter-typescript": "0.
|
|
163
|
-
"@suss/behavioral-ir": "0.
|
|
164
|
-
"@suss/contract-graphql": "0.
|
|
165
|
-
"@suss/extractor": "0.
|
|
166
|
-
"@suss/manifest-aws": "0.
|
|
167
|
-
"@suss/recognize": "0.
|
|
168
|
-
"@suss/sql": "0.
|
|
160
|
+
"@suss/adapter-python": "0.15.0",
|
|
161
|
+
"@suss/adapter-ruby": "0.15.0",
|
|
162
|
+
"@suss/adapter-typescript": "0.15.0",
|
|
163
|
+
"@suss/behavioral-ir": "0.15.0",
|
|
164
|
+
"@suss/contract-graphql": "0.15.0",
|
|
165
|
+
"@suss/extractor": "0.15.0",
|
|
166
|
+
"@suss/manifest-aws": "0.15.0",
|
|
167
|
+
"@suss/recognize": "0.15.0",
|
|
168
|
+
"@suss/sql": "0.15.0"
|
|
169
169
|
},
|
|
170
170
|
"devDependencies": {
|
|
171
171
|
"@suss/client-apollo": "*",
|