@geoprotocol/geo-sdk 0.18.2 → 0.19.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 (352) hide show
  1. package/README.md +995 -372
  2. package/dist/contracts.d.ts +0 -11
  3. package/dist/contracts.d.ts.map +1 -1
  4. package/dist/contracts.js +0 -11
  5. package/dist/contracts.js.map +1 -1
  6. package/dist/index.d.ts +7 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +7 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/lite.d.ts +2 -0
  11. package/dist/lite.d.ts.map +1 -1
  12. package/dist/lite.js +2 -0
  13. package/dist/lite.js.map +1 -1
  14. package/dist/src/abis/dao-space-v2.test.d.ts +2 -0
  15. package/dist/src/abis/dao-space-v2.test.d.ts.map +1 -0
  16. package/dist/src/abis/dao-space-v2.test.js +67 -0
  17. package/dist/src/abis/dao-space-v2.test.js.map +1 -0
  18. package/dist/src/client/api.d.ts +86 -0
  19. package/dist/src/client/api.d.ts.map +1 -0
  20. package/dist/src/client/api.js +169 -0
  21. package/dist/src/client/api.js.map +1 -0
  22. package/dist/src/client/comments.d.ts +59 -0
  23. package/dist/src/client/comments.d.ts.map +1 -0
  24. package/dist/src/client/comments.js +96 -0
  25. package/dist/src/client/comments.js.map +1 -0
  26. package/dist/src/client/context.d.ts +20 -0
  27. package/dist/src/client/context.d.ts.map +1 -0
  28. package/dist/src/client/context.js +20 -0
  29. package/dist/src/client/context.js.map +1 -0
  30. package/dist/src/client/dao-spaces.d.ts +348 -0
  31. package/dist/src/client/dao-spaces.d.ts.map +1 -0
  32. package/dist/src/client/dao-spaces.js +494 -0
  33. package/dist/src/client/dao-spaces.js.map +1 -0
  34. package/dist/src/client/dao-spaces.test.d.ts +2 -0
  35. package/dist/src/client/dao-spaces.test.d.ts.map +1 -0
  36. package/dist/src/client/dao-spaces.test.js +263 -0
  37. package/dist/src/client/dao-spaces.test.js.map +1 -0
  38. package/dist/src/client/edits.d.ts +100 -0
  39. package/dist/src/client/edits.d.ts.map +1 -0
  40. package/dist/src/client/edits.js +131 -0
  41. package/dist/src/client/edits.js.map +1 -0
  42. package/dist/src/client/edits.test.d.ts +2 -0
  43. package/dist/src/client/edits.test.d.ts.map +1 -0
  44. package/dist/src/client/edits.test.js +98 -0
  45. package/dist/src/client/edits.test.js.map +1 -0
  46. package/dist/src/client/entities.d.ts +23 -0
  47. package/dist/src/client/entities.d.ts.map +1 -0
  48. package/dist/src/client/entities.js +88 -0
  49. package/dist/src/client/entities.js.map +1 -0
  50. package/dist/src/client/entity-votes.d.ts +141 -0
  51. package/dist/src/client/entity-votes.d.ts.map +1 -0
  52. package/dist/src/client/entity-votes.js +168 -0
  53. package/dist/src/client/entity-votes.js.map +1 -0
  54. package/dist/src/client/entity-votes.test.d.ts +2 -0
  55. package/dist/src/client/entity-votes.test.d.ts.map +1 -0
  56. package/dist/src/client/entity-votes.test.js +93 -0
  57. package/dist/src/client/entity-votes.test.js.map +1 -0
  58. package/dist/src/client/graph-workflows.test.d.ts +2 -0
  59. package/dist/src/client/graph-workflows.test.d.ts.map +1 -0
  60. package/dist/src/client/graph-workflows.test.js +83 -0
  61. package/dist/src/client/graph-workflows.test.js.map +1 -0
  62. package/dist/src/client/images-storage.test.d.ts +2 -0
  63. package/dist/src/client/images-storage.test.d.ts.map +1 -0
  64. package/dist/src/client/images-storage.test.js +52 -0
  65. package/dist/src/client/images-storage.test.js.map +1 -0
  66. package/dist/src/client/images.d.ts +35 -0
  67. package/dist/src/client/images.d.ts.map +1 -0
  68. package/dist/src/client/images.js +90 -0
  69. package/dist/src/client/images.js.map +1 -0
  70. package/dist/src/client/personal-spaces.d.ts +155 -0
  71. package/dist/src/client/personal-spaces.d.ts.map +1 -0
  72. package/dist/src/client/personal-spaces.js +198 -0
  73. package/dist/src/client/personal-spaces.js.map +1 -0
  74. package/dist/src/client/proposals.d.ts +185 -0
  75. package/dist/src/client/proposals.d.ts.map +1 -0
  76. package/dist/src/client/proposals.js +294 -0
  77. package/dist/src/client/proposals.js.map +1 -0
  78. package/dist/src/client/proposals.test.d.ts +2 -0
  79. package/dist/src/client/proposals.test.d.ts.map +1 -0
  80. package/dist/src/client/proposals.test.js +243 -0
  81. package/dist/src/client/proposals.test.js.map +1 -0
  82. package/dist/src/client/spaces.test.d.ts +2 -0
  83. package/dist/src/client/spaces.test.d.ts.map +1 -0
  84. package/dist/src/client/spaces.test.js +155 -0
  85. package/dist/src/client/spaces.test.js.map +1 -0
  86. package/dist/src/client/storage.d.ts +52 -0
  87. package/dist/src/client/storage.d.ts.map +1 -0
  88. package/dist/src/client/storage.js +53 -0
  89. package/dist/src/client/storage.js.map +1 -0
  90. package/dist/src/client.d.ts +325 -0
  91. package/dist/src/client.d.ts.map +1 -0
  92. package/dist/src/client.js +452 -0
  93. package/dist/src/client.js.map +1 -0
  94. package/dist/src/client.test.d.ts +2 -0
  95. package/dist/src/client.test.d.ts.map +1 -0
  96. package/dist/src/client.test.js +120 -0
  97. package/dist/src/client.test.js.map +1 -0
  98. package/dist/src/contracts-v2/abis.d.ts +196 -0
  99. package/dist/src/contracts-v2/abis.d.ts.map +1 -0
  100. package/dist/src/contracts-v2/abis.js +110 -0
  101. package/dist/src/contracts-v2/abis.js.map +1 -0
  102. package/dist/src/contracts-v2/actions.d.ts +56 -0
  103. package/dist/src/contracts-v2/actions.d.ts.map +1 -0
  104. package/dist/src/contracts-v2/actions.js +83 -0
  105. package/dist/src/contracts-v2/actions.js.map +1 -0
  106. package/dist/src/contracts-v2/encoding.d.ts +80 -0
  107. package/dist/src/contracts-v2/encoding.d.ts.map +1 -0
  108. package/dist/src/contracts-v2/encoding.js +193 -0
  109. package/dist/src/contracts-v2/encoding.js.map +1 -0
  110. package/dist/src/contracts-v2/encoding.test.d.ts +2 -0
  111. package/dist/src/contracts-v2/encoding.test.d.ts.map +1 -0
  112. package/dist/src/contracts-v2/encoding.test.js +93 -0
  113. package/dist/src/contracts-v2/encoding.test.js.map +1 -0
  114. package/dist/src/contracts-v2/local-geobrowser.e2e.test.d.ts +2 -0
  115. package/dist/src/contracts-v2/local-geobrowser.e2e.test.d.ts.map +1 -0
  116. package/dist/src/contracts-v2/local-geobrowser.e2e.test.js +239 -0
  117. package/dist/src/contracts-v2/local-geobrowser.e2e.test.js.map +1 -0
  118. package/dist/src/contracts-v2/voting-settings.d.ts +48 -0
  119. package/dist/src/contracts-v2/voting-settings.d.ts.map +1 -0
  120. package/dist/src/contracts-v2/voting-settings.js +69 -0
  121. package/dist/src/contracts-v2/voting-settings.js.map +1 -0
  122. package/dist/src/dao-space/constants.d.ts +6 -3
  123. package/dist/src/dao-space/constants.d.ts.map +1 -1
  124. package/dist/src/dao-space/constants.js +6 -5
  125. package/dist/src/dao-space/constants.js.map +1 -1
  126. package/dist/src/dao-space/create-space.d.ts +1 -31
  127. package/dist/src/dao-space/create-space.d.ts.map +1 -1
  128. package/dist/src/dao-space/create-space.js +5 -70
  129. package/dist/src/dao-space/create-space.js.map +1 -1
  130. package/dist/src/dao-space/execute-proposal.d.ts +1 -22
  131. package/dist/src/dao-space/execute-proposal.d.ts.map +1 -1
  132. package/dist/src/dao-space/execute-proposal.js +12 -59
  133. package/dist/src/dao-space/execute-proposal.js.map +1 -1
  134. package/dist/src/dao-space/propose-add-editor.test.js +1 -1
  135. package/dist/src/dao-space/propose-add-editor.test.js.map +1 -1
  136. package/dist/src/dao-space/propose-edit.d.ts +1 -30
  137. package/dist/src/dao-space/propose-edit.d.ts.map +1 -1
  138. package/dist/src/dao-space/propose-edit.js +12 -108
  139. package/dist/src/dao-space/propose-edit.js.map +1 -1
  140. package/dist/src/dao-space/propose-edit.test.js +8 -1
  141. package/dist/src/dao-space/propose-edit.test.js.map +1 -1
  142. package/dist/src/dao-space/propose-remove-editor.d.ts.map +1 -1
  143. package/dist/src/dao-space/propose-remove-editor.js +5 -5
  144. package/dist/src/dao-space/propose-remove-editor.js.map +1 -1
  145. package/dist/src/dao-space/propose-remove-editor.test.js +3 -8
  146. package/dist/src/dao-space/propose-remove-editor.test.js.map +1 -1
  147. package/dist/src/dao-space/propose-remove-member.d.ts.map +1 -1
  148. package/dist/src/dao-space/propose-remove-member.js +5 -5
  149. package/dist/src/dao-space/propose-remove-member.js.map +1 -1
  150. package/dist/src/dao-space/propose-request-membership.d.ts.map +1 -1
  151. package/dist/src/dao-space/propose-request-membership.js +4 -4
  152. package/dist/src/dao-space/propose-request-membership.js.map +1 -1
  153. package/dist/src/dao-space/propose-update-voting-settings.d.ts +8 -0
  154. package/dist/src/dao-space/propose-update-voting-settings.d.ts.map +1 -0
  155. package/dist/src/dao-space/propose-update-voting-settings.js +19 -0
  156. package/dist/src/dao-space/propose-update-voting-settings.js.map +1 -0
  157. package/dist/src/dao-space/propose-update-voting-settings.test.d.ts +2 -0
  158. package/dist/src/dao-space/propose-update-voting-settings.test.d.ts.map +1 -0
  159. package/dist/src/dao-space/propose-update-voting-settings.test.js +118 -0
  160. package/dist/src/dao-space/propose-update-voting-settings.test.js.map +1 -0
  161. package/dist/src/dao-space/vote-proposal.d.ts +1 -24
  162. package/dist/src/dao-space/vote-proposal.d.ts.map +1 -1
  163. package/dist/src/dao-space/vote-proposal.js +12 -64
  164. package/dist/src/dao-space/vote-proposal.js.map +1 -1
  165. package/dist/src/e2e/local-geobrowser.d.ts +9 -0
  166. package/dist/src/e2e/local-geobrowser.d.ts.map +1 -0
  167. package/dist/src/e2e/local-geobrowser.js +35 -0
  168. package/dist/src/e2e/local-geobrowser.js.map +1 -0
  169. package/dist/src/e2e/v2-contracts.test.d.ts +2 -0
  170. package/dist/src/e2e/v2-contracts.test.d.ts.map +1 -0
  171. package/dist/src/e2e/v2-contracts.test.js +25 -0
  172. package/dist/src/e2e/v2-contracts.test.js.map +1 -0
  173. package/dist/src/e2e-api-surface.test.d.ts +2 -0
  174. package/dist/src/e2e-api-surface.test.d.ts.map +1 -0
  175. package/dist/src/e2e-api-surface.test.js +1021 -0
  176. package/dist/src/e2e-api-surface.test.js.map +1 -0
  177. package/dist/src/e2e-flows.test.d.ts +2 -0
  178. package/dist/src/e2e-flows.test.d.ts.map +1 -0
  179. package/dist/src/e2e-flows.test.js +445 -0
  180. package/dist/src/e2e-flows.test.js.map +1 -0
  181. package/dist/src/e2e-legacy-api-surface.test.d.ts +2 -0
  182. package/dist/src/e2e-legacy-api-surface.test.d.ts.map +1 -0
  183. package/dist/src/e2e-legacy-api-surface.test.js +840 -0
  184. package/dist/src/e2e-legacy-api-surface.test.js.map +1 -0
  185. package/dist/src/encoding.d.ts +3 -0
  186. package/dist/src/encoding.d.ts.map +1 -1
  187. package/dist/src/encoding.js +3 -0
  188. package/dist/src/encoding.js.map +1 -1
  189. package/dist/src/encodings/get-create-dao-space-calldata.d.ts +3 -89
  190. package/dist/src/encodings/get-create-dao-space-calldata.d.ts.map +1 -1
  191. package/dist/src/encodings/get-create-dao-space-calldata.js +5 -95
  192. package/dist/src/encodings/get-create-dao-space-calldata.js.map +1 -1
  193. package/dist/src/encodings/get-create-personal-space-calldata.d.ts +2 -0
  194. package/dist/src/encodings/get-create-personal-space-calldata.d.ts.map +1 -1
  195. package/dist/src/encodings/get-create-personal-space-calldata.js +2 -0
  196. package/dist/src/encodings/get-create-personal-space-calldata.js.map +1 -1
  197. package/dist/src/graph/comment-utils.d.ts +4 -0
  198. package/dist/src/graph/comment-utils.d.ts.map +1 -1
  199. package/dist/src/graph/comment-utils.js +4 -0
  200. package/dist/src/graph/comment-utils.js.map +1 -1
  201. package/dist/src/graph/constants.d.ts +12 -3
  202. package/dist/src/graph/constants.d.ts.map +1 -1
  203. package/dist/src/graph/constants.js +11 -5
  204. package/dist/src/graph/constants.js.map +1 -1
  205. package/dist/src/graph/create-comment.d.ts +3 -22
  206. package/dist/src/graph/create-comment.d.ts.map +1 -1
  207. package/dist/src/graph/create-comment.js +6 -136
  208. package/dist/src/graph/create-comment.js.map +1 -1
  209. package/dist/src/graph/create-comment.test.js +19 -8
  210. package/dist/src/graph/create-comment.test.js.map +1 -1
  211. package/dist/src/graph/create-entity.d.ts +2 -0
  212. package/dist/src/graph/create-entity.d.ts.map +1 -1
  213. package/dist/src/graph/create-entity.js +2 -0
  214. package/dist/src/graph/create-entity.js.map +1 -1
  215. package/dist/src/graph/create-image.d.ts +2 -21
  216. package/dist/src/graph/create-image.d.ts.map +1 -1
  217. package/dist/src/graph/create-image.js +7 -69
  218. package/dist/src/graph/create-image.js.map +1 -1
  219. package/dist/src/graph/create-property.d.ts +2 -0
  220. package/dist/src/graph/create-property.d.ts.map +1 -1
  221. package/dist/src/graph/create-property.js +2 -0
  222. package/dist/src/graph/create-property.js.map +1 -1
  223. package/dist/src/graph/create-proposal-review.d.ts +1 -27
  224. package/dist/src/graph/create-proposal-review.d.ts.map +1 -1
  225. package/dist/src/graph/create-proposal-review.js +4 -61
  226. package/dist/src/graph/create-proposal-review.js.map +1 -1
  227. package/dist/src/graph/create-relation.d.ts +2 -0
  228. package/dist/src/graph/create-relation.d.ts.map +1 -1
  229. package/dist/src/graph/create-relation.js +2 -0
  230. package/dist/src/graph/create-relation.js.map +1 -1
  231. package/dist/src/graph/create-type.d.ts +2 -0
  232. package/dist/src/graph/create-type.d.ts.map +1 -1
  233. package/dist/src/graph/create-type.js +2 -0
  234. package/dist/src/graph/create-type.js.map +1 -1
  235. package/dist/src/graph/delete-entity.d.ts +2 -14
  236. package/dist/src/graph/delete-entity.d.ts.map +1 -1
  237. package/dist/src/graph/delete-entity.js +5 -78
  238. package/dist/src/graph/delete-entity.js.map +1 -1
  239. package/dist/src/graph/delete-entity.test.js +7 -0
  240. package/dist/src/graph/delete-entity.test.js.map +1 -1
  241. package/dist/src/graph/delete-relation.d.ts +2 -0
  242. package/dist/src/graph/delete-relation.d.ts.map +1 -1
  243. package/dist/src/graph/delete-relation.js +2 -0
  244. package/dist/src/graph/delete-relation.js.map +1 -1
  245. package/dist/src/graph/entity-vote.d.ts +37 -0
  246. package/dist/src/graph/entity-vote.d.ts.map +1 -0
  247. package/dist/src/graph/entity-vote.js +44 -0
  248. package/dist/src/graph/entity-vote.js.map +1 -0
  249. package/dist/src/graph/entity-vote.test.d.ts +2 -0
  250. package/dist/src/graph/entity-vote.test.d.ts.map +1 -0
  251. package/dist/src/graph/entity-vote.test.js +123 -0
  252. package/dist/src/graph/entity-vote.test.js.map +1 -0
  253. package/dist/src/graph/index.d.ts +1 -0
  254. package/dist/src/graph/index.d.ts.map +1 -1
  255. package/dist/src/graph/index.js +1 -0
  256. package/dist/src/graph/index.js.map +1 -1
  257. package/dist/src/graph/update-comment.d.ts +3 -0
  258. package/dist/src/graph/update-comment.d.ts.map +1 -1
  259. package/dist/src/graph/update-comment.js +3 -0
  260. package/dist/src/graph/update-comment.js.map +1 -1
  261. package/dist/src/graph/update-entity.d.ts +2 -0
  262. package/dist/src/graph/update-entity.d.ts.map +1 -1
  263. package/dist/src/graph/update-entity.js +2 -0
  264. package/dist/src/graph/update-entity.js.map +1 -1
  265. package/dist/src/graph/update-proposal-review.d.ts +2 -27
  266. package/dist/src/graph/update-proposal-review.d.ts.map +1 -1
  267. package/dist/src/graph/update-proposal-review.js +4 -50
  268. package/dist/src/graph/update-proposal-review.js.map +1 -1
  269. package/dist/src/graph/update-relation.d.ts +2 -0
  270. package/dist/src/graph/update-relation.d.ts.map +1 -1
  271. package/dist/src/graph/update-relation.js +2 -0
  272. package/dist/src/graph/update-relation.js.map +1 -1
  273. package/dist/src/ipfs-core.d.ts +42 -0
  274. package/dist/src/ipfs-core.d.ts.map +1 -0
  275. package/dist/src/ipfs-core.js +165 -0
  276. package/dist/src/ipfs-core.js.map +1 -0
  277. package/dist/src/ipfs-core.test.d.ts +2 -0
  278. package/dist/src/ipfs-core.test.d.ts.map +1 -0
  279. package/dist/src/ipfs-core.test.js +56 -0
  280. package/dist/src/ipfs-core.test.js.map +1 -0
  281. package/dist/src/ipfs.d.ts +7 -52
  282. package/dist/src/ipfs.d.ts.map +1 -1
  283. package/dist/src/ipfs.js +27 -170
  284. package/dist/src/ipfs.js.map +1 -1
  285. package/dist/src/networks.d.ts +46 -0
  286. package/dist/src/networks.d.ts.map +1 -0
  287. package/dist/src/networks.js +90 -0
  288. package/dist/src/networks.js.map +1 -0
  289. package/dist/src/ops/comments.d.ts +80 -0
  290. package/dist/src/ops/comments.d.ts.map +1 -0
  291. package/dist/src/ops/comments.js +142 -0
  292. package/dist/src/ops/comments.js.map +1 -0
  293. package/dist/src/ops/entities.d.ts +50 -0
  294. package/dist/src/ops/entities.d.ts.map +1 -0
  295. package/dist/src/ops/entities.js +51 -0
  296. package/dist/src/ops/entities.js.map +1 -0
  297. package/dist/src/ops/images.d.ts +37 -0
  298. package/dist/src/ops/images.d.ts.map +1 -0
  299. package/dist/src/ops/images.js +69 -0
  300. package/dist/src/ops/images.js.map +1 -0
  301. package/dist/src/ops/index.d.ts +7 -0
  302. package/dist/src/ops/index.d.ts.map +1 -0
  303. package/dist/src/ops/index.js +7 -0
  304. package/dist/src/ops/index.js.map +1 -0
  305. package/dist/src/ops/index.test.d.ts +2 -0
  306. package/dist/src/ops/index.test.d.ts.map +1 -0
  307. package/dist/src/ops/index.test.js +115 -0
  308. package/dist/src/ops/index.test.js.map +1 -0
  309. package/dist/src/ops/properties.d.ts +20 -0
  310. package/dist/src/ops/properties.d.ts.map +1 -0
  311. package/dist/src/ops/properties.js +20 -0
  312. package/dist/src/ops/properties.js.map +1 -0
  313. package/dist/src/ops/proposal-reviews.d.ts +43 -0
  314. package/dist/src/ops/proposal-reviews.d.ts.map +1 -0
  315. package/dist/src/ops/proposal-reviews.js +103 -0
  316. package/dist/src/ops/proposal-reviews.js.map +1 -0
  317. package/dist/src/ops/relations.d.ts +57 -0
  318. package/dist/src/ops/relations.d.ts.map +1 -0
  319. package/dist/src/ops/relations.js +59 -0
  320. package/dist/src/ops/relations.js.map +1 -0
  321. package/dist/src/ops/types.d.ts +20 -0
  322. package/dist/src/ops/types.d.ts.map +1 -0
  323. package/dist/src/ops/types.js +20 -0
  324. package/dist/src/ops/types.js.map +1 -0
  325. package/dist/src/personal-space/constants.d.ts +1 -0
  326. package/dist/src/personal-space/constants.d.ts.map +1 -1
  327. package/dist/src/personal-space/constants.js +1 -0
  328. package/dist/src/personal-space/constants.js.map +1 -1
  329. package/dist/src/personal-space/create-space.d.ts +1 -18
  330. package/dist/src/personal-space/create-space.d.ts.map +1 -1
  331. package/dist/src/personal-space/create-space.js +1 -18
  332. package/dist/src/personal-space/create-space.js.map +1 -1
  333. package/dist/src/personal-space/has-space.d.ts +9 -2
  334. package/dist/src/personal-space/has-space.d.ts.map +1 -1
  335. package/dist/src/personal-space/has-space.js +9 -13
  336. package/dist/src/personal-space/has-space.js.map +1 -1
  337. package/dist/src/personal-space/has-space.test.d.ts +2 -0
  338. package/dist/src/personal-space/has-space.test.d.ts.map +1 -0
  339. package/dist/src/personal-space/has-space.test.js +30 -0
  340. package/dist/src/personal-space/has-space.test.js.map +1 -0
  341. package/dist/src/personal-space/publish-edit.d.ts +1 -22
  342. package/dist/src/personal-space/publish-edit.d.ts.map +1 -1
  343. package/dist/src/personal-space/publish-edit.js +10 -64
  344. package/dist/src/personal-space/publish-edit.js.map +1 -1
  345. package/dist/src/smart-wallet.d.ts +2 -4
  346. package/dist/src/smart-wallet.d.ts.map +1 -1
  347. package/dist/src/smart-wallet.js +6 -9
  348. package/dist/src/smart-wallet.js.map +1 -1
  349. package/dist/src/types.d.ts +25 -0
  350. package/dist/src/types.d.ts.map +1 -1
  351. package/dist/src/types.js.map +1 -1
  352. package/package.json +14 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/client/entities.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAkDrD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,yBAuCjH"}
