@terreno/syncdb 57.20.0 → 58.0.0-beta.1

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 (476) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +7 -7
  3. package/dist/api/apiError.d.ts +43 -0
  4. package/dist/api/apiError.d.ts.map +1 -0
  5. package/dist/api/apiError.js +28 -0
  6. package/dist/api/apiError.js.map +1 -0
  7. package/dist/api/apiFetch.d.ts +44 -0
  8. package/dist/api/apiFetch.d.ts.map +1 -0
  9. package/dist/api/apiFetch.js +203 -0
  10. package/dist/api/apiFetch.js.map +1 -0
  11. package/dist/api/client.d.ts +70 -0
  12. package/dist/api/client.d.ts.map +1 -0
  13. package/dist/api/client.js +240 -0
  14. package/dist/api/client.js.map +1 -0
  15. package/dist/api/client.test.d.ts +2 -0
  16. package/dist/api/client.test.d.ts.map +1 -0
  17. package/dist/api/client.test.js +588 -0
  18. package/dist/api/client.test.js.map +1 -0
  19. package/dist/app/app.d.ts +13 -0
  20. package/dist/app/app.d.ts.map +1 -0
  21. package/dist/app/app.js +13 -0
  22. package/dist/app/app.js.map +1 -0
  23. package/dist/app/devConsoleLogger.d.ts +18 -0
  24. package/dist/app/devConsoleLogger.d.ts.map +1 -0
  25. package/dist/app/devConsoleLogger.js +147 -0
  26. package/dist/app/devConsoleLogger.js.map +1 -0
  27. package/dist/app/devConsoleLogger.test.d.ts +2 -0
  28. package/dist/app/devConsoleLogger.test.d.ts.map +1 -0
  29. package/dist/app/devConsoleLogger.test.js +202 -0
  30. package/dist/app/devConsoleLogger.test.js.map +1 -0
  31. package/dist/app/mcpTools.d.ts +32 -0
  32. package/dist/app/mcpTools.d.ts.map +1 -0
  33. package/dist/app/mcpTools.js +61 -0
  34. package/dist/app/mcpTools.js.map +1 -0
  35. package/dist/app/permissions.d.ts +26 -0
  36. package/dist/app/permissions.d.ts.map +1 -0
  37. package/dist/app/permissions.js +37 -0
  38. package/dist/app/permissions.js.map +1 -0
  39. package/dist/app/permissions.test.d.ts +2 -0
  40. package/dist/app/permissions.test.d.ts.map +1 -0
  41. package/dist/app/permissions.test.js +36 -0
  42. package/dist/app/permissions.test.js.map +1 -0
  43. package/dist/app/upgradeCheck.d.ts +46 -0
  44. package/dist/app/upgradeCheck.d.ts.map +1 -0
  45. package/dist/app/upgradeCheck.js +121 -0
  46. package/dist/app/upgradeCheck.js.map +1 -0
  47. package/dist/auth/SessionProvider.d.ts +40 -0
  48. package/dist/auth/SessionProvider.d.ts.map +1 -0
  49. package/dist/auth/SessionProvider.js +44 -0
  50. package/dist/auth/SessionProvider.js.map +1 -0
  51. package/dist/auth/SessionProvider.test.d.ts +2 -0
  52. package/dist/auth/SessionProvider.test.d.ts.map +1 -0
  53. package/dist/auth/SessionProvider.test.js +240 -0
  54. package/dist/auth/SessionProvider.test.js.map +1 -0
  55. package/dist/auth/TerrenoAccountSecurityScreen.d.ts +25 -0
  56. package/dist/auth/TerrenoAccountSecurityScreen.d.ts.map +1 -0
  57. package/dist/auth/TerrenoAccountSecurityScreen.js +21 -0
  58. package/dist/auth/TerrenoAccountSecurityScreen.js.map +1 -0
  59. package/dist/auth/TerrenoLoginScreen.d.ts +62 -0
  60. package/dist/auth/TerrenoLoginScreen.d.ts.map +1 -0
  61. package/dist/auth/TerrenoLoginScreen.js +45 -0
  62. package/dist/auth/TerrenoLoginScreen.js.map +1 -0
  63. package/dist/auth/auth.d.ts +36 -0
  64. package/dist/auth/auth.d.ts.map +1 -0
  65. package/dist/auth/auth.js +35 -0
  66. package/dist/auth/auth.js.map +1 -0
  67. package/dist/auth/betterAuthAdapter.d.ts +1 -1
  68. package/dist/auth/betterAuthClient.d.ts +276 -0
  69. package/dist/auth/betterAuthClient.d.ts.map +1 -0
  70. package/dist/auth/betterAuthClient.js +744 -0
  71. package/dist/auth/betterAuthClient.js.map +1 -0
  72. package/dist/auth/betterAuthClient.types.test.d.ts +2 -0
  73. package/dist/auth/betterAuthClient.types.test.d.ts.map +1 -0
  74. package/dist/auth/betterAuthClient.types.test.js +151 -0
  75. package/dist/auth/betterAuthClient.types.test.js.map +1 -0
  76. package/dist/auth/betterAuthClientRegistry.d.ts +51 -0
  77. package/dist/auth/betterAuthClientRegistry.d.ts.map +1 -0
  78. package/dist/auth/betterAuthClientRegistry.js +69 -0
  79. package/dist/auth/betterAuthClientRegistry.js.map +1 -0
  80. package/dist/auth/betterAuthClientRegistry.test.d.ts +2 -0
  81. package/dist/auth/betterAuthClientRegistry.test.d.ts.map +1 -0
  82. package/dist/auth/betterAuthClientRegistry.test.js +91 -0
  83. package/dist/auth/betterAuthClientRegistry.test.js.map +1 -0
  84. package/dist/auth/betterAuthTypes.d.ts +172 -0
  85. package/dist/auth/betterAuthTypes.d.ts.map +1 -0
  86. package/dist/auth/betterAuthTypes.js +7 -0
  87. package/dist/auth/betterAuthTypes.js.map +1 -0
  88. package/dist/auth/jwtAuthAdapter.d.ts +102 -0
  89. package/dist/auth/jwtAuthAdapter.d.ts.map +1 -0
  90. package/dist/auth/jwtAuthAdapter.js +282 -0
  91. package/dist/auth/jwtAuthAdapter.js.map +1 -0
  92. package/dist/auth/jwtAuthAdapter.test.d.ts +2 -0
  93. package/dist/auth/jwtAuthAdapter.test.d.ts.map +1 -0
  94. package/dist/auth/jwtAuthAdapter.test.js +614 -0
  95. package/dist/auth/jwtAuthAdapter.test.js.map +1 -0
  96. package/dist/auth/loginErrors.d.ts +75 -0
  97. package/dist/auth/loginErrors.d.ts.map +1 -0
  98. package/dist/auth/loginErrors.js +154 -0
  99. package/dist/auth/loginErrors.js.map +1 -0
  100. package/dist/auth/loginErrors.test.d.ts +2 -0
  101. package/dist/auth/loginErrors.test.d.ts.map +1 -0
  102. package/dist/auth/loginErrors.test.js +70 -0
  103. package/dist/auth/loginErrors.test.js.map +1 -0
  104. package/dist/auth/ownEntry.d.ts +8 -0
  105. package/dist/auth/ownEntry.d.ts.map +1 -0
  106. package/dist/auth/ownEntry.js +13 -0
  107. package/dist/auth/ownEntry.js.map +1 -0
  108. package/dist/auth/ownEntry.test.d.ts +2 -0
  109. package/dist/auth/ownEntry.test.d.ts.map +1 -0
  110. package/dist/auth/ownEntry.test.js +18 -0
  111. package/dist/auth/ownEntry.test.js.map +1 -0
  112. package/dist/auth/platform.d.ts +3 -0
  113. package/dist/auth/platform.d.ts.map +1 -0
  114. package/dist/auth/platform.js +4 -0
  115. package/dist/auth/platform.js.map +1 -0
  116. package/dist/auth/rememberedAccounts.d.ts +126 -0
  117. package/dist/auth/rememberedAccounts.d.ts.map +1 -0
  118. package/dist/auth/rememberedAccounts.js +399 -0
  119. package/dist/auth/rememberedAccounts.js.map +1 -0
  120. package/dist/auth/rememberedAccounts.test.d.ts +2 -0
  121. package/dist/auth/rememberedAccounts.test.d.ts.map +1 -0
  122. package/dist/auth/rememberedAccounts.test.js +676 -0
  123. package/dist/auth/rememberedAccounts.test.js.map +1 -0
  124. package/dist/auth/session.d.ts +118 -0
  125. package/dist/auth/session.d.ts.map +1 -0
  126. package/dist/auth/session.js +370 -0
  127. package/dist/auth/session.js.map +1 -0
  128. package/dist/auth/session.test.d.ts +2 -0
  129. package/dist/auth/session.test.d.ts.map +1 -0
  130. package/dist/auth/session.test.js +825 -0
  131. package/dist/auth/session.test.js.map +1 -0
  132. package/dist/auth/tokenExpiry.d.ts +70 -0
  133. package/dist/auth/tokenExpiry.d.ts.map +1 -0
  134. package/dist/auth/tokenExpiry.js +123 -0
  135. package/dist/auth/tokenExpiry.js.map +1 -0
  136. package/dist/auth/types.d.ts +1 -1
  137. package/dist/auth/types.js +1 -1
  138. package/dist/auth/useAccountSecurity.d.ts +183 -0
  139. package/dist/auth/useAccountSecurity.d.ts.map +1 -0
  140. package/dist/auth/useAccountSecurity.js +399 -0
  141. package/dist/auth/useAccountSecurity.js.map +1 -0
  142. package/dist/auth/useAccountSecurity.types.test.d.ts +2 -0
  143. package/dist/auth/useAccountSecurity.types.test.d.ts.map +1 -0
  144. package/dist/auth/useAccountSecurity.types.test.js +21 -0
  145. package/dist/auth/useAccountSecurity.types.test.js.map +1 -0
  146. package/dist/auth/useAuthMethods.d.ts +67 -0
  147. package/dist/auth/useAuthMethods.d.ts.map +1 -0
  148. package/dist/auth/useAuthMethods.js +77 -0
  149. package/dist/auth/useAuthMethods.js.map +1 -0
  150. package/dist/auth/useAuthMethods.test.d.ts +2 -0
  151. package/dist/auth/useAuthMethods.test.d.ts.map +1 -0
  152. package/dist/auth/useAuthMethods.test.js +145 -0
  153. package/dist/auth/useAuthMethods.test.js.map +1 -0
  154. package/dist/auth/useJwtAuth.d.ts +31 -0
  155. package/dist/auth/useJwtAuth.d.ts.map +1 -0
  156. package/dist/auth/useJwtAuth.js +58 -0
  157. package/dist/auth/useJwtAuth.js.map +1 -0
  158. package/dist/auth/useJwtAuth.test.d.ts +2 -0
  159. package/dist/auth/useJwtAuth.test.d.ts.map +1 -0
  160. package/dist/auth/useJwtAuth.test.js +165 -0
  161. package/dist/auth/useJwtAuth.test.js.map +1 -0
  162. package/dist/auth/useLoginController.d.ts +248 -0
  163. package/dist/auth/useLoginController.d.ts.map +1 -0
  164. package/dist/auth/useLoginController.js +671 -0
  165. package/dist/auth/useLoginController.js.map +1 -0
  166. package/dist/auth/useLoginController.types.test.d.ts +2 -0
  167. package/dist/auth/useLoginController.types.test.d.ts.map +1 -0
  168. package/dist/auth/useLoginController.types.test.js +19 -0
  169. package/dist/auth/useLoginController.types.test.js.map +1 -0
  170. package/dist/buildNumber.d.ts +34 -0
  171. package/dist/buildNumber.d.ts.map +1 -0
  172. package/dist/buildNumber.js +62 -0
  173. package/dist/buildNumber.js.map +1 -0
  174. package/dist/buildNumber.test.d.ts +2 -0
  175. package/dist/buildNumber.test.d.ts.map +1 -0
  176. package/dist/buildNumber.test.js +114 -0
  177. package/dist/buildNumber.test.js.map +1 -0
  178. package/dist/client.d.ts +10 -1
  179. package/dist/client.d.ts.map +1 -1
  180. package/dist/client.js +237 -184
  181. package/dist/client.js.map +1 -1
  182. package/dist/client.socketEvents.test.d.ts +2 -0
  183. package/dist/client.socketEvents.test.d.ts.map +1 -0
  184. package/dist/client.socketEvents.test.js +64 -0
  185. package/dist/client.socketEvents.test.js.map +1 -0
  186. package/dist/client.test.js +60 -1
  187. package/dist/client.test.js.map +1 -1
  188. package/dist/codegen/cli.js +23 -12
  189. package/dist/codegen/cli.js.map +1 -1
  190. package/dist/codegen/cli.test.js +57 -0
  191. package/dist/codegen/cli.test.js.map +1 -1
  192. package/dist/codegen/discoverCollections.d.ts.map +1 -1
  193. package/dist/codegen/discoverCollections.js +4 -0
  194. package/dist/codegen/discoverCollections.js.map +1 -1
  195. package/dist/codegen/discoverOperations.d.ts +11 -0
  196. package/dist/codegen/discoverOperations.d.ts.map +1 -0
  197. package/dist/codegen/discoverOperations.js +135 -0
  198. package/dist/codegen/discoverOperations.js.map +1 -0
  199. package/dist/codegen/emitApi.d.ts +8 -0
  200. package/dist/codegen/emitApi.d.ts.map +1 -0
  201. package/dist/codegen/emitApi.js +312 -0
  202. package/dist/codegen/emitApi.js.map +1 -0
  203. package/dist/codegen/emitApi.test.d.ts +2 -0
  204. package/dist/codegen/emitApi.test.d.ts.map +1 -0
  205. package/dist/codegen/emitApi.test.js +360 -0
  206. package/dist/codegen/emitApi.test.js.map +1 -0
  207. package/dist/codegen/emitSdk.js +2 -2
  208. package/dist/codegen/generate.d.ts +6 -1
  209. package/dist/codegen/generate.d.ts.map +1 -1
  210. package/dist/codegen/generate.js +18 -0
  211. package/dist/codegen/generate.js.map +1 -1
  212. package/dist/codegen/generate.test.js +53 -1
  213. package/dist/codegen/generate.test.js.map +1 -1
  214. package/dist/codegen/hookNames.d.ts +11 -0
  215. package/dist/codegen/hookNames.d.ts.map +1 -1
  216. package/dist/codegen/hookNames.js +23 -0
  217. package/dist/codegen/hookNames.js.map +1 -1
  218. package/dist/codegen/safeIdentifiers.d.ts +5 -1
  219. package/dist/codegen/safeIdentifiers.d.ts.map +1 -1
  220. package/dist/codegen/safeIdentifiers.js +7 -2
  221. package/dist/codegen/safeIdentifiers.js.map +1 -1
  222. package/dist/codegen/safeIdentifiers.test.js +9 -0
  223. package/dist/codegen/safeIdentifiers.test.js.map +1 -1
  224. package/dist/codegen/types.d.ts +46 -1
  225. package/dist/codegen/types.d.ts.map +1 -1
  226. package/dist/config/baseUrl.d.ts +13 -0
  227. package/dist/config/baseUrl.d.ts.map +1 -0
  228. package/dist/config/baseUrl.js +49 -0
  229. package/dist/config/baseUrl.js.map +1 -0
  230. package/dist/config/baseUrl.test.d.ts +2 -0
  231. package/dist/config/baseUrl.test.d.ts.map +1 -0
  232. package/dist/config/baseUrl.test.js +42 -0
  233. package/dist/config/baseUrl.test.js.map +1 -0
  234. package/dist/config/resolveBaseUrls.d.ts +53 -0
  235. package/dist/config/resolveBaseUrls.d.ts.map +1 -0
  236. package/dist/config/resolveBaseUrls.js +80 -0
  237. package/dist/config/resolveBaseUrls.js.map +1 -0
  238. package/dist/config/resolveBaseUrls.test.d.ts +2 -0
  239. package/dist/config/resolveBaseUrls.test.d.ts.map +1 -0
  240. package/dist/config/resolveBaseUrls.test.js +265 -0
  241. package/dist/config/resolveBaseUrls.test.js.map +1 -0
  242. package/dist/crypto/keyProviders.d.ts +2 -2
  243. package/dist/crypto/keyProviders.d.ts.map +1 -1
  244. package/dist/crypto/keyProviders.js +15 -4
  245. package/dist/crypto/keyProviders.js.map +1 -1
  246. package/dist/crypto/keyProviders.test.js +19 -0
  247. package/dist/crypto/keyProviders.test.js.map +1 -1
  248. package/dist/crypto/types.d.ts +5 -0
  249. package/dist/crypto/types.d.ts.map +1 -1
  250. package/dist/flags/flagTestServer.d.ts +19 -0
  251. package/dist/flags/flagTestServer.d.ts.map +1 -0
  252. package/dist/flags/flagTestServer.js +58 -0
  253. package/dist/flags/flagTestServer.js.map +1 -0
  254. package/dist/flags/useFeatureFlags.d.ts +30 -0
  255. package/dist/flags/useFeatureFlags.d.ts.map +1 -0
  256. package/dist/flags/useFeatureFlags.js +83 -0
  257. package/dist/flags/useFeatureFlags.js.map +1 -0
  258. package/dist/flags/useFeatureFlags.test.d.ts +2 -0
  259. package/dist/flags/useFeatureFlags.test.d.ts.map +1 -0
  260. package/dist/flags/useFeatureFlags.test.js +116 -0
  261. package/dist/flags/useFeatureFlags.test.js.map +1 -0
  262. package/dist/flags/useTerrenoFeatureFlags.d.ts +50 -0
  263. package/dist/flags/useTerrenoFeatureFlags.d.ts.map +1 -0
  264. package/dist/flags/useTerrenoFeatureFlags.js +125 -0
  265. package/dist/flags/useTerrenoFeatureFlags.js.map +1 -0
  266. package/dist/flags/useTerrenoFeatureFlags.test.d.ts +2 -0
  267. package/dist/flags/useTerrenoFeatureFlags.test.d.ts.map +1 -0
  268. package/dist/flags/useTerrenoFeatureFlags.test.js +259 -0
  269. package/dist/flags/useTerrenoFeatureFlags.test.js.map +1 -0
  270. package/dist/index.d.ts +2 -2
  271. package/dist/index.d.ts.map +1 -1
  272. package/dist/index.js +1 -1
  273. package/dist/index.js.map +1 -1
  274. package/dist/isolated/TerrenoAccountSecurityScreen.isolated.d.ts +2 -0
  275. package/dist/isolated/TerrenoAccountSecurityScreen.isolated.d.ts.map +1 -0
  276. package/dist/isolated/TerrenoAccountSecurityScreen.isolated.js +94 -0
  277. package/dist/isolated/TerrenoAccountSecurityScreen.isolated.js.map +1 -0
  278. package/dist/isolated/TerrenoLoginScreen.isolated.d.ts +2 -0
  279. package/dist/isolated/TerrenoLoginScreen.isolated.d.ts.map +1 -0
  280. package/dist/isolated/TerrenoLoginScreen.isolated.js +183 -0
  281. package/dist/isolated/TerrenoLoginScreen.isolated.js.map +1 -0
  282. package/dist/isolated/betterAuthClient.isolated.d.ts +2 -0
  283. package/dist/isolated/betterAuthClient.isolated.d.ts.map +1 -0
  284. package/dist/isolated/betterAuthClient.isolated.js +1734 -0
  285. package/dist/isolated/betterAuthClient.isolated.js.map +1 -0
  286. package/dist/isolated/betterAuthClient.native.isolated.d.ts +2 -0
  287. package/dist/isolated/betterAuthClient.native.isolated.d.ts.map +1 -0
  288. package/dist/isolated/betterAuthClient.native.isolated.js +153 -0
  289. package/dist/isolated/betterAuthClient.native.isolated.js.map +1 -0
  290. package/dist/isolated/mcpTools.isolated.d.ts +2 -0
  291. package/dist/isolated/mcpTools.isolated.d.ts.map +1 -0
  292. package/dist/isolated/mcpTools.isolated.js +197 -0
  293. package/dist/isolated/mcpTools.isolated.js.map +1 -0
  294. package/dist/isolated/rememberedAccounts.native.isolated.d.ts +2 -0
  295. package/dist/isolated/rememberedAccounts.native.isolated.d.ts.map +1 -0
  296. package/dist/isolated/rememberedAccounts.native.isolated.js +50 -0
  297. package/dist/isolated/rememberedAccounts.native.isolated.js.map +1 -0
  298. package/dist/isolated/sessionLogout.isolated.d.ts +2 -0
  299. package/dist/isolated/sessionLogout.isolated.d.ts.map +1 -0
  300. package/dist/isolated/sessionLogout.isolated.js +133 -0
  301. package/dist/isolated/sessionLogout.isolated.js.map +1 -0
  302. package/dist/isolated/tokenExpiry.isolated.d.ts +2 -0
  303. package/dist/isolated/tokenExpiry.isolated.d.ts.map +1 -0
  304. package/dist/isolated/tokenExpiry.isolated.js +232 -0
  305. package/dist/isolated/tokenExpiry.isolated.js.map +1 -0
  306. package/dist/isolated/upgradeCheck.isolated.d.ts +2 -0
  307. package/dist/isolated/upgradeCheck.isolated.d.ts.map +1 -0
  308. package/dist/isolated/upgradeCheck.isolated.js +241 -0
  309. package/dist/isolated/upgradeCheck.isolated.js.map +1 -0
  310. package/dist/isolated/useAccountSecurity.isolated.d.ts +2 -0
  311. package/dist/isolated/useAccountSecurity.isolated.d.ts.map +1 -0
  312. package/dist/isolated/useAccountSecurity.isolated.js +851 -0
  313. package/dist/isolated/useAccountSecurity.isolated.js.map +1 -0
  314. package/dist/isolated/useAccountSecurity.native.isolated.d.ts +2 -0
  315. package/dist/isolated/useAccountSecurity.native.isolated.d.ts.map +1 -0
  316. package/dist/isolated/useAccountSecurity.native.isolated.js +52 -0
  317. package/dist/isolated/useAccountSecurity.native.isolated.js.map +1 -0
  318. package/dist/isolated/useLoginController.isolated.d.ts +2 -0
  319. package/dist/isolated/useLoginController.isolated.d.ts.map +1 -0
  320. package/dist/isolated/useLoginController.isolated.js +1116 -0
  321. package/dist/isolated/useLoginController.isolated.js.map +1 -0
  322. package/dist/persisters/defaultPersisterFactory.native.d.ts.map +1 -1
  323. package/dist/persisters/defaultPersisterFactory.native.js +2 -0
  324. package/dist/persisters/defaultPersisterFactory.native.js.map +1 -1
  325. package/dist/persisters/encryptedIndexedDbPersister.d.ts.map +1 -1
  326. package/dist/persisters/encryptedIndexedDbPersister.js +3 -0
  327. package/dist/persisters/encryptedIndexedDbPersister.js.map +1 -1
  328. package/dist/persisters/types.d.ts +6 -0
  329. package/dist/persisters/types.d.ts.map +1 -1
  330. package/dist/query/queryWindows.js +2 -2
  331. package/dist/query/queryWindows.js.map +1 -1
  332. package/dist/react/apiHooks.d.ts +87 -0
  333. package/dist/react/apiHooks.d.ts.map +1 -0
  334. package/dist/react/apiHooks.js +195 -0
  335. package/dist/react/apiHooks.js.map +1 -0
  336. package/dist/react/apiHooks.test.d.ts +2 -0
  337. package/dist/react/apiHooks.test.d.ts.map +1 -0
  338. package/dist/react/apiHooks.test.js +366 -0
  339. package/dist/react/apiHooks.test.js.map +1 -0
  340. package/dist/react/index.d.ts +2 -0
  341. package/dist/react/index.d.ts.map +1 -1
  342. package/dist/react/index.js +2 -0
  343. package/dist/react/index.js.map +1 -1
  344. package/dist/react/provider.d.ts +2 -0
  345. package/dist/react/provider.d.ts.map +1 -1
  346. package/dist/react/provider.js +2 -0
  347. package/dist/react/provider.js.map +1 -1
  348. package/dist/react/useSocketEvent.d.ts +27 -0
  349. package/dist/react/useSocketEvent.d.ts.map +1 -0
  350. package/dist/react/useSocketEvent.js +36 -0
  351. package/dist/react/useSocketEvent.js.map +1 -0
  352. package/dist/react/useSocketEvent.test.d.ts +2 -0
  353. package/dist/react/useSocketEvent.test.d.ts.map +1 -0
  354. package/dist/react/useSocketEvent.test.js +76 -0
  355. package/dist/react/useSocketEvent.test.js.map +1 -0
  356. package/dist/sync/replayCoordinator.js +1 -1
  357. package/dist/sync/replayCoordinator.js.map +1 -1
  358. package/dist/sync/socketTransport.d.ts.map +1 -1
  359. package/dist/sync/socketTransport.js +14 -1
  360. package/dist/sync/socketTransport.js.map +1 -1
  361. package/dist/sync/socketTransport.test.js +42 -0
  362. package/dist/sync/socketTransport.test.js.map +1 -1
  363. package/dist/sync/transport.d.ts +9 -0
  364. package/dist/sync/transport.d.ts.map +1 -1
  365. package/dist/sync/transport.js +13 -0
  366. package/dist/sync/transport.js.map +1 -1
  367. package/dist/testing/fakeTransport.d.ts +5 -1
  368. package/dist/testing/fakeTransport.d.ts.map +1 -1
  369. package/dist/testing/fakeTransport.js +26 -0
  370. package/dist/testing/fakeTransport.js.map +1 -1
  371. package/dist/testing/fakeTransport.test.js +15 -0
  372. package/dist/testing/fakeTransport.test.js.map +1 -1
  373. package/package.json +96 -8
  374. package/src/api/apiError.ts +47 -0
  375. package/src/api/apiFetch.ts +245 -0
  376. package/src/api/client.test.ts +711 -0
  377. package/src/api/client.ts +367 -0
  378. package/src/app/app.ts +30 -0
  379. package/src/app/devConsoleLogger.test.ts +246 -0
  380. package/src/app/devConsoleLogger.ts +173 -0
  381. package/src/app/mcpTools.ts +101 -0
  382. package/src/app/permissions.test.ts +44 -0
  383. package/src/app/permissions.ts +58 -0
  384. package/src/app/upgradeCheck.ts +177 -0
  385. package/src/auth/SessionProvider.test.tsx +286 -0
  386. package/src/auth/SessionProvider.tsx +87 -0
  387. package/src/auth/TerrenoAccountSecurityScreen.tsx +56 -0
  388. package/src/auth/TerrenoLoginScreen.tsx +131 -0
  389. package/src/auth/auth.ts +117 -0
  390. package/src/auth/betterAuthAdapter.ts +1 -1
  391. package/src/auth/betterAuthClient.ts +997 -0
  392. package/src/auth/betterAuthClient.types.test.ts +197 -0
  393. package/src/auth/betterAuthClientRegistry.test.ts +114 -0
  394. package/src/auth/betterAuthClientRegistry.ts +99 -0
  395. package/src/auth/betterAuthTypes.ts +189 -0
  396. package/src/auth/jwtAuthAdapter.test.ts +754 -0
  397. package/src/auth/jwtAuthAdapter.ts +420 -0
  398. package/src/auth/loginErrors.test.ts +97 -0
  399. package/src/auth/loginErrors.ts +249 -0
  400. package/src/auth/ownEntry.test.ts +22 -0
  401. package/src/auth/ownEntry.ts +15 -0
  402. package/src/auth/platform.ts +4 -0
  403. package/src/auth/rememberedAccounts.test.ts +844 -0
  404. package/src/auth/rememberedAccounts.ts +568 -0
  405. package/src/auth/session.test.ts +976 -0
  406. package/src/auth/session.ts +509 -0
  407. package/src/auth/tokenExpiry.ts +185 -0
  408. package/src/auth/types.ts +1 -1
  409. package/src/auth/useAccountSecurity.ts +678 -0
  410. package/src/auth/useAccountSecurity.types.test.ts +28 -0
  411. package/src/auth/useAuthMethods.test.ts +181 -0
  412. package/src/auth/useAuthMethods.ts +137 -0
  413. package/src/auth/useJwtAuth.test.tsx +202 -0
  414. package/src/auth/useJwtAuth.ts +102 -0
  415. package/src/auth/useLoginController.ts +1038 -0
  416. package/src/auth/useLoginController.types.test.ts +26 -0
  417. package/src/buildNumber.test.ts +139 -0
  418. package/src/buildNumber.ts +75 -0
  419. package/src/client.socketEvents.test.ts +77 -0
  420. package/src/client.test.ts +73 -1
  421. package/src/client.ts +87 -18
  422. package/src/codegen/cli.test.ts +66 -0
  423. package/src/codegen/cli.ts +23 -12
  424. package/src/codegen/discoverCollections.ts +4 -0
  425. package/src/codegen/discoverOperations.ts +172 -0
  426. package/src/codegen/emitApi.test.tsx +445 -0
  427. package/src/codegen/emitApi.ts +396 -0
  428. package/src/codegen/emitSdk.ts +2 -2
  429. package/src/codegen/fixtures/openapi.api.json +840 -0
  430. package/src/codegen/generate.test.ts +54 -1
  431. package/src/codegen/generate.ts +20 -1
  432. package/src/codegen/hookNames.ts +35 -0
  433. package/src/codegen/safeIdentifiers.test.ts +20 -0
  434. package/src/codegen/safeIdentifiers.ts +7 -2
  435. package/src/codegen/types.ts +45 -1
  436. package/src/config/baseUrl.test.ts +53 -0
  437. package/src/config/baseUrl.ts +68 -0
  438. package/src/config/resolveBaseUrls.test.ts +308 -0
  439. package/src/config/resolveBaseUrls.ts +118 -0
  440. package/src/crypto/keyProviders.test.ts +23 -0
  441. package/src/crypto/keyProviders.ts +15 -4
  442. package/src/crypto/types.ts +5 -0
  443. package/src/flags/flagTestServer.ts +77 -0
  444. package/src/flags/useFeatureFlags.test.tsx +146 -0
  445. package/src/flags/useFeatureFlags.ts +130 -0
  446. package/src/flags/useTerrenoFeatureFlags.test.tsx +329 -0
  447. package/src/flags/useTerrenoFeatureFlags.ts +188 -0
  448. package/src/index.ts +2 -1
  449. package/src/isolated/TerrenoAccountSecurityScreen.isolated.tsx +123 -0
  450. package/src/isolated/TerrenoLoginScreen.isolated.tsx +256 -0
  451. package/src/isolated/betterAuthClient.isolated.ts +2198 -0
  452. package/src/isolated/betterAuthClient.native.isolated.ts +173 -0
  453. package/src/isolated/mcpTools.isolated.ts +259 -0
  454. package/src/isolated/rememberedAccounts.native.isolated.ts +63 -0
  455. package/src/isolated/sessionLogout.isolated.ts +152 -0
  456. package/src/isolated/tokenExpiry.isolated.ts +271 -0
  457. package/src/isolated/upgradeCheck.isolated.tsx +321 -0
  458. package/src/isolated/useAccountSecurity.isolated.ts +1089 -0
  459. package/src/isolated/useAccountSecurity.native.isolated.ts +61 -0
  460. package/src/isolated/useLoginController.isolated.ts +1384 -0
  461. package/src/persisters/defaultPersisterFactory.native.ts +7 -1
  462. package/src/persisters/encryptedIndexedDbPersister.ts +3 -0
  463. package/src/persisters/types.ts +6 -0
  464. package/src/query/queryWindows.ts +2 -2
  465. package/src/react/apiHooks.test.tsx +473 -0
  466. package/src/react/apiHooks.tsx +336 -0
  467. package/src/react/index.ts +2 -0
  468. package/src/react/provider.tsx +3 -0
  469. package/src/react/useSocketEvent.test.tsx +96 -0
  470. package/src/react/useSocketEvent.ts +59 -0
  471. package/src/sync/replayCoordinator.ts +1 -1
  472. package/src/sync/socketTransport.test.ts +49 -0
  473. package/src/sync/socketTransport.ts +15 -0
  474. package/src/sync/transport.ts +25 -0
  475. package/src/testing/fakeTransport.test.ts +18 -0
  476. package/src/testing/fakeTransport.ts +36 -5
