@geenius/tools 0.1.0 → 0.3.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.
Files changed (177) hide show
  1. package/package.json +62 -3
  2. package/packages/convex/shared/README.md +1 -1
  3. package/packages/devtools/dist/index.d.ts +204 -0
  4. package/packages/devtools/dist/index.js +186 -0
  5. package/packages/devtools/dist/index.js.map +1 -0
  6. package/packages/devtools/react/README.md +1 -1
  7. package/packages/devtools/solidjs/README.md +1 -1
  8. package/packages/devtools/solidjs/dist/index.js +1830 -0
  9. package/packages/devtools/solidjs/dist/index.js.map +1 -0
  10. package/packages/env/dist/index.d.ts +151 -0
  11. package/packages/env/dist/index.js +93 -0
  12. package/packages/env/dist/index.js.map +1 -0
  13. package/packages/errors/dist/index.d.ts +177 -0
  14. package/packages/errors/dist/index.js +187 -0
  15. package/packages/errors/dist/index.js.map +1 -0
  16. package/packages/errors/react/README.md +1 -1
  17. package/packages/errors/solidjs/README.md +1 -1
  18. package/packages/logger/dist/index.d.ts +171 -0
  19. package/packages/logger/dist/index.js +216 -0
  20. package/packages/logger/dist/index.js.map +1 -0
  21. package/packages/logger/react/README.md +1 -1
  22. package/packages/logger/solidjs/README.md +1 -1
  23. package/packages/perf/dist/index.d.ts +168 -0
  24. package/packages/perf/dist/index.js +265 -0
  25. package/packages/perf/dist/index.js.map +1 -0
  26. package/packages/perf/react/README.md +1 -1
  27. package/packages/perf/solidjs/README.md +1 -1
  28. package/packages/shared/dist/index.d.ts +253 -0
  29. package/packages/shared/dist/index.js +278 -0
  30. package/packages/shared/dist/index.js.map +1 -0
  31. package/.changeset/config.json +0 -11
  32. package/.env.example +0 -2
  33. package/.github/CODEOWNERS +0 -1
  34. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -16
  35. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -11
  36. package/.github/PULL_REQUEST_TEMPLATE.md +0 -10
  37. package/.github/dependabot.yml +0 -11
  38. package/.github/workflows/ci.yml +0 -23
  39. package/.github/workflows/release.yml +0 -29
  40. package/.node-version +0 -1
  41. package/.nvmrc +0 -1
  42. package/.prettierrc +0 -7
  43. package/.project/ACCOUNT.yaml +0 -4
  44. package/.project/IDEAS.yaml +0 -7
  45. package/.project/PROJECT.yaml +0 -11
  46. package/.project/ROADMAP.yaml +0 -15
  47. package/CODE_OF_CONDUCT.md +0 -26
  48. package/CONTRIBUTING.md +0 -69
  49. package/SECURITY.md +0 -18
  50. package/SUPPORT.md +0 -14
  51. package/packages/convex/shared/package.json +0 -42
  52. package/packages/convex/shared/src/audit/index.ts +0 -5
  53. package/packages/convex/shared/src/audit/presets.ts +0 -165
  54. package/packages/convex/shared/src/audit/schema.ts +0 -85
  55. package/packages/convex/shared/src/audit/write.ts +0 -102
  56. package/packages/convex/shared/src/extract.ts +0 -75
  57. package/packages/convex/shared/src/index.ts +0 -41
  58. package/packages/convex/shared/src/messages.ts +0 -45
  59. package/packages/convex/shared/src/security.ts +0 -112
  60. package/packages/convex/shared/src/throw.ts +0 -184
  61. package/packages/convex/shared/src/types.ts +0 -57
  62. package/packages/convex/shared/src/utils.ts +0 -58
  63. package/packages/convex/shared/tsconfig.json +0 -28
  64. package/packages/convex/shared/tsup.config.ts +0 -12
  65. package/packages/devtools/package.json +0 -27
  66. package/packages/devtools/react/package.json +0 -53
  67. package/packages/devtools/react/src/components/DesignPreview.tsx +0 -59
  68. package/packages/devtools/react/src/components/DesignSwitcherDropdown.tsx +0 -99
  69. package/packages/devtools/react/src/components/DevSidebar.tsx +0 -247
  70. package/packages/devtools/react/src/components/DevToolbar.tsx +0 -242
  71. package/packages/devtools/react/src/components/GitHubIssueDialog.tsx +0 -402
  72. package/packages/devtools/react/src/components/InspectorOverlay.tsx +0 -312
  73. package/packages/devtools/react/src/components/PageLoadWaterfall.tsx +0 -144
  74. package/packages/devtools/react/src/components/PerformancePanel.tsx +0 -330
  75. package/packages/devtools/react/src/context/DevModeContext.tsx +0 -226
  76. package/packages/devtools/react/src/context/PerformanceContext.tsx +0 -143
  77. package/packages/devtools/react/src/data/designs.ts +0 -13
  78. package/packages/devtools/react/src/hooks/useGitHubLabels.ts +0 -47
  79. package/packages/devtools/react/src/hooks/useVirtualList.ts +0 -124
  80. package/packages/devtools/react/src/index.ts +0 -77
  81. package/packages/devtools/react/src/panels/ConvexSpy.tsx +0 -130
  82. package/packages/devtools/react/src/panels/DatabaseSeeder.tsx +0 -116
  83. package/packages/devtools/react/src/panels/DevModePhase2.tsx +0 -191
  84. package/packages/devtools/react/src/panels/DevModePhase3.tsx +0 -234
  85. package/packages/devtools/react/src/panels/FeatureFlagsToggle.tsx +0 -104
  86. package/packages/devtools/react/src/panels/QuickRouteJump.tsx +0 -152
  87. package/packages/devtools/react/src/services/github-service.ts +0 -247
  88. package/packages/devtools/react/tsconfig.json +0 -31
  89. package/packages/devtools/react/tsup.config.ts +0 -18
  90. package/packages/devtools/solidjs/package.json +0 -49
  91. package/packages/devtools/solidjs/src/components/DesignPreview.tsx +0 -51
  92. package/packages/devtools/solidjs/src/components/DesignSwitcherDropdown.tsx +0 -95
  93. package/packages/devtools/solidjs/src/components/DevSidebar.tsx +0 -247
  94. package/packages/devtools/solidjs/src/components/DevToolbar.tsx +0 -242
  95. package/packages/devtools/solidjs/src/components/GitHubIssueDialog.tsx +0 -400
  96. package/packages/devtools/solidjs/src/components/InspectorOverlay.tsx +0 -311
  97. package/packages/devtools/solidjs/src/components/PageLoadWaterfall.tsx +0 -144
  98. package/packages/devtools/solidjs/src/components/PerformancePanel.tsx +0 -330
  99. package/packages/devtools/solidjs/src/context/DevModeContext.tsx +0 -216
  100. package/packages/devtools/solidjs/src/context/PerformanceContext.tsx +0 -135
  101. package/packages/devtools/solidjs/src/data/designs.ts +0 -13
  102. package/packages/devtools/solidjs/src/hooks/createGitHubLabels.ts +0 -47
  103. package/packages/devtools/solidjs/src/index.ts +0 -64
  104. package/packages/devtools/solidjs/src/services/github-service.ts +0 -247
  105. package/packages/devtools/solidjs/tsconfig.json +0 -21
  106. package/packages/devtools/src/index.ts +0 -377
  107. package/packages/devtools/tsup.config.ts +0 -12
  108. package/packages/env/package.json +0 -30
  109. package/packages/env/src/index.ts +0 -264
  110. package/packages/env/tsup.config.ts +0 -12
  111. package/packages/errors/package.json +0 -27
  112. package/packages/errors/react/package.json +0 -72
  113. package/packages/errors/react/src/analytics.ts +0 -16
  114. package/packages/errors/react/src/components/ErrorBoundary.tsx +0 -248
  115. package/packages/errors/react/src/components/ErrorDisplay.tsx +0 -328
  116. package/packages/errors/react/src/components/ValidationErrors.tsx +0 -102
  117. package/packages/errors/react/src/config.ts +0 -199
  118. package/packages/errors/react/src/constants.ts +0 -74
  119. package/packages/errors/react/src/hooks/useErrorBoundary.ts +0 -92
  120. package/packages/errors/react/src/hooks/useErrorHandler.ts +0 -87
  121. package/packages/errors/react/src/index.ts +0 -96
  122. package/packages/errors/react/src/types.ts +0 -102
  123. package/packages/errors/react/src/utils/errorMessages.ts +0 -35
  124. package/packages/errors/react/src/utils/errorPolicy.ts +0 -139
  125. package/packages/errors/react/src/utils/extractAppError.ts +0 -174
  126. package/packages/errors/react/src/utils/formatError.ts +0 -112
  127. package/packages/errors/react/tsconfig.json +0 -25
  128. package/packages/errors/react/tsup.config.ts +0 -24
  129. package/packages/errors/solidjs/package.json +0 -46
  130. package/packages/errors/solidjs/src/components/ErrorDisplay.tsx +0 -179
  131. package/packages/errors/solidjs/src/config.ts +0 -98
  132. package/packages/errors/solidjs/src/hooks/createErrorHandler.ts +0 -107
  133. package/packages/errors/solidjs/src/index.ts +0 -61
  134. package/packages/errors/solidjs/src/types.ts +0 -34
  135. package/packages/errors/solidjs/src/utils/errorPolicy.ts +0 -56
  136. package/packages/errors/solidjs/src/utils/extractAppError.ts +0 -94
  137. package/packages/errors/solidjs/src/utils/formatError.ts +0 -33
  138. package/packages/errors/solidjs/tsconfig.json +0 -26
  139. package/packages/errors/solidjs/tsup.config.ts +0 -21
  140. package/packages/errors/src/index.ts +0 -320
  141. package/packages/errors/tsup.config.ts +0 -12
  142. package/packages/logger/package.json +0 -27
  143. package/packages/logger/react/package.json +0 -46
  144. package/packages/logger/react/src/index.ts +0 -4
  145. package/packages/logger/react/src/useMetrics.ts +0 -42
  146. package/packages/logger/react/src/usePerformanceLog.ts +0 -61
  147. package/packages/logger/react/tsconfig.json +0 -31
  148. package/packages/logger/react/tsup.config.ts +0 -12
  149. package/packages/logger/solidjs/package.json +0 -45
  150. package/packages/logger/solidjs/src/createMetrics.ts +0 -37
  151. package/packages/logger/solidjs/src/createPerformanceLog.ts +0 -58
  152. package/packages/logger/solidjs/src/index.ts +0 -4
  153. package/packages/logger/solidjs/tsconfig.json +0 -32
  154. package/packages/logger/solidjs/tsup.config.ts +0 -12
  155. package/packages/logger/src/index.ts +0 -363
  156. package/packages/logger/tsup.config.ts +0 -12
  157. package/packages/perf/package.json +0 -27
  158. package/packages/perf/react/package.json +0 -59
  159. package/packages/perf/react/src/components/PerformanceDashboard.tsx +0 -257
  160. package/packages/perf/react/src/hooks/useMonitoredQuery.ts +0 -89
  161. package/packages/perf/react/src/hooks/usePerformanceMetrics.ts +0 -78
  162. package/packages/perf/react/src/index.ts +0 -33
  163. package/packages/perf/react/src/services/PerformanceMonitor.ts +0 -313
  164. package/packages/perf/react/src/types.ts +0 -77
  165. package/packages/perf/react/tsconfig.json +0 -25
  166. package/packages/perf/react/tsup.config.ts +0 -19
  167. package/packages/perf/solidjs/package.json +0 -41
  168. package/packages/perf/solidjs/src/components/PerformanceDashboard.tsx +0 -207
  169. package/packages/perf/solidjs/src/hooks/createPerformanceMetrics.ts +0 -73
  170. package/packages/perf/solidjs/src/index.ts +0 -31
  171. package/packages/perf/solidjs/src/services/PerformanceMonitor.ts +0 -134
  172. package/packages/perf/solidjs/src/types.ts +0 -78
  173. package/packages/perf/solidjs/tsconfig.json +0 -26
  174. package/packages/perf/solidjs/tsup.config.ts +0 -14
  175. package/packages/perf/src/index.ts +0 -410
  176. package/packages/perf/tsup.config.ts +0 -12
  177. package/pnpm-workspace.yaml +0 -2
