@ebowwa/codespaces-types 1.0.0 → 1.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.
Files changed (67) hide show
  1. package/{dist/types → compile}/index.js +41 -15
  2. package/compile/index.ts +553 -0
  3. package/compile/resources.js +116 -0
  4. package/compile/resources.ts +157 -0
  5. package/compile/schemas/resources.js +127 -0
  6. package/compile/schemas/resources.ts +144 -0
  7. package/{dist/types → compile}/terminal-websocket.js +4 -1
  8. package/compile/terminal-websocket.ts +133 -0
  9. package/compile/time.js +30 -0
  10. package/compile/time.ts +32 -0
  11. package/{dist/types → compile}/user/distributions.js +0 -1
  12. package/{dist/types/user/distributions.d.ts → compile/user/distributions.ts} +0 -1
  13. package/{dist/types → compile}/validation.js +23 -17
  14. package/compile/validation.ts +98 -0
  15. package/index.js +21 -0
  16. package/index.ts +5 -0
  17. package/package.json +38 -45
  18. package/runtime/ai.js +505 -0
  19. package/runtime/ai.ts +501 -0
  20. package/runtime/api.js +677 -0
  21. package/runtime/api.ts +857 -0
  22. package/runtime/database.js +94 -0
  23. package/runtime/database.ts +107 -0
  24. package/runtime/env.js +63 -0
  25. package/runtime/env.ts +68 -0
  26. package/{dist/runtime → runtime}/glm.js +7 -4
  27. package/runtime/glm.ts +36 -0
  28. package/runtime/index.js +28 -0
  29. package/{dist/runtime/index.js → runtime/index.ts} +1 -0
  30. package/runtime/ssh.js +47 -0
  31. package/runtime/ssh.ts +58 -0
  32. package/README.md +0 -65
  33. package/dist/runtime/ai.d.ts +0 -1336
  34. package/dist/runtime/ai.d.ts.map +0 -1
  35. package/dist/runtime/ai.js +0 -416
  36. package/dist/runtime/api.d.ts +0 -1304
  37. package/dist/runtime/api.d.ts.map +0 -1
  38. package/dist/runtime/api.js +0 -673
  39. package/dist/runtime/database.d.ts +0 -376
  40. package/dist/runtime/database.d.ts.map +0 -1
  41. package/dist/runtime/database.js +0 -91
  42. package/dist/runtime/env.d.ts +0 -121
  43. package/dist/runtime/env.d.ts.map +0 -1
  44. package/dist/runtime/env.js +0 -54
  45. package/dist/runtime/glm.d.ts +0 -17
  46. package/dist/runtime/glm.d.ts.map +0 -1
  47. package/dist/runtime/index.d.ts +0 -13
  48. package/dist/runtime/index.d.ts.map +0 -1
  49. package/dist/runtime/ssh.d.ts +0 -111
  50. package/dist/runtime/ssh.d.ts.map +0 -1
  51. package/dist/runtime/ssh.js +0 -44
  52. package/dist/types/index.d.ts +0 -437
  53. package/dist/types/index.d.ts.map +0 -1
  54. package/dist/types/resources.d.ts +0 -69
  55. package/dist/types/resources.d.ts.map +0 -1
  56. package/dist/types/resources.js +0 -113
  57. package/dist/types/schemas/resources.d.ts +0 -166
  58. package/dist/types/schemas/resources.d.ts.map +0 -1
  59. package/dist/types/schemas/resources.js +0 -123
  60. package/dist/types/terminal-websocket.d.ts +0 -109
  61. package/dist/types/terminal-websocket.d.ts.map +0 -1
  62. package/dist/types/time.d.ts +0 -7
  63. package/dist/types/time.d.ts.map +0 -1
  64. package/dist/types/time.js +0 -27
  65. package/dist/types/user/distributions.d.ts.map +0 -1
  66. package/dist/types/validation.d.ts +0 -44
  67. package/dist/types/validation.d.ts.map +0 -1