@@ -0,0 +1,88 @@
1
+ import { deleteRelation as grcDeleteRelation, updateEntity as grcUpdateEntity, } from '@geoprotocol/grc-20';
2
+ import { Id } from '../id.js';
3
+ import { assertValid, toGrcId } from '../id-utils.js';
4
+ import { graphqlData } from './api.js';
5
+ class DeleteEntityError extends Error {
6
+ _tag = 'DeleteEntityError';
7
+ }
8
+ function createDeleteEntityOps({ id, spaceId, values, relations }) {
9
+ assertValid(id, '`id` in `deleteEntity`');
10
+ assertValid(spaceId, '`spaceId` in `deleteEntity`');
11
+ const normalizedSpaceId = String(spaceId).replaceAll('-', '');
12
+ const ops = [];
13
+ const matchingValues = values.filter(v => v.spaceId === normalizedSpaceId);
14
+ const matchingRelations = relations.filter(r => r.spaceId === normalizedSpaceId);
15
+ const uniquePropertyIds = [...new Set(matchingValues.map(v => v.propertyId))];
16
+ if (uniquePropertyIds.length > 0) {
17
+ const unsetValues = uniquePropertyIds.map(propertyId => ({
18
+ property: toGrcId(propertyId),
19
+ language: { type: 'all' },
20
+ }));
21
+ ops.push(grcUpdateEntity({
22
+ id: toGrcId(id),
23
+ set: [],
24
+ unset: unsetValues,
25
+ }));
26
+ }
27
+ for (const relation of matchingRelations) {
28
+ ops.push(grcDeleteRelation(toGrcId(relation.id)));
29
+ }
30
+ return { id: Id(id), ops };
31
+ }
32
+ /**
33
+ * Fetches the current entity values and relations for a space, then builds delete ops.
34
+ *
35
+ * Entity deletion requires current graph context so the SDK can unset existing
36
+ * values and delete existing relations in the target space.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const { ops } = await geo.entities.delete({
41
+ * id: entityId,
42
+ * spaceId,
43
+ * });
44
+ * ```
45
+ *
46
+ * @param context Client context containing API origin and fetch configuration.
47
+ * @param params Entity ID and space ID to delete within.
48
+ * @returns Entity ID and deletion ops, or no ops when the entity is not found.
49
+ * @throws When IDs are invalid, fetch is unavailable, GraphQL fails, or the response is malformed.
50
+ */
51
+ export async function deleteEntity(context, { id, spaceId }) {
52
+ assertValid(id, '`id` in `deleteEntity`');
53
+ assertValid(spaceId, '`spaceId` in `deleteEntity`');
54
+ const normalizedSpaceId = String(spaceId).replaceAll('-', '');
55
+ const query = `query entity {
56
+ entity(id: "${id}") {
57
+ valuesList(filter: { spaceId: { in: [${JSON.stringify(normalizedSpaceId)}] } }) {
58
+ propertyId
59
+ spaceId
60
+ }
61
+ relationsList(filter: { spaceId: { in: [${JSON.stringify(normalizedSpaceId)}] } }) {
62
+ id
63
+ spaceId
64
+ }
65
+ }
66
+ }`;
67
+ let response;
68
+ try {
69
+ response = await graphqlData(context, query);
70
+ }
71
+ catch (error) {
72
+ const message = String(error);
73
+ if (message.includes('Could not parse GraphQL response')) {
74
+ throw new DeleteEntityError(`Could not parse GraphQL response for entity ${id}: ${error}`);
75
+ }
76
+ throw new DeleteEntityError(`Could not fetch entity data for ${id}: ${error}`);
77
+ }
78
+ if (!response.entity) {
79
+ return { id: Id(id), ops: [] };
80
+ }
81
+ return createDeleteEntityOps({
82
+ id,
83
+ spaceId,
84
+ values: response.entity.valuesList,
85
+ relations: response.entity.relationsList,
86
+ });
87
+ }
88
+ //# sourceMappingURL=entities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../src/client/entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,IAAI,iBAAiB,EACnC,YAAY,IAAI,eAAe,GAEhC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,MAAM,iBAAkB,SAAQ,KAAK;IAC1B,IAAI,GAAG,mBAAmB,CAAC;CACrC;AAcD,SAAS,qBAAqB,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AE;QACF,OAAO;QACP,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU;QAClC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa;KACzC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,141 @@
1
+ import type { Id } from '../id.js';
2
+ import type { GeoClientContext } from './context.js';
3
+ export type ClientEntityVoteParams = {
4
+ authorSpaceId: Id | string;
5
+ spaceId: Id | string;
6
+ entityId: Id | string;
7
+ };
8
+ export type EntityVoteCalldataParams = ClientEntityVoteParams & {
9
+ spaceRegistryAddress: `0x${string}`;
10
+ };
11
+ /**
12
+ * Encodes upvote calldata.
13
+ *
14
+ * Use this pure helper when you already have the target space registry address.
15
+ * Use `geo.entityVotes.upvote(...)` when the address should come from the
16
+ * configured network.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const tx = encodeUpvoteEntityCalldata({
21
+ * authorSpaceId,
22
+ * spaceId,
23
+ * entityId,
24
+ * spaceRegistryAddress,
25
+ * });
26
+ * ```
27
+ *
28
+ * @param params Author space, target space, entity ID, and space registry address.
29
+ * @returns Target registry address and encoded calldata.
30
+ * @throws When any supplied ID is invalid.
31
+ */
32
+ export declare function encodeUpvoteEntityCalldata(params: EntityVoteCalldataParams): {
33
+ to: `0x${string}`;
34
+ calldata: `0x${string}`;
35
+ };
36
+ /**
37
+ * Encodes downvote calldata.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const tx = encodeDownvoteEntityCalldata({
42
+ * authorSpaceId,
43
+ * spaceId,
44
+ * entityId,
45
+ * spaceRegistryAddress,
46
+ * });
47
+ * ```
48
+ *
49
+ * @param params Author space, target space, entity ID, and space registry address.
50
+ * @returns Target registry address and encoded calldata.
51
+ * @throws When any supplied ID is invalid.
52
+ */
53
+ export declare function encodeDownvoteEntityCalldata(params: EntityVoteCalldataParams): {
54
+ to: `0x${string}`;
55
+ calldata: `0x${string}`;
56
+ };
57
+ /**
58
+ * Encodes vote-withdrawal calldata.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const tx = encodeWithdrawEntityVoteCalldata({
63
+ * authorSpaceId,
64
+ * spaceId,
65
+ * entityId,
66
+ * spaceRegistryAddress,
67
+ * });
68
+ * ```
69
+ *
70
+ * @param params Author space, target space, entity ID, and space registry address.
71
+ * @returns Target registry address and encoded calldata.
72
+ * @throws When any supplied ID is invalid.
73
+ */
74
+ export declare function encodeWithdrawEntityVoteCalldata(params: EntityVoteCalldataParams): {
75
+ to: `0x${string}`;
76
+ calldata: `0x${string}`;
77
+ };
78
+ /**
79
+ * Builds calldata for upvoting an entity using the configured space registry.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const tx = geo.entityVotes.upvote({
84
+ * authorSpaceId,
85
+ * spaceId,
86
+ * entityId,
87
+ * });
88
+ * ```
89
+ *
90
+ * @param context Client context containing the target network configuration.
91
+ * @param params Author space, target space, and entity ID.
92
+ * @returns Target registry address and encoded calldata.
93
+ * @throws When IDs are invalid or the configured network is missing `SPACE_REGISTRY_ADDRESS`.
94
+ */
95
+ export declare function upvote(context: GeoClientContext, params: ClientEntityVoteParams): {
96
+ to: `0x${string}`;
97
+ calldata: `0x${string}`;
98
+ };
99
+ /**
100
+ * Builds calldata for downvoting an entity using the configured space registry.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const tx = geo.entityVotes.downvote({
105
+ * authorSpaceId,
106
+ * spaceId,
107
+ * entityId,
108
+ * });
109
+ * ```
110
+ *
111
+ * @param context Client context containing the target network configuration.
112
+ * @param params Author space, target space, and entity ID.
113
+ * @returns Target registry address and encoded calldata.
114
+ * @throws When IDs are invalid or the configured network is missing `SPACE_REGISTRY_ADDRESS`.
115
+ */
116
+ export declare function downvote(context: GeoClientContext, params: ClientEntityVoteParams): {
117
+ to: `0x${string}`;
118
+ calldata: `0x${string}`;
119
+ };
120
+ /**
121
+ * Builds calldata for withdrawing an entity vote using the configured space registry.
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * const tx = geo.entityVotes.withdraw({
126
+ * authorSpaceId,
127
+ * spaceId,
128
+ * entityId,
129
+ * });
130
+ * ```
131
+ *
132
+ * @param context Client context containing the target network configuration.
133
+ * @param params Author space, target space, and entity ID.
134
+ * @returns Target registry address and encoded calldata.
135
+ * @throws When IDs are invalid or the configured network is missing `SPACE_REGISTRY_ADDRESS`.
136
+ */
137
+ export declare function withdraw(context: GeoClientContext, params: ClientEntityVoteParams): {
138
+ to: `0x${string}`;
139
+ calldata: `0x${string}`;
140
+ };
141
+ //# sourceMappingURL=entity-votes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-votes.d.ts","sourceRoot":"","sources":["../../../src/client/entity-votes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAGnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAWrD,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,EAAE,EAAE,GAAG,MAAM,CAAC;IAC3B,OAAO,EAAE,EAAE,GAAG,MAAM,CAAC;IACrB,QAAQ,EAAE,EAAE,GAAG,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,sBAAsB,GAAG;IAC9D,oBAAoB,EAAE,KAAK,MAAM,EAAE,CAAC;CACrC,CAAC;AA+CF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,wBAAwB;;;EAE1E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,wBAAwB;;;EAE5E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,wBAAwB;;;EAEhF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,sBAAsB;;;EAE/E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,sBAAsB;;;EAEjF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,sBAAsB;;;EAEjF"}
@@ -0,0 +1,168 @@
1
+ import { encodeAbiParameters, encodeFunctionData, keccak256, toHex } from 'viem';
2
+ import { SpaceRegistryAbi } from '../abis/index.js';
3
+ import { assertValid } from '../id-utils.js';
4
+ import { requireGeoContract } from '../networks.js';
5
+ const EMPTY_SIGNATURE = '0x';
6
+ const ENTITY_OBJECT_TYPE = '00000000';
7
+ const ENTITY_VOTE_VERSION = 0;
8
+ const UPVOTED_ACTION = keccak256(toHex('PERMISSIONLESS.UPVOTED'));
9
+ const DOWNVOTED_ACTION = keccak256(toHex('PERMISSIONLESS.DOWNVOTED'));
10
+ const UNVOTED_ACTION = keccak256(toHex('PERMISSIONLESS.UNVOTED'));
11
+ function idToBytes16(id, sourceHint) {
12
+ const normalized = id.startsWith('0x') ? id.slice(2) : id.replaceAll('-', '');
13
+ assertValid(normalized, sourceHint);
14
+ return `0x${normalized.toLowerCase()}`;
15
+ }
16
+ function encodeEntityVoteTopic(entityId) {
17
+ const normalizedEntityId = idToBytes16(entityId, '`entityId` in entity vote').slice(2);
18
+ return `0x${ENTITY_OBJECT_TYPE}${normalizedEntityId}${'0'.repeat(24)}`;
19
+ }
20
+ function encodeEntityVoteData(authorSpaceId, spaceId) {
21
+ return encodeAbiParameters([{ type: 'uint16' }, { type: 'bytes16' }, { type: 'bytes16' }], [ENTITY_VOTE_VERSION, authorSpaceId, spaceId]);
22
+ }
23
+ function encodeEntityVoteCalldata(params, action) {
24
+ const authorSpaceId = idToBytes16(params.authorSpaceId, '`authorSpaceId` in entity vote');
25
+ const spaceId = idToBytes16(params.spaceId, '`spaceId` in entity vote');
26
+ const topic = encodeEntityVoteTopic(params.entityId);
27
+ const data = encodeEntityVoteData(authorSpaceId, spaceId);
28
+ const calldata = encodeFunctionData({
29
+ abi: SpaceRegistryAbi,
30
+ functionName: 'enter',
31
+ args: [authorSpaceId, spaceId, action, topic, data, EMPTY_SIGNATURE],
32
+ });
33
+ return {
34
+ to: params.spaceRegistryAddress,
35
+ calldata,
36
+ };
37
+ }
38
+ function withSpaceRegistry(context, params) {
39
+ return {
40
+ ...params,
41
+ spaceRegistryAddress: requireGeoContract(context.network, 'SPACE_REGISTRY_ADDRESS'),
42
+ };
43
+ }
44
+ /**
45
+ * Encodes upvote calldata.
46
+ *
47
+ * Use this pure helper when you already have the target space registry address.
48
+ * Use `geo.entityVotes.upvote(...)` when the address should come from the
49
+ * configured network.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const tx = encodeUpvoteEntityCalldata({
54
+ * authorSpaceId,
55
+ * spaceId,
56
+ * entityId,
57
+ * spaceRegistryAddress,
58
+ * });
59
+ * ```
60
+ *
61
+ * @param params Author space, target space, entity ID, and space registry address.
62
+ * @returns Target registry address and encoded calldata.
63
+ * @throws When any supplied ID is invalid.
64
+ */
65
+ export function encodeUpvoteEntityCalldata(params) {
66
+ return encodeEntityVoteCalldata(params, UPVOTED_ACTION);
67
+ }
68
+ /**
69
+ * Encodes downvote calldata.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * const tx = encodeDownvoteEntityCalldata({
74
+ * authorSpaceId,
75
+ * spaceId,
76
+ * entityId,
77
+ * spaceRegistryAddress,
78
+ * });
79
+ * ```
80
+ *
81
+ * @param params Author space, target space, entity ID, and space registry address.
82
+ * @returns Target registry address and encoded calldata.
83
+ * @throws When any supplied ID is invalid.
84
+ */
85
+ export function encodeDownvoteEntityCalldata(params) {
86
+ return encodeEntityVoteCalldata(params, DOWNVOTED_ACTION);
87
+ }
88
+ /**
89
+ * Encodes vote-withdrawal calldata.
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * const tx = encodeWithdrawEntityVoteCalldata({
94
+ * authorSpaceId,
95
+ * spaceId,
96
+ * entityId,
97
+ * spaceRegistryAddress,
98
+ * });
99
+ * ```
100
+ *
101
+ * @param params Author space, target space, entity ID, and space registry address.
102
+ * @returns Target registry address and encoded calldata.
103
+ * @throws When any supplied ID is invalid.
104
+ */
105
+ export function encodeWithdrawEntityVoteCalldata(params) {
106
+ return encodeEntityVoteCalldata(params, UNVOTED_ACTION);
107
+ }
108
+ /**
109
+ * Builds calldata for upvoting an entity using the configured space registry.
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * const tx = geo.entityVotes.upvote({
114
+ * authorSpaceId,
115
+ * spaceId,
116
+ * entityId,
117
+ * });
118
+ * ```
119
+ *
120
+ * @param context Client context containing the target network configuration.
121
+ * @param params Author space, target space, and entity ID.
122
+ * @returns Target registry address and encoded calldata.
123
+ * @throws When IDs are invalid or the configured network is missing `SPACE_REGISTRY_ADDRESS`.
124
+ */
125
+ export function upvote(context, params) {
126
+ return encodeUpvoteEntityCalldata(withSpaceRegistry(context, params));
127
+ }
128
+ /**
129
+ * Builds calldata for downvoting an entity using the configured space registry.
130
+ *
131
+ * @example
132
+ * ```ts
133
+ * const tx = geo.entityVotes.downvote({
134
+ * authorSpaceId,
135
+ * spaceId,
136
+ * entityId,
137
+ * });
138
+ * ```
139
+ *
140
+ * @param context Client context containing the target network configuration.
141
+ * @param params Author space, target space, and entity ID.
142
+ * @returns Target registry address and encoded calldata.
143
+ * @throws When IDs are invalid or the configured network is missing `SPACE_REGISTRY_ADDRESS`.
144
+ */
145
+ export function downvote(context, params) {
146
+ return encodeDownvoteEntityCalldata(withSpaceRegistry(context, params));
147
+ }
148
+ /**
149
+ * Builds calldata for withdrawing an entity vote using the configured space registry.
150
+ *
151
+ * @example
152
+ * ```ts
153
+ * const tx = geo.entityVotes.withdraw({
154
+ * authorSpaceId,
155
+ * spaceId,
156
+ * entityId,
157
+ * });
158
+ * ```
159
+ *
160
+ * @param context Client context containing the target network configuration.
161
+ * @param params Author space, target space, and entity ID.
162
+ * @returns Target registry address and encoded calldata.
163
+ * @throws When IDs are invalid or the configured network is missing `SPACE_REGISTRY_ADDRESS`.
164
+ */
165
+ export function withdraw(context, params) {
166
+ return encodeWithdrawEntityVoteCalldata(withSpaceRegistry(context, params));
167
+ }
168
+ //# sourceMappingURL=entity-votes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-votes.js","sourceRoot":"","sources":["../../../src/client/entity-votes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGpD,MAAM,eAAe,GAAG,IAAa,CAAC;AACtC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AACtC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,cAAc,GAAG,SAAS,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC;AAClE,MAAM,gBAAgB,GAAG,SAAS,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAC;AACtE,MAAM,cAAc,GAAG,SAAS,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC;AAclE,SAAS,WAAW,CAAC,EAAe,EAAE,UAAkB;IACtD,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC9E,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAEpC,OAAO,KAAK,UAAU,CAAC,WAAW,EAAE,EAAmB,CAAC;AAC1D,CAAC;AAED,SAAS,qBAAqB,CAAC,Q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OAAO,CAAC,OAAO,EAAE,wBAAwB,CAAC;KACpF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAgC;IACzE,OAAO,wBAAwB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,4BAA4B,CAAC,MAAgC;IAC3E,OAAO,wBAAwB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gCAAgC,CAAC,MAAgC;IAC/E,OAAO,wBAAwB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,MAAM,CAAC,OAAyB,EAAE,MAA8B;IAC9E,OAAO,0BAA0B,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACxE,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAyB,EAAE,MAA8B;IAChF,OAAO,4BAA4B,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAyB,EAAE,MAA8B;IAChF,OAAO,gCAAgC,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=entity-votes.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-votes.test.d.ts","sourceRoot":"","sources":["../../../src/client/entity-votes.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,93 @@
1
+ import { decodeAbiParameters, decodeFunctionData } from 'viem';
2
+ import { describe, expect, it } from 'vitest';
3
+ import { SpaceRegistryAbi } from '../abis/index.js';
4
+ import { defineGeoNetworkConfig } from '../networks.js';
5
+ import { downvote, encodeDownvoteEntityCalldata, encodeUpvoteEntityCalldata, encodeWithdrawEntityVoteCalldata, upvote, withdraw, } from './entity-votes.js';
6
+ const AUTHOR_SPACE_ID = '0eed5491b917cf58b33ac81255fe7ae9';
7
+ const SPACE_ID = 'abcdef12345678901234567890abcdef';
8
+ const ENTITY_ID = '11111111111111111111111111111111';
9
+ const SPACE_REGISTRY_ADDRESS = '0x0000000000000000000000000000000000000001';
10
+ const UPVOTED_ACTION = '0x1fc04a8d9387c7bd1199a2a77c8e531a7a7b11991df5dcc8c9acb6abcb481725';
11
+ const DOWNVOTED_ACTION = '0xde8b897ce7cc541dacb388d5aabb3dc0fb7856920284f41582c15b5fc31a8662';
12
+ const UNVOTED_ACTION = '0x3bd4c337382f79aa5007a91169bb57723b5dd59e6b4bb60d20362bcc0d9d998b';
13
+ function testContext() {
14
+ return {
15
+ network: defineGeoNetworkConfig({
16
+ id: 'LOCAL',
17
+ name: 'Local Geo',
18
+ apiOrigin: 'http://localhost:3000',
19
+ contracts: {
20
+ SPACE_REGISTRY_ADDRESS,
21
+ },
22
+ }),
23
+ };
24
+ }
25
+ function decodeEntityVote(calldata) {
26
+ const decoded = decodeFunctionData({
27
+ abi: SpaceRegistryAbi,
28
+ data: calldata,
29
+ });
30
+ expect(decoded.functionName).toBe('enter');
31
+ const [fromSpaceId, toSpaceId, action, topic, data, signature] = decoded.args;
32
+ const [version, authorSpaceId, spaceId] = decodeAbiParameters([{ type: 'uint16' }, { type: 'bytes16' }, { type: 'bytes16' }], data);
33
+ return {
34
+ fromSpaceId,
35
+ toSpaceId,
36
+ action,
37
+ topic,
38
+ signature,
39
+ version,
40
+ authorSpaceId,
41
+ spaceId,
42
+ };
43
+ }
44
+ describe('client entity vote helpers', () => {
45
+ it('encodes an upvote without context', () => {
46
+ const result = encodeUpvoteEntityCalldata({
47
+ authorSpaceId: AUTHOR_SPACE_ID,
48
+ spaceId: SPACE_ID,
49
+ entityId: ENTITY_ID,
50
+ spaceRegistryAddress: SPACE_REGISTRY_ADDRESS,
51
+ });
52
+ const decoded = decodeEntityVote(result.calldata);
53
+ expect(result.to).toBe(SPACE_REGISTRY_ADDRESS);
54
+ expect(decoded.fromSpaceId).toBe(`0x${AUTHOR_SPACE_ID}`);
55
+ expect(decoded.toSpaceId).toBe(`0x${SPACE_ID}`);
56
+ expect(decoded.action).toBe(UPVOTED_ACTION);
57
+ expect(decoded.topic).toBe(`0x00000000${ENTITY_ID}${'0'.repeat(24)}`);
58
+ expect(decoded.signature).toBe('0x');
59
+ expect(decoded.version).toBe(0);
60
+ expect(decoded.authorSpaceId).toBe(`0x${AUTHOR_SPACE_ID}`);
61
+ expect(decoded.spaceId).toBe(`0x${SPACE_ID}`);
62
+ });
63
+ it('encodes downvote and withdraw variants without context', () => {
64
+ const base = {
65
+ authorSpaceId: AUTHOR_SPACE_ID,
66
+ spaceId: SPACE_ID,
67
+ entityId: ENTITY_ID,
68
+ spaceRegistryAddress: SPACE_REGISTRY_ADDRESS,
69
+ };
70
+ expect(decodeEntityVote(encodeDownvoteEntityCalldata(base).calldata).action).toBe(DOWNVOTED_ACTION);
71
+ expect(decodeEntityVote(encodeWithdrawEntityVoteCalldata(base).calldata).action).toBe(UNVOTED_ACTION);
72
+ });
73
+ it('uses the configured registry address for context-aware helpers', () => {
74
+ const context = testContext();
75
+ const params = {
76
+ authorSpaceId: AUTHOR_SPACE_ID,
77
+ spaceId: SPACE_ID,
78
+ entityId: ENTITY_ID,
79
+ };
80
+ expect(upvote(context, params).to).toBe(SPACE_REGISTRY_ADDRESS);
81
+ expect(decodeEntityVote(downvote(context, params).calldata).action).toBe(DOWNVOTED_ACTION);
82
+ expect(decodeEntityVote(withdraw(context, params).calldata).action).toBe(UNVOTED_ACTION);
83
+ });
84
+ it('throws for invalid ids before encoding', () => {
85
+ expect(() => encodeUpvoteEntityCalldata({
86
+ authorSpaceId: 'invalid',
87
+ spaceId: SPACE_ID,
88
+ entityId: ENTITY_ID,
89
+ spaceRegistryAddress: SPACE_REGISTRY_ADDRESS,
90
+ })).toThrow('Invalid id: "invalid" for `authorSpaceId` in entity vote');
91
+ });
92
+ });
93
+ //# sourceMappingURL=entity-votes.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-votes.test.js","sourceRoot":"","sources":["../../../src/client/entity-votes.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,0BAA0B,EAC1B,gCAAgC,EAChC,MAAM,EACN,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAE3B,MAAM,eAAe,GAAG,kCAAkC,CAAC;AAC3D,MAAM,QAAQ,GAAG,kCAAkC,CAAC;AACpD,MAAM,SAAS,GAAG,kCAAkC,CAAC;AACrD,MAAM,sBAAsB,GAAG,4CAAqD,CAAC;AACrF,MAAM,cAAc,GAAG,oEAAoE,CAAC;AAC5F,MAAM,gBAAgB,GAAG,oEAAoE,CAAC;AAC9F,MAAM,cAAc,GAAG,oEAAoE,CAAC;AAE5F,SAAS,WAAW;IAClB,OAAO;QACL,OAAO,EAAE,sBAAsB,CAAC;YAC9B,EAAE,EAAE,OAAO;YACX,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE,uBAAuB;YAClC,SAAS,EAAE;gBACT,sBAAsB;aACvB;SACF,CAAC;KACH,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAuB;IAC/C,MAAM,OAAO,GAAG,kBAAkB,CA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AAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAChE,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC3F,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,GAAG,EAAE,CACV,0BAA0B,CAAC;YACzB,aAAa,EAAE,SAAS;YACxB,OAAO,EAAE,QAAQ;YACjB,QAAQ,EAAE,SAAS;YACnB,oBAAoB,EAAE,sBAAsB;SAC7C,CAAC,CACH,CAAC,OAAO,CAAC,0DAA0D,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=graph-workflows.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-workflows.test.d.ts","sourceRoot":"","sources":["../../../src/client/graph-workflows.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,83 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import { createGeoClient } from '../client.js';
3
+ import { REPLY_TO_PROPERTY } from '../core/ids/system.js';
4
+ import { toGrcId } from '../id-utils.js';
5
+ import { defineGeoNetworkConfig } from '../networks.js';
6
+ const ENTITY_ID = '3af3e22d21694a078681516710b7ecf1';
7
+ const SPACE_ID = 'd4bc2f205e2d415e971eb0b9fbf6b6fc';
8
+ const COMMENT_A_ID = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
9
+ const ROOT_ENTITY_ID = 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb';
10
+ const ROOT_SPACE_ID = 'cccccccccccccccccccccccccccccccc';
11
+ const PROPERTY_ID = 'dddddddddddddddddddddddddddddddd';
12
+ const RELATION_ID = 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee';
13
+ function customNetwork() {
14
+ return defineGeoNetworkConfig({
15
+ id: 'LOCAL',
16
+ name: 'Local Geo',
17
+ apiOrigin: 'http://localhost:3000',
18
+ });
19
+ }
20
+ function replyToRelations(ops) {
21
+ return ops.filter((op) => op.type === 'createRelation' &&
22
+ op.relationType.every((byte, index) => byte === toGrcId(REPLY_TO_PROPERTY)[index]));
23
+ }
24
+ describe('geo graph workflow clients', () => {
25
+ it('creates comment reply chains from fetched parent context', async () => {
26
+ const fetch = vi.fn().mockResolvedValue(new Response(JSON.stringify({
27
+ data: {
28
+ entity: {
29
+ relationsList: [
30
+ {
31
+ toEntity: { id: ROOT_ENTITY_ID },
32
+ toSpace: { id: ROOT_SPACE_ID },
33
+ position: 'a1',
34
+ },
35
+ {
36
+ toEntity: { id: COMMENT_A_ID },
37
+ toSpace: { id: SPACE_ID },
38
+ position: 'a0',
39
+ },
40
+ ],
41
+ },
42
+ },
43
+ })));
44
+ const geo = createGeoClient({ network: customNetwork(), fetch });
45
+ const result = await geo.comments.create({
46
+ id: 'ffffffffffffffffffffffffffffffff',
47
+ content: 'Deep reply',
48
+ replyTo: { entityId: ENTITY_ID, spaceId: SPACE_ID },
49
+ });
50
+ const relations = replyToRelations(result.ops);
51
+ expect(relations).toHaveLength(3);
52
+ expect(relations[0]?.to).toEqual(toGrcId(ENTITY_ID));
53
+ expect(relations[1]?.to).toEqual(toGrcId(COMMENT_A_ID));
54
+ expect(relations[2]?.to).toEqual(toGrcId(ROOT_ENTITY_ID));
55
+ expect(relations[0]?.toSpace).toEqual(toGrcId(SPACE_ID));
56
+ expect(relations[2]?.toSpace).toEqual(toGrcId(ROOT_SPACE_ID));
57
+ expect(fetch).toHaveBeenCalledWith('http://localhost:3000/graphql', expect.objectContaining({ method: 'POST' }));
58
+ });
59
+ it('deletes an entity using fetched values and relations for the requested space', async () => {
60
+ const fetch = vi.fn().mockResolvedValue(new Response(JSON.stringify({
61
+ data: {
62
+ entity: {
63
+ valuesList: [
64
+ { propertyId: PROPERTY_ID, spaceId: SPACE_ID },
65
+ { propertyId: PROPERTY_ID, spaceId: SPACE_ID },
66
+ { propertyId: ROOT_ENTITY_ID, spaceId: ROOT_SPACE_ID },
67
+ ],
68
+ relationsList: [
69
+ { id: RELATION_ID, spaceId: SPACE_ID },
70
+ { id: COMMENT_A_ID, spaceId: ROOT_SPACE_ID },
71
+ ],
72
+ },
73
+ },
74
+ })));
75
+ const geo = createGeoClient({ network: customNetwork(), fetch });
76
+ const result = await geo.entities.delete({ id: ENTITY_ID, spaceId: SPACE_ID });
77
+ expect(result.id).toBe(ENTITY_ID);
78
+ expect(result.ops.map(op => op.type)).toEqual(['updateEntity', 'deleteRelation']);
79
+ expect(result.ops[0].unset).toHaveLength(1);
80
+ expect(fetch).toHaveBeenCalledWith('http://localhost:3000/graphql', expect.objectContaining({ method: 'POST' }));
81
+ });
82
+ });
83
+ //# sourceMappingURL=graph-workflows.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-workflows.test.js","sourceRoot":"","sources":["../../../src/client/graph-workflows.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,SAAS,GAAG,kCAAkC,CAAC;AACrD,MAAM,QAAQ,GAAG,kCAA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AgB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IACnH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=images-storage.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"images-storage.test.d.ts","sourceRoot":"","sources":["../../../src/client/images-storage.test.ts"],"names":[],"mappings":""}