@@ -1,410 +0,0 @@
1
- /**
2
- * @geenius-tools/perf — Performance monitoring
3
- *
4
- * Provides utilities for measuring and tracking performance metrics.
5
- * Supports timing, memory profiling, and metric collection.
6
- */
7
-
8
- /**
9
- * Performance metric entry
10
- */
11
- export interface PerfMetric {
12
- /** Metric name */
13
- name: string
14
- /** Duration in milliseconds */
15
- duration: number
16
- /** When metric was recorded */
17
- timestamp: Date
18
- /** Metric tags */
19
- tags?: Record<string, string>
20
- /** Additional metadata */
21
- metadata?: Record<string, unknown>
22
- }
23
-
24
- /**
25
- * Performance monitor callback
26
- */
27
- export type PerfCallback = (metric: PerfMetric) => void | Promise<void>
28
-
29
- /**
30
- * Simple timer for measuring duration
31
- *
32
- * @example
33
- * ```ts
34
- * const timer = new Timer()
35
- * // ... do work ...
36
- * console.log(timer.elapsed()) // duration in ms
37
- * ```
38
- */
39
- export class Timer {
40
- private startTime: number
41
-
42
- constructor() {
43
- this.startTime = this.now()
44
- }
45
-
46
- /**
47
- * Gets elapsed time in milliseconds
48
- */
49
- elapsed(): number {
50
- return this.now() - this.startTime
51
- }
52
-
53
- /**
54
- * Resets timer
55
- */
56
- reset() {
57
- this.startTime = this.now()
58
- }
59
-
60
- /**
61
- * Gets current time in milliseconds
62
- */
63
- private now(): number {
64
- if (typeof performance !== 'undefined' && performance.now) {
65
- return performance.now()
66
- }
67
- return Date.now()
68
- }
69
- }
70
-
71
- /**
72
- * Performance tracker for named metrics
73
- *
74
- * @example
75
- * ```ts
76
- * const perf = new PerfTracker()
77
- * perf.mark('fetch-start')
78
- * // ... fetch data ...
79
- * perf.measure('api-call', 'fetch-start')
80
- * ```
81
- */
82
- export class PerfTracker {
83
- private marks: Map<string, number> = new Map()
84
- private metrics: PerfMetric[] = []
85
- private callbacks: PerfCallback[] = []
86
-
87
- /**
88
- * Records a performance mark at current time
89
- */
90
- mark(name: string, tags?: Record<string, string>) {
91
- const now = typeof performance !== 'undefined' && performance.now
92
- ? performance.now()
93
- : Date.now()
94
-
95
- this.marks.set(name, now)
96
- }
97
-
98
- /**
99
- * Measures duration from mark to now
100
- */
101
- measure(
102
- name: string,
103
- startMark: string,
104
- endMark?: string,
105
- metadata?: Record<string, unknown>
106
- ): number {
107
- const startTime = this.marks.get(startMark)
108
- if (startTime === undefined) {
109
- console.warn(`Mark "${startMark}" not found`)
110
- return 0
111
- }
112
-
113
- let endTime: number
114
- if (endMark) {
115
- endTime = this.marks.get(endMark) ?? this.now()
116
- } else {
117
- endTime = this.now()
118
- }
119
-
120
- const duration = endTime - startTime
121
-
122
- const metric: PerfMetric = {
123
- name,
124
- duration,
125
- timestamp: new Date(),
126
- metadata,
127
- }
128
-
129
- this.metrics.push(metric)
130
- this.emit(metric)
131
-
132
- return duration
133
- }
134
-
135
- /**
136
- * Times a function execution
137
- *
138
- * @example
139
- * ```ts
140
- * const duration = await perf.time('fetch', async () => {
141
- * return fetch('/api/data')
142
- * })
143
- * ```
144
- */
145
- async time<T>(
146
- name: string,
147
- fn: () => T | Promise<T>,
148
- metadata?: Record<string, unknown>
149
- ): Promise<{ duration: number; result: T }> {
150
- const timer = new Timer()
151
-
152
- try {
153
- const result = await Promise.resolve(fn())
154
- const duration = timer.elapsed()
155
-
156
- const metric: PerfMetric = {
157
- name,
158
- duration,
159
- timestamp: new Date(),
160
- metadata,
161
- }
162
-
163
- this.metrics.push(metric)
164
- this.emit(metric)
165
-
166
- return { duration, result }
167
- } catch (error) {
168
- const duration = timer.elapsed()
169
- const metric: PerfMetric = {
170
- name,
171
- duration,
172
- timestamp: new Date(),
173
- metadata: {
174
- ...metadata,
175
- error: error instanceof Error ? error.message : String(error),
176
- },
177
- }
178
-
179
- this.metrics.push(metric)
180
- this.emit(metric)
181
-
182
- throw error
183
- }
184
- }
185
-
186
- /**
187
- * Times a sync function execution
188
- */
189
- timeSync<T>(
190
- name: string,
191
- fn: () => T,
192
- metadata?: Record<string, unknown>
193
- ): { duration: number; result: T } {
194
- const timer = new Timer()
195
-
196
- try {
197
- const result = fn()
198
- const duration = timer.elapsed()
199
-
200
- const metric: PerfMetric = {
201
- name,
202
- duration,
203
- timestamp: new Date(),
204
- metadata,
205
- }
206
-
207
- this.metrics.push(metric)
208
- this.emit(metric)
209
-
210
- return { duration, result }
211
- } catch (error) {
212
- const duration = timer.elapsed()
213
- const metric: PerfMetric = {
214
- name,
215
- duration,
216
- timestamp: new Date(),
217
- metadata: {
218
- ...metadata,
219
- error: error instanceof Error ? error.message : String(error),
220
- },
221
- }
222
-
223
- this.metrics.push(metric)
224
- this.emit(metric)
225
-
226
- throw error
227
- }
228
- }
229
-
230
- /**
231
- * Registers callback for metric events
232
- */
233
- on(callback: PerfCallback) {
234
- this.callbacks.push(callback)
235
- return () => {
236
- this.callbacks = this.callbacks.filter((cb) => cb !== callback)
237
- }
238
- }
239
-
240
- /**
241
- * Emits metric to registered callbacks
242
- */
243
- private emit(metric: PerfMetric) {
244
- for (const callback of this.callbacks) {
245
- try {
246
- void callback(metric)
247
- } catch {
248
- // Silently fail to prevent perf tracking from breaking app
249
- }
250
- }
251
- }
252
-
253
- /**
254
- * Gets all recorded metrics
255
- */
256
- getMetrics(): PerfMetric[] {
257
- return [...this.metrics]
258
- }
259
-
260
- /**
261
- * Gets metrics by name
262
- */
263
- getByName(name: string): PerfMetric[] {
264
- return this.metrics.filter((m) => m.name === name)
265
- }
266
-
267
- /**
268
- * Gets average duration for named metric
269
- */
270
- getAverage(name: string): number {
271
- const metrics = this.getByName(name)
272
- if (metrics.length === 0) return 0
273
-
274
- const total = metrics.reduce((sum, m) => sum + m.duration, 0)
275
- return total / metrics.length
276
- }
277
-
278
- /**
279
- * Clears all metrics
280
- */
281
- clear() {
282
- this.marks.clear()
283
- this.metrics = []
284
- }
285
-
286
- /**
287
- * Gets current time in ms
288
- */
289
- private now(): number {
290
- if (typeof performance !== 'undefined' && performance.now) {
291
- return performance.now()
292
- }
293
- return Date.now()
294
- }
295
- }
296
-
297
- /**
298
- * Creates a performance tracker instance
299
- *
300
- * @example
301
- * ```ts
302
- * const perf = createPerfTracker()
303
- * await perf.time('api-call', () => fetch('/api/data'))
304
- * ```
305
- */
306
- export function createPerfTracker(): PerfTracker {
307
- return new PerfTracker()
308
- }
309
-
310
- /**
311
- * Measures memory usage (Node.js only)
312
- *
313
- * @returns Memory usage in bytes
314
- */
315
- export function getMemoryUsage(): {
316
- heapUsed: number
317
- heapTotal: number
318
- external: number
319
- } {
320
- if (typeof process !== 'undefined' && process.memoryUsage) {
321
- const usage = process.memoryUsage()
322
- return {
323
- heapUsed: usage.heapUsed,
324
- heapTotal: usage.heapTotal,
325
- external: usage.external,
326
- }
327
- }
328
-
329
- return {
330
- heapUsed: 0,
331
- heapTotal: 0,
332
- external: 0,
333
- }
334
- }
335
-
336
- /**
337
- * Decorator for automatic function timing
338
- *
339
- * @example
340
- * ```ts
341
- * class DataService {
342
- * @Timed()
343
- * async fetchData() {
344
- * return fetch('/api/data')
345
- * }
346
- * }
347
- * ```
348
- */
349
- export function Timed(name?: string): MethodDecorator {
350
- return function (target, prop, descriptor) {
351
- if (!descriptor || typeof descriptor.value !== 'function') {
352
- return descriptor
353
- }
354
-
355
- const originalFn = descriptor.value
356
- const metricName = name ?? String(prop)
357
- const tracker = createPerfTracker()
358
-
359
- descriptor.value = async function (...args: any[]) {
360
- const { duration, result } = await tracker.time(metricName, () =>
361
- originalFn.apply(this, args)
362
- )
363
- return result
364
- }
365
-
366
- return descriptor
367
- }
368
- }
369
-
370
- /**
371
- * Debounce function with performance tracking
372
- */
373
- export function debounce<T extends (...args: any[]) => any>(
374
- fn: T,
375
- wait: number,
376
- name?: string
377
- ): T {
378
- let timeout: NodeJS.Timeout | null = null
379
- const tracker = createPerfTracker()
380
-
381
- return ((...args: any[]) => {
382
- if (timeout) {
383
- clearTimeout(timeout)
384
- }
385
-
386
- timeout = setTimeout(() => {
387
- void tracker.timeSync(name ?? fn.name, () => fn(...args))
388
- }, wait)
389
- }) as T
390
- }
391
-
392
- /**
393
- * Throttle function with performance tracking
394
- */
395
- export function throttle<T extends (...args: any[]) => any>(
396
- fn: T,
397
- wait: number,
398
- name?: string
399
- ): T {
400
- let last = 0
401
- const tracker = createPerfTracker()
402
-
403
- return ((...args: any[]) => {
404
- const now = Date.now()
405
- if (now - last >= wait) {
406
- last = now
407
- void tracker.timeSync(name ?? fn.name, () => fn(...args))
408
- }
409
- }) as T
410
- }
@@ -1,12 +0,0 @@
1
- import { defineConfig } from 'tsup'
2
-
3
- export default defineConfig({
4
- entry: {
5
- index: 'src/index.ts',
6
- },
7
- format: ['esm'],
8
- dts: true,
9
- clean: true,
10
- sourcemap: true,
11
- })
12
-
@@ -1,2 +0,0 @@
1
- packages:
2
- - 'packages/*/*'