@quiltdata/benchling-webhook 0.7.4 → 0.7.5-20251113T182945Z

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.
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ /**
3
+ * Next steps message generator
4
+ *
5
+ * Generates context-appropriate command suggestions after setup completion.
6
+ * Supports both repository context (npm scripts) and npx context, and handles
7
+ * deployment results for Phase 3 command chaining.
8
+ *
9
+ * @module lib/next-steps-generator
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.generateNextSteps = generateNextSteps;
13
+ const context_detector_1 = require("./context-detector");
14
+ /**
15
+ * Generate next steps message after setup completion
16
+ *
17
+ * Produces context-appropriate command suggestions based on the
18
+ * deployment profile, execution context, and deployment results.
19
+ * Commands are formatted differently for repository context (npm scripts)
20
+ * vs npx context.
21
+ *
22
+ * @param options - Configuration for next steps generation
23
+ * @param options.profile - Deployment profile name (default, dev, prod, or custom)
24
+ * @param options.stage - Deployment stage (optional)
25
+ * @param options.context - Execution context (optional, auto-detected if not provided)
26
+ * @param options.deployment - Deployment result (optional, for post-deploy next steps)
27
+ * @param options.skipDeployment - Whether deployment was skipped (optional)
28
+ * @returns Formatted next steps message with commands
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * // After setup only (no deployment)
33
+ * const steps = generateNextSteps({ profile: 'default', skipDeployment: true });
34
+ * console.log(steps);
35
+ * // Output:
36
+ * // Next steps:
37
+ * // 1. Deploy to AWS: npm run deploy
38
+ * // 2. Test integration: npm run test
39
+ *
40
+ * // After successful deployment
41
+ * const steps = generateNextSteps({
42
+ * profile: 'default',
43
+ * deployment: {
44
+ * success: true,
45
+ * webhookUrl: 'https://example.com/webhook'
46
+ * }
47
+ * });
48
+ * // Output:
49
+ * // Webhook URL: https://example.com/webhook
50
+ * // Next steps:
51
+ * // 1. Configure webhook URL in Benchling
52
+ * // 2. Test webhook: npm run test
53
+ * ```
54
+ */
55
+ function generateNextSteps(options) {
56
+ const { profile = "default", deployment, skipDeployment = false, context } = options;
57
+ // Auto-detect context if not provided (backward compatibility)
58
+ const execContext = context || (0, context_detector_1.detectExecutionContext)();
59
+ const lines = [];
60
+ // Handle deployment results (Phase 3)
61
+ if (deployment) {
62
+ if (deployment.success && deployment.webhookUrl) {
63
+ // Successful deployment - show webhook URL
64
+ lines.push("");
65
+ lines.push(`Webhook URL: ${deployment.webhookUrl}`);
66
+ lines.push("");
67
+ lines.push("Next steps:");
68
+ lines.push(" 1. Configure webhook URL in Benchling app settings");
69
+ lines.push(` 2. Test webhook: ${formatTestCommand(profile, execContext)}`);
70
+ lines.push(` 3. Check logs: ${formatHealthCheckCommand(profile, execContext)}`);
71
+ }
72
+ else if (!deployment.success) {
73
+ // Failed deployment - show recovery steps
74
+ lines.push("");
75
+ lines.push("Setup was successful, but deployment failed.");
76
+ if (deployment.error) {
77
+ lines.push(`Error: ${deployment.error}`);
78
+ }
79
+ lines.push("");
80
+ lines.push("Next steps:");
81
+ lines.push(" 1. Fix the error above");
82
+ lines.push(` 2. Retry deployment: ${formatDeployCommand(profile, execContext)}`);
83
+ lines.push(` 3. Check configuration: ${formatHealthCheckCommand(profile, execContext)}`);
84
+ }
85
+ }
86
+ else if (skipDeployment) {
87
+ // Setup complete, deployment skipped - show deploy command
88
+ lines.push("Next steps:");
89
+ lines.push(` 1. Deploy to AWS: ${formatDeployCommand(profile, execContext)}`);
90
+ lines.push(` 2. Test integration: ${formatTestCommand(profile, execContext)}`);
91
+ lines.push(` 3. Check configuration: ${formatHealthCheckCommand(profile, execContext)}`);
92
+ }
93
+ else {
94
+ // Default: setup complete without deployment info (backward compatibility)
95
+ lines.push("Next steps:");
96
+ lines.push(` 1. Deploy to AWS: ${formatDeployCommand(profile, execContext)}`);
97
+ lines.push(` 2. Test integration: ${formatTestCommand(profile, execContext)}`);
98
+ }
99
+ return lines.join("\n");
100
+ }
101
+ /**
102
+ * Format deploy command for given profile and context
103
+ *
104
+ * @param profile - Profile name
105
+ * @param context - Execution context
106
+ * @returns Formatted deploy command
107
+ */
108
+ function formatDeployCommand(profile, context) {
109
+ if (context.isRepository) {
110
+ // Repository context - use npm scripts
111
+ if (profile === "default")
112
+ return "npm run deploy";
113
+ if (profile === "dev")
114
+ return "npm run deploy:dev";
115
+ if (profile === "prod")
116
+ return "npm run deploy:prod";
117
+ return `npm run deploy -- --profile ${profile} --stage ${profile}`;
118
+ }
119
+ else {
120
+ // NPX context - use npx commands
121
+ if (profile === "default")
122
+ return `npx ${context.packageName} deploy`;
123
+ if (profile === "dev")
124
+ return `npx ${context.packageName} deploy --profile ${profile} --stage dev`;
125
+ if (profile === "prod")
126
+ return `npx ${context.packageName} deploy --profile ${profile} --stage prod`;
127
+ return `npx ${context.packageName} deploy --profile ${profile} --stage ${profile}`;
128
+ }
129
+ }
130
+ /**
131
+ * Format test/logs command for given profile and context
132
+ *
133
+ * @param profile - Profile name
134
+ * @param context - Execution context
135
+ * @returns Formatted test or logs command
136
+ */
137
+ function formatTestCommand(profile, context) {
138
+ if (context.isRepository) {
139
+ // Repository context - use npm scripts
140
+ if (profile === "default")
141
+ return "npm run test";
142
+ if (profile === "dev")
143
+ return "npm run test:dev";
144
+ if (profile === "prod")
145
+ return "npm run test:prod";
146
+ return `npx ts-node scripts/check-logs.ts --profile ${profile}`;
147
+ }
148
+ else {
149
+ // NPX context - use npx commands
150
+ if (profile === "default")
151
+ return `npx ${context.packageName} test`;
152
+ if (profile === "dev")
153
+ return `npx ${context.packageName} test --profile ${profile}`;
154
+ if (profile === "prod")
155
+ return `npx ${context.packageName} test --profile ${profile}`;
156
+ return `npx ${context.packageName} test --profile ${profile}`;
157
+ }
158
+ }
159
+ /**
160
+ * Format health check command for given profile and context
161
+ *
162
+ * @param profile - Profile name
163
+ * @param context - Execution context
164
+ * @returns Formatted health check command
165
+ */
166
+ function formatHealthCheckCommand(profile, context) {
167
+ if (context.isRepository) {
168
+ // Repository context - use npm scripts
169
+ if (profile === "default")
170
+ return "npm run setup:health";
171
+ return `npm run setup:health -- --profile ${profile}`;
172
+ }
173
+ else {
174
+ // NPX context - use npx commands
175
+ if (profile === "default")
176
+ return `npx ${context.packageName} health-check`;
177
+ return `npx ${context.packageName} health-check --profile ${profile}`;
178
+ }
179
+ }
180
+ //# sourceMappingURL=next-steps-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next-steps-generator.js","sourceRoot":"","sources":["../../lib/next-steps-generator.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AA8CH,8CA8CC;AAzFD,yDAA4D;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,SAAgB,iBAAiB,CAAC,OAAyB;IACvD,MAAM,EAAE,OAAO,GAAG,SAAS,EAAE,UAAU,EAAE,cAAc,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAErF,+DAA+D;IAC/D,MAAM,WAAW,GAAG,OAAO,IAAI,IAAA,yCAAsB,GAAE,CAAC;IAExD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,sCAAsC;IACtC,IAAI,UAAU,EAAE,CAAC;QACb,IAAI,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;YAC9C,2CAA2C;YAC3C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,gBAAgB,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;YACpD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC1B,KAAK,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;YACnE,KAAK,CAAC,IAAI,CAAC,sBAAsB,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;YAC5E,KAAK,CAAC,IAAI,CAAC,oBAAoB,wBAAwB,CAAC,OAAO,EAAE,WAAW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O,+CAA+C,OAAO,EAAE,CAAC;IACpE,CAAC;SAAM,CAAC;QACJ,iCAAiC;QACjC,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,OAAO,OAAO,CAAC,WAAW,OAAO,CAAC;QACpE,IAAI,OAAO,KAAK,KAAK;YAAE,OAAO,OAAO,OAAO,CAAC,WAAW,mBAAmB,OAAO,EAAE,CAAC;QACrF,IAAI,OAAO,KAAK,MAAM;YAAE,OAAO,OAAO,OAAO,CAAC,WAAW,mBAAmB,OAAO,EAAE,CAAC;QACtF,OAAO,OAAO,OAAO,CAAC,WAAW,mBAAmB,OAAO,EAAE,CAAC;IAClE,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAS,wBAAwB,CAAC,OAAe,EAAE,OAAuD;IACtG,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QACvB,uCAAuC;QACvC,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,sBAAsB,CAAC;QACzD,OAAO,qCAAqC,OAAO,EAAE,CAAC;IAC1D,CAAC;SAAM,CAAC;QACJ,iCAAiC;QACjC,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,OAAO,OAAO,CAAC,WAAW,eAAe,CAAC;QAC5E,OAAO,OAAO,OAAO,CAAC,WAAW,2BAA2B,OAAO,EAAE,CAAC;IAC1E,CAAC;AACL,CAAC"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Type definitions for next steps generation
3
+ *
4
+ * @module types/next-steps
5
+ */
6
+ /**
7
+ * Execution context for command suggestions
8
+ *
9
+ * Determines whether to show npm script commands (repository context)
10
+ * or npx commands (package user context).
11
+ */
12
+ export interface ExecutionContext {
13
+ /**
14
+ * True if running in repository (has matching package.json with source files)
15
+ */
16
+ isRepository: boolean;
17
+ /**
18
+ * True if running via npx (installed as package)
19
+ */
20
+ isNpx: boolean;
21
+ /**
22
+ * Package name for npx commands
23
+ * @example "@quiltdata/benchling-webhook"
24
+ */
25
+ packageName: string;
26
+ /**
27
+ * Available npm scripts (if repository context)
28
+ * @example ["deploy", "deploy:dev", "deploy:prod", "test", "test:dev"]
29
+ */
30
+ availableScripts: string[];
31
+ }
32
+ /**
33
+ * Deployment result information
34
+ *
35
+ * Contains outputs from a deployment operation for display in next steps.
36
+ */
37
+ export interface DeploymentResult {
38
+ /**
39
+ * Whether deployment succeeded
40
+ */
41
+ success: boolean;
42
+ /**
43
+ * Webhook URL (if deployment succeeded)
44
+ * @example "https://abc123.execute-api.us-east-1.amazonaws.com/prod/webhook"
45
+ */
46
+ webhookUrl?: string;
47
+ /**
48
+ * CloudFormation stack ARN
49
+ * @example "arn:aws:cloudformation:us-east-1:123456789012:stack/BenchlingWebhook/abc123"
50
+ */
51
+ stackArn?: string;
52
+ /**
53
+ * AWS region where deployed
54
+ * @example "us-east-1"
55
+ */
56
+ region?: string;
57
+ /**
58
+ * Error message (if deployment failed)
59
+ */
60
+ error?: string;
61
+ }
62
+ /**
63
+ * Options for generating next steps message
64
+ */
65
+ export interface NextStepsOptions {
66
+ /**
67
+ * Profile name (default, dev, prod, or custom)
68
+ */
69
+ profile: string;
70
+ /**
71
+ * Deployment stage (dev or prod)
72
+ * @default Inferred from profile
73
+ */
74
+ stage?: string;
75
+ /**
76
+ * Execution context (optional in Phase 1, required in Phase 2)
77
+ *
78
+ * If not provided, defaults to repository context for backward compatibility.
79
+ */
80
+ context?: ExecutionContext;
81
+ /**
82
+ * Deployment result (optional, for Phase 3)
83
+ *
84
+ * If provided, next steps will include deployment-specific information.
85
+ */
86
+ deployment?: DeploymentResult;
87
+ /**
88
+ * Whether deployment was skipped
89
+ * @default false
90
+ */
91
+ skipDeployment?: boolean;
92
+ }
93
+ //# sourceMappingURL=next-steps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next-steps.d.ts","sourceRoot":"","sources":["../../../lib/types/next-steps.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAE3B;;;;OAIG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /**
3
+ * Type definitions for next steps generation
4
+ *
5
+ * @module types/next-steps
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ //# sourceMappingURL=next-steps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next-steps.js","sourceRoot":"","sources":["../../../lib/types/next-steps.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
package/dist/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@quiltdata/benchling-webhook",
3
- "version": "0.7.4",
3
+ "version": "0.7.5-20251113T182945Z",
4
4
  "description": "AWS CDK deployment for Benchling webhook processing using Fargate - Deploy directly with npx",
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.ts",
7
7
  "files": [
8
8
  "dist/",
9
+ "cdk.json",
9
10
  "README.md",
10
11
  "LICENSE",
11
12
  "env.template"
@@ -75,7 +76,7 @@
75
76
  "aws-sdk-client-mock": "^4.1.0",
76
77
  "cross-env": "^10.1.0",
77
78
  "dotenv": "^17.2.3",
78
- "esbuild": "0.25.12",
79
+ "esbuild": "0.27.0",
79
80
  "eslint": "^9.22.0",
80
81
  "globals": "^16.0.0",
81
82
  "jest": "^30.0.0",
@@ -95,7 +96,6 @@
95
96
  "ajv": "^8.17.1",
96
97
  "ajv-formats": "^3.0.1",
97
98
  "aws-cdk-lib": "2.222.0",
98
- "aws-sdk": "^2.1574.0",
99
99
  "boxen": "^8.0.0",
100
100
  "chalk": "^5.0.0",
101
101
  "commander": "^14.0.2",
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@quiltdata/benchling-webhook",
3
- "version": "0.7.4",
3
+ "version": "0.7.5-20251113T182945Z",
4
4
  "description": "AWS CDK deployment for Benchling webhook processing using Fargate - Deploy directly with npx",
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.ts",
7
7
  "files": [
8
8
  "dist/",
9
+ "cdk.json",
9
10
  "README.md",
10
11
  "LICENSE",
11
12
  "env.template"
@@ -75,7 +76,7 @@
75
76
  "aws-sdk-client-mock": "^4.1.0",
76
77
  "cross-env": "^10.1.0",
77
78
  "dotenv": "^17.2.3",
78
- "esbuild": "0.25.12",
79
+ "esbuild": "0.27.0",
79
80
  "eslint": "^9.22.0",
80
81
  "globals": "^16.0.0",
81
82
  "jest": "^30.0.0",
@@ -95,7 +96,6 @@
95
96
  "ajv": "^8.17.1",
96
97
  "ajv-formats": "^3.0.1",
97
98
  "aws-cdk-lib": "2.222.0",
98
- "aws-sdk": "^2.1574.0",
99
99
  "boxen": "^8.0.0",
100
100
  "chalk": "^5.0.0",
101
101
  "commander": "^14.0.2",