nbgitpuller-jl-interface 0.4.0__tar.gz → 1.0.0__tar.gz

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.
Files changed (52) hide show
  1. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/CHANGELOG.md +25 -2
  2. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/PKG-INFO +9 -1
  3. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/README.md +8 -0
  4. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/nbgitpuller_jl_interface/_version.py +1 -1
  5. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/nbgitpuller_jl_interface/labextension/package.json +2 -2
  6. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/nbgitpuller_jl_interface/labextension/schemas/nbgitpuller-jl-interface/package.json.orig +1 -1
  7. nbgitpuller_jl_interface-1.0.0/nbgitpuller_jl_interface/labextension/static/293.488357a8d6ce24253311.js +1 -0
  8. nbgitpuller_jl_interface-0.4.0/nbgitpuller_jl_interface/labextension/static/remoteEntry.b83083f7b0a432020f55.js → nbgitpuller_jl_interface-1.0.0/nbgitpuller_jl_interface/labextension/static/remoteEntry.4caf41ad4e8e084aba3e.js +1 -1
  9. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/nbgitpuller_jl_interface/routes.py +1 -1
  10. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/nbgitpuller_jl_interface/utils.py +14 -2
  11. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/package.json +1 -1
  12. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/src/__tests__/nbgitpuller_jb_interface.spec.ts +25 -0
  13. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/src/utils.ts +10 -7
  14. nbgitpuller_jl_interface-0.4.0/nbgitpuller_jl_interface/labextension/static/293.24f6a6ad6689d54e2835.js +0 -1
  15. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/.copier-answers.yml +0 -0
  16. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/.gitignore +0 -0
  17. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/.prettierignore +0 -0
  18. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/.vscode/settings.json +0 -0
  19. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/.yarnrc.yml +0 -0
  20. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/LICENSE +0 -0
  21. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/RELEASE.md +0 -0
  22. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/babel.config.js +0 -0
  23. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/conftest.py +0 -0
  24. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/install.json +0 -0
  25. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/jest.config.js +0 -0
  26. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/jupyter-config/server-config/nbgitpuller_jl_interface.json +0 -0
  27. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/nbgitpuller_jl_interface/__init__.py +0 -0
  28. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/nbgitpuller_jl_interface/labextension/schemas/nbgitpuller-jl-interface/plugin.json +0 -0
  29. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/nbgitpuller_jl_interface/labextension/static/728.1316db9caad2256ea253.js +0 -0
  30. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/nbgitpuller_jl_interface/labextension/static/style.js +0 -0
  31. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/nbgitpuller_jl_interface/labextension/static/third-party-licenses.json +0 -0
  32. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/nbgitpuller_jl_interface/tests/__init__.py +0 -0
  33. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/nbgitpuller_jl_interface/tests/test_routes.py +0 -0
  34. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/nbgitpuller_jl_interface/tests/test_utils.py +0 -0
  35. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/pyproject.toml +0 -0
  36. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/schema/plugin.json +0 -0
  37. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/setup.py +0 -0
  38. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/src/index.ts +0 -0
  39. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/src/request.ts +0 -0
  40. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/style/base.css +0 -0
  41. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/style/index.css +0 -0
  42. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/style/index.js +0 -0
  43. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/style/tmp_logo.svg +0 -0
  44. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/tsconfig.json +0 -0
  45. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/tsconfig.test.json +0 -0
  46. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/ui-tests/README.md +0 -0
  47. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/ui-tests/jupyter_server_test_config.py +0 -0
  48. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/ui-tests/package.json +0 -0
  49. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/ui-tests/playwright.config.js +0 -0
  50. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/ui-tests/tests/nbgitpuller_jl_interface.spec.ts +0 -0
  51. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/ui-tests/yarn.lock +0 -0
  52. {nbgitpuller_jl_interface-0.4.0 → nbgitpuller_jl_interface-1.0.0}/yarn.lock +0 -0
@@ -2,6 +2,31 @@
2
2
 
3
3
  <!-- <START NEW CHANGELOG ENTRY> -->
4
4
 
