@ibgib/core-gib 0.0.4

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 (330) hide show
  1. package/.vscode/core-gib-snippets.code-snippets +189 -0
  2. package/.vscode/launch.json +24 -0
  3. package/.vscode/settings.json +56 -0
  4. package/.vscode/tasks.json +37 -0
  5. package/CHANGELOG.md +11 -0
  6. package/README.md +215 -0
  7. package/dist/common/aws-constants.d.mts +7 -0
  8. package/dist/common/aws-constants.d.mts.map +1 -0
  9. package/dist/common/aws-constants.mjs +7 -0
  10. package/dist/common/aws-constants.mjs.map +1 -0
  11. package/dist/common/bin/bin-types.d.mts +17 -0
  12. package/dist/common/bin/bin-types.d.mts.map +1 -0
  13. package/dist/common/bin/bin-types.mjs +3 -0
  14. package/dist/common/bin/bin-types.mjs.map +1 -0
  15. package/dist/common/cache/cache-types.d.mts +57 -0
  16. package/dist/common/cache/cache-types.d.mts.map +1 -0
  17. package/dist/common/cache/cache-types.mjs +2 -0
  18. package/dist/common/cache/cache-types.mjs.map +1 -0
  19. package/dist/common/comment/comment-constants.d.mts +11 -0
  20. package/dist/common/comment/comment-constants.d.mts.map +1 -0
  21. package/dist/common/comment/comment-constants.mjs +11 -0
  22. package/dist/common/comment/comment-constants.mjs.map +1 -0
  23. package/dist/common/comment/comment-helper.d.mts +59 -0
  24. package/dist/common/comment/comment-helper.d.mts.map +1 -0
  25. package/dist/common/comment/comment-helper.mjs +173 -0
  26. package/dist/common/comment/comment-helper.mjs.map +1 -0
  27. package/dist/common/comment/comment-types.d.mts +16 -0
  28. package/dist/common/comment/comment-types.d.mts.map +1 -0
  29. package/dist/common/comment/comment-types.mjs +2 -0
  30. package/dist/common/comment/comment-types.mjs.map +1 -0
  31. package/dist/common/display/display-helper.d.mts +19 -0
  32. package/dist/common/display/display-helper.d.mts.map +1 -0
  33. package/dist/common/display/display-helper.mjs +68 -0
  34. package/dist/common/display/display-helper.mjs.map +1 -0
  35. package/dist/common/display/display-types.d.mts +97 -0
  36. package/dist/common/display/display-types.d.mts.map +1 -0
  37. package/dist/common/display/display-types.mjs +37 -0
  38. package/dist/common/display/display-types.mjs.map +1 -0
  39. package/dist/common/encrypt/encrypt-constants.d.mts +27 -0
  40. package/dist/common/encrypt/encrypt-constants.d.mts.map +1 -0
  41. package/dist/common/encrypt/encrypt-constants.mjs +27 -0
  42. package/dist/common/encrypt/encrypt-constants.mjs.map +1 -0
  43. package/dist/common/encrypt/encrypt-types.d.mts +116 -0
  44. package/dist/common/encrypt/encrypt-types.d.mts.map +1 -0
  45. package/dist/common/encrypt/encrypt-types.mjs +9 -0
  46. package/dist/common/encrypt/encrypt-types.mjs.map +1 -0
  47. package/dist/common/error/error-constants.d.mts +9 -0
  48. package/dist/common/error/error-constants.d.mts.map +1 -0
  49. package/dist/common/error/error-constants.mjs +9 -0
  50. package/dist/common/error/error-constants.mjs.map +1 -0
  51. package/dist/common/error/error-helper.d.mts +43 -0
  52. package/dist/common/error/error-helper.d.mts.map +1 -0
  53. package/dist/common/error/error-helper.mjs +167 -0
  54. package/dist/common/error/error-helper.mjs.map +1 -0
  55. package/dist/common/error/error-types.d.mts +58 -0
  56. package/dist/common/error/error-types.d.mts.map +1 -0
  57. package/dist/common/error/error-types.mjs +2 -0
  58. package/dist/common/error/error-types.mjs.map +1 -0
  59. package/dist/common/form/form-helper.d.mts +97 -0
  60. package/dist/common/form/form-helper.d.mts.map +1 -0
  61. package/dist/common/form/form-helper.mjs +185 -0
  62. package/dist/common/form/form-helper.mjs.map +1 -0
  63. package/dist/common/form/form-items.d.mts +229 -0
  64. package/dist/common/form/form-items.d.mts.map +1 -0
  65. package/dist/common/form/form-items.mjs +63 -0
  66. package/dist/common/form/form-items.mjs.map +1 -0
  67. package/dist/common/import-export/import-export-types.d.mts +18 -0
  68. package/dist/common/import-export/import-export-types.d.mts.map +1 -0
  69. package/dist/common/import-export/import-export-types.mjs +2 -0
  70. package/dist/common/import-export/import-export-types.mjs.map +1 -0
  71. package/dist/common/legacy/legacy-types.d.mts +2 -0
  72. package/dist/common/legacy/legacy-types.d.mts.map +1 -0
  73. package/dist/common/legacy/legacy-types.mjs +2 -0
  74. package/dist/common/legacy/legacy-types.mjs.map +1 -0
  75. package/dist/common/link/link-constants.d.mts +2 -0
  76. package/dist/common/link/link-constants.d.mts.map +1 -0
  77. package/dist/common/link/link-constants.mjs +2 -0
  78. package/dist/common/link/link-constants.mjs.map +1 -0
  79. package/dist/common/link/link-helper.d.mts +37 -0
  80. package/dist/common/link/link-helper.d.mts.map +1 -0
  81. package/dist/common/link/link-helper.mjs +143 -0
  82. package/dist/common/link/link-helper.mjs.map +1 -0
  83. package/dist/common/link/link-types.d.mts +14 -0
  84. package/dist/common/link/link-types.d.mts.map +1 -0
  85. package/dist/common/link/link-types.mjs +2 -0
  86. package/dist/common/link/link-types.mjs.map +1 -0
  87. package/dist/common/other/graph-helper.d.mts +166 -0
  88. package/dist/common/other/graph-helper.d.mts.map +1 -0
  89. package/dist/common/other/graph-helper.mjs +710 -0
  90. package/dist/common/other/graph-helper.mjs.map +1 -0
  91. package/dist/common/other/ibgib-helper.d.mts +245 -0
  92. package/dist/common/other/ibgib-helper.d.mts.map +1 -0
  93. package/dist/common/other/ibgib-helper.mjs +641 -0
  94. package/dist/common/other/ibgib-helper.mjs.map +1 -0
  95. package/dist/common/other/other-constants.d.mts +53 -0
  96. package/dist/common/other/other-constants.d.mts.map +1 -0
  97. package/dist/common/other/other-constants.mjs +67 -0
  98. package/dist/common/other/other-constants.mjs.map +1 -0
  99. package/dist/common/other/other-types.d.mts +166 -0
  100. package/dist/common/other/other-types.d.mts.map +1 -0
  101. package/dist/common/other/other-types.mjs +30 -0
  102. package/dist/common/other/other-types.mjs.map +1 -0
  103. package/dist/common/other/svg-constants.d.mts +2 -0
  104. package/dist/common/other/svg-constants.d.mts.map +1 -0
  105. package/dist/common/other/svg-constants.mjs +2 -0
  106. package/dist/common/other/svg-constants.mjs.map +1 -0
  107. package/dist/common/other/svg-helper.d.mts +54 -0
  108. package/dist/common/other/svg-helper.d.mts.map +1 -0
  109. package/dist/common/other/svg-helper.mjs +170 -0
  110. package/dist/common/other/svg-helper.mjs.map +1 -0
  111. package/dist/common/pic/pic-constants.d.mts +13 -0
  112. package/dist/common/pic/pic-constants.d.mts.map +1 -0
  113. package/dist/common/pic/pic-constants.mjs +13 -0
  114. package/dist/common/pic/pic-constants.mjs.map +1 -0
  115. package/dist/common/pic/pic-helper.d.mts +70 -0
  116. package/dist/common/pic/pic-helper.d.mts.map +1 -0
  117. package/dist/common/pic/pic-helper.mjs +235 -0
  118. package/dist/common/pic/pic-helper.mjs.map +1 -0
  119. package/dist/common/pic/pic-types.d.mts +23 -0
  120. package/dist/common/pic/pic-types.d.mts.map +1 -0
  121. package/dist/common/pic/pic-types.mjs +2 -0
  122. package/dist/common/pic/pic-types.mjs.map +1 -0
  123. package/dist/common/root/root-constants.d.mts +40 -0
  124. package/dist/common/root/root-constants.d.mts.map +1 -0
  125. package/dist/common/root/root-constants.mjs +40 -0
  126. package/dist/common/root/root-constants.mjs.map +1 -0
  127. package/dist/common/root/root-types.d.mts +9 -0
  128. package/dist/common/root/root-types.d.mts.map +1 -0
  129. package/dist/common/root/root-types.mjs +2 -0
  130. package/dist/common/root/root-types.mjs.map +1 -0
  131. package/dist/common/tag/tag-constants.d.mts +21 -0
  132. package/dist/common/tag/tag-constants.d.mts.map +1 -0
  133. package/dist/common/tag/tag-constants.mjs +28 -0
  134. package/dist/common/tag/tag-constants.mjs.map +1 -0
  135. package/dist/common/tag/tag-types.d.mts +14 -0
  136. package/dist/common/tag/tag-types.d.mts.map +1 -0
  137. package/dist/common/tag/tag-types.mjs +2 -0
  138. package/dist/common/tag/tag-types.mjs.map +1 -0
  139. package/dist/core-constants.d.mts +89 -0
  140. package/dist/core-constants.d.mts.map +1 -0
  141. package/dist/core-constants.mjs +484 -0
  142. package/dist/core-constants.mjs.map +1 -0
  143. package/dist/core-helper.d.mts +6 -0
  144. package/dist/core-helper.d.mts.map +1 -0
  145. package/dist/core-helper.mjs +28 -0
  146. package/dist/core-helper.mjs.map +1 -0
  147. package/dist/core-types.d.mts +520 -0
  148. package/dist/core-types.d.mts.map +1 -0
  149. package/dist/core-types.mjs +2 -0
  150. package/dist/core-types.mjs.map +1 -0
  151. package/dist/index.d.mts +2 -0
  152. package/dist/index.d.mts.map +1 -0
  153. package/dist/index.mjs +3 -0
  154. package/dist/index.mjs.map +1 -0
  155. package/dist/witness/app/app-base-v1.d.mts +130 -0
  156. package/dist/witness/app/app-base-v1.d.mts.map +1 -0
  157. package/dist/witness/app/app-base-v1.mjs +462 -0
  158. package/dist/witness/app/app-base-v1.mjs.map +1 -0
  159. package/dist/witness/app/app-constants.d.mts +10 -0
  160. package/dist/witness/app/app-constants.d.mts.map +1 -0
  161. package/dist/witness/app/app-constants.mjs +13 -0
  162. package/dist/witness/app/app-constants.mjs.map +1 -0
  163. package/dist/witness/app/app-helper.d.mts +85 -0
  164. package/dist/witness/app/app-helper.d.mts.map +1 -0
  165. package/dist/witness/app/app-helper.mjs +258 -0
  166. package/dist/witness/app/app-helper.mjs.map +1 -0
  167. package/dist/witness/app/app-types.d.mts +211 -0
  168. package/dist/witness/app/app-types.d.mts.map +1 -0
  169. package/dist/witness/app/app-types.mjs +49 -0
  170. package/dist/witness/app/app-types.mjs.map +1 -0
  171. package/dist/witness/app/chat-app/chat-app-types.d.mts +18 -0
  172. package/dist/witness/app/chat-app/chat-app-types.d.mts.map +1 -0
  173. package/dist/witness/app/chat-app/chat-app-types.mjs +25 -0
  174. package/dist/witness/app/chat-app/chat-app-types.mjs.map +1 -0
  175. package/dist/witness/app/flash-app/flash-app-types.d.mts +16 -0
  176. package/dist/witness/app/flash-app/flash-app-types.d.mts.map +1 -0
  177. package/dist/witness/app/flash-app/flash-app-types.mjs +23 -0
  178. package/dist/witness/app/flash-app/flash-app-types.mjs.map +1 -0
  179. package/dist/witness/app/raw-app/raw-app-types.d.mts +18 -0
  180. package/dist/witness/app/raw-app/raw-app-types.d.mts.map +1 -0
  181. package/dist/witness/app/raw-app/raw-app-types.mjs +25 -0
  182. package/dist/witness/app/raw-app/raw-app-types.mjs.map +1 -0
  183. package/dist/witness/app/todo-app/todo-app-types.d.ts +33 -0
  184. package/dist/witness/app/todo-app/todo-app-types.d.ts.map +1 -0
  185. package/dist/witness/app/todo-app/todo-app-types.js +31 -0
  186. package/dist/witness/app/todo-app/todo-app-types.js.map +1 -0
  187. package/dist/witness/robbot/robbot-base-v1.d.ts +432 -0
  188. package/dist/witness/robbot/robbot-base-v1.d.ts.map +1 -0
  189. package/dist/witness/robbot/robbot-base-v1.js +1407 -0
  190. package/dist/witness/robbot/robbot-base-v1.js.map +1 -0
  191. package/dist/witness/robbot/robbot-constants.d.mts +24 -0
  192. package/dist/witness/robbot/robbot-constants.d.mts.map +1 -0
  193. package/dist/witness/robbot/robbot-constants.mjs +24 -0
  194. package/dist/witness/robbot/robbot-constants.mjs.map +1 -0
  195. package/dist/witness/robbot/robbot-helper.d.mts +152 -0
  196. package/dist/witness/robbot/robbot-helper.d.mts.map +1 -0
  197. package/dist/witness/robbot/robbot-helper.mjs +609 -0
  198. package/dist/witness/robbot/robbot-helper.mjs.map +1 -0
  199. package/dist/witness/robbot/robbot-types.d.mts +539 -0
  200. package/dist/witness/robbot/robbot-types.d.mts.map +1 -0
  201. package/dist/witness/robbot/robbot-types.mjs +294 -0
  202. package/dist/witness/robbot/robbot-types.mjs.map +1 -0
  203. package/dist/witness/space/bootstrap/bootstrap-constants.d.mts +14 -0
  204. package/dist/witness/space/bootstrap/bootstrap-constants.d.mts.map +1 -0
  205. package/dist/witness/space/bootstrap/bootstrap-constants.mjs +15 -0
  206. package/dist/witness/space/bootstrap/bootstrap-constants.mjs.map +1 -0
  207. package/dist/witness/space/inner-space-v1.d.ts +63 -0
  208. package/dist/witness/space/inner-space-v1.d.ts.map +1 -0
  209. package/dist/witness/space/inner-space-v1.js +356 -0
  210. package/dist/witness/space/inner-space-v1.js.map +1 -0
  211. package/dist/witness/space/outer-space/outer-space-constants.d.mts +2 -0
  212. package/dist/witness/space/outer-space/outer-space-constants.d.mts.map +1 -0
  213. package/dist/witness/space/outer-space/outer-space-constants.mjs +2 -0
  214. package/dist/witness/space/outer-space/outer-space-constants.mjs.map +1 -0
  215. package/dist/witness/space/outer-space/outer-space-helper.d.mts +28 -0
  216. package/dist/witness/space/outer-space/outer-space-helper.d.mts.map +1 -0
  217. package/dist/witness/space/outer-space/outer-space-helper.mjs +87 -0
  218. package/dist/witness/space/outer-space/outer-space-helper.mjs.map +1 -0
  219. package/dist/witness/space/outer-space/outer-space-types.d.mts +548 -0
  220. package/dist/witness/space/outer-space/outer-space-types.d.mts.map +1 -0
  221. package/dist/witness/space/outer-space/outer-space-types.mjs +118 -0
  222. package/dist/witness/space/outer-space/outer-space-types.mjs.map +1 -0
  223. package/dist/witness/space/space-base-v1.d.mts +147 -0
  224. package/dist/witness/space/space-base-v1.d.mts.map +1 -0
  225. package/dist/witness/space/space-base-v1.mjs +350 -0
  226. package/dist/witness/space/space-base-v1.mjs.map +1 -0
  227. package/dist/witness/space/space-constants.d.mts +181 -0
  228. package/dist/witness/space/space-constants.d.mts.map +1 -0
  229. package/dist/witness/space/space-constants.mjs +192 -0
  230. package/dist/witness/space/space-constants.mjs.map +1 -0
  231. package/dist/witness/space/space-helper.d.mts +666 -0
  232. package/dist/witness/space/space-helper.d.mts.map +1 -0
  233. package/dist/witness/space/space-helper.mjs +2830 -0
  234. package/dist/witness/space/space-helper.mjs.map +1 -0
  235. package/dist/witness/space/space-types.d.mts +422 -0
  236. package/dist/witness/space/space-types.d.mts.map +1 -0
  237. package/dist/witness/space/space-types.mjs +52 -0
  238. package/dist/witness/space/space-types.mjs.map +1 -0
  239. package/dist/witness/witness-base-v1.d.ts +144 -0
  240. package/dist/witness/witness-base-v1.d.ts.map +1 -0
  241. package/dist/witness/witness-base-v1.js +300 -0
  242. package/dist/witness/witness-base-v1.js.map +1 -0
  243. package/dist/witness/witness-constants.d.mts +3 -0
  244. package/dist/witness/witness-constants.d.mts.map +1 -0
  245. package/dist/witness/witness-constants.mjs +3 -0
  246. package/dist/witness/witness-constants.mjs.map +1 -0
  247. package/dist/witness/witness-form-builder.d.mts +45 -0
  248. package/dist/witness/witness-form-builder.d.mts.map +1 -0
  249. package/dist/witness/witness-form-builder.mjs +95 -0
  250. package/dist/witness/witness-form-builder.mjs.map +1 -0
  251. package/dist/witness/witness-helper.d.mts +89 -0
  252. package/dist/witness/witness-helper.d.mts.map +1 -0
  253. package/dist/witness/witness-helper.mjs +229 -0
  254. package/dist/witness/witness-helper.mjs.map +1 -0
  255. package/dist/witness/witness-types.d.mts +211 -0
  256. package/dist/witness/witness-types.d.mts.map +1 -0
  257. package/dist/witness/witness-types.mjs +2 -0
  258. package/dist/witness/witness-types.mjs.map +1 -0
  259. package/jasmine-browser.json +18 -0
  260. package/jasmine.json +6 -0
  261. package/package.json +67 -0
  262. package/src/assumptions.spec.mts +45 -0
  263. package/src/common/aws-constants.mts +5 -0
  264. package/src/common/bin/bin-types.mts +17 -0
  265. package/src/common/cache/cache-types.mts +53 -0
  266. package/src/common/comment/comment-constants.mts +10 -0
  267. package/src/common/comment/comment-helper.mts +211 -0
  268. package/src/common/comment/comment-types.mts +19 -0
  269. package/src/common/display/display-helper.mts +88 -0
  270. package/src/common/display/display-types.mts +108 -0
  271. package/src/common/encrypt/encrypt-constants.mts +28 -0
  272. package/src/common/encrypt/encrypt-types.mts +130 -0
  273. package/src/common/error/error-constants.mts +8 -0
  274. package/src/common/error/error-helper.mts +155 -0
  275. package/src/common/error/error-types.mts +62 -0
  276. package/src/common/form/form-helper.mts +253 -0
  277. package/src/common/form/form-items.mts +236 -0
  278. package/src/common/import-export/import-export-types.mts +18 -0
  279. package/src/common/legacy/about-legacy.md +0 -0
  280. package/src/common/legacy/legacy-types.mts +0 -0
  281. package/src/common/link/link-constants.mts +1 -0
  282. package/src/common/link/link-helper.mts +155 -0
  283. package/src/common/link/link-types.mts +16 -0
  284. package/src/common/other/graph-helper.mts +853 -0
  285. package/src/common/other/ibgib-helper.mts +671 -0
  286. package/src/common/other/other-constants.mts +76 -0
  287. package/src/common/other/other-types.mts +186 -0
  288. package/src/common/other/svg-constants.mts +1 -0
  289. package/src/common/other/svg-helper.mts +238 -0
  290. package/src/common/pic/pic-constants.mts +13 -0
  291. package/src/common/pic/pic-helper.mts +295 -0
  292. package/src/common/pic/pic-types.mts +29 -0
  293. package/src/common/root/root-constants.mts +41 -0
  294. package/src/common/root/root-types.mts +8 -0
  295. package/src/common/tag/tag-constants.mts +34 -0
  296. package/src/common/tag/tag-types.mts +19 -0
  297. package/src/core-constants.mts +506 -0
  298. package/src/core-helper.mts +33 -0
  299. package/src/core-types.mts +519 -0
  300. package/src/helper.spec.mts +64 -0
  301. package/src/index.mts +1 -0
  302. package/src/witness/app/app-base-v1.mts +584 -0
  303. package/src/witness/app/app-constants.mts +16 -0
  304. package/src/witness/app/app-helper.mts +322 -0
  305. package/src/witness/app/app-types.mts +252 -0
  306. package/src/witness/app/chat-app/chat-app-types.mts +40 -0
  307. package/src/witness/app/flash-app/flash-app-types.mts +38 -0
  308. package/src/witness/app/raw-app/raw-app-types.mts +40 -0
  309. package/src/witness/app/todo-app/todo-app-types.ts +59 -0
  310. package/src/witness/robbot/robbot-base-v1.ts +1531 -0
  311. package/src/witness/robbot/robbot-constants.mts +25 -0
  312. package/src/witness/robbot/robbot-helper.mts +676 -0
  313. package/src/witness/robbot/robbot-helper.spec.mts +135 -0
  314. package/src/witness/robbot/robbot-types.mts +797 -0
  315. package/src/witness/space/bootstrap/bootstrap-constants.mts +15 -0
  316. package/src/witness/space/inner-space-v1.ts +372 -0
  317. package/src/witness/space/outer-space/outer-space-constants.mts +1 -0
  318. package/src/witness/space/outer-space/outer-space-helper.mts +91 -0
  319. package/src/witness/space/outer-space/outer-space-types.mts +627 -0
  320. package/src/witness/space/space-base-v1.mts +414 -0
  321. package/src/witness/space/space-constants.mts +208 -0
  322. package/src/witness/space/space-helper.mts +3242 -0
  323. package/src/witness/space/space-types.mts +476 -0
  324. package/src/witness/witness-base-v1.ts +325 -0
  325. package/src/witness/witness-constants.mts +2 -0
  326. package/src/witness/witness-form-builder.mts +128 -0
  327. package/src/witness/witness-helper.mts +256 -0
  328. package/src/witness/witness-types.mts +249 -0
  329. package/tsconfig.json +15 -0
  330. package/tsconfig.test.json +10 -0
