@bitsness/grapuco-cli 0.1.10 → 0.1.11
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/index.js +64 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5279,10 +5279,71 @@ var init_nestjs_routes = __esm({
|
|
|
5279
5279
|
});
|
|
5280
5280
|
|
|
5281
5281
|
// src/parser/ingestion/workers/extractors/nestjs-events.ts
|
|
5282
|
-
|
|
5282
|
+
function detectClassLevelSubscriber(classNode, className, filePath, events) {
|
|
5283
|
+
for (const child of classNode.children) {
|
|
5284
|
+
if (child.type !== "decorator") continue;
|
|
5285
|
+
const callExp = child.children.find((c) => c.type === "call_expression");
|
|
5286
|
+
if (!callExp) continue;
|
|
5287
|
+
const funcName = callExp.childForFieldName("function")?.text;
|
|
5288
|
+
if (!funcName || !CLASS_SUBSCRIBER_DECORATORS.has(funcName)) continue;
|
|
5289
|
+
const argsNode = callExp.childForFieldName("arguments");
|
|
5290
|
+
if (!argsNode) continue;
|
|
5291
|
+
let topicName = null;
|
|
5292
|
+
for (const arg of argsNode.children) {
|
|
5293
|
+
if (arg.type === "string") {
|
|
5294
|
+
topicName = arg.text.substring(1, arg.text.length - 1);
|
|
5295
|
+
break;
|
|
5296
|
+
}
|
|
5297
|
+
}
|
|
5298
|
+
if (!topicName) continue;
|
|
5299
|
+
const classBody = classNode.childForFieldName("body");
|
|
5300
|
+
if (!classBody) continue;
|
|
5301
|
+
let handlerMethodName = null;
|
|
5302
|
+
let handlerLine = classNode.startPosition.row;
|
|
5303
|
+
for (const member of classBody.children) {
|
|
5304
|
+
if (member.type === "method_definition") {
|
|
5305
|
+
const mName = member.childForFieldName("name")?.text;
|
|
5306
|
+
if (mName && HANDLER_METHOD_NAMES.has(mName)) {
|
|
5307
|
+
handlerMethodName = mName;
|
|
5308
|
+
handlerLine = member.startPosition.row;
|
|
5309
|
+
break;
|
|
5310
|
+
}
|
|
5311
|
+
}
|
|
5312
|
+
}
|
|
5313
|
+
events.push({
|
|
5314
|
+
filePath,
|
|
5315
|
+
topicName,
|
|
5316
|
+
className,
|
|
5317
|
+
methodName: handlerMethodName || className,
|
|
5318
|
+
framework: `bullmq-${funcName.toLowerCase()}`,
|
|
5319
|
+
lineNumber: handlerLine
|
|
5320
|
+
});
|
|
5321
|
+
}
|
|
5322
|
+
}
|
|
5323
|
+
var CLASS_SUBSCRIBER_DECORATORS, HANDLER_METHOD_NAMES, extractNestJSEvents;
|
|
5283
5324
|
var init_nestjs_events = __esm({
|
|
5284
5325
|
"src/parser/ingestion/workers/extractors/nestjs-events.ts"() {
|
|
5285
5326
|
"use strict";
|
|
5327
|
+
CLASS_SUBSCRIBER_DECORATORS = /* @__PURE__ */ new Set([
|
|
5328
|
+
"Processor",
|
|
5329
|
+
// BullMQ @Processor('queueName')
|
|
5330
|
+
"WorkerHost",
|
|
5331
|
+
// BullMQ alternate pattern
|
|
5332
|
+
"Consumer",
|
|
5333
|
+
// KafkaJS / custom consumers
|
|
5334
|
+
"RabbitSubscribe"
|
|
5335
|
+
// @golevelup/nestjs-rabbitmq
|
|
5336
|
+
]);
|
|
5337
|
+
HANDLER_METHOD_NAMES = /* @__PURE__ */ new Set([
|
|
5338
|
+
"process",
|
|
5339
|
+
// BullMQ WorkerHost.process()
|
|
5340
|
+
"handleMessage",
|
|
5341
|
+
// Generic consumer pattern
|
|
5342
|
+
"handle",
|
|
5343
|
+
// Generic handler
|
|
5344
|
+
"execute"
|
|
5345
|
+
// CQRS-style
|
|
5346
|
+
]);
|
|
5286
5347
|
extractNestJSEvents = (tree, filePath) => {
|
|
5287
5348
|
const events = [];
|
|
5288
5349
|
const rootNode = tree.rootNode;
|
|
@@ -5290,6 +5351,7 @@ var init_nestjs_events = __esm({
|
|
|
5290
5351
|
if (node.type === "class_declaration") {
|
|
5291
5352
|
const nameNode = node.childForFieldName("name");
|
|
5292
5353
|
currentClass = nameNode ? nameNode.text : null;
|
|
5354
|
+
detectClassLevelSubscriber(node, currentClass, filePath, events);
|
|
5293
5355
|
}
|
|
5294
5356
|
if (node.type === "method_definition") {
|
|
5295
5357
|
const methodNameNode = node.childForFieldName("name");
|
|
@@ -6650,7 +6712,7 @@ var require_package = __commonJS({
|
|
|
6650
6712
|
"package.json"(exports2, module2) {
|
|
6651
6713
|
module2.exports = {
|
|
6652
6714
|
name: "@bitsness/grapuco-cli",
|
|
6653
|
-
version: "0.1.
|
|
6715
|
+
version: "0.1.11",
|
|
6654
6716
|
description: "Grapuco CLI \u2014 Parse your code locally, sync architecture to cloud. Zero source code upload.",
|
|
6655
6717
|
type: "commonjs",
|
|
6656
6718
|
bin: {
|