six-degrees 0.2.1 → 0.3.0

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 (470) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +10 -0
  3. package/.next/standalone/.next/build-manifest.json +3 -3
  4. package/.next/standalone/.next/prerender-manifest.json +39 -11
  5. package/.next/standalone/.next/required-server-files.json +4 -1
  6. package/.next/standalone/.next/routes-manifest.json +60 -0
  7. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  8. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.rsc +10 -10
  18. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +10 -10
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +9 -9
  20. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  21. package/.next/standalone/.next/server/app/api/admin-delete/route.js +3 -2
  22. package/.next/standalone/.next/server/app/api/admin-delete/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/admin-update/route.js +3 -2
  24. package/.next/standalone/.next/server/app/api/admin-update/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/bridges/route.js +3 -2
  26. package/.next/standalone/.next/server/app/api/bridges/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/bulk-import/route.js +3 -2
  28. package/.next/standalone/.next/server/app/api/bulk-import/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/company-scores/legacy/route/app-paths-manifest.json +3 -0
  30. package/.next/standalone/.next/server/app/api/company-scores/legacy/route/build-manifest.json +12 -0
  31. package/.next/standalone/.next/server/app/api/company-scores/legacy/route/server-reference-manifest.json +4 -0
  32. package/.next/standalone/.next/server/app/api/company-scores/legacy/route.js +9 -0
  33. package/.next/standalone/.next/server/app/api/company-scores/legacy/route.js.map +5 -0
  34. package/.next/standalone/.next/server/app/api/company-scores/legacy/route.js.nft.json +1 -0
  35. package/.next/standalone/.next/server/app/api/company-scores/legacy/route_client-reference-manifest.js +3 -0
  36. package/.next/standalone/.next/server/app/api/company-scores/route.js +3 -2
  37. package/.next/standalone/.next/server/app/api/company-scores/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/connections/route.js +3 -2
  39. package/.next/standalone/.next/server/app/api/connections/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/data/export/route/app-paths-manifest.json +3 -0
  41. package/.next/standalone/.next/server/app/api/data/export/route/build-manifest.json +12 -0
  42. package/.next/standalone/.next/server/app/api/data/export/route/server-reference-manifest.json +4 -0
  43. package/.next/standalone/.next/server/app/api/data/export/route.js +7 -0
  44. package/.next/standalone/.next/server/app/api/data/export/route.js.map +5 -0
  45. package/.next/standalone/.next/server/app/api/data/export/route.js.nft.json +1 -0
  46. package/.next/standalone/.next/server/app/api/data/export/route_client-reference-manifest.js +3 -0
  47. package/.next/standalone/.next/server/app/api/data/import/route/app-paths-manifest.json +3 -0
  48. package/.next/standalone/.next/server/app/api/data/import/route/build-manifest.json +12 -0
  49. package/.next/standalone/.next/server/app/api/data/import/route/server-reference-manifest.json +4 -0
  50. package/.next/standalone/.next/server/app/api/data/import/route.js +8 -0
  51. package/.next/standalone/.next/server/app/api/data/import/route.js.map +5 -0
  52. package/.next/standalone/.next/server/app/api/data/import/route.js.nft.json +1 -0
  53. package/.next/standalone/.next/server/app/api/data/import/route_client-reference-manifest.js +3 -0
  54. package/.next/standalone/.next/server/app/api/data/restart/route/app-paths-manifest.json +3 -0
  55. package/.next/standalone/.next/server/app/api/data/restart/route/build-manifest.json +12 -0
  56. package/.next/standalone/.next/server/app/api/data/restart/route/server-reference-manifest.json +4 -0
  57. package/.next/standalone/.next/server/app/api/data/restart/route.js +8 -0
  58. package/.next/standalone/.next/server/app/api/data/restart/route.js.map +5 -0
  59. package/.next/standalone/.next/server/app/api/data/restart/route.js.nft.json +1 -0
  60. package/.next/standalone/.next/server/app/api/data/restart/route_client-reference-manifest.js +3 -0
  61. package/.next/standalone/.next/server/app/api/data/reveal/route/app-paths-manifest.json +3 -0
  62. package/.next/standalone/.next/server/app/api/data/reveal/route/build-manifest.json +12 -0
  63. package/.next/standalone/.next/server/app/api/data/reveal/route/server-reference-manifest.json +4 -0
  64. package/.next/standalone/.next/server/app/api/data/reveal/route.js +7 -0
  65. package/.next/standalone/.next/server/app/api/data/reveal/route.js.map +5 -0
  66. package/.next/standalone/.next/server/app/api/data/reveal/route.js.nft.json +1 -0
  67. package/.next/standalone/.next/server/app/api/data/reveal/route_client-reference-manifest.js +3 -0
  68. package/.next/standalone/.next/server/app/api/data/route/app-paths-manifest.json +3 -0
  69. package/.next/standalone/.next/server/app/api/data/route/build-manifest.json +12 -0
  70. package/.next/standalone/.next/server/app/api/data/route/server-reference-manifest.json +4 -0
  71. package/.next/standalone/.next/server/app/api/data/route.js +7 -0
  72. package/.next/standalone/.next/server/app/api/data/route.js.map +5 -0
  73. package/.next/standalone/.next/server/app/api/data/route.js.nft.json +1 -0
  74. package/.next/standalone/.next/server/app/api/data/route_client-reference-manifest.js +3 -0
  75. package/.next/standalone/.next/server/app/api/delete-cluster/route.js +3 -2
  76. package/.next/standalone/.next/server/app/api/delete-cluster/route.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/api/ingest/route.js +2 -2
  78. package/.next/standalone/.next/server/app/api/ingest/route.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/api/network/route.js +3 -2
  80. package/.next/standalone/.next/server/app/api/network/route.js.nft.json +1 -1
  81. package/.next/standalone/.next/server/app/api/notifications/route.js +3 -2
  82. package/.next/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/api/outreach/route.js +3 -2
  84. package/.next/standalone/.next/server/app/api/outreach/route.js.nft.json +1 -1
  85. package/.next/standalone/.next/server/app/api/queue/route.js +3 -2
  86. package/.next/standalone/.next/server/app/api/queue/route.js.nft.json +1 -1
  87. package/.next/standalone/.next/server/app/api/scraper/route.js +3 -2
  88. package/.next/standalone/.next/server/app/api/scraper/route.js.nft.json +1 -1
  89. package/.next/standalone/.next/server/app/api/settings/route/app-paths-manifest.json +3 -0
  90. package/.next/standalone/.next/server/app/api/settings/route/build-manifest.json +12 -0
  91. package/.next/standalone/.next/server/app/api/settings/route/server-reference-manifest.json +4 -0
  92. package/.next/standalone/.next/server/app/api/settings/route.js +9 -0
  93. package/.next/standalone/.next/server/app/api/settings/route.js.map +5 -0
  94. package/.next/standalone/.next/server/app/api/settings/route.js.nft.json +1 -0
  95. package/.next/standalone/.next/server/app/api/settings/route_client-reference-manifest.js +3 -0
  96. package/.next/standalone/.next/server/app/api/settings/sector-preview/route/app-paths-manifest.json +3 -0
  97. package/.next/standalone/.next/server/app/api/settings/sector-preview/route/build-manifest.json +12 -0
  98. package/.next/standalone/.next/server/app/api/settings/sector-preview/route/server-reference-manifest.json +4 -0
  99. package/.next/standalone/.next/server/app/api/settings/sector-preview/route.js +8 -0
  100. package/.next/standalone/.next/server/app/api/settings/sector-preview/route.js.map +5 -0
  101. package/.next/standalone/.next/server/app/api/settings/sector-preview/route.js.nft.json +1 -0
  102. package/.next/standalone/.next/server/app/api/settings/sector-preview/route_client-reference-manifest.js +3 -0
  103. package/.next/standalone/.next/server/app/api/settings/sector-suggestions/route/app-paths-manifest.json +3 -0
  104. package/.next/standalone/.next/server/app/api/settings/sector-suggestions/route/build-manifest.json +12 -0
  105. package/.next/standalone/.next/server/app/api/settings/sector-suggestions/route/server-reference-manifest.json +4 -0
  106. package/.next/standalone/.next/server/app/api/settings/sector-suggestions/route.js +8 -0
  107. package/.next/standalone/.next/server/app/api/settings/sector-suggestions/route.js.map +5 -0
  108. package/.next/standalone/.next/server/app/api/settings/sector-suggestions/route.js.nft.json +1 -0
  109. package/.next/standalone/.next/server/app/api/settings/sector-suggestions/route_client-reference-manifest.js +3 -0
  110. package/.next/standalone/.next/server/app/api/setup-profile/route.js +3 -2
  111. package/.next/standalone/.next/server/app/api/setup-profile/route.js.nft.json +1 -1
  112. package/.next/standalone/.next/server/app/api/unlock/route.js +3 -2
  113. package/.next/standalone/.next/server/app/api/unlock/route.js.nft.json +1 -1
  114. package/.next/standalone/.next/server/app/api/update/route.js +1 -1
  115. package/.next/standalone/.next/server/app/api/update/route.js.nft.json +1 -1
  116. package/.next/standalone/.next/server/app/api/update-images/route.js +3 -2
  117. package/.next/standalone/.next/server/app/api/update-images/route.js.nft.json +1 -1
  118. package/.next/standalone/.next/server/app/api/users/route.js +3 -2
  119. package/.next/standalone/.next/server/app/api/users/route.js.nft.json +1 -1
  120. package/.next/standalone/.next/server/app/avatars/[file]/route.js +2 -1
  121. package/.next/standalone/.next/server/app/avatars/[file]/route.js.nft.json +1 -1
  122. package/.next/standalone/.next/server/app/favicon.ico/route.js +2 -1
  123. package/.next/standalone/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  124. package/.next/standalone/.next/server/app/import/page.js.nft.json +1 -1
  125. package/.next/standalone/.next/server/app/import/page_client-reference-manifest.js +1 -1
  126. package/.next/standalone/.next/server/app/import.html +1 -1
  127. package/.next/standalone/.next/server/app/import.rsc +12 -12
  128. package/.next/standalone/.next/server/app/import.segments/_full.segment.rsc +12 -12
  129. package/.next/standalone/.next/server/app/import.segments/_tree.segment.rsc +1 -1
  130. package/.next/standalone/.next/server/app/import.segments/import/__PAGE__.segment.rsc +11 -11
  131. package/.next/standalone/.next/server/app/index.html +1 -1
  132. package/.next/standalone/.next/server/app/index.rsc +12 -12
  133. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +11 -11
  134. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +12 -12
  135. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  136. package/.next/standalone/.next/server/app/launch/page.js.nft.json +1 -1
  137. package/.next/standalone/.next/server/app/launch/page_client-reference-manifest.js +1 -1
  138. package/.next/standalone/.next/server/app/launch.html +2 -2
  139. package/.next/standalone/.next/server/app/launch.rsc +12 -12
  140. package/.next/standalone/.next/server/app/launch.segments/_full.segment.rsc +12 -12
  141. package/.next/standalone/.next/server/app/launch.segments/_tree.segment.rsc +1 -1
  142. package/.next/standalone/.next/server/app/launch.segments/launch/__PAGE__.segment.rsc +11 -11
  143. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  144. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  145. package/.next/standalone/.next/server/app/paths/page.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/paths/page_client-reference-manifest.js +1 -1
  147. package/.next/standalone/.next/server/app/paths.html +1 -1
  148. package/.next/standalone/.next/server/app/paths.rsc +12 -12
  149. package/.next/standalone/.next/server/app/paths.segments/_full.segment.rsc +12 -12
  150. package/.next/standalone/.next/server/app/paths.segments/_tree.segment.rsc +1 -1
  151. package/.next/standalone/.next/server/app/paths.segments/paths/__PAGE__.segment.rsc +11 -11
  152. package/.next/standalone/.next/server/app/profile/page.js.nft.json +1 -1
  153. package/.next/standalone/.next/server/app/profile/page_client-reference-manifest.js +1 -1
  154. package/.next/standalone/.next/server/app/profile.html +1 -1
  155. package/.next/standalone/.next/server/app/profile.rsc +12 -12
  156. package/.next/standalone/.next/server/app/profile.segments/_full.segment.rsc +12 -12
  157. package/.next/standalone/.next/server/app/profile.segments/_tree.segment.rsc +1 -1
  158. package/.next/standalone/.next/server/app/profile.segments/profile/__PAGE__.segment.rsc +11 -11
  159. package/.next/standalone/.next/server/app/queue/page.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/queue/page_client-reference-manifest.js +1 -1
  161. package/.next/standalone/.next/server/app/queue.html +1 -1
  162. package/.next/standalone/.next/server/app/queue.rsc +12 -12
  163. package/.next/standalone/.next/server/app/queue.segments/_full.segment.rsc +12 -12
  164. package/.next/standalone/.next/server/app/queue.segments/_tree.segment.rsc +1 -1
  165. package/.next/standalone/.next/server/app/queue.segments/queue/__PAGE__.segment.rsc +11 -11
  166. package/.next/standalone/.next/server/app/settings/page/app-paths-manifest.json +3 -0
  167. package/.next/standalone/.next/server/app/settings/page/build-manifest.json +20 -0
  168. package/.next/standalone/.next/server/app/settings/page/next-font-manifest.json +11 -0
  169. package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +1 -0
  170. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +4 -0
  171. package/.next/standalone/.next/server/app/settings/page.js +13 -0
  172. package/.next/standalone/.next/server/app/settings/page.js.map +5 -0
  173. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -0
  174. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +3 -0
  175. package/.next/standalone/.next/server/app/settings.html +1 -0
  176. package/.next/standalone/.next/server/app/settings.meta +26 -0
  177. package/.next/standalone/.next/server/app/settings.rsc +24 -0
  178. package/.next/standalone/.next/server/app/settings.segments/_full.segment.rsc +24 -0
  179. package/.next/standalone/.next/server/app/settings.segments/_tree.segment.rsc +4 -0
  180. package/.next/standalone/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +28 -0
  181. package/.next/standalone/.next/server/app/setup/page.js.nft.json +1 -1
  182. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  183. package/.next/standalone/.next/server/app/setup.html +1 -1
  184. package/.next/standalone/.next/server/app/setup.rsc +12 -12
  185. package/.next/standalone/.next/server/app/setup.segments/_full.segment.rsc +12 -12
  186. package/.next/standalone/.next/server/app/setup.segments/_tree.segment.rsc +1 -1
  187. package/.next/standalone/.next/server/app/setup.segments/setup/__PAGE__.segment.rsc +11 -11
  188. package/.next/standalone/.next/server/app-paths-manifest.json +10 -0
  189. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-rnla2._.js +3 -0
  190. package/.next/standalone/.next/server/chunks/[root-of-the-server]__00la_y0._.js +3 -0
  191. package/.next/standalone/.next/server/chunks/[root-of-the-server]__07t47cm._.js +3 -0
  192. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0cj5jqc._.js +3 -0
  193. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0e0fei3._.js +3 -0
  194. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0i5hdu4._.js +3 -0
  195. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ljcioj._.js +3 -0
  196. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ljnyho._.js +3 -0
  197. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o5-tcg._.js +3 -0
  198. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qrnous._.js +3 -0
  199. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0t3v1a1._.js +3 -0
  200. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0uag-k5._.js +8 -0
  201. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0um1uey._.js +3 -0
  202. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wmexuc._.js +3 -0
  203. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0xu34sz._.js +3 -0
  204. package/.next/standalone/.next/server/chunks/[root-of-the-server]__133knx1._.js +3 -0
  205. package/.next/standalone/.next/server/chunks/[root-of-the-server]__14ou7j5._.js +3 -0
  206. package/.next/standalone/.next/server/chunks/[root-of-the-server]__15-17hl._.js +3 -0
  207. package/.next/standalone/.next/server/chunks/[root-of-the-server]__16iu0hv._.js +3 -0
  208. package/.next/standalone/.next/server/chunks/[root-of-the-server]__19b7mig._.js +3 -0
  209. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1bbcwub._.js +8 -0
  210. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1eris29._.js +3 -0
  211. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1gjo_cq._.js +3 -0
  212. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1kbl21f._.js +3 -0
  213. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1qcm08_._.js +3 -0
  214. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1rphsdk._.js +3 -0
  215. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1t3rugi._.js +3 -0
  216. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1w25q0m._.js +3 -0
  217. package/.next/standalone/.next/server/chunks/_072jl0y._.js +3 -0
  218. package/.next/standalone/.next/server/chunks/_0lw8_i0._.js +3 -0
  219. package/.next/standalone/.next/server/chunks/_1_fynia._.js +21 -3
  220. package/.next/standalone/.next/server/chunks/_1fn30_l._.js +3 -0
  221. package/.next/standalone/.next/server/chunks/_1itd1o_._.js +2 -1
  222. package/.next/standalone/.next/server/chunks/_1iwkh8t._.js +1 -1
  223. package/.next/standalone/.next/server/chunks/_1mxn_lb._.js +3 -0
  224. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_company-scores_legacy_route_actions_1ncspu_.js +3 -0
  225. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_data_export_route_actions_1lkimty.js +3 -0
  226. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_data_import_route_actions_1eji0kd.js +3 -0
  227. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_data_restart_route_actions_00_-u6o.js +3 -0
  228. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_data_reveal_route_actions_0-moqtn.js +3 -0
  229. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_data_route_actions_0j0w5ep.js +3 -0
  230. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_settings_route_actions_1bpm9ac.js +3 -0
  231. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_settings_sector-preview_route_actions_0w79454.js +3 -0
  232. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_settings_sector-suggestions_route_actions_1eoqugp.js +3 -0
  233. package/.next/standalone/.next/server/chunks/lib_db-client_15le7cw.js +155 -0
  234. package/.next/standalone/.next/server/chunks/{lib_rpc_0mc73lk.js → lib_rpc_00tx2sm.js} +1 -1
  235. package/.next/standalone/.next/server/chunks/lib_rpc_02-qa4d.js +3 -0
  236. package/.next/standalone/.next/server/chunks/lib_rpc_02ndsg2.js +3 -0
  237. package/.next/standalone/.next/server/chunks/lib_rpc_08q5vp6.js +3 -0
  238. package/.next/standalone/.next/server/chunks/lib_rpc_0_8i3ft.js +3 -0
  239. package/.next/standalone/.next/server/chunks/lib_rpc_0c9d9ti.js +5 -2
  240. package/.next/standalone/.next/server/chunks/lib_rpc_0huvw-3.js +3 -0
  241. package/.next/standalone/.next/server/chunks/lib_rpc_0ip2vdh.js +3 -0
  242. package/.next/standalone/.next/server/chunks/lib_rpc_0jzisgh.js +3 -0
  243. package/.next/standalone/.next/server/chunks/lib_rpc_0yi9xvd.js +3 -0
  244. package/.next/standalone/.next/server/chunks/lib_rpc_1jyhd0o.js +3 -0
  245. package/.next/standalone/.next/server/chunks/lib_rpc_1kn59-i.js +3 -0
  246. package/.next/standalone/.next/server/chunks/lib_rpc_1q2jkza.js +3 -0
  247. package/.next/standalone/.next/server/chunks/lib_rpc_1vpm1sk.js +3 -0
  248. package/.next/standalone/.next/server/chunks/lib_rpc_1x6p_31.js +3 -0
  249. package/.next/standalone/.next/server/chunks/node_modules_next_1zc5q0a._.js +158 -0
  250. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0mocm6d._.js → [root-of-the-server]__0an6blh._.js} +3 -3
  251. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1m0255u._.js +3 -0
  252. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0bipr5s._.js → [root-of-the-server]__1z1j3ek._.js} +2 -2
  253. package/.next/standalone/.next/server/chunks/ssr/_07u8byv._.js +3 -0
  254. package/.next/standalone/.next/server/chunks/ssr/_08r_mlf._.js +3 -0
  255. package/.next/standalone/.next/server/chunks/ssr/{_0ggabjc._.js → _0942v8n._.js} +1 -1
  256. package/.next/standalone/.next/server/chunks/ssr/{_1djpk8t._.js → _0hl_t7r._.js} +2 -2
  257. package/.next/standalone/.next/server/chunks/ssr/_0tb83dw._.js +132 -0
  258. package/.next/standalone/.next/server/chunks/ssr/_1-87bs1._.js +3 -0
  259. package/.next/standalone/.next/server/chunks/ssr/_17gui6a._.js +1 -1
  260. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_settings_page_actions_11x4dq5.js +3 -0
  261. package/.next/standalone/.next/server/chunks/ssr/app_launch_page_19t0dyd.js +2 -2
  262. package/.next/standalone/.next/server/chunks/ssr/app_page_1fazqbf.js +4 -4
  263. package/.next/standalone/.next/server/chunks/ssr/app_profile_page_0u3-l5y.js +1 -1
  264. package/.next/standalone/.next/server/chunks/ssr/app_queue_page_0c6znd6.js +5 -5
  265. package/.next/standalone/.next/server/chunks/ssr/app_settings_page_1f8mjj_.js +3 -0
  266. package/.next/standalone/.next/server/chunks/ssr/app_setup_page_1-282zx.js +2 -2
  267. package/.next/standalone/.next/server/chunks/ssr/lib_0i8v-s3._.js +1 -1
  268. package/.next/standalone/.next/server/chunks/ssr/node_modules_1f8t_rp._.js +23 -0
  269. package/.next/standalone/.next/server/chunks/ssr/node_modules_1nkgb45._.js +2 -2
  270. package/.next/standalone/.next/server/chunks/ssr/{node_modules_01xbj_9._.js → node_modules_1wax83z._.js} +3 -3
  271. package/.next/standalone/.next/server/chunks/ssr/{node_modules_next_dist_00nap8h._.js → node_modules_next_dist_1bunoni._.js} +2 -2
  272. package/.next/standalone/.next/server/edge/chunks/[root-of-the-server]__0pco7a6._.js +2 -2
  273. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  274. package/.next/standalone/.next/server/middleware-manifest.json +15 -7
  275. package/.next/standalone/.next/server/next-font-manifest.js +1 -1
  276. package/.next/standalone/.next/server/next-font-manifest.json +4 -0
  277. package/.next/standalone/.next/server/pages/404.html +1 -1
  278. package/.next/standalone/.next/server/pages/500.html +1 -1
  279. package/.next/standalone/.next/server/prefetch-hints.json +14 -0
  280. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  281. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  282. package/.next/standalone/.next/static/chunks/06x3jiiz96m5t.js +1 -0
  283. package/.next/standalone/.next/static/chunks/{34at5d2ifl62i.js → 0ngx9s6-zgshe.js} +5 -5
  284. package/.next/standalone/.next/static/chunks/0q-_khndfxubv.js +2 -0
  285. package/.next/standalone/.next/static/chunks/1c79veqedvubt.js +1 -0
  286. package/.next/standalone/.next/static/chunks/1chp3nx45meg5.js +44 -0
  287. package/.next/standalone/.next/static/chunks/1irqj0lf-fu3d.js +1 -0
  288. package/.next/standalone/.next/static/chunks/1uadqylrod5_v.js +1 -0
  289. package/.next/standalone/.next/static/chunks/23u0zclgwpc4d.js +1 -0
  290. package/.next/standalone/.next/static/chunks/289ktj97di6zg.js +1 -0
  291. package/.next/standalone/.next/static/chunks/2b3lmf8e6uj8m.js +16 -0
  292. package/.next/standalone/.next/static/chunks/2jz311xl1pp_8.js +1 -0
  293. package/.next/standalone/.next/static/chunks/3npq5yd7c4dmn.js +2 -0
  294. package/.next/standalone/.next/static/qqqcxvzBUizkECrT4swyK/_clientMiddlewareManifest.js +14 -0
  295. package/.next/standalone/CHANGELOG.md +298 -0
  296. package/.next/standalone/CONTRIBUTING.md +5 -2
  297. package/.next/standalone/README.md +138 -30
  298. package/.next/standalone/SECURITY.md +117 -10
  299. package/.next/standalone/app/api/company-scores/legacy/route.js +32 -0
  300. package/.next/standalone/app/api/company-scores/route.js +20 -11
  301. package/.next/standalone/app/api/data/export/route.js +49 -0
  302. package/.next/standalone/app/api/data/import/route.js +83 -0
  303. package/.next/standalone/app/api/data/restart/route.js +37 -0
  304. package/.next/standalone/app/api/data/reveal/route.js +14 -0
  305. package/.next/standalone/app/api/data/route.js +39 -0
  306. package/.next/standalone/app/api/ingest/route.js +15 -47
  307. package/.next/standalone/app/api/scraper/route.js +264 -125
  308. package/.next/standalone/app/api/settings/route.js +58 -0
  309. package/.next/standalone/app/api/settings/sector-preview/route.js +38 -0
  310. package/.next/standalone/app/api/settings/sector-suggestions/route.js +20 -0
  311. package/.next/standalone/app/api/update/route.js +188 -23
  312. package/.next/standalone/app/avatars/[file]/route.js +4 -2
  313. package/.next/standalone/app/components/CompanyScores.js +28 -7
  314. package/.next/standalone/app/components/EmptyState.js +8 -0
  315. package/.next/standalone/app/components/ForceGraph.js +39 -35
  316. package/.next/standalone/app/components/LegacyScoresCard.js +129 -0
  317. package/.next/standalone/app/components/Sidebar.js +11 -10
  318. package/.next/standalone/app/components/UpdatePanel.js +306 -119
  319. package/.next/standalone/app/components/UserProvider.js +4 -3
  320. package/.next/standalone/app/components/settings/DataSection.js +437 -0
  321. package/.next/standalone/app/components/settings/SectorSection.js +445 -0
  322. package/.next/standalone/app/components/ui.js +62 -0
  323. package/.next/standalone/app/launch/page.js +30 -20
  324. package/.next/standalone/app/page.js +13 -0
  325. package/.next/standalone/app/paths/page.js +12 -4
  326. package/.next/standalone/app/profile/page.js +41 -8
  327. package/.next/standalone/app/queue/page.js +8 -2
  328. package/.next/standalone/app/settings/page.js +96 -0
  329. package/.next/standalone/app/setup/page.js +32 -16
  330. package/.next/standalone/bin/args.mjs +44 -0
  331. package/.next/standalone/bin/six-degrees.mjs +9 -15
  332. package/.next/standalone/lib/companies.js +44 -119
  333. package/.next/standalone/lib/csv.js +8 -0
  334. package/.next/standalone/lib/data-export.js +170 -0
  335. package/.next/standalone/lib/data-folder.js +238 -0
  336. package/.next/standalone/lib/data-import.js +878 -0
  337. package/.next/standalone/lib/db-client.js +48 -3
  338. package/.next/standalone/lib/durable.js +73 -0
  339. package/.next/standalone/lib/gate.js +90 -1
  340. package/.next/standalone/lib/ingest.js +40 -0
  341. package/.next/standalone/lib/legacy-offer.js +185 -0
  342. package/.next/standalone/lib/legacy-scores.js +77 -0
  343. package/.next/standalone/lib/linkedin-limits.js +124 -1
  344. package/.next/standalone/lib/rpc.js +121 -13
  345. package/.next/standalone/lib/sample-stats.js +16 -0
  346. package/.next/standalone/lib/scan-progress.js +13 -0
  347. package/.next/standalone/lib/scan-state.js +53 -0
  348. package/.next/standalone/lib/scanner-python.js +685 -0
  349. package/.next/standalone/lib/scanner-setup.js +104 -0
  350. package/.next/standalone/lib/scoring.js +747 -138
  351. package/.next/standalone/lib/scraper-client.js +9 -5
  352. package/.next/standalone/lib/sector-directory.js +1532 -0
  353. package/.next/standalone/lib/sector-focus.js +163 -0
  354. package/.next/standalone/lib/sector-labels.js +81 -0
  355. package/.next/standalone/lib/settings-effects.js +59 -0
  356. package/.next/standalone/lib/settings.js +83 -0
  357. package/.next/standalone/lib/updater-job.js +838 -0
  358. package/.next/standalone/lib/updater.js +494 -0
  359. package/.next/standalone/middleware.js +25 -28
  360. package/.next/standalone/next.config.mjs +19 -3
  361. package/.next/standalone/package-lock.json +2 -2
  362. package/.next/standalone/package.json +1 -2
  363. package/.next/standalone/scripts/apply-update.sh +482 -0
  364. package/.next/standalone/scripts/build-app.mjs +251 -9
  365. package/.next/standalone/scripts/requirements.txt +106 -4
  366. package/.next/standalone/scripts/test-release-server.mjs +143 -0
  367. package/.next/standalone/server.js +1 -1
  368. package/.next/static/chunks/06x3jiiz96m5t.js +1 -0
  369. package/.next/static/chunks/{34at5d2ifl62i.js → 0ngx9s6-zgshe.js} +5 -5
  370. package/.next/static/chunks/0q-_khndfxubv.js +2 -0
  371. package/.next/static/chunks/1c79veqedvubt.js +1 -0
  372. package/.next/static/chunks/1chp3nx45meg5.js +44 -0
  373. package/.next/static/chunks/1irqj0lf-fu3d.js +1 -0
  374. package/.next/static/chunks/1uadqylrod5_v.js +1 -0
  375. package/.next/static/chunks/23u0zclgwpc4d.js +1 -0
  376. package/.next/static/chunks/289ktj97di6zg.js +1 -0
  377. package/.next/static/chunks/2b3lmf8e6uj8m.js +16 -0
  378. package/.next/static/chunks/2jz311xl1pp_8.js +1 -0
  379. package/.next/static/chunks/3npq5yd7c4dmn.js +2 -0
  380. package/.next/static/qqqcxvzBUizkECrT4swyK/_clientMiddlewareManifest.js +14 -0
  381. package/CHANGELOG.md +298 -0
  382. package/README.md +138 -30
  383. package/SECURITY.md +117 -10
  384. package/bin/args.mjs +44 -0
  385. package/bin/six-degrees.mjs +9 -15
  386. package/lib/companies.js +44 -119
  387. package/lib/csv.js +8 -0
  388. package/lib/data-export.js +170 -0
  389. package/lib/data-folder.js +238 -0
  390. package/lib/data-import.js +878 -0
  391. package/lib/db-client.js +48 -3
  392. package/lib/durable.js +73 -0
  393. package/lib/gate.js +90 -1
  394. package/lib/ingest.js +40 -0
  395. package/lib/legacy-offer.js +185 -0
  396. package/lib/legacy-scores.js +77 -0
  397. package/lib/linkedin-limits.js +124 -1
  398. package/lib/rpc.js +121 -13
  399. package/lib/sample-stats.js +16 -0
  400. package/lib/scan-progress.js +13 -0
  401. package/lib/scan-state.js +53 -0
  402. package/lib/scanner-python.js +685 -0
  403. package/lib/scanner-setup.js +104 -0
  404. package/lib/scoring.js +747 -138
  405. package/lib/scraper-client.js +9 -5
  406. package/lib/sector-directory.js +1532 -0
  407. package/lib/sector-focus.js +163 -0
  408. package/lib/sector-labels.js +81 -0
  409. package/lib/settings-effects.js +59 -0
  410. package/lib/settings.js +83 -0
  411. package/lib/updater-job.js +838 -0
  412. package/lib/updater.js +494 -0
  413. package/package.json +1 -2
  414. package/scripts/requirements.txt +106 -4
  415. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0jrmmj-._.js +0 -150
  416. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qx548g._.js +0 -151
  417. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1an3leo._.js +0 -150
  418. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1m8zedk._.js +0 -155
  419. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1zor0ys._.js +0 -3
  420. package/.next/standalone/.next/server/chunks/_0_rp-01._.js +0 -3
  421. package/.next/standalone/.next/server/chunks/_0hzdk79._.js +0 -3
  422. package/.next/standalone/.next/server/chunks/_0ow7u5r._.js +0 -3
  423. package/.next/standalone/.next/server/chunks/_0t0zc2d._.js +0 -3
  424. package/.next/standalone/.next/server/chunks/_0wa631d._.js +0 -3
  425. package/.next/standalone/.next/server/chunks/_13ccnao._.js +0 -3
  426. package/.next/standalone/.next/server/chunks/_13es063._.js +0 -3
  427. package/.next/standalone/.next/server/chunks/_142872j._.js +0 -3
  428. package/.next/standalone/.next/server/chunks/_18wsb_a._.js +0 -8
  429. package/.next/standalone/.next/server/chunks/_1e-4h5h._.js +0 -3
  430. package/.next/standalone/.next/server/chunks/_1gvvd7n._.js +0 -158
  431. package/.next/standalone/.next/server/chunks/_1moda66._.js +0 -3
  432. package/.next/standalone/.next/server/chunks/_1p6ghzv._.js +0 -3
  433. package/.next/standalone/.next/server/chunks/_1xmmi_v._.js +0 -3
  434. package/.next/standalone/.next/server/chunks/_1z-yrlf._.js +0 -3
  435. package/.next/standalone/.next/server/chunks/ssr/_0bf3x4q._.js +0 -3
  436. package/.next/standalone/.next/server/chunks/ssr/app_paths_page_1ol90m7.js +0 -4
  437. package/.next/standalone/.next/static/ZGTiDrZ5NHGETgGdlhssu/_clientMiddlewareManifest.js +0 -6
  438. package/.next/standalone/.next/static/chunks/0jk64vo17avsb.js +0 -1
  439. package/.next/standalone/.next/static/chunks/0s65dsrthylo6.js +0 -2
  440. package/.next/standalone/.next/static/chunks/0uyfdhi8dek85.js +0 -16
  441. package/.next/standalone/.next/static/chunks/220-ne82aus0c.js +0 -44
  442. package/.next/standalone/.next/static/chunks/229haorf0f19b.js +0 -2
  443. package/.next/standalone/.next/static/chunks/2g54uafnwuakc.js +0 -1
  444. package/.next/standalone/.next/static/chunks/2spwqs6b6dx13.js +0 -1
  445. package/.next/standalone/.next/static/chunks/38dlepuubiox0.js +0 -1
  446. package/.next/standalone/scripts/score-connections.sql +0 -80
  447. package/.next/standalone/scripts/score_new_connections.sql +0 -77
  448. package/.next/standalone/site/app.js +0 -84
  449. package/.next/standalone/site/index.html +0 -221
  450. package/.next/standalone/site/style.css +0 -155
  451. package/.next/standalone/site/video/install-mac-poster.jpg +0 -0
  452. package/.next/standalone/site/video/install-mac.mp4 +0 -0
  453. package/.next/standalone/site/video/linux-poster.jpg +0 -0
  454. package/.next/standalone/site/video/linux.mp4 +0 -0
  455. package/.next/standalone/site/video/scan-poster.jpg +0 -0
  456. package/.next/standalone/site/video/scan.mp4 +0 -0
  457. package/.next/static/ZGTiDrZ5NHGETgGdlhssu/_clientMiddlewareManifest.js +0 -6
  458. package/.next/static/chunks/0jk64vo17avsb.js +0 -1
  459. package/.next/static/chunks/0s65dsrthylo6.js +0 -2
  460. package/.next/static/chunks/0uyfdhi8dek85.js +0 -16
  461. package/.next/static/chunks/220-ne82aus0c.js +0 -44
  462. package/.next/static/chunks/229haorf0f19b.js +0 -2
  463. package/.next/static/chunks/2g54uafnwuakc.js +0 -1
  464. package/.next/static/chunks/2spwqs6b6dx13.js +0 -1
  465. package/.next/static/chunks/38dlepuubiox0.js +0 -1
  466. package/scripts/score_new_connections.sql +0 -77
  467. /package/.next/standalone/.next/static/{ZGTiDrZ5NHGETgGdlhssu → qqqcxvzBUizkECrT4swyK}/_buildManifest.js +0 -0
  468. /package/.next/standalone/.next/static/{ZGTiDrZ5NHGETgGdlhssu → qqqcxvzBUizkECrT4swyK}/_ssgManifest.js +0 -0
  469. /package/.next/static/{ZGTiDrZ5NHGETgGdlhssu → qqqcxvzBUizkECrT4swyK}/_buildManifest.js +0 -0
  470. /package/.next/static/{ZGTiDrZ5NHGETgGdlhssu → qqqcxvzBUizkECrT4swyK}/_ssgManifest.js +0 -0
