@quiltdata/benchling-webhook 0.5.4 → 0.6.1-20251104T043302Z

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 (107) hide show
  1. package/README.md +295 -12
  2. package/dist/bin/benchling-webhook.d.ts +1 -1
  3. package/dist/bin/benchling-webhook.d.ts.map +1 -1
  4. package/dist/bin/benchling-webhook.js +12 -22
  5. package/dist/bin/benchling-webhook.js.map +1 -1
  6. package/dist/bin/cdk-dev.js +59 -3
  7. package/dist/bin/cli.js +27 -9
  8. package/dist/bin/cli.js.map +1 -1
  9. package/dist/bin/commands/deploy.d.ts +6 -2
  10. package/dist/bin/commands/deploy.d.ts.map +1 -1
  11. package/dist/bin/commands/deploy.js +151 -90
  12. package/dist/bin/commands/deploy.js.map +1 -1
  13. package/dist/bin/commands/setup-wizard.d.ts +22 -0
  14. package/dist/bin/commands/setup-wizard.d.ts.map +1 -0
  15. package/dist/bin/commands/setup-wizard.js +47 -0
  16. package/dist/bin/commands/setup-wizard.js.map +1 -0
  17. package/dist/bin/config-profiles.d.ts +59 -0
  18. package/dist/bin/config-profiles.d.ts.map +1 -0
  19. package/dist/bin/config-profiles.js +272 -0
  20. package/dist/bin/config-profiles.js.map +1 -0
  21. package/dist/bin/create-secret.d.ts +25 -0
  22. package/dist/bin/create-secret.d.ts.map +1 -0
  23. package/dist/bin/create-secret.js +239 -0
  24. package/dist/bin/create-secret.js.map +1 -0
  25. package/dist/lib/benchling-auth-validator.d.ts +65 -0
  26. package/dist/lib/benchling-auth-validator.d.ts.map +1 -0
  27. package/dist/lib/benchling-auth-validator.js +213 -0
  28. package/dist/lib/benchling-auth-validator.js.map +1 -0
  29. package/dist/lib/benchling-webhook-stack.d.ts +13 -10
  30. package/dist/lib/benchling-webhook-stack.d.ts.map +1 -1
  31. package/dist/lib/benchling-webhook-stack.js +25 -69
  32. package/dist/lib/benchling-webhook-stack.js.map +1 -1
  33. package/dist/lib/config-logger.d.ts +191 -0
  34. package/dist/lib/config-logger.d.ts.map +1 -0
  35. package/dist/lib/config-logger.js +372 -0
  36. package/dist/lib/config-logger.js.map +1 -0
  37. package/dist/lib/configuration-saver.d.ts +75 -0
  38. package/dist/lib/configuration-saver.d.ts.map +1 -0
  39. package/dist/lib/configuration-saver.js +145 -0
  40. package/dist/lib/configuration-saver.js.map +1 -0
  41. package/dist/lib/configuration-validator.d.ts +63 -0
  42. package/dist/lib/configuration-validator.d.ts.map +1 -0
  43. package/dist/lib/configuration-validator.js +136 -0
  44. package/dist/lib/configuration-validator.js.map +1 -0
  45. package/dist/lib/configuration-wizard.d.ts +52 -0
  46. package/dist/lib/configuration-wizard.d.ts.map +1 -0
  47. package/dist/lib/configuration-wizard.js +193 -0
  48. package/dist/lib/configuration-wizard.js.map +1 -0
  49. package/dist/lib/fargate-service.d.ts +18 -9
  50. package/dist/lib/fargate-service.d.ts.map +1 -1
  51. package/dist/lib/fargate-service.js +177 -61
  52. package/dist/lib/fargate-service.js.map +1 -1
  53. package/dist/lib/quilt-config-resolver.d.ts +53 -0
  54. package/dist/lib/quilt-config-resolver.d.ts.map +1 -0
  55. package/dist/lib/quilt-config-resolver.js +100 -0
  56. package/dist/lib/quilt-config-resolver.js.map +1 -0
  57. package/dist/lib/s3-bucket-validator.d.ts +76 -0
  58. package/dist/lib/s3-bucket-validator.d.ts.map +1 -0
  59. package/dist/lib/s3-bucket-validator.js +237 -0
  60. package/dist/lib/s3-bucket-validator.js.map +1 -0
  61. package/dist/lib/types/config.d.ts +398 -0
  62. package/dist/lib/types/config.d.ts.map +1 -0
  63. package/dist/lib/types/config.js +11 -0
  64. package/dist/lib/types/config.js.map +1 -0
  65. package/dist/lib/utils/config-loader.d.ts +48 -0
  66. package/dist/lib/utils/config-loader.d.ts.map +1 -0
  67. package/dist/lib/utils/config-loader.js +109 -0
  68. package/dist/lib/utils/config-loader.js.map +1 -0
  69. package/dist/lib/utils/config-resolver.d.ts +138 -0
  70. package/dist/lib/utils/config-resolver.d.ts.map +1 -0
  71. package/dist/lib/utils/config-resolver.js +272 -0
  72. package/dist/lib/utils/config-resolver.js.map +1 -0
  73. package/dist/lib/utils/config.d.ts +50 -0
  74. package/dist/lib/utils/config.d.ts.map +1 -1
  75. package/dist/lib/utils/config.js +86 -0
  76. package/dist/lib/utils/config.js.map +1 -1
  77. package/dist/lib/utils/secrets.d.ts +174 -0
  78. package/dist/lib/utils/secrets.d.ts.map +1 -0
  79. package/dist/lib/utils/secrets.js +351 -0
  80. package/dist/lib/utils/secrets.js.map +1 -0
  81. package/dist/lib/xdg-cli-wrapper.d.ts +113 -0
  82. package/dist/lib/xdg-cli-wrapper.d.ts.map +1 -0
  83. package/dist/lib/xdg-cli-wrapper.js +288 -0
  84. package/dist/lib/xdg-cli-wrapper.js.map +1 -0
  85. package/dist/lib/xdg-config.d.ts +187 -0
  86. package/dist/lib/xdg-config.d.ts.map +1 -0
  87. package/dist/lib/xdg-config.js +562 -0
  88. package/dist/lib/xdg-config.js.map +1 -0
  89. package/dist/package.json +34 -26
  90. package/dist/scripts/config-health-check.d.ts +78 -0
  91. package/dist/scripts/config-health-check.d.ts.map +1 -0
  92. package/dist/scripts/config-health-check.js +559 -0
  93. package/dist/scripts/config-health-check.js.map +1 -0
  94. package/dist/scripts/infer-quilt-config.d.ts +50 -0
  95. package/dist/scripts/infer-quilt-config.d.ts.map +1 -0
  96. package/dist/scripts/infer-quilt-config.js +353 -0
  97. package/dist/scripts/infer-quilt-config.js.map +1 -0
  98. package/dist/scripts/install-wizard.d.ts +34 -0
  99. package/dist/scripts/install-wizard.d.ts.map +1 -0
  100. package/dist/scripts/install-wizard.js +719 -0
  101. package/dist/scripts/install-wizard.js.map +1 -0
  102. package/dist/scripts/sync-secrets.d.ts +63 -0
  103. package/dist/scripts/sync-secrets.d.ts.map +1 -0
  104. package/dist/scripts/sync-secrets.js +424 -0
  105. package/dist/scripts/sync-secrets.js.map +1 -0
  106. package/env.template +60 -47
  107. package/package.json +34 -26
