@quiltdata/benchling-webhook 0.5.4 → 0.6.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.
- package/README.md +273 -10
- package/dist/bin/benchling-webhook.d.ts +1 -1
- package/dist/bin/benchling-webhook.d.ts.map +1 -1
- package/dist/bin/benchling-webhook.js +8 -22
- package/dist/bin/benchling-webhook.js.map +1 -1
- package/dist/bin/cdk-dev.js +59 -3
- package/dist/bin/cli.js +16 -6
- package/dist/bin/cli.js.map +1 -1
- package/dist/bin/commands/deploy.d.ts +6 -2
- package/dist/bin/commands/deploy.d.ts.map +1 -1
- package/dist/bin/commands/deploy.js +149 -90
- package/dist/bin/commands/deploy.js.map +1 -1
- package/dist/bin/config-profiles.d.ts +59 -0
- package/dist/bin/config-profiles.d.ts.map +1 -0
- package/dist/bin/config-profiles.js +272 -0
- package/dist/bin/config-profiles.js.map +1 -0
- package/dist/bin/create-secret.d.ts +25 -0
- package/dist/bin/create-secret.d.ts.map +1 -0
- package/dist/bin/create-secret.js +239 -0
- package/dist/bin/create-secret.js.map +1 -0
- package/dist/lib/benchling-auth-validator.d.ts +65 -0
- package/dist/lib/benchling-auth-validator.d.ts.map +1 -0
- package/dist/lib/benchling-auth-validator.js +213 -0
- package/dist/lib/benchling-auth-validator.js.map +1 -0
- package/dist/lib/benchling-webhook-stack.d.ts +13 -10
- package/dist/lib/benchling-webhook-stack.d.ts.map +1 -1
- package/dist/lib/benchling-webhook-stack.js +25 -69
- package/dist/lib/benchling-webhook-stack.js.map +1 -1
- package/dist/lib/config-logger.d.ts +191 -0
- package/dist/lib/config-logger.d.ts.map +1 -0
- package/dist/lib/config-logger.js +372 -0
- package/dist/lib/config-logger.js.map +1 -0
- package/dist/lib/configuration-saver.d.ts +75 -0
- package/dist/lib/configuration-saver.d.ts.map +1 -0
- package/dist/lib/configuration-saver.js +145 -0
- package/dist/lib/configuration-saver.js.map +1 -0
- package/dist/lib/configuration-validator.d.ts +63 -0
- package/dist/lib/configuration-validator.d.ts.map +1 -0
- package/dist/lib/configuration-validator.js +136 -0
- package/dist/lib/configuration-validator.js.map +1 -0
- package/dist/lib/configuration-wizard.d.ts +52 -0
- package/dist/lib/configuration-wizard.d.ts.map +1 -0
- package/dist/lib/configuration-wizard.js +193 -0
- package/dist/lib/configuration-wizard.js.map +1 -0
- package/dist/lib/fargate-service.d.ts +18 -9
- package/dist/lib/fargate-service.d.ts.map +1 -1
- package/dist/lib/fargate-service.js +177 -61
- package/dist/lib/fargate-service.js.map +1 -1
- package/dist/lib/quilt-config-resolver.d.ts +53 -0
- package/dist/lib/quilt-config-resolver.d.ts.map +1 -0
- package/dist/lib/quilt-config-resolver.js +100 -0
- package/dist/lib/quilt-config-resolver.js.map +1 -0
- package/dist/lib/s3-bucket-validator.d.ts +76 -0
- package/dist/lib/s3-bucket-validator.d.ts.map +1 -0
- package/dist/lib/s3-bucket-validator.js +237 -0
- package/dist/lib/s3-bucket-validator.js.map +1 -0
- package/dist/lib/types/config.d.ts +398 -0
- package/dist/lib/types/config.d.ts.map +1 -0
- package/dist/lib/types/config.js +11 -0
- package/dist/lib/types/config.js.map +1 -0
- package/dist/lib/utils/config-loader.d.ts +48 -0
- package/dist/lib/utils/config-loader.d.ts.map +1 -0
- package/dist/lib/utils/config-loader.js +109 -0
- package/dist/lib/utils/config-loader.js.map +1 -0
- package/dist/lib/utils/config-resolver.d.ts +138 -0
- package/dist/lib/utils/config-resolver.d.ts.map +1 -0
- package/dist/lib/utils/config-resolver.js +272 -0
- package/dist/lib/utils/config-resolver.js.map +1 -0
- package/dist/lib/utils/config.d.ts +50 -0
- package/dist/lib/utils/config.d.ts.map +1 -1
- package/dist/lib/utils/config.js +86 -0
- package/dist/lib/utils/config.js.map +1 -1
- package/dist/lib/utils/secrets.d.ts +174 -0
- package/dist/lib/utils/secrets.d.ts.map +1 -0
- package/dist/lib/utils/secrets.js +351 -0
- package/dist/lib/utils/secrets.js.map +1 -0
- package/dist/lib/xdg-cli-wrapper.d.ts +113 -0
- package/dist/lib/xdg-cli-wrapper.d.ts.map +1 -0
- package/dist/lib/xdg-cli-wrapper.js +288 -0
- package/dist/lib/xdg-cli-wrapper.js.map +1 -0
- package/dist/lib/xdg-config.d.ts +187 -0
- package/dist/lib/xdg-config.d.ts.map +1 -0
- package/dist/lib/xdg-config.js +562 -0
- package/dist/lib/xdg-config.js.map +1 -0
- package/dist/package.json +33 -25
- package/dist/scripts/config-health-check.d.ts +78 -0
- package/dist/scripts/config-health-check.d.ts.map +1 -0
- package/dist/scripts/config-health-check.js +559 -0
- package/dist/scripts/config-health-check.js.map +1 -0
- package/dist/scripts/infer-quilt-config.d.ts +50 -0
- package/dist/scripts/infer-quilt-config.d.ts.map +1 -0
- package/dist/scripts/infer-quilt-config.js +353 -0
- package/dist/scripts/infer-quilt-config.js.map +1 -0
- package/dist/scripts/install-wizard.d.ts +34 -0
- package/dist/scripts/install-wizard.d.ts.map +1 -0
- package/dist/scripts/install-wizard.js +719 -0
- package/dist/scripts/install-wizard.js.map +1 -0
- package/dist/scripts/sync-secrets.d.ts +63 -0
- package/dist/scripts/sync-secrets.d.ts.map +1 -0
- package/dist/scripts/sync-secrets.js +424 -0
- package/dist/scripts/sync-secrets.js.map +1 -0
- package/env.template +60 -47
- package/package.json +33 -25
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* XDG Configuration Management
|
|
4
|
+
*
|
|
5
|
+
* Provides XDG-compliant configuration file management for the Benchling Webhook system.
|
|
6
|
+
* Implements a three-file configuration model:
|
|
7
|
+
* - User configuration: User-provided default settings
|
|
8
|
+
* - Derived configuration: CLI-inferred configuration
|
|
9
|
+
* - Deployment configuration: Deployment-specific artifacts
|
|
10
|
+
*
|
|
11
|
+
* Supports multiple named profiles (e.g., "default", "dev", "prod") for flexible configuration management.
|
|
12
|
+
*
|
|
13
|
+
* @module xdg-config
|
|
14
|
+
*/
|
|
15
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.XDGConfig = void 0;
|
|
20
|
+
const fs_1 = require("fs");
|
|
21
|
+
const path_1 = require("path");
|
|
22
|
+
const os_1 = require("os");
|
|
23
|
+
const os_2 = require("os");
|
|
24
|
+
const ajv_1 = __importDefault(require("ajv"));
|
|
25
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
26
|
+
/**
|
|
27
|
+
* JSON Schema for configuration validation
|
|
28
|
+
* This is a lenient schema that allows additional properties
|
|
29
|
+
*/
|
|
30
|
+
const CONFIG_SCHEMA = {
|
|
31
|
+
type: "object",
|
|
32
|
+
properties: {
|
|
33
|
+
quiltCatalog: { type: "string" },
|
|
34
|
+
quiltUserBucket: { type: "string" },
|
|
35
|
+
quiltDatabase: { type: "string" },
|
|
36
|
+
quiltStackArn: { type: "string" },
|
|
37
|
+
quiltRegion: { type: "string" },
|
|
38
|
+
catalogUrl: { type: "string" },
|
|
39
|
+
benchlingTenant: { type: "string" },
|
|
40
|
+
benchlingClientId: { type: "string" },
|
|
41
|
+
benchlingClientSecret: { type: "string" },
|
|
42
|
+
benchlingAppDefinitionId: { type: "string" },
|
|
43
|
+
benchlingPkgBucket: { type: "string" },
|
|
44
|
+
benchlingTestEntry: { type: "string" },
|
|
45
|
+
benchlingSecret: { type: "string" },
|
|
46
|
+
benchlingSecrets: { type: "string" },
|
|
47
|
+
cdkAccount: { type: "string" },
|
|
48
|
+
cdkRegion: { type: "string" },
|
|
49
|
+
awsProfile: { type: "string" },
|
|
50
|
+
queueArn: { type: "string" },
|
|
51
|
+
pkgPrefix: { type: "string" },
|
|
52
|
+
pkgKey: { type: "string" },
|
|
53
|
+
logLevel: { type: "string" },
|
|
54
|
+
webhookAllowList: { type: "string" },
|
|
55
|
+
webhookEndpoint: { type: "string" },
|
|
56
|
+
enableWebhookVerification: { type: "string" },
|
|
57
|
+
createEcrRepository: { type: "string" },
|
|
58
|
+
ecrRepositoryName: { type: "string" },
|
|
59
|
+
imageTag: { type: "string" },
|
|
60
|
+
webhookUrl: { type: "string" },
|
|
61
|
+
deploymentTimestamp: { type: "string" },
|
|
62
|
+
deployedAt: { type: "string" },
|
|
63
|
+
stackArn: { type: "string" },
|
|
64
|
+
_metadata: {
|
|
65
|
+
type: "object",
|
|
66
|
+
properties: {
|
|
67
|
+
savedAt: { type: "string" },
|
|
68
|
+
source: { type: "string" },
|
|
69
|
+
version: { type: "string" },
|
|
70
|
+
inferredAt: { type: "string" },
|
|
71
|
+
inferredFrom: { type: "string" },
|
|
72
|
+
deployedBy: { type: "string" },
|
|
73
|
+
stackName: { type: "string" },
|
|
74
|
+
},
|
|
75
|
+
additionalProperties: true,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
additionalProperties: true,
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* XDG Configuration Manager
|
|
82
|
+
*
|
|
83
|
+
* Manages XDG-compliant configuration files for the Benchling Webhook system.
|
|
84
|
+
*/
|
|
85
|
+
class XDGConfig {
|
|
86
|
+
/**
|
|
87
|
+
* Creates a new XDG Configuration Manager
|
|
88
|
+
*
|
|
89
|
+
* @param baseDir - Base configuration directory (defaults to ~/.config/benchling-webhook)
|
|
90
|
+
*/
|
|
91
|
+
constructor(baseDir) {
|
|
92
|
+
this.baseDir = baseDir || this.getDefaultBaseDir();
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Gets the default XDG base directory
|
|
96
|
+
*
|
|
97
|
+
* @returns The default base directory path
|
|
98
|
+
*/
|
|
99
|
+
getDefaultBaseDir() {
|
|
100
|
+
const home = (0, os_1.homedir)();
|
|
101
|
+
return (0, path_1.resolve)(home, ".config", "benchling-webhook");
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Expands home directory in a path
|
|
105
|
+
*
|
|
106
|
+
* @param path - Path potentially containing ~ for home directory
|
|
107
|
+
* @returns Expanded absolute path
|
|
108
|
+
*/
|
|
109
|
+
static expandHomeDir(path) {
|
|
110
|
+
const home = (0, os_1.homedir)();
|
|
111
|
+
return path.replace(/^~/, home);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Gets the configuration file paths
|
|
115
|
+
*
|
|
116
|
+
* @returns Object containing paths to all configuration files
|
|
117
|
+
*/
|
|
118
|
+
static getPaths() {
|
|
119
|
+
const home = (0, os_1.homedir)();
|
|
120
|
+
const baseDir = (0, path_1.resolve)(home, ".config", "benchling-webhook");
|
|
121
|
+
return {
|
|
122
|
+
userConfig: (0, path_1.resolve)(baseDir, "default.json"),
|
|
123
|
+
derivedConfig: (0, path_1.resolve)(baseDir, "config", "default.json"),
|
|
124
|
+
deployConfig: (0, path_1.resolve)(baseDir, "deploy", "default.json"),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Gets the configuration file paths for this instance
|
|
129
|
+
*
|
|
130
|
+
* @returns Object containing paths to all configuration files
|
|
131
|
+
*/
|
|
132
|
+
getPaths() {
|
|
133
|
+
return {
|
|
134
|
+
userConfig: (0, path_1.resolve)(this.baseDir, "default.json"),
|
|
135
|
+
derivedConfig: (0, path_1.resolve)(this.baseDir, "config", "default.json"),
|
|
136
|
+
deployConfig: (0, path_1.resolve)(this.baseDir, "deploy", "default.json"),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Ensures all required configuration directories exist
|
|
141
|
+
*
|
|
142
|
+
* Creates the base configuration directory and subdirectories if they don't exist.
|
|
143
|
+
*
|
|
144
|
+
* @throws {Error} If directory creation fails
|
|
145
|
+
*/
|
|
146
|
+
ensureDirectories() {
|
|
147
|
+
// Create base directory
|
|
148
|
+
if (!(0, fs_1.existsSync)(this.baseDir)) {
|
|
149
|
+
(0, fs_1.mkdirSync)(this.baseDir, { recursive: true });
|
|
150
|
+
}
|
|
151
|
+
// Create config subdirectory
|
|
152
|
+
const configDir = (0, path_1.resolve)(this.baseDir, "config");
|
|
153
|
+
if (!(0, fs_1.existsSync)(configDir)) {
|
|
154
|
+
(0, fs_1.mkdirSync)(configDir, { recursive: true });
|
|
155
|
+
}
|
|
156
|
+
// Create deploy subdirectory
|
|
157
|
+
const deployDir = (0, path_1.resolve)(this.baseDir, "deploy");
|
|
158
|
+
if (!(0, fs_1.existsSync)(deployDir)) {
|
|
159
|
+
(0, fs_1.mkdirSync)(deployDir, { recursive: true });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Gets the file path for a specific configuration type
|
|
164
|
+
*
|
|
165
|
+
* @param configType - Type of configuration to read
|
|
166
|
+
* @returns Absolute path to the configuration file
|
|
167
|
+
*/
|
|
168
|
+
getConfigPath(configType) {
|
|
169
|
+
const paths = this.getPaths();
|
|
170
|
+
switch (configType) {
|
|
171
|
+
case "user":
|
|
172
|
+
return paths.userConfig;
|
|
173
|
+
case "derived":
|
|
174
|
+
return paths.derivedConfig;
|
|
175
|
+
case "deploy":
|
|
176
|
+
return paths.deployConfig;
|
|
177
|
+
default:
|
|
178
|
+
throw new Error(`Unknown configuration type: ${configType}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Reads and parses a configuration file with schema validation
|
|
183
|
+
*
|
|
184
|
+
* @param configType - Type of configuration to read ("user", "derived", or "deploy")
|
|
185
|
+
* @returns Parsed configuration object
|
|
186
|
+
* @throws {Error} If file not found, invalid JSON, or schema validation fails
|
|
187
|
+
*/
|
|
188
|
+
readConfig(configType) {
|
|
189
|
+
const configPath = this.getConfigPath(configType);
|
|
190
|
+
// Check if file exists
|
|
191
|
+
if (!(0, fs_1.existsSync)(configPath)) {
|
|
192
|
+
throw new Error(`Configuration file not found: ${configPath}`);
|
|
193
|
+
}
|
|
194
|
+
// Read file content
|
|
195
|
+
let fileContent;
|
|
196
|
+
try {
|
|
197
|
+
fileContent = (0, fs_1.readFileSync)(configPath, "utf-8");
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
throw new Error(`Failed to read configuration file: ${configPath}. ${error.message}`);
|
|
201
|
+
}
|
|
202
|
+
// Parse JSON
|
|
203
|
+
let config;
|
|
204
|
+
try {
|
|
205
|
+
config = JSON.parse(fileContent);
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
throw new Error(`Invalid JSON in configuration file: ${configPath}. ${error.message}`);
|
|
209
|
+
}
|
|
210
|
+
// Validate schema
|
|
211
|
+
const ajv = new ajv_1.default();
|
|
212
|
+
const validate = ajv.compile(CONFIG_SCHEMA);
|
|
213
|
+
const valid = validate(config);
|
|
214
|
+
if (!valid) {
|
|
215
|
+
const errors = validate.errors?.map((err) => `${err.instancePath} ${err.message}`).join(", ");
|
|
216
|
+
throw new Error(`Invalid configuration schema in ${configPath}: ${errors}`);
|
|
217
|
+
}
|
|
218
|
+
return config;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Gets the backup file path for a configuration type
|
|
222
|
+
*
|
|
223
|
+
* @param configType - Type of configuration
|
|
224
|
+
* @returns Backup file path
|
|
225
|
+
*/
|
|
226
|
+
getBackupPath(configType) {
|
|
227
|
+
const configPath = this.getConfigPath(configType);
|
|
228
|
+
return `${configPath}.backup`;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Validates configuration against schema
|
|
232
|
+
*
|
|
233
|
+
* @param config - Configuration object to validate
|
|
234
|
+
* @throws {Error} If validation fails
|
|
235
|
+
*/
|
|
236
|
+
validateConfigSchema(config) {
|
|
237
|
+
const ajv = new ajv_1.default();
|
|
238
|
+
const validate = ajv.compile(CONFIG_SCHEMA);
|
|
239
|
+
const valid = validate(config);
|
|
240
|
+
if (!valid) {
|
|
241
|
+
const errors = validate.errors?.map((err) => `${err.instancePath} ${err.message}`).join(", ");
|
|
242
|
+
throw new Error(`Invalid configuration schema: ${errors}`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Writes a configuration file atomically with backup
|
|
247
|
+
*
|
|
248
|
+
* Uses a temporary file and rename operation for atomic writes.
|
|
249
|
+
* Creates a backup of the existing file before overwriting.
|
|
250
|
+
*
|
|
251
|
+
* @param configType - Type of configuration to write ("user", "derived", or "deploy")
|
|
252
|
+
* @param config - Configuration object to write
|
|
253
|
+
* @throws {Error} If validation fails or write operation fails
|
|
254
|
+
*/
|
|
255
|
+
writeConfig(configType, config) {
|
|
256
|
+
// Validate configuration before writing
|
|
257
|
+
this.validateConfigSchema(config);
|
|
258
|
+
const configPath = this.getConfigPath(configType);
|
|
259
|
+
const backupPath = this.getBackupPath(configType);
|
|
260
|
+
const configDir = (0, path_1.dirname)(configPath);
|
|
261
|
+
// Ensure config directory exists first
|
|
262
|
+
if (!(0, fs_1.existsSync)(configDir)) {
|
|
263
|
+
(0, fs_1.mkdirSync)(configDir, { recursive: true });
|
|
264
|
+
}
|
|
265
|
+
// Create backup only if file already exists
|
|
266
|
+
if ((0, fs_1.existsSync)(configPath)) {
|
|
267
|
+
try {
|
|
268
|
+
(0, fs_1.copyFileSync)(configPath, backupPath);
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
throw new Error(`Failed to create backup: ${error.message}`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
// Write to temporary file first (atomic write)
|
|
275
|
+
const tempPath = (0, path_1.resolve)((0, os_2.tmpdir)(), `benchling-webhook-config-${Date.now()}.json`);
|
|
276
|
+
const configJson = JSON.stringify(config, null, 4);
|
|
277
|
+
try {
|
|
278
|
+
(0, fs_1.writeFileSync)(tempPath, configJson, "utf-8");
|
|
279
|
+
// Atomic rename (with fallback for cross-device on Windows)
|
|
280
|
+
try {
|
|
281
|
+
(0, fs_1.renameSync)(tempPath, configPath);
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
// Fall back to copy+delete for cross-device scenarios (Windows)
|
|
285
|
+
(0, fs_1.copyFileSync)(tempPath, configPath);
|
|
286
|
+
(0, fs_1.unlinkSync)(tempPath);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
throw new Error(`Failed to write configuration file: ${error.message}`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Merges multiple configuration sources with priority order
|
|
295
|
+
*
|
|
296
|
+
* Merges configurations in priority order (user → derived → deploy),
|
|
297
|
+
* where later configurations override earlier ones.
|
|
298
|
+
* Uses deep merge to handle nested objects.
|
|
299
|
+
*
|
|
300
|
+
* @param configs - Configuration set to merge
|
|
301
|
+
* @returns Merged configuration object
|
|
302
|
+
*/
|
|
303
|
+
mergeConfigs(configs) {
|
|
304
|
+
// Start with empty config
|
|
305
|
+
let merged = {};
|
|
306
|
+
// Merge in priority order: user → derived → deploy
|
|
307
|
+
// Each subsequent config overrides previous values
|
|
308
|
+
if (configs.user) {
|
|
309
|
+
merged = (0, lodash_merge_1.default)({}, merged, configs.user);
|
|
310
|
+
}
|
|
311
|
+
if (configs.derived) {
|
|
312
|
+
merged = (0, lodash_merge_1.default)({}, merged, configs.derived);
|
|
313
|
+
}
|
|
314
|
+
if (configs.deploy) {
|
|
315
|
+
merged = (0, lodash_merge_1.default)({}, merged, configs.deploy);
|
|
316
|
+
}
|
|
317
|
+
return merged;
|
|
318
|
+
}
|
|
319
|
+
// ====================================================================
|
|
320
|
+
// Profile Management Methods (Phase 1.1)
|
|
321
|
+
// ====================================================================
|
|
322
|
+
/**
|
|
323
|
+
* Gets the profile directory path
|
|
324
|
+
*
|
|
325
|
+
* @param profileName - Profile name (defaults to "default")
|
|
326
|
+
* @returns Profile directory path
|
|
327
|
+
*/
|
|
328
|
+
getProfileDir(profileName = "default") {
|
|
329
|
+
if (profileName === "default") {
|
|
330
|
+
return this.baseDir;
|
|
331
|
+
}
|
|
332
|
+
return (0, path_1.resolve)(this.baseDir, "profiles", profileName);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Gets configuration file paths for a specific profile
|
|
336
|
+
*
|
|
337
|
+
* @param profileName - Profile name (defaults to "default")
|
|
338
|
+
* @returns Configuration file paths for the profile
|
|
339
|
+
*/
|
|
340
|
+
getProfilePaths(profileName = "default") {
|
|
341
|
+
const profileDir = this.getProfileDir(profileName);
|
|
342
|
+
return {
|
|
343
|
+
userConfig: (0, path_1.resolve)(profileDir, "default.json"),
|
|
344
|
+
derivedConfig: (0, path_1.resolve)(profileDir, "config", "default.json"),
|
|
345
|
+
deployConfig: (0, path_1.resolve)(profileDir, "deploy", "default.json"),
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Ensures profile directories exist
|
|
350
|
+
*
|
|
351
|
+
* @param profileName - Profile name (defaults to "default")
|
|
352
|
+
*/
|
|
353
|
+
ensureProfileDirectories(profileName = "default") {
|
|
354
|
+
const profileDir = this.getProfileDir(profileName);
|
|
355
|
+
// Create profile directory
|
|
356
|
+
if (!(0, fs_1.existsSync)(profileDir)) {
|
|
357
|
+
(0, fs_1.mkdirSync)(profileDir, { recursive: true });
|
|
358
|
+
}
|
|
359
|
+
// Create config subdirectory
|
|
360
|
+
const configDir = (0, path_1.resolve)(profileDir, "config");
|
|
361
|
+
if (!(0, fs_1.existsSync)(configDir)) {
|
|
362
|
+
(0, fs_1.mkdirSync)(configDir, { recursive: true });
|
|
363
|
+
}
|
|
364
|
+
// Create deploy subdirectory
|
|
365
|
+
const deployDir = (0, path_1.resolve)(profileDir, "deploy");
|
|
366
|
+
if (!(0, fs_1.existsSync)(deployDir)) {
|
|
367
|
+
(0, fs_1.mkdirSync)(deployDir, { recursive: true });
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Lists all available profiles
|
|
372
|
+
*
|
|
373
|
+
* @returns Array of profile names
|
|
374
|
+
*/
|
|
375
|
+
listProfiles() {
|
|
376
|
+
const profiles = ["default"];
|
|
377
|
+
const profilesDir = (0, path_1.resolve)(this.baseDir, "profiles");
|
|
378
|
+
if ((0, fs_1.existsSync)(profilesDir)) {
|
|
379
|
+
const entries = (0, fs_1.readdirSync)(profilesDir, { withFileTypes: true });
|
|
380
|
+
const profileDirs = entries
|
|
381
|
+
.filter((entry) => entry.isDirectory())
|
|
382
|
+
.map((entry) => entry.name);
|
|
383
|
+
profiles.push(...profileDirs);
|
|
384
|
+
}
|
|
385
|
+
return profiles;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Checks if a profile exists
|
|
389
|
+
*
|
|
390
|
+
* @param profileName - Profile name to check
|
|
391
|
+
* @returns True if profile exists, false otherwise
|
|
392
|
+
*/
|
|
393
|
+
profileExists(profileName) {
|
|
394
|
+
const profileDir = this.getProfileDir(profileName);
|
|
395
|
+
return (0, fs_1.existsSync)(profileDir);
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Reads configuration for a specific profile
|
|
399
|
+
*
|
|
400
|
+
* @param configType - Type of configuration to read
|
|
401
|
+
* @param profileName - Profile name (defaults to "default")
|
|
402
|
+
* @returns Parsed configuration object
|
|
403
|
+
* @throws {Error} If file not found or validation fails
|
|
404
|
+
*/
|
|
405
|
+
readProfileConfig(configType, profileName = "default") {
|
|
406
|
+
const paths = this.getProfilePaths(profileName);
|
|
407
|
+
let configPath;
|
|
408
|
+
switch (configType) {
|
|
409
|
+
case "user":
|
|
410
|
+
configPath = paths.userConfig;
|
|
411
|
+
break;
|
|
412
|
+
case "derived":
|
|
413
|
+
configPath = paths.derivedConfig;
|
|
414
|
+
break;
|
|
415
|
+
case "deploy":
|
|
416
|
+
configPath = paths.deployConfig;
|
|
417
|
+
break;
|
|
418
|
+
default:
|
|
419
|
+
throw new Error(`Unknown configuration type: ${configType}`);
|
|
420
|
+
}
|
|
421
|
+
// Check if file exists
|
|
422
|
+
if (!(0, fs_1.existsSync)(configPath)) {
|
|
423
|
+
throw new Error(`Configuration file not found: ${configPath}`);
|
|
424
|
+
}
|
|
425
|
+
// Read and parse
|
|
426
|
+
let fileContent;
|
|
427
|
+
try {
|
|
428
|
+
fileContent = (0, fs_1.readFileSync)(configPath, "utf-8");
|
|
429
|
+
}
|
|
430
|
+
catch (error) {
|
|
431
|
+
throw new Error(`Failed to read configuration file: ${configPath}. ${error.message}`);
|
|
432
|
+
}
|
|
433
|
+
let config;
|
|
434
|
+
try {
|
|
435
|
+
config = JSON.parse(fileContent);
|
|
436
|
+
}
|
|
437
|
+
catch (error) {
|
|
438
|
+
throw new Error(`Invalid JSON in configuration file: ${configPath}. ${error.message}`);
|
|
439
|
+
}
|
|
440
|
+
// Validate schema
|
|
441
|
+
this.validateConfigSchema(config);
|
|
442
|
+
return config;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Writes configuration for a specific profile
|
|
446
|
+
*
|
|
447
|
+
* @param configType - Type of configuration to write
|
|
448
|
+
* @param config - Configuration object to write
|
|
449
|
+
* @param profileName - Profile name (defaults to "default")
|
|
450
|
+
* @throws {Error} If validation fails or write operation fails
|
|
451
|
+
*/
|
|
452
|
+
writeProfileConfig(configType, config, profileName = "default") {
|
|
453
|
+
// Validate configuration before writing
|
|
454
|
+
this.validateConfigSchema(config);
|
|
455
|
+
// Ensure profile directories exist
|
|
456
|
+
this.ensureProfileDirectories(profileName);
|
|
457
|
+
const paths = this.getProfilePaths(profileName);
|
|
458
|
+
let configPath;
|
|
459
|
+
switch (configType) {
|
|
460
|
+
case "user":
|
|
461
|
+
configPath = paths.userConfig;
|
|
462
|
+
break;
|
|
463
|
+
case "derived":
|
|
464
|
+
configPath = paths.derivedConfig;
|
|
465
|
+
break;
|
|
466
|
+
case "deploy":
|
|
467
|
+
configPath = paths.deployConfig;
|
|
468
|
+
break;
|
|
469
|
+
default:
|
|
470
|
+
throw new Error(`Unknown configuration type: ${configType}`);
|
|
471
|
+
}
|
|
472
|
+
const backupPath = `${configPath}.backup`;
|
|
473
|
+
// Create backup if file exists
|
|
474
|
+
if ((0, fs_1.existsSync)(configPath)) {
|
|
475
|
+
try {
|
|
476
|
+
(0, fs_1.copyFileSync)(configPath, backupPath);
|
|
477
|
+
}
|
|
478
|
+
catch (error) {
|
|
479
|
+
throw new Error(`Failed to create backup: ${error.message}`);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
// Write to temporary file first (atomic write)
|
|
483
|
+
const tempPath = (0, path_1.resolve)((0, os_2.tmpdir)(), `benchling-webhook-config-${Date.now()}.json`);
|
|
484
|
+
const configJson = JSON.stringify(config, null, 4);
|
|
485
|
+
try {
|
|
486
|
+
(0, fs_1.writeFileSync)(tempPath, configJson, "utf-8");
|
|
487
|
+
// Atomic rename (with fallback for cross-device on Windows)
|
|
488
|
+
try {
|
|
489
|
+
(0, fs_1.renameSync)(tempPath, configPath);
|
|
490
|
+
}
|
|
491
|
+
catch {
|
|
492
|
+
// Fall back to copy+delete for cross-device scenarios (Windows)
|
|
493
|
+
(0, fs_1.copyFileSync)(tempPath, configPath);
|
|
494
|
+
(0, fs_1.unlinkSync)(tempPath);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
catch (error) {
|
|
498
|
+
throw new Error(`Failed to write configuration file: ${error.message}`);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Loads a complete profile with all configuration files
|
|
503
|
+
*
|
|
504
|
+
* @param profileName - Profile name (defaults to "default")
|
|
505
|
+
* @returns Complete profile configuration
|
|
506
|
+
*/
|
|
507
|
+
loadProfile(profileName = "default") {
|
|
508
|
+
const profile = {
|
|
509
|
+
name: profileName,
|
|
510
|
+
};
|
|
511
|
+
const paths = this.getProfilePaths(profileName);
|
|
512
|
+
// Load user config if exists
|
|
513
|
+
if ((0, fs_1.existsSync)(paths.userConfig)) {
|
|
514
|
+
try {
|
|
515
|
+
profile.user = this.readProfileConfig("user", profileName);
|
|
516
|
+
}
|
|
517
|
+
catch {
|
|
518
|
+
// User config is optional
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
// Load derived config if exists
|
|
522
|
+
if ((0, fs_1.existsSync)(paths.derivedConfig)) {
|
|
523
|
+
try {
|
|
524
|
+
profile.derived = this.readProfileConfig("derived", profileName);
|
|
525
|
+
}
|
|
526
|
+
catch {
|
|
527
|
+
// Derived config is optional
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
// Load deploy config if exists
|
|
531
|
+
if ((0, fs_1.existsSync)(paths.deployConfig)) {
|
|
532
|
+
try {
|
|
533
|
+
profile.deploy = this.readProfileConfig("deploy", profileName);
|
|
534
|
+
}
|
|
535
|
+
catch {
|
|
536
|
+
// Deploy config is optional
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
return profile;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Deletes a profile and all its configuration files
|
|
543
|
+
*
|
|
544
|
+
* WARNING: This is a destructive operation!
|
|
545
|
+
*
|
|
546
|
+
* @param profileName - Profile name to delete
|
|
547
|
+
* @throws {Error} If attempting to delete the default profile or if deletion fails
|
|
548
|
+
*/
|
|
549
|
+
deleteProfile(profileName) {
|
|
550
|
+
if (profileName === "default") {
|
|
551
|
+
throw new Error("Cannot delete the default profile");
|
|
552
|
+
}
|
|
553
|
+
const profileDir = this.getProfileDir(profileName);
|
|
554
|
+
if (!(0, fs_1.existsSync)(profileDir)) {
|
|
555
|
+
throw new Error(`Profile does not exist: ${profileName}`);
|
|
556
|
+
}
|
|
557
|
+
// For safety, we'll require manual deletion
|
|
558
|
+
throw new Error(`Profile deletion must be done manually. Profile directory: ${profileDir}`);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
exports.XDGConfig = XDGConfig;
|
|
562
|
+
//# sourceMappingURL=xdg-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xdg-config.js","sourceRoot":"","sources":["../../lib/xdg-config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;AA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