Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ npx cdk deploy
3. Command-Click "Quilt Catalog" to open the package in a new window
4. Drag in an attachment to the Benchling entry
1. Click "Update package" to create a new version
2. The package will include:
- entry.json: Entry metadata
- assay-results.json: Associated assay results
- input.json: Original webhook payload
- README.md: Package documentation

## Testing

Expand Down
1 change: 1 addition & 0 deletions lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const FILES = {
INPUT_JSON: "input.json",
README_MD: "README.md",
ENTRY_MD: "entry.md",
ASSAY_RESULTS_JSON: "assay-results.json",
} as const;

export const MIME_TYPES = {
Expand Down
33 changes: 32 additions & 1 deletion lib/packaging-state-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,14 @@ export class PackagingStateMachine extends Construct {

private createDefinition(): stepfunctions.IChainable {
const fetchEntryTask = this.createFetchEntryTask();
const fetchAssayResults = this.createFetchAssayResultsTask();
const templates = this.writeTemplates();
const exportWorkflow = this.createExportWorkflow();

return fetchEntryTask.next(templates).next(exportWorkflow);
return fetchEntryTask
.next(fetchAssayResults)
.next(templates)
.next(exportWorkflow);
}


Expand Down Expand Up @@ -230,6 +234,11 @@ export class PackagingStateMachine extends Construct {
FILES.ENTRY_JSON,
"$.entry.entryData",
);
const writeAssayResultsToS3Task = this.createS3WriteTask(
this.props.bucket,
FILES.ASSAY_RESULTS_JSON,
"$.assayResults.assayResults",
);
const writeMetadataTask = this.createS3WriteTask(
this.props.bucket,
FILES.INPUT_JSON,
Expand All @@ -240,10 +249,32 @@ export class PackagingStateMachine extends Construct {
return extractDownloadURL
.next(processExportTask)
.next(writeEntryToS3Task)
.next(writeAssayResultsToS3Task)
.next(writeMetadataTask)
.next(sendToSQSTask);
}

private createFetchAssayResultsTask(): stepfunctions.CustomState {
return new stepfunctions.CustomState(this, "FetchAssayResults", {
stateJson: {
Type: "Task",
Resource: "arn:aws:states:::http:invoke",
Parameters: {
"ApiEndpoint.$":
"States.Format('{}/api/v2/assay-results?entryId={}', $.baseURL, $.entity)",
Method: "GET",
Authentication: {
ConnectionArn: this.props.benchlingConnection.attrArn,
},
},
ResultSelector: {
"assayResults.$": "$.ResponseBody.assayResults",
},
ResultPath: "$.assayResults",
},
});
}

private createFetchEntryTask(): stepfunctions.CustomState {
return new stepfunctions.CustomState(this, "FetchEntry", {
stateJson: {
Expand Down