@kadi.build/deploy-ability 0.0.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 (198) hide show
  1. package/README.md +523 -0
  2. package/dist/constants.d.ts +82 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/constants.js +82 -0
  5. package/dist/constants.js.map +1 -0
  6. package/dist/errors/certificate-error.d.ts +95 -0
  7. package/dist/errors/certificate-error.d.ts.map +1 -0
  8. package/dist/errors/certificate-error.js +111 -0
  9. package/dist/errors/certificate-error.js.map +1 -0
  10. package/dist/errors/deployment-error.d.ts +122 -0
  11. package/dist/errors/deployment-error.d.ts.map +1 -0
  12. package/dist/errors/deployment-error.js +185 -0
  13. package/dist/errors/deployment-error.js.map +1 -0
  14. package/dist/errors/index.d.ts +13 -0
  15. package/dist/errors/index.d.ts.map +1 -0
  16. package/dist/errors/index.js +18 -0
  17. package/dist/errors/index.js.map +1 -0
  18. package/dist/errors/profile-error.d.ts +106 -0
  19. package/dist/errors/profile-error.d.ts.map +1 -0
  20. package/dist/errors/profile-error.js +127 -0
  21. package/dist/errors/profile-error.js.map +1 -0
  22. package/dist/errors/provider-error.d.ts +104 -0
  23. package/dist/errors/provider-error.d.ts.map +1 -0
  24. package/dist/errors/provider-error.js +120 -0
  25. package/dist/errors/provider-error.js.map +1 -0
  26. package/dist/errors/wallet-error.d.ts +131 -0
  27. package/dist/errors/wallet-error.d.ts.map +1 -0
  28. package/dist/errors/wallet-error.js +154 -0
  29. package/dist/errors/wallet-error.js.map +1 -0
  30. package/dist/index.d.ts +49 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +53 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/targets/akash/bid-selectors.d.ts +251 -0
  35. package/dist/targets/akash/bid-selectors.d.ts.map +1 -0
  36. package/dist/targets/akash/bid-selectors.js +322 -0
  37. package/dist/targets/akash/bid-selectors.js.map +1 -0
  38. package/dist/targets/akash/bid-types.d.ts +297 -0
  39. package/dist/targets/akash/bid-types.d.ts.map +1 -0
  40. package/dist/targets/akash/bid-types.js +89 -0
  41. package/dist/targets/akash/bid-types.js.map +1 -0
  42. package/dist/targets/akash/blockchain-client.d.ts +577 -0
  43. package/dist/targets/akash/blockchain-client.d.ts.map +1 -0
  44. package/dist/targets/akash/blockchain-client.js +803 -0
  45. package/dist/targets/akash/blockchain-client.js.map +1 -0
  46. package/dist/targets/akash/certificate-manager.d.ts +228 -0
  47. package/dist/targets/akash/certificate-manager.d.ts.map +1 -0
  48. package/dist/targets/akash/certificate-manager.js +395 -0
  49. package/dist/targets/akash/certificate-manager.js.map +1 -0
  50. package/dist/targets/akash/constants.d.ts +231 -0
  51. package/dist/targets/akash/constants.d.ts.map +1 -0
  52. package/dist/targets/akash/constants.js +225 -0
  53. package/dist/targets/akash/constants.js.map +1 -0
  54. package/dist/targets/akash/deployer.d.ts +136 -0
  55. package/dist/targets/akash/deployer.d.ts.map +1 -0
  56. package/dist/targets/akash/deployer.js +599 -0
  57. package/dist/targets/akash/deployer.js.map +1 -0
  58. package/dist/targets/akash/environment.d.ts +241 -0
  59. package/dist/targets/akash/environment.d.ts.map +1 -0
  60. package/dist/targets/akash/environment.js +245 -0
  61. package/dist/targets/akash/environment.js.map +1 -0
  62. package/dist/targets/akash/index.d.ts +1113 -0
  63. package/dist/targets/akash/index.d.ts.map +1 -0
  64. package/dist/targets/akash/index.js +909 -0
  65. package/dist/targets/akash/index.js.map +1 -0
  66. package/dist/targets/akash/lease-monitor.d.ts +51 -0
  67. package/dist/targets/akash/lease-monitor.d.ts.map +1 -0
  68. package/dist/targets/akash/lease-monitor.js +110 -0
  69. package/dist/targets/akash/lease-monitor.js.map +1 -0
  70. package/dist/targets/akash/logs.d.ts +71 -0
  71. package/dist/targets/akash/logs.d.ts.map +1 -0
  72. package/dist/targets/akash/logs.js +311 -0
  73. package/dist/targets/akash/logs.js.map +1 -0
  74. package/dist/targets/akash/logs.types.d.ts +102 -0
  75. package/dist/targets/akash/logs.types.d.ts.map +1 -0
  76. package/dist/targets/akash/logs.types.js +9 -0
  77. package/dist/targets/akash/logs.types.js.map +1 -0
  78. package/dist/targets/akash/pricing.d.ts +247 -0
  79. package/dist/targets/akash/pricing.d.ts.map +1 -0
  80. package/dist/targets/akash/pricing.js +246 -0
  81. package/dist/targets/akash/pricing.js.map +1 -0
  82. package/dist/targets/akash/provider-client.d.ts +114 -0
  83. package/dist/targets/akash/provider-client.d.ts.map +1 -0
  84. package/dist/targets/akash/provider-client.js +318 -0
  85. package/dist/targets/akash/provider-client.js.map +1 -0
  86. package/dist/targets/akash/provider-metadata.d.ts +228 -0
  87. package/dist/targets/akash/provider-metadata.d.ts.map +1 -0
  88. package/dist/targets/akash/provider-metadata.js +14 -0
  89. package/dist/targets/akash/provider-metadata.js.map +1 -0
  90. package/dist/targets/akash/provider-service.d.ts +133 -0
  91. package/dist/targets/akash/provider-service.d.ts.map +1 -0
  92. package/dist/targets/akash/provider-service.js +391 -0
  93. package/dist/targets/akash/provider-service.js.map +1 -0
  94. package/dist/targets/akash/query-client.d.ts +125 -0
  95. package/dist/targets/akash/query-client.d.ts.map +1 -0
  96. package/dist/targets/akash/query-client.js +332 -0
  97. package/dist/targets/akash/query-client.js.map +1 -0
  98. package/dist/targets/akash/sdl-generator.d.ts +31 -0
  99. package/dist/targets/akash/sdl-generator.d.ts.map +1 -0
  100. package/dist/targets/akash/sdl-generator.js +279 -0
  101. package/dist/targets/akash/sdl-generator.js.map +1 -0
  102. package/dist/targets/akash/types.d.ts +285 -0
  103. package/dist/targets/akash/types.d.ts.map +1 -0
  104. package/dist/targets/akash/types.js +54 -0
  105. package/dist/targets/akash/types.js.map +1 -0
  106. package/dist/targets/akash/wallet-manager.d.ts +526 -0
  107. package/dist/targets/akash/wallet-manager.d.ts.map +1 -0
  108. package/dist/targets/akash/wallet-manager.js +953 -0
  109. package/dist/targets/akash/wallet-manager.js.map +1 -0
  110. package/dist/targets/local/compose-generator.d.ts +244 -0
  111. package/dist/targets/local/compose-generator.d.ts.map +1 -0
  112. package/dist/targets/local/compose-generator.js +324 -0
  113. package/dist/targets/local/compose-generator.js.map +1 -0
  114. package/dist/targets/local/deployer.d.ts +82 -0
  115. package/dist/targets/local/deployer.d.ts.map +1 -0
  116. package/dist/targets/local/deployer.js +367 -0
  117. package/dist/targets/local/deployer.js.map +1 -0
  118. package/dist/targets/local/engine-manager.d.ts +155 -0
  119. package/dist/targets/local/engine-manager.d.ts.map +1 -0
  120. package/dist/targets/local/engine-manager.js +250 -0
  121. package/dist/targets/local/engine-manager.js.map +1 -0
  122. package/dist/targets/local/index.d.ts +40 -0
  123. package/dist/targets/local/index.d.ts.map +1 -0
  124. package/dist/targets/local/index.js +43 -0
  125. package/dist/targets/local/index.js.map +1 -0
  126. package/dist/targets/local/network-manager.d.ts +160 -0
  127. package/dist/targets/local/network-manager.d.ts.map +1 -0
  128. package/dist/targets/local/network-manager.js +337 -0
  129. package/dist/targets/local/network-manager.js.map +1 -0
  130. package/dist/targets/local/types.d.ts +327 -0
  131. package/dist/targets/local/types.d.ts.map +1 -0
  132. package/dist/targets/local/types.js +9 -0
  133. package/dist/targets/local/types.js.map +1 -0
  134. package/dist/types/common.d.ts +585 -0
  135. package/dist/types/common.d.ts.map +1 -0
  136. package/dist/types/common.js +13 -0
  137. package/dist/types/common.js.map +1 -0
  138. package/dist/types/index.d.ts +15 -0
  139. package/dist/types/index.d.ts.map +1 -0
  140. package/dist/types/index.js +12 -0
  141. package/dist/types/index.js.map +1 -0
  142. package/dist/types/options.d.ts +329 -0
  143. package/dist/types/options.d.ts.map +1 -0
  144. package/dist/types/options.js +10 -0
  145. package/dist/types/options.js.map +1 -0
  146. package/dist/types/profiles.d.ts +329 -0
  147. package/dist/types/profiles.d.ts.map +1 -0
  148. package/dist/types/profiles.js +27 -0
  149. package/dist/types/profiles.js.map +1 -0
  150. package/dist/types/results.d.ts +443 -0
  151. package/dist/types/results.d.ts.map +1 -0
  152. package/dist/types/results.js +64 -0
  153. package/dist/types/results.js.map +1 -0
  154. package/dist/types/validators.d.ts +118 -0
  155. package/dist/types/validators.d.ts.map +1 -0
  156. package/dist/types/validators.js +198 -0
  157. package/dist/types/validators.js.map +1 -0
  158. package/dist/utils/command-runner.d.ts +128 -0
  159. package/dist/utils/command-runner.d.ts.map +1 -0
  160. package/dist/utils/command-runner.js +210 -0
  161. package/dist/utils/command-runner.js.map +1 -0
  162. package/dist/utils/index.d.ts +10 -0
  163. package/dist/utils/index.d.ts.map +1 -0
  164. package/dist/utils/index.js +10 -0
  165. package/dist/utils/index.js.map +1 -0
  166. package/dist/utils/logger.d.ts +68 -0
  167. package/dist/utils/logger.d.ts.map +1 -0
  168. package/dist/utils/logger.js +93 -0
  169. package/dist/utils/logger.js.map +1 -0
  170. package/dist/utils/profile-loader.d.ts +76 -0
  171. package/dist/utils/profile-loader.d.ts.map +1 -0
  172. package/dist/utils/profile-loader.js +194 -0
  173. package/dist/utils/profile-loader.js.map +1 -0
  174. package/dist/utils/registry/index.d.ts +27 -0
  175. package/dist/utils/registry/index.d.ts.map +1 -0
  176. package/dist/utils/registry/index.js +29 -0
  177. package/dist/utils/registry/index.js.map +1 -0
  178. package/dist/utils/registry/manager.d.ts +319 -0
  179. package/dist/utils/registry/manager.d.ts.map +1 -0
  180. package/dist/utils/registry/manager.js +671 -0
  181. package/dist/utils/registry/manager.js.map +1 -0
  182. package/dist/utils/registry/setup.d.ts +135 -0
  183. package/dist/utils/registry/setup.d.ts.map +1 -0
  184. package/dist/utils/registry/setup.js +207 -0
  185. package/dist/utils/registry/setup.js.map +1 -0
  186. package/dist/utils/registry/transformer.d.ts +92 -0
  187. package/dist/utils/registry/transformer.d.ts.map +1 -0
  188. package/dist/utils/registry/transformer.js +131 -0
  189. package/dist/utils/registry/transformer.js.map +1 -0
  190. package/dist/utils/registry/types.d.ts +241 -0
  191. package/dist/utils/registry/types.d.ts.map +1 -0
  192. package/dist/utils/registry/types.js +10 -0
  193. package/dist/utils/registry/types.js.map +1 -0
  194. package/docs/EXAMPLES.md +293 -0
  195. package/docs/PLACEMENT.md +433 -0
  196. package/docs/STORAGE.md +318 -0
  197. package/docs/building-provider-reliability-tracker.md +2581 -0
  198. package/package.json +109 -0
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Profile type definitions from agent.json
3
+ *
4
+ * These types represent the structure of deployment profiles
5
+ * as defined in an agent's agent.json configuration file.
6
+ *
7
+ * @module types/profiles
8
+ */
9
+ /**
10
+ * Type guard to check if profile is for local deployment
11
+ *
12
+ * @param profile - The profile to check
13
+ * @returns True if profile targets local deployment
14
+ */
15
+ export function isLocalProfile(profile) {
16
+ return profile.target === 'local';
17
+ }
18
+ /**
19
+ * Type guard to check if profile is for Akash deployment
20
+ *
21
+ * @param profile - The profile to check
22
+ * @returns True if profile targets Akash deployment
23
+ */
24
+ export function isAkashProfile(profile) {
25
+ return profile.target === 'akash';
26
+ }
27
+ //# sourceMappingURL=profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/types/profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA6WH;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,OAA0B;IAE1B,OAAO,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,OAA0B;IAE1B,OAAO,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC;AACpC,CAAC"}
@@ -0,0 +1,443 @@
1
+ /**
2
+ * Result type definitions for deployment operations
3
+ *
4
+ * This module uses discriminated unions for type-safe error handling.
5
+ * All deployment operations return Result types that explicitly represent
6
+ * success or failure states.
7
+ *
8
+ * @module types/results
9
+ */
10
+ import type { DeploymentSequence, WalletAddress, ProviderUri, Network, ContainerEngine } from './common.js';
11
+ /**
12
+ * Success result wrapper
13
+ *
14
+ * Represents a successful operation with data
15
+ *
16
+ * @template TData - The type of the success data
17
+ */
18
+ export interface Success<TData> {
19
+ readonly success: true;
20
+ readonly data: TData;
21
+ }
22
+ /**
23
+ * Failure result wrapper
24
+ *
25
+ * Represents a failed operation with error information
26
+ *
27
+ * @template TError - The type of the error
28
+ */
29
+ export interface Failure<TError> {
30
+ readonly success: false;
31
+ readonly error: TError;
32
+ }
33
+ /**
34
+ * Result type combining success and failure
35
+ *
36
+ * A discriminated union that forces explicit error handling
37
+ *
38
+ * @template TData - The type of success data
39
+ * @template TError - The type of error (defaults to Error)
40
+ *
41
+ * @example
42
+ * const result: Result<number> = await someOperation();
43
+ * if (result.success) {
44
+ * console.log(result.data); // TypeScript knows this is number
45
+ * } else {
46
+ * console.error(result.error); // TypeScript knows this is Error
47
+ * }
48
+ */
49
+ export type Result<TData, TError = Error> = Success<TData> | Failure<TError>;
50
+ /**
51
+ * Akash deployment result data
52
+ *
53
+ * Contains all information about a successful Akash deployment
54
+ */
55
+ export interface AkashDeploymentData {
56
+ /**
57
+ * Deployment sequence number (unique ID)
58
+ */
59
+ readonly dseq: DeploymentSequence;
60
+ /**
61
+ * Wallet address that owns the deployment
62
+ */
63
+ readonly owner: WalletAddress;
64
+ /**
65
+ * Provider that accepted the lease
66
+ */
67
+ readonly provider: WalletAddress;
68
+ /**
69
+ * Provider's API endpoint
70
+ */
71
+ readonly providerUri: ProviderUri;
72
+ /**
73
+ * Group sequence number
74
+ */
75
+ readonly gseq: number;
76
+ /**
77
+ * Order sequence number
78
+ */
79
+ readonly oseq: number;
80
+ /**
81
+ * Network where deployment was created
82
+ */
83
+ readonly network: Network;
84
+ /**
85
+ * Service endpoints (if exposed globally)
86
+ * Maps service name to its public URL
87
+ *
88
+ * @example
89
+ * {
90
+ * "api": "https://provider.akash.network:12345",
91
+ * "web": "https://provider.akash.network:12346"
92
+ * }
93
+ */
94
+ readonly endpoints?: Readonly<Record<string, string>>;
95
+ /**
96
+ * TLS certificate used for provider communication
97
+ * Only included if certificate was generated during deployment
98
+ */
99
+ readonly certificate?: {
100
+ readonly cert: string;
101
+ readonly privateKey: string;
102
+ };
103
+ /**
104
+ * Profile name that was deployed
105
+ */
106
+ readonly profile: string;
107
+ /**
108
+ * Timestamp when deployment was created
109
+ */
110
+ readonly deployedAt: Date;
111
+ /**
112
+ * Deployment status on blockchain
113
+ *
114
+ * - `active`: Deployment is running
115
+ * - `closed`: Deployment has been terminated
116
+ */
117
+ readonly status: 'active' | 'closed';
118
+ /**
119
+ * Lease pricing information
120
+ *
121
+ * Complete pricing breakdown including per-block, per-hour, and per-month costs
122
+ * in uAKT and AKT. Includes method to convert to USD when AKT market price is provided.
123
+ *
124
+ * @example Display pricing in uAKT
125
+ * ```typescript
126
+ * const { leasePrice } = deploymentData;
127
+ * console.log(`${leasePrice.uakt.perMonth} uAKT/month`);
128
+ * console.log(`${leasePrice.akt.perMonth} AKT/month`);
129
+ * ```
130
+ *
131
+ * @example Convert to USD
132
+ * ```typescript
133
+ * const aktPrice = 0.50; // $0.50 per AKT from CoinGecko
134
+ * const usd = leasePrice.toUSD(aktPrice);
135
+ * console.log(`$${usd.perMonth.toFixed(2)}/month`);
136
+ * ```
137
+ *
138
+ * @see LeasePrice for detailed documentation
139
+ */
140
+ readonly leasePrice: import('../targets/akash/pricing.js').LeasePrice;
141
+ /**
142
+ * When the lease was created (blockchain timestamp)
143
+ *
144
+ * This is a string representation of the block height or timestamp
145
+ * when the lease was established on-chain.
146
+ */
147
+ readonly leaseCreatedAt: string;
148
+ /**
149
+ * Services deployed with their resource allocations
150
+ *
151
+ * Provides both aggregated totals and detailed resource specifications.
152
+ * Each service may have multiple resource specs (e.g., different replica configurations),
153
+ * and this field provides both summary totals and granular details.
154
+ *
155
+ * **totalResources**: Aggregated sum of all resource specs (count × resources)
156
+ * **replicaCount**: Total number of replicas across all specs
157
+ * **resourceSpecs**: Detailed breakdown of each resource specification with replica counts
158
+ *
159
+ * @example Simple usage - Display totals
160
+ * ```typescript
161
+ * deploymentData.services?.forEach(service => {
162
+ * console.log(`Service: ${service.name}`);
163
+ * console.log(` Total CPU: ${service.totalResources.cpu}`);
164
+ * console.log(` Total Memory: ${service.totalResources.memory}`);
165
+ * console.log(` Total Replicas: ${service.replicaCount}`);
166
+ * });
167
+ * ```
168
+ *
169
+ * @example Advanced usage - Show detailed specs
170
+ * ```typescript
171
+ * deploymentData.services?.forEach(service => {
172
+ * console.log(`Service: ${service.name} (${service.replicaCount} replicas)`);
173
+ * service.resourceSpecs.forEach((spec, i) => {
174
+ * console.log(` Spec ${i + 1}: ${spec.count}× ${spec.cpu} CPU, ${spec.memory} RAM`);
175
+ * });
176
+ * });
177
+ * ```
178
+ *
179
+ * @example Real-world scenario
180
+ * ```typescript
181
+ * // Service with mixed replica configurations:
182
+ * {
183
+ * name: "web",
184
+ * totalResources: { cpu: "5.0", memory: "10Gi", storage: "5Gi" },
185
+ * replicaCount: 4,
186
+ * resourceSpecs: [
187
+ * { count: 3, cpu: "1.0", memory: "2Gi", storage: "1Gi" }, // 3 standard replicas
188
+ * { count: 1, cpu: "2.0", memory: "4Gi", storage: "2Gi" } // 1 high-performance replica
189
+ * ]
190
+ * }
191
+ * ```
192
+ */
193
+ readonly services?: ReadonlyArray<{
194
+ /** Service name from SDL */
195
+ readonly name: string;
196
+ /**
197
+ * Aggregated total resources across all replicas
198
+ *
199
+ * This is the sum of (count × resources) for all resource specs.
200
+ * Use this for displaying overall capacity or cost estimation.
201
+ */
202
+ readonly totalResources: {
203
+ /** Total CPU allocation (e.g., "5.0" = 5 CPU cores total) */
204
+ readonly cpu: string;
205
+ /** Total memory allocation (e.g., "10Gi" = 10 GiB total) */
206
+ readonly memory: string;
207
+ /** Total storage allocation (e.g., "5Gi" = 5 GiB total) */
208
+ readonly storage: string;
209
+ };
210
+ /**
211
+ * Total number of replicas across all resource specs
212
+ *
213
+ * Sum of all `count` fields in resourceSpecs.
214
+ */
215
+ readonly replicaCount: number;
216
+ /**
217
+ * Detailed resource specifications with replica counts
218
+ *
219
+ * Each spec represents a distinct resource configuration and the number
220
+ * of replicas (count) using that configuration. Most services have only
221
+ * one spec, but advanced deployments may have multiple.
222
+ */
223
+ readonly resourceSpecs: ReadonlyArray<{
224
+ /** Number of replicas with this resource configuration */
225
+ readonly count: number;
226
+ /** CPU per replica (e.g., "1.0", "0.5") */
227
+ readonly cpu: string;
228
+ /** Memory per replica (e.g., "2Gi", "512Mi") */
229
+ readonly memory: string;
230
+ /** Storage per replica (e.g., "1Gi", "10Gi") */
231
+ readonly storage: string;
232
+ }>;
233
+ }>;
234
+ }
235
+ /**
236
+ * Akash dry-run result data
237
+ *
238
+ * Contains preview information without actually deploying
239
+ */
240
+ export interface AkashDryRunData {
241
+ /**
242
+ * Indicates this was a dry run
243
+ */
244
+ readonly dryRun: true;
245
+ /**
246
+ * Generated SDL (Stack Definition Language) content
247
+ */
248
+ readonly sdl: string;
249
+ /**
250
+ * Estimated cost per block in uAKT
251
+ */
252
+ readonly estimatedCost?: number;
253
+ /**
254
+ * Profile name that would be deployed
255
+ */
256
+ readonly profile: string;
257
+ /**
258
+ * Network that would be targeted
259
+ */
260
+ readonly network: Network;
261
+ }
262
+ /**
263
+ * Result of Akash Network deployment
264
+ *
265
+ * Either deployment data or dry-run data depending on options
266
+ */
267
+ export type AkashDeploymentResult = Result<AkashDeploymentData> | Result<AkashDryRunData>;
268
+ /**
269
+ * Local deployment result data
270
+ *
271
+ * Contains information about a successful local deployment
272
+ */
273
+ export interface LocalDeploymentData {
274
+ /**
275
+ * Profile name that was deployed
276
+ */
277
+ readonly profile: string;
278
+ /**
279
+ * Container engine used
280
+ */
281
+ readonly engine: ContainerEngine;
282
+ /**
283
+ * Docker network name
284
+ */
285
+ readonly network: string;
286
+ /**
287
+ * Service names that were deployed
288
+ */
289
+ readonly services: readonly string[];
290
+ /**
291
+ * Container IDs mapped by service name
292
+ */
293
+ readonly containers: Readonly<Record<string, string>>;
294
+ /**
295
+ * Service endpoints (local URLs)
296
+ * Maps service name to localhost:port
297
+ *
298
+ * @example
299
+ * {
300
+ * "api": "http://localhost:8080",
301
+ * "web": "http://localhost:3000"
302
+ * }
303
+ */
304
+ readonly endpoints: Readonly<Record<string, string>>;
305
+ /**
306
+ * Path to generated docker-compose.yml
307
+ */
308
+ readonly composePath: string;
309
+ /**
310
+ * Timestamp when deployment was created
311
+ */
312
+ readonly deployedAt: Date;
313
+ }
314
+ /**
315
+ * Local dry-run result data
316
+ */
317
+ export interface LocalDryRunData {
318
+ /**
319
+ * Indicates this was a dry run
320
+ */
321
+ readonly dryRun: true;
322
+ /**
323
+ * Generated docker-compose.yml content
324
+ */
325
+ readonly composeFile: string;
326
+ /**
327
+ * Profile name that would be deployed
328
+ */
329
+ readonly profile: string;
330
+ /**
331
+ * Container engine that would be used
332
+ */
333
+ readonly engine: ContainerEngine;
334
+ /**
335
+ * Services that would be deployed
336
+ */
337
+ readonly services: readonly string[];
338
+ }
339
+ /**
340
+ * Result of local deployment
341
+ */
342
+ export type LocalDeploymentResult = Result<LocalDeploymentData> | Result<LocalDryRunData>;
343
+ /**
344
+ * Wallet connection result data
345
+ */
346
+ export interface WalletConnectionData {
347
+ /**
348
+ * Connected wallet address
349
+ */
350
+ readonly address: WalletAddress;
351
+ /**
352
+ * Wallet type that was used
353
+ */
354
+ readonly walletType: 'keplr' | 'walletconnect';
355
+ /**
356
+ * Account balance in uAKT
357
+ */
358
+ readonly balance?: number;
359
+ /**
360
+ * Network the wallet is connected to
361
+ */
362
+ readonly network: Network;
363
+ }
364
+ /**
365
+ * Result of wallet connection attempt
366
+ */
367
+ export type WalletConnectionResult = Result<WalletConnectionData>;
368
+ /**
369
+ * Certificate data
370
+ */
371
+ export interface CertificateData {
372
+ /**
373
+ * PEM-encoded certificate
374
+ */
375
+ readonly cert: string;
376
+ /**
377
+ * PEM-encoded private key
378
+ */
379
+ readonly privateKey: string;
380
+ /**
381
+ * Certificate serial number
382
+ */
383
+ readonly serial: string;
384
+ /**
385
+ * Whether this certificate was newly created
386
+ */
387
+ readonly isNew: boolean;
388
+ /**
389
+ * Path where certificate was saved
390
+ */
391
+ readonly path?: string;
392
+ }
393
+ /**
394
+ * Result of certificate operation
395
+ */
396
+ export type CertificateResult = Result<CertificateData>;
397
+ /**
398
+ * Helper function to create a success result
399
+ *
400
+ * @template TData - Type of success data
401
+ * @param data - The success data
402
+ * @returns Success result
403
+ *
404
+ * @example
405
+ * return success({ dseq: 12345, provider: 'akash1...' });
406
+ */
407
+ export declare function success<TData>(data: TData): Success<TData>;
408
+ /**
409
+ * Helper function to create a failure result
410
+ *
411
+ * @template TError - Type of error
412
+ * @param error - The error
413
+ * @returns Failure result
414
+ *
415
+ * @example
416
+ * return failure(new DeploymentError('Failed to connect', 'CONN_001'));
417
+ */
418
+ export declare function failure<TError = Error>(error: TError): Failure<TError>;
419
+ /**
420
+ * Type guard to check if result is successful
421
+ *
422
+ * @param result - The result to check
423
+ * @returns True if result is successful
424
+ *
425
+ * @example
426
+ * if (isSuccess(result)) {
427
+ * console.log(result.data); // TypeScript knows this exists
428
+ * }
429
+ */
430
+ export declare function isSuccess<TData, TError>(result: Result<TData, TError>): result is Success<TData>;
431
+ /**
432
+ * Type guard to check if result is a failure
433
+ *
434
+ * @param result - The result to check
435
+ * @returns True if result is a failure
436
+ *
437
+ * @example
438
+ * if (isFailure(result)) {
439
+ * console.error(result.error); // TypeScript knows this exists
440
+ * }
441
+ */
442
+ export declare function isFailure<TData, TError>(result: Result<TData, TError>): result is Failure<TError>;
443
+ //# sourceMappingURL=results.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../src/types/results.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,OAAO,EACP,eAAe,EAChB,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,MAAM,WAAW,OAAO,CAAC,KAAK;IAC5B,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,IAAI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AM,EACrC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAC5B,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAE3B"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Result type definitions for deployment operations
3
+ *
4
+ * This module uses discriminated unions for type-safe error handling.
5
+ * All deployment operations return Result types that explicitly represent
6
+ * success or failure states.
7
+ *
8
+ * @module types/results
9
+ */
10
+ /**
11
+ * Helper function to create a success result
12
+ *
13
+ * @template TData - Type of success data
14
+ * @param data - The success data
15
+ * @returns Success result
16
+ *
17
+ * @example
18
+ * return success({ dseq: 12345, provider: 'akash1...' });
19
+ */
20
+ export function success(data) {
21
+ return { success: true, data };
22
+ }
23
+ /**
24
+ * Helper function to create a failure result
25
+ *
26
+ * @template TError - Type of error
27
+ * @param error - The error
28
+ * @returns Failure result
29
+ *
30
+ * @example
31
+ * return failure(new DeploymentError('Failed to connect', 'CONN_001'));
32
+ */
33
+ export function failure(error) {
34
+ return { success: false, error };
35
+ }
36
+ /**
37
+ * Type guard to check if result is successful
38
+ *
39
+ * @param result - The result to check
40
+ * @returns True if result is successful
41
+ *
42
+ * @example
43
+ * if (isSuccess(result)) {
44
+ * console.log(result.data); // TypeScript knows this exists
45
+ * }
46
+ */
47
+ export function isSuccess(result) {
48
+ return result.success === true;
49
+ }
50
+ /**
51
+ * Type guard to check if result is a failure
52
+ *
53
+ * @param result - The result to check
54
+ * @returns True if result is a failure
55
+ *
56
+ * @example
57
+ * if (isFailure(result)) {
58
+ * console.error(result.error); // TypeScript knows this exists
59
+ * }
60
+ */
61
+ export function isFailure(result) {
62
+ return result.success === false;
63
+ }
64
+ //# sourceMappingURL=results.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results.js","sourceRoot":"","sources":["../../src/types/results.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAocH;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO,CAAQ,IAAW;IACxC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACjC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO,CAAiB,KAAa;IACnD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AACnC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CACvB,MAA6B;IAE7B,OAAO,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC;AACjC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CACvB,MAA6B;IAE7B,OAAO,MAAM,CAAC,OAAO,KAAK,KAAK,CAAC;AAClC,CAAC"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Type Validators and Constructors for Branded Types
3
+ *
4
+ * This module provides runtime validation and safe constructors for branded types
5
+ * using Zod. Instead of blind type assertions (as SomeType), these schemas validate
6
+ * input and provide compile-time guarantees.
7
+ *
8
+ * **Philosophy:**
9
+ * - Branded types provide documentation and prevent mixing incompatible values
10
+ * - Zod schemas enforce the brand contract at runtime
11
+ * - Single point of validation - once created, branded values are trusted
12
+ *
13
+ * **Why Zod:**
14
+ * - Composable, reusable schemas
15
+ * - Excellent error messages
16
+ * - Type inference works perfectly with branded types
17
+ * - Industry standard (Vercel, tRPC, Remix, etc.)
18
+ *
19
+ * @module types/validators
20
+ */
21
+ import { z } from 'zod';
22
+ import type { WalletAddress, DeploymentSequence } from './common.js';
23
+ export declare const WalletAddressSchema: z.ZodString;
24
+ /**
25
+ * Validates and creates a WalletAddress branded type
26
+ *
27
+ * Throws ZodError if validation fails with detailed error messages.
28
+ *
29
+ * @param address - String to validate as wallet address
30
+ * @returns Branded WalletAddress
31
+ * @throws {ZodError} If address format is invalid
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const addr = createWalletAddress('akash1...');
36
+ * ```
37
+ */
38
+ export declare function createWalletAddress(address: string): WalletAddress;
39
+ /**
40
+ * Type guard to check if a string is a valid wallet address
41
+ *
42
+ * @param address - String to check
43
+ * @returns true if address is valid
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * if (isWalletAddress(address)) {
48
+ * // TypeScript knows address is WalletAddress
49
+ * }
50
+ * ```
51
+ */
52
+ export declare function isWalletAddress(address: string): address is WalletAddress;
53
+ /**
54
+ * Safely converts unknown value to WalletAddress
55
+ *
56
+ * Returns undefined instead of throwing if validation fails.
57
+ * Useful for optional fields or untrusted input.
58
+ *
59
+ * @param value - Value to convert
60
+ * @returns WalletAddress if valid, undefined otherwise
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const addr = toWalletAddress(untrustedInput);
65
+ * if (addr) {
66
+ * // Use validated address
67
+ * }
68
+ * ```
69
+ */
70
+ export declare function toWalletAddress(value: unknown): WalletAddress | undefined;
71
+ export declare const DeploymentSequenceSchema: z.ZodNumber;
72
+ /**
73
+ * Validates and creates a DeploymentSequence branded type
74
+ *
75
+ * Throws ZodError if validation fails.
76
+ *
77
+ * @param dseq - Number to validate as deployment sequence
78
+ * @returns Branded DeploymentSequence
79
+ * @throws {ZodError} If dseq is invalid
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * const dseq = createDeploymentSequence(12345);
84
+ * ```
85
+ */
86
+ export declare function createDeploymentSequence(dseq: number): DeploymentSequence;
87
+ /**
88
+ * Type guard to check if a number is a valid deployment sequence
89
+ *
90
+ * @param dseq - Number to check
91
+ * @returns true if dseq is valid
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * if (isDeploymentSequence(dseq)) {
96
+ * // TypeScript knows dseq is DeploymentSequence
97
+ * }
98
+ * ```
99
+ */
100
+ export declare function isDeploymentSequence(dseq: number): dseq is DeploymentSequence;
101
+ /**
102
+ * Safely converts unknown value to DeploymentSequence
103
+ *
104
+ * Returns undefined instead of throwing if validation fails.
105
+ *
106
+ * @param value - Value to convert
107
+ * @returns DeploymentSequence if valid, undefined otherwise
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * const dseq = toDeploymentSequence(untrustedInput);
112
+ * if (dseq) {
113
+ * // Use validated dseq
114
+ * }
115
+ * ```
116
+ */
117
+ export declare function toDeploymentSequence(value: unknown): DeploymentSequence | undefined;
118
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/types/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAyCrE,eAAO,MAAM,mBAAmB,aAA8B,CAAC;AAE/D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAGlE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI,aAAa,CAEzE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAGzE;AAmCD,eAAO,MAAM,wBAAwB,aAAmC,CAAC;AAEzE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAGzE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,kBAAkB,CAE7E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CAGnF"}