@getvision/core 0.0.0 → 0.0.2-ae8b128-develop

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.
Files changed (52) hide show
  1. package/dist/core.d.ts +98 -0
  2. package/dist/core.d.ts.map +1 -0
  3. package/dist/core.js +266 -0
  4. package/dist/index.d.ts +8 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +5 -14
  7. package/dist/logs/index.d.ts +3 -0
  8. package/dist/logs/index.d.ts.map +1 -0
  9. package/dist/logs/index.js +2 -0
  10. package/dist/logs/interceptor.d.ts +21 -0
  11. package/dist/logs/interceptor.d.ts.map +1 -0
  12. package/dist/logs/interceptor.js +72 -0
  13. package/dist/logs/store.d.ts +36 -0
  14. package/dist/logs/store.d.ts.map +1 -0
  15. package/dist/logs/store.js +72 -0
  16. package/dist/server/index.d.ts +3 -0
  17. package/dist/server/index.d.ts.map +1 -0
  18. package/dist/server/index.js +2 -0
  19. package/dist/server/jsonrpc.d.ts +21 -0
  20. package/dist/server/jsonrpc.d.ts.map +1 -0
  21. package/dist/server/jsonrpc.js +73 -0
  22. package/dist/server/static.d.ts +10 -0
  23. package/dist/server/static.d.ts.map +1 -0
  24. package/dist/server/static.js +54 -0
  25. package/dist/server/websocket.d.ts +36 -0
  26. package/dist/server/websocket.d.ts.map +1 -0
  27. package/dist/server/websocket.js +153 -0
  28. package/dist/tracing/index.d.ts +3 -0
  29. package/dist/tracing/index.d.ts.map +1 -0
  30. package/dist/tracing/index.js +2 -0
  31. package/dist/tracing/store.d.ts +52 -0
  32. package/dist/tracing/store.d.ts.map +1 -0
  33. package/dist/tracing/store.js +101 -0
  34. package/dist/tracing/tracer.d.ts +28 -0
  35. package/dist/tracing/tracer.d.ts.map +1 -0
  36. package/dist/tracing/tracer.js +64 -0
  37. package/dist/types/adapter-options.d.ts +69 -0
  38. package/dist/types/adapter-options.d.ts.map +1 -0
  39. package/dist/types/adapter-options.js +4 -0
  40. package/dist/types/index.d.ts +193 -0
  41. package/dist/types/index.d.ts.map +1 -0
  42. package/dist/types/index.js +5 -0
  43. package/dist/types/logs.d.ts +14 -0
  44. package/dist/types/logs.d.ts.map +1 -0
  45. package/dist/types/logs.js +1 -0
  46. package/dist/utils/service-detection.d.ts +43 -0
  47. package/dist/utils/service-detection.d.ts.map +1 -0
  48. package/dist/utils/service-detection.js +103 -0
  49. package/dist/utils/zod-utils.d.ts +7 -0
  50. package/dist/utils/zod-utils.d.ts.map +1 -0
  51. package/dist/utils/zod-utils.js +145 -0
  52. package/package.json +20 -8
