@suss/packs 0.14.1 → 0.16.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/activerecord.d.ts +2 -0
- 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/dist/nestjs-microservices.d.ts +1 -0
- package/dist/nestjs-microservices.js +57 -0
- package/dist/package-exports.d.ts +1 -0
- package/dist/package-exports.js +35 -0
- package/package.json +20 -10
package/dist/activerecord.d.ts
CHANGED
|
@@ -19,9 +19,11 @@ import '@suss/framework-graphql-ruby';
|
|
|
19
19
|
import '@suss/framework-hono';
|
|
20
20
|
import '@suss/framework-mongoose';
|
|
21
21
|
import '@suss/framework-nestjs-graphql';
|
|
22
|
+
import '@suss/framework-nestjs-microservices';
|
|
22
23
|
import '@suss/framework-nestjs-rest';
|
|
23
24
|
import '@suss/framework-nextjs';
|
|
24
25
|
import '@suss/runtime-node';
|
|
26
|
+
import '@suss/framework-package-exports';
|
|
25
27
|
import '@suss/framework-prisma';
|
|
26
28
|
import '@suss/framework-react-router';
|
|
27
29
|
import '@suss/framework-react';
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@suss/framework-nestjs-microservices';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// ../framework/nestjs-microservices/dist/index.js
|
|
2
|
+
function nestjsMicroservicesFramework(options = {}) {
|
|
3
|
+
const binding = {
|
|
4
|
+
semantics: "message-bus",
|
|
5
|
+
messageBus: options.transport ?? "nats",
|
|
6
|
+
channel: { from: "decoratorArgument", position: 0 }
|
|
7
|
+
};
|
|
8
|
+
return {
|
|
9
|
+
name: "nestjs-microservices",
|
|
10
|
+
languages: ["typescript"],
|
|
11
|
+
protocol: "message-bus",
|
|
12
|
+
discovery: [
|
|
13
|
+
{
|
|
14
|
+
kind: "consumer",
|
|
15
|
+
match: {
|
|
16
|
+
type: "decoratedRoute",
|
|
17
|
+
importModule: ["@nestjs/microservices", "@nestjs/common"],
|
|
18
|
+
classDecorators: ["Controller", ...options.classDecorators ?? []],
|
|
19
|
+
// The values label the handler for a reader; the boundary
|
|
20
|
+
// comes from the declared binding below.
|
|
21
|
+
methodDecoratorRouteMap: {
|
|
22
|
+
EventPattern: "event",
|
|
23
|
+
MessagePattern: "message"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
binding,
|
|
27
|
+
requiresImport: ["@nestjs/microservices"]
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
terminals: [
|
|
31
|
+
// An @MessagePattern handler's return is the reply; an
|
|
32
|
+
// @EventPattern handler's return is dropped by the framework.
|
|
33
|
+
// Both are recorded as returns, and reply pairing is deferred.
|
|
34
|
+
{
|
|
35
|
+
kind: "return",
|
|
36
|
+
match: { type: "returnStatement", excludeCallReturns: false },
|
|
37
|
+
extraction: {}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
kind: "throw",
|
|
41
|
+
match: { type: "throwExpression" },
|
|
42
|
+
extraction: {}
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
inputMapping: {
|
|
46
|
+
type: "decoratedParams",
|
|
47
|
+
decoratorRoleMap: {
|
|
48
|
+
Payload: "message",
|
|
49
|
+
Ctx: "context"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
var index_default = nestjsMicroservicesFramework;
|
|
55
|
+
export {
|
|
56
|
+
index_default as default
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@suss/framework-package-exports';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// ../framework/package-exports/dist/index.js
|
|
2
|
+
function packageExportsFramework() {
|
|
3
|
+
return {
|
|
4
|
+
name: "package-exports",
|
|
5
|
+
languages: ["typescript"],
|
|
6
|
+
protocol: "in-process",
|
|
7
|
+
discovery: [
|
|
8
|
+
{
|
|
9
|
+
kind: "library",
|
|
10
|
+
match: { type: "packageExports", workspaces: true }
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
kind: "caller",
|
|
14
|
+
match: { type: "packageImport", workspaces: true }
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
terminals: [
|
|
18
|
+
{
|
|
19
|
+
kind: "return",
|
|
20
|
+
match: { type: "returnStatement" },
|
|
21
|
+
extraction: {}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
kind: "throw",
|
|
25
|
+
match: { type: "throwExpression" },
|
|
26
|
+
extraction: {}
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
inputMapping: { type: "allPositional" }
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
var index_default = packageExportsFramework;
|
|
33
|
+
export {
|
|
34
|
+
index_default as default
|
|
35
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/packs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Every pack suss ships, as one package with a subpath per pack.",
|
|
6
6
|
"keywords": [
|
|
@@ -104,6 +104,10 @@
|
|
|
104
104
|
"types": "./dist/nestjs-graphql.d.ts",
|
|
105
105
|
"import": "./dist/nestjs-graphql.js"
|
|
106
106
|
},
|
|
107
|
+
"./nestjs-microservices": {
|
|
108
|
+
"types": "./dist/nestjs-microservices.d.ts",
|
|
109
|
+
"import": "./dist/nestjs-microservices.js"
|
|
110
|
+
},
|
|
107
111
|
"./nestjs-rest": {
|
|
108
112
|
"types": "./dist/nestjs-rest.d.ts",
|
|
109
113
|
"import": "./dist/nestjs-rest.js"
|
|
@@ -116,6 +120,10 @@
|
|
|
116
120
|
"types": "./dist/node.d.ts",
|
|
117
121
|
"import": "./dist/node.js"
|
|
118
122
|
},
|
|
123
|
+
"./package-exports": {
|
|
124
|
+
"types": "./dist/package-exports.d.ts",
|
|
125
|
+
"import": "./dist/package-exports.js"
|
|
126
|
+
},
|
|
119
127
|
"./prisma": {
|
|
120
128
|
"types": "./dist/prisma.d.ts",
|
|
121
129
|
"import": "./dist/prisma.js"
|
|
@@ -157,15 +165,15 @@
|
|
|
157
165
|
"ts-morph": "^23.0.0"
|
|
158
166
|
},
|
|
159
167
|
"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.
|
|
168
|
+
"@suss/adapter-python": "0.16.0",
|
|
169
|
+
"@suss/adapter-ruby": "0.16.0",
|
|
170
|
+
"@suss/adapter-typescript": "0.16.0",
|
|
171
|
+
"@suss/behavioral-ir": "0.16.0",
|
|
172
|
+
"@suss/contract-graphql": "0.16.0",
|
|
173
|
+
"@suss/extractor": "0.16.0",
|
|
174
|
+
"@suss/manifest-aws": "0.16.0",
|
|
175
|
+
"@suss/recognize": "0.16.0",
|
|
176
|
+
"@suss/sql": "0.16.0"
|
|
169
177
|
},
|
|
170
178
|
"devDependencies": {
|
|
171
179
|
"@suss/client-apollo": "*",
|
|
@@ -189,8 +197,10 @@
|
|
|
189
197
|
"@suss/framework-hono": "*",
|
|
190
198
|
"@suss/framework-mongoose": "*",
|
|
191
199
|
"@suss/framework-nestjs-graphql": "*",
|
|
200
|
+
"@suss/framework-nestjs-microservices": "*",
|
|
192
201
|
"@suss/framework-nestjs-rest": "*",
|
|
193
202
|
"@suss/framework-nextjs": "*",
|
|
203
|
+
"@suss/framework-package-exports": "*",
|
|
194
204
|
"@suss/framework-prisma": "*",
|
|
195
205
|
"@suss/framework-react": "*",
|
|
196
206
|
"@suss/framework-react-router": "*",
|