Skip to content

Commit

Permalink
compile
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushgaud committed Nov 14, 2023
1 parent 8282293 commit 9429ef8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
17 changes: 9 additions & 8 deletions resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12339,28 +12339,29 @@ wrike_ist.wrike.link_html=function(a){var b=cljs.core.__destructure_map(a);a=clj
': \x3ca href\x3d"',cljs.core.str.cljs$core$IFn$_invoke$arity$1(c),'"\x3e (#',cljs.core.str.cljs$core$IFn$_invoke$arity$1(a),")\x3c/a\x3e"].join(""):[wrike_ist.wrike.link_badge,cljs.core.str.cljs$core$IFn$_invoke$arity$1(e)," on branch ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(d),': \x3ca href\x3d"',cljs.core.str.cljs$core$IFn$_invoke$arity$1(c),'"\x3e',cljs.core.str.cljs$core$IFn$_invoke$arity$1(b)," (#",cljs.core.str.cljs$core$IFn$_invoke$arity$1(a),")\x3c/a\x3e"].join("")};
wrike_ist.wrike.parse_body=function(a){return cljs.core.js__GT_clj.cljs$core$IFn$_invoke$arity$1(JSON.parse(cljs$cst$184$body.cljs$core$IFn$_invoke$arity$1(a)))};
wrike_ist.wrike.find_task=function(a){a=["https://www.wrike.com/api/v4/tasks?fields\x3d[parentIds]\x26permalink\x3d",cljs.core.str.cljs$core$IFn$_invoke$arity$1(encodeURIComponent(a))].join("");return httpurr.client.node.get(a,new cljs.core.PersistentArrayMap(null,1,[cljs$cst$183$headers,wrike_ist.wrike.headers()],null)).then(function(b){b=cljs.core.get_in.cljs$core$IFn$_invoke$arity$2(wrike_ist.wrike.parse_body(b),new cljs.core.PersistentVector(null,2,5,cljs.core.PersistentVector.EMPTY_NODE,["data",
0],null));if(cljs.core.truth_(b))return console.info("Task found"),Promise.resolve(b);console.error("Task not found");return Promise.reject(Error("Task not found"))})};
0],null));if(cljs.core.truth_(b))return console.info("find-task: Task found"),Promise.resolve(b);console.error("find-task: Task not found");return Promise.reject(Error("find-task: Task not found"))})};
wrike_ist.wrike.get_folder_id=function(a){return httpurr.client.node.get("https://www.wrike.com/api/v4/folders",new cljs.core.PersistentArrayMap(null,1,[cljs$cst$183$headers,wrike_ist.wrike.headers()],null)).then(wrike_ist.wrike.parse_body).then(function(b){b=cljs.core.__destructure_map(b);b=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,"data");var c=clojure.string.split.cljs$core$IFn$_invoke$arity$2(a,/\s+/);b=cljs.core.filter.cljs$core$IFn$_invoke$arity$2(function(d){return cljs.core.contains_QMARK_(c,
cljs$cst$209$title.cljs$core$IFn$_invoke$arity$1(d))},b);return cljs.core.seq(b)?cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs$cst$205$id,b):cljs.core.PersistentVector.EMPTY})};
wrike_ist.wrike.fetch_wrike_task=function(a){a=["https://www.wrike.com/api/v4/tasks/",cljs.core.str.cljs$core$IFn$_invoke$arity$1(a)].join("");var b=new cljs.core.PersistentArrayMap(null,1,[cljs$cst$183$headers,wrike_ist.wrike.headers()],null);a=wrike_ist.wrike.parse_body(httpurr.client.node.get(a,b));return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(200,cljs$cst$109$status.cljs$core$IFn$_invoke$arity$1(a))?a:null};
wrike_ist.wrike.is_wrike_task_in_folder_QMARK_=function(a,b){wrike_ist.wrike.find_task(a);return function(c){c=cljs.core.__destructure_map(c);c=cljs.core.get.cljs$core$IFn$_invoke$arity$2(c,"task-id");c=["https://www.wrike.com/api/v4/tasks/",cljs.core.str.cljs$core$IFn$_invoke$arity$1(c)].join("");return httpurr.client.node.get(c,new cljs.core.PersistentArrayMap(null,1,[cljs$cst$183$headers,wrike_ist.wrike.headers()],null)).then(wrike_ist.wrike.parse_body).then(function(d){if(cljs.core.contains_QMARK_(cljs$cst$210$folders.cljs$core$IFn$_invoke$arity$1(d),
b))return console.log("Task is in the folder or an inherited folder: true"),!0;d=cljs$cst$211$parentIds.cljs$core$IFn$_invoke$arity$1(d);if(cljs.core.truth_(d))return console.log("Task is in the folder or an inherited folder: true"),cljs.core.some(function(e){return cljs.core.contains_QMARK_(cljs$cst$210$folders.cljs$core$IFn$_invoke$arity$1(wrike_ist.wrike.fetch_wrike_task(e)),b)},d);console.log("Task is not in the folder or an inherited folder: false");return!1})}};
wrike_ist.wrike.check_valid_task=function(a){var b=cljs.core.__destructure_map(a);a=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,cljs$cst$212$permalink);var c=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,cljs$cst$207$target_branch);b=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,cljs$cst$213$folder_names);var d=cljs.core,e=d.truth_;c=cljs.core.truth_(c)?clojure.string.starts_with_QMARK_(c,"release"):c;if(e.call(d,c)){c=wrike_ist.wrike.get_folder_id(b);if(cljs.core.seq(c)){if(cljs.core.truth_(wrike_ist.wrike.is_wrike_task_in_folder_QMARK_(a,
cljs.core.first(c))))return console.info("Task is in the folder or an inherited folder: true"),Promise.resolve(a);console.error("Task not found");return Promise.reject(Error("Task not found"))}console.error("No matching folder found");return Promise.reject(Error("No matching folder found"))}return null};
b))return console.log("is-wrike-task-in-folder?: Task is in the folder or an inherited folder: true"),!0;d=cljs$cst$211$parentIds.cljs$core$IFn$_invoke$arity$1(d);if(cljs.core.truth_(d))return console.log("is-wrike-task-in-folder?: Task is in the folder or an inherited folder: true"),cljs.core.some(function(e){return cljs.core.contains_QMARK_(cljs$cst$210$folders.cljs$core$IFn$_invoke$arity$1(wrike_ist.wrike.fetch_wrike_task(e)),b)},d);console.log("is-wrike-task-in-folder?: Task is not in the folder or an inherited folder: false");
return!1})}};
wrike_ist.wrike.check_valid_task=function(a){var b=cljs.core.__destructure_map(a);a=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,cljs$cst$212$permalink);var c=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,cljs$cst$207$target_branch);b=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,cljs$cst$213$folder_names);var d=cljs.core,e=d.truth_;c=cljs.core.truth_(c)?clojure.string.starts_with_QMARK_(c,"release"):c;if(e.call(d,c)){c=wrike_ist.wrike.get_folder_id(b);if(cljs.core.seq(c)){if(cljs.core.truth_(wrike_ist.wrike.is_wrike_task_in_folder_QMARK_(a,cljs.core.first(c))))return console.info("check-valid-task: Task is in the folder or an inherited folder: true"),
Promise.resolve(a);console.error("check-valid-task: Task not found");return Promise.reject(Error("Task not found"))}console.error("check-valid-task: No matching folder found");return Promise.reject(Error("check-valid-task: No matching folder found"))}return null};
wrike_ist.wrike.link_pr=function(a){var b=cljs.core.__destructure_map(a),c=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,cljs$cst$206$pr_url);a=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,cljs$cst$212$permalink);return wrike_ist.wrike.find_task(a).then(function(d){d=cljs.core.__destructure_map(d);d=cljs.core.get.cljs$core$IFn$_invoke$arity$2(d,"id");var e=["https://www.wrike.com/api/v4/tasks/",cljs.core.str.cljs$core$IFn$_invoke$arity$1(d),"/comments"].join("");return httpurr.client.node.get(e,
new cljs.core.PersistentArrayMap(null,1,[cljs$cst$183$headers,wrike_ist.wrike.headers()],null)).then(function(f){return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(function(g,h){return cljs.core.truth_(cljs.core.get.cljs$core$IFn$_invoke$arity$2(h,"text").includes(c))?cljs.core.reduced(Promise.reject(cljs$cst$214$present)):g},Promise.resolve(),cljs.core.get.cljs$core$IFn$_invoke$arity$2(wrike_ist.wrike.parse_body(f),"data"))}).then(function(){var f=function(h){h=wrike_ist.wrike.link_html(b);h=
cljs.core.clj__GT_js(new cljs.core.PersistentArrayMap(null,2,[cljs$cst$215$text,h,cljs$cst$216$plainText,!1],null));return httpurr.client.node.post(e,new cljs.core.PersistentArrayMap(null,2,[cljs$cst$183$headers,wrike_ist.wrike.headers(),cljs$cst$184$body,JSON.stringify(h)],null))},g=function(h){var k=null;if(0<arguments.length){k=0;for(var l=Array(arguments.length-0);k<l.length;)l[k]=arguments[k+0],++k;k=new cljs.core.IndexedSeq(l,0,null)}return f.call(this,k)};g.cljs$lang$maxFixedArity=0;g.cljs$lang$applyTo=
function(h){h=cljs.core.seq(h);return f(h)};g.cljs$core$IFn$_invoke$arity$variadic=f;return g}()).then(function(){return console.log("PR link sent to task")}).catch(function(f){return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(f,cljs$cst$214$present)?console.log("PR link already in comments"):Promise.reject(f)})})};
function(h){h=cljs.core.seq(h);return f(h)};g.cljs$core$IFn$_invoke$arity$variadic=f;return g}()).then(function(){return console.log("link-pr: PR link sent to task")}).catch(function(f){return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(f,cljs$cst$214$present)?console.log("link-pr: PR link already in comments"):Promise.reject(f)})})};
wrike_ist.wrike.folder_statuses=function(a){a=["https://www.wrike.com/api/v4/folders/",cljs.core.str.cljs$core$IFn$_invoke$arity$1(a)].join("");return httpurr.client.node.get(a,new cljs.core.PersistentArrayMap(null,1,[cljs$cst$183$headers,wrike_ist.wrike.headers()],null)).then(wrike_ist.wrike.parse_body).then(function(b){b=cljs.core.__destructure_map(b);b=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,"data");b=cljs.core.nth.cljs$core$IFn$_invoke$arity$3(b,0,null);b=cljs.core.__destructure_map(b);
var c=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,"workflowId");return httpurr.client.node.get("https://www.wrike.com/api/v4/workflows",new cljs.core.PersistentArrayMap(null,1,[cljs$cst$183$headers,wrike_ist.wrike.headers()],null)).then(wrike_ist.wrike.parse_body).then(function(d){d=cljs.core.__destructure_map(d);d=cljs.core.get.cljs$core$IFn$_invoke$arity$2(d,"data");return cljs.core.first(cljs.core.filter.cljs$core$IFn$_invoke$arity$2(function(e){return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(cljs.core.get.cljs$core$IFn$_invoke$arity$2(e,
"id"),c)},d))})}).then(function(b){b=cljs.core.__destructure_map(b);b=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,"customStatuses");return cljs.core.filter.cljs$core$IFn$_invoke$arity$2(function(c){return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(cljs.core.get.cljs$core$IFn$_invoke$arity$2(c,"hidden"),!1)},b)})};
wrike_ist.wrike.find_status=function(a,b){b=cljs.core.__destructure_map(b);var c=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,cljs$cst$217$wanted_status),d=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,cljs$cst$218$wanted_group);return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(function(e,f){e=cljs.core.__destructure_map(e);var g=cljs.core.get.cljs$core$IFn$_invoke$arity$2(e,"group");f=cljs.core.__destructure_map(f);var h=cljs.core.get.cljs$core$IFn$_invoke$arity$2(f,"name"),k=cljs.core.get.cljs$core$IFn$_invoke$arity$2(f,
"group");return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(h,c)?cljs.core.reduced(f):cljs.core.truth_(d)?cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(g,d)?e:cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(k,d)?f:null:null},null,a)};wrike_ist.wrike.next_status=function(a,b){return wrike_ist.wrike.folder_statuses(a).then(function(c){c=wrike_ist.wrike.find_status(c,b);return cljs.core.truth_(c)?c:Promise.reject(["No appropriate status found",cljs.core.str.cljs$core$IFn$_invoke$arity$1(b)].join(""))})};
"group");return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(h,c)?cljs.core.reduced(f):cljs.core.truth_(d)?cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(g,d)?e:cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(k,d)?f:null:null},null,a)};wrike_ist.wrike.next_status=function(a,b){return wrike_ist.wrike.folder_statuses(a).then(function(c){c=wrike_ist.wrike.find_status(c,b);return cljs.core.truth_(c)?c:Promise.reject(["next-status: No appropriate status found",cljs.core.str.cljs$core$IFn$_invoke$arity$1(b)].join(""))})};
wrike_ist.wrike.update_task_status=function(a,b){a=cljs.core.__destructure_map(a);var c=cljs.core.get.cljs$core$IFn$_invoke$arity$2(a,"id");a=cljs.core.get.cljs$core$IFn$_invoke$arity$2(a,"parentIds");a=cljs.core.nth.cljs$core$IFn$_invoke$arity$3(a,0,null);return wrike_ist.wrike.next_status(a,b).then(function(d){d=cljs.core.__destructure_map(d);var e=cljs.core.get.cljs$core$IFn$_invoke$arity$2(d,"id");d=["https://www.wrike.com/api/v4/tasks/",cljs.core.str.cljs$core$IFn$_invoke$arity$1(c)].join("");
e=cljs.core.clj__GT_js(new cljs.core.PersistentArrayMap(null,1,[cljs$cst$219$customStatus,e],null));return httpurr.client.node.put(d,new cljs.core.PersistentArrayMap(null,2,[cljs$cst$183$headers,wrike_ist.wrike.headers(),cljs$cst$184$body,JSON.stringify(e)],null))})};
wrike_ist.wrike.progress_task=function(a,b){a=cljs.core.__destructure_map(a);a=cljs.core.get.cljs$core$IFn$_invoke$arity$2(a,cljs$cst$212$permalink);return cljs.core.truth_(cljs.core.not_empty(b))?wrike_ist.wrike.find_task(a).then(function(c){return wrike_ist.wrike.update_task_status(c,new cljs.core.PersistentArrayMap(null,1,[cljs$cst$217$wanted_status,b],null))}):null};
wrike_ist.wrike.complete_task=function(a,b){a=cljs.core.__destructure_map(a);a=cljs.core.get.cljs$core$IFn$_invoke$arity$2(a,cljs$cst$212$permalink);return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2("-",b)?console.log('Skipping `merged` transition because it\'s set to "-"'):wrike_ist.wrike.find_task(a).then(function(c){return wrike_ist.wrike.update_task_status(c,new cljs.core.PersistentArrayMap(null,2,[cljs$cst$217$wanted_status,b,cljs$cst$218$wanted_group,"Completed"],null))})};
wrike_ist.wrike.cancel_task=function(a,b){a=cljs.core.__destructure_map(a);a=cljs.core.get.cljs$core$IFn$_invoke$arity$2(a,cljs$cst$212$permalink);return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2("-",b)?console.log('Skipping `closed` transition because it\'s set to "-"'):wrike_ist.wrike.find_task(a).then(function(c){return wrike_ist.wrike.update_task_status(c,new cljs.core.PersistentArrayMap(null,2,[cljs$cst$217$wanted_status,b,cljs$cst$218$wanted_group,"Cancelled"],null))})};wrike_ist.core={};wrike_ist.core.find_links=function(a){return cljs.core.not_empty(cljs.core.re_seq(/\bhttps:\/\/www\.wrike\.com\/open\.htm\?id=\d+\b/,a))};
wrike_ist.wrike.complete_task=function(a,b){a=cljs.core.__destructure_map(a);a=cljs.core.get.cljs$core$IFn$_invoke$arity$2(a,cljs$cst$212$permalink);return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2("-",b)?console.log('complete-task: Skipping `merged` transition because it\'s set to "-"'):wrike_ist.wrike.find_task(a).then(function(c){return wrike_ist.wrike.update_task_status(c,new cljs.core.PersistentArrayMap(null,2,[cljs$cst$217$wanted_status,b,cljs$cst$218$wanted_group,"Completed"],null))})};
wrike_ist.wrike.cancel_task=function(a,b){a=cljs.core.__destructure_map(a);a=cljs.core.get.cljs$core$IFn$_invoke$arity$2(a,cljs$cst$212$permalink);return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2("-",b)?console.log('cancel-task: Skipping `closed` transition because it\'s set to "-"'):wrike_ist.wrike.find_task(a).then(function(c){return wrike_ist.wrike.update_task_status(c,new cljs.core.PersistentArrayMap(null,2,[cljs$cst$217$wanted_status,b,cljs$cst$218$wanted_group,"Cancelled"],null))})};wrike_ist.core={};wrike_ist.core.find_links=function(a){return cljs.core.not_empty(cljs.core.re_seq(/\bhttps:\/\/www\.wrike\.com\/open\.htm\?id=\d+\b/,a))};
wrike_ist.core.extract_details=function(a){var b=a.body;if(cljs.core.truth_(b)&&(b=wrike_ist.core.find_links(b),cljs.core.truth_(b))){var c=a.merged?cljs$cst$220$merged:cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(a.state,"closed")?cljs$cst$221$closed:a.draft?cljs$cst$222$draft:cljs$cst$223$open,d=a.html_url,e=a.title,f=a.number,g=a.base.ref,h=a.head.repo.name;return cljs.core.map.cljs$core$IFn$_invoke$arity$2(function(k){return new cljs.core.PersistentArrayMap(null,7,[cljs$cst$224$state,c,cljs$cst$212$permalink,
k,cljs$cst$206$pr_url,d,cljs$cst$205$id,f,cljs$cst$209$title,e,cljs$cst$207$target_branch,g,cljs$cst$208$repository_name,h],null)},b)}return null};
wrike_ist.core.main=function(){var a=shadow.js.shim.module$$actions$github.context.payload,b=a.pull_request;if(cljs.core.truth_(b))for(var c=wrike_ist.core.extract_details(b);;){var d=cljs.core.first(c);if(cljs.core.truth_(d)){var e=d,f=cljs.core.__destructure_map(e),g=f,h=cljs.core.get.cljs$core$IFn$_invoke$arity$2(f,cljs$cst$224$state);(function(){var k=h;switch(k instanceof cljs.core.Keyword?k.fqn:null){case "draft":return Promise.all(new cljs.core.PersistentVector(null,2,5,cljs.core.PersistentVector.EMPTY_NODE,
Expand Down
Loading

0 comments on commit 9429ef8

Please sign in to comment.