@@ -1,113 +0,0 @@
1
- /**
2
- * Shared resource parsing utilities
3
- */
4
- /**
5
- * Parse CPU usage from raw output with validation
6
- */
7
- export function parseCPU(raw) {
8
- if (!raw || typeof raw !== 'string') {
9
- return 0;
10
- }
11
- const num = parseFloat(raw);
12
- if (isNaN(num)) {
13
- console.warn('Invalid CPU value:', raw);
14
- return 0;
15
- }
16
- return Math.round(num * 10) / 10;
17
- }
18
- /**
19
- * Parse memory usage from raw output with validation
20
- * Returns: { percent, used, total }
21
- */
22
- export function parseMemory(raw) {
23
- if (!raw || typeof raw !== 'string') {
24
- return { percent: 0, used: '0 GB', total: '0 GB' };
25
- }
26
- const parts = raw.split(/\s+/);
27
- if (parts.length < 3) {
28
- console.warn('Invalid memory output:', raw);
29
- return { percent: 0, used: '0 GB', total: '0 GB' };
30
- }
31
- return {
32
- percent: Math.round(parseFloat(parts[0]) * 10) / 10,
33
- used: `${(parseFloat(parts[1]) || 0).toFixed(1)} GB`,
34
- total: `${(parseFloat(parts[2]) || 0).toFixed(1)} GB`,
35
- };
36
- }
37
- /**
38
- * Parse disk usage from raw output with validation
39
- * Handles formats like "4% 2.8G 75G" -> adds space before unit
40
- */
41
- export function parseDisk(raw) {
42
- if (!raw || typeof raw !== 'string') {
43
- return { percent: 0, used: '0 GB', total: '0 GB' };
44
- }
45
- const parts = raw.split(/\s+/);
46
- const percent = parseFloat(parts[0]?.replace('%', '') || '0') || 0;
47
- // Format "2.8G" -> "2.8 GB" for consistency
48
- const formatSize = (size) => {
49
- if (size.endsWith('G') || size.endsWith('M') || size.endsWith('K')) {
50
- return size.replace(/([GMK])$/, ' $1B');
51
- }
52
- return size;
53
- };
54
- return {
55
- percent: Math.round(percent),
56
- used: formatSize(parts[1] || '0 GB'),
57
- total: formatSize(parts[2] || '0 GB'),
58
- };
59
- }
60
- /**
61
- * Parse GPU usage from raw output with validation
62
- * Returns undefined if no GPU present
63
- */
64
- export function parseGPU(raw) {
65
- if (!raw || raw === 'NOGPU' || raw === '0' || !raw.trim()) {
66
- return undefined;
67
- }
68
- const parts = raw.split(',').map(s => s.trim());
69
- if (parts.length < 3) {
70
- console.warn('Invalid GPU output:', raw);
71
- return undefined;
72
- }
73
- // nvidia-smi returns values in MB, convert to GB
74
- return {
75
- gpuPercent: parseFloat(parts[0]) || 0,
76
- gpuMemoryUsed: `${(parseFloat(parts[1]) / 1024).toFixed(1)} GB`,
77
- gpuMemoryTotal: `${(parseFloat(parts[2]) / 1024).toFixed(1)} GB`,
78
- };
79
- }
80
- /**
81
- * Parse all resources from raw command outputs
82
- */
83
- export function parseResources(raw) {
84
- const cpu = parseCPU(raw.cpu);
85
- const memory = parseMemory(raw.memory);
86
- const disk = parseDisk(raw.disk);
87
- const gpu = parseGPU(raw.gpu);
88
- return {
89
- // Raw values for metrics storage
90
- cpu,
91
- memory: memory.percent,
92
- disk: disk.percent,
93
- gpu: raw.gpu,
94
- network: raw.network,
95
- loadavg: raw.loadavg,
96
- processes: raw.processes,
97
- connections: raw.connections,
98
- ports: raw.ports,
99
- // Parsed values for API response
100
- cpuPercent: cpu,
101
- memoryPercent: memory.percent,
102
- memoryUsed: memory.used,
103
- memoryTotal: memory.total,
104
- diskPercent: disk.percent,
105
- diskUsed: disk.used,
106
- diskTotal: disk.total,
107
- ...(gpu && {
108
- gpuPercent: gpu.gpuPercent,
109
- gpuMemoryUsed: gpu.gpuMemoryUsed,
110
- gpuMemoryTotal: gpu.gpuMemoryTotal,
111
- }),
112
- };
113
- }
@@ -1,166 +0,0 @@
1
- /**
2
- * Zod schemas for resource parsing validation
3
- */
4
- import { z } from 'zod';
5
- /**
6
- * CPU output validation schema
7
- */
8
- export declare const CPUOutputSchema: z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>;
9
- /**
10
- * Memory output validation schema
11
- */
12
- export declare const MemoryOutputSchema: z.ZodPipeline<z.ZodEffects<z.ZodString, {
13
- percent: number;
14
- used: string;
15
- total: string;
16
- }, string>, z.ZodObject<{
17
- percent: z.ZodNumber;
18
- used: z.ZodString;
19
- total: z.ZodString;
20
- }, "strip", z.ZodTypeAny, {
21
- used: string;
22
- total: string;
23
- percent: number;
24
- }, {
25
- used: string;
26
- total: string;
27
- percent: number;
28
- }>>;
29
- /**
30
- * Disk output validation schema
31
- */
32
- export declare const DiskOutputSchema: z.ZodPipeline<z.ZodEffects<z.ZodString, {
33
- percent: number;
34
- used: string;
35
- total: string;
36
- }, string>, z.ZodObject<{
37
- percent: z.ZodNumber;
38
- used: z.ZodString;
39
- total: z.ZodString;
40
- }, "strip", z.ZodTypeAny, {
41
- used: string;
42
- total: string;
43
- percent: number;
44
- }, {
45
- used: string;
46
- total: string;
47
- percent: number;
48
- }>>;
49
- /**
50
- * GPU output validation schema
51
- */
52
- export declare const GPUOutputSchema: z.ZodPipeline<z.ZodEffects<z.ZodString, {
53
- gpuPercent: number;
54
- gpuMemoryUsed: string;
55
- gpuMemoryTotal: string;
56
- } | null, string>, z.ZodNullable<z.ZodObject<{
57
- gpuPercent: z.ZodNumber;
58
- gpuMemoryUsed: z.ZodString;
59
- gpuMemoryTotal: z.ZodString;
60
- }, "strip", z.ZodTypeAny, {
61
- gpuPercent: number;
62
- gpuMemoryUsed: string;
63
- gpuMemoryTotal: string;
64
- }, {
65
- gpuPercent: number;
66
- gpuMemoryUsed: string;
67
- gpuMemoryTotal: string;
68
- }>>>;
69
- /**
70
- * Raw resources input schema
71
- */
72
- export declare const RawResourcesInputSchema: z.ZodObject<{
73
- cpu: z.ZodString;
74
- memory: z.ZodString;
75
- disk: z.ZodString;
76
- gpu: z.ZodString;
77
- network: z.ZodOptional<z.ZodString>;
78
- loadavg: z.ZodOptional<z.ZodString>;
79
- processes: z.ZodOptional<z.ZodString>;
80
- connections: z.ZodOptional<z.ZodString>;
81
- }, "strip", z.ZodTypeAny, {
82
- cpu: string;
83
- memory: string;
84
- disk: string;
85
- gpu: string;
86
- network?: string | undefined;
87
- loadavg?: string | undefined;
88
- processes?: string | undefined;
89
- connections?: string | undefined;
90
- }, {
91
- cpu: string;
92
- memory: string;
93
- disk: string;
94
- gpu: string;
95
- network?: string | undefined;
96
- loadavg?: string | undefined;
97
- processes?: string | undefined;
98
- connections?: string | undefined;
99
- }>;
100
- /**
101
- * Parsed resources output schema
102
- */
103
- export declare const ParsedResourcesSchema: z.ZodObject<{
104
- cpu: z.ZodNumber;
105
- memory: z.ZodNumber;
106
- disk: z.ZodNumber;
107
- gpu: z.ZodOptional<z.ZodString>;
108
- network: z.ZodOptional<z.ZodString>;
109
- loadavg: z.ZodOptional<z.ZodString>;
110
- processes: z.ZodOptional<z.ZodString>;
111
- connections: z.ZodOptional<z.ZodString>;
112
- cpuPercent: z.ZodNumber;
113
- memoryPercent: z.ZodNumber;
114
- memoryUsed: z.ZodString;
115
- memoryTotal: z.ZodString;
116
- diskPercent: z.ZodNumber;
117
- diskUsed: z.ZodString;
118
- diskTotal: z.ZodString;
119
- gpuPercent: z.ZodOptional<z.ZodNumber>;
120
- gpuMemoryUsed: z.ZodOptional<z.ZodString>;
121
- gpuMemoryTotal: z.ZodOptional<z.ZodString>;
122
- }, "strip", z.ZodTypeAny, {
123
- cpu: number;
124
- memory: number;
125
- disk: number;
126
- cpuPercent: number;
127
- memoryPercent: number;
128
- memoryUsed: string;
129
- memoryTotal: string;
130
- diskPercent: number;
131
- diskUsed: string;
132
- diskTotal: string;
133
- network?: string | undefined;
134
- gpuPercent?: number | undefined;
135
- gpuMemoryUsed?: string | undefined;
136
- gpuMemoryTotal?: string | undefined;
137
- gpu?: string | undefined;
138
- loadavg?: string | undefined;
139
- processes?: string | undefined;
140
- connections?: string | undefined;
141
- }, {
142
- cpu: number;
143
- memory: number;
144
- disk: number;
145
- cpuPercent: number;
146
- memoryPercent: number;
147
- memoryUsed: string;
148
- memoryTotal: string;
149
- diskPercent: number;
150
- diskUsed: string;
151
- diskTotal: string;
152
- network?: string | undefined;
153
- gpuPercent?: number | undefined;
154
- gpuMemoryUsed?: string | undefined;
155
- gpuMemoryTotal?: string | undefined;
156
- gpu?: string | undefined;
157
- loadavg?: string | undefined;
158
- processes?: string | undefined;
159
- connections?: string | undefined;
160
- }>;
161
- /**
162
- * Type exports for TypeScript inference
163
- */
164
- export type ParsedResources = z.infer<typeof ParsedResourcesSchema>;
165
- export type RawResourcesInput = z.infer<typeof RawResourcesInputSchema>;
166
- //# sourceMappingURL=resources.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../types/schemas/resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;GAEG;AACH,eAAO,MAAM,eAAe,uEAOO,CAAA;AAEnC;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;GAiB5B,CAAA;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;GAyB1B,CAAA;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;IA0BzB,CAAA;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;EASlC,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBhC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AACnE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
@@ -1,123 +0,0 @@
1
- /**
2
- * Zod schemas for resource parsing validation
3
- */
4
- import { z } from 'zod';
5
- /**
6
- * CPU output validation schema
7
- */
8
- export const CPUOutputSchema = z
9
- .string()
10
- .transform((val) => {
11
- const num = parseFloat(val);
12
- if (isNaN(num))
13
- throw new Error('Invalid CPU value');
14
- return Math.round(num * 10) / 10;
15
- })
16
- .pipe(z.number().min(0).max(100));
17
- /**
18
- * Memory output validation schema
19
- */
20
- export const MemoryOutputSchema = z
21
- .string()
22
- .transform((val) => {
23
- const parts = val.split(/\s+/);
24
- if (parts.length < 3)
25
- throw new Error('Invalid memory output');
26
- return {
27
- percent: Math.round(parseFloat(parts[0]) * 10) / 10,
28
- used: `${(parseFloat(parts[1]) || 0).toFixed(1)} GB`,
29
- total: `${(parseFloat(parts[2]) || 0).toFixed(1)} GB`,
30
- };
31
- })
32
- .pipe(z.object({
33
- percent: z.number().min(0).max(100),
34
- used: z.string(),
35
- total: z.string(),
36
- }));
37
- /**
38
- * Disk output validation schema
39
- */
40
- export const DiskOutputSchema = z
41
- .string()
42
- .transform((val) => {
43
- const parts = val.split(/\s+/);
44
- const percent = parseFloat(parts[0]?.replace('%', '') || '0') || 0;
45
- const formatSize = (size) => {
46
- if (size.endsWith('G') || size.endsWith('M') || size.endsWith('K')) {
47
- return size.replace(/([GMK])$/, ' $1B');
48
- }
49
- return size;
50
- };
51
- return {
52
- percent: Math.round(percent),
53
- used: formatSize(parts[1] || '0 GB'),
54
- total: formatSize(parts[2] || '0 GB'),
55
- };
56
- })
57
- .pipe(z.object({
58
- percent: z.number().min(0).max(100),
59
- used: z.string(),
60
- total: z.string(),
61
- }));
62
- /**
63
- * GPU output validation schema
64
- */
65
- export const GPUOutputSchema = z
66
- .string()
67
- .transform((val) => {
68
- if (val === 'NOGPU' || val === '0' || !val.trim()) {
69
- return null;
70
- }
71
- const parts = val.split(',').map((s) => s.trim());
72
- if (parts.length < 3) {
73
- return null;
74
- }
75
- return {
76
- gpuPercent: parseFloat(parts[0]) || 0,
77
- gpuMemoryUsed: `${(parseFloat(parts[1]) / 1024).toFixed(1)} GB`,
78
- gpuMemoryTotal: `${(parseFloat(parts[2]) / 1024).toFixed(1)} GB`,
79
- };
80
- })
81
- .pipe(z
82
- .object({
83
- gpuPercent: z.number().min(0).max(100),
84
- gpuMemoryUsed: z.string(),
85
- gpuMemoryTotal: z.string(),
86
- })
87
- .nullable());
88
- /**
89
- * Raw resources input schema
90
- */
91
- export const RawResourcesInputSchema = z.object({
92
- cpu: z.string(),
93
- memory: z.string(),
94
- disk: z.string(),
95
- gpu: z.string(),
96
- network: z.string().optional(),
97
- loadavg: z.string().optional(),
98
- processes: z.string().optional(),
99
- connections: z.string().optional(),
100
- });
101
- /**
102
- * Parsed resources output schema
103
- */
104
- export const ParsedResourcesSchema = z.object({
105
- cpu: z.number().min(0).max(100),
106
- memory: z.number().min(0).max(100),
107
- disk: z.number().min(0).max(100),
108
- gpu: z.string().optional(),
109
- network: z.string().optional(),
110
- loadavg: z.string().optional(),
111
- processes: z.string().optional(),
112
- connections: z.string().optional(),
113
- cpuPercent: z.number().min(0).max(100),
114
- memoryPercent: z.number().min(0).max(100),
115
- memoryUsed: z.string(),
116
- memoryTotal: z.string(),
117
- diskPercent: z.number().min(0).max(100),
118
- diskUsed: z.string(),
119
- diskTotal: z.string(),
120
- gpuPercent: z.number().min(0).max(100).optional(),
121
- gpuMemoryUsed: z.string().optional(),
122
- gpuMemoryTotal: z.string().optional(),
123
- });
@@ -1,109 +0,0 @@
1
- /**
2
- * Shared WebSocket Types for Terminal
3
- * Used by both server (Bun) and client (browser)
4
- */
5
- /**
6
- * WebSocket Close Codes
7
- * Based on RFC 6455 and custom application codes
8
- * See: https://www.iana.org/assignments/websocket/websocket.xml#close-code-number
9
- */
10
- export declare const WebSocketCloseCode: {
11
- readonly NORMAL_CLOSURE: 1000;
12
- readonly ENDPOINT_GOING_AWAY: 1001;
13
- readonly PROTOCOL_ERROR: 1002;
14
- readonly UNSUPPORTED_DATA: 1003;
15
- readonly NO_STATUS_RECEIVED: 1005;
16
- readonly ABNORMAL_CLOSURE: 1006;
17
- readonly INVALID_FRAME_PAYLOAD_DATA: 1007;
18
- readonly POLICY_VIOLATION: 1008;
19
- readonly MESSAGE_TOO_BIG: 1009;
20
- readonly MISSING_MANDATORY_EXTENSION: 1010;
21
- readonly INTERNAL_ERROR: 1011;
22
- readonly SERVICE_RESTART: 1012;
23
- readonly TRY_AGAIN_LATER: 1013;
24
- readonly SESSION_NOT_FOUND: 4001;
25
- readonly SESSION_ALREADY_CLOSED: 4002;
26
- readonly INVALID_MESSAGE_FORMAT: 4003;
27
- readonly AUTHENTICATION_FAILED: 4004;
28
- readonly CONNECTION_TIMEOUT: 4005;
29
- readonly SESSION_LIMIT_REACHED: 4006;
30
- readonly INVALID_HOST: 4007;
31
- readonly SSH_CONNECTION_FAILED: 4008;
32
- readonly NETWORK_BLOCKED: 4009;
33
- };
34
- export type WebSocketCloseCode = typeof WebSocketCloseCode[keyof typeof WebSocketCloseCode];
35
- /**
36
- * Incoming WebSocket message types from client to server
37
- */
38
- export type ClientToServerMessage = ConnectMessage | InputMessage | ResizeMessage | DisconnectMessage;
39
- /**
40
- * Outgoing WebSocket message types from server to client
41
- */
42
- export type ServerToClientMessage = SessionResponse | ProgressResponse | ErrorResponse | OutputMessage;
43
- /**
44
- * Connect to a terminal session
45
- */
46
- export interface ConnectMessage {
47
- type: "connect";
48
- host: string;
49
- user?: string;
50
- sessionId?: string | null;
51
- environmentId?: string;
52
- }
53
- /**
54
- * Send input to terminal
55
- */
56
- export interface InputMessage {
57
- type: "input";
58
- data: string;
59
- }
60
- /**
61
- * Resize terminal window
62
- */
63
- export interface ResizeMessage {
64
- type: "resize";
65
- rows: number;
66
- cols: number;
67
- }
68
- /**
69
- * Explicitly disconnect from session
70
- */
71
- export interface DisconnectMessage {
72
- type: "disconnect";
73
- reason?: string;
74
- }
75
- /**
76
- * Session established response
77
- */
78
- export interface SessionResponse {
79
- type: "session";
80
- sessionId: string;
81
- existing: boolean;
82
- host: string;
83
- user: string;
84
- }
85
- /**
86
- * Progress update during connection
87
- */
88
- export interface ProgressResponse {
89
- type: "progress";
90
- message: string;
91
- status: "info" | "success" | "error" | "warning";
92
- }
93
- /**
94
- * Error message
95
- */
96
- export interface ErrorResponse {
97
- type: "error";
98
- code: number;
99
- message: string;
100
- details?: string;
101
- }
102
- /**
103
- * Terminal output (stdout/stderr)
104
- */
105
- export interface OutputMessage {
106
- type: "output" | "stderr";
107
- data: string;
108
- }
109
- //# sourceMappingURL=terminal-websocket.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"terminal-websocket.d.ts","sourceRoot":"","sources":["../../types/terminal-websocket.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;CA4BrB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE5F;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC7B,cAAc,GACd,YAAY,GACZ,aAAa,GACb,iBAAiB,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC7B,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,aAAa,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;CAClD;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Format elapsed time since a given date in full precision (e.g., "2d 14h 32m 15s")
3
- * @param dateString - ISO date string to calculate elapsed time from
4
- * @returns Formatted elapsed time string
5
- */
6
- export declare function formatElapsedTime(dateString: string): string;
7
- //# sourceMappingURL=time.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../types/time.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CA0B5D"}
@@ -1,27 +0,0 @@
1
- /**
2
- * Format elapsed time since a given date in full precision (e.g., "2d 14h 32m 15s")
3
- * @param dateString - ISO date string to calculate elapsed time from
4
- * @returns Formatted elapsed time string
5
- */
6
- export function formatElapsedTime(dateString) {
7
- const now = Date.now();
8
- const created = new Date(dateString).getTime();
9
- const elapsed = now - created;
10
- const seconds = Math.floor(elapsed / 1000);
11
- const minutes = Math.floor(seconds / 60);
12
- const hours = Math.floor(minutes / 60);
13
- const days = Math.floor(hours / 24);
14
- const parts = [];
15
- if (days > 0) {
16
- parts.push(`${days}d`);
17
- }
18
- if (hours % 24 > 0 || days > 0) {
19
- parts.push(`${hours % 24}h`);
20
- }
21
- if (minutes % 60 > 0 || hours > 0) {
22
- parts.push(`${minutes % 60}m`);
23
- }
24
- // Always show seconds if less than a minute, or for completeness
25
- parts.push(`${seconds % 60}s`);
26
- return parts.join(' ');
27
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"distributions.d.ts","sourceRoot":"","sources":["../../../types/user/distributions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Validation utilities for environment names and other inputs
3
- * Migrated to use Zod for runtime type safety and better error messages
4
- */
5
- import { z } from 'zod';
6
- export interface ValidationResult {
7
- isValid: boolean;
8
- error?: string;
9
- }
10
- /**
11
- * Zod schema for environment name validation
12
- * - Must start with a letter or number
13
- * - Can contain letters, numbers, hyphens, and underscores
14
- * - 1-64 characters long
15
- * - Cannot be a reserved word
16
- */
17
- export declare const EnvironmentNameSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
18
- export type EnvironmentName = z.infer<typeof EnvironmentNameSchema>;
19
- /**
20
- * Zod schema for SSH key name validation
21
- */
22
- export declare const SSHKeyNameSchema: z.ZodEffects<z.ZodString, string, string>;
23
- export type SSHKeyName = z.infer<typeof SSHKeyNameSchema>;
24
- /**
25
- * Zod schema for Hetzner API token validation
26
- */
27
- export declare const APITokenSchema: z.ZodEffects<z.ZodString, string, string>;
28
- export type APIToken = z.infer<typeof APITokenSchema>;
29
- /**
30
- * Validates environment name according to Hetzner naming rules
31
- * @deprecated Use EnvironmentNameSchema.safeParse() instead
32
- */
33
- export declare function validateEnvironmentName(name: string): ValidationResult;
34
- /**
35
- * Validates SSH key name
36
- * @deprecated Use SSHKeyNameSchema.safeParse() instead
37
- */
38
- export declare function validateSSHKeyName(name: string): ValidationResult;
39
- /**
40
- * Validates Hetzner API token format
41
- * @deprecated Use APITokenSchema.safeParse() instead
42
- */
43
- export declare function validateAPIToken(token: string): ValidationResult;
44
- //# sourceMappingURL=validation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../types/validation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,yEAQD,CAAA;AAEjC,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE;;GAEG;AACH,eAAO,MAAM,gBAAgB,2CAII,CAAA;AAEjC,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD;;GAEG;AACH,eAAO,MAAM,cAAc,2CAKM,CAAA;AAEjC,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAErD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAStE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CASjE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,CAShE"}