Skip to content

Commit

Permalink
improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushgaud committed Nov 15, 2023
1 parent 7bcad84 commit 8a50638
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12346,9 +12346,9 @@ r,b));q+=1}else{m=!0;break a}return m?cljs.core.chunk_cons(cljs.core.chunk(p),k(
wrike_ist.wrike.is_wrike_task_in_folder_QMARK_=function(a){return wrike_ist.wrike.find_task(a).then(function(b){var c=cljs.core.__destructure_map(b);b=cljs.core.get.cljs$core$IFn$_invoke$arity$2(c,"id");var d=cljs.core.get.cljs$core$IFn$_invoke$arity$2(c,"parentIds"),e=cljs.core.get.cljs$core$IFn$_invoke$arity$2(c,"superParentIds");c=cljs.core.get.cljs$core$IFn$_invoke$arity$2(c,"title");console.info(["is-wrike-task-in-folder?: Task Name: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(c)," id: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(b),
" parentIds: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(d)," superParentIds: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(e)].join(""));console.info(["is-wrike-task-in-folder?: Folder names to match: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(wrike_ist.wrike.folder_names)].join(""));var f=cljs.core.concat.cljs$core$IFn$_invoke$arity$2(d,e);b=function(){return function k(h){return new cljs.core.LazySeq(null,function(){for(;;){var l=cljs.core.seq(h);if(l){if(cljs.core.chunked_seq_QMARK_(l)){var m=
cljs.core.chunk_first(l),n=cljs.core.count(m),p=cljs.core.chunk_buffer(n);a:for(var q=0;;)if(q<n){var r=cljs.core._nth(m,q);r=wrike_ist.wrike.fetch_folder_details(r,wrike_ist.wrike.folder_names);cljs.core.chunk_append(p,r);q+=1}else{m=!0;break a}return m?cljs.core.chunk_cons(cljs.core.chunk(p),k(cljs.core.chunk_rest(l))):cljs.core.chunk_cons(cljs.core.chunk(p),null)}p=cljs.core.first(l);p=wrike_ist.wrike.fetch_folder_details(p,wrike_ist.wrike.folder_names);return cljs.core.cons(p,k(cljs.core.rest(l)))}return null}},
null,null)}(f)}();Promise.all(b);return Promise.all(b).then(function(g){if(cljs.core.truth_(cljs.core.some(cljs.core.true_QMARK_,g)))return console.info("is-wrike-task-in-folder?: Matching folders found"),!0;console.info("is-wrike-task-in-folder?: No matching folders found");return!1})})};
wrike_ist.wrike.check_valid_task=function(a,b){return new Promise(function(c,d){return cljs.core.truth_(cljs.core.truth_(b)?clojure.string.starts_with_QMARK_(b,"release"):b)?wrike_ist.wrike.is_wrike_task_in_folder_QMARK_(a).then(function(e){if(cljs.core.truth_(e))return console.info("check-valid-task: Task is in the folder or an inherited folder: true"),c.cljs$core$IFn$_invoke$arity$1?c.cljs$core$IFn$_invoke$arity$1(a):c.call(null,a);console.error("check-valid-task: Task not found in folder");e=Error("check-valid-task: Task not found in folder");
return d.cljs$core$IFn$_invoke$arity$1?d.cljs$core$IFn$_invoke$arity$1(e):d.call(null,e)}):null})};
null,null)}(f)}();Promise.all(b);return Promise.all(b).then(function(g){if(cljs.core.truth_(cljs.core.some(cljs.core.true_QMARK_,g)))return console.info("is-wrike-task-in-folder?: Matching folders found"),!0;console.info("is-wrike-task-in-folder?: Task is not part of one of the required folders: ",wrike_ist.wrike.folder_names);return!1})})};
wrike_ist.wrike.check_valid_task=function(a,b){return new Promise(function(c,d){return cljs.core.truth_(cljs.core.truth_(b)?clojure.string.starts_with_QMARK_(b,"release"):b)?(console.info("check-valid-task: PR is target to release branch, checking task folder validity"),wrike_ist.wrike.is_wrike_task_in_folder_QMARK_(a).then(function(e){if(cljs.core.truth_(e))return console.info("check-valid-task: Task is in the folder or an inherited folder: true"),c.cljs$core$IFn$_invoke$arity$1?c.cljs$core$IFn$_invoke$arity$1(a):
c.call(null,a);console.error("check-valid-task: Task not found in folder");e=Error("check-valid-task: Task not found in folder");return d.cljs$core$IFn$_invoke$arity$1?d.cljs$core$IFn$_invoke$arity$1(e):d.call(null,e)})):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$210$permalink);var d=cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,cljs$cst$207$target_branch),e=wrike_ist.wrike.check_valid_task(a,d);return wrike_ist.wrike.find_task(a).then(function(f){f=cljs.core.__destructure_map(f);f=cljs.core.get.cljs$core$IFn$_invoke$arity$2(f,"id");var g=["https://www.wrike.com/api/v4/tasks/",
cljs.core.str.cljs$core$IFn$_invoke$arity$1(f),"/comments"].join("");return httpurr.client.node.get(g,new cljs.core.PersistentArrayMap(null,1,[cljs$cst$183$headers,wrike_ist.wrike.headers()],null)).then(function(h){return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(function(k,l){return cljs.core.truth_(cljs.core.get.cljs$core$IFn$_invoke$arity$2(l,"text").includes(c))?cljs.core.reduced(Promise.reject(cljs$cst$211$present)):k},Promise.resolve(),cljs.core.get.cljs$core$IFn$_invoke$arity$2(wrike_ist.wrike.parse_body(h),
"data"))}).then(function(){var h=function(l){l=wrike_ist.wrike.link_html(b);l=cljs.core.clj__GT_js(new cljs.core.PersistentArrayMap(null,2,[cljs$cst$212$text,l,cljs$cst$213$plainText,!1],null));return httpurr.client.node.post(g,new cljs.core.PersistentArrayMap(null,2,[cljs$cst$183$headers,wrike_ist.wrike.headers(),cljs$cst$184$body,JSON.stringify(l)],null))},k=function(l){var m=null;if(0<arguments.length){m=0;for(var n=Array(arguments.length-0);m<n.length;)n[m]=arguments[m+0],++m;m=new cljs.core.IndexedSeq(n,
Expand Down
6 changes: 3 additions & 3 deletions resources/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/wrike_ist/wrike.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
(.info js/console (str "is-wrike-task-in-folder?: Matching folders found"))
true)
(do
(.info js/console "is-wrike-task-in-folder?: No matching folders found")
(.info js/console "is-wrike-task-in-folder?: Task is not part of one of the required folders: " folder-names)
false))))))))


Expand All @@ -97,6 +97,7 @@
(js/Promise.
(fn [resolve reject]
(when (and target-branch (str/starts-with? target-branch "release"))
(.info js/console (str "check-valid-task: PR is target to release branch, checking task folder validity"))
(let [task-in-folder-promise (is-wrike-task-in-folder? permalink)]
(.then task-in-folder-promise
(fn [task-in-folder?]
Expand Down

0 comments on commit 8a50638

Please sign in to comment.