@@ -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AC;IACN,CAAC;AACL,CAAC"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * TypeScript Wrapper for Python XDG CLI
3
+ *
4
+ * Provides type-safe access to the Python XDG configuration CLI from TypeScript.
5
+ * This ensures consistency by delegating all XDG operations to the Python implementation.
6
+ *
7
+ * @module lib/xdg-cli-wrapper
8
+ */
9
+ import type { CompleteConfig, DerivedConfig, UserConfig, DeploymentConfig, ProfileName, ConfigType } from "./types/config";
10
+ /**
11
+ * CLI execution options
12
+ */
13
+ interface CLIOptions {
14
+ profile?: ProfileName;
15
+ type?: ConfigType;
16
+ validate?: boolean;
17
+ backup?: boolean;
18
+ pretty?: boolean;
19
+ verbose?: boolean;
20
+ }
21
+ /**
22
+ * Base class for XDG CLI errors
23
+ */
24
+ export declare class XDGCLIError extends Error {
25
+ readonly command: string;
26
+ readonly exitCode: number;
27
+ readonly stderr: string;
28
+ constructor(message: string, command: string, exitCode: number, stderr: string);
29
+ }
30
+ /**
31
+ * XDG CLI Wrapper Class
32
+ *
33
+ * Provides TypeScript interface to Python XDG CLI operations.
34
+ */
35
+ export declare class XDGCLIWrapper {
36
+ /**
37
+ * Read configuration from XDG storage
38
+ *
39
+ * @param options - Read options
40
+ * @returns Configuration data
41
+ */
42
+ static read<T = UserConfig>(options?: CLIOptions): T;
43
+ /**
44
+ * Write configuration to XDG storage
45
+ *
46
+ * @param data - Configuration data to write
47
+ * @param options - Write options
48
+ */
49
+ static write(data: any, options?: CLIOptions): void;
50
+ /**
51
+ * Merge data into existing configuration
52
+ *
53
+ * @param data - Data to merge
54
+ * @param options - Merge options
55
+ */
56
+ static merge(data: any, options?: CLIOptions): void;
57
+ /**
58
+ * Validate configuration against schema
59
+ *
60
+ * @param options - Validation options
61
+ * @returns True if valid, false otherwise
62
+ */
63
+ static validate(options?: CLIOptions): boolean;
64
+ /**
65
+ * List all available profiles
66
+ *
67
+ * @returns Array of profile names
68
+ */
69
+ static listProfiles(): ProfileName[];
70
+ /**
71
+ * Export configuration as JSON
72
+ *
73
+ * @param options - Export options
74
+ * @returns Configuration data
75
+ */
76
+ static export<T = CompleteConfig>(options?: CLIOptions): T;
77
+ /**
78
+ * Get a specific configuration field value
79
+ *
80
+ * @param key - Field key (supports dot notation)
81
+ * @param options - Get options
82
+ * @returns Field value
83
+ */
84
+ static get(key: string, options?: CLIOptions & {
85
+ default?: string;
86
+ }): any;
87
+ /**
88
+ * Set a specific configuration field value
89
+ *
90
+ * @param key - Field key (supports dot notation)
91
+ * @param value - Value to set
92
+ * @param options - Set options
93
+ */
94
+ static set(key: string, value: any, options?: CLIOptions): void;
95
+ /**
96
+ * Read user configuration
97
+ */
98
+ static readUser(profile?: ProfileName): UserConfig;
99
+ /**
100
+ * Read derived configuration
101
+ */
102
+ static readDerived(profile?: ProfileName): DerivedConfig;
103
+ /**
104
+ * Read deployment configuration
105
+ */
106
+ static readDeploy(profile?: ProfileName): DeploymentConfig;
107
+ /**
108
+ * Read complete merged configuration
109
+ */
110
+ static readComplete(profile?: ProfileName): CompleteConfig;
111
+ }
112
+ export {};
113
+ //# sourceMappingURL=xdg-cli-wrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xdg-cli-wrapper.d.ts","sourceRoot":"","sources":["../../lib/xdg-cli-wrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE3H;;GAEG;AACH,UAAU,UAAU;IAChB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,K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OAAO,GAAE,WAAuB,GAAG,gBAAgB;IAIrE;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,GAAE,WAAuB,GAAG,cAAc;CAGxE"}
@@ -0,0 +1,288 @@
1
+ "use strict";
2
+ /**
3
+ * TypeScript Wrapper for Python XDG CLI
4
+ *
5
+ * Provides type-safe access to the Python XDG configuration CLI from TypeScript.
6
+ * This ensures consistency by delegating all XDG operations to the Python implementation.
7
+ *
8
+ * @module lib/xdg-cli-wrapper
9
+ */
10
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
23
+ }) : function(o, v) {
24
+ o["default"] = v;
25
+ });
26
+ var __importStar = (this && this.__importStar) || (function () {
27
+ var ownKeys = function(o) {
28
+ ownKeys = Object.getOwnPropertyNames || function (o) {
29
+ var ar = [];
30
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
31
+ return ar;
32
+ };
33
+ return ownKeys(o);
34
+ };
35
+ return function (mod) {
36
+ if (mod && mod.__esModule) return mod;
37
+ var result = {};
38
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
39
+ __setModuleDefault(result, mod);
40
+ return result;
41
+ };
42
+ })();
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.XDGCLIWrapper = exports.XDGCLIError = void 0;
45
+ const child_process_1 = require("child_process");
46
+ const path = __importStar(require("path"));
47
+ /**
48
+ * Base class for XDG CLI errors
49
+ */
50
+ class XDGCLIError extends Error {
51
+ constructor(message, command, exitCode, stderr) {
52
+ super(message);
53
+ this.command = command;
54
+ this.exitCode = exitCode;
55
+ this.stderr = stderr;
56
+ this.name = "XDGCLIError";
57
+ }
58
+ }
59
+ exports.XDGCLIError = XDGCLIError;
60
+ /**
61
+ * Get the path to the Python CLI script
62
+ */
63
+ function getCLIPath() {
64
+ return path.join(__dirname, "..", "docker", "scripts", "benchling-webhook-config");
65
+ }
66
+ /**
67
+ * Execute Python CLI command
68
+ */
69
+ function executeCLI(args, options = {}) {
70
+ const cliPath = getCLIPath();
71
+ const command = `python3 ${cliPath} ${args.join(" ")}`;
72
+ try {
73
+ const result = (0, child_process_1.execSync)(command, {
74
+ encoding: "utf-8",
75
+ stdio: options.captureStdout ? "pipe" : ["pipe", "pipe", "inherit"],
76
+ maxBuffer: 10 * 1024 * 1024, // 10MB buffer
77
+ });
78
+ return result;
79
+ }
80
+ catch (error) {
81
+ const stderr = error.stderr?.toString() || error.message;
82
+ const exitCode = error.status || 1;
83
+ throw new XDGCLIError(`XDG CLI command failed: ${command}`, command, exitCode, stderr);
84
+ }
85
+ }
86
+ /**
87
+ * XDG CLI Wrapper Class
88
+ *
89
+ * Provides TypeScript interface to Python XDG CLI operations.
90
+ */
91
+ class XDGCLIWrapper {
92
+ /**
93
+ * Read configuration from XDG storage
94
+ *
95
+ * @param options - Read options
96
+ * @returns Configuration data
97
+ */
98
+ static read(options = {}) {
99
+ const args = ["read"];
100
+ if (options.profile) {
101
+ args.push("--profile", options.profile);
102
+ }
103
+ if (options.type) {
104
+ args.push("--type", options.type);
105
+ }
106
+ if (options.validate) {
107
+ args.push("--validate");
108
+ }
109
+ args.push("--compact"); // Always use compact for parsing
110
+ const output = executeCLI(args, { captureStdout: true, verbose: options.verbose });
111
+ return JSON.parse(output);
112
+ }
113
+ /**
114
+ * Write configuration to XDG storage
115
+ *
116
+ * @param data - Configuration data to write
117
+ * @param options - Write options
118
+ */
119
+ static write(data, options = {}) {
120
+ const args = ["write", JSON.stringify(data)];
121
+ if (options.profile) {
122
+ args.push("--profile", options.profile);
123
+ }
124
+ if (options.type) {
125
+ args.push("--type", options.type);
126
+ }
127
+ if (options.validate !== false) {
128
+ args.push("--validate");
129
+ }
130
+ if (options.backup !== false) {
131
+ args.push("--backup");
132
+ }
133
+ executeCLI(args, { verbose: options.verbose });
134
+ }
135
+ /**
136
+ * Merge data into existing configuration
137
+ *
138
+ * @param data - Data to merge
139
+ * @param options - Merge options
140
+ */
141
+ static merge(data, options = {}) {
142
+ const args = ["merge", JSON.stringify(data)];
143
+ if (options.profile) {
144
+ args.push("--profile", options.profile);
145
+ }
146
+ if (options.type) {
147
+ args.push("--type", options.type);
148
+ }
149
+ if (options.validate !== false) {
150
+ args.push("--validate");
151
+ }
152
+ if (options.backup !== false) {
153
+ args.push("--backup");
154
+ }
155
+ executeCLI(args, { verbose: options.verbose });
156
+ }
157
+ /**
158
+ * Validate configuration against schema
159
+ *
160
+ * @param options - Validation options
161
+ * @returns True if valid, false otherwise
162
+ */
163
+ static validate(options = {}) {
164
+ const args = ["validate"];
165
+ if (options.profile) {
166
+ args.push("--profile", options.profile);
167
+ }
168
+ if (options.type) {
169
+ args.push("--type", options.type);
170
+ }
171
+ try {
172
+ executeCLI(args, { verbose: options.verbose });
173
+ return true;
174
+ }
175
+ catch (error) {
176
+ if (error instanceof XDGCLIError) {
177
+ return false;
178
+ }
179
+ throw error;
180
+ }
181
+ }
182
+ /**
183
+ * List all available profiles
184
+ *
185
+ * @returns Array of profile names
186
+ */
187
+ static listProfiles() {
188
+ const output = executeCLI(["list"], { captureStdout: true });
189
+ // Parse output: "Available profiles:\n default\n dev\n..."
190
+ const lines = output.split("\n").filter((line) => line.trim() && !line.includes("Available profiles"));
191
+ return lines.map((line) => line.trim().split(/\s+/)[0]);
192
+ }
193
+ /**
194
+ * Export configuration as JSON
195
+ *
196
+ * @param options - Export options
197
+ * @returns Configuration data
198
+ */
199
+ static export(options = {}) {
200
+ const args = ["export"];
201
+ if (options.profile) {
202
+ args.push("--profile", options.profile);
203
+ }
204
+ if (options.type) {
205
+ args.push("--type", options.type);
206
+ }
207
+ args.push("--compact");
208
+ const output = executeCLI(args, { captureStdout: true, verbose: options.verbose });
209
+ return JSON.parse(output);
210
+ }
211
+ /**
212
+ * Get a specific configuration field value
213
+ *
214
+ * @param key - Field key (supports dot notation)
215
+ * @param options - Get options
216
+ * @returns Field value
217
+ */
218
+ static get(key, options = {}) {
219
+ const args = ["get", key];
220
+ if (options.profile) {
221
+ args.push("--profile", options.profile);
222
+ }
223
+ if (options.type) {
224
+ args.push("--type", options.type);
225
+ }
226
+ if (options.default) {
227
+ args.push("--default", options.default);
228
+ }
229
+ const output = executeCLI(args, { captureStdout: true, verbose: options.verbose });
230
+ // Try to parse as JSON, otherwise return as string
231
+ try {
232
+ return JSON.parse(output.trim());
233
+ }
234
+ catch {
235
+ return output.trim();
236
+ }
237
+ }
238
+ /**
239
+ * Set a specific configuration field value
240
+ *
241
+ * @param key - Field key (supports dot notation)
242
+ * @param value - Value to set
243
+ * @param options - Set options
244
+ */
245
+ static set(key, value, options = {}) {
246
+ const isObject = typeof value === "object";
247
+ const args = ["set", key, isObject ? JSON.stringify(value) : String(value)];
248
+ if (options.profile) {
249
+ args.push("--profile", options.profile);
250
+ }
251
+ if (options.type) {
252
+ args.push("--type", options.type);
253
+ }
254
+ if (isObject) {
255
+ args.push("--json");
256
+ }
257
+ if (options.backup !== false) {
258
+ args.push("--backup");
259
+ }
260
+ executeCLI(args, { verbose: options.verbose });
261
+ }
262
+ /**
263
+ * Read user configuration
264
+ */
265
+ static readUser(profile = "default") {
266
+ return this.read({ profile, type: "user" });
267
+ }
268
+ /**
269
+ * Read derived configuration
270
+ */
271
+ static readDerived(profile = "default") {
272
+ return this.read({ profile, type: "derived" });
273
+ }
274
+ /**
275
+ * Read deployment configuration
276
+ */
277
+ static readDeploy(profile = "default") {
278
+ return this.read({ profile, type: "deploy" });
279
+ }
280
+ /**
281
+ * Read complete merged configuration
282
+ */
283
+ static readComplete(profile = "default") {
284
+ return this.export({ profile, type: "complete" });
285
+ }
286
+ }
287
+ exports.XDGCLIWrapper = XDGCLIWrapper;
288
+ //# sourceMappingURL=xdg-cli-wrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xdg-cli-wrapper.js","sourceRoot":"","sources":["../../lib/xdg-cli-wrapper.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAAyC;AACzC,2CAA6B;AAe7B;;GAEG;AACH,MAAa,WAAY,SAAQ,KAAK;IAClC,YACI,OAAe,EACC,OAAe,EACf,QAAgB,EAChB,MAAc;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,YAAO,GAAP,OAAO,CAAQ;QACf,aAAQ,GAAR,QAAQ,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAQ;QAG9B,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC9B,CAAC;CACJ;AAVD,kCAUC;AAED;;GAEG;AACH,SAAS,UAAU;IACf,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,0BAA0B,CAAC,CAAC;AACvF,CAAC;AAED;;GAEG;AACH,SAAS,UAAU,CAAC,IAAc,EAAE,UAA0D,EAAE;IAC5F,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,WAAW,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAEvD,IAAI,CAAC;QACD,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,OAAO,EAAE;YAC7B,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC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CAAC;IACnD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,UAAuB,SAAS;QAC5C,OAAO,IAAI,CAAC,IAAI,CAAa,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,UAAuB,SAAS;QAC/C,OAAO,IAAI,CAAC,IAAI,CAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,UAAuB,SAAS;QAC9C,OAAO,IAAI,CAAC,IAAI,CAAmB,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,UAAuB,SAAS;QAChD,OAAO,IAAI,CAAC,MAAM,CAAiB,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;IACtE,CAAC;CACJ;AA3ND,sCA2NC"}
@@ -0,0 +1,187 @@
1
+ /**
2
+ * XDG Configuration Management
3
+ *
4
+ * Provides XDG-compliant configuration file management for the Benchling Webhook system.
5
+ * Implements a three-file configuration model:
6
+ * - User configuration: User-provided default settings
7
+ * - Derived configuration: CLI-inferred configuration
8
+ * - Deployment configuration: Deployment-specific artifacts
9
+ *
10
+ * Supports multiple named profiles (e.g., "default", "dev", "prod") for flexible configuration management.
11
+ *
12
+ * @module xdg-config
13
+ */
14
+ import { ConfigType, ProfileName, XDGConfigPaths, ConfigSet, ConfigProfile } from "./types/config";
15
+ /**
16
+ * Base configuration structure (for backward compatibility)
17
+ */
18
+ export interface BaseConfig {
19
+ [key: string]: unknown;
20
+ }
21
+ export type { ConfigType, XDGConfigPaths, ConfigSet };
22
+ /**
23
+ * XDG Configuration Manager
24
+ *
25
+ * Manages XDG-compliant configuration files for the Benchling Webhook system.
26
+ */
27
+ export declare class XDGConfig {
28
+ private readonly baseDir;
29
+ /**
30
+ * Creates a new XDG Configuration Manager
31
+ *
32
+ * @param baseDir - Base configuration directory (defaults to ~/.config/benchling-webhook)
33
+ */
34
+ constructor(baseDir?: string);
35
+ /**
36
+ * Gets the default XDG base directory
37
+ *
38
+ * @returns The default base directory path
39
+ */
40
+ private getDefaultBaseDir;
41
+ /**
42
+ * Expands home directory in a path
43
+ *
44
+ * @param path - Path potentially containing ~ for home directory
45
+ * @returns Expanded absolute path
46
+ */
47
+ private static expandHomeDir;
48
+ /**
49
+ * Gets the configuration file paths
50
+ *
51
+ * @returns Object containing paths to all configuration files
52
+ */
53
+ static getPaths(): XDGConfigPaths;
54
+ /**
55
+ * Gets the configuration file paths for this instance
56
+ *
57
+ * @returns Object containing paths to all configuration files
58
+ */
59
+ getPaths(): XDGConfigPaths;
60
+ /**
61
+ * Ensures all required configuration directories exist
62
+ *
63
+ * Creates the base configuration directory and subdirectories if they don't exist.
64
+ *
65
+ * @throws {Error} If directory creation fails
66
+ */
67
+ ensureDirectories(): void;
68
+ /**
69
+ * Gets the file path for a specific configuration type
70
+ *
71
+ * @param configType - Type of configuration to read
72
+ * @returns Absolute path to the configuration file
73
+ */
74
+ private getConfigPath;
75
+ /**
76
+ * Reads and parses a configuration file with schema validation
77
+ *
78
+ * @param configType - Type of configuration to read ("user", "derived", or "deploy")
79
+ * @returns Parsed configuration object
80
+ * @throws {Error} If file not found, invalid JSON, or schema validation fails
81
+ */
82
+ readConfig(configType: ConfigType): BaseConfig;
83
+ /**
84
+ * Gets the backup file path for a configuration type
85
+ *
86
+ * @param configType - Type of configuration
87
+ * @returns Backup file path
88
+ */
89
+ getBackupPath(configType: ConfigType): string;
90
+ /**
91
+ * Validates configuration against schema
92
+ *
93
+ * @param config - Configuration object to validate
94
+ * @throws {Error} If validation fails
95
+ */
96
+ private validateConfigSchema;
97
+ /**
98
+ * Writes a configuration file atomically with backup
99
+ *
100
+ * Uses a temporary file and rename operation for atomic writes.
101
+ * Creates a backup of the existing file before overwriting.
102
+ *
103
+ * @param configType - Type of configuration to write ("user", "derived", or "deploy")
104
+ * @param config - Configuration object to write
105
+ * @throws {Error} If validation fails or write operation fails
106
+ */
107
+ writeConfig(configType: ConfigType, config: BaseConfig): void;
108
+ /**
109
+ * Merges multiple configuration sources with priority order
110
+ *
111
+ * Merges configurations in priority order (user → derived → deploy),
112
+ * where later configurations override earlier ones.
113
+ * Uses deep merge to handle nested objects.
114
+ *
115
+ * @param configs - Configuration set to merge
116
+ * @returns Merged configuration object
117
+ */
118
+ mergeConfigs(configs: ConfigSet): BaseConfig;
119
+ /**
120
+ * Gets the profile directory path
121
+ *
122
+ * @param profileName - Profile name (defaults to "default")
123
+ * @returns Profile directory path
124
+ */
125
+ getProfileDir(profileName?: ProfileName): string;
126
+ /**
127
+ * Gets configuration file paths for a specific profile
128
+ *
129
+ * @param profileName - Profile name (defaults to "default")
130
+ * @returns Configuration file paths for the profile
131
+ */
132
+ getProfilePaths(profileName?: ProfileName): XDGConfigPaths;
133
+ /**
134
+ * Ensures profile directories exist
135
+ *
136
+ * @param profileName - Profile name (defaults to "default")
137
+ */
138
+ ensureProfileDirectories(profileName?: ProfileName): void;
139
+ /**
140
+ * Lists all available profiles
141
+ *
142
+ * @returns Array of profile names
143
+ */
144
+ listProfiles(): ProfileName[];
145
+ /**
146
+ * Checks if a profile exists
147
+ *
148
+ * @param profileName - Profile name to check
149
+ * @returns True if profile exists, false otherwise
150
+ */
151
+ profileExists(profileName: ProfileName): boolean;
152
+ /**
153
+ * Reads configuration for a specific profile
154
+ *
155
+ * @param configType - Type of configuration to read
156
+ * @param profileName - Profile name (defaults to "default")
157
+ * @returns Parsed configuration object
158
+ * @throws {Error} If file not found or validation fails
159
+ */
160
+ readProfileConfig(configType: ConfigType, profileName?: ProfileName): BaseConfig;
161
+ /**
162
+ * Writes configuration for a specific profile
163
+ *
164
+ * @param configType - Type of configuration to write
165
+ * @param config - Configuration object to write
166
+ * @param profileName - Profile name (defaults to "default")
167
+ * @throws {Error} If validation fails or write operation fails
168
+ */
169
+ writeProfileConfig(configType: ConfigType, config: BaseConfig, profileName?: ProfileName): void;
170
+ /**
171
+ * Loads a complete profile with all configuration files
172
+ *
173
+ * @param profileName - Profile name (defaults to "default")
174
+ * @returns Complete profile configuration
175
+ */
176
+ loadProfile(profileName?: ProfileName): ConfigProfile;
177
+ /**
178
+ * Deletes a profile and all its configuration files
179
+ *
180
+ * WARNING: This is a destructive operation!
181
+ *
182
+ * @param profileName - Profile name to delete
183
+ * @throws {Error} If attempting to delete the default profile or if deletion fails
184
+ */
185
+ deleteProfile(profileName: ProfileName): void;
186
+ }
187
+ //# sourceMappingURL=xdg-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xdg-config.d.ts","sourceRoot":"","sources":["../../lib/xdg-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,OAAO,EAIH,UAAU,EACV,WAAW,EACX,cAAc,EACd,SAAS,EACT,aAAa,EAChB,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAGD,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC;AAyDtD;;;;GAIG;AACH,qBAAa,SAAS;IAClB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC;;;;OAIG;gBACS,OAAO,CAAC,EAAE,MAAM;IAI5B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAKzB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAK5B;;;;OAIG;WACW,QAAQ,IAAI,cAAc;IAWxC;;;;OAIG;IACI,QAAQ,IAAI,cAAc;IAQjC;;;;;;OAMG;IACI,iBAAiB,IAAI,IAAI;IAmBhC;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAcrB;;;;;;OAMG;IACI,UAAU,CAA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