5
+ ## 1.0.0
6
+
7
+ ([Full Changelog](https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/compare/v0.4.0...759fb6102164f8863a7b43141b34c915d43fe5bd))
8
+
9
+ ### Enhancements made
10
+
11
+ - [OSL-4409] fix: improve formatting of error message [#9](https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/pull/9) ([@dgpalmieri](https://github.com/dgpalmieri), [@Alex-Lewandowski](https://github.com/Alex-Lewandowski), [@emlundell](https://github.com/emlundell))
12
+ - add additional check for if branch is valid [#7](https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/pull/7) ([@segallagher](https://github.com/segallagher), [@emlundell](https://github.com/emlundell))
13
+
14
+ ### Documentation improvements
15
+
16
+ - refactor: reword notebooks to repositories [#8](https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/pull/8) ([@segallagher](https://github.com/segallagher), [@dgpalmieri](https://github.com/dgpalmieri), [@emlundell](https://github.com/emlundell))
17
+ - docs: add note about git cred prompting to readme [#6](https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/pull/6) ([@dgpalmieri](https://github.com/dgpalmieri), [@segallagher](https://github.com/segallagher))
18
+
19
+ ### Contributors to this release
20
+
21
+ The following people contributed discussions, new ideas, code and documentation contributions, and review.
22
+ See [our definition of contributors](https://github-activity.readthedocs.io/en/latest/use/#how-does-this-tool-define-contributions-in-the-reports).
23
+
24
+ ([GitHub contributors page for this release](https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/graphs/contributors?from=2026-04-15&to=2026-04-22&type=c))
25
+
26
+ @Alex-Lewandowski ([activity](https://github.com/search?q=repo%3AASFOpenSARlab%2Fnbgitpuller-jl-interface+involves%3AAlex-Lewandowski+updated%3A2026-04-15..2026-04-22&type=Issues)) | @dgpalmieri ([activity](https://github.com/search?q=repo%3AASFOpenSARlab%2Fnbgitpuller-jl-interface+involves%3Adgpalmieri+updated%3A2026-04-15..2026-04-22&type=Issues)) | @emlundell ([activity](https://github.com/search?q=repo%3AASFOpenSARlab%2Fnbgitpuller-jl-interface+involves%3Aemlundell+updated%3A2026-04-15..2026-04-22&type=Issues)) | @segallagher ([activity](https://github.com/search?q=repo%3AASFOpenSARlab%2Fnbgitpuller-jl-interface+involves%3Asegallagher+updated%3A2026-04-15..2026-04-22&type=Issues))
27
+
28
+ <!-- <END NEW CHANGELOG ENTRY> -->
29
+
5
30
  ## 0.4.0
6
31
 
7
32
  ([Full Changelog](https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/compare/v0.3.0...c0858bae9a3c63097a47872caeb0332071433e10))
@@ -19,8 +44,6 @@ See [our definition of contributors](https://github-activity.readthedocs.io/en/l
19
44
 
20
45
  @bbuechler ([activity](https://github.com/search?q=repo%3AASFOpenSARlab%2Fnbgitpuller-jl-interface+involves%3Abbuechler+updated%3A2026-04-10..2026-04-15&type=Issues)) | @dgpalmieri ([activity](https://github.com/search?q=repo%3AASFOpenSARlab%2Fnbgitpuller-jl-interface+involves%3Adgpalmieri+updated%3A2026-04-10..2026-04-15&type=Issues)) | @segallagher ([activity](https://github.com/search?q=repo%3AASFOpenSARlab%2Fnbgitpuller-jl-interface+involves%3Asegallagher+updated%3A2026-04-10..2026-04-15&type=Issues))
21
46
 
22
- <!-- <END NEW CHANGELOG ENTRY> -->
23
-
24
47
  ## 0.3.0
25
48
 
26
49
  ([Full Changelog](https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/compare/v0.2.5...eab8732c960fecc43d3cda8560330cc3b692a5bf))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbgitpuller_jl_interface
3
- Version: 0.4.0
3
+ Version: 1.0.0
4
4
  Summary: A human interface with nbgitpuller in JupyterBook
5
5
  Project-URL: Homepage, https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface
6
6
  Project-URL: Bug Tracker, https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/issues
@@ -111,6 +111,14 @@ the frontend extension, check the frontend extension is installed:
111
111
  jupyter labextension list
112
112
  ```
113
113
 
114
+ If `git` is asking for credentials on the command line when deployed locally
115
+ (you may have mistyped your url!), add the following lines to `~/.gitconfig`:
116
+
117
+ ```bash
118
+ [credential "https://github.com"]
119
+ helper = !/usr/bin/gh auth git-credential
120
+ ```
121
+
114
122
  ## Contributing
115
123
 
116
124
  ### Development install
@@ -45,6 +45,14 @@ the frontend extension, check the frontend extension is installed:
45
45
  jupyter labextension list
46
46
  ```
47
47
 
48
+ If `git` is asking for credentials on the command line when deployed locally
49
+ (you may have mistyped your url!), add the following lines to `~/.gitconfig`:
50
+
51
+ ```bash
52
+ [credential "https://github.com"]
53
+ helper = !/usr/bin/gh auth git-credential
54
+ ```
55
+
48
56
  ## Contributing
49
57
 
50
58
  ### Development install
@@ -1,4 +1,4 @@
1
1
  # This file is auto-generated by Hatchling. As such, do not:
2
2
  # - modify
3
3
  # - track in version control e.g. be sure to add to .gitignore
4
- __version__ = VERSION = '0.4.0'
4
+ __version__ = VERSION = '1.0.0'
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nbgitpuller-jl-interface",
3
- "version": "0.4.0",
3
+ "version": "1.0.0",
4
4
  "description": "A human interface with nbgitpuller in JupyterBook",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -117,7 +117,7 @@
117
117
  "outputDir": "nbgitpuller_jl_interface/labextension",
118
118
  "schemaDir": "schema",
119
119
  "_build": {
120
- "load": "static/remoteEntry.b83083f7b0a432020f55.js",
120
+ "load": "static/remoteEntry.4caf41ad4e8e084aba3e.js",
121
121
  "extension": "./extension",
122
122
  "style": "./style"
123
123
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nbgitpuller-jl-interface",
3
- "version": "0.4.0",
3
+ "version": "1.0.0",
4
4
  "description": "A human interface with nbgitpuller in JupyterBook",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunknbgitpuller_jl_interface=self.webpackChunknbgitpuller_jl_interface||[]).push([[293],{293(e,t,n){n.r(t),n.d(t,{default:()=>y,getJupyterAppInstance:()=>b});var i=n(813),o=n(53),r=n(247),a=n(41);const s="nbgitpuller-jl-interface-update-btn";let l,p=!1;async function c(e){const t=await async function(e){var t;let n=0,i=0;for(const o of e){const e=o.repoUrl,r=o.branch,s=o.destPath,l=a.PageConfig.getBaseUrl(),p=a.URLExt.join(l,"nbgitpuller-jl-interface","update-check"),c=null===(t=document.cookie.split(";").find(e=>e.startsWith("_xsrf=")))||void 0===t?void 0:t.split("=")[1],d=await fetch(p,{method:"POST",headers:{"Content-Type":"application/json","X-XSRFToken":null!=c?c:""},body:JSON.stringify({repositoryUrl:e,repositoryBranch:r,destination:s})}),u=await d.json();0!==u.returncode?i+=1:u.updatefound&&(n+=1)}return{response:{numToBeUpdated:n,numWithErrors:i},statuscode:0}}(e);if(0===t.statuscode){const n=t.response;let i,o;n.numWithErrors>0?(i=`${n.numWithErrors} repositories with errors`,o=d.Error):n.numToBeUpdated>0?(i=`${n.numToBeUpdated} repositories awaiting updates\n`,o=d.UpdateRequired):(i=`${e.length} repositories up to date`,o=d.UpToDate);const r=await u(o,i);0!==r.returncode&&console.error(r)}}var d;async function u(e,t){const n=document.getElementById(s);if(!n)return{error:"Unable to find nbgitpuller widget",returncode:1};let i;if(e===d.UpToDate)i='<p><span class="success">◉</span> Up to Date</p>';else if(e===d.Updating)i='<p><span class="lds-dual-ring"></span> Updating</p>';else if(e===d.UpdateRequired)i='<p><span class="pending blink">◉</span> Update Repositories</p>';else if(e===d.Error)i='<p><span class="failure blink">◉</span> Update Error</p>';else{if(e!==d.Initializing)return{error:"Unknown widget state",returncode:2};i='<p><span class="">◉</span> Initializing</p>'}return n.title=t,n.innerHTML=function(e){return`\n <jp-button class="nbgitpuller-jl-interface-update-btn jp-ToolbarButtonComponent">\n ${e}\n </jp-button>`}(i),{error:"",returncode:0}}!function(e){e[e.UpToDate=0]="UpToDate",e[e.UpdateRequired=1]="UpdateRequired",e[e.Updating=2]="Updating",e[e.Error=3]="Error",e[e.Initializing=4]="Initializing"}(d||(d={}));var g=n(726),f=n(778);let h=null;function b(e){if(!h&&e&&(h=e),!h)throw new Error("App instance has not been initialized yet");return h}const w={id:"nbgitpuller-jl-interface:plugin",description:"A human interface with nbgitpuller in JupyterBook",autoStart:!0,optional:[],requires:[i.ILabShell,f.ICommandPalette,g.ISettingRegistry,i.JupyterFrontEnd.IPaths],activate:(e,t,n,i,g)=>{i?(Promise.all([e.restored,i.load(w.id)]).then(async([,t])=>{async function n(t){t.get("reloadWidget").composite&&(await async function(e,t){const n=t.get("repos").composite,i=t.get("rank").composite,l=(0,o.find)(e.shell.widgets("top"),e=>e.id===s);l&&l.dispose();const g=new r.Widget;g.id=s,g.addClass("lm-Widget"),g.addClass("jp-ToolbarButton"),g.addClass("nbgitpuller-jl-interface-wrapper"),g.node.addEventListener("click",async()=>{if(p)return;p=!0,await u(d.Updating,"Updating GitHub Repositories...");const e=await async function(e){var t;const n=a.PageConfig.getBaseUrl(),i=a.URLExt.join(n,"nbgitpuller-jl-interface","gitpuller"),o=null===(t=document.cookie.split(";").find(e=>e.startsWith("_xsrf=")))||void 0===t?void 0:t.split("=")[1],r=[];for(const t of e){const e=t.repoUrl,n=t.branch,a=t.destPath,s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json","X-XSRFToken":null!=o?o:""},body:JSON.stringify({repositoryUrl:e,repositoryBranch:n,destination:a})}),l=await s.json();0!==l.returncode&&r.push({repo:e,reason:l.error})}return r}(n);if(await c(n),0!==e.length){let t="Failed to update the following repositories: \n";for(const n of e)t+=`- ${n.repo}\n`;t+="If you require assistance with resolving this issue, please contact your platform administrators.",console.log(t),alert(t)}p=!1}),e.shell.add(g,"top",{rank:i}),await new Promise(e=>setTimeout(e,1e3)),await c(n),console.log("nbgitpuller-jl-interface settings loaded")}(e,t),await async function(e){const t=e.get("repos").composite,n=e.get("probeInterval").composite;clearInterval(l),l=setInterval(async()=>{await c(t)},n)}(t),await t.set("reloadWidget",!1))}await t.set("reloadWidget",!0),n(t),t.changed.connect(n),console.log("JupyterLab extension nbgitpuller-jl-interface is fully operational!")}).catch(e=>{console.error(`Something went wrong...${e}`)}),console.log("JupyterLab extension nbgitpuller-jl-interface is activated!")):console.log("Settings not found. nbgitpuller-jl-interface cannot be established.")}},y=w}}]);
@@ -1 +1 @@
1
- var _JUPYTERLAB;(()=>{"use strict";var e,r,t,n,o,a,i,l,u,f,s,d,p,c,h,v,g,b,m,y={234(e,r,t){var n={"./index":()=>t.e(293).then(()=>()=>t(293)),"./extension":()=>t.e(293).then(()=>()=>t(293)),"./style":()=>t.e(728).then(()=>()=>t(728))},o=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then(()=>{throw new Error('Module "'+e+'" does not exist in container.')}),t.R=void 0,r),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>a})}},w={};function j(e){var r=w[e];if(void 0!==r)return r.exports;var t=w[e]={id:e,exports:{}};return y[e](t,t.exports,j),t.exports}j.m=y,j.c=w,j.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return j.d(r,{a:r}),r},j.d=(e,r)=>{for(var t in r)j.o(r,t)&&!j.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},j.f={},j.e=e=>Promise.all(Object.keys(j.f).reduce((r,t)=>(j.f[t](e,r),r),[])),j.u=e=>e+"."+{293:"24f6a6ad6689d54e2835",728:"1316db9caad2256ea253"}[e]+".js?v="+{293:"24f6a6ad6689d54e2835",728:"1316db9caad2256ea253"}[e],j.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),j.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="nbgitpuller-jl-interface:",j.l=(t,n,o,a)=>{if(e[t])e[t].push(n);else{var i,l;if(void 0!==o)for(var u=document.getElementsByTagName("script"),f=0;f<u.length;f++){var s=u[f];if(s.getAttribute("src")==t||s.getAttribute("data-webpack")==r+o){i=s;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",j.nc&&i.setAttribute("nonce",j.nc),i.setAttribute("data-webpack",r+o),i.src=t),e[t]=[n];var d=(r,n)=>{i.onerror=i.onload=null,clearTimeout(p);var o=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(n)),r)return r(n)},p=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),l&&document.head.appendChild(i)}},j.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{j.S={};var e={},r={};j.I=(t,n)=>{n||(n=[]);var o=r[t];if(o||(o=r[t]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[t])return e[t];j.o(j.S,t)||(j.S[t]={});var a=j.S[t],i="nbgitpuller-jl-interface",l=[];return"default"===t&&((e,r,t,n)=>{var o=a[e]=a[e]||{},l=o[r];(!l||!l.loaded&&(1!=!l.eager?n:i>l.from))&&(o[r]={get:()=>j.e(293).then(()=>()=>j(293)),from:i,eager:!1})})("nbgitpuller-jl-interface","0.4.0"),e[t]=l.length?Promise.all(l).then(()=>e[t]=1):1}}})(),(()=>{var e;j.g.importScripts&&(e=j.g.location+"");var r=j.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),j.p=e})(),t=e=>{var r=e=>e.split(".").map(e=>+e==e?+e:e),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},n=(e,r)=>{e=t(e),r=t(r);for(var n=0;;){if(n>=e.length)return n<r.length&&"u"!=(typeof r[n])[0];var o=e[n],a=(typeof o)[0];if(n>=r.length)return"u"==a;var i=r[n],l=(typeof i)[0];if(a!=l)return"o"==a&&"n"==l||"s"==l||"u"==a;if("o"!=a&&"u"!=a&&o!=i)return o<i;n++}},o=e=>{var r=e[0],t="";if(1===e.length)return"*";if(r+.5){t+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var n=1,a=1;a<e.length;a++)n--,t+="u"==(typeof(l=e[a]))[0]?"-":(n>0?".":"")+(n=2,l);return t}var i=[];for(a=1;a<e.length;a++){var l=e[a];i.push(0===l?"not("+u()+")":1===l?"("+u()+" || "+u()+")":2===l?i.pop()+" "+i.pop():o(l))}return u();function u(){return i.pop().replace(/^\((.+)\)$/,"$1")}},a=(e,r)=>{if(0 in e){r=t(r);var n=e[0],o=n<0;o&&(n=-n-1);for(var i=0,l=1,u=!0;;l++,i++){var f,s,d=l<e.length?(typeof e[l])[0]:"";if(i>=r.length||"o"==(s=(typeof(f=r[i]))[0]))return!u||("u"==d?l>n&&!o:""==d!=o);if("u"==s){if(!u||"u"!=d)return!1}else if(u)if(d==s)if(l<=n){if(f!=e[l])return!1}else{if(o?f>e[l]:f<e[l])return!1;f!=e[l]&&(u=!1)}else if("s"!=d&&"n"!=d){if(o||l<=n)return!1;u=!1,l--}else{if(l<=n||s<d!=o)return!1;u=!1}else"s"!=d&&"n"!=d&&(u=!1,l--)}}var p=[],c=p.pop.bind(p);for(i=1;i<e.length;i++){var h=e[i];p.push(1==h?c()|c():2==h?c()&c():h?a(h,r):!c())}return!!c()},i=(e,r)=>e&&j.o(e,r),l=e=>(e.loaded=1,e.get()),u=e=>Object.keys(e).reduce((r,t)=>(e[t].eager&&(r[t]=e[t]),r),{}),f=(e,r,t)=>{var o=t?u(e[r]):e[r];return Object.keys(o).reduce((e,r)=>!e||!o[e].loaded&&n(e,r)?r:e,0)},s=(e,r,t,n)=>"Unsatisfied version "+t+" from "+(t&&e[r][t].from)+" of shared singleton module "+r+" (required "+o(n)+")",d=e=>{throw new Error(e)},p=e=>{"undefined"!=typeof console&&console.warn&&console.warn(e)},c=(e,r,t)=>t?t():((e,r)=>d("Shared module "+r+" doesn't exist in shared scope "+e))(e,r),h=(e=>function(r,t,n,o,a){var i=j.I(r);return i&&i.then&&!n?i.then(e.bind(e,r,j.S[r],t,!1,o,a)):e(r,j.S[r],t,n,o,a)})((e,r,t,n,o,u)=>{if(!i(r,t))return c(e,t,u);var d=f(r,t,n);return a(o,d)||p(s(r,t,d,o)),l(r[t][d])}),v={},g={41:()=>h("default","@jupyterlab/coreutils",!1,[1,6,5,6]),53:()=>h("default","@lumino/algorithm",!1,[1,2,0,0]),247:()=>h("default","@lumino/widgets",!1,[1,2,3,1,,"alpha",1]),726:()=>h("default","@jupyterlab/settingregistry",!1,[1,4,5,6]),778:()=>h("default","@jupyterlab/apputils",!1,[1,4,6,6]),813:()=>h("default","@jupyterlab/application",!1,[1,4,5,6])},b={293:[41,53,247,726,778,813]},m={},j.f.consumes=(e,r)=>{j.o(b,e)&&b[e].forEach(e=>{if(j.o(v,e))return r.push(v[e]);if(!m[e]){var t=r=>{v[e]=0,j.m[e]=t=>{delete j.c[e],t.exports=r()}};m[e]=!0;var n=r=>{delete v[e],j.m[e]=t=>{throw delete j.c[e],r}};try{var o=g[e]();o.then?r.push(v[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}})},(()=>{var e={34:0};j.f.j=(r,t)=>{var n=j.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((t,o)=>n=e[r]=[t,o]);t.push(n[2]=o);var a=j.p+j.u(r),i=new Error;j.l(a,t=>{if(j.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[a,i,l]=t,u=0;if(a.some(r=>0!==e[r])){for(n in i)j.o(i,n)&&(j.m[n]=i[n]);l&&l(j)}for(r&&r(t);u<a.length;u++)o=a[u],j.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=self.webpackChunknbgitpuller_jl_interface=self.webpackChunknbgitpuller_jl_interface||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),j.nc=void 0;var S=j(234);(_JUPYTERLAB=void 0===_JUPYTERLAB?{}:_JUPYTERLAB)["nbgitpuller-jl-interface"]=S})();
1
+ var _JUPYTERLAB;(()=>{"use strict";var e,r,t,n,o,a,i,l,u,f,s,d,p,c,h,v,g,b,m,y={234(e,r,t){var n={"./index":()=>t.e(293).then(()=>()=>t(293)),"./extension":()=>t.e(293).then(()=>()=>t(293)),"./style":()=>t.e(728).then(()=>()=>t(728))},o=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then(()=>{throw new Error('Module "'+e+'" does not exist in container.')}),t.R=void 0,r),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>a})}},w={};function j(e){var r=w[e];if(void 0!==r)return r.exports;var t=w[e]={id:e,exports:{}};return y[e](t,t.exports,j),t.exports}j.m=y,j.c=w,j.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return j.d(r,{a:r}),r},j.d=(e,r)=>{for(var t in r)j.o(r,t)&&!j.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},j.f={},j.e=e=>Promise.all(Object.keys(j.f).reduce((r,t)=>(j.f[t](e,r),r),[])),j.u=e=>e+"."+{293:"488357a8d6ce24253311",728:"1316db9caad2256ea253"}[e]+".js?v="+{293:"488357a8d6ce24253311",728:"1316db9caad2256ea253"}[e],j.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),j.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="nbgitpuller-jl-interface:",j.l=(t,n,o,a)=>{if(e[t])e[t].push(n);else{var i,l;if(void 0!==o)for(var u=document.getElementsByTagName("script"),f=0;f<u.length;f++){var s=u[f];if(s.getAttribute("src")==t||s.getAttribute("data-webpack")==r+o){i=s;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",j.nc&&i.setAttribute("nonce",j.nc),i.setAttribute("data-webpack",r+o),i.src=t),e[t]=[n];var d=(r,n)=>{i.onerror=i.onload=null,clearTimeout(p);var o=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(n)),r)return r(n)},p=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),l&&document.head.appendChild(i)}},j.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{j.S={};var e={},r={};j.I=(t,n)=>{n||(n=[]);var o=r[t];if(o||(o=r[t]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[t])return e[t];j.o(j.S,t)||(j.S[t]={});var a=j.S[t],i="nbgitpuller-jl-interface",l=[];return"default"===t&&((e,r,t,n)=>{var o=a[e]=a[e]||{},l=o[r];(!l||!l.loaded&&(1!=!l.eager?n:i>l.from))&&(o[r]={get:()=>j.e(293).then(()=>()=>j(293)),from:i,eager:!1})})("nbgitpuller-jl-interface","1.0.0"),e[t]=l.length?Promise.all(l).then(()=>e[t]=1):1}}})(),(()=>{var e;j.g.importScripts&&(e=j.g.location+"");var r=j.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),j.p=e})(),t=e=>{var r=e=>e.split(".").map(e=>+e==e?+e:e),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},n=(e,r)=>{e=t(e),r=t(r);for(var n=0;;){if(n>=e.length)return n<r.length&&"u"!=(typeof r[n])[0];var o=e[n],a=(typeof o)[0];if(n>=r.length)return"u"==a;var i=r[n],l=(typeof i)[0];if(a!=l)return"o"==a&&"n"==l||"s"==l||"u"==a;if("o"!=a&&"u"!=a&&o!=i)return o<i;n++}},o=e=>{var r=e[0],t="";if(1===e.length)return"*";if(r+.5){t+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var n=1,a=1;a<e.length;a++)n--,t+="u"==(typeof(l=e[a]))[0]?"-":(n>0?".":"")+(n=2,l);return t}var i=[];for(a=1;a<e.length;a++){var l=e[a];i.push(0===l?"not("+u()+")":1===l?"("+u()+" || "+u()+")":2===l?i.pop()+" "+i.pop():o(l))}return u();function u(){return i.pop().replace(/^\((.+)\)$/,"$1")}},a=(e,r)=>{if(0 in e){r=t(r);var n=e[0],o=n<0;o&&(n=-n-1);for(var i=0,l=1,u=!0;;l++,i++){var f,s,d=l<e.length?(typeof e[l])[0]:"";if(i>=r.length||"o"==(s=(typeof(f=r[i]))[0]))return!u||("u"==d?l>n&&!o:""==d!=o);if("u"==s){if(!u||"u"!=d)return!1}else if(u)if(d==s)if(l<=n){if(f!=e[l])return!1}else{if(o?f>e[l]:f<e[l])return!1;f!=e[l]&&(u=!1)}else if("s"!=d&&"n"!=d){if(o||l<=n)return!1;u=!1,l--}else{if(l<=n||s<d!=o)return!1;u=!1}else"s"!=d&&"n"!=d&&(u=!1,l--)}}var p=[],c=p.pop.bind(p);for(i=1;i<e.length;i++){var h=e[i];p.push(1==h?c()|c():2==h?c()&c():h?a(h,r):!c())}return!!c()},i=(e,r)=>e&&j.o(e,r),l=e=>(e.loaded=1,e.get()),u=e=>Object.keys(e).reduce((r,t)=>(e[t].eager&&(r[t]=e[t]),r),{}),f=(e,r,t)=>{var o=t?u(e[r]):e[r];return Object.keys(o).reduce((e,r)=>!e||!o[e].loaded&&n(e,r)?r:e,0)},s=(e,r,t,n)=>"Unsatisfied version "+t+" from "+(t&&e[r][t].from)+" of shared singleton module "+r+" (required "+o(n)+")",d=e=>{throw new Error(e)},p=e=>{"undefined"!=typeof console&&console.warn&&console.warn(e)},c=(e,r,t)=>t?t():((e,r)=>d("Shared module "+r+" doesn't exist in shared scope "+e))(e,r),h=(e=>function(r,t,n,o,a){var i=j.I(r);return i&&i.then&&!n?i.then(e.bind(e,r,j.S[r],t,!1,o,a)):e(r,j.S[r],t,n,o,a)})((e,r,t,n,o,u)=>{if(!i(r,t))return c(e,t,u);var d=f(r,t,n);return a(o,d)||p(s(r,t,d,o)),l(r[t][d])}),v={},g={41:()=>h("default","@jupyterlab/coreutils",!1,[1,6,5,6]),53:()=>h("default","@lumino/algorithm",!1,[1,2,0,0]),247:()=>h("default","@lumino/widgets",!1,[1,2,3,1,,"alpha",1]),726:()=>h("default","@jupyterlab/settingregistry",!1,[1,4,5,6]),778:()=>h("default","@jupyterlab/apputils",!1,[1,4,6,6]),813:()=>h("default","@jupyterlab/application",!1,[1,4,5,6])},b={293:[41,53,247,726,778,813]},m={},j.f.consumes=(e,r)=>{j.o(b,e)&&b[e].forEach(e=>{if(j.o(v,e))return r.push(v[e]);if(!m[e]){var t=r=>{v[e]=0,j.m[e]=t=>{delete j.c[e],t.exports=r()}};m[e]=!0;var n=r=>{delete v[e],j.m[e]=t=>{throw delete j.c[e],r}};try{var o=g[e]();o.then?r.push(v[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}})},(()=>{var e={34:0};j.f.j=(r,t)=>{var n=j.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((t,o)=>n=e[r]=[t,o]);t.push(n[2]=o);var a=j.p+j.u(r),i=new Error;j.l(a,t=>{if(j.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[a,i,l]=t,u=0;if(a.some(r=>0!==e[r])){for(n in i)j.o(i,n)&&(j.m[n]=i[n]);l&&l(j)}for(r&&r(t);u<a.length;u++)o=a[u],j.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=self.webpackChunknbgitpuller_jl_interface=self.webpackChunknbgitpuller_jl_interface||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),j.nc=void 0;var S=j(234);(_JUPYTERLAB=void 0===_JUPYTERLAB?{}:_JUPYTERLAB)["nbgitpuller-jl-interface"]=S})();
@@ -65,7 +65,7 @@ class GitDetectUpdateHandler(APIHandler):
65
65
  "returncode": 42,
66
66
  }
67
67
 
68
- ret = checkIfRepoExists(repository_url)
68
+ ret = checkIfRepoExists(repository_url, repository_branch)
69
69
  result.update(ret)
70
70
  # Exit early if error found
71
71
  if result["returncode"] != 0:
@@ -61,19 +61,31 @@ def pullRepo(repository_url: str, repository_branch: str, destination: str) -> d
61
61
  "returncode": result.returncode
62
62
  }
63
63
 
64
- def checkIfRepoExists(repository_url) -> dict[str, Any]:
64
+ def checkIfRepoExists(repository_url: str, branch: str) -> dict[str, Any]:
65
65
  # Get git command
66
66
  command = which("git")
67
67
 
68
68
  if command is None:
69
69
  error = "git not found"
70
70
  return {"repoexists": False, "error": error, "returncode": 1}
71
- # Fetch repo contents
71
+ # Check remote exists
72
72
  result = subprocess.run(
73
73
  [command, "ls-remote", repository_url],
74
74
  capture_output=True,
75
75
  text=True
76
76
  )
77
+ if result.returncode != 0:
78
+ return {
79
+ "repoexists": result.stdout != "",
80
+ "error": result.stderr,
81
+ "returncode": result.returncode
82
+ }
83
+ # Check branch exists on remote
84
+ result = subprocess.run(
85
+ [command, "ls-remote", "--heads", repository_url, f"refs/heads/{branch}"],
86
+ capture_output=True,
87
+ text=True
88
+ )
77
89
  return {
78
90
  "repoexists": result.stdout != "",
79
91
  "error": result.stderr,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nbgitpuller-jl-interface",
3
- "version": "0.4.0",
3
+ "version": "1.0.0",
4
4
  "description": "A human interface with nbgitpuller in JupyterBook",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -149,6 +149,31 @@ describe('nbgitpuller-jl-interface utils setUpdateButtonDisplay', () => {
149
149
  expect(widget.innerHTML).toContain(`<span class="success">◉</span>`);
150
150
  });
151
151
 
152
+ it('widget updating', async () => {
153
+ const widget = await document.createElement('div');
154
+ widget.id = 'nbgitpuller-jl-interface-update-btn';
155
+ document.body.appendChild(widget);
156
+
157
+ const returnValue = await setUpdateButtonDisplay(WidgetState.Updating, '');
158
+
159
+ expect(returnValue).toStrictEqual({ error: '', returncode: 0 });
160
+ expect(widget.innerHTML).toContain(`<span class="lds-dual-ring"></span>`);
161
+ });
162
+
163
+ it('widget initializing', async () => {
164
+ const widget = await document.createElement('div');
165
+ widget.id = 'nbgitpuller-jl-interface-update-btn';
166
+ document.body.appendChild(widget);
167
+
168
+ const returnValue = await setUpdateButtonDisplay(
169
+ WidgetState.Initializing,
170
+ ''
171
+ );
172
+
173
+ expect(returnValue).toStrictEqual({ error: '', returncode: 0 });
174
+ expect(widget.innerHTML).toContain(`<p><span class="">◉</span>`);
175
+ });
176
+
152
177
  it('widget update required', async () => {
153
178
  const widget = await document.createElement('div');
154
179
  widget.id = 'nbgitpuller-jl-interface-update-btn';
@@ -46,7 +46,7 @@ export async function nbgitpullerUpdateButton(
46
46
  currentlyUpdating = true;
47
47
 
48
48
  // Update widget to running animation
49
- const pendingTooltip = 'Updating Notebooks...';
49
+ const pendingTooltip = 'Updating GitHub Repositories...';
50
50
  await setUpdateButtonDisplay(WidgetState.Updating, pendingTooltip);
51
51
 
52
52
  // Pull each repository
@@ -57,10 +57,12 @@ export async function nbgitpullerUpdateButton(
57
57
 
58
58
  // Notify users of any failure
59
59
  if (failed_updates.length !== 0) {
60
- let failure_message = 'Failed to update the following notebooks: \n';
60
+ let failure_message = 'Failed to update the following repositories: \n';
61
61
  for (const failure of failed_updates) {
62
- failure_message += `${failure['repo']}`;
62
+ failure_message += `- ${failure['repo']}\n`;
63
63
  }
64
+ failure_message +=
65
+ 'If you require assistance with resolving this issue, please contact your platform administrators.';
64
66
  console.log(failure_message);
65
67
  alert(failure_message);
66
68
  }
@@ -208,13 +210,13 @@ export async function checkForUpdatesAndSetDisplay(
208
210
  let tooltip;
209
211
  let widgetState;
210
212
  if (updateCheckResponse['numWithErrors'] > 0) {
211
- tooltip = `${updateCheckResponse['numWithErrors']} notebooks with errors`;
213
+ tooltip = `${updateCheckResponse['numWithErrors']} repositories with errors`;
212
214
  widgetState = WidgetState.Error;
213
215
  } else if (updateCheckResponse['numToBeUpdated'] > 0) {
214
- tooltip = `${updateCheckResponse['numToBeUpdated']} notebooks awaiting updates\n`;
216
+ tooltip = `${updateCheckResponse['numToBeUpdated']} repositories awaiting updates\n`;
215
217
  widgetState = WidgetState.UpdateRequired;
216
218
  } else {
217
- tooltip = `${repositories.length} Notebooks up to date`;
219
+ tooltip = `${repositories.length} repositories up to date`;
218
220
  widgetState = WidgetState.UpToDate;
219
221
  }
220
222
 
@@ -253,7 +255,8 @@ export async function setUpdateButtonDisplay(
253
255
  } else if (targetWidgetState === WidgetState.Updating) {
254
256
  labelHTML = '<p><span class="lds-dual-ring"></span> Updating</p>';
255
257
  } else if (targetWidgetState === WidgetState.UpdateRequired) {
256
- labelHTML = '<p><span class="pending blink">◉</span> Update Notebooks</p>';
258
+ labelHTML =
259
+ '<p><span class="pending blink">◉</span> Update Repositories</p>';
257
260
  } else if (targetWidgetState === WidgetState.Error) {
258
261
  labelHTML = '<p><span class="failure blink">◉</span> Update Error</p>';
259
262
  } else if (targetWidgetState === WidgetState.Initializing) {
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunknbgitpuller_jl_interface=self.webpackChunknbgitpuller_jl_interface||[]).push([[293],{293(e,t,n){n.r(t),n.d(t,{default:()=>U,getJupyterAppInstance:()=>h});var o=n(813),i=n(53),r=n(247),a=n(41);const s="nbgitpuller-jl-interface-update-btn";let l,p=!1;async function c(e){const t=await async function(e){var t;let n=0,o=0;for(const i of e){const e=i.repoUrl,r=i.branch,s=i.destPath,l=a.PageConfig.getBaseUrl(),p=a.URLExt.join(l,"nbgitpuller-jl-interface","update-check"),c=null===(t=document.cookie.split(";").find(e=>e.startsWith("_xsrf=")))||void 0===t?void 0:t.split("=")[1],d=await fetch(p,{method:"POST",headers:{"Content-Type":"application/json","X-XSRFToken":null!=c?c:""},body:JSON.stringify({repositoryUrl:e,repositoryBranch:r,destination:s})}),u=await d.json();0!==u.returncode?o+=1:u.updatefound&&(n+=1)}return{response:{numToBeUpdated:n,numWithErrors:o},statuscode:0}}(e);if(0===t.statuscode){const n=t.response;let o,i;n.numWithErrors>0?(o=`${n.numWithErrors} notebooks with errors`,i=d.Error):n.numToBeUpdated>0?(o=`${n.numToBeUpdated} notebooks awaiting updates\n`,i=d.UpdateRequired):(o=`${e.length} Notebooks up to date`,i=d.UpToDate);const r=await u(i,o);0!==r.returncode&&console.error(r)}}var d;async function u(e,t){const n=document.getElementById(s);if(!n)return{error:"Unable to find nbgitpuller widget",returncode:1};let o;if(e===d.UpToDate)o='<p><span class="success">◉</span> Up to Date</p>';else if(e===d.Updating)o='<p><span class="lds-dual-ring"></span> Updating</p>';else if(e===d.UpdateRequired)o='<p><span class="pending blink">◉</span> Update Notebooks</p>';else if(e===d.Error)o='<p><span class="failure blink">◉</span> Update Error</p>';else{if(e!==d.Initializing)return{error:"Unknown widget state",returncode:2};o='<p><span class="">◉</span> Initializing</p>'}return n.title=t,n.innerHTML=function(e){return`\n <jp-button class="nbgitpuller-jl-interface-update-btn jp-ToolbarButtonComponent">\n ${e}\n </jp-button>`}(o),{error:"",returncode:0}}!function(e){e[e.UpToDate=0]="UpToDate",e[e.UpdateRequired=1]="UpdateRequired",e[e.Updating=2]="Updating",e[e.Error=3]="Error",e[e.Initializing=4]="Initializing"}(d||(d={}));var g=n(726),f=n(778);let b=null;function h(e){if(!b&&e&&(b=e),!b)throw new Error("App instance has not been initialized yet");return b}const w={id:"nbgitpuller-jl-interface:plugin",description:"A human interface with nbgitpuller in JupyterBook",autoStart:!0,optional:[],requires:[o.ILabShell,f.ICommandPalette,g.ISettingRegistry,o.JupyterFrontEnd.IPaths],activate:(e,t,n,o,g)=>{o?(Promise.all([e.restored,o.load(w.id)]).then(async([,t])=>{async function n(t){t.get("reloadWidget").composite&&(await async function(e,t){const n=t.get("repos").composite,o=t.get("rank").composite,l=(0,i.find)(e.shell.widgets("top"),e=>e.id===s);l&&l.dispose();const g=new r.Widget;g.id=s,g.addClass("lm-Widget"),g.addClass("jp-ToolbarButton"),g.addClass("nbgitpuller-jl-interface-wrapper"),g.node.addEventListener("click",async()=>{if(p)return;p=!0,await u(d.Updating,"Updating Notebooks...");const e=await async function(e){var t;const n=a.PageConfig.getBaseUrl(),o=a.URLExt.join(n,"nbgitpuller-jl-interface","gitpuller"),i=null===(t=document.cookie.split(";").find(e=>e.startsWith("_xsrf=")))||void 0===t?void 0:t.split("=")[1],r=[];for(const t of e){const e=t.repoUrl,n=t.branch,a=t.destPath,s=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-XSRFToken":null!=i?i:""},body:JSON.stringify({repositoryUrl:e,repositoryBranch:n,destination:a})}),l=await s.json();0!==l.returncode&&r.push({repo:e,reason:l.error})}return r}(n);if(await c(n),0!==e.length){let t="Failed to update the following notebooks: \n";for(const n of e)t+=`${n.repo}`;console.log(t),alert(t)}p=!1}),e.shell.add(g,"top",{rank:o}),await new Promise(e=>setTimeout(e,1e3)),await c(n),console.log("nbgitpuller-jl-interface settings loaded")}(e,t),await async function(e){const t=e.get("repos").composite,n=e.get("probeInterval").composite;clearInterval(l),l=setInterval(async()=>{await c(t)},n)}(t),await t.set("reloadWidget",!1))}await t.set("reloadWidget",!0),n(t),t.changed.connect(n),console.log("JupyterLab extension nbgitpuller-jl-interface is fully operational!")}).catch(e=>{console.error(`Something went wrong...${e}`)}),console.log("JupyterLab extension nbgitpuller-jl-interface is activated!")):console.log("Settings not found. nbgitpuller-jl-interface cannot be established.")}},U=w}}]);