@gloocan/cat-inspector 0.1.1
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/artifact-helpers.d.ts +4 -0
- package/dist/artifact-helpers.d.ts.map +1 -0
- package/dist/artifact-helpers.js +21 -0
- package/dist/artifact-helpers.js.map +1 -0
- package/dist/ast/get-all-ts-files.d.ts +5 -0
- package/dist/ast/get-all-ts-files.d.ts.map +1 -0
- package/dist/ast/get-all-ts-files.js +36 -0
- package/dist/ast/get-all-ts-files.js.map +1 -0
- package/dist/ast/merge-ast.d.ts +3 -0
- package/dist/ast/merge-ast.d.ts.map +1 -0
- package/dist/ast/merge-ast.js +40 -0
- package/dist/ast/merge-ast.js.map +1 -0
- package/dist/ast/run-ast-scanner.d.ts +15 -0
- package/dist/ast/run-ast-scanner.d.ts.map +1 -0
- package/dist/ast/run-ast-scanner.js +44 -0
- package/dist/ast/run-ast-scanner.js.map +1 -0
- package/dist/ast/scan-for-labels.d.ts +20 -0
- package/dist/ast/scan-for-labels.d.ts.map +1 -0
- package/dist/ast/scan-for-labels.js +88 -0
- package/dist/ast/scan-for-labels.js.map +1 -0
- package/dist/ast/scan-for-returns.d.ts +13 -0
- package/dist/ast/scan-for-returns.d.ts.map +1 -0
- package/dist/ast/scan-for-returns.js +48 -0
- package/dist/ast/scan-for-returns.js.map +1 -0
- package/dist/ast/type-expand.d.ts +16 -0
- package/dist/ast/type-expand.d.ts.map +1 -0
- package/dist/ast/type-expand.js +118 -0
- package/dist/ast/type-expand.js.map +1 -0
- package/dist/ast/visit-node.d.ts +31 -0
- package/dist/ast/visit-node.d.ts.map +1 -0
- package/dist/ast/visit-node.js +298 -0
- package/dist/ast/visit-node.js.map +1 -0
- package/dist/bootstrap.d.ts +105 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +121 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/catalog-bootstrap-cache.d.ts +23 -0
- package/dist/catalog-bootstrap-cache.d.ts.map +1 -0
- package/dist/catalog-bootstrap-cache.js +54 -0
- package/dist/catalog-bootstrap-cache.js.map +1 -0
- package/dist/catalog-fingerprint.d.ts +20 -0
- package/dist/catalog-fingerprint.d.ts.map +1 -0
- package/dist/catalog-fingerprint.js +57 -0
- package/dist/catalog-fingerprint.js.map +1 -0
- package/dist/coverage/compute-coverage.d.ts +41 -0
- package/dist/coverage/compute-coverage.d.ts.map +1 -0
- package/dist/coverage/compute-coverage.js +229 -0
- package/dist/coverage/compute-coverage.js.map +1 -0
- package/dist/coverage/scan-all-service-candidates.d.ts +15 -0
- package/dist/coverage/scan-all-service-candidates.d.ts.map +1 -0
- package/dist/coverage/scan-all-service-candidates.js +73 -0
- package/dist/coverage/scan-all-service-candidates.js.map +1 -0
- package/dist/coverage/scan-express-candidates.d.ts +17 -0
- package/dist/coverage/scan-express-candidates.d.ts.map +1 -0
- package/dist/coverage/scan-express-candidates.js +300 -0
- package/dist/coverage/scan-express-candidates.js.map +1 -0
- package/dist/coverage/scan-reachable-services.d.ts +13 -0
- package/dist/coverage/scan-reachable-services.d.ts.map +1 -0
- package/dist/coverage/scan-reachable-services.js +469 -0
- package/dist/coverage/scan-reachable-services.js.map +1 -0
- package/dist/coverage/types.d.ts +32 -0
- package/dist/coverage/types.d.ts.map +1 -0
- package/dist/coverage/types.js +2 -0
- package/dist/coverage/types.js.map +1 -0
- package/dist/decorators/cat-class.d.ts +11 -0
- package/dist/decorators/cat-class.d.ts.map +1 -0
- package/dist/decorators/cat-class.js +20 -0
- package/dist/decorators/cat-class.js.map +1 -0
- package/dist/decorators/cat.d.ts +3 -0
- package/dist/decorators/cat.d.ts.map +1 -0
- package/dist/decorators/cat.js +102 -0
- package/dist/decorators/cat.js.map +1 -0
- package/dist/express-inspector-correlation.d.ts +23 -0
- package/dist/express-inspector-correlation.d.ts.map +1 -0
- package/dist/express-inspector-correlation.js +50 -0
- package/dist/express-inspector-correlation.js.map +1 -0
- package/dist/express-playground-mocks.d.ts +28 -0
- package/dist/express-playground-mocks.d.ts.map +1 -0
- package/dist/express-playground-mocks.js +55 -0
- package/dist/express-playground-mocks.js.map +1 -0
- package/dist/express-qa-host-minio-upload.d.ts +16 -0
- package/dist/express-qa-host-minio-upload.d.ts.map +1 -0
- package/dist/express-qa-host-minio-upload.js +56 -0
- package/dist/express-qa-host-minio-upload.js.map +1 -0
- package/dist/express.d.ts +21 -0
- package/dist/express.d.ts.map +1 -0
- package/dist/express.js +167 -0
- package/dist/express.js.map +1 -0
- package/dist/functional.d.ts +15 -0
- package/dist/functional.d.ts.map +1 -0
- package/dist/functional.js +165 -0
- package/dist/functional.js.map +1 -0
- package/dist/graph/relationships.d.ts +9 -0
- package/dist/graph/relationships.d.ts.map +1 -0
- package/dist/graph/relationships.js +92 -0
- package/dist/graph/relationships.js.map +1 -0
- package/dist/http-bridge-registry.d.ts +26 -0
- package/dist/http-bridge-registry.d.ts.map +1 -0
- package/dist/http-bridge-registry.js +39 -0
- package/dist/http-bridge-registry.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/invoke-policy.d.ts +34 -0
- package/dist/invoke-policy.d.ts.map +1 -0
- package/dist/invoke-policy.js +72 -0
- package/dist/invoke-policy.js.map +1 -0
- package/dist/invoke-runtime-config.d.ts +4 -0
- package/dist/invoke-runtime-config.d.ts.map +1 -0
- package/dist/invoke-runtime-config.js +15 -0
- package/dist/invoke-runtime-config.js.map +1 -0
- package/dist/jobs/in-memory-job-registry.d.ts +21 -0
- package/dist/jobs/in-memory-job-registry.d.ts.map +1 -0
- package/dist/jobs/in-memory-job-registry.js +44 -0
- package/dist/jobs/in-memory-job-registry.js.map +1 -0
- package/dist/logger.d.ts +9 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +17 -0
- package/dist/logger.js.map +1 -0
- package/dist/openapi/registry-to-openapi.d.ts +11 -0
- package/dist/openapi/registry-to-openapi.d.ts.map +1 -0
- package/dist/openapi/registry-to-openapi.js +61 -0
- package/dist/openapi/registry-to-openapi.js.map +1 -0
- package/dist/registry-state.d.ts +107 -0
- package/dist/registry-state.d.ts.map +1 -0
- package/dist/registry-state.js +302 -0
- package/dist/registry-state.js.map +1 -0
- package/dist/return.d.ts +14 -0
- package/dist/return.d.ts.map +1 -0
- package/dist/return.js +107 -0
- package/dist/return.js.map +1 -0
- package/dist/rpc.d.ts +7 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +287 -0
- package/dist/rpc.js.map +1 -0
- package/dist/serialize-rpc-result.d.ts +38 -0
- package/dist/serialize-rpc-result.d.ts.map +1 -0
- package/dist/serialize-rpc-result.js +132 -0
- package/dist/serialize-rpc-result.js.map +1 -0
- package/dist/session-store.d.ts +9 -0
- package/dist/session-store.d.ts.map +1 -0
- package/dist/session-store.js +19 -0
- package/dist/session-store.js.map +1 -0
- package/dist/source-utils.d.ts +19 -0
- package/dist/source-utils.d.ts.map +1 -0
- package/dist/source-utils.js +65 -0
- package/dist/source-utils.js.map +1 -0
- package/dist/transport/remote-bridge-cli.d.ts +2 -0
- package/dist/transport/remote-bridge-cli.d.ts.map +1 -0
- package/dist/transport/remote-bridge-cli.js +12 -0
- package/dist/transport/remote-bridge-cli.js.map +1 -0
- package/dist/transport/remote-inspector-bridge.d.ts +18 -0
- package/dist/transport/remote-inspector-bridge.d.ts.map +1 -0
- package/dist/transport/remote-inspector-bridge.js +71 -0
- package/dist/transport/remote-inspector-bridge.js.map +1 -0
- package/dist/transport/socket-io-playground.d.ts +78 -0
- package/dist/transport/socket-io-playground.d.ts.map +1 -0
- package/dist/transport/socket-io-playground.js +875 -0
- package/dist/transport/socket-io-playground.js.map +1 -0
- package/dist/transport/socket-io.d.ts +4 -0
- package/dist/transport/socket-io.d.ts.map +1 -0
- package/dist/transport/socket-io.js +4 -0
- package/dist/transport/socket-io.js.map +1 -0
- package/dist/transport/ws-server.d.ts +42 -0
- package/dist/transport/ws-server.d.ts.map +1 -0
- package/dist/transport/ws-server.js +429 -0
- package/dist/transport/ws-server.js.map +1 -0
- package/dist/type-string-normalize.d.ts +24 -0
- package/dist/type-string-normalize.d.ts.map +1 -0
- package/dist/type-string-normalize.js +178 -0
- package/dist/type-string-normalize.js.map +1 -0
- package/dist/types.d.ts +218 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/upload/fetch-file-url.d.ts +24 -0
- package/dist/upload/fetch-file-url.d.ts.map +1 -0
- package/dist/upload/fetch-file-url.js +130 -0
- package/dist/upload/fetch-file-url.js.map +1 -0
- package/dist/upload/host-minio-client.d.ts +30 -0
- package/dist/upload/host-minio-client.d.ts.map +1 -0
- package/dist/upload/host-minio-client.js +56 -0
- package/dist/upload/host-minio-client.js.map +1 -0
- package/dist/upload/materialize.d.ts +110 -0
- package/dist/upload/materialize.d.ts.map +1 -0
- package/dist/upload/materialize.js +466 -0
- package/dist/upload/materialize.js.map +1 -0
- package/dist/upload/upload-store.d.ts +44 -0
- package/dist/upload/upload-store.d.ts.map +1 -0
- package/dist/upload/upload-store.js +86 -0
- package/dist/upload/upload-store.js.map +1 -0
- package/dist/validate-params-json-schema.d.ts +13 -0
- package/dist/validate-params-json-schema.d.ts.map +1 -0
- package/dist/validate-params-json-schema.js +37 -0
- package/dist/validate-params-json-schema.js.map +1 -0
- package/dist/validate-return-json-schema.d.ts +9 -0
- package/dist/validate-return-json-schema.d.ts.map +1 -0
- package/dist/validate-return-json-schema.js +33 -0
- package/dist/validate-return-json-schema.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { ActiveContext, ApiContext, ErrorCapture, Registry, broadcastErrorThrown, broadcastMiddlewareNext, } from './registry-state.js';
|
|
2
|
+
import { extractApiReturnLabels, extractParamNames, extractReturnLabels, extractThrowLabels, getFunctionBody, } from './source-utils.js';
|
|
3
|
+
function detectModeForFunction(paramNames, options) {
|
|
4
|
+
const looksLikeExpress = paramNames.includes('req') && paramNames.includes('res');
|
|
5
|
+
const hasRoute = options?.route !== undefined;
|
|
6
|
+
if (!looksLikeExpress && !hasRoute)
|
|
7
|
+
return 'service';
|
|
8
|
+
return hasRoute ? 'api' : 'api_candidate';
|
|
9
|
+
}
|
|
10
|
+
function registerFunction(fnKey, fn, mode, params, declaredReturn, paramsJsonSchema) {
|
|
11
|
+
if (Registry.has(fnKey)) {
|
|
12
|
+
throw new Error(`cat: duplicate fnKey "${fnKey}". Each instrumented function must use a unique key.`);
|
|
13
|
+
}
|
|
14
|
+
const body = getFunctionBody(fn);
|
|
15
|
+
Registry.set(fnKey, {
|
|
16
|
+
mode,
|
|
17
|
+
className: fnKey.split('.')[0] ?? fnKey,
|
|
18
|
+
method: fnKey.split('.')[1] ?? fnKey,
|
|
19
|
+
style: 'function',
|
|
20
|
+
body,
|
|
21
|
+
params,
|
|
22
|
+
declaredReturn,
|
|
23
|
+
returns: extractReturnLabels(body).map((label) => ({
|
|
24
|
+
label,
|
|
25
|
+
type: null,
|
|
26
|
+
status: 'pending',
|
|
27
|
+
})),
|
|
28
|
+
errors: extractThrowLabels(body).map((label) => ({
|
|
29
|
+
label,
|
|
30
|
+
type: null,
|
|
31
|
+
message: null,
|
|
32
|
+
status: 'pending',
|
|
33
|
+
})),
|
|
34
|
+
children: [],
|
|
35
|
+
parents: [],
|
|
36
|
+
route: null,
|
|
37
|
+
httpMethod: null,
|
|
38
|
+
apiResponses: extractApiReturnLabels(body).map((label) => ({
|
|
39
|
+
label,
|
|
40
|
+
statusCode: null,
|
|
41
|
+
bodyShape: null,
|
|
42
|
+
status: 'pending',
|
|
43
|
+
})),
|
|
44
|
+
serviceLinks: [],
|
|
45
|
+
pipelineId: null,
|
|
46
|
+
pipelineIndex: null,
|
|
47
|
+
...(paramsJsonSchema !== undefined && paramsJsonSchema !== null
|
|
48
|
+
? { paramsJsonSchema }
|
|
49
|
+
: {}),
|
|
50
|
+
originalFn: fn,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function isThenable(v) {
|
|
54
|
+
return Boolean(v && typeof v.then === 'function');
|
|
55
|
+
}
|
|
56
|
+
function buildWrapper(fnKey, original) {
|
|
57
|
+
return function (...args) {
|
|
58
|
+
const entry = Registry.get(fnKey);
|
|
59
|
+
const isApi = entry?.mode === 'api';
|
|
60
|
+
const isMiddleware = entry?.mode === 'api_candidate';
|
|
61
|
+
const clearContext = () => {
|
|
62
|
+
if (isApi)
|
|
63
|
+
ApiContext.clear();
|
|
64
|
+
else
|
|
65
|
+
ActiveContext.pop();
|
|
66
|
+
};
|
|
67
|
+
// Express middleware: wrap next() so successful middleware steps emit an inspector event.
|
|
68
|
+
// This avoids leaving expected middleware nodes stuck at "pending" when they only call next().
|
|
69
|
+
if (isMiddleware && typeof args[2] === 'function') {
|
|
70
|
+
const realNext = args[2];
|
|
71
|
+
let emitted = false;
|
|
72
|
+
args[2] = (...nextArgs) => {
|
|
73
|
+
if (!emitted) {
|
|
74
|
+
emitted = true;
|
|
75
|
+
const err = nextArgs[0];
|
|
76
|
+
if (err) {
|
|
77
|
+
const message = err instanceof Error ? err.message : typeof err === 'string' ? err : 'next(err)';
|
|
78
|
+
broadcastErrorThrown({
|
|
79
|
+
event: 'ERROR_THROWN',
|
|
80
|
+
fnKey,
|
|
81
|
+
label: 'NEXT_ERROR',
|
|
82
|
+
layer: 'expected',
|
|
83
|
+
message,
|
|
84
|
+
stack: err instanceof Error ? err.stack ?? null : null,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
broadcastMiddlewareNext({
|
|
89
|
+
event: 'MIDDLEWARE_NEXT',
|
|
90
|
+
fnKey,
|
|
91
|
+
label: 'NEXT',
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return realNext(...nextArgs);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
if (isApi)
|
|
99
|
+
ApiContext.set(fnKey);
|
|
100
|
+
else
|
|
101
|
+
ActiveContext.push(fnKey);
|
|
102
|
+
let out;
|
|
103
|
+
try {
|
|
104
|
+
out = original.apply(this, args);
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
if (err instanceof Error && !ErrorCapture.hasCurrent()) {
|
|
108
|
+
ErrorCapture.capture('UNEXPECTED_ERROR', err);
|
|
109
|
+
broadcastErrorThrown({
|
|
110
|
+
event: 'ERROR_THROWN',
|
|
111
|
+
fnKey,
|
|
112
|
+
label: 'UNEXPECTED_ERROR',
|
|
113
|
+
layer: 'unexpected',
|
|
114
|
+
message: err.message,
|
|
115
|
+
stack: err.stack ?? null,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
clearContext();
|
|
119
|
+
throw err;
|
|
120
|
+
}
|
|
121
|
+
if (isThenable(out)) {
|
|
122
|
+
return Promise.resolve(out).finally(clearContext);
|
|
123
|
+
}
|
|
124
|
+
clearContext();
|
|
125
|
+
return out;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export function cat(fnKey, fn, options) {
|
|
129
|
+
const paramNames = extractParamNames(fn);
|
|
130
|
+
const mode = detectModeForFunction(paramNames, options);
|
|
131
|
+
const hintedParams = options?.params ??
|
|
132
|
+
paramNames.map((name) => ({ name, type: 'unknown' }));
|
|
133
|
+
const hintedReturn = options?.declaredReturn ?? 'unknown';
|
|
134
|
+
registerFunction(fnKey, fn, mode, hintedParams, hintedReturn, options?.paramsJsonSchema ?? null);
|
|
135
|
+
if (options?.route) {
|
|
136
|
+
const entry = Registry.get(fnKey);
|
|
137
|
+
entry.route = options.route;
|
|
138
|
+
entry.httpMethod = options.method ?? 'GET';
|
|
139
|
+
entry.mode = 'api';
|
|
140
|
+
}
|
|
141
|
+
const wrapped = buildWrapper(fnKey, fn);
|
|
142
|
+
const entry = Registry.get(fnKey);
|
|
143
|
+
if (entry)
|
|
144
|
+
entry.originalFn = wrapped;
|
|
145
|
+
return wrapped;
|
|
146
|
+
}
|
|
147
|
+
export function catModule(moduleName, fns, options) {
|
|
148
|
+
const wrapped = {};
|
|
149
|
+
for (const [methodName, fn] of Object.entries(fns)) {
|
|
150
|
+
const fnKey = `${moduleName}.${methodName}`;
|
|
151
|
+
const paramNames = extractParamNames(fn);
|
|
152
|
+
const mode = detectModeForFunction(paramNames);
|
|
153
|
+
const hintedParams = options?.[methodName]?.params ??
|
|
154
|
+
paramNames.map((name) => ({ name, type: 'unknown' }));
|
|
155
|
+
const hintedReturn = options?.[methodName]?.declaredReturn ?? 'unknown';
|
|
156
|
+
registerFunction(fnKey, fn, mode, hintedParams, hintedReturn, options?.[methodName]?.paramsJsonSchema ?? null);
|
|
157
|
+
const wrappedFn = buildWrapper(fnKey, fn);
|
|
158
|
+
const entry = Registry.get(fnKey);
|
|
159
|
+
if (entry)
|
|
160
|
+
entry.originalFn = wrappedFn;
|
|
161
|
+
wrapped[methodName] = wrappedFn;
|
|
162
|
+
}
|
|
163
|
+
return wrapped;
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=functional.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functional.js","sourceRoot":"","sources":["../src/functional.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EACb,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACN,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,GACf,MAAM,mBAAmB,CAAA;AAgB1B,SAAS,qBAAqB,CAAC,UAAoB,EAAE,OAA4B;IAChF,MAAM,gBAAgB,GAAG,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IACjF,MAAM,QAAQ,GAAG,OAAO,EAAE,KAAK,KAAK,SAAS,CAAA;IAC7C,IAAI,CAAC,gBAAgB,IAA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KAAK;YAAE,KAAK,CAAC,UAAU,GAAG,SAAS,CAAA;QACvC,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS,CAAA;IAChC,CAAC;IAED,OAAO,OAAY,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function resolveRelationships(): void;
|
|
2
|
+
export declare function analyzeRelationships(): {
|
|
3
|
+
roots: string[];
|
|
4
|
+
leaves: string[];
|
|
5
|
+
middle: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare function buildTree(fnKey: string, visited?: Set<string>): object;
|
|
8
|
+
export declare function groupApiPipelines(): Record<string, string[]>;
|
|
9
|
+
//# sourceMappingURL=relationships.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../src/graph/relationships.ts"],"names":[],"mappings":"AAMA,wBAAgB,oBAAoB,IAAI,IAAI,CAuB3C;AAED,wBAAgB,oBAAoB,IAAI;IACvC,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,CAAA;CAChB,CAeA;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,cAAoB,GAAG,MAAM,CA0B5E;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAgB5D"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Registry } from '../registry-state.js';
|
|
2
|
+
function dedupePush(arr, key) {
|
|
3
|
+
if (!arr.includes(key))
|
|
4
|
+
arr.push(key);
|
|
5
|
+
}
|
|
6
|
+
export function resolveRelationships() {
|
|
7
|
+
const allKeys = [...Registry.keys()];
|
|
8
|
+
Registry.forEach((meta, fnKey) => {
|
|
9
|
+
for (const otherKey of allKeys) {
|
|
10
|
+
if (otherKey === fnKey)
|
|
11
|
+
continue;
|
|
12
|
+
const methodName = otherKey.split('.')[1];
|
|
13
|
+
if (!methodName)
|
|
14
|
+
continue;
|
|
15
|
+
if (meta.body.includes(methodName)) {
|
|
16
|
+
const other = Registry.get(otherKey);
|
|
17
|
+
if (!other)
|
|
18
|
+
continue;
|
|
19
|
+
if (meta.mode === 'service' && other.mode === 'service') {
|
|
20
|
+
dedupePush(meta.children, otherKey);
|
|
21
|
+
dedupePush(other.parents, fnKey);
|
|
22
|
+
}
|
|
23
|
+
if (meta.mode === 'api' && other.mode === 'service') {
|
|
24
|
+
dedupePush(meta.serviceLinks, otherKey);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export function analyzeRelationships() {
|
|
31
|
+
const roots = [];
|
|
32
|
+
const leaves = [];
|
|
33
|
+
const middle = [];
|
|
34
|
+
Registry.forEach((meta, key) => {
|
|
35
|
+
const hasParents = meta.parents.length > 0;
|
|
36
|
+
const hasChildren = meta.children.length > 0;
|
|
37
|
+
if (!hasParents && hasChildren)
|
|
38
|
+
roots.push(key);
|
|
39
|
+
if (hasParents && !hasChildren)
|
|
40
|
+
leaves.push(key);
|
|
41
|
+
if (hasParents && hasChildren)
|
|
42
|
+
middle.push(key);
|
|
43
|
+
});
|
|
44
|
+
return { roots, leaves, middle };
|
|
45
|
+
}
|
|
46
|
+
export function buildTree(fnKey, visited = new Set()) {
|
|
47
|
+
if (visited.has(fnKey))
|
|
48
|
+
return { key: fnKey, circular: true };
|
|
49
|
+
visited.add(fnKey);
|
|
50
|
+
const meta = Registry.get(fnKey);
|
|
51
|
+
if (!meta)
|
|
52
|
+
return { key: fnKey, error: 'not found' };
|
|
53
|
+
return {
|
|
54
|
+
key: fnKey,
|
|
55
|
+
mode: meta.mode,
|
|
56
|
+
className: meta.className,
|
|
57
|
+
method: meta.method,
|
|
58
|
+
params: meta.params,
|
|
59
|
+
declaredReturn: meta.declaredReturn,
|
|
60
|
+
returns: meta.returns,
|
|
61
|
+
errors: meta.errors,
|
|
62
|
+
apiResponses: meta.apiResponses,
|
|
63
|
+
route: meta.route,
|
|
64
|
+
httpMethod: meta.httpMethod,
|
|
65
|
+
pipelineId: meta.pipelineId,
|
|
66
|
+
pipelineIndex: meta.pipelineIndex,
|
|
67
|
+
serviceLinks: meta.serviceLinks,
|
|
68
|
+
isRoot: meta.parents.length === 0,
|
|
69
|
+
isLeaf: meta.children.length === 0,
|
|
70
|
+
children: meta.children.map((child) => buildTree(child, visited)),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export function groupApiPipelines() {
|
|
74
|
+
const grouped = {};
|
|
75
|
+
Registry.forEach((meta, fnKey) => {
|
|
76
|
+
if (meta.pipelineId === null || meta.pipelineIndex === null)
|
|
77
|
+
return;
|
|
78
|
+
if (!grouped[meta.pipelineId])
|
|
79
|
+
grouped[meta.pipelineId] = [];
|
|
80
|
+
grouped[meta.pipelineId].push(fnKey);
|
|
81
|
+
});
|
|
82
|
+
for (const [pid, keys] of Object.entries(grouped)) {
|
|
83
|
+
keys.sort((a, b) => {
|
|
84
|
+
const ai = Registry.get(a)?.pipelineIndex ?? 0;
|
|
85
|
+
const bi = Registry.get(b)?.pipelineIndex ?? 0;
|
|
86
|
+
return ai - bi;
|
|
87
|
+
});
|
|
88
|
+
grouped[pid] = keys;
|
|
89
|
+
}
|
|
90
|
+
return grouped;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=relationships.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationships.js","sourceRoot":"","sources":["../../src/graph/relationships.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE/C,SAAS,UAAU,CAAC,GAAa,EAAE,GAAW;IAC7C,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACtC,CAAC;AAED,MAAM,UAAU,oB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,EAAE,CAAA;QACf,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;IACpB,CAAC;IACD,OAAO,OAAO,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Express } from 'express';
|
|
2
|
+
import type { HttpMethod } from './express.js';
|
|
3
|
+
export type HttpBridgeSpec = {
|
|
4
|
+
app: Express;
|
|
5
|
+
method: HttpMethod;
|
|
6
|
+
path: string;
|
|
7
|
+
mapArgsToBody: (args: unknown[]) => unknown;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Map a catalogued `fnKey` to an in-process HTTP call (Pattern B). Requires an existing `Registry` entry.
|
|
11
|
+
* Side effect: sets `entry.invokeKind = 'http_synthetic'`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function registerHttpBridgeRoute(app: Express, spec: {
|
|
14
|
+
fnKey: string;
|
|
15
|
+
method: HttpMethod;
|
|
16
|
+
path: string;
|
|
17
|
+
mapArgsToBody: (args: unknown[]) => unknown;
|
|
18
|
+
}): void;
|
|
19
|
+
export declare function getHttpBridgeSpec(fnKey: string): HttpBridgeSpec | undefined;
|
|
20
|
+
export declare function clearHttpBridgeRegistry(): void;
|
|
21
|
+
export declare function runHttpBridgeInvoke(spec: HttpBridgeSpec, args: unknown[]): Promise<{
|
|
22
|
+
statusCode: number;
|
|
23
|
+
headers: Record<string, string>;
|
|
24
|
+
body: unknown;
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=http-bridge-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-bridge-registry.d.ts","sourceRoot":"","sources":["../src/http-bridge-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAI9C,MAAM,MAAM,cAAc,GAAG;IAC5B,GAAG,EAAE,OAAO,CAAA;IACZ,MAAM,EAAE,UAAU,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAA;CAC3C,CAAA;AAID;;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAA;CAAE,GACpG,IAAI,CAeN;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAE3E;AAED,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C;AAED,wBAAsB,mBAAmB,CACxC,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,OAAO,EAAE,GACb,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAQjF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { invokeExpressSynthetic } from './express.js';
|
|
2
|
+
import { Registry } from './registry-state.js';
|
|
3
|
+
const bridges = new Map();
|
|
4
|
+
/**
|
|
5
|
+
* Map a catalogued `fnKey` to an in-process HTTP call (Pattern B). Requires an existing `Registry` entry.
|
|
6
|
+
* Side effect: sets `entry.invokeKind = 'http_synthetic'`.
|
|
7
|
+
*/
|
|
8
|
+
export function registerHttpBridgeRoute(app, spec) {
|
|
9
|
+
const e = Registry.get(spec.fnKey);
|
|
10
|
+
if (!e) {
|
|
11
|
+
throw new Error(`registerHttpBridgeRoute: unknown fnKey "${spec.fnKey}"`);
|
|
12
|
+
}
|
|
13
|
+
if (bridges.has(spec.fnKey)) {
|
|
14
|
+
throw new Error(`registerHttpBridgeRoute: duplicate registration for "${spec.fnKey}"`);
|
|
15
|
+
}
|
|
16
|
+
e.invokeKind = 'http_synthetic';
|
|
17
|
+
bridges.set(spec.fnKey, {
|
|
18
|
+
app,
|
|
19
|
+
method: spec.method,
|
|
20
|
+
path: spec.path,
|
|
21
|
+
mapArgsToBody: spec.mapArgsToBody,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export function getHttpBridgeSpec(fnKey) {
|
|
25
|
+
return bridges.get(fnKey);
|
|
26
|
+
}
|
|
27
|
+
export function clearHttpBridgeRegistry() {
|
|
28
|
+
bridges.clear();
|
|
29
|
+
}
|
|
30
|
+
export async function runHttpBridgeInvoke(spec, args) {
|
|
31
|
+
const body = spec.mapArgsToBody(args);
|
|
32
|
+
const out = await invokeExpressSynthetic(spec.app, {
|
|
33
|
+
method: spec.method,
|
|
34
|
+
path: spec.path,
|
|
35
|
+
body,
|
|
36
|
+
});
|
|
37
|
+
return { statusCode: out.statusCode, headers: out.headers, body: out.bodyJson };
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=http-bridge-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-bridge-registry.js","sourceRoot":"","sources":["../src/http-bridge-registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAS9C,MAAM,OAAO,GAAG,IAAI,GAAG,EAA0B,CAAA;AAEjD;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACtC,GAAY,EACZ,IAAsG;IAEtG,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClC,IAAI,CAAC,CAAC,EAAE,CAAC;QACR,MAAM,IAAI,KAAK,CAAC,2CAA2C,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;IAC1E,CAAC;IACD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,wDAAwD,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;IACvF,CAAC;IACD,CAAC,CAAC,UAAU,GAAG,gBAAgB,CAAA;IAC/B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE;QACvB,GAAG;QACH,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,aAAa,EAAE,IAAI,CAAC,aAAa;KACjC,CAAC,CAAA;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC9C,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,MAAM,UAAU,uBAAuB;IACtC,OAAO,CAAC,KAAK,EAAE,CAAA;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,IAAoB,EACpB,IAAe;IAEf,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;IACrC,MAAM,GAAG,GAAG,MAAM,sBAAsB,CAAC,IAAI,CAAC,GAAG,EAAE;QAClD,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI;KACJ,CAAC,CAAA;IACF,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAA;AAChF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export { runASTScanner, type RunAstScannerOptions } from './ast/run-ast-scanner.js';
|
|
2
|
+
export { mergeASTIntoRegistry } from './ast/merge-ast.js';
|
|
3
|
+
export { getAllTsFiles, type GetAllTsFilesOptions } from './ast/get-all-ts-files.js';
|
|
4
|
+
export { bootstrap, validateBootstrapFileWire, validateBootstrapStorage, type BootstrapOptions, type BootstrapResult, type BootstrapStorageOptions, type HostMinioOptions, type StorageAdapter, } from './bootstrap.js';
|
|
5
|
+
export { Cat } from './decorators/cat.js';
|
|
6
|
+
export { CatClass, CatService } from './decorators/cat-class.js';
|
|
7
|
+
export { cat, catModule, type CatFunctionOptions } from './functional.js';
|
|
8
|
+
export { createCorrelationMiddleware, invokeExpressSynthetic, pipelineIdForRoute, registerCatPipeline, type HttpMethod, } from './express.js';
|
|
9
|
+
export { registerHttpBridgeRoute, clearHttpBridgeRegistry, type HttpBridgeSpec, } from './http-bridge-registry.js';
|
|
10
|
+
export { extractArtifactsFromResult } from './artifact-helpers.js';
|
|
11
|
+
export { exportRegistryOpenApi } from './openapi/registry-to-openapi.js';
|
|
12
|
+
export { getInvokeTimeoutMs, setInvokeTimeoutMs, resetInvokeTimeoutMs, } from './invoke-runtime-config.js';
|
|
13
|
+
export { resetReturnJsonSchemaValidators } from './validate-return-json-schema.js';
|
|
14
|
+
export { parseHostMinioEndpoint, putBufferAndPresignGetUrl, type ParsedHostMinioClientConfig, type PutBufferAndPresignGetInput, } from './upload/host-minio-client.js';
|
|
15
|
+
export { resetParamsJsonSchemaValidators, validateArgsAgainstParamsJsonSchema, } from './validate-params-json-schema.js';
|
|
16
|
+
export { analyzeRelationships, buildTree, groupApiPipelines, resolveRelationships, } from './graph/relationships.js';
|
|
17
|
+
export { createLogger, type Logger, type LogLevel } from './logger.js';
|
|
18
|
+
export { Registry, ActiveContext, ApiContext, InstanceRegistry, LabelCapture, ErrorCapture, wsClients, broadcast, broadcastReturnResolved, broadcastErrorThrown, broadcastApiResponse, broadcastJobProgress, registerInstance, AutoInstanceRegistry, ClassConstructorRegistry, registerClassConstructor, registerReturnJsonSchema, registerParamsJsonSchema, resetInspectorState, clearExpressApiInvokeCapture, recordExpressApiInvokeCapture, readExpressApiInvokeCapture, setBroadcastSink, clearBroadcastSink, getInspectorBroadcastStore, runWithInspectorBroadcastTarget, readInspectorSocketIdFromHeaders, INSPECTOR_SOCKET_ID_HEADER, type InspectorBroadcastSource, type InspectorBroadcastStore, } from './registry-state.js';
|
|
19
|
+
export { Return, Throw, ApiReturn, getShape, getType, type ApiPayload, type Labeled } from './return.js';
|
|
20
|
+
export { normalizeReturnTypeForRpcCompare, typesMatchForRpc, peelOuterLabeled, splitTopLevelUnion, } from './type-string-normalize.js';
|
|
21
|
+
export { extractParamNames, extractReturnLabels, extractThrowLabels, extractApiReturnLabels, getFunctionBody } from './source-utils.js';
|
|
22
|
+
export { scanExpressCandidates, type ScanExpressCandidatesOptions } from './coverage/scan-express-candidates.js';
|
|
23
|
+
export { scanReachableServices, type ScanReachableServicesOptions } from './coverage/scan-reachable-services.js';
|
|
24
|
+
export { computeCoverageReport, type ComputeCoverageOptions, type CoverageReport } from './coverage/compute-coverage.js';
|
|
25
|
+
export type { CandidateKind, CandidateRef, CoverageCandidates } from './coverage/types.js';
|
|
26
|
+
export { startInspectorWebSocket, type InspectorWebSocketOptions, type InspectorWebSocketHandle } from './transport/ws-server.js';
|
|
27
|
+
export { startRemoteInspectorBridge, type RemoteInspectorBridgeHandle, type RemoteInspectorBridgeOptions, } from './transport/remote-inspector-bridge.js';
|
|
28
|
+
export { executeRPC } from './rpc.js';
|
|
29
|
+
export { maybeSerializeRpcResult, resetRpcSerializationConfig, SerializeRpcResultError, serializeRpcResult, setRpcSerializationConfig, type RpcSerializationOptions, } from './serialize-rpc-result.js';
|
|
30
|
+
export { configureInvokeRateLimit, registerInvokeAudit, registerPreInvoke, resetInvokePolicy, type InvokeAuditEvent, type InvokeTransport, type PreInvokeContext, type PreInvokeHook, } from './invoke-policy.js';
|
|
31
|
+
export { InMemoryJobRegistry } from './jobs/in-memory-job-registry.js';
|
|
32
|
+
export { resetSessionStore, sessionCreate, sessionStep } from './session-store.js';
|
|
33
|
+
export { fetchFileUrl, isHostnameAllowed, type FetchFileUrlOptions, } from './upload/fetch-file-url.js';
|
|
34
|
+
export { buildCatalogWireExtras, enrichRegistryParamsWithWireHints, normalizeExpressPayloadFilesForPlayground, publicFileUrlCatalogSlice, type CatalogWireExtras, type MaterializeServiceWireOptions, } from './upload/materialize.js';
|
|
35
|
+
export { PROTOCOL_VERSION, type ApiResponseEntry, type BootstrapEvent, type CatMode, type JobProgressWireEvent, type ErrorEntry, type InspectorWireEvent, type QaFileWireMode, type QaMediaUploadTarget, type RegistryEntry, type RpcErrorDetail, type RpcExecutedEvent, type RpcArtifactRef, type RpcResponse, type SessionStateWireMessage, type ReturnEntry, type ReturnResolvedEvent, } from './types.js';
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACpF,OAAO,EACN,SAAS,EACT,yBAAyB,EACzB,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACnB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EACN,2BAA2B,EAC3B,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,UAAU,GACf,MAAM,cAAc,CAAA;AACrB,OA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AAClF,OAAO,EACN,YAAY,EACZ,iBAAiB,EACjB,KAAK,mBAAmB,GACxB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACN,sBAAsB,EACtB,iCAAiC,EACjC,yCAAyC,EACzC,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,6BAA6B,GAClC,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACN,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,OAAO,EACZ,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,mBAAmB,GACxB,MAAM,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export { runASTScanner } from './ast/run-ast-scanner.js';
|
|
2
|
+
export { mergeASTIntoRegistry } from './ast/merge-ast.js';
|
|
3
|
+
export { getAllTsFiles } from './ast/get-all-ts-files.js';
|
|
4
|
+
export { bootstrap, validateBootstrapFileWire, validateBootstrapStorage, } from './bootstrap.js';
|
|
5
|
+
export { Cat } from './decorators/cat.js';
|
|
6
|
+
export { CatClass, CatService } from './decorators/cat-class.js';
|
|
7
|
+
export { cat, catModule } from './functional.js';
|
|
8
|
+
export { createCorrelationMiddleware, invokeExpressSynthetic, pipelineIdForRoute, registerCatPipeline, } from './express.js';
|
|
9
|
+
export { registerHttpBridgeRoute, clearHttpBridgeRegistry, } from './http-bridge-registry.js';
|
|
10
|
+
export { extractArtifactsFromResult } from './artifact-helpers.js';
|
|
11
|
+
export { exportRegistryOpenApi } from './openapi/registry-to-openapi.js';
|
|
12
|
+
export { getInvokeTimeoutMs, setInvokeTimeoutMs, resetInvokeTimeoutMs, } from './invoke-runtime-config.js';
|
|
13
|
+
export { resetReturnJsonSchemaValidators } from './validate-return-json-schema.js';
|
|
14
|
+
export { parseHostMinioEndpoint, putBufferAndPresignGetUrl, } from './upload/host-minio-client.js';
|
|
15
|
+
export { resetParamsJsonSchemaValidators, validateArgsAgainstParamsJsonSchema, } from './validate-params-json-schema.js';
|
|
16
|
+
export { analyzeRelationships, buildTree, groupApiPipelines, resolveRelationships, } from './graph/relationships.js';
|
|
17
|
+
export { createLogger } from './logger.js';
|
|
18
|
+
export { Registry, ActiveContext, ApiContext, InstanceRegistry, LabelCapture, ErrorCapture, wsClients, broadcast, broadcastReturnResolved, broadcastErrorThrown, broadcastApiResponse, broadcastJobProgress, registerInstance, AutoInstanceRegistry, ClassConstructorRegistry, registerClassConstructor, registerReturnJsonSchema, registerParamsJsonSchema, resetInspectorState, clearExpressApiInvokeCapture, recordExpressApiInvokeCapture, readExpressApiInvokeCapture, setBroadcastSink, clearBroadcastSink, getInspectorBroadcastStore, runWithInspectorBroadcastTarget, readInspectorSocketIdFromHeaders, INSPECTOR_SOCKET_ID_HEADER, } from './registry-state.js';
|
|
19
|
+
export { Return, Throw, ApiReturn, getShape, getType } from './return.js';
|
|
20
|
+
export { normalizeReturnTypeForRpcCompare, typesMatchForRpc, peelOuterLabeled, splitTopLevelUnion, } from './type-string-normalize.js';
|
|
21
|
+
export { extractParamNames, extractReturnLabels, extractThrowLabels, extractApiReturnLabels, getFunctionBody } from './source-utils.js';
|
|
22
|
+
export { scanExpressCandidates } from './coverage/scan-express-candidates.js';
|
|
23
|
+
export { scanReachableServices } from './coverage/scan-reachable-services.js';
|
|
24
|
+
export { computeCoverageReport } from './coverage/compute-coverage.js';
|
|
25
|
+
export { startInspectorWebSocket } from './transport/ws-server.js';
|
|
26
|
+
export { startRemoteInspectorBridge, } from './transport/remote-inspector-bridge.js';
|
|
27
|
+
export { executeRPC } from './rpc.js';
|
|
28
|
+
export { maybeSerializeRpcResult, resetRpcSerializationConfig, SerializeRpcResultError, serializeRpcResult, setRpcSerializationConfig, } from './serialize-rpc-result.js';
|
|
29
|
+
export { configureInvokeRateLimit, registerInvokeAudit, registerPreInvoke, resetInvokePolicy, } from './invoke-policy.js';
|
|
30
|
+
export { InMemoryJobRegistry } from './jobs/in-memory-job-registry.js';
|
|
31
|
+
export { resetSessionStore, sessionCreate, sessionStep } from './session-store.js';
|
|
32
|
+
export { fetchFileUrl, isHostnameAllowed, } from './upload/fetch-file-url.js';
|
|
33
|
+
export { buildCatalogWireExtras, enrichRegistryParamsWithWireHints, normalizeExpressPayloadFilesForPlayground, publicFileUrlCatalogSlice, } from './upload/materialize.js';
|
|
34
|
+
export { PROTOCOL_VERSION, } from './types.js';
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA6B,MAAM,0BAA0B,CAAA;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,aAAa,EAA6B,MAAM,2BAA2B,CAAA;AACpF,OAAO,EACN,SAAS,EACT,yBAAyB,EACzB,wBAAwB,GAMxB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,GAAG,EAAE,SAAS,EAA2B,MAAM,iBAAiB,CAAA;AACzE,OAAO,EACN,2BAA2B,EAC3B,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,GAEnB,MAAM,cAAc,CAAA;AACrB,OAAO,EACN,uBAAuB,EACvB,uBAAuB,GAEvB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAk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qC,MAAM,uCAAuC,CAAA;AAChH,OAAO,EAAE,qBAAqB,EAAoD,MAAM,gCAAgC,CAAA;AAExH,OAAO,EAAE,uBAAuB,EAAiE,MAAM,0BAA0B,CAAA;AACjI,OAAO,EACN,0BAA0B,GAG1B,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EACN,uBAAuB,EACvB,2BAA2B,EAC3B,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,GAEzB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACN,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,GAKjB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAClF,OAAO,EACN,YAAY,EACZ,iBAAiB,GAEjB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACN,sBAAsB,EACtB,iCAAiC,EACjC,yCAAyC,EACzC,yBAAyB,GAGzB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACN,gBAAgB,GAiBhB,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { RpcResponse } from './types.js';
|
|
2
|
+
export type InvokeTransport = 'socket.io' | 'websocket';
|
|
3
|
+
export type PreInvokeContext = {
|
|
4
|
+
fnKey: string;
|
|
5
|
+
args: unknown[];
|
|
6
|
+
socketId: string | undefined;
|
|
7
|
+
transport: InvokeTransport;
|
|
8
|
+
/** Present for Socket.IO `rpc:call` and embedded ws `RPC_CALL` when the client supplied a token. */
|
|
9
|
+
requestId?: string;
|
|
10
|
+
/** Socket.IO: `handshake.auth.token`. WebSocket: `?token=` query when present. */
|
|
11
|
+
authToken?: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type PreInvokeHook = (ctx: PreInvokeContext) => void | RpcResponse | Promise<void | RpcResponse>;
|
|
14
|
+
export type InvokeAuditEvent = {
|
|
15
|
+
fnKey: string;
|
|
16
|
+
requestId: string;
|
|
17
|
+
status: 'ok' | 'error';
|
|
18
|
+
transport: InvokeTransport;
|
|
19
|
+
socketId: string | undefined;
|
|
20
|
+
durationMs: number;
|
|
21
|
+
};
|
|
22
|
+
export type InvokeAuditHook = (evt: InvokeAuditEvent) => void | Promise<void>;
|
|
23
|
+
export declare function registerPreInvoke(hook: PreInvokeHook): () => void;
|
|
24
|
+
export declare function registerInvokeAudit(hook: InvokeAuditHook): () => void;
|
|
25
|
+
export declare function configureInvokeRateLimit(opts: {
|
|
26
|
+
maxInvokesPerWindow: number;
|
|
27
|
+
windowMs: number;
|
|
28
|
+
} | null): void;
|
|
29
|
+
export declare function resetInvokePolicy(): void;
|
|
30
|
+
export declare function runPreInvokes(ctx: PreInvokeContext): Promise<RpcResponse | undefined>;
|
|
31
|
+
export declare function invokeRateLimitAllow(key: string): boolean;
|
|
32
|
+
export declare function invokeRateLimitRetryAfterMs(key: string): number;
|
|
33
|
+
export declare function invokeAudit(evt: InvokeAuditEvent): Promise<void>;
|
|
34
|
+
//# sourceMappingURL=invoke-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke-policy.d.ts","sourceRoot":"","sources":["../src/invoke-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,WAAW,CAAA;AAEvD,MAAM,MAAM,gBAAgB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,EAAE,CAAA;IACf,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,SAAS,EAAE,eAAe,CAAA;IAC1B,oGAAoG;IACpG,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kFAAkF;IAClF,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2
|
+
const auditHooks = [];
|
|
3
|
+
const rateBuckets = new Map();
|
|
4
|
+
let rateOpts = null;
|
|
5
|
+
export function registerPreInvoke(hook) {
|
|
6
|
+
preHooks.push(hook);
|
|
7
|
+
return () => {
|
|
8
|
+
const i = preHooks.indexOf(hook);
|
|
9
|
+
if (i >= 0)
|
|
10
|
+
preHooks.splice(i, 1);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function registerInvokeAudit(hook) {
|
|
14
|
+
auditHooks.push(hook);
|
|
15
|
+
return () => {
|
|
16
|
+
const i = auditHooks.indexOf(hook);
|
|
17
|
+
if (i >= 0)
|
|
18
|
+
auditHooks.splice(i, 1);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function configureInvokeRateLimit(opts) {
|
|
22
|
+
rateOpts = opts;
|
|
23
|
+
rateBuckets.clear();
|
|
24
|
+
}
|
|
25
|
+
export function resetInvokePolicy() {
|
|
26
|
+
preHooks.length = 0;
|
|
27
|
+
auditHooks.length = 0;
|
|
28
|
+
rateOpts = null;
|
|
29
|
+
rateBuckets.clear();
|
|
30
|
+
}
|
|
31
|
+
export async function runPreInvokes(ctx) {
|
|
32
|
+
for (const h of preHooks) {
|
|
33
|
+
const r = await h(ctx);
|
|
34
|
+
if (r && typeof r === 'object' && r.type === 'RPC_RESPONSE') {
|
|
35
|
+
return r;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
export function invokeRateLimitAllow(key) {
|
|
41
|
+
if (!rateOpts)
|
|
42
|
+
return true;
|
|
43
|
+
const now = Date.now();
|
|
44
|
+
let b = rateBuckets.get(key);
|
|
45
|
+
if (!b || now >= b.resetAt) {
|
|
46
|
+
b = { count: 0, resetAt: now + rateOpts.windowMs };
|
|
47
|
+
rateBuckets.set(key, b);
|
|
48
|
+
}
|
|
49
|
+
if (b.count >= rateOpts.maxInvokesPerWindow)
|
|
50
|
+
return false;
|
|
51
|
+
b.count++;
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
export function invokeRateLimitRetryAfterMs(key) {
|
|
55
|
+
if (!rateOpts)
|
|
56
|
+
return 0;
|
|
57
|
+
const b = rateBuckets.get(key);
|
|
58
|
+
if (!b)
|
|
59
|
+
return 0;
|
|
60
|
+
return Math.max(0, b.resetAt - Date.now());
|
|
61
|
+
}
|
|
62
|
+
export async function invokeAudit(evt) {
|
|
63
|
+
for (const h of auditHooks) {
|
|
64
|
+
try {
|
|
65
|
+
await h(evt);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
/* audit must not break invoke */
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=invoke-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke-policy.js","sourceRoot":"","sources":["../src/invoke-policy.ts"],"names":[],"mappings":"AA8BA,MAAM,QAAQ,GAAoB,EAAE,CAAA;AACpC,MAAM,UAAU,GAAsB,EAAE,CAAA;AAGxC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAA;AAC7C,IAAI,QAAQ,GAA6D,IAAI,CAAA;AAE7E,MAAM,UAAU,iBAAiB,CAAC,IAAmB;IACpD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACnB,OAAO,GAAG,EAAE;QACX,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAChC,IAAI,CAAC,IAAI,CAAC;YAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAClC,CAAC,CAAA;AACF,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAqB;IACxD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrB,OAAO,GAAG,EAAE;QACX,MAAM,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,CA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AAC,KAAK,IAAI,QAAQ,CAAC,mBAAmB;QAAE,OAAO,KAAK,CAAA;IACzD,CAAC,CAAC,KAAK,EAAE,CAAA;IACT,OAAO,IAAI,CAAA;AACZ,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,GAAW;IACtD,IAAI,CAAC,QAAQ;QAAE,OAAO,CAAC,CAAA;IACvB,MAAM,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC9B,IAAI,CAAC,CAAC;QAAE,OAAO,CAAC,CAAA;IAChB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;AAC3C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAqB;IACtD,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC5B,IAAI,CAAC;YACJ,MAAM,CAAC,CAAC,GAAG,CAAC,CAAA;QACb,CAAC;QAAC,MAAM,CAAC;YACR,iCAAiC;QAClC,CAAC;IACF,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke-runtime-config.d.ts","sourceRoot":"","sources":["../src/invoke-runtime-config.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAEvD;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAK/D;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Optional max duration for a single RPC handler `await` (host-wide). */
|
|
2
|
+
let invokeTimeoutMs;
|
|
3
|
+
export function getInvokeTimeoutMs() {
|
|
4
|
+
return invokeTimeoutMs;
|
|
5
|
+
}
|
|
6
|
+
export function setInvokeTimeoutMs(ms) {
|
|
7
|
+
if (ms !== undefined && (!Number.isFinite(ms) || ms <= 0)) {
|
|
8
|
+
throw new Error('invokeTimeoutMs must be a positive finite number when set');
|
|
9
|
+
}
|
|
10
|
+
invokeTimeoutMs = ms;
|
|
11
|
+
}
|
|
12
|
+
export function resetInvokeTimeoutMs() {
|
|
13
|
+
invokeTimeoutMs = undefined;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=invoke-runtime-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke-runtime-config.js","sourceRoot":"","sources":["../src/invoke-runtime-config.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,IAAI,eAAmC,CAAA;AAEvC,MAAM,UAAU,kBAAkB;IACjC,OAAO,eAAe,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,EAAsB;IACxD,IAAI,EAAE,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAA;IAC7E,CAAC;IACD,eAAe,GAAG,EAAE,CAAA;AACrB,CAAC;AAED,MAAM,UAAU,oBAAoB;IACnC,eAAe,GAAG,SAAS,CAAA;AAC5B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type JobStatus = 'queued' | 'running' | 'done' | 'failed';
|
|
2
|
+
type JobRow = {
|
|
3
|
+
status: JobStatus;
|
|
4
|
+
percent: number;
|
|
5
|
+
result?: unknown;
|
|
6
|
+
detail?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Minimal in-memory job registry for QA demos: creates ids, updates status, fans out `JOB_PROGRESS` on the inspector broadcast path.
|
|
10
|
+
*/
|
|
11
|
+
export declare class InMemoryJobRegistry {
|
|
12
|
+
private readonly jobs;
|
|
13
|
+
createJob(): string;
|
|
14
|
+
setRunning(jobId: string, percent?: number): void;
|
|
15
|
+
complete(jobId: string, result?: unknown): void;
|
|
16
|
+
fail(jobId: string, detail?: string): void;
|
|
17
|
+
get(jobId: string): JobRow | undefined;
|
|
18
|
+
private require;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=in-memory-job-registry.d.ts.map
|