It looks like a export request is successfully made, but I get an error. Might need to introduce delay

This commit is contained in:
worm 2023-01-02 15:38:38 -08:00
parent c0be5218db
commit 91f4fb3058
3 changed files with 22 additions and 17 deletions

1
log
View file

@ -0,0 +1 @@
The plan ID is plan-UiFnw8QxVkotVrev

19
main.js
View file

@ -1,25 +1,10 @@
import { normalized_config } from "./normalize-config.js";
import { get_run_details, create_plan_export } from "./tfc-api-functions.mjs";
import { runidNotProvided, runIdPrefixCheckFail } from "./validate-user-input.mjs";
const my_config = await normalized_config;
// TODO: Split all this run verification clutter out into a separate module
// verify that a run_id was provided to the program
const runid_provided = run_id => {
return (run_id ? true : false);
}
// Add negation function for readability (no 'unless' in js)
const runidNotProvided = run_id => {
return !runid_provided(run_id);
}
// Check for prefix indicating a valid run id
const startsWithRun = run_id => {
return run_id.startsWith("run-");
}
if(runidNotProvided(my_config.run_id) || !startsWithRun(my_config.run_id)){
if(runidNotProvided(my_config.run_id) || runIdPrefixCheckFail(my_config.run_id)){
throw new Error("A valid RunID must be provided. Please check that the supplied runID is valid");
}

19
validate-user-input.mjs Normal file
View file

@ -0,0 +1,19 @@
// verify that a run_id was provided to the program
const runid_provided = run_id => {
return (run_id ? true : false);
}
// Add negation function for readability (no 'unless' in js)
export const runidNotProvided = run_id => {
return !runid_provided(run_id);
}
// Check for prefix indicating a valid run id
const startsWithRun = run_id => {
return run_id.startsWith("run-");
}
// Add negation function for readability (no 'unless' in js)
export const runIdPrefixCheckFail = run_id => {
return !startsWithRun(run_id);
}