Shows how to get repo export and walk it in TypeScript walktherepo.wisp.place
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

fixes links

+66 -21
+2 -2
README.md
··· 3 3 demo: [https://walktherepo.wisp.place](https://walktherepo.wisp.place/) 4 4 5 5 A demo showing how to use [@atcute](https://github.com/mary-ext/atcute) to download a user's repo and "walk" it to access all the records inside of it faster than you would via multiple api calls. 6 - If you're just wanting to see that code directly it's [here](https://tangled.org/baileytownsend.dev/repo-walk-example/blob/main/src/lib/RepoStats.svelte#L56). 6 + If you're just wanting to see that code directly it's [here](https://tangled.org/did:plc:rnpkyqnmsw4ipey6eotbdnnf/repo-walk-example/blob/main/src/lib/RepoStats.svelte#L56). 7 7 8 8 Comparisons using my repo as an example. 9 9 ··· 11 11 ![](./.tangled/images/carWalk.jpg) 12 12 13 13 API Calls 14 - ![](./.tangled/images/apiWalk.jpg) 14 + ![](./.tangled/images/apiWalk.jpg)
+2 -1
package.json
··· 35 35 "globals": "^17.0.0", 36 36 "tailwindcss": "^4.1.18", 37 37 "typescript-eslint": "^8.52.0" 38 - } 38 + }, 39 + "packageManager": "pnpm@10.33.2+sha512.a90faf6feeab71ad6c6e57f94e0fe1a12f5dcc22cd754db40ae9593eb6a3e0b6b12e3540218bb37ae083404b1f2ce6db2a4121e979829b4aff94b99f49da1cf8" 39 40 }
+62 -18
src/App.svelte
··· 1 1 <script lang="ts"> 2 - 3 - import SearchForm from './lib/SearchForm.svelte'; 4 - import RepoStats from './lib/RepoStats.svelte'; 2 + import SearchForm from "./lib/SearchForm.svelte"; 3 + import RepoStats from "./lib/RepoStats.svelte"; 5 4 6 5 let showRepoStats = $state(false); 7 6 let searchResults = $state({ 8 - did: '', 9 - handle: '', 10 - pdsUrl: '', 11 - slowPoke: false 7 + did: "", 8 + handle: "", 9 + pdsUrl: "", 10 + slowPoke: false, 12 11 }); 13 12 14 - const resolvedResult = (didResult: string, handle: string, pdsUrlResult: string, slowPokeResult: boolean) => { 15 - searchResults = { did: didResult, handle: handle, pdsUrl: pdsUrlResult, slowPoke: slowPokeResult }; 13 + const resolvedResult = ( 14 + didResult: string, 15 + handle: string, 16 + pdsUrlResult: string, 17 + slowPokeResult: boolean, 18 + ) => { 19 + searchResults = { 20 + did: didResult, 21 + handle: handle, 22 + pdsUrl: pdsUrlResult, 23 + slowPoke: slowPokeResult, 24 + }; 16 25 showRepoStats = true; 17 26 }; 18 - 19 27 </script> 20 28 21 - <a href="https://tangled.org/baileytownsend.dev/repo-walk-example" target="_blank" rel="noopener noreferrer" class="fixed top-4 right-4 z-50 btn btn-ghost btn-sm gap-2 hover:scale-110 transition-transform shadow-lg"> 22 - <svg version="1.1" class="size-6" width="25" height="25" viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg"> 29 + <a 30 + href="https://tangled.org/did:plc:rnpkyqnmsw4ipey6eotbdnnf/repo-walk-example" 31 + target="_blank" 32 + rel="noopener noreferrer" 33 + class="fixed top-4 right-4 z-50 btn btn-ghost btn-sm gap-2 hover:scale-110 transition-transform shadow-lg" 34 + > 35 + <svg 36 + version="1.1" 37 + class="size-6" 38 + width="25" 39 + height="25" 40 + viewBox="0 0 25 25" 41 + xmlns="http://www.w3.org/2000/svg" 42 + > 23 43 <g transform="translate(-0.42924038,-0.87777209)"> 24 - <path fill="currentColor" style="stroke-width:0.111183;" d="m 16.775491,24.987061 c -0.78517,-0.0064 -1.384202,-0.234614 -2.033994,-0.631295 -0.931792,-0.490188 -1.643475,-1.31368 -2.152014,-2.221647 C 11.781409,23.136647 10.701392,23.744942 9.4922931,24.0886 8.9774725,24.238111 8.0757679,24.389777 6.5811304,23.84827 4.4270703,23.124679 2.8580086,20.883331 3.0363279,18.599583 3.0037061,17.652919 3.3488675,16.723769 3.8381157,15.925061 2.5329485,15.224503 1.4686756,14.048584 1.0611184,12.606459 0.81344502,11.816973 0.82385989,10.966486 0.91519098,10.154906 1.2422711,8.2387903 2.6795811,6.5725716 4.5299585,5.9732484 5.2685364,4.290122 6.8802592,3.0349975 8.706276,2.7794663 c 1.2124148,-0.1688264 2.46744,0.084987 3.52811,0.7011837 1.545426,-1.7139736 4.237779,-2.2205077 6.293579,-1.1676231 1.568222,0.7488935 2.689625,2.3113526 2.961888,4.0151464 1.492195,0.5977882 2.749007,1.8168898 3.242225,3.3644951 0.329805,0.9581836 0.340709,2.0135956 0.127128,2.9974286 -0.381606,1.535184 -1.465322,2.842146 -2.868035,3.556463 0.0034,0.273204 0.901506,2.243045 0.751284,3.729647 -0.03281,1.858525 -1.211631,3.619894 -2.846433,4.475452 -0.953967,0.556812 -2.084452,0.546309 -3.120531,0.535398 z m -4.470079,-5.349839 c 1.322246,-0.147248 2.189053,-1.300106 2.862307,-2.338363 0.318287,-0.472954 0.561404,-1.002348 0.803,-1.505815 0.313265,0.287151 0.578698,0.828085 1.074141,0.956909 0.521892,0.162542 1.133743,0.03052 1.45325,-0.443554 0.611414,-1.140449 0.31004,-2.516537 -0.04602,-3.698347 C 18.232844,11.92927 17.945151,11.232927 17.397785,10.751793 17.514522,9.9283111 17.026575,9.0919791 16.332883,8.6609491 15.741721,9.1323278 14.842258,9.1294949 14.271975,8.6252369 13.178927,9.7400102 12.177239,9.7029996 11.209704,8.8195135 10.992255,8.6209543 10.577326,10.031484 9.1211947,9.2324497 8.2846288,9.9333947 7.6359672,10.607693 7.0611981,11.578553 6.5026891,12.62523 5.9177873,13.554793 5.867393,14.69141 c -0.024234,0.66432 0.4948601,1.360337 1.1982269,1.306329 0.702996,0.06277 1.1815208,-0.629091 1.7138087,-0.916491 0.079382,0.927141 0.1688108,1.923227 0.4821259,2.828358 0.3596254,1.171275 1.6262605,1.915695 2.8251855,1.745211 0.08481,-0.0066 0.218672,-0.01769 0.218672,-0.0176 z m 0.686342,-3.497495 c -0.643126,-0.394168 -0.33365,-1.249599 -0.359402,-1.870938 0.064,-0.749774 0.115321,-1.538054 0.452402,-2.221125 0.356724,-0.487008 1.226721,-0.299139 1.265134,0.325689 -0.02558,0.628509 -0.314101,1.25416 -0.279646,1.9057 -0.07482,0.544043 0.05418,1.155133 -0.186476,1.652391 -0.197455,0.275121 -0.599638,0.355105 -0.892012,0.208283 z m -2.808766,-0.358124 c -0.605767,-0.328664 -0.4133176,-1.155655 -0.5083256,-1.73063 0.078762,-0.66567 0.013203,-1.510085 0.5705316,-1.976886 0.545037,-0.380109 1.286917,0.270803 1.029164,0.868384 -0.274913,0.755214 -0.09475,1.580345 -0.08893,2.34609 -0.104009,0.451702 -0.587146,0.691508 -1.002445,0.493042 z"></path> 44 + <path 45 + fill="currentColor" 46 + style="stroke-width:0.111183;" 47 + d="m 16.775491,24.987061 c -0.78517,-0.0064 -1.384202,-0.234614 -2.033994,-0.631295 -0.931792,-0.490188 -1.643475,-1.31368 -2.152014,-2.221647 C 11.781409,23.136647 10.701392,23.744942 9.4922931,24.0886 8.9774725,24.238111 8.0757679,24.389777 6.5811304,23.84827 4.4270703,23.124679 2.8580086,20.883331 3.0363279,18.599583 3.0037061,17.652919 3.3488675,16.723769 3.8381157,15.925061 2.5329485,15.224503 1.4686756,14.048584 1.0611184,12.606459 0.81344502,11.816973 0.82385989,10.966486 0.91519098,10.154906 1.2422711,8.2387903 2.6795811,6.5725716 4.5299585,5.9732484 5.2685364,4.290122 6.8802592,3.0349975 8.706276,2.7794663 c 1.2124148,-0.1688264 2.46744,0.084987 3.52811,0.7011837 1.545426,-1.7139736 4.237779,-2.2205077 6.293579,-1.1676231 1.568222,0.7488935 2.689625,2.3113526 2.961888,4.0151464 1.492195,0.5977882 2.749007,1.8168898 3.242225,3.3644951 0.329805,0.9581836 0.340709,2.0135956 0.127128,2.9974286 -0.381606,1.535184 -1.465322,2.842146 -2.868035,3.556463 0.0034,0.273204 0.901506,2.243045 0.751284,3.729647 -0.03281,1.858525 -1.211631,3.619894 -2.846433,4.475452 -0.953967,0.556812 -2.084452,0.546309 -3.120531,0.535398 z m -4.470079,-5.349839 c 1.322246,-0.147248 2.189053,-1.300106 2.862307,-2.338363 0.318287,-0.472954 0.561404,-1.002348 0.803,-1.505815 0.313265,0.287151 0.578698,0.828085 1.074141,0.956909 0.521892,0.162542 1.133743,0.03052 1.45325,-0.443554 0.611414,-1.140449 0.31004,-2.516537 -0.04602,-3.698347 C 18.232844,11.92927 17.945151,11.232927 17.397785,10.751793 17.514522,9.9283111 17.026575,9.0919791 16.332883,8.6609491 15.741721,9.1323278 14.842258,9.1294949 14.271975,8.6252369 13.178927,9.7400102 12.177239,9.7029996 11.209704,8.8195135 10.992255,8.6209543 10.577326,10.031484 9.1211947,9.2324497 8.2846288,9.9333947 7.6359672,10.607693 7.0611981,11.578553 6.5026891,12.62523 5.9177873,13.554793 5.867393,14.69141 c -0.024234,0.66432 0.4948601,1.360337 1.1982269,1.306329 0.702996,0.06277 1.1815208,-0.629091 1.7138087,-0.916491 0.079382,0.927141 0.1688108,1.923227 0.4821259,2.828358 0.3596254,1.171275 1.6262605,1.915695 2.8251855,1.745211 0.08481,-0.0066 0.218672,-0.01769 0.218672,-0.0176 z m 0.686342,-3.497495 c -0.643126,-0.394168 -0.33365,-1.249599 -0.359402,-1.870938 0.064,-0.749774 0.115321,-1.538054 0.452402,-2.221125 0.356724,-0.487008 1.226721,-0.299139 1.265134,0.325689 -0.02558,0.628509 -0.314101,1.25416 -0.279646,1.9057 -0.07482,0.544043 0.05418,1.155133 -0.186476,1.652391 -0.197455,0.275121 -0.599638,0.355105 -0.892012,0.208283 z m -2.808766,-0.358124 c -0.605767,-0.328664 -0.4133176,-1.155655 -0.5083256,-1.73063 0.078762,-0.66567 0.013203,-1.510085 0.5705316,-1.976886 0.545037,-0.380109 1.286917,0.270803 1.029164,0.868384 -0.274913,0.755214 -0.09475,1.580345 -0.08893,2.34609 -0.104009,0.451702 -0.587146,0.691508 -1.002445,0.493042 z" 48 + ></path> 25 49 </g> 26 50 </svg> 27 51 <span class="hidden sm:inline">View on Tangled</span> ··· 30 54 <main class="container mx-auto px-4 py-8 max-w-4xl"> 31 55 <div class="text-center mb-8"> 32 56 {#if showRepoStats} 33 - <h2 class="text-2xl font-bold text-primary">Walking <a class="link link-info" href="https://pdsls.dev/at://{searchResults.did}" target="_blank">{searchResults.handle}</a>'s repo {searchResults.slowPoke ? 'via api calls' : 'via export'}</h2> 57 + <h2 class="text-2xl font-bold text-primary"> 58 + Walking <a 59 + class="link link-info" 60 + href="https://pdsls.dev/at://{searchResults.did}" 61 + target="_blank">{searchResults.handle}</a 62 + >'s repo {searchResults.slowPoke 63 + ? "via api calls" 64 + : "via export"} 65 + </h2> 34 66 {:else} 35 67 <h1 class="text-5xl font-bold mb-4">Walk The Repo</h1> 36 - <p class="text-lg mb-2">Demo showing why you may rather export the users whole repo instead of walking it via api calls if you want to access all the user's records.</p> 37 - <p class="text-sm opacity-70">Also shows how many records you have and how many of each kind if you're into that kind of thing...</p> 68 + <p class="text-lg mb-2"> 69 + Demo showing why you may rather export the users whole repo 70 + instead of walking it via api calls if you want to access all 71 + the user's records. 72 + </p> 73 + <p class="text-sm opacity-70"> 74 + Also shows how many records you have and how many of each kind 75 + if you're into that kind of thing... 76 + </p> 38 77 {/if} 39 78 </div> 40 79 41 80 <div class="card bg-base-200 shadow-xl"> 42 81 <div class="card-body"> 43 82 {#if showRepoStats} 44 - <RepoStats did={searchResults.did} pdsUrl={searchResults.pdsUrl} slowPokeMode={searchResults.slowPoke} handle={searchResults.handle}/> 83 + <RepoStats 84 + did={searchResults.did} 85 + pdsUrl={searchResults.pdsUrl} 86 + slowPokeMode={searchResults.slowPoke} 87 + handle={searchResults.handle} 88 + /> 45 89 {:else} 46 - <SearchForm resolvedResult={resolvedResult}/> 90 + <SearchForm {resolvedResult} /> 47 91 {/if} 48 92 </div> 49 93 </div>