package/CHANGELOG.md CHANGED
@@ -20,6 +20,99 @@ Upgrade notes for consumer action live in [`mcp-server/src/docs/upgrades/`](mcp-
20
20
 
21
21
  Unreleased changes live in [`changelog/unreleased/`](changelog/unreleased/). Add one Markdown file per feature (see that directory's README) instead of editing this section.
22
22
 
23
+ ## [58.0.0-beta.1] - 2026-11-02
24
+
25
+ Upgrade note: [`mcp-server/src/docs/upgrades/58.0.0-beta.1.md`](mcp-server/src/docs/upgrades/58.0.0-beta.1.md).
26
+
27
+ ### Breaking
28
+
29
+ - Terreno 58 targets Expo SDK 58 (`~58.0.14`), React Native `0.88.0`, and React `19.3.0`. `@terreno/ui` peers `react-native` `0.88.0`. Native catalog moves with the SDK: `react-native-gesture-handler` `~3.3.0`, `react-native-reanimated` `4.7.1` + `react-native-worklets` `0.13.0`, `react-native-screens` `~4.30.0`, `react-native-webview` `14.0.1`, `@sentry/react-native` `~8.28.0`, `@shopify/flash-list` `2.3.2`, `@shopify/react-native-skia` `2.14.0`. Rebuild dev clients and store binaries.
30
+ - Expo Router 58: set `export const unstable_settings = {initialRouteName}` on the layout instead of passing `initialRouteName` to `<Slot>` / navigators. `SidebarNavigation` ignores the prop.
31
+ - Expo Router 58 static rendering: a custom `app/+html.tsx` must render `headNodes` and `bodyNodes` from `useServerDocumentContext()` (`expo-router/html`), or exported pages ship without their JavaScript. `example-frontend` is updated.
32
+ - React Native 0.88 generated types: type refs as `ViewInstance`, `TextInstance`, `ScrollViewInstance`, and `TextInputInstance` (`Box.scrollRef`, `TextField.inputRef`, `Text` `ref`).
33
+ - `create-terreno-app` scaffolds Expo `~58.0.14`, React Native `0.88.0`, and React `19.3.0`.
34
+ - The Terreno 58 native module baseline lands in `example-frontend` and `demo`: `@stripe/stripe-react-native` 0.81.0, `react-native-purchases` and `react-native-purchases-ui` 10.12.2, `expo-device`, `expo-crypto`, `expo-local-authentication`, `expo-system-ui`, and `expo-build-properties` (Android Kotlin 2.2.21 and `compileSdkVersion` 37 pins). Rebuild every dev client and store binary. `react-native-otp-verify` is left out because it does not support the New Architecture. The demo has a hidden **Native Modules** page that shows each module's version and whether the running binary links it. See the 58.0.0 upgrade note.
35
+ - `TerrenoApp` turns HTTP rate limiting on by default. Omitting `rateLimit` now mounts the limiter with the memory store (auth 20 / 15 min, api 600 / 15 min). Pass `rateLimit: false` to turn it off. On Cloud Run pass `rateLimit: {trustProxy: 1}` so unauthenticated traffic keys by client IP. See the 58.0.0 upgrade note.
36
+ - `@terreno/admin-frontend` no longer takes an RTK `api`. The `api` prop is removed from every admin component (`AdminProvider`, `AdminShellLayout`, `AdminHome`, `AdminModelList`, `AdminModelTable`, `AdminModelForm`, `AdminScreenRouter`, `ConfigurationScreen`, `DocumentStorageBrowser`, `ConsentHistory`, comms, jobs, org, consent, and announcement screens, and widget props), and admin hooks drop their `api` argument (`useAdminConfig(apiBase)`, `useAdminScripts(apiBase)`, `useAdminRoles(apiBase)`, `useConfigurationApi({basePath})`, `useDocumentStorageApi(basePath)`, `useConsentHistory(baseUrl)`, `useOrganizationsApi(basePath)`, `useCommsDashboardApi()`, `useJobsDashboardApi()`, and the `useAiObservability*Api()` hooks).
37
+ - `useAdminApi(api, routePath, modelName)` is removed. Use `useAdminModelApi(routePath, modelName)`, which keeps the same hook names and calls the same `/admin/{routePath}` URLs through the admin fetch client. `AdminApi`, `EndpointBuilder`, and admin `injectEndpoints` are gone; `@reduxjs/toolkit` and `react-redux` are no longer peers of admin-frontend.
38
+ - `AdminProvider` is now the required auth binding for every admin request, including ObjectId and API-only model CRUD. Cookie SPAs pass `credentials="same-origin"`; embedded apps pass `apiOrigin` and `getAuthHeaders`. Product screens that reuse admin components wrap them in `AdminProvider`. See the 58.0.0 upgrade guide.
39
+ - Removed the legacy RTK realtime path. Use `sync` on `modelRouter` with `@terreno/syncdb` for live collection updates. `RealtimeApp`, `SyncApp`, socket auth, `sync:delta`, and admin `admin:model.changed` events are unchanged. See the 58.0.0 upgrade note.
40
+ - `@terreno/api`: `modelRouter` no longer accepts `realtime` (now a TypeScript error), and the change stream no longer emits the `sync` websocket event. Removed `RealtimeConfig`, `RealtimeEvent`, `DocumentSubscription`, `QuerySubscription`, `registerRealtime`, `getRealtimeRegistry`, `findRegistryEntryByCollection`, `findRegistryEntryByRoutePath`, `updateRealtimeRegistryOptions`, `clearRealtimeRegistry`, `RealtimeRegistryEntry`, the query-subscription store (`addQuerySubscription`, `removeQuerySubscription`, `removeAllSocketQueries`, `getQuerySubscriptionsForCollection`, `computeQueryId`, `clearQueryStore`), and `MAX_MODEL_SUBSCRIPTIONS` / `MAX_DOCUMENT_SUBSCRIPTIONS` / `MAX_QUERY_SUBSCRIPTIONS`. Sockets no longer handle `subscribe:model`, `subscribe:document`, or `subscribe:query`.
41
+ - `@terreno/rtk`: removed `realtimeList`, `realtimeDocument`, `setRealtimeSocket`, `getRealtimeSocket`, `useSyncConnection`, and the `RealtimeEvent` type. The rest of `@terreno/rtk` (including `useSocketConnection` and `useRealtimeDebug`) is removed in the same release; see `remove-rtk.md`.
42
+ - Removed `@terreno/rtk` and every Redux dependency (`@reduxjs/toolkit`, `react-redux`, `redux-persist`, `@rtk-query/codegen-openapi`). `@terreno/rtk` is not published for 58. `@terreno/syncdb` is the only frontend data, request, and session layer. Follow `docs/how-to/migrate-rtk-to-syncdb.md`, which maps every removed export to its replacement, and the 58.0.0 upgrade note.
43
+ - `@terreno/syncdb` adds `@terreno/syncdb/api` (`createApiClient`, `ApiError`), request hooks in `@terreno/syncdb/react` (`ApiClientProvider`, `useApiQuery`, `useLazyApiQuery`, `useApiMutation`, `useSocketEvent`), `@terreno/syncdb/config` (`baseUrl`, `baseWebsocketsUrl`, `appHeaders`), `@terreno/syncdb/auth` (`createBetterAuthClient`, `SessionProvider`, `useSession`, `jwtAuthAdapter`, `useJwtAuth`, token-expiry helpers), `@terreno/syncdb/flags` (`useFeatureFlags`, `useTerrenoFeatureFlags` on the sync socket), `@terreno/syncdb/app` (`useUpgradeCheck`, `hasPermission`, `canOpenAdminPage`, `installDevConsoleLogger`, `useMCPTools`), and `@terreno/syncdb/buildNumber`.
44
+ - `terreno-syncdb-codegen --api-out` generates typed hooks for every non-synced OpenAPI operation (same names as the RTK codegen), replacing `@rtk-query/codegen-openapi`. `bun run sdk` writes `store/apiSdk.ts`.
45
+ - `@terreno/ui` `ConsentNavigator`, `AnnouncementNavigator`, `useConsentForms`, `useSubmitConsent`, `useAnnouncements`, and `useAcknowledgeAnnouncement` take a request `client` instead of an RTK `api`.
46
+ - `GptHistory` (`gpt/histories`) and `McpServiceToken` (`mcp/service-tokens`, read-only) are synced collections with String ids. Run the `gptHistoryStringIdsMigration` (`@terreno/ai`) and `mcpServiceTokenStringIdsMigration` (`@terreno/api`) before deploying 58 frontends.
47
+ - `create-terreno-app`, the `terreno_bootstrap` prompt, and the `terreno_generate_screen` tool scaffold apps without Redux or `@terreno/rtk`. The terreno-mcp-local `get_rtk_state` tool, the MCP resource `terreno://docs/rtk`, and `terreno state --slice rtk` are removed; use `get_syncdb_state` and `terreno state`.
48
+
49
+ ### Added
50
+
51
+ - `DataTable` columns size themselves when `width` is omitted. Each auto column starts at the wider of its header and its content (sampled from at most 50 rows, measured with a canvas on web and estimated on native), clamped to 80–360px, and auto columns grow to fill the table's container. Columns that set `width` keep it. `DataTableColumn.width` is now optional.
52
+
53
+ ### Changed
54
+
55
+ - The repository's agent rules now generate with rulesync 17 (up from 9). The root rule `.rulesync/rules/00-root.md` now generates `AGENTS.md`, which Devin and other AGENTS.md readers load, in place of `.devin/rules/00-root.md`. Never edit `AGENTS.md` by hand: edit the root rule and run `bun run rules`. The examples that existed only in the old hand-edited `AGENTS.md` (syncdb and RTK SDK usage) moved into the root rule, so `CLAUDE.md`, the Cursor root rule, and Copilot instructions get them too. Links in the root rule now resolve from the repository root. Generated Copilot hooks use the portable `command` field. Generated Copilot subagents no longer list `agent/runSubagent` as their only tool, so they get every default tool. Generated skills carry their `license`, `disable-model-invocation`, and Devin `triggers` frontmatter.
56
+ - `@terreno/syncdb/auth` `SessionProvider`: `logout()` no longer clears the session before the server answers. The session stays in the state until `authClient.signOut()` finishes (`signOutTimeoutMs`, default 10 seconds), and then it is cleared. Meanwhile the new `isSigningOut` state (`useSession().isSigningOut`) is true; `isLoading` is left alone, so a navigator gated on it keeps its screen. Before, a login screen that opened at once could find the still-live session and sign the user straight back in. A sign-out that fails or times out checks the session first. A session that is still live, or a cookie or native session the server cannot be asked about, stays signed in, and `error` is set to `SIGN_OUT_FAILED_MESSAGE` ("Couldn't sign out. Check your connection and try again."). A web bearer client, which drops its token before the request leaves, ends signed out. The global `auth/logout` action (a refused session) now ends signed out even when the sign-out request fails. With `apisToReset` (57.17.0), `logout()` purges the cache when the session clears, not when it is dispatched: a purge at dispatch refetched every mounted screen mid-sign-out, and a refetch that could not reach the server answered 401 and signed the user out even though the sign-out failed. A failed sign-out keeps both the session and the cache. The global `auth/logout` action still purges at once (only the first of several in flight) and again when the session clears. A sign-in for another user that lands while a sign-out is in flight is kept; a sign-out that started signed out asks `getSession` first, so a restore of the session it revoked is cleared. Show `selectBetterAuthIsSigningOut` on the sign-out control and `selectBetterAuthError` after a failed sign-out.
57
+
58
+ ### Removed
59
+
60
+ - `@terreno/ui` no longer exports the `Filter` and `FilterProps` aliases deprecated in 57.7.0. Import `DropdownPanel` and `DropdownPanelProps` instead. `FilterSelectMenu`, `FilterBoolean`, `FilterAccordion`, and `FilterChangesBadge` keep their names.
61
+
62
+ ### Fixed
63
+
64
+ - `@terreno/syncdb`: logging out while `syncDb.start()` is still running no longer loses local writes or logs errors. `start()` now resolves the web encryption key from `GET /sync/key` before it loads the store, so the flush in `stop()` never needs the network after the session has ended. A `stop()` or `signOut()` call now cancels a `start()` that is running or queued ahead of it, so the transport never connects without a session. A failed key fetch is now retried on the next save instead of failing every save for the rest of the session.
65
+
66
+ ## [57.21.0] - 2026-11-01
67
+
68
+ Upgrade note: [`mcp-server/src/docs/upgrades/57.21.0.md`](mcp-server/src/docs/upgrades/57.21.0.md).
69
+
70
+ ### Breaking
71
+
72
+ - The `terreno-scan` plugin is now `terreno-loop`, and its skills are renamed from `terreno-scan-*` to `terreno-loop-*`. The resident loop `terreno-scan-loop` is now `terreno-loop-run`: `/terreno-loop:run` in Claude Code, `/terreno-loop-run` in Cursor, `$terreno-loop-run` in Codex. Claude Code moves existing installs over through the marketplace `renames` entry. In Cursor and Codex, uninstall `terreno-scan` and install `terreno-loop`. Campaign state stays at `.terreno/scan/<goal>.json`, so campaigns already in progress resume.
73
+
74
+ ### Added
75
+
76
+ - `@terreno/admin-spa` serves an MCP OAuth consent screen at `/console/oauth/consent`, so a backend with no product frontend can set `mcpOAuth.consentUrl` to `${issuer}/console/oauth/consent`. Any signed-in user can approve or deny a request with their Better Auth session; signed-out users sign in and return through the login screen's new `returnTo` parameter, which accepts only in-app paths.
77
+ - Claude Code plugins now publish to npm with every release, as `@terreno/agent-plugin` and `@terreno/agent-plugin-loop`. A new `terreno-releases` marketplace installs them at the latest stable release. To pin one release, add `TerrenoLabs/terreno#<version>` instead. See [Install agent skills](docs/how-to/install-agent-skills.md#pick-a-channel).
78
+ - The generated Claude plugin manifest no longer pins `version`. Before this change, plugins installed from the `TerrenoLabs/terreno` marketplace stayed on the `2.12.0` copy, because their version never changed. They now update on every commit. Run `/plugin update terreno@terreno-plugins` once to leave `2.12.0`.
79
+ - The `terreno-planning` lifecycle plugin (2.13.0) plans e2e tests and manual regression cases in every IP:
80
+
81
+ - Grow requires `## E2E tests` and `## Regression cases` sections (either may be `None — <reason>`), read from the e2e guide at `docs/testing/e2e.md` or a `## Testing conventions` override in AGENTS.md or CLAUDE.md.
82
+ - Regression cases stay minimal: most features add none. A case is only for what a developer or QA must check by hand, such as push notifications, and Roast fails one that repeats an existing case.
83
+ - Pick writes each planned spec in the task that delivers it, and Roast runs it; a missing or failing row is `FAIL`.
84
+ - Brew gates on every planned spec and merges regression cases into `docs/regression/<area>.md` with the next free ID.
85
+ - Taste re-checks both sections after behaviour-changing fixes and renumbers regression ID collisions with `master`.
86
+ - `bun run check:lifecycle-skills` enforces these phrases in every stage.
87
+ - New `backfill-regression` skill proposes manual regression cases one area at a time and writes only the sets the human approves.
88
+ - A consumer opts out of manual regression suites with `Regression suites | none` in its `## Testing conventions` table.
89
+ - The `terreno-planning` lifecycle plugin (2.14.0) grows an end-user guide with every feature:
90
+
91
+ - Every IP has a `## User guide` section listing the guide pages it adds, updates, or retires, or `None — <reason>`. Pages live in `docs/user-guide/<area>/<feature>.md`, one feature per page, with `title`, `audience`, `platforms`, and `questions` frontmatter that chat agents use to answer "how do I…" questions.
92
+ - Pick writes each page in the task that ships the feature, Roast checks it against the shipped screens, Brew gates on it and the index, and Taste keeps it current after fixes.
93
+ - A repo opts out with `| User guide | none — <reason> |` in a `## User guide conventions` table in AGENTS.md or CLAUDE.md.
94
+ - New `backfill-user-guide` skill drafts pages for features that shipped without one, one area at a time, and writes only the pages the human approves.
95
+ - `bun run check:user-guide` validates the pages and index (CI `repo-policies`); `--uncovered <app dir>` lists screens no page names.
96
+ - Terreno's own guide covers the example app's main features.
97
+ - `@terreno/api`: opt-in `mcpRequestLog` on `TerrenoApp` records one metadata-only `McpRequestLog` row per MCP tool call (tool, user, credential, service token or OAuth client, duration, outcome, error class; never arguments, results, or error text), expiring after `retentionDays` (default 30).
98
+ - `@terreno/api`: opt-in `mcpToolSettings` on `TerrenoApp` registers every MCP tool in `McpToolSetting` at startup; tools an admin switches off are hidden from `tools/list` and rejected by `tools/call`.
99
+ - `@terreno/api`: deleting an `McpOAuthToken` row revokes its whole connection (token family) and keeps the rows. New `McpOAuthToken.revokeAllForUser` and `McpServiceToken.revokeAllForUser`.
100
+ - `@terreno/admin-backend`: `mcpAdminModels()` adds MCP admin screens (service tokens, OAuth clients, OAuth connections, request log, tool switches), `mcpAdminStatements` for RBAC, and `mcpAdminScripts()` adds `mcp-sign-out-everywhere`. See [Manage MCP from the admin panel](docs/how-to/manage-mcp-in-admin.md).
101
+ - Docs: [Expose an MCP server safely](docs/how-to/expose-mcp-server-safely.md) (OAuth, service tokens, Cloudflare Tunnel, Access) and the `bootstrap-mcp-server` skill for a single-binary MCP server with the admin console embedded.
102
+ - Every workspace package has a real-process smoke test and an e2e page:
103
+
104
+ - Each package's `e2e/smoke.ts` (or `smoke.spec.ts` for browser packages) runs its built output through its public entry: a server on a real port, the compiled binary, or a page in Chromium. `bun run --cwd <package> smoke` runs one; `bun run smoke` runs them all and prints each package's time. The CircleCI `smoke` job runs them on every package change.
105
+ - `@terreno/test` adds the smoke helpers `smokeMongoUri()`, `spawnUntilReady()`, `spawnExampleBackend()`, `runBin()`, and `freePort()`.
106
+ - The [E2E testing guide](docs/testing/e2e.md) explains the test tiers and links one page per package under `docs/testing/e2e/`.
107
+ - Manual regression cases live in `docs/regression/<area>.md`, one file per area, and `bun run check:regression-suites` validates them.
108
+ - example-frontend's smoke serves a web export that `bun run --cwd example-frontend export:smoke` builds once with a placeholder API URL; the smoke swaps in a `freePort()` API URL as it serves the bundle, so the 30 s smoke no longer rebuilds the export. `spawnUntilReady()` takes `stopGraceMs`, and `spawnExampleBackend()` stops example-backend after 0.5 s instead of 5 s.
109
+ - Every workspace package has a `typecheck` script that runs `tsc` over source and test files through a new `tsconfig.typecheck.json`. Root `bun run lint` ends with `bun run typecheck`, and CircleCI runs it in a new `typecheck` job. Test files that had type errors were fixed.
110
+
111
+ ### Changed
112
+
113
+ - `@terreno/api`: deleting an `McpOAuthToken` row with document or query `deleteOne` now revokes that row's whole token family (the connection) and keeps the rows instead of removing one pair. `deleteMany` is unchanged.
114
+ - `@terreno/ui`: new `theme.field` tokens (`background`, `backgroundDisabled`, `border`, `borderFocus`, `borderError`, `borderDisabled`) style form inputs. `TextField`, `SelectField`, `DateTimeField`, `HeightField`, and `OtpField` read them instead of `surface.base` and `border.dark`. Defaults equal the old colors, but overriding `surface` or `border` no longer recolors those fields; use `setTheme({field: ...})`.
115
+
23
116
  ## [57.20.0] - 2026-10-30
24
117
 
25
118
  Upgrade note: [`mcp-server/src/docs/upgrades/57.20.0.md`](mcp-server/src/docs/upgrades/57.20.0.md).
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Local-first data layer for @terreno apps: TinyBase MergeableStore, durable outbox, websocket delta sync, encrypted web persistence.
4
4
 
5
- Local-first data layer for Terreno apps. A TinyBase `MergeableStore` (encrypted IndexedDB on web, expo-sqlite on native) is the UI's source of truth: reads come from the local store, writes apply optimistically and enqueue in a durable outbox, and the server reconciles asynchronously over a socket delta protocol with HTTP snapshot catch-up. Every mutation executes the existing `@terreno/api` modelRouter write path — identical permissions, hooks, and validation as REST. Supersedes `@terreno/rtk` for data-synchronization concerns (see [the migration guide](https://github.com/TerrenoLabs/terreno/blob/master/docs/how-to/migrate-rtk-to-syncdb.md)).
5
+ Local-first data layer for Terreno apps. A TinyBase `MergeableStore` (encrypted IndexedDB on web, expo-sqlite on native) is the UI's source of truth: reads come from the local store, writes apply optimistically and enqueue in a durable outbox, and the server reconciles asynchronously over a socket delta protocol with HTTP snapshot catch-up. Every mutation executes the existing `@terreno/api` modelRouter write path — identical permissions, hooks, and validation as REST. It also ships the request client, generated API hooks, auth session, feature flags, and app utilities that replaced `@terreno/rtk` in Terreno 58 (see [the upgrade guide](https://github.com/TerrenoLabs/terreno/blob/master/docs/how-to/migrate-rtk-to-syncdb.md)).
6
6
 
7
7
  ## Architecture
8
8
 
@@ -116,15 +116,16 @@ Index requirement: `TerrenoApp.start()` awaits `ensureSyncIndexes()` before list
116
116
  ### Frontend
117
117
 
118
118
  ```typescript
119
- import {betterAuthAdapter, createSyncDb} from "@terreno/syncdb";
119
+ import {betterAuthAdapter, bridgeBetterAuthReactClient, createSyncDb} from "@terreno/syncdb";
120
+ import {createBetterAuthClient} from "@terreno/syncdb/auth";
121
+ import {baseUrl} from "@terreno/syncdb/config";
120
122
  import {SyncDbProvider, useMutate, useQuery, useSyncStatus} from "@terreno/syncdb/react";
121
- import {createBetterAuthClient} from "@terreno/rtk";
122
123
 
123
- const authClient = createBetterAuthClient({baseURL: "http://localhost:4000"});
124
+ const authClient = createBetterAuthClient({baseURL: baseUrl, scheme: "myapp"});
124
125
 
125
126
  export const syncDb = createSyncDb({
126
- authProvider: betterAuthAdapter(authClient),
127
- baseUrl: "http://localhost:4000",
127
+ authProvider: betterAuthAdapter(bridgeBetterAuthReactClient(authClient)),
128
+ baseUrl,
128
129
  collections: ["todos"],
129
130
  name: "myapp",
130
131
  });
@@ -454,7 +455,6 @@ This writes `store/syncDbSdk.ts` with `SYNC_COLLECTIONS`, entity types, and hook
454
455
  - **`Model.bulkWrite` is unavailable on synced models**: it skips Mongoose middleware, so it can never stamp seqs. `registerSync` replaces the static with one that throws — bulk updates to a synced collection have to loop per document.
455
456
  - **Native plaintext by design**: no SQLCipher; the OS sandbox is deemed sufficient.
456
457
  - **Whole-store persistence**: each save serializes and (on web) encrypts the full store — cost scales with store size, not change size. Bound it by scoping which collections sync; saves are debounced, and a burst of transactions costs one serialization per write, not one per transaction.
457
- - **`realtime` + `sync` coexistence**: a model may enable both (distinct events, `sync` vs `sync:delta`, so clients never double-apply), at the cost of double emission work. `modelRouter` `realtime` is **deprecated and will be removed in Terreno 58**; use `sync` only.
458
458
  - **Cold start scales with row count, not stream count**: streams page together through `POST /sync/snapshot/batch`, one round trip per round of up to 5,000 rows. Against a server without that route, every stream costs at least one `GET /sync/snapshot` round trip (`snapshotConcurrency` at a time, default 6). Sync only the collections the client reads. See [Use syncdb correctly](https://github.com/TerrenoLabs/terreno/blob/master/docs/how-to/use-syncdb-correctly.md) for this and the write-path pitfalls apps must handle.
459
459
  - **Seq counter write amplification**: every synced write does an atomic `$inc` on a per-stream counter doc. Acceptable at current scale; Redis-based counters are the documented upgrade path.
460
460
 
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Error payload from an `@terreno/api` JSON:API error body. `title` is always
3
+ * set (falls back to the HTTP status text); the rest mirror the server body.
4
+ */
5
+ export interface ApiErrorData {
6
+ title: string;
7
+ detail?: string;
8
+ code?: string;
9
+ fields?: Record<string, string>;
10
+ meta?: Record<string, unknown>;
11
+ /**
12
+ * Set by the server when the error is expected and must not reach external error tracking
13
+ * (Sentry). Hosts' `onError` handlers should skip reporting when it is `true`.
14
+ */
15
+ disableExternalErrorTracking?: boolean;
16
+ }
17
+ /** `data.code` values for failures that never reached an HTTP response (`status: 0`). */
18
+ export declare const API_ERROR_CODES: {
19
+ /** The caller's `signal` aborted the request. */
20
+ readonly aborted: "request-aborted";
21
+ /** `fetch` rejected (offline, DNS, CORS, connection reset). */
22
+ readonly network: "network-error";
23
+ /** The request exceeded `timeoutMs`. */
24
+ readonly timeout: "request-timeout";
25
+ };
26
+ /**
27
+ * Thrown for every failed request made through the syncdb API client. Shaped like
28
+ * `@terreno/ui`'s `APIError` (`status` + `data.title`) so screens can render it
29
+ * directly. `status` is `0` for timeouts, cancellations, and network failures
30
+ * (see {@link API_ERROR_CODES}).
31
+ */
32
+ export declare class ApiError extends Error {
33
+ data: ApiErrorData;
34
+ status: number;
35
+ constructor({ cause, data, status }: {
36
+ cause?: unknown;
37
+ data: ApiErrorData;
38
+ status: number;
39
+ });
40
+ }
41
+ /** Narrow an unknown caught value to {@link ApiError}. */
42
+ export declare const isApiError: (value: unknown) => value is ApiError;
43
+ //# sourceMappingURL=apiError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiError.d.ts","sourceRoot":"","sources":["../../src/api/apiError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B;;;OAGG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;CACxC;AAED,yFAAyF;AACzF,eAAO,MAAM,eAAe;IAC1B,iDAAiD;;IAEjD,+DAA+D;;IAE/D,wCAAwC;;CAEhC,CAAC;AAEX;;;;;GAKG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;gBAEH,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAC,EAAE;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,YAAY,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC;CAMzF;AAED,0DAA0D;AAC1D,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,QAAqC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /** `data.code` values for failures that never reached an HTTP response (`status: 0`). */
2
+ export const API_ERROR_CODES = {
3
+ /** The caller's `signal` aborted the request. */
4
+ aborted: "request-aborted",
5
+ /** `fetch` rejected (offline, DNS, CORS, connection reset). */
6
+ network: "network-error",
7
+ /** The request exceeded `timeoutMs`. */
8
+ timeout: "request-timeout",
9
+ };
10
+ /**
11
+ * Thrown for every failed request made through the syncdb API client. Shaped like
12
+ * `@terreno/ui`'s `APIError` (`status` + `data.title`) so screens can render it
13
+ * directly. `status` is `0` for timeouts, cancellations, and network failures
14
+ * (see {@link API_ERROR_CODES}).
15
+ */
16
+ export class ApiError extends Error {
17
+ data;
18
+ status;
19
+ constructor({ cause, data, status }) {
20
+ super(data.title, cause === undefined ? undefined : { cause });
21
+ this.name = "ApiError";
22
+ this.data = data;
23
+ this.status = status;
24
+ }
25
+ }
26
+ /** Narrow an unknown caught value to {@link ApiError}. */
27
+ export const isApiError = (value) => value instanceof ApiError;
28
+ //# sourceMappingURL=apiError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiError.js","sourceRoot":"","sources":["../../src/api/apiError.ts"],"names":[],"mappings":"AAiBA,yFAAyF;AACzF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,iDAAiD;IACjD,OAAO,EAAE,iBAAiB;IAC1B,+DAA+D;IAC/D,OAAO,EAAE,eAAe;IACxB,wCAAwC;IACxC,OAAO,EAAE,iBAAiB;CAClB,CAAC;AAEX;;;;;GAKG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,IAAI,CAAe;IACnB,MAAM,CAAS;IAEf,YAAY,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAwD;QACtF,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,0DAA0D;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAAqB,EAAE,CAAC,KAAK,YAAY,QAAQ,CAAC"}
@@ -0,0 +1,44 @@
1
+ /** Default AbortController timeout for a single request. */
2
+ export declare const DEFAULT_API_TIMEOUT_MS = 30000;
3
+ /** `fetch`-compatible function; injectable for tests and custom transports. */
4
+ export type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
5
+ export interface ApiFetchArgs {
6
+ url: string;
7
+ method?: string;
8
+ /** Plain objects are JSON-encoded; FormData, Blob, and strings pass through. */
9
+ body?: BodyInit | Record<string, unknown> | readonly unknown[] | null;
10
+ /** Primitives, arrays (repeated keys), nested objects (bracket keys), Dates (ISO strings). */
11
+ params?: Record<string, unknown>;
12
+ headers?: HeadersInit;
13
+ credentials?: RequestCredentials;
14
+ signal?: AbortSignal;
15
+ timeoutMs?: number;
16
+ /** Defaults to JSON when the response says so, otherwise text. */
17
+ parseAs?: "json" | "text" | "blob";
18
+ fetchImpl?: FetchLike;
19
+ }
20
+ /**
21
+ * Serialize query params for `@terreno/api`'s qs parser: arrays become repeated
22
+ * keys and nested objects use bracket keys (`updated[$gte]=…`).
23
+ */
24
+ export declare const serializeParams: (params: Record<string, unknown> | undefined) => string;
25
+ /** Prefix a relative URL with `baseUrl`; absolute and protocol-relative URLs are kept. */
26
+ export declare const resolveApiUrl: ({ baseUrl, url }: {
27
+ baseUrl?: string;
28
+ url: string;
29
+ }) => string;
30
+ /**
31
+ * Same response unwrapping the RTK base query used: list envelopes
32
+ * (`{data, more, …}`) stay whole, and envelopes with a truthy `data` unwrap to it.
33
+ */
34
+ export declare const unwrapEnvelope: (result: unknown) => unknown;
35
+ /**
36
+ * One `fetch` with a timeout, body encoding, and JSON:API error mapping. No auth,
37
+ * retries, or unwrapping — {@link createApiClient} layers those on. Exported for
38
+ * hosts (admin-frontend) that bind their own auth headers.
39
+ */
40
+ export declare const apiFetch: ({ body, credentials, fetchImpl, headers, method, params, parseAs, signal, timeoutMs, url, }: ApiFetchArgs) => Promise<{
41
+ response: Response;
42
+ result: unknown;
43
+ }>;
44
+ //# sourceMappingURL=apiFetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiFetch.d.ts","sourceRoot":"","sources":["../../src/api/apiFetch.ts"],"names":[],"mappings":"AAEA,4DAA4D;AAC5D,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAE7C,+EAA+E;AAC/E,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEjF,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,OAAO,EAAE,GAAG,IAAI,CAAC;IACtE,8FAA8F;IAC9F,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACnC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAwCD;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,KAAG,MAS7E,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,aAAa,GAAI,kBAAgB;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,KAAG,MAM/E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,OAAO,KAAG,OAYhD,CAAC;AA4CF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAU,6FAW5B,YAAY,KAAG,OAAO,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAC,CAkF9D,CAAC"}
@@ -0,0 +1,203 @@
1
+ import { API_ERROR_CODES, ApiError } from "./apiError";
2
+ /** Default AbortController timeout for a single request. */
3
+ export const DEFAULT_API_TIMEOUT_MS = 30_000;
4
+ const isFormData = (value) => typeof FormData !== "undefined" && value instanceof FormData;
5
+ const isBinary = (value) => (typeof Blob !== "undefined" && value instanceof Blob) ||
6
+ (typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer) ||
7
+ (typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams);
8
+ const isJsonBody = (value) => value != null && typeof value === "object" && !isFormData(value) && !isBinary(value);
9
+ const appendParam = (search, key, value) => {
10
+ if (value === undefined) {
11
+ return;
12
+ }
13
+ if (value === null) {
14
+ search.append(key, "");
15
+ return;
16
+ }
17
+ if (Array.isArray(value)) {
18
+ for (const item of value) {
19
+ appendParam(search, key, item);
20
+ }
21
+ return;
22
+ }
23
+ if (value instanceof Date) {
24
+ search.append(key, value.toISOString());
25
+ return;
26
+ }
27
+ if (typeof value === "object") {
28
+ for (const [childKey, childValue] of Object.entries(value)) {
29
+ appendParam(search, `${key}[${childKey}]`, childValue);
30
+ }
31
+ return;
32
+ }
33
+ search.append(key, String(value));
34
+ };
35
+ /**
36
+ * Serialize query params for `@terreno/api`'s qs parser: arrays become repeated
37
+ * keys and nested objects use bracket keys (`updated[$gte]=…`).
38
+ */
39
+ export const serializeParams = (params) => {
40
+ if (!params) {
41
+ return "";
42
+ }
43
+ const search = new URLSearchParams();
44
+ for (const [key, value] of Object.entries(params)) {
45
+ appendParam(search, key, value);
46
+ }
47
+ return search.toString();
48
+ };
49
+ /** Prefix a relative URL with `baseUrl`; absolute and protocol-relative URLs are kept. */
50
+ export const resolveApiUrl = ({ baseUrl, url }) => {
51
+ if (!baseUrl || /^[a-z][a-z0-9+.-]*:/i.test(url) || url.startsWith("//")) {
52
+ return url;
53
+ }
54
+ const trimmed = baseUrl.replace(/\/+$/, "");
55
+ return `${trimmed}${url.startsWith("/") ? url : `/${url}`}`;
56
+ };
57
+ /**
58
+ * Same response unwrapping the RTK base query used: list envelopes
59
+ * (`{data, more, …}`) stay whole, and envelopes with a truthy `data` unwrap to it.
60
+ */
61
+ export const unwrapEnvelope = (result) => {
62
+ if (result == null || typeof result !== "object" || Array.isArray(result)) {
63
+ return result;
64
+ }
65
+ if ("more" in result) {
66
+ return result;
67
+ }
68
+ const data = result.data;
69
+ if (data) {
70
+ return data;
71
+ }
72
+ return result;
73
+ };
74
+ const readErrorData = async (response) => {
75
+ const contentType = response.headers.get("Content-Type") ?? "";
76
+ if (contentType.includes("application/json")) {
77
+ try {
78
+ const parsed = (await response.json());
79
+ // Routes that predate JSON:API errors (`PATCH /auth/me`) answer `{message}`; it is the
80
+ // reason the server gives, so it stands in for the missing `title`.
81
+ const title = typeof parsed?.title === "string" && parsed.title.length > 0
82
+ ? parsed.title
83
+ : typeof parsed?.message === "string" && parsed.message.length > 0
84
+ ? parsed.message
85
+ : undefined;
86
+ if (parsed && title !== undefined) {
87
+ const data = { title };
88
+ if (parsed.detail !== undefined) {
89
+ data.detail = parsed.detail;
90
+ }
91
+ if (parsed.code !== undefined) {
92
+ data.code = parsed.code;
93
+ }
94
+ if (parsed.fields !== undefined) {
95
+ data.fields = parsed.fields;
96
+ }
97
+ if (parsed.meta !== undefined) {
98
+ data.meta = parsed.meta;
99
+ }
100
+ if (typeof parsed.disableExternalErrorTracking === "boolean") {
101
+ data.disableExternalErrorTracking = parsed.disableExternalErrorTracking;
102
+ }
103
+ return data;
104
+ }
105
+ }
106
+ catch {
107
+ // Fall through to the status text.
108
+ }
109
+ }
110
+ const fallback = response.statusText.trim();
111
+ return { title: fallback.length > 0 ? fallback : `Request failed (${response.status})` };
112
+ };
113
+ /**
114
+ * One `fetch` with a timeout, body encoding, and JSON:API error mapping. No auth,
115
+ * retries, or unwrapping — {@link createApiClient} layers those on. Exported for
116
+ * hosts (admin-frontend) that bind their own auth headers.
117
+ */
118
+ export const apiFetch = async ({ body, credentials, fetchImpl, headers, method = "GET", params, parseAs, signal, timeoutMs = DEFAULT_API_TIMEOUT_MS, url, }) => {
119
+ const controller = new AbortController();
120
+ let timedOut = false;
121
+ const onAbort = () => {
122
+ controller.abort();
123
+ };
124
+ if (signal?.aborted) {
125
+ controller.abort();
126
+ }
127
+ else {
128
+ signal?.addEventListener("abort", onAbort, { once: true });
129
+ }
130
+ const timeoutId = setTimeout(() => {
131
+ timedOut = true;
132
+ controller.abort();
133
+ }, timeoutMs);
134
+ const requestHeaders = new Headers(headers);
135
+ let requestBody;
136
+ if (isJsonBody(body)) {
137
+ requestBody = JSON.stringify(body);
138
+ if (!requestHeaders.has("Content-Type")) {
139
+ requestHeaders.set("Content-Type", "application/json");
140
+ }
141
+ }
142
+ else if (body != null) {
143
+ requestBody = body;
144
+ }
145
+ const query = serializeParams(params);
146
+ const fullUrl = query ? `${url}${url.includes("?") ? "&" : "?"}${query}` : url;
147
+ const fetcher = fetchImpl ?? ((input, init) => globalThis.fetch(input, init));
148
+ try {
149
+ const response = await fetcher(fullUrl, {
150
+ body: requestBody,
151
+ credentials,
152
+ headers: requestHeaders,
153
+ method,
154
+ signal: controller.signal,
155
+ });
156
+ if (!response.ok) {
157
+ throw new ApiError({ data: await readErrorData(response), status: response.status });
158
+ }
159
+ if (response.status === 204) {
160
+ return { response, result: null };
161
+ }
162
+ if (parseAs === "blob") {
163
+ return { response, result: await response.blob() };
164
+ }
165
+ if (parseAs === "text") {
166
+ return { response, result: await response.text() };
167
+ }
168
+ const contentType = response.headers.get("Content-Type") ?? "";
169
+ if (parseAs === "json" || contentType.includes("application/json")) {
170
+ return { response, result: await response.json() };
171
+ }
172
+ return { response, result: await response.text() };
173
+ }
174
+ catch (error) {
175
+ if (error instanceof ApiError) {
176
+ throw error;
177
+ }
178
+ if (timedOut) {
179
+ throw new ApiError({
180
+ cause: error,
181
+ data: { code: API_ERROR_CODES.timeout, title: "Request timed out" },
182
+ status: 0,
183
+ });
184
+ }
185
+ if (controller.signal.aborted || (error instanceof Error && error.name === "AbortError")) {
186
+ throw new ApiError({
187
+ cause: error,
188
+ data: { code: API_ERROR_CODES.aborted, title: "Request cancelled" },
189
+ status: 0,
190
+ });
191
+ }
192
+ throw new ApiError({
193
+ cause: error,
194
+ data: { code: API_ERROR_CODES.network, title: "Network request failed" },
195
+ status: 0,
196
+ });
197
+ }
198
+ finally {
199
+ clearTimeout(timeoutId);
200
+ signal?.removeEventListener("abort", onAbort);
201
+ }
202
+ };
203
+ //# sourceM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H,CAAC,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * `@terreno/syncdb/api` — request client for every non-synced `@terreno/api` route
3
+ * (`/auth/me`, modelRouter actions, AI, consents, …). Synced collections use the
4
+ * local-first store instead; this client covers request/response APIs.
5
+ *
6
+ * It shares the {@link AuthProvider} contract with `createSyncDb`, so sync and
7
+ * request traffic authenticate (and refresh on 401) the same way.
8
+ */
9
+ import type { AuthProvider } from "../types";
10
+ import { ApiError } from "./apiError";
11
+ import { type ApiFetchArgs, type FetchLike } from "./apiFetch";
12
+ export { API_ERROR_CODES, ApiError, type ApiErrorData, isApiError } from "./apiError";
13
+ export { type ApiFetchArgs, apiFetch, DEFAULT_API_TIMEOUT_MS, type FetchLike, resolveApiUrl, serializeParams, unwrapEnvelope, } from "./apiFetch";
14
+ /** How long an unsubscribed cache entry survives before it is dropped. */
15
+ export declare const DEFAULT_KEEP_UNUSED_DATA_MS = 60000;
16
+ export interface ApiRequestArgs extends Omit<ApiFetchArgs, "fetchImpl" | "headers"> {
17
+ headers?: Record<string, string>;
18
+ /** Unwrap `{data}` single-document envelopes (default `true`). */
19
+ unwrap?: boolean;
20
+ }
21
+ export interface ApiClientConfig {
22
+ /** API origin; relative request URLs are prefixed with it. */
23
+ baseUrl?: string;
24
+ /** Same provider passed to `createSyncDb`. Only `getToken` and `refresh` are used. */
25
+ authProvider?: Pick<AuthProvider, "getToken"> & Partial<Pick<AuthProvider, "refresh">>;
26
+ /** `"include"` for cookie sessions across origins, `"same-origin"` for SPAs. */
27
+ credentials?: RequestCredentials;
28
+ /** Extra headers on every request (e.g. `App-Version`, `App-Platform`). */
29
+ headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
30
+ fetchImpl?: FetchLike;
31
+ timeoutMs?: number;
32
+ /** Called for every failed request, after any refresh retry (e.g. report to Sentry). */
33
+ onError?: (error: ApiError, args: ApiRequestArgs) => void;
34
+ keepUnusedDataMs?: number;
35
+ }
36
+ export type ApiQueryStatus = "uninitialized" | "pending" | "fulfilled" | "rejected";
37
+ export interface ApiQueryState<T = unknown> {
38
+ status: ApiQueryStatus;
39
+ data: T | undefined;
40
+ error: unknown;
41
+ /** True while any request (first load or refetch) is in flight. */
42
+ isFetching: boolean;
43
+ }
44
+ export interface ApiQueryOptions {
45
+ providesTags?: readonly string[];
46
+ /** Ignore cached data and in-flight requests and fetch again. */
47
+ force?: boolean;
48
+ }
49
+ export interface ApiClient {
50
+ readonly baseUrl: string | undefined;
51
+ /** One uncached request with auth, refresh-on-401, and envelope unwrapping. */
52
+ request: <T = unknown>(args: ApiRequestArgs) => Promise<T>;
53
+ /** Cached request: dedupes identical in-flight calls and reuses fulfilled data. */
54
+ fetchQuery: <T = unknown>(args: ApiRequestArgs, options?: ApiQueryOptions) => Promise<T>;
55
+ getQueryState: <T = unknown>(args: ApiRequestArgs) => ApiQueryState<T>;
56
+ /** Listen for state changes on one cache entry. Returns unsubscribe. */
57
+ subscribeQuery: (args: ApiRequestArgs, listener: () => void, options?: Pick<ApiQueryOptions, "providesTags">) => () => void;
58
+ /** Refetch subscribed entries carrying any of `tags`; drop unsubscribed ones. */
59
+ invalidateTags: (tags: readonly string[]) => void;
60
+ /** Drop every cache entry (call on logout / user switch). */
61
+ reset: () => void;
62
+ }
63
+ /**
64
+ * Stable cache key: method, URL, params, headers, JSON or string body, and unwrap mode.
65
+ * FormData and Blob bodies are not part of the key; send those with `request()`.
66
+ */
67
+ export declare const apiQueryKey: (args: ApiRequestArgs) => string;
68
+ /** Create a request client. One per app; pass it to `ApiClientProvider`. */
69
+ export declare const createApiClient: (config?: ApiClientConfig) => ApiClient;
70
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAkB,QAAQ,EAAC,MAAM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