@@ -0,0 +1,476 @@
1
+ import { IbGibRel8ns_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
2
+ import { IbGibAddr, IbGib, IbGibRel8ns, TjpIbGibAddr } from '@ibgib/ts-gib';
3
+
4
+ import {
5
+ Witness, WitnessCmdData, WitnessCmdIbGib, WitnessCmdRel8ns,
6
+ WitnessData_V1, WitnessResultData, WitnessResultIbGib, WitnessResultRel8ns,
7
+ } from '../witness-types.mjs';
8
+ import { IbGibSpaceAny } from './space-base-v1.mjs';
9
+ import { ENCRYPTION_REL8N_NAME } from '../../common/encrypt/encrypt-constants.mjs';
10
+ import { BOOTSTRAP_DATA_DEFAULT_SPACE_ID_KEY, BOOTSTRAP_DATA_KNOWN_SPACE_IDS_KEY } from './bootstrap/bootstrap-constants.mjs';
11
+
12
+ /**
13
+ * Marker type to show intent that it should be the spaceId, i.e.
14
+ * space.data.uuid.
15
+ */
16
+ export type SpaceId = string;
17
+
18
+ /**
19
+ * Common data among all ibgib spaces.
20
+ */
21
+ export interface IbGibSpaceData extends WitnessData_V1 {
22
+ /**
23
+ * redeclaration for the name of the space, to make it required as opposed
24
+ * to the base declaration which is optional.
25
+ *
26
+ * does NOT have to be unique.
27
+ */
28
+ name: string;
29
+ /**
30
+ * Redeclared over {@link WitnessData_V1.uuid} just for code readability,
31
+ * showing the id to be a {@link SpaceId}, as well making it a required
32
+ * field.
33
+ */
34
+ uuid: SpaceId;
35
+ /**
36
+ * If true, when this space receives a command that includes incoming ibGibs
37
+ * and ibGibAddrs, we will ensure the ibGibs have a 1-to-1 correspondence to
38
+ * the addrs we're logging, and that the gib hashes are verified against the
39
+ * ibGibs themselves.
40
+ *
41
+ * Otherwise, someone could pass in a bunch of legitimate addresses and
42
+ * illegitimate ibGibs (that have little to do with the addresses). This
43
+ * could at best be a coding mistake & at worst be malicious.
44
+ */
45
+ validateIbGibAddrsMatchIbGibs?: boolean;
46
+ /**
47
+ * interval between polling calls made to other spaces, e.g. sync spaces,
48
+ * or used within a space to check inside itself for updates.
49
+ *
50
+ * ## notes
51
+ *
52
+ * * use as needed
53
+ * * I want to just have this as a sync space setting, but since they are
54
+ * enciphered, I don't want to just have them sitting around in plaintext.
55
+ * * So I'm going to have it in the local app space, which the ibgibs
56
+ * service will check in order for it to decide on interval.
57
+ * * definitely a code smell, but I'm still resolving what a local app
58
+ * space is vs the service that accesses it.
59
+ */
60
+ longPollingIntervalMs?: number;
61
+ }
62
+
63
+ /**
64
+ * Specifically for ibgib spaces that are implemented via a path/subpath
65
+ * strategy, i.e., using a filesystem-like addressing mechanism.
66
+ */
67
+ export interface IbGibSpaceData_Subpathed extends IbGibSpaceData {
68
+ /**
69
+ * Redeclared here to make this required (not optional)
70
+ */
71
+ uuid: SpaceId;
72
+ baseDir: string | any;
73
+ encoding: string | any;
74
+ baseSubPath: string;
75
+ spaceSubPath: string;
76
+ ibgibsSubPath: string;
77
+ metaSubPath: string;
78
+ binSubPath: string;
79
+ dnaSubPath: string;
80
+ n?: number;
81
+ timestamp?: string;
82
+ }
83
+
84
+ export interface IbGibSpaceRel8ns extends IbGibRel8ns_V1 {
85
+ [ENCRYPTION_REL8N_NAME]?: IbGibAddr[];
86
+ }
87
+
88
+
89
+ /**
90
+ * Cmds for interacting with ibgib spaces.
91
+ *
92
+ * Not all of these will be implemented for every space.
93
+ *
94
+ * ## todo
95
+ *
96
+ * change these commands to better structure, e.g., verb/do/mod, can/get/addrs
97
+ * */
98
+ export type IbGibSpaceOptionsCmd =
99
+ 'get' | 'put' | 'delete';
100
+ /** Cmds for interacting with ibgib spaces. */
101
+ export const IbGibSpaceOptionsCmd = {
102
+ /** Retrieve ibGib(s) out of the space (does not remove them). */
103
+ get: 'get' as IbGibSpaceOptionsCmd,
104
+ /** Registers/imports ibGib(s) into the space. */
105
+ put: 'put' as IbGibSpaceOptionsCmd,
106
+ /** Delete an ibGib from a space */
107
+ delete: 'delete' as IbGibSpaceOptionsCmd,
108
+ }
109
+
110
+ /**
111
+ * Flags to affect the command's interpretation.
112
+ */
113
+ export type IbGibSpaceOptionsCmdModifier =
114
+ 'can' | 'addrs' | 'latest' | 'watch' | 'unwatch' | 'tjps';
115
+ /**
116
+ * Flags to affect the command's interpretation.
117
+ */
118
+ export const IbGibSpaceOptionsCmdModifier = {
119
+ /**
120
+ * Only interested if possibility to do command.
121
+ *
122
+ * This can be due to authorization or other.
123
+ */
124
+ can: 'can' as IbGibSpaceOptionsCmdModifier,
125
+ /**
126
+ * Only return the addresses of ibgibs
127
+ */
128
+ addrs: 'addrs' as IbGibSpaceOptionsCmdModifier,
129
+ /**
130
+ * Only interested in the latest one(s).
131
+ *
132
+ * The incoming addr(s) should be the tjp(s), since "latest"
133
+ * only makes sense with unique timelines which are referenced by
134
+ * their tjps.
135
+ *
136
+ * ## notes
137
+ *
138
+ * ATOW I'm actually using this in the aws dynamodb ibgib space to
139
+ * get "newer" ibgibs, not just the latest.
140
+ */
141
+ latest: 'latest' as IbGibSpaceOptionsCmdModifier,
142
+ /**
143
+ * Ask to get updates on tjps in ibGibAddrs.
144
+ */
145
+ watch: 'watch' as IbGibSpaceOptionsCmdModifier,
146
+ /*
147
+ * Ask to stop getting updates on tjps in ibGibAddrs.
148
+ */
149
+ unwatch: 'unwatch' as IbGibSpaceOptionsCmdModifier,
150
+ /**
151
+ * Get the tjp ibgibs/addrs for given ibgib(s)
152
+ */
153
+ tjps: 'tjps' as IbGibSpaceOptionsCmdModifier,
154
+ }
155
+
156
+ /** Information for interacting with spaces. */
157
+ export interface IbGibSpaceOptionsData
158
+ extends WitnessCmdData<IbGibSpaceOptionsCmd, IbGibSpaceOptionsCmdModifier> {
159
+ /**
160
+ * If putting, this will force replacing the file.
161
+ *
162
+ * ## intent
163
+ * atow this is just for `put` commands.
164
+ */
165
+ force?: boolean;
166
+ /**
167
+ */
168
+ catchAllErrors?: boolean;
169
+ /**
170
+ */
171
+ trace?: boolean;
172
+ }
173
+
174
+ export interface IbGibSpaceOptionsRel8ns extends WitnessCmdRel8ns {
175
+ }
176
+
177
+ export interface IbGibSpaceOptionsIbGib<
178
+ TIbGib extends IbGib = IbGib_V1,
179
+ TOptsData extends IbGibSpaceOptionsData = IbGibSpaceOptionsData,
180
+ // TOptsRel8ns extends IbGibSpaceOptionsRel8ns = IbGibSpaceOptionsRel8ns
181
+ TOptsRel8ns extends IbGibSpaceOptionsRel8ns = IbGibSpaceOptionsRel8ns,
182
+ > extends WitnessCmdIbGib<TIbGib, IbGibSpaceOptionsCmd, IbGibSpaceOptionsCmdModifier, TOptsData, TOptsRel8ns> {
183
+ }
184
+
185
+ /**
186
+ * Shape of result data common to all (most) space interactions.
187
+ *
188
+ * This is in addition of course to {@link WitnessResultData}.
189
+ */
190
+ export interface IbGibSpaceResultData extends WitnessResultData {
191
+ /**
192
+ * If the `cmd` is `canGet` or `canPut`, this holds the result that indicates
193
+ * if you can or can't.
194
+ */
195
+ can?: boolean;
196
+ /**
197
+ * Addresses not found in a get.
198
+ */
199
+ addrsNotFound?: IbGibAddr[];
200
+ /**
201
+ * Addresses that are already in the space when requesting `put` or `canPut`.
202
+ */
203
+ addrsAlreadyHave?: IbGibAddr[];
204
+ /**
205
+ * Result map used when
206
+ *
207
+ * Mapping of incoming ibGibAddr -> latestAddr | null
208
+ *
209
+ * If there is a tjp/timeline -> maps to the latest in the store.
210
+ * If there is no tjp -> maps to the incoming addr.
211
+ * If the incoming addr is not found in the store -> maps to null.
212
+ */
213
+ latestAddrsMap?: { [addr: string]: IbGibAddr | null }
214
+ /**
215
+ * Map of TjpAddr -> newer LatestIbGibAddr notification.
216
+ *
217
+ * ## about
218
+ *
219
+ * When using the `watch` command modifier, a caller can subscribe to
220
+ * updates/notifications to a timeline. When an update occurs in the space
221
+ * via a `put` cmd that ends up creating/storing a newer ibgib address than
222
+ * the one the receiving space knows the caller is aware of, it will try to
223
+ * make the caller aware of the update.
224
+ *
225
+ * There are two ways to do this:
226
+ * 1. Store the notification info locally until the next interaction between
227
+ * the space and the caller.
228
+ * 2. Send the notification actively to the caller.
229
+ *
230
+ * For the first implementation of notifications, only the first will be
231
+ * implemented. Local notifications will be implemented, but active
232
+ * internodal notification in the general sense will be implemented at a
233
+ * later time.
234
+ *
235
+ * ## notes
236
+ *
237
+ * * may also implement a dedicated command to watch subscriptions.
238
+ */
239
+ watchTjpUpdateMap?: { [tjpAddr: string]: IbGibAddr; }
240
+ }
241
+
242
+ export interface IbGibSpaceResultRel8ns extends WitnessResultRel8ns { }
243
+
244
+ export interface IbGibSpaceResultIbGib<
245
+ TIbGib extends IbGib,
246
+ TResultData extends IbGibSpaceResultData,
247
+ TResultRel8ns extends IbGibSpaceResultRel8ns
248
+ >
249
+ extends WitnessResultIbGib<TIbGib, TResultData, TResultRel8ns> {
250
+ }
251
+
252
+ /**
253
+ * Data space adapter/provider, such that a space should only have one type of...
254
+ * * ibGib shape
255
+ * * witness arg shape (which brings in external ibGibs)
256
+ * * witness result shape
257
+ *
258
+ * So this interface facilitates that belief.
259
+ */
260
+ export interface IbGibSpace<
261
+ TIbGib extends IbGib,
262
+ TOptionsData extends IbGibSpaceOptionsData,
263
+ TOptionsRel8ns extends IbGibSpaceOptionsRel8ns,
264
+ TOptionsIbGib extends IbGibSpaceOptionsIbGib<TIbGib, TOptionsData, TOptionsRel8ns>,
265
+ TResultData extends IbGibSpaceResultData,
266
+ TResultRel8ns extends IbGibSpaceResultRel8ns,
267
+ TResultIbGib extends IbGibSpaceResultIbGib<TIbGib, TResultData, TResultRel8ns>,
268
+ TData extends IbGibSpaceData = IbGibSpaceData,
269
+ TRel8ns extends IbGibSpaceRel8ns = IbGibRel8ns,
270
+ >
271
+ extends Witness<TOptionsIbGib, TResultIbGib, TData, TRel8ns> {
272
+ witness(arg: TOptionsIbGib): Promise<TResultIbGib | undefined>;
273
+ }
274
+
275
+ export type SpaceLockAction = 'lock' | 'unlock';
276
+ export type SpaceLockScope = 'all' | TjpIbGibAddr;
277
+
278
+ /**
279
+ * Data shape for {@link IbGibSpaceLockIbGib}.
280
+ *
281
+ * This includes the options passed in and contains any result data of the lock
282
+ * as well.
283
+ */
284
+ export interface IbGibSpaceLockData {
285
+ /**
286
+ * In-memory unique identifier associated with the lock.
287
+ *
288
+ * ## intent
289
+ *
290
+ * I intend this mainly as a device for differentiating among multiple
291
+ * tabs open on the same browser. These share the same IndexedDB instance
292
+ * (and thus the same space bucket), but they have different caching
293
+ * mechanisms and interfaces to this bucket.
294
+ */
295
+ instanceId?: string;
296
+ /**
297
+ * self-explanatory
298
+ */
299
+ // action?: SpaceLockAction;
300
+ /**
301
+ * When setting the lock, this was the maximum amount of time the lock is
302
+ * valid.
303
+ *
304
+ * {@link expirationUTC}
305
+ */
306
+ secondsValid?: number;
307
+ /**
308
+ * When setting the lock, this was the calculated expiration string based on
309
+ * {@link secondsValid}.
310
+ *
311
+ * If the lock is not manually released, this will determine if the lock is
312
+ * adhered to.
313
+ */
314
+ expirationUTC?: string;
315
+ /**
316
+ * The scope to which the lock applies.
317
+ */
318
+ scope: SpaceLockScope;
319
+ /**
320
+ * True if space was already locked.
321
+ */
322
+ alreadyLocked?: boolean;
323
+ /**
324
+ * True if caller's request to lock the space was executed.
325
+ */
326
+ success?: boolean;
327
+ /**
328
+ * If errored, this is the message.
329
+ */
330
+ errorMsg?: string;
331
+ }
332
+
333
+ /**
334
+ * Options for the function that locks a space.
335
+
336
+ * {@link IbGibSpaceLockData}
337
+ * {@link IbGibSpaceLockIbGib}
338
+ */
339
+ export interface IbGibSpaceLockOptions extends IbGibSpaceLockData {
340
+ /**
341
+ * the space to lock/unlock
342
+ */
343
+ space: IbGibSpaceAny;
344
+ }
345
+
346
+ /**
347
+ * Rel8ns shape for {@link IbGibSpaceLockIbGib}
348
+ *
349
+ * marker interface atm
350
+ */
351
+ export interface IbGibSpaceLockRel8ns extends IbGibRel8ns_V1 { }
352
+
353
+ /**
354
+ * When locking a space, this is the ibGib that contains informatino regarding
355
+ * the process. This includes if the lock was successful, how long the lock is
356
+ * good for, etc.
357
+ *
358
+ * ## notes
359
+ *
360
+ * * This is meant to be completely ephemeral and there will be no gib. There
361
+ * may be many calls to lock/release in tight loops and atow it wouldn't seem
362
+ * provide us with much benefit to store this kind of metadata.
363
+ */
364
+ export interface IbGibSpaceLockIbGib
365
+ extends IbGib_V1<IbGibSpaceLockData, IbGibSpaceLockRel8ns> {
366
+
367
+ }
368
+
369
+
370
+ /**
371
+ * Data of a {@link BootstrapIbGib}
372
+ */
373
+ export interface BootstrapData {
374
+ /**
375
+ * this id will be the default space of the bootstrap (meta space).
376
+ *
377
+ * The `bootstrapIbGib.rel8ns` will contain links to the space addresses,
378
+ * with `rel8nName === spaceId`.
379
+ *
380
+ * So to get the default space, you need the default space address. To get
381
+ * that address, you first read this data value, then index into
382
+ * `bootstrap.rel8ns[spaceId]`.
383
+ */
384
+ [BOOTSTRAP_DATA_DEFAULT_SPACE_ID_KEY]: SpaceId;
385
+ /**
386
+ * List of known spaces in this bootstrap. These should be rel8n names in
387
+ * the bootstrap's `rel8ns` map.
388
+ */
389
+ [BOOTSTRAP_DATA_KNOWN_SPACE_IDS_KEY]: SpaceId[];
390
+ }
391
+
392
+ /**
393
+ * Rel8ns of a {@link BootstrapIbGib}
394
+ *
395
+ * atow, these will have rel8nNames of [spaceId] that point to the corresponding
396
+ * latest spaceAddr, such that the length is always === 1.
397
+ */
398
+ export interface BootstrapRel8ns extends IbGibRel8ns_V1 {
399
+ // [BOOTSTRAP_REL8N_NAME_SPACE]: IbGibAddr[];
400
+ }
401
+
402
+ /**
403
+ * When the application first starts, it looks to bootstrap itself. So it will
404
+ * look for an ibgib with this "primitive" address, i.e. where the gib is the
405
+ * string literal 'gib'. It looks for this address inside what is called the
406
+ * "zero space". This is a default space with default parameters that always
407
+ * points to the same location, relative to the context (app in our current case,
408
+ * but in the future the context could be e.g. an IoT device or AI microservice).
409
+ *
410
+ * So the context execution starts, creating a default zero space ibgib in
411
+ * memory, which itself has a default location/parameters that the space looks
412
+ * in in storage. Here it looks for the bootstrap ibgib with a known address
413
+ * "bootstrap^gib" (atow). Inside that bootstrap ibgib, there should be at least
414
+ * one local space referenced, or a new one must be created and then stored here
415
+ * for future app/context startups.
416
+ *
417
+ * Spaces are rel8d by their `spaceId`'s in `ibgib.rel8ns`, and the `ibgib.data`
418
+ * key (`ibgib.data.defaultSpaceId` atow) contains the default `spaceId`. If
419
+ * there are multiple local spaces that the bootstrap ibgib knows about, there
420
+ * will be only one "default" set.
421
+ *
422
+ * ## first run
423
+ *
424
+ * @see {@link IbgibsService.createNewLocalSpaceAndBootstrapGib}
425
+ * @see {@link getLocalSpace} in `helper/space.ts`
426
+ *
427
+ * A new local space will be created, whose parameters (including its `uuid`
428
+ * which is its `spaceId`) contribute to its reiffied gib hash. A new bootstrap
429
+ * ibgib is created, and in its `bootstrapIbGib.data.defaultSpaceId` we set the
430
+ * newly created local space's id. We then rel8 the space to the bootstrap also
431
+ * via this spaceId as the rel8nName.
432
+ *
433
+ * Note that when the local space is updated, its most recent address must
434
+ * replace the address that the bootstrap ibgib is pointing to.
435
+ *
436
+ * @example
437
+ *
438
+ * Here is a copy of a bootstrap^gib.json file on March 30, 2022:
439
+ * ```
440
+ * {
441
+ * "ib":"bootstrap",
442
+ * "gib":"gib",
443
+ * "data":{
444
+ * "defaultSpaceId":"72af3bba9c6da224829de86982346e283469823e49862398a56510c238bad869",
445
+ * "spaceIds":["72af3bba9c6da224829de86982346e283469823e49862398a56510c238bad869"]
446
+ * },
447
+ * "rel8ns":{
448
+ * "72af3bba9c6da224829de86982346e283469823e49862398a56510c238bad869": [
449
+ * "witness space IonicSpace_V1 test_space_name 72af3bba9c6da224829de86982346e283469823e49862398a56510c238bad869^62879B18C2726D27262626552672868923477EE09171626A386C1982F392AC26"
450
+ * ]
451
+ * }
452
+ * }
453
+ * ```
454
+ *
455
+ * ## notes
456
+ *
457
+ * Usually primitives are not stored/persisted. This is because the `gib`
458
+ * indicates that there is no hash corroboration ("guarantee") to the internal
459
+ * data or rel8ns. However, a newly started app has to start somewhere. This
460
+ * offers an alternative to using app storage and streamlines the app overall,
461
+ * since instead of working with two stores (in Ionic: `Storage` and
462
+ * `FileSystem`) we will just be working with one (`FileSystem`).
463
+ *
464
+ * In the future, we'll want to do a workflow here where the user
465
+ * can start from an existing space, but for now it's just located
466
+ * here.
467
+ */
468
+ export interface BootstrapIbGib
469
+ extends IbGib_V1<BootstrapData, BootstrapRel8ns> {
470
+
471
+ }
472
+
473
+ /**
474
+ * Marker type to indicate that a string is meant to be a transmission id.
475
+ */
476
+ export type TxId = 'string';