@@ -0,0 +1,101 @@
1
+ import { nanoid } from 'nanoid';
2
+ /**
3
+ * In-memory trace store
4
+ * Stores traces with automatic cleanup when max limit is reached
5
+ */
6
+ export class TraceStore {
7
+ traces = new Map();
8
+ maxTraces;
9
+ constructor(maxTraces = 1000) {
10
+ this.maxTraces = maxTraces;
11
+ }
12
+ /**
13
+ * Create a new trace
14
+ */
15
+ createTrace(method, path) {
16
+ const trace = {
17
+ id: nanoid(),
18
+ timestamp: Date.now(),
19
+ method,
20
+ path,
21
+ spans: [],
22
+ };
23
+ this.addTrace(trace);
24
+ return trace;
25
+ }
26
+ /**
27
+ * Add a trace to the store
28
+ */
29
+ addTrace(trace) {
30
+ // Remove oldest trace if we've hit the limit
31
+ if (this.traces.size >= this.maxTraces) {
32
+ const oldestKey = this.traces.keys().next().value;
33
+ if (oldestKey) {
34
+ this.traces.delete(oldestKey);
35
+ }
36
+ }
37
+ this.traces.set(trace.id, trace);
38
+ }
39
+ /**
40
+ * Add a span to a trace
41
+ */
42
+ addSpan(traceId, span) {
43
+ const trace = this.traces.get(traceId);
44
+ if (trace) {
45
+ trace.spans.push(span);
46
+ }
47
+ }
48
+ /**
49
+ * Complete a trace with final data
50
+ */
51
+ completeTrace(traceId, statusCode, duration) {
52
+ const trace = this.traces.get(traceId);
53
+ if (trace) {
54
+ trace.statusCode = statusCode;
55
+ trace.duration = duration;
56
+ }
57
+ }
58
+ /**
59
+ * Get a trace by ID
60
+ */
61
+ getTrace(id) {
62
+ return this.traces.get(id);
63
+ }
64
+ /**
65
+ * Get all traces (newest first)
66
+ */
67
+ getAllTraces() {
68
+ return Array.from(this.traces.values()).reverse();
69
+ }
70
+ /**
71
+ * Get traces with filters
72
+ */
73
+ getTraces(filter) {
74
+ let traces = this.getAllTraces();
75
+ if (filter?.method) {
76
+ traces = traces.filter((t) => t.method === filter.method);
77
+ }
78
+ if (filter?.statusCode) {
79
+ traces = traces.filter((t) => t.statusCode === filter.statusCode);
80
+ }
81
+ if (filter?.minDuration) {
82
+ traces = traces.filter((t) => (t.duration ?? 0) >= filter.minDuration);
83
+ }
84
+ if (filter?.limit) {
85
+ traces = traces.slice(0, filter.limit);
86
+ }
87
+ return traces;
88
+ }
89
+ /**
90
+ * Clear all traces
91
+ */
92
+ clear() {
93
+ this.traces.clear();
94
+ }
95
+ /**
96
+ * Get trace count
97
+ */
98
+ count() {
99
+ return this.traces.size;
100
+ }
101
+ }
@@ -0,0 +1,28 @@
1
+ import type { Span } from '../types/index';
2
+ /**
3
+ * Tracer for creating and managing spans
4
+ */
5
+ export declare class Tracer {
6
+ private activeSpans;
7
+ /**
8
+ * Start a new span
9
+ */
10
+ startSpan(name: string, traceId: string, parentId?: string): Span;
11
+ /**
12
+ * End a span
13
+ */
14
+ endSpan(spanId: string): Span | undefined;
15
+ /**
16
+ * Add an attribute to a span
17
+ */
18
+ setAttribute(spanId: string, key: string, value: unknown): void;
19
+ /**
20
+ * Add an event to a span
21
+ */
22
+ addEvent(spanId: string, name: string, attributes?: Record<string, unknown>): void;
23
+ /**
24
+ * Get an active span
25
+ */
26
+ getSpan(spanId: string): Span | undefined;
27
+ }
28
+ //# sourceMappingURL=tracer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../src/tracing/tracer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAa,MAAM,gBAAgB,CAAA;AAErD;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,WAAW,CAA0B;IAE7C;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAejE;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAUzC;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAO/D;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAYlF;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;CAG1C"}
@@ -0,0 +1,64 @@
1
+ import { nanoid } from 'nanoid';
2
+ /**
3
+ * Tracer for creating and managing spans
4
+ */
5
+ export class Tracer {
6
+ activeSpans = new Map();
7
+ /**
8
+ * Start a new span
9
+ */
10
+ startSpan(name, traceId, parentId) {
11
+ const span = {
12
+ id: nanoid(),
13
+ traceId,
14
+ parentId,
15
+ name,
16
+ startTime: Date.now(),
17
+ attributes: {},
18
+ events: [],
19
+ };
20
+ this.activeSpans.set(span.id, span);
21
+ return span;
22
+ }
23
+ /**
24
+ * End a span
25
+ */
26
+ endSpan(spanId) {
27
+ const span = this.activeSpans.get(spanId);
28
+ if (span) {
29
+ span.endTime = Date.now();
30
+ span.duration = span.endTime - span.startTime;
31
+ this.activeSpans.delete(spanId);
32
+ }
33
+ return span;
34
+ }
35
+ /**
36
+ * Add an attribute to a span
37
+ */
38
+ setAttribute(spanId, key, value) {
39
+ const span = this.activeSpans.get(spanId);
40
+ if (span && span.attributes) {
41
+ span.attributes[key] = value;
42
+ }
43
+ }
44
+ /**
45
+ * Add an event to a span
46
+ */
47
+ addEvent(spanId, name, attributes) {
48
+ const span = this.activeSpans.get(spanId);
49
+ if (span) {
50
+ const event = {
51
+ name,
52
+ timestamp: Date.now(),
53
+ attributes,
54
+ };
55
+ span.events?.push(event);
56
+ }
57
+ }
58
+ /**
59
+ * Get an active span
60
+ */
61
+ getSpan(spanId) {
62
+ return this.activeSpans.get(spanId);
63
+ }
64
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Unified adapter options and types
3
+ */
4
+ /**
5
+ * Service configuration
6
+ */
7
+ export interface ServiceConfig {
8
+ name?: string;
9
+ version?: string;
10
+ description?: string;
11
+ integrations?: IntegrationConfig;
12
+ }
13
+ /**
14
+ * Integration configuration
15
+ */
16
+ export interface IntegrationConfig {
17
+ database?: string;
18
+ redis?: string;
19
+ [key: string]: string | undefined;
20
+ }
21
+ /**
22
+ * Drizzle Studio configuration
23
+ */
24
+ export interface DrizzleConfig {
25
+ autoStart?: boolean;
26
+ port?: number;
27
+ }
28
+ /**
29
+ * Service definition for manual grouping
30
+ */
31
+ export interface ServiceDefinition {
32
+ name: string;
33
+ description?: string;
34
+ routes: string[];
35
+ }
36
+ /**
37
+ * Base adapter options (common to all adapters)
38
+ */
39
+ export interface BaseAdapterOptions {
40
+ enabled?: boolean;
41
+ port?: number;
42
+ maxTraces?: number;
43
+ logging?: boolean;
44
+ service?: ServiceConfig;
45
+ services?: ServiceDefinition[];
46
+ drizzle?: DrizzleConfig;
47
+ }
48
+ /**
49
+ * Hono adapter options
50
+ */
51
+ export interface VisionHonoOptions extends BaseAdapterOptions {
52
+ name?: string;
53
+ maxTraces?: number;
54
+ }
55
+ /**
56
+ * Express adapter options
57
+ */
58
+ export interface VisionExpressOptions extends BaseAdapterOptions {
59
+ maxLogs?: number;
60
+ cors?: boolean;
61
+ }
62
+ /**
63
+ * Fastify adapter options
64
+ */
65
+ export interface VisionFastifyOptions extends BaseAdapterOptions {
66
+ maxLogs?: number;
67
+ cors?: boolean;
68
+ }
69
+ //# sourceMappingURL=adapter-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-options.d.ts","sourceRoot":"","sources":["../../src/types/adapter-options.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,iBAAiB,CAAA;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC9B,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Unified adapter options and types
3
+ */
4
+ export {};
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Core types for Vision Dashboard
3
+ */
4
+ export interface JsonRpcRequest {
5
+ jsonrpc: '2.0';
6
+ method: string;
7
+ params?: unknown;
8
+ id?: string | number;
9
+ }
10
+ export interface JsonRpcResponse {
11
+ jsonrpc: '2.0';
12
+ result?: unknown;
13
+ error?: JsonRpcError;
14
+ id: string | number | null;
15
+ }
16
+ export interface JsonRpcError {
17
+ code: number;
18
+ message: string;
19
+ data?: unknown;
20
+ }
21
+ export interface JsonRpcNotification {
22
+ jsonrpc: '2.0';
23
+ method: string;
24
+ params?: unknown;
25
+ }
26
+ export interface Trace {
27
+ id: string;
28
+ timestamp: number;
29
+ method: string;
30
+ path: string;
31
+ statusCode?: number;
32
+ duration?: number;
33
+ spans: Span[];
34
+ metadata?: Record<string, unknown>;
35
+ }
36
+ export interface Span {
37
+ id: string;
38
+ traceId: string;
39
+ parentId?: string;
40
+ name: string;
41
+ startTime: number;
42
+ endTime?: number;
43
+ duration?: number;
44
+ attributes?: Record<string, unknown>;
45
+ events?: SpanEvent[];
46
+ }
47
+ export interface SpanEvent {
48
+ name: string;
49
+ timestamp: number;
50
+ attributes?: Record<string, unknown>;
51
+ }
52
+ export interface AppStatus {
53
+ name?: string;
54
+ version?: string;
55
+ description?: string;
56
+ environment?: string;
57
+ running: boolean;
58
+ pid?: number;
59
+ uptime?: number;
60
+ memory?: {
61
+ heapUsed: number;
62
+ heapTotal: number;
63
+ external: number;
64
+ };
65
+ metadata?: {
66
+ framework?: string;
67
+ integrations?: Record<string, string>;
68
+ drizzle?: {
69
+ detected: boolean;
70
+ configPath?: string;
71
+ studioUrl?: string;
72
+ autoStarted?: boolean;
73
+ };
74
+ [key: string]: unknown;
75
+ };
76
+ }
77
+ export interface RouteMetadata {
78
+ method: string;
79
+ path: string;
80
+ handler: string;
81
+ middleware?: string[];
82
+ params?: RouteParam[];
83
+ requestBody?: RequestBodySchema;
84
+ responseBody?: RequestBodySchema;
85
+ response?: RouteResponse;
86
+ schema?: any;
87
+ }
88
+ export interface RequestBodySchema {
89
+ template: string;
90
+ fields: SchemaField[];
91
+ }
92
+ export interface SchemaField {
93
+ name: string;
94
+ type: string;
95
+ description?: string;
96
+ required: boolean;
97
+ example?: any;
98
+ nested?: SchemaField[];
99
+ }
100
+ export interface ServiceGroup {
101
+ name: string;
102
+ description?: string;
103
+ routes: RouteMetadata[];
104
+ }
105
+ export interface RouteParam {
106
+ name: string;
107
+ type: string;
108
+ required: boolean;
109
+ description?: string;
110
+ }
111
+ export interface RouteResponse {
112
+ type: string;
113
+ description?: string;
114
+ schema?: unknown;
115
+ }
116
+ export type DashboardEvent = {
117
+ type: 'app.started';
118
+ data: AppStatus;
119
+ } | {
120
+ type: 'app.stopped';
121
+ data: {
122
+ pid: number;
123
+ };
124
+ } | {
125
+ type: 'trace.new';
126
+ data: Trace;
127
+ } | {
128
+ type: 'log.entry';
129
+ data: import('./logs').LogEntry;
130
+ } | {
131
+ type: 'log.stdout';
132
+ data: {
133
+ message: string;
134
+ timestamp: number;
135
+ };
136
+ } | {
137
+ type: 'log.stderr';
138
+ data: {
139
+ message: string;
140
+ timestamp: number;
141
+ };
142
+ } | {
143
+ type: 'compile.start';
144
+ data: {
145
+ timestamp: number;
146
+ };
147
+ } | {
148
+ type: 'compile.success';
149
+ data: {
150
+ timestamp: number;
151
+ duration: number;
152
+ };
153
+ } | {
154
+ type: 'compile.error';
155
+ data: {
156
+ message: string;
157
+ stack?: string;
158
+ };
159
+ };
160
+ export interface VisionServerOptions {
161
+ port?: number;
162
+ host?: string;
163
+ maxTraces?: number;
164
+ maxLogs?: number;
165
+ captureConsole?: boolean;
166
+ enableCors?: boolean;
167
+ }
168
+ export interface VisionAdapter {
169
+ name: string;
170
+ version: string;
171
+ getRoutes(): RouteMetadata[];
172
+ onRequest(handler: RequestHandler): void;
173
+ onResponse(handler: ResponseHandler): void;
174
+ }
175
+ export type RequestHandler = (req: AdapterRequest) => void | Promise<void>;
176
+ export type ResponseHandler = (req: AdapterRequest, res: AdapterResponse) => void | Promise<void>;
177
+ export interface AdapterRequest {
178
+ method: string;
179
+ path: string;
180
+ headers: Record<string, string>;
181
+ query?: Record<string, string>;
182
+ body?: unknown;
183
+ timestamp: number;
184
+ }
185
+ export interface AdapterResponse {
186
+ statusCode: number;
187
+ headers: Record<string, string>;
188
+ body?: unknown;
189
+ duration: number;
190
+ }
191
+ export * from './logs';
192
+ export * from './adapter-options';
193
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,KAAK,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,KAAK,CAAA;IACd,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,KA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AI,CAAC,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,cAAc,QAAQ,CAAA;AACtB,cAAc,mBAAmB,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Core types for Vision Dashboard
3
+ */
4
+ export * from './logs';
5
+ export * from './adapter-options';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Log entry types
3
+ */
4
+ export type LogLevel = 'log' | 'info' | 'warn' | 'error' | 'debug';
5
+ export interface LogEntry {
6
+ id: string;
7
+ timestamp: number;
8
+ level: LogLevel;
9
+ message: string;
10
+ args?: any[];
11
+ source?: string;
12
+ stack?: string;
13
+ }
14
+ //# sourceMappingURL=logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/types/logs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;AAElE,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,QAAQ,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Package info detected from package.json
3
+ */
4
+ export interface PackageInfo {
5
+ name: string;
6
+ version: string;
7
+ }
8
+ /**
9
+ * Integration configuration
10
+ */
11
+ export interface IntegrationConfig {
12
+ database?: string;
13
+ redis?: string;
14
+ [key: string]: string | undefined;
15
+ }
16
+ /**
17
+ * Drizzle detection result
18
+ */
19
+ export interface DrizzleInfo {
20
+ detected: boolean;
21
+ configPath?: string;
22
+ }
23
+ /**
24
+ * Auto-detect package.json for service name and version
25
+ */
26
+ export declare function autoDetectPackageInfo(): PackageInfo;
27
+ /**
28
+ * Auto-detect integrations from environment variables
29
+ */
30
+ export declare function autoDetectIntegrations(): IntegrationConfig;
31
+ /**
32
+ * Detect Drizzle configuration
33
+ */
34
+ export declare function detectDrizzle(): DrizzleInfo;
35
+ /**
36
+ * Start Drizzle Studio
37
+ */
38
+ export declare function startDrizzleStudio(port?: number): boolean;
39
+ /**
40
+ * Stop Drizzle Studio
41
+ */
42
+ export declare function stopDrizzleStudio(): void;
43
+ //# sourceMappingURL=service-detection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-detection.d.ts","sourceRoot":"","sources":["../../src/utils/service-detection.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,WAAW,CAcnD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,iBAAiB,CAsB1D;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,WAAW,CAc3C;AAID;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,GAAE,MAAa,GAAG,OAAO,CAgC/D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC"}
@@ -0,0 +1,103 @@
1
+ import { readFileSync, existsSync } from 'fs';
2
+ import { join } from 'path';
3
+ import { spawn } from 'child_process';
4
+ /**
5
+ * Auto-detect package.json for service name and version
6
+ */
7
+ export function autoDetectPackageInfo() {
8
+ try {
9
+ const pkgPath = join(process.cwd(), 'package.json');
10
+ if (existsSync(pkgPath)) {
11
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
12
+ return {
13
+ name: pkg.name || 'unknown',
14
+ version: pkg.version || '0.0.0',
15
+ };
16
+ }
17
+ }
18
+ catch (error) {
19
+ // Ignore errors
20
+ }
21
+ return { name: 'unknown', version: '0.0.0' };
22
+ }
23
+ /**
24
+ * Auto-detect integrations from environment variables
25
+ */
26
+ export function autoDetectIntegrations() {
27
+ const integrations = {};
28
+ // Common database env vars
29
+ const dbKeys = ['DATABASE_URL', 'DB_URL', 'POSTGRES_URL', 'MYSQL_URL', 'MONGODB_URL'];
30
+ for (const key of dbKeys) {
31
+ if (process.env[key]) {
32
+ integrations.database = process.env[key];
33
+ break;
34
+ }
35
+ }
36
+ // Common redis env vars
37
+ const redisKeys = ['REDIS_URL', 'CACHE_URL', 'UPSTASH_REDIS_URL'];
38
+ for (const key of redisKeys) {
39
+ if (process.env[key]) {
40
+ integrations.redis = process.env[key];
41
+ break;
42
+ }
43
+ }
44
+ return integrations;
45
+ }
46
+ /**
47
+ * Detect Drizzle configuration
48
+ */
49
+ export function detectDrizzle() {
50
+ const possiblePaths = [
51
+ 'drizzle.config.ts',
52
+ 'drizzle.config.js',
53
+ 'drizzle.config.mjs',
54
+ ];
55
+ for (const path of possiblePaths) {
56
+ if (existsSync(path)) {
57
+ return { detected: true, configPath: path };
58
+ }
59
+ }
60
+ return { detected: false };
61
+ }
62
+ let drizzleStudioProcess = null;
63
+ /**
64
+ * Start Drizzle Studio
65
+ */
66
+ export function startDrizzleStudio(port = 4983) {
67
+ const drizzleInfo = detectDrizzle();
68
+ if (!drizzleInfo.detected) {
69
+ console.warn('⚠️ Drizzle config not found. Skipping Drizzle Studio auto-start.');
70
+ return false;
71
+ }
72
+ console.log(`🗄️ Starting Drizzle Studio on port ${port}...`);
73
+ try {
74
+ drizzleStudioProcess = spawn('npx', ['drizzle-kit', 'studio', '--port', String(port), '--host', '0.0.0.0'], {
75
+ stdio: 'inherit',
76
+ detached: false,
77
+ });
78
+ drizzleStudioProcess.on('error', (error) => {
79
+ console.error('❌ Failed to start Drizzle Studio:', error.message);
80
+ });
81
+ drizzleStudioProcess.on('exit', (code) => {
82
+ if (code !== 0 && code !== null) {
83
+ console.error(`❌ Drizzle Studio exited with code ${code}`);
84
+ }
85
+ });
86
+ console.log(`✅ Drizzle Studio started`);
87
+ return true;
88
+ }
89
+ catch (error) {
90
+ console.error('❌ Failed to start Drizzle Studio:', error);
91
+ return false;
92
+ }
93
+ }
94
+ /**
95
+ * Stop Drizzle Studio
96
+ */
97
+ export function stopDrizzleStudio() {
98
+ if (drizzleStudioProcess) {
99
+ drizzleStudioProcess.kill();
100
+ drizzleStudioProcess = null;
101
+ console.log('🛑 Drizzle Studio stopped');
102
+ }
103
+ }
@@ -0,0 +1,7 @@
1
+ import type { ZodType } from 'zod';
2
+ import type { RequestBodySchema } from '../types/index';
3
+ /**
4
+ * Generate JSON template with comments from Zod schema
5
+ */
6
+ export declare function generateZodTemplate(schema: ZodType): RequestBodySchema | undefined;
7
+ //# sourceMappingURL=zod-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod-utils.d.ts","sourceRoot":"","sources":["../../src/utils/zod-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,KAAK,CAAA;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAe,MAAM,gBAAgB,CAAA;AAEpE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,iBAAiB,GAAG,SAAS,CAalF"}