@@ -0,0 +1,482 @@
1
+ #!/bin/bash
2
+ # Put a new version of Six Degrees in place of the one that just quit, and open it.
3
+ #
4
+ # The app's server starts this (lib/updater-job.js) after it has downloaded the
5
+ # new version, checked it against the release's SHA256SUMS and checked that its
6
+ # code signature is intact, and copied it into a hidden folder beside the
7
+ # running app. Then the app quits. Everything slow or likely to fail has already
8
+ # happened by then. What is left:
9
+ #
10
+ # 1. Wait until the old app has gone: the processes the server named (--pid:
11
+ # the app and the server itself) and every process whose *executable* is
12
+ # inside the old app (Electron's helpers, and the server, which runs the
13
+ # app's own node). After --wait seconds, stop what is left of those:
14
+ # SIGTERM, then SIGKILL after --grace seconds. Nothing else is ever stopped:
15
+ # a Terminal, an editor or a `tail -f` whose folder or file is inside the
16
+ # app isn't the app (TRAPS §40). If the app can't be stopped, nothing
17
+ # changes and it is opened again.
18
+ # 2. Rename the old app aside, in the same folder (it is never deleted first),
19
+ # then rename the new one into its place, or copy it with ditto if a rename
20
+ # can't do it.
21
+ # 3. Clear the quarantine flag and open it, with the app's own arguments. Then
22
+ # wait for it to say it has started: its server writes --confirm when the
23
+ # first page asks for /api/update, which every page does. A new version
24
+ # that closes before that (it crashed, or its server couldn't start and the
25
+ # error was dismissed) is taken out again, like one that can't be put in
26
+ # place, and the old app is put back and opened.
27
+ # 4. Keep the old version, one copy, as a zip in --keep, and write the outcome
28
+ # to --status. The app reads that file on its next start and shows it in
29
+ # Settings → Updates.
30
+ #
31
+ # If anything fails after the old app was moved, the old app is put back and
32
+ # opened again. install.sh can't do that, because it deletes first. Nothing is
33
+ # deleted here before what replaces it is in place: the new version that failed
34
+ # is moved out of the way first, and removed only once the old one is back.
35
+ #
36
+ # Every value comes from the server. Nothing comes from a web page.
37
+ #
38
+ # apply-update.sh --target APP --staged DIR --status FILE --from VERSION --to VERSION
39
+ # [--keep DIR] [--pid PID]... [--wait SECONDS] [--grace SECONDS]
40
+ # [--confirm FILE] [--confirm-wait SECONDS]
41
+ # [--log FILE] [--work DIR] [-- ARGUMENTS FOR THE NEW APP...]
42
+ #
43
+ # --staged must be the one place the server stages to, ".<app>.incoming" beside
44
+ # the app: it is removed after use, so nothing else is accepted.
45
+ #
46
+ # It handles both kinds of Mac app: the Electron app (Contents/MacOS/Six Degrees)
47
+ # and the classic launcher (a bash script, Contents/MacOS/six-degrees). It only
48
+ # moves whole bundles, so their insides don't matter.
49
+ #
50
+ # The tests (tests/apply-update.test.mjs) run it against pretend apps in a
51
+ # temporary folder. They swap `open` for a stand-in through
52
+ # SIX_DEGREES_UPDATER_OPEN, which is read only when SIX_DEGREES_UPDATER_TEST=1.
53
+ # The server starts this with a clean environment, so neither variable can
54
+ # reach a real update.
55
+ #
56
+ # macOS's /bin/bash is version 3.2: no associative arrays, and an empty array
57
+ # needs ${a[@]+"${a[@]}"} under `set -u`.
58
+
59
+ set -uo pipefail # not -e: each failure is handled, so the old app can be put back
60
+
61
+ # ps and lsof print a name that isn't plain ASCII as escapes in the C locale,
62
+ # and then no path matches: an app in "Programmes Été" would never be found, and
63
+ # would be swapped while it still ran. The server starts this with the same
64
+ # setting (lib/updater-job.js helperEnv); it is set here too, for any other caller.
65
+ export LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
66
+
67
+ OPEN=/usr/bin/open
68
+ if [ "${SIX_DEGREES_UPDATER_TEST:-}" = 1 ] && [ -n "${SIX_DEGREES_UPDATER_OPEN:-}" ]; then
69
+ OPEN="$SIX_DEGREES_UPDATER_OPEN"
70
+ fi
71
+
72
+ target="" staged="" keep="" status="" from="" to="" wait=30 grace=5 log_file="" work=""
73
+ confirm="" confirm_wait=600
74
+ pids=() # the processes the server named
75
+ starts=() # when each of them started: with the pid, that names one process
76
+ relaunch=()
77
+ inside="" # "<target>/Contents/", as given
78
+ inside_real="" # the same with symlinks resolved, as lsof reports paths
79
+ staged_expected=""
80
+ kept=""
81
+ aside=""
82
+
83
+ log() { printf '%s %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*"; }
84
+
85
+ # A value for the status file, as a JSON string.
86
+ json_string() {
87
+ local s nl=$'\n'
88
+ # Control characters other than tab and newline can't appear in a path or a
89
+ # message anyone should read; they would make the file unreadable.
90
+ s="$(printf '%s' "$1" | tr -d '\000-\010\013-\037')"
91
+ s="${s//\\/\\\\}"; s="${s//\"/\\\"}"; s="${s// /\\t}"; s="${s//$nl/\\n}"
92
+ printf '"%s"' "$s"
93
+ }
94
+
95
+ # The outcome, for the app's next start (lib/updater.js lastUpdateReport).
96
+ write_status() { # outcome [reason]
97
+ local outcome="$1" reason="${2:-}" tmp="$status.$$.tmp"
98
+ mkdir -p "$(dirname "$status")" 2>/dev/null
99
+ {
100
+ printf '{"outcome":%s,"from":%s,"to":%s,"at":%s' \
101
+ "$(json_string "$outcome")" "$(json_string "$from")" "$(json_string "$to")" \
102
+ "$(json_string "$(date -u '+%Y-%m-%dT%H:%M:%SZ')")"
103
+ if [ -n "$reason" ]; then printf ',"reason":%s' "$(json_string "$reason")"; fi
104
+ if [ -n "$kept" ]; then printf ',"previous":%s' "$(json_string "$kept")"; fi
105
+ if [ -n "$log_file" ]; then printf ',"log":%s' "$(json_string "$log_file")"; fi
106
+ printf '}\n'
107
+ } > "$tmp" && mv -f "$tmp" "$status"
108
+ log "Outcome: $outcome${reason:+ ($reason)}"
109
+ }
110
+
111
+ # Open an app with the arguments it was given (open drops both the environment
112
+ # and the command line of whoever calls it).
113
+ open_app() { # app
114
+ if [ ${#relaunch[@]} -gt 0 ]; then
115
+ "$OPEN" "$1" --args "${relaunch[@]}"
116
+ else
117
+ "$OPEN" "$1"
118
+ fi
119
+ }
120
+
121
+ # ── which processes are the app's ────────────────────────────────────────────
122
+
123
+ started_at() { ps -o lstart= -p "$1" 2>/dev/null; }
124
+
125
+ # Every process of this user whose executable is inside the app, one pid per
126
+ # line. The first "txt" file lsof lists for a process is its executable. Not its
127
+ # command line or working folder: a process can rewrite its command line (Next
128
+ # does, TRAPS §26), and anything can name a file in the app or sit in its
129
+ # folder, a Terminal or an editor above all (TRAPS §40). A fixed-string prefix:
130
+ # "Six Degrees (1).app" is never read as a pattern, and another copy of the app
131
+ # never matches. lsof sees only this user's processes; a copy another user has
132
+ # open is the server's to refuse before it hands over (lib/updater-job.js).
133
+ from_app() {
134
+ lsof -d txt -Fpn 2>/dev/null | A="$inside" B="$inside_real" awk '
135
+ /^p/ { pid = substr($0, 2); first = 1; next }
136
+ /^n/ && first {
137
+ first = 0
138
+ exe = substr($0, 2)
139
+ if (index(exe, ENVIRON["A"]) == 1 || index(exe, ENVIRON["B"]) == 1) print pid
140
+ }'
141
+ }
142
+
143
+ # Is this process the old app's? Asked before a pid the server named is stopped:
144
+ # its executable, command or working folder is inside the app. (A named pid is
145
+ # already the same process the server named: see named_alive.)
146
+ belongs() { # pid
147
+ local exe cmd cwd
148
+ exe="$(lsof -a -p "$1" -d txt -Fn 2>/dev/null | sed -n 's/^n//p' | head -1)"
149
+ case "$exe" in "$inside"*|"$inside_real"*) return 0 ;; esac
150
+ cmd="$(ps -o command= -p "$1" 2>/dev/null)" || return 1
151
+ case "$cmd" in "$inside"*|*" $inside"*|"$inside_real"*|*" $inside_real"*) return 0 ;; esac
152
+ cwd="$(lsof -a -p "$1" -d cwd -Fn 2>/dev/null | sed -n 's/^n//p' | head -1)"
153
+ case "$cwd/" in "$inside"*|"$inside_real"*) return 0 ;; esac
154
+ return 1
155
+ }
156
+
157
+ # The named processes still running, and still the ones the server named: a pid
158
+ # whose start time has changed was given to something else meanwhile.
159
+ named_alive() {
160
+ local i=0
161
+ while [ "$i" -lt ${#pids[@]} ]; do
162
+ if [ -n "${starts[$i]}" ] && [ "$(started_at "${pids[$i]}")" = "${starts[$i]}" ]; then
163
+ echo "${pids[$i]}"
164
+ fi
165
+ i=$((i + 1))
166
+ done
167
+ }
168
+
169
+ as_line() { sort -un | tr '\n' ' ' | sed 's/ *$//'; }
170
+
171
+ # What is still to be waited for.
172
+ waiting_now() { { named_alive; from_app; } | as_line; }
173
+
174
+ # What may be stopped: a named process while it is still the old app's, and
175
+ # anything whose executable is inside the app. Nothing else, ever.
176
+ stoppable_now() {
177
+ local p
178
+ { for p in $(named_alive); do belongs "$p" && echo "$p"; done; from_app; } | as_line
179
+ }
180
+
181
+ # Wait for the app to be gone; stop what's left of it after $1 seconds, giving
182
+ # it $2 more after SIGTERM before SIGKILL.
183
+ wait_for_exit() { # wait grace
184
+ local deadline left
185
+ deadline=$((SECONDS + $1))
186
+ while :; do
187
+ left="$(waiting_now)"
188
+ [ -z "$left" ] && return 0
189
+ [ "$SECONDS" -ge "$deadline" ] && break
190
+ sleep 0.25
191
+ done
192
+ left="$(stoppable_now)"
193
+ if [ -n "$left" ]; then
194
+ log "Still running after ${1}s: $left. Asking them to stop."
195
+ # shellcheck disable=SC2086 # a list of pids, split on purpose
196
+ kill $left 2>/dev/null
197
+ deadline=$((SECONDS + $2))
198
+ while [ "$SECONDS" -lt "$deadline" ]; do
199
+ sleep 0.25
200
+ [ -z "$(stoppable_now)" ] && break
201
+ done
202
+ left="$(stoppable_now)"
203
+ if [ -n "$left" ]; then
204
+ log "Still running after ${2}s more: $left. Stopping them."
205
+ # shellcheck disable=SC2086
206
+ kill -9 $left 2>/dev/null
207
+ sleep 1
208
+ fi
209
+ fi
210
+ left="$(stoppable_now)"
211
+ if [ -n "$left" ]; then
212
+ log "Could not stop: $left."
213
+ return 1
214
+ fi
215
+ # A named process that doesn't run from the app isn't one of its own any
216
+ # more, and isn't this script's to stop. Nothing of the app is left.
217
+ left="$(waiting_now)"
218
+ [ -n "$left" ] && log "Not waiting for $left any longer: it doesn't run from the old app."
219
+ return 0
220
+ }
221
+
222
+ # ── moving apps ──────────────────────────────────────────────────────────────
223
+
224
+ # A name beside the app that nothing has: ".<app>.<what>-<this pid>", with -2,
225
+ # -3… on the end if an earlier update left that one behind. `mv` onto a folder
226
+ # that exists moves *into* it, so a taken name must never be used.
227
+ unused_beside() { # what
228
+ local base name n=1
229
+ base="$(dirname "$target")/.$(basename "$target").$1-$$"
230
+ name="$base"
231
+ while [ -e "$name" ] || [ -L "$name" ]; do
232
+ n=$((n + 1))
233
+ [ "$n" -gt 99 ] && return 1
234
+ name="$base-$n"
235
+ done
236
+ printf '%s\n' "$name"
237
+ }
238
+
239
+ # The staged copy, removed only under its one possible name (checked in main).
240
+ remove_staged() {
241
+ if [ -n "$staged" ] && [ "$staged" = "$staged_expected" ]; then rm -rf "$staged"; fi
242
+ }
243
+
244
+ # Something failed after the old app was moved aside: put it back and open it.
245
+ # What is at the app's place now (the new version, or part of a copy) is moved
246
+ # out of the way, never deleted, until the old app is back.
247
+ put_back() { # reason
248
+ local reason="$1" err="" failed=""
249
+ trap '' TERM INT HUP # two renames that must not be cut in half
250
+ # Nothing may run from what is taken out: a new version that `open` said it
251
+ # couldn't open, but did.
252
+ wait_for_exit 3 2 || log "Something of the new version is still running."
253
+ if [ -e "$target" ] || [ -L "$target" ]; then
254
+ if ! failed="$(unused_beside failed)" || [ -e "$failed" ] || ! err="$(mv "$target" "$failed" 2>&1)"; then
255
+ trap - TERM INT HUP
256
+ kept="$aside"
257
+ write_status failed "$reason; the new version couldn't be moved out of the way (${err:-no free name for it})"
258
+ return
259
+ fi
260
+ fi
261
+ if err="$(mv "$aside" "$target" 2>&1)"; then
262
+ trap - TERM INT HUP
263
+ if [ -n "$failed" ]; then rm -rf "$failed"; fi # only now: the old app is back
264
+ remove_staged
265
+ write_status rolled-back "$reason"
266
+ open_app "$target" || log "Could not open the previous version either."
267
+ else
268
+ trap - TERM INT HUP
269
+ kept="$aside"
270
+ write_status failed "$reason; putting the previous version back failed too ($err)"
271
+ fi
272
+ }
273
+
274
+ # Wait for the new version to say it has started: its server writes --confirm
275
+ # when the first page asks for /api/update. 0: it has. 1: it closed first
276
+ # (nothing runs from it, three looks in a row). 2: it still runs after
277
+ # --confirm-wait seconds without saying so, and is left be.
278
+ said_started() { [ -f "$confirm" ] && grep -qF "\"version\":$(json_string "$to")" "$confirm" 2>/dev/null; }
279
+ # Anything still running from the app, for deciding it has closed. A rollback
280
+ # must never come from a look that missed it, so a process started by its path
281
+ # inside the app counts too (ps shows argv[0]: the Electron app and its
282
+ # helpers are started that way). Only for this look; nothing is stopped on it.
283
+ runs_from_app() {
284
+ [ -n "$(from_app)" ] && return 0
285
+ ps -axo comm= 2>/dev/null | A="$inside" B="$inside_real" awk '
286
+ index($0, ENVIRON["A"]) == 1 || index($0, ENVIRON["B"]) == 1 { found = 1 } END { exit !found }'
287
+ }
288
+ await_start() {
289
+ local deadline gone=0
290
+ deadline=$((SECONDS + confirm_wait))
291
+ while :; do
292
+ sleep 1
293
+ said_started && return 0
294
+ if ! runs_from_app; then
295
+ gone=$((gone + 1))
296
+ if [ "$gone" -ge 3 ]; then
297
+ said_started && return 0
298
+ return 1
299
+ fi
300
+ else
301
+ gone=0
302
+ fi
303
+ [ "$SECONDS" -ge "$deadline" ] && return 2
304
+ done
305
+ }
306
+
307
+ # Keep the old version, one copy, as a zip in --keep, until the next update.
308
+ # A zip, not the app itself: an app left in a folder can turn up in Spotlight
309
+ # beside the real one, and a Finder alias or a Dock icon may follow a moved
310
+ # folder rather than its old path (DESKTOP.md D4). Once the old folder is gone,
311
+ # both find the new one by its path, as they do after install.sh. It runs
312
+ # after the new version has started, at low priority, because it takes a while.
313
+ keep_previous() {
314
+ local name version zip box="" f
315
+ if [ -z "$keep" ]; then
316
+ rm -rf "$aside"
317
+ log "Removed the previous version."
318
+ return
319
+ fi
320
+ name="$(basename "$target" .app)"
321
+ version="${from//[^0-9A-Za-z._-]/}"
322
+ zip="$keep/$name ${version:-previous}.zip"
323
+ mkdir -p "$keep" 2>/dev/null
324
+ # Under its own name, so unzipping it gives "Six Degrees.app". A fresh folder
325
+ # each time: an old one of the same name would take the app inside it.
326
+ if box="$(mktemp -d "$keep/.previous-XXXXXX" 2>/dev/null)" \
327
+ && mv "$aside" "$box/$name.app" 2>/dev/null \
328
+ && nice -n 10 ditto -c -k --sequesterRsrc --keepParent "$box/$name.app" "$zip.part" 2>/dev/null \
329
+ && mv -f "$zip.part" "$zip"; then
330
+ for f in "$keep/$name "*.zip; do
331
+ if [ -e "$f" ] && [ "$f" != "$zip" ]; then rm -f "$f"; fi # the one kept last time
332
+ done
333
+ kept="$zip"
334
+ log "Kept a copy of the previous version: $zip"
335
+ else
336
+ rm -f "$zip.part"
337
+ log "Could not keep a copy of the previous version in $keep; removing it."
338
+ fi
339
+ if [ -n "$box" ]; then rm -rf "$box"; fi
340
+ rm -rf "$aside"
341
+ }
342
+
343
+ refuse() { log "Refusing: $*"; exit 2; }
344
+
345
+ main() {
346
+ while [ $# -gt 0 ]; do
347
+ case "$1" in
348
+ --target) target="$2"; shift 2 ;;
349
+ --staged) staged="$2"; shift 2 ;;
350
+ --keep) keep="$2"; shift 2 ;;
351
+ --status) status="$2"; shift 2 ;;
352
+ --from) from="$2"; shift 2 ;;
353
+ --to) to="$2"; shift 2 ;;
354
+ --pid) pids+=("$2"); shift 2 ;;
355
+ --wait) wait="$2"; shift 2 ;;
356
+ --grace) grace="$2"; shift 2 ;;
357
+ --confirm) confirm="$2"; shift 2 ;;
358
+ --confirm-wait) confirm_wait="$2"; shift 2 ;;
359
+ --log) log_file="$2"; shift 2 ;;
360
+ --work) work="$2"; shift 2 ;;
361
+ --) shift; relaunch=("$@"); break ;;
362
+ *) log "Unknown argument: $1"; exit 2 ;;
363
+ esac
364
+ done
365
+ if [ -z "$target" ] || [ -z "$staged" ] || [ -z "$status" ] || [ -z "$to" ]; then
366
+ log "Missing arguments: --target, --staged, --status and --to are needed."
367
+ exit 2
368
+ fi
369
+ case "$target" in
370
+ /*.app) ;;
371
+ *) refuse "$target is not an app." ;;
372
+ esac
373
+ local n
374
+ for n in "$wait" "$grace" "$confirm_wait" ${pids[@]+"${pids[@]}"}; do
375
+ case "$n" in ''|*[!0-9]*) refuse "'$n' is not a whole number (--wait, --grace, --confirm-wait and --pid take one)." ;; esac
376
+ done
377
+ # Whatever is at --staged is removed after use, so it can only be the server's
378
+ # staging folder beside the app (lib/updater.js stagingPath), never anything else.
379
+ staged_expected="$(dirname "$target")/.$(basename "$target").incoming"
380
+ [ "$staged" = "$staged_expected" ] || refuse "the new version must wait at $staged_expected, not $staged."
381
+ case "$keep" in ''|/?*) ;; *) refuse "--keep must be a whole path." ;; esac
382
+ case "$confirm" in ''|/*/update-confirmed.json) ;; *) refuse "--confirm must be a whole path to update-confirmed.json." ;; esac
383
+
384
+ inside="$target/Contents/"
385
+ # Both must be whole absolute paths: they are matched as prefixes of other
386
+ # processes' executables, so a shortened one ("/Six Degrees.app/Contents/")
387
+ # would match every copy of the app on this Mac.
388
+ local parent_real
389
+ if parent_real="$(cd "$(dirname "$target")" 2>/dev/null && pwd -P)" && [ "${parent_real#/}" != "$parent_real" ]; then
390
+ inside_real="${parent_real%/}/$(basename "$target")/Contents/"
391
+ else
392
+ inside_real="$inside"
393
+ fi
394
+ # The server's folder for this run (the downloaded image, this script's copy).
395
+ # Only ever one of its own.
396
+ case "$(basename "${work:-x}")" in
397
+ six-degrees-update-*) trap 'rm -rf "$work"' EXIT ;;
398
+ esac
399
+ # The named processes as they are now, so a number the system hands out again
400
+ # later is never mistaken for them.
401
+ local p
402
+ for p in ${pids[@]+"${pids[@]}"}; do starts+=("$(started_at "$p")"); done
403
+
404
+ log "Updating $target from ${from:-?} to $to."
405
+
406
+ if ! wait_for_exit "$wait" "$grace"; then
407
+ remove_staged
408
+ write_status not-applied "the old version didn't close"
409
+ open_app "$target" || log "Could not open it again."
410
+ exit 1
411
+ fi
412
+ log "The old version has closed."
413
+
414
+ if [ ! -d "$staged/Contents" ]; then
415
+ write_status not-applied "the new version was missing when it was time to put it in place"
416
+ open_app "$target"
417
+ exit 1
418
+ fi
419
+
420
+ # Beside the old app, so this and putting it back are renames on one disk.
421
+ local err=""
422
+ if ! aside="$(unused_beside previous)"; then
423
+ remove_staged
424
+ write_status not-applied "there was no free name beside the app to move the old version to"
425
+ open_app "$target"
426
+ exit 1
427
+ fi
428
+ trap '' TERM INT HUP # from here until something is in the app's place again
429
+ if [ -e "$aside" ] || [ -L "$aside" ] || ! err="$(mv "$target" "$aside" 2>&1)"; then
430
+ trap - TERM INT HUP
431
+ remove_staged
432
+ write_status not-applied "macOS didn't let Six Degrees move its old version aside (${err:-the name it chose was taken})"
433
+ open_app "$target"
434
+ exit 1
435
+ fi
436
+ log "Moved the old version aside, to $aside."
437
+
438
+ if [ -e "$target" ] || [ -L "$target" ]; then
439
+ put_back "something else appeared in the app's place"
440
+ exit 1
441
+ fi
442
+ if ! err="$(mv "$staged" "$target" 2>&1)"; then
443
+ log "Could not rename the new version into place ($err); copying it instead."
444
+ if ! err="$(ditto "$staged" "$target" 2>&1)"; then
445
+ put_back "it couldn't put the new version in place ($err)"
446
+ exit 1
447
+ fi
448
+ remove_staged
449
+ fi
450
+ trap - TERM INT HUP
451
+ log "The new version is in place."
452
+
453
+ # Files the app downloads itself aren't normally quarantined; this is for the
454
+ # case where the same image reached the Mac another way first.
455
+ xattr -dr com.apple.quarantine "$target" 2>/dev/null
456
+
457
+ if [ -n "$confirm" ]; then rm -f "$confirm"; fi # an earlier update's word doesn't count
458
+ if ! err="$(open_app "$target" 2>&1)"; then
459
+ put_back "the new version wouldn't open ($err)"
460
+ exit 1
461
+ fi
462
+ log "Opened the new version."
463
+
464
+ # Until this is over, the status file still says "started" (the server wrote
465
+ # it), which the new version, running, already reads as a success.
466
+ if [ -n "$confirm" ]; then
467
+ await_start
468
+ case $? in
469
+ 0) log "The new version has started." ;;
470
+ 1) put_back "the new version closed before it finished starting"
471
+ exit 1 ;;
472
+ *) log "The new version hasn't said it has started after ${confirm_wait}s. Leaving it running." ;;
473
+ esac
474
+ rm -f "$confirm"
475
+ fi
476
+
477
+ keep_previous
478
+ write_status installed
479
+ exit 0
480
+ }
481
+
482
+ main "$@"