shokupan 0.13.0 → 0.14.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/{analyzer-BOtveWL-.cjs → analyzer-BZSVGTmP.cjs} +5 -4
- package/dist/analyzer-BZSVGTmP.cjs.map +1 -0
- package/dist/{analyzer-B0fMzeIo.js → analyzer-Faojwm7c.js} +5 -4
- package/dist/analyzer-Faojwm7c.js.map +1 -0
- package/dist/{analyzer.impl-CUDO6vpn.cjs → analyzer.impl-5aCqtook.cjs} +28 -11
- package/dist/analyzer.impl-5aCqtook.cjs.map +1 -0
- package/dist/{analyzer.impl-DmHe92Oi.js → analyzer.impl-COdN69gL.js} +28 -11
- package/dist/analyzer.impl-COdN69gL.js.map +1 -0
- package/dist/ast-analyzer-worker-C3jrQ8VR.js +184 -0
- package/dist/ast-analyzer-worker-C3jrQ8VR.js.map +1 -0
- package/dist/ast-analyzer-worker-D_uYkqmY.cjs +184 -0
- package/dist/ast-analyzer-worker-D_uYkqmY.cjs.map +1 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/context.d.ts +39 -4
- package/dist/decorators/di.d.ts +31 -0
- package/dist/decorators/hooks.d.ts +28 -0
- package/dist/decorators/http.d.ts +60 -0
- package/dist/decorators/index.d.ts +8 -0
- package/dist/decorators/mcp.d.ts +48 -0
- package/dist/decorators/util/container.d.ts +36 -0
- package/dist/decorators/websocket.d.ts +172 -0
- package/dist/index-BP7v0Hiv.cjs +12216 -0
- package/dist/index-BP7v0Hiv.cjs.map +1 -0
- package/dist/index-CUNBeZKj.js +12176 -0
- package/dist/index-CUNBeZKj.js.map +1 -0
- package/dist/index.cjs +137 -10518
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +137 -10477
- package/dist/index.js.map +1 -1
- package/dist/{json-parser-COdZ0fqY.cjs → json-parser-BA0mUgMF.cjs} +3 -3
- package/dist/json-parser-BA0mUgMF.cjs.map +1 -0
- package/dist/{json-parser-B3dnQmCC.js → json-parser-BFM-SnBR.js} +3 -3
- package/dist/json-parser-BFM-SnBR.js.map +1 -0
- package/dist/knex-DDPXR-sQ.js +218 -0
- package/dist/knex-DDPXR-sQ.js.map +1 -0
- package/dist/knex-DghF-jjm.cjs +240 -0
- package/dist/knex-DghF-jjm.cjs.map +1 -0
- package/dist/level-BU87Jbus.js +184 -0
- package/dist/level-BU87Jbus.js.map +1 -0
- package/dist/level-DNFl2n-m.cjs +184 -0
- package/dist/level-DNFl2n-m.cjs.map +1 -0
- package/dist/plugins/application/api-explorer/static/explorer-client.mjs +54 -28
- package/dist/plugins/application/asyncapi/plugin.d.ts +1 -0
- package/dist/plugins/application/asyncapi/static/asyncapi-client.mjs +22 -11
- package/dist/plugins/application/dashboard/fetch-interceptor.d.ts +3 -1
- package/dist/plugins/application/dashboard/metrics-collector.d.ts +5 -3
- package/dist/plugins/application/dashboard/plugin.d.ts +36 -3
- package/dist/plugins/application/dashboard/static/requests.js +517 -53
- package/dist/plugins/application/dashboard/static/tabs.js +2 -2
- package/dist/plugins/application/error-view/index.d.ts +25 -0
- package/dist/plugins/application/error-view/reason-phrases.d.ts +1 -0
- package/dist/plugins/application/openapi/analyzer.d.ts +3 -1
- package/dist/plugins/application/openapi/analyzer.impl.d.ts +4 -2
- package/dist/router.d.ts +56 -21
- package/dist/shokupan.d.ts +25 -11
- package/dist/sqlite-CLrcTkti.js +180 -0
- package/dist/sqlite-CLrcTkti.js.map +1 -0
- package/dist/sqlite-n7FQ6Ja6.cjs +180 -0
- package/dist/sqlite-n7FQ6Ja6.cjs.map +1 -0
- package/dist/surreal-6QONU6xa.cjs +210 -0
- package/dist/surreal-6QONU6xa.cjs.map +1 -0
- package/dist/surreal-w7DeGVI-.js +188 -0
- package/dist/surreal-w7DeGVI-.js.map +1 -0
- package/dist/util/adapter/datastore/knex.d.ts +29 -0
- package/dist/util/adapter/datastore/level.d.ts +26 -0
- package/dist/util/adapter/datastore/sqlite.d.ts +24 -0
- package/dist/util/adapter/datastore/surreal.d.ts +29 -0
- package/dist/util/adapter/datastore.d.ts +59 -0
- package/dist/util/adapter/h3.d.ts +8 -0
- package/dist/util/adapter/index.d.ts +1 -0
- package/dist/util/ast-analyzer-worker.d.ts +77 -0
- package/dist/util/ast-worker-thread.d.ts +1 -0
- package/dist/util/cookie-parser.d.ts +6 -0
- package/dist/util/env-loader.d.ts +7 -0
- package/dist/util/html.d.ts +15 -0
- package/dist/util/ide.d.ts +9 -0
- package/dist/util/logger.d.ts +25 -0
- package/dist/util/query-string.d.ts +8 -0
- package/dist/util/response-transformer.d.ts +87 -0
- package/dist/util/symbol.d.ts +1 -0
- package/dist/util/types.d.ts +116 -42
- package/dist/websocket.d.ts +163 -0
- package/package.json +27 -1
- package/dist/analyzer-B0fMzeIo.js.map +0 -1
- package/dist/analyzer-BOtveWL-.cjs.map +0 -1
- package/dist/analyzer.impl-CUDO6vpn.cjs.map +0 -1
- package/dist/analyzer.impl-DmHe92Oi.js.map +0 -1
- package/dist/json-parser-B3dnQmCC.js.map +0 -1
- package/dist/json-parser-COdZ0fqY.cjs.map +0 -1
- package/dist/plugins/application/error-view/views/error.d.ts +0 -2
- package/dist/plugins/application/error-view/views/status.d.ts +0 -2
- package/dist/util/decorators.d.ts +0 -134
- package/dist/util/di.d.ts +0 -13
- /package/dist/{util → decorators/util}/metadata.d.ts +0 -0
- /package/dist/{util → decorators/util}/stack.d.ts +0 -0
|
@@ -321,7 +321,7 @@ async function selectEvent(name, el) {
|
|
|
321
321
|
sourceLinksHtml = sourceInfos.map(s => {
|
|
322
322
|
const filename = s.file ? s.file.split('/').pop() : 'unknown';
|
|
323
323
|
return `<a href="vscode://file/${s.file}:${s.line}" style="color: #fbbf24; text-decoration: none; display: block;" class="code-link">
|
|
324
|
-
<code style="font-family: 'JetBrains Mono', monospace; background: rgba(251, 191, 36, 0.1); padding: 2px 4px; border-radius: 4px;">${filename}:${s.line}</code>
|
|
324
|
+
<code style="font-family: 'JetBrains Mono', monospace; background: rgba(251, 191, 36, 0.1); padding: 2px 4px; border-radius: 4px;">${escapeHtml(filename)}:${s.line}</code>
|
|
325
325
|
</a>`;
|
|
326
326
|
}).join('');
|
|
327
327
|
}
|
|
@@ -336,10 +336,10 @@ async function selectEvent(name, el) {
|
|
|
336
336
|
<div class="doc-body">
|
|
337
337
|
<div class="alert warning" style="background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.2); border-radius: 6px; padding: 16px; margin-bottom: 24px;">
|
|
338
338
|
<p style="margin: 0; color: #fbbf24; font-weight: 500;">
|
|
339
|
-
${op.summary || 'Possible Issue Detected'}
|
|
339
|
+
${escapeHtml(op.summary || 'Possible Issue Detected')}
|
|
340
340
|
</p>
|
|
341
341
|
<p style="margin: 8px 0 0 0; opacity: 0.8; line-height: 1.5;">
|
|
342
|
-
${desc}
|
|
342
|
+
${escapeHtml(desc)}
|
|
343
343
|
</p>
|
|
344
344
|
<p style="margin: 12px 0 0 0;">
|
|
345
345
|
${sourceLinksHtml}
|
|
@@ -454,7 +454,7 @@ async function selectEvent(name, el) {
|
|
|
454
454
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right:6px">
|
|
455
455
|
<polyline points="16 18 22 12 16 6"></polyline><polyline points="8 6 2 12 8 18"></polyline>
|
|
456
456
|
</svg>
|
|
457
|
-
<code style="font-family: inherit;">${filename}:${s.line}</code>
|
|
457
|
+
<code style="font-family: inherit;">${escapeHtml(filename)}:${s.line}</code>
|
|
458
458
|
</a>`;
|
|
459
459
|
} else {
|
|
460
460
|
sourceLinkHtml = `<div class="doc-source-link" title="Multiple sources">
|
|
@@ -469,16 +469,16 @@ async function selectEvent(name, el) {
|
|
|
469
469
|
els.docPanel.innerHTML = `
|
|
470
470
|
<div class="doc-header">
|
|
471
471
|
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom: 0.5rem;">
|
|
472
|
-
<h1 class="doc-title" style="margin:0">${item.name}</h1>
|
|
472
|
+
<h1 class="doc-title" style="margin:0">${escapeHtml(item.name)}</h1>
|
|
473
473
|
${sourceLinkHtml}
|
|
474
474
|
</div>
|
|
475
475
|
<div class="doc-meta">
|
|
476
476
|
<span class="badge badge-${item.type === 'publish' ? 'SEND' : 'RECV'}" style="font-size: 0.8rem; padding: 4px 8px;">${item.type === 'publish' ? 'SEND' : 'RECV'}</span>
|
|
477
|
-
<span>${op.operationId || ''}</span>
|
|
477
|
+
<span>${escapeHtml(op.operationId || '')}</span>
|
|
478
478
|
</div>
|
|
479
479
|
</div>
|
|
480
480
|
<div class="doc-body">
|
|
481
|
-
${desc ? `<p style="line-height: 1.6; margin-bottom: 2rem;">${desc}</p>` : ''}
|
|
481
|
+
${desc ? `<p style="line-height: 1.6; margin-bottom: 2rem;">${escapeHtml(desc)}</p>` : ''}
|
|
482
482
|
|
|
483
483
|
<div class="section-title">Payload Schema</div>
|
|
484
484
|
${payload ? renderSchemaToDOM(payload) : '<div class="empty-state-text" style="color:var(--text-muted); font-style:italic;">Payload Unused</div>'}
|
|
@@ -641,9 +641,20 @@ async function selectEvent(name, el) {
|
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
643
|
|
|
644
|
+
// Helper to escape HTML
|
|
645
|
+
function escapeHtml(text) {
|
|
646
|
+
if (!text) return '';
|
|
647
|
+
return String(text)
|
|
648
|
+
.replace(/&/g, "&")
|
|
649
|
+
.replace(/</g, "<")
|
|
650
|
+
.replace(/>/g, ">")
|
|
651
|
+
.replace(/"/g, """)
|
|
652
|
+
.replace(/'/g, "'");
|
|
653
|
+
}
|
|
654
|
+
|
|
644
655
|
function renderSchemaToDOM(schema) {
|
|
645
656
|
if (!schema || schema.type !== 'object') {
|
|
646
|
-
return `<div class="code-block">${JSON.stringify(schema, null, 2)}</div>`;
|
|
657
|
+
return `<div class="code-block">${escapeHtml(JSON.stringify(schema, null, 2))}</div>`;
|
|
647
658
|
}
|
|
648
659
|
|
|
649
660
|
let html = '<div class="schema-root">';
|
|
@@ -659,12 +670,12 @@ function renderSchemaToDOM(schema) {
|
|
|
659
670
|
out += `
|
|
660
671
|
<div class="schema-row">
|
|
661
672
|
<div class="schema-prop">
|
|
662
|
-
${key} ${isReq ? '<span class="prop-req">*</span>' : ''}
|
|
673
|
+
${escapeHtml(key)} ${isReq ? '<span class="prop-req">*</span>' : ''}
|
|
663
674
|
</div>
|
|
664
675
|
<div style="flex: 1;">
|
|
665
676
|
<div style="display:flex; align-items:baseline;">
|
|
666
|
-
<span class="schema-type">${type}</span>
|
|
667
|
-
<span class="schema-desc">${desc}</span>
|
|
677
|
+
<span class="schema-type">${escapeHtml(type)}</span>
|
|
678
|
+
<span class="schema-desc">${escapeHtml(desc)}</span>
|
|
668
679
|
</div>
|
|
669
680
|
${prop.properties ? `<div class="nested-schema">${renderProps(prop.properties, prop.required)}</div>` : ''}
|
|
670
681
|
</div>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Logger } from '../../../util/logger';
|
|
1
2
|
/**
|
|
2
3
|
* Interface representing the details of an intercepted outbound request.
|
|
3
4
|
*/
|
|
@@ -87,7 +88,8 @@ export declare class FetchInterceptor {
|
|
|
87
88
|
private originalHttpsRequest;
|
|
88
89
|
private callbacks;
|
|
89
90
|
private isPatched;
|
|
90
|
-
|
|
91
|
+
private logger;
|
|
92
|
+
constructor(logger?: Logger);
|
|
91
93
|
/**
|
|
92
94
|
* Statically restore the original network methods.
|
|
93
95
|
* Useful for cleaning up in tests.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DatastoreAdapter } from '../../../util/adapter/datastore';
|
|
2
|
+
import { Logger } from '../../../util/logger';
|
|
2
3
|
interface AggregatedMetric {
|
|
3
4
|
timestamp: number;
|
|
4
5
|
interval: string;
|
|
@@ -35,12 +36,13 @@ interface AggregatedMetric {
|
|
|
35
36
|
}
|
|
36
37
|
export declare class MetricsCollector {
|
|
37
38
|
private onCollect?;
|
|
39
|
+
private logger?;
|
|
38
40
|
private currentIntervalStart;
|
|
39
41
|
private pendingDetails;
|
|
40
42
|
private eventLoopHistogram;
|
|
41
43
|
private timer;
|
|
42
|
-
db?:
|
|
43
|
-
constructor(db?:
|
|
44
|
+
db?: DatastoreAdapter;
|
|
45
|
+
constructor(db?: DatastoreAdapter, onCollect?: (metric: AggregatedMetric) => void, logger?: Logger);
|
|
44
46
|
recordRequest(duration: number, isError: boolean): void;
|
|
45
47
|
private alignTimestamp;
|
|
46
48
|
private collect;
|
|
@@ -27,9 +27,22 @@ export interface DashboardConfig {
|
|
|
27
27
|
getRequestHeaders?: () => HeadersInit;
|
|
28
28
|
path?: string;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* patterns to ignore in the request list.
|
|
31
|
+
* Can be a glob pattern (string), regex, or a custom callback function.
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
+
ignorePatterns?: (string | RegExp | ((req: RequestLog) => boolean))[];
|
|
34
|
+
/**
|
|
35
|
+
* If true, the replay endpoint will be disabled.
|
|
36
|
+
*/
|
|
37
|
+
disableReplay?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Array of status codes to not record.
|
|
40
|
+
*/
|
|
41
|
+
ignoreStatusCodes?: number[];
|
|
42
|
+
/**
|
|
43
|
+
* Array of HTTP methods to not record (e.g. ['OPTIONS', 'HEAD'])
|
|
44
|
+
*/
|
|
45
|
+
ignoreMethods?: string[];
|
|
33
46
|
/**
|
|
34
47
|
* Retention time in milliseconds
|
|
35
48
|
*/
|
|
@@ -62,7 +75,26 @@ export interface DashboardConfig {
|
|
|
62
75
|
* @default 1000
|
|
63
76
|
*/
|
|
64
77
|
maxLogEntries?: number;
|
|
78
|
+
/**
|
|
79
|
+
* Track and display state mutations made by middleware.
|
|
80
|
+
* Requires enableMiddlewareTracking to be enabled on the application.
|
|
81
|
+
* When enabled, the dashboard will show what properties each middleware added/modified on ctx.state.
|
|
82
|
+
* @default true (if enableMiddlewareTracking is enabled)
|
|
83
|
+
*/
|
|
84
|
+
trackStateMutations?: boolean;
|
|
65
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* The Dashboard plugin provides a web interface for monitoring and debugging the Shokupan application.
|
|
88
|
+
* It allows you to view request logs, metrics, and other debugging information. Additionally,
|
|
89
|
+
* this plugin shows the scalar, asyncapi and openapi plugins if they are enabled.
|
|
90
|
+
* It uses WebSockets to push updates to the dashboard in real-time.
|
|
91
|
+
*
|
|
92
|
+
* This plugin will automatically enable the metrics plugin and the fetch interceptor. These are
|
|
93
|
+
* required for the dashboard to function. The fetch interceptor will track all requests and
|
|
94
|
+
* responses for use in the dashboard and Network tab.
|
|
95
|
+
*
|
|
96
|
+
* When enabled, enableMiddlewareTracking will automatically be enabled on the application.
|
|
97
|
+
*/
|
|
66
98
|
export declare class Dashboard implements ShokupanPlugin {
|
|
67
99
|
private readonly dashboardConfig;
|
|
68
100
|
private [$appRoot];
|
|
@@ -76,7 +108,7 @@ export declare class Dashboard implements ShokupanPlugin {
|
|
|
76
108
|
private instrumented;
|
|
77
109
|
private mountPath;
|
|
78
110
|
private metricsCollector;
|
|
79
|
-
get db(): import('../../../util/datastore').
|
|
111
|
+
get db(): import('../../../util/adapter/datastore').DatastoreAdapter;
|
|
80
112
|
constructor(dashboardConfig?: DashboardConfig);
|
|
81
113
|
onInit(app: any, options?: {
|
|
82
114
|
path?: string;
|
|
@@ -84,6 +116,7 @@ export declare class Dashboard implements ShokupanPlugin {
|
|
|
84
116
|
private detectIntegrations;
|
|
85
117
|
private static getBasePath;
|
|
86
118
|
private setupRoutes;
|
|
119
|
+
private shouldIgnoreRequest;
|
|
87
120
|
private getUptime;
|
|
88
121
|
private getPublicMetrics;
|
|
89
122
|
private broadcastMetricUpdate;
|