@quiltdata/benchling-webhook 0.7.4-20251107T053446Z → 0.7.4-20251113T165616Z
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/bin/cli.js +34 -24
- package/dist/bin/cli.js.map +1 -1
- package/dist/bin/commands/get-env.d.ts +16 -0
- package/dist/bin/commands/get-env.d.ts.map +1 -0
- package/dist/bin/commands/get-env.js +210 -0
- package/dist/bin/commands/get-env.js.map +1 -0
- package/dist/bin/commands/infer-quilt-config.d.ts +3 -2
- package/dist/bin/commands/infer-quilt-config.d.ts.map +1 -1
- package/dist/bin/commands/infer-quilt-config.js +39 -65
- package/dist/bin/commands/infer-quilt-config.js.map +1 -1
- package/dist/bin/commands/install.d.ts +57 -0
- package/dist/bin/commands/install.d.ts.map +1 -0
- package/dist/bin/commands/install.js +166 -0
- package/dist/bin/commands/install.js.map +1 -0
- package/dist/bin/commands/setup-wizard.d.ts +12 -2
- package/dist/bin/commands/setup-wizard.d.ts.map +1 -1
- package/dist/bin/commands/setup-wizard.js +123 -131
- package/dist/bin/commands/setup-wizard.js.map +1 -1
- package/dist/bin/commands/sync-secrets.d.ts +6 -3
- package/dist/bin/commands/sync-secrets.d.ts.map +1 -1
- package/dist/bin/commands/sync-secrets.js +14 -6
- package/dist/bin/commands/sync-secrets.js.map +1 -1
- package/dist/lib/context-detector.d.ts +33 -0
- package/dist/lib/context-detector.d.ts.map +1 -0
- package/dist/lib/context-detector.js +224 -0
- package/dist/lib/context-detector.js.map +1 -0
- package/dist/lib/interfaces/config-storage.d.ts +80 -0
- package/dist/lib/interfaces/config-storage.d.ts.map +1 -0
- package/dist/lib/interfaces/config-storage.js +9 -0
- package/dist/lib/interfaces/config-storage.js.map +1 -0
- package/dist/lib/next-steps-generator.d.ts +53 -0
- package/dist/lib/next-steps-generator.d.ts.map +1 -0
- package/dist/lib/next-steps-generator.js +180 -0
- package/dist/lib/next-steps-generator.js.map +1 -0
- package/dist/lib/types/next-steps.d.ts +93 -0
- package/dist/lib/types/next-steps.d.ts.map +1 -0
- package/dist/lib/types/next-steps.js +8 -0
- package/dist/lib/types/next-steps.js.map +1 -0
- package/dist/lib/utils/stack-inference.d.ts +28 -0
- package/dist/lib/utils/stack-inference.d.ts.map +1 -1
- package/dist/lib/utils/stack-inference.js +61 -0
- package/dist/lib/utils/stack-inference.js.map +1 -1
- package/dist/lib/xdg-base.d.ts +306 -0
- package/dist/lib/xdg-base.d.ts.map +1 -0
- package/dist/lib/xdg-base.js +440 -0
- package/dist/lib/xdg-base.js.map +1 -0
- package/dist/lib/xdg-config.d.ts +54 -187
- package/dist/lib/xdg-config.d.ts.map +1 -1
- package/dist/lib/xdg-config.js +83 -342
- package/dist/lib/xdg-config.js.map +1 -1
- package/dist/package.json +5 -4
- package/dist/scripts/list-quilt-stacks.d.ts +14 -0
- package/dist/scripts/list-quilt-stacks.d.ts.map +1 -0
- package/dist/scripts/list-quilt-stacks.js +96 -0
- package/dist/scripts/list-quilt-stacks.js.map +1 -0
- package/env.template +79 -0
- package/package.json +5 -4
- package/dist/bin/commands/config-show.d.ts +0 -14
- package/dist/bin/commands/config-show.d.ts.map +0 -1
- package/dist/bin/commands/config-show.js +0 -24
- package/dist/bin/commands/config-show.js.map +0 -1
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XDG Base Abstract Class (v0.7.0)
|
|
3
|
+
*
|
|
4
|
+
* Abstract base class containing all shared business logic for configuration management.
|
|
5
|
+
* Concrete implementations (XDGConfig, XDGTest) provide storage primitives.
|
|
6
|
+
*
|
|
7
|
+
* This separation allows:
|
|
8
|
+
* - Shared validation, inheritance, and error handling logic in one place
|
|
9
|
+
* - Multiple storage backends (filesystem, in-memory) with identical behavior
|
|
10
|
+
* - Better test coverage by exercising business logic through both implementations
|
|
11
|
+
*
|
|
12
|
+
* @module xdg-base
|
|
13
|
+
* @version 0.7.0
|
|
14
|
+
*/
|
|
15
|
+
import { ProfileConfig, DeploymentHistory, DeploymentRecord, ValidationResult } from "./types/config";
|
|
16
|
+
import { IConfigStorage } from "./interfaces/config-storage";
|
|
17
|
+
/**
|
|
18
|
+
* Abstract base class for XDG configuration management
|
|
19
|
+
*
|
|
20
|
+
* Implements IConfigStorage interface with all business logic.
|
|
21
|
+
* Subclasses must implement abstract storage primitives for their specific storage mechanism.
|
|
22
|
+
*
|
|
23
|
+
* @abstract
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Filesystem implementation
|
|
27
|
+
* class XDGConfig extends XDGBase {
|
|
28
|
+
* protected readProfileRaw(profile: string): ProfileConfig {
|
|
29
|
+
* const data = readFileSync(this.getProfilePath(profile), "utf-8");
|
|
30
|
+
* return JSON.parse(data);
|
|
31
|
+
* }
|
|
32
|
+
* // ... other primitives
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* // In-memory implementation
|
|
36
|
+
* class XDGTest extends XDGBase {
|
|
37
|
+
* private profiles = new Map<string, ProfileConfig>();
|
|
38
|
+
* protected readProfileRaw(profile: string): ProfileConfig {
|
|
39
|
+
* const config = this.profiles.get(profile);
|
|
40
|
+
* if (!config) throw new Error(`Profile not found: ${profile}`);
|
|
41
|
+
* return config;
|
|
42
|
+
* }
|
|
43
|
+
* // ... other primitives
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare abstract class XDGBase implements IConfigStorage {
|
|
48
|
+
/**
|
|
49
|
+
* Reads raw profile configuration without validation
|
|
50
|
+
*
|
|
51
|
+
* @param profile - Profile name
|
|
52
|
+
* @returns Raw profile configuration
|
|
53
|
+
* @throws {Error} If profile cannot be read
|
|
54
|
+
*/
|
|
55
|
+
protected abstract readProfileRaw(profile: string): ProfileConfig;
|
|
56
|
+
/**
|
|
57
|
+
* Writes raw profile configuration without validation
|
|
58
|
+
*
|
|
59
|
+
* @param profile - Profile name
|
|
60
|
+
* @param config - Configuration to write
|
|
61
|
+
* @throws {Error} If write fails
|
|
62
|
+
*/
|
|
63
|
+
protected abstract writeProfileRaw(profile: string, config: ProfileConfig): void;
|
|
64
|
+
/**
|
|
65
|
+
* Deletes profile and all associated data
|
|
66
|
+
*
|
|
67
|
+
* @param profile - Profile name
|
|
68
|
+
* @throws {Error} If deletion fails
|
|
69
|
+
*/
|
|
70
|
+
protected abstract deleteProfileRaw(profile: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Lists all profile names
|
|
73
|
+
*
|
|
74
|
+
* @returns Array of profile names
|
|
75
|
+
*/
|
|
76
|
+
protected abstract listProfilesRaw(): string[];
|
|
77
|
+
/**
|
|
78
|
+
* Checks if profile exists
|
|
79
|
+
*
|
|
80
|
+
* @param profile - Profile name
|
|
81
|
+
* @returns True if profile exists
|
|
82
|
+
*/
|
|
83
|
+
protected abstract profileExistsRaw(profile: string): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Reads raw deployment history without validation
|
|
86
|
+
*
|
|
87
|
+
* @param profile - Profile name
|
|
88
|
+
* @returns Deployment history or null if none exists
|
|
89
|
+
* @throws {Error} If read fails
|
|
90
|
+
*/
|
|
91
|
+
protected abstract readDeploymentsRaw(profile: string): DeploymentHistory | null;
|
|
92
|
+
/**
|
|
93
|
+
* Writes raw deployment history without validation
|
|
94
|
+
*
|
|
95
|
+
* @param profile - Profile name
|
|
96
|
+
* @param history - Deployment history to write
|
|
97
|
+
* @throws {Error} If write fails
|
|
98
|
+
*/
|
|
99
|
+
protected abstract writeDeploymentsRaw(profile: string, history: DeploymentHistory): void;
|
|
100
|
+
/**
|
|
101
|
+
* Reads configuration for a profile with validation
|
|
102
|
+
*
|
|
103
|
+
* @param profile - Profile name (e.g., "default", "dev", "prod")
|
|
104
|
+
* @returns Validated configuration object
|
|
105
|
+
* @throws {Error} If profile not found or configuration is invalid
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const config = storage.readProfile("default");
|
|
110
|
+
* console.log(config.benchling.tenant);
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
readProfile(profile: string): ProfileConfig;
|
|
114
|
+
/**
|
|
115
|
+
* Writes configuration for a profile with validation
|
|
116
|
+
*
|
|
117
|
+
* Creates the profile if it doesn't exist.
|
|
118
|
+
*
|
|
119
|
+
* @param profile - Profile name
|
|
120
|
+
* @param config - Configuration object to write
|
|
121
|
+
* @throws {Error} If validation fails or write operation fails
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* storage.writeProfile("default", {
|
|
126
|
+
* quilt: { ... },
|
|
127
|
+
* benchling: { ... },
|
|
128
|
+
* packages: { ... },
|
|
129
|
+
* deployment: { ... },
|
|
130
|
+
* _metadata: {
|
|
131
|
+
* version: "0.7.0",
|
|
132
|
+
* createdAt: new Date().toISOString(),
|
|
133
|
+
* updatedAt: new Date().toISOString(),
|
|
134
|
+
* source: "wizard"
|
|
135
|
+
* }
|
|
136
|
+
* });
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
writeProfile(profile: string, config: ProfileConfig): void;
|
|
140
|
+
/**
|
|
141
|
+
* Deletes a profile and all its data
|
|
142
|
+
*
|
|
143
|
+
* WARNING: This is a destructive operation!
|
|
144
|
+
* Cannot delete the "default" profile.
|
|
145
|
+
*
|
|
146
|
+
* @param profile - Profile name to delete
|
|
147
|
+
* @throws {Error} If attempting to delete default profile or if deletion fails
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* storage.deleteProfile("dev");
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
deleteProfile(profile: string): void;
|
|
155
|
+
/**
|
|
156
|
+
* Lists all available profiles
|
|
157
|
+
*
|
|
158
|
+
* @returns Array of profile names
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* const profiles = storage.listProfiles();
|
|
163
|
+
* console.log(profiles); // ["default", "dev", "prod"]
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
listProfiles(): string[];
|
|
167
|
+
/**
|
|
168
|
+
* Checks if a profile exists
|
|
169
|
+
*
|
|
170
|
+
* @param profile - Profile name to check
|
|
171
|
+
* @returns True if profile exists and has valid configuration, false otherwise
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* if (storage.profileExists("dev")) {
|
|
176
|
+
* const config = storage.readProfile("dev");
|
|
177
|
+
* }
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
profileExists(profile: string): boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Gets deployment history for a profile with validation
|
|
183
|
+
*
|
|
184
|
+
* Returns empty history if deployments don't exist.
|
|
185
|
+
*
|
|
186
|
+
* @param profile - Profile name
|
|
187
|
+
* @returns Deployment history with active deployments and full history
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* const deployments = storage.getDeployments("default");
|
|
192
|
+
* console.log(deployments.active["prod"]); // Active prod deployment
|
|
193
|
+
* console.log(deployments.history[0]); // Most recent deployment
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
getDeployments(profile: string): DeploymentHistory;
|
|
197
|
+
/**
|
|
198
|
+
* Records a new deployment for a profile
|
|
199
|
+
*
|
|
200
|
+
* Adds deployment to history and updates active deployment for the stage.
|
|
201
|
+
* Creates deployment history if it doesn't exist.
|
|
202
|
+
*
|
|
203
|
+
* @param profile - Profile name
|
|
204
|
+
* @param deployment - Deployment record to add
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* storage.recordDeployment("default", {
|
|
209
|
+
* stage: "prod",
|
|
210
|
+
* timestamp: new Date().toISOString(),
|
|
211
|
+
* imageTag: "0.7.0",
|
|
212
|
+
* endpoint: "https://abc123.execute-api.us-east-1.amazonaws.com/prod",
|
|
213
|
+
* stackName: "BenchlingWebhookStack",
|
|
214
|
+
* region: "us-east-1",
|
|
215
|
+
* deployedBy: "ernest@example.com",
|
|
216
|
+
* commit: "abc123f"
|
|
217
|
+
* });
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
recordDeployment(profile: string, deployment: DeploymentRecord): void;
|
|
221
|
+
/**
|
|
222
|
+
* Gets the active deployment for a specific stage
|
|
223
|
+
*
|
|
224
|
+
* @param profile - Profile name
|
|
225
|
+
* @param stage - Stage name (e.g., "dev", "prod")
|
|
226
|
+
* @returns Active deployment record for the stage, or null if none exists
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```typescript
|
|
230
|
+
* const prodDeployment = storage.getActiveDeployment("default", "prod");
|
|
231
|
+
* if (prodDeployment) {
|
|
232
|
+
* console.log("Prod endpoint:", prodDeployment.endpoint);
|
|
233
|
+
* }
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
getActiveDeployment(profile: string, stage: string): DeploymentRecord | null;
|
|
237
|
+
/**
|
|
238
|
+
* Reads profile configuration with inheritance support
|
|
239
|
+
*
|
|
240
|
+
* If the profile has an `_inherits` field, loads the base profile first
|
|
241
|
+
* and deep merges the current profile on top.
|
|
242
|
+
*
|
|
243
|
+
* Detects and prevents circular inheritance chains.
|
|
244
|
+
*
|
|
245
|
+
* @param profile - Profile name to read
|
|
246
|
+
* @param baseProfile - Optional explicit base profile (overrides `_inherits`)
|
|
247
|
+
* @returns Merged configuration with inheritance applied
|
|
248
|
+
* @throws {Error} If circular inheritance is detected
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```typescript
|
|
252
|
+
* // dev/config.json has "_inherits": "default"
|
|
253
|
+
* const devConfig = storage.readProfileWithInheritance("dev");
|
|
254
|
+
* // Returns default config deep-merged with dev overrides
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
readProfileWithInheritance(profile: string, baseProfile?: string): ProfileConfig;
|
|
258
|
+
/**
|
|
259
|
+
* Internal recursive implementation of profile inheritance
|
|
260
|
+
*
|
|
261
|
+
* @param profile - Current profile name
|
|
262
|
+
* @param explicitBase - Explicitly specified base profile
|
|
263
|
+
* @param visited - Set of visited profiles (for circular detection)
|
|
264
|
+
* @returns Merged configuration
|
|
265
|
+
* @throws {Error} If circular inheritance is detected
|
|
266
|
+
*/
|
|
267
|
+
private readProfileWithInheritanceInternal;
|
|
268
|
+
/**
|
|
269
|
+
* Deep merges two profile configurations
|
|
270
|
+
*
|
|
271
|
+
* Nested objects are merged recursively.
|
|
272
|
+
* Arrays are replaced (not concatenated).
|
|
273
|
+
* Current config takes precedence over base config.
|
|
274
|
+
*
|
|
275
|
+
* @param base - Base configuration
|
|
276
|
+
* @param current - Current configuration (takes precedence)
|
|
277
|
+
* @returns Merged configuration
|
|
278
|
+
*/
|
|
279
|
+
private deepMergeConfigs;
|
|
280
|
+
/**
|
|
281
|
+
* Validates a profile configuration against the schema
|
|
282
|
+
*
|
|
283
|
+
* @param config - Configuration object to validate
|
|
284
|
+
* @returns Validation result with errors and warnings
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```typescript
|
|
288
|
+
* const validation = storage.validateProfile(config);
|
|
289
|
+
* if (!validation.isValid) {
|
|
290
|
+
* console.error("Validation errors:", validation.errors);
|
|
291
|
+
* }
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
validateProfile(config: ProfileConfig): ValidationResult;
|
|
295
|
+
/**
|
|
296
|
+
* Builds a helpful error message when a profile is not found
|
|
297
|
+
*
|
|
298
|
+
* Subclasses can override this to add storage-specific detection
|
|
299
|
+
* (e.g., legacy file detection for filesystem storage).
|
|
300
|
+
*
|
|
301
|
+
* @param profile - Profile name that was not found
|
|
302
|
+
* @returns Formatted error message
|
|
303
|
+
*/
|
|
304
|
+
protected buildProfileNotFoundError(profile: string): string;
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=xdg-base.d.ts.map
|
|
@@ -0,0 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