@qlever-llc/trellis 0.7.0-rc.5 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (994) hide show
  1. package/README.md +9 -8
  2. package/esm/_dnt.shims.d.ts +1 -2
  3. package/esm/_dnt.shims.d.ts.map +1 -1
  4. package/esm/auth/browser/login.d.ts +10 -2
  5. package/esm/auth/browser/login.d.ts.map +1 -1
  6. package/esm/auth/browser/login.js +37 -21
  7. package/esm/auth/browser.d.ts +4 -3
  8. package/esm/auth/browser.d.ts.map +1 -1
  9. package/esm/auth/browser.js +3 -2
  10. package/esm/auth/device_activation.d.ts +16 -4
  11. package/esm/auth/device_activation.d.ts.map +1 -1
  12. package/esm/auth/device_activation.js +37 -13
  13. package/esm/auth/mod.d.ts +4 -4
  14. package/esm/auth/mod.d.ts.map +1 -1
  15. package/esm/auth/mod.js +4 -4
  16. package/esm/auth/protocol.d.ts +330 -65
  17. package/esm/auth/protocol.d.ts.map +1 -1
  18. package/esm/auth/protocol.js +278 -206
  19. package/esm/auth/schemas.d.ts +67 -2
  20. package/esm/auth/schemas.d.ts.map +1 -1
  21. package/esm/auth/schemas.js +30 -5
  22. package/esm/auth/session_auth.d.ts +2 -3
  23. package/esm/auth/session_auth.d.ts.map +1 -1
  24. package/esm/auth/session_auth.js +24 -10
  25. package/esm/auth.d.ts +3 -0
  26. package/esm/auth.d.ts.map +1 -0
  27. package/esm/auth.js +2 -0
  28. package/esm/browser.d.ts +6 -0
  29. package/esm/browser.d.ts.map +1 -0
  30. package/esm/browser.js +5 -0
  31. package/esm/client.d.ts.map +1 -0
  32. package/esm/client_connect.d.ts +53 -0
  33. package/esm/client_connect.d.ts.map +1 -0
  34. package/esm/client_connect.js +338 -0
  35. package/esm/codec.d.ts.map +1 -0
  36. package/esm/contract.d.ts +20 -0
  37. package/esm/contract.d.ts.map +1 -0
  38. package/esm/contract.js +1 -0
  39. package/esm/contract_support/canonical.d.ts.map +1 -0
  40. package/esm/contract_support/mod.d.ts +622 -0
  41. package/esm/contract_support/mod.d.ts.map +1 -0
  42. package/esm/contract_support/mod.js +968 -0
  43. package/esm/contract_support/protocol.d.ts.map +1 -0
  44. package/esm/contract_support/protocol.js +145 -0
  45. package/esm/contract_support/runtime.d.ts +75 -0
  46. package/esm/contract_support/runtime.d.ts.map +1 -0
  47. package/esm/contract_support/schema_pointers.d.ts.map +1 -0
  48. package/esm/contracts.d.ts +5 -0
  49. package/esm/contracts.d.ts.map +1 -0
  50. package/esm/contracts.js +3 -0
  51. package/esm/device.d.ts +48 -0
  52. package/esm/device.d.ts.map +1 -0
  53. package/esm/device.js +288 -0
  54. package/esm/env.d.ts +2 -0
  55. package/esm/env.d.ts.map +1 -0
  56. package/esm/env.js +1 -0
  57. package/esm/errors/AuthError.d.ts +30 -0
  58. package/esm/errors/AuthError.d.ts.map +1 -0
  59. package/esm/errors/AuthError.js +76 -0
  60. package/esm/errors/KVError.d.ts.map +1 -0
  61. package/esm/errors/RemoteError.d.ts +53 -0
  62. package/esm/errors/RemoteError.d.ts.map +1 -0
  63. package/esm/errors/RemoteError.js +80 -0
  64. package/esm/errors/StoreError.d.ts.map +1 -0
  65. package/esm/errors/TransferError.d.ts.map +1 -0
  66. package/esm/errors/TrellisError.d.ts.map +1 -0
  67. package/esm/errors/ValidationError.d.ts.map +1 -0
  68. package/esm/errors/index.d.ts +178 -0
  69. package/esm/errors/index.d.ts.map +1 -0
  70. package/esm/errors/index.js +118 -0
  71. package/esm/globals.d.ts.map +1 -0
  72. package/esm/health.d.ts +5 -0
  73. package/esm/health.d.ts.map +1 -0
  74. package/esm/health.js +3 -0
  75. package/esm/helpers.d.ts +10 -0
  76. package/esm/helpers.d.ts.map +1 -0
  77. package/esm/helpers.js +38 -0
  78. package/esm/host/deno.d.ts +3 -0
  79. package/esm/host/deno.d.ts.map +1 -0
  80. package/esm/host/deno.js +2 -0
  81. package/esm/host/mod.d.ts +3 -0
  82. package/esm/host/mod.d.ts.map +1 -0
  83. package/esm/host/mod.js +2 -0
  84. package/esm/host/node.d.ts +3 -0
  85. package/esm/host/node.d.ts.map +1 -0
  86. package/esm/host/node.js +2 -0
  87. package/esm/index.d.ts +29 -0
  88. package/esm/index.d.ts.map +1 -0
  89. package/esm/index.js +15 -0
  90. package/esm/kv.d.ts.map +1 -0
  91. package/esm/models/trellis/TrellisError.d.ts +20 -0
  92. package/esm/models/trellis/TrellisError.d.ts.map +1 -0
  93. package/esm/models/trellis/TrellisError.js +15 -0
  94. package/esm/operations.d.ts +103 -0
  95. package/esm/operations.d.ts.map +1 -0
  96. package/esm/operations.js +229 -0
  97. package/esm/runtime_transport.d.ts +21 -0
  98. package/esm/runtime_transport.d.ts.map +1 -0
  99. package/esm/runtime_transport.js +50 -0
  100. package/esm/sdk/core.d.ts +3 -0
  101. package/esm/sdk/core.d.ts.map +1 -0
  102. package/esm/sdk/core.js +2 -0
  103. package/esm/server/deno.d.ts +1 -1
  104. package/esm/server/deno.d.ts.map +1 -1
  105. package/esm/server/health.d.ts +78 -9
  106. package/esm/server/health.d.ts.map +1 -1
  107. package/esm/server/health.js +196 -11
  108. package/esm/server/health_rpc.d.ts +2 -1
  109. package/esm/server/health_rpc.d.ts.map +1 -1
  110. package/esm/server/health_rpc.js +6 -4
  111. package/esm/server/health_schemas.d.ts +51 -0
  112. package/esm/server/health_schemas.d.ts.map +1 -1
  113. package/esm/server/health_schemas.js +39 -3
  114. package/esm/server/mod.d.ts +7 -10
  115. package/esm/server/mod.d.ts.map +1 -1
  116. package/esm/server/mod.js +6 -7
  117. package/esm/server/node.d.ts +1 -1
  118. package/esm/server/node.d.ts.map +1 -1
  119. package/esm/server/service.d.ts +65 -13
  120. package/esm/server/service.d.ts.map +1 -1
  121. package/esm/server/service.js +299 -54
  122. package/esm/server/transfer.d.ts +21 -5
  123. package/esm/server/transfer.d.ts.map +1 -1
  124. package/esm/server/transfer.js +210 -25
  125. package/esm/server.d.ts +40 -0
  126. package/esm/server.d.ts.map +1 -0
  127. package/esm/server.js +807 -0
  128. package/esm/server_logger.d.ts.map +1 -0
  129. package/esm/store.d.ts +60 -0
  130. package/esm/store.d.ts.map +1 -0
  131. package/esm/store.js +371 -0
  132. package/esm/tasks.d.ts.map +1 -0
  133. package/esm/tracing.d.ts +5 -0
  134. package/esm/tracing.d.ts.map +1 -0
  135. package/esm/tracing.js +7 -0
  136. package/esm/transfer.d.ts +114 -0
  137. package/esm/transfer.d.ts.map +1 -0
  138. package/esm/transfer.js +353 -0
  139. package/esm/trellis.d.ts +314 -0
  140. package/esm/trellis.d.ts.map +1 -0
  141. package/esm/trellis.js +1049 -0
  142. package/package.json +32 -55
  143. package/script/generated/js/sdks/trellis-core/api.d.ts.map +1 -0
  144. package/script/generated/js/sdks/trellis-core/api.js +42 -0
  145. package/script/generated/js/sdks/trellis-core/contract.d.ts +8 -0
  146. package/script/generated/js/sdks/trellis-core/contract.d.ts.map +1 -0
  147. package/script/generated/js/sdks/trellis-core/contract.js +62 -0
  148. package/script/generated/js/sdks/trellis-core/mod.d.ts +6 -0
  149. package/script/generated/js/sdks/trellis-core/mod.d.ts.map +1 -0
  150. package/script/generated/js/sdks/trellis-core/mod.js +29 -0
  151. package/script/generated/js/sdks/trellis-core/schemas.d.ts +1237 -0
  152. package/script/generated/js/sdks/trellis-core/schemas.d.ts.map +1 -0
  153. package/script/generated/js/sdks/trellis-core/schemas.js +32 -0
  154. package/script/generated/js/sdks/trellis-core/types.d.ts +198 -0
  155. package/script/generated/js/sdks/trellis-core/types.d.ts.map +1 -0
  156. package/script/generated/js/sdks/trellis-core/types.js +5 -0
  157. package/script/js/packages/trellis/auth/browser/login.d.ts +35 -0
  158. package/script/js/packages/trellis/auth/browser/login.d.ts.map +1 -0
  159. package/script/js/packages/trellis/auth/browser/login.js +117 -0
  160. package/script/js/packages/trellis/auth/browser/portal.d.ts.map +1 -0
  161. package/script/js/packages/trellis/auth/browser/portal.js +40 -0
  162. package/script/js/packages/trellis/auth/browser/session.d.ts.map +1 -0
  163. package/script/js/packages/trellis/auth/browser/session.js +79 -0
  164. package/script/js/packages/trellis/auth/browser/storage.d.ts.map +1 -0
  165. package/script/js/packages/trellis/auth/browser.d.ts +13 -0
  166. package/script/js/packages/trellis/auth/browser.d.ts.map +1 -0
  167. package/script/js/packages/trellis/auth/browser.js +52 -0
  168. package/script/js/packages/trellis/auth/device_activation.d.ts +206 -0
  169. package/script/js/packages/trellis/auth/device_activation.d.ts.map +1 -0
  170. package/script/js/packages/trellis/auth/device_activation.js +357 -0
  171. package/script/js/packages/trellis/auth/keys.d.ts.map +1 -0
  172. package/script/js/packages/trellis/auth/keys.js +56 -0
  173. package/script/js/packages/trellis/auth/mod.d.ts +18 -0
  174. package/script/js/packages/trellis/auth/mod.d.ts.map +1 -0
  175. package/script/js/packages/trellis/auth/mod.js +217 -0
  176. package/script/js/packages/trellis/auth/proof.d.ts.map +1 -0
  177. package/script/js/packages/trellis/auth/proof.js +48 -0
  178. package/script/js/packages/trellis/auth/protocol.d.ts +1580 -0
  179. package/script/js/packages/trellis/auth/protocol.d.ts.map +1 -0
  180. package/script/js/packages/trellis/auth/protocol.js +808 -0
  181. package/script/js/packages/trellis/auth/schemas.d.ts +158 -0
  182. package/script/js/packages/trellis/auth/schemas.d.ts.map +1 -0
  183. package/script/js/packages/trellis/auth/schemas.js +92 -0
  184. package/script/js/packages/trellis/auth/session_auth.d.ts +19 -0
  185. package/script/js/packages/trellis/auth/session_auth.d.ts.map +1 -0
  186. package/script/js/packages/trellis/auth/session_auth.js +59 -0
  187. package/script/js/packages/trellis/auth/trellis_id.d.ts.map +1 -0
  188. package/script/js/packages/trellis/auth/trellis_id.js +8 -0
  189. package/script/js/packages/trellis/auth/types.d.ts.map +1 -0
  190. package/script/js/packages/trellis/auth/utils.d.ts.map +1 -0
  191. package/script/js/packages/trellis/auth.d.ts +2 -0
  192. package/script/js/packages/trellis/auth.d.ts.map +1 -0
  193. package/script/js/packages/trellis/auth.js +17 -0
  194. package/script/js/packages/trellis/client.d.ts.map +1 -0
  195. package/script/js/packages/trellis/client.js +67 -0
  196. package/script/js/packages/trellis/client_connect.d.ts +53 -0
  197. package/script/js/packages/trellis/client_connect.d.ts.map +1 -0
  198. package/script/js/packages/trellis/client_connect.js +342 -0
  199. package/script/js/packages/trellis/codec.d.ts.map +1 -0
  200. package/script/js/packages/trellis/codec.js +80 -0
  201. package/script/js/packages/trellis/contract.d.ts +20 -0
  202. package/script/js/packages/trellis/contract.d.ts.map +1 -0
  203. package/script/js/packages/trellis/contract.js +9 -0
  204. package/script/js/packages/trellis/contract_support/canonical.d.ts.map +1 -0
  205. package/script/js/packages/trellis/contract_support/mod.d.ts +622 -0
  206. package/script/js/packages/trellis/contract_support/mod.d.ts.map +1 -0
  207. package/script/js/packages/trellis/contract_support/mod.js +1001 -0
  208. package/script/js/packages/trellis/contract_support/protocol.d.ts.map +1 -0
  209. package/script/js/packages/trellis/contract_support/protocol.js +151 -0
  210. package/script/js/packages/trellis/contract_support/runtime.d.ts +75 -0
  211. package/script/js/packages/trellis/contract_support/runtime.d.ts.map +1 -0
  212. package/script/js/packages/trellis/contract_support/schema_pointers.d.ts.map +1 -0
  213. package/script/js/packages/trellis/contracts.d.ts +4 -0
  214. package/script/js/packages/trellis/contracts.d.ts.map +1 -0
  215. package/script/js/packages/trellis/contracts.js +24 -0
  216. package/script/js/packages/trellis/device.d.ts +48 -0
  217. package/script/js/packages/trellis/device.d.ts.map +1 -0
  218. package/script/js/packages/trellis/device.js +292 -0
  219. package/script/js/packages/trellis/errors/AuthError.d.ts +30 -0
  220. package/script/js/packages/trellis/errors/AuthError.d.ts.map +1 -0
  221. package/script/js/packages/trellis/errors/AuthError.js +83 -0
  222. package/script/js/packages/trellis/errors/KVError.d.ts.map +1 -0
  223. package/script/js/packages/trellis/errors/KVError.js +53 -0
  224. package/script/js/packages/trellis/errors/RemoteError.d.ts +53 -0
  225. package/script/js/packages/trellis/errors/RemoteError.d.ts.map +1 -0
  226. package/script/js/packages/trellis/errors/RemoteError.js +87 -0
  227. package/script/js/packages/trellis/errors/StoreError.d.ts.map +1 -0
  228. package/script/js/packages/trellis/errors/StoreError.js +48 -0
  229. package/script/js/packages/trellis/errors/TransferError.d.ts.map +1 -0
  230. package/script/js/packages/trellis/errors/TransferError.js +48 -0
  231. package/script/js/packages/trellis/errors/TrellisError.d.ts +16 -0
  232. package/script/js/packages/trellis/errors/TrellisError.d.ts.map +1 -0
  233. package/script/js/packages/trellis/errors/TrellisError.js +19 -0
  234. package/script/js/packages/trellis/errors/ValidationError.d.ts.map +1 -0
  235. package/script/js/packages/trellis/errors/ValidationError.js +84 -0
  236. package/script/js/packages/trellis/errors/index.d.ts +177 -0
  237. package/script/js/packages/trellis/errors/index.d.ts.map +1 -0
  238. package/script/js/packages/trellis/errors/index.js +136 -0
  239. package/script/js/packages/trellis/globals.d.ts.map +1 -0
  240. package/script/js/packages/trellis/health.d.ts +4 -0
  241. package/script/js/packages/trellis/health.d.ts.map +1 -0
  242. package/script/js/packages/trellis/health.js +18 -0
  243. package/script/js/packages/trellis/helpers.d.ts +10 -0
  244. package/script/js/packages/trellis/helpers.d.ts.map +1 -0
  245. package/script/js/packages/trellis/helpers.js +44 -0
  246. package/script/js/packages/trellis/index.d.ts +28 -0
  247. package/script/js/packages/trellis/index.d.ts.map +1 -0
  248. package/script/js/packages/trellis/index.js +81 -0
  249. package/script/js/packages/trellis/kv.d.ts.map +1 -0
  250. package/script/js/packages/trellis/kv.js +383 -0
  251. package/script/js/packages/trellis/models/trellis/TrellisError.d.ts +20 -0
  252. package/script/js/packages/trellis/models/trellis/TrellisError.d.ts.map +1 -0
  253. package/script/js/packages/trellis/models/trellis/TrellisError.js +21 -0
  254. package/script/js/packages/trellis/npm/src/_dnt.polyfills.d.ts +18 -0
  255. package/script/js/packages/trellis/npm/src/_dnt.polyfills.d.ts.map +1 -0
  256. package/script/js/packages/trellis/npm/src/_dnt.shims.d.ts +5 -0
  257. package/script/js/packages/trellis/npm/src/_dnt.shims.d.ts.map +1 -0
  258. package/script/js/packages/trellis/npm/src/_dnt.shims.js +65 -0
  259. package/script/js/packages/trellis/npm/src/auth/browser/login.d.ts +35 -0
  260. package/script/js/packages/trellis/npm/src/auth/browser/login.d.ts.map +1 -0
  261. package/script/js/packages/trellis/npm/src/auth/browser/login.js +117 -0
  262. package/script/js/packages/trellis/npm/src/auth/browser/portal.d.ts +11 -0
  263. package/script/js/packages/trellis/npm/src/auth/browser/portal.d.ts.map +1 -0
  264. package/script/js/packages/trellis/npm/src/auth/browser/portal.js +40 -0
  265. package/script/js/packages/trellis/npm/src/auth/browser/session.d.ts +19 -0
  266. package/script/js/packages/trellis/npm/src/auth/browser/session.d.ts.map +1 -0
  267. package/script/js/packages/trellis/npm/src/auth/browser/session.js +79 -0
  268. package/script/js/packages/trellis/npm/src/auth/browser/storage.d.ts +12 -0
  269. package/script/js/packages/trellis/npm/src/auth/browser/storage.d.ts.map +1 -0
  270. package/script/js/packages/trellis/npm/src/auth/browser/storage.js +67 -0
  271. package/script/js/packages/trellis/npm/src/auth/browser.d.ts +14 -0
  272. package/script/js/packages/trellis/npm/src/auth/browser.d.ts.map +1 -0
  273. package/script/js/packages/trellis/npm/src/auth/browser.js +53 -0
  274. package/script/js/packages/trellis/npm/src/auth/device_activation.d.ts +206 -0
  275. package/script/js/packages/trellis/npm/src/auth/device_activation.d.ts.map +1 -0
  276. package/script/js/packages/trellis/npm/src/auth/device_activation.js +357 -0
  277. package/script/js/packages/trellis/npm/src/auth/keys.d.ts +5 -0
  278. package/script/js/packages/trellis/npm/src/auth/keys.d.ts.map +1 -0
  279. package/script/js/packages/trellis/npm/src/auth/keys.js +56 -0
  280. package/script/js/packages/trellis/npm/src/auth/mod.d.ts +18 -0
  281. package/script/js/packages/trellis/npm/src/auth/mod.d.ts.map +1 -0
  282. package/script/js/packages/trellis/npm/src/auth/mod.js +217 -0
  283. package/script/js/packages/trellis/npm/src/auth/proof.d.ts +9 -0
  284. package/script/js/packages/trellis/npm/src/auth/proof.d.ts.map +1 -0
  285. package/script/js/packages/trellis/npm/src/auth/proof.js +48 -0
  286. package/script/js/packages/trellis/npm/src/auth/protocol.d.ts +1580 -0
  287. package/script/js/packages/trellis/npm/src/auth/protocol.d.ts.map +1 -0
  288. package/script/js/packages/trellis/npm/src/auth/protocol.js +808 -0
  289. package/script/js/packages/trellis/npm/src/auth/schemas.d.ts +158 -0
  290. package/script/js/packages/trellis/npm/src/auth/schemas.d.ts.map +1 -0
  291. package/script/js/packages/trellis/npm/src/auth/schemas.js +92 -0
  292. package/script/js/packages/trellis/npm/src/auth/session_auth.d.ts +19 -0
  293. package/script/js/packages/trellis/npm/src/auth/session_auth.d.ts.map +1 -0
  294. package/script/js/packages/trellis/npm/src/auth/session_auth.js +59 -0
  295. package/script/js/packages/trellis/npm/src/auth/trellis_id.d.ts +2 -0
  296. package/script/js/packages/trellis/npm/src/auth/trellis_id.d.ts.map +1 -0
  297. package/script/js/packages/trellis/npm/src/auth/trellis_id.js +8 -0
  298. package/script/js/packages/trellis/npm/src/auth/types.d.ts +8 -0
  299. package/script/js/packages/trellis/npm/src/auth/types.d.ts.map +1 -0
  300. package/script/js/packages/trellis/npm/src/auth/types.js +2 -0
  301. package/script/js/packages/trellis/npm/src/auth/utils.d.ts +11 -0
  302. package/script/js/packages/trellis/npm/src/auth/utils.d.ts.map +1 -0
  303. package/script/js/packages/trellis/npm/src/auth/utils.js +77 -0
  304. package/script/js/packages/trellis/npm/src/auth.d.ts +3 -0
  305. package/script/js/packages/trellis/npm/src/auth.d.ts.map +1 -0
  306. package/script/js/packages/trellis/npm/src/auth.js +18 -0
  307. package/script/js/packages/trellis/npm/src/browser.d.ts +6 -0
  308. package/script/js/packages/trellis/npm/src/browser.d.ts.map +1 -0
  309. package/script/js/packages/trellis/npm/src/browser.js +21 -0
  310. package/script/js/packages/trellis/npm/src/client.d.ts +33 -0
  311. package/script/js/packages/trellis/npm/src/client.d.ts.map +1 -0
  312. package/script/js/packages/trellis/npm/src/client.js +67 -0
  313. package/script/js/packages/trellis/npm/src/client_connect.d.ts +53 -0
  314. package/script/js/packages/trellis/npm/src/client_connect.d.ts.map +1 -0
  315. package/script/js/packages/trellis/npm/src/client_connect.js +366 -0
  316. package/script/js/packages/trellis/npm/src/codec.d.ts +13 -0
  317. package/script/js/packages/trellis/npm/src/codec.d.ts.map +1 -0
  318. package/script/js/packages/trellis/npm/src/codec.js +80 -0
  319. package/script/js/packages/trellis/npm/src/contract.d.ts +20 -0
  320. package/script/js/packages/trellis/npm/src/contract.d.ts.map +1 -0
  321. package/script/js/packages/trellis/npm/src/contract.js +9 -0
  322. package/script/js/packages/trellis/npm/src/contract_support/canonical.d.ts +14 -0
  323. package/script/js/packages/trellis/npm/src/contract_support/canonical.d.ts.map +1 -0
  324. package/script/js/packages/trellis/npm/src/contract_support/canonical.js +144 -0
  325. package/script/js/packages/trellis/npm/src/contract_support/mod.d.ts +622 -0
  326. package/script/js/packages/trellis/npm/src/contract_support/mod.d.ts.map +1 -0
  327. package/script/js/packages/trellis/npm/src/contract_support/mod.js +1001 -0
  328. package/script/js/packages/trellis/npm/src/contract_support/protocol.d.ts +335 -0
  329. package/script/js/packages/trellis/npm/src/contract_support/protocol.d.ts.map +1 -0
  330. package/script/js/packages/trellis/npm/src/contract_support/protocol.js +151 -0
  331. package/script/js/packages/trellis/npm/src/contract_support/runtime.d.ts +75 -0
  332. package/script/js/packages/trellis/npm/src/contract_support/runtime.d.ts.map +1 -0
  333. package/script/js/packages/trellis/npm/src/contract_support/runtime.js +13 -0
  334. package/script/js/packages/trellis/npm/src/contract_support/schema_pointers.d.ts +18 -0
  335. package/script/js/packages/trellis/npm/src/contract_support/schema_pointers.d.ts.map +1 -0
  336. package/script/js/packages/trellis/npm/src/contract_support/schema_pointers.js +63 -0
  337. package/script/js/packages/trellis/npm/src/contracts.d.ts +5 -0
  338. package/script/js/packages/trellis/npm/src/contracts.d.ts.map +1 -0
  339. package/script/js/packages/trellis/npm/src/contracts.js +25 -0
  340. package/script/js/packages/trellis/npm/src/device.d.ts +48 -0
  341. package/script/js/packages/trellis/npm/src/device.d.ts.map +1 -0
  342. package/script/js/packages/trellis/npm/src/device.js +292 -0
  343. package/script/js/packages/trellis/npm/src/env.d.ts +2 -0
  344. package/script/js/packages/trellis/npm/src/env.d.ts.map +1 -0
  345. package/script/js/packages/trellis/npm/src/env.js +5 -0
  346. package/script/js/packages/trellis/npm/src/errors/AuthError.d.ts +30 -0
  347. package/script/js/packages/trellis/npm/src/errors/AuthError.d.ts.map +1 -0
  348. package/script/js/packages/trellis/npm/src/errors/AuthError.js +83 -0
  349. package/script/js/packages/trellis/npm/src/errors/KVError.d.ts +31 -0
  350. package/script/js/packages/trellis/npm/src/errors/KVError.d.ts.map +1 -0
  351. package/script/js/packages/trellis/npm/src/errors/KVError.js +53 -0
  352. package/script/js/packages/trellis/npm/src/errors/RemoteError.d.ts +53 -0
  353. package/script/js/packages/trellis/npm/src/errors/RemoteError.d.ts.map +1 -0
  354. package/script/js/packages/trellis/npm/src/errors/RemoteError.js +87 -0
  355. package/script/js/packages/trellis/npm/src/errors/StoreError.d.ts +22 -0
  356. package/script/js/packages/trellis/npm/src/errors/StoreError.d.ts.map +1 -0
  357. package/script/js/packages/trellis/npm/src/errors/StoreError.js +48 -0
  358. package/script/js/packages/trellis/npm/src/errors/TransferError.d.ts +22 -0
  359. package/script/js/packages/trellis/npm/src/errors/TransferError.d.ts.map +1 -0
  360. package/script/js/packages/trellis/npm/src/errors/TransferError.js +48 -0
  361. package/script/js/packages/trellis/npm/src/errors/TrellisError.d.ts +16 -0
  362. package/script/js/packages/trellis/npm/src/errors/TrellisError.d.ts.map +1 -0
  363. package/script/js/packages/trellis/npm/src/errors/TrellisError.js +19 -0
  364. package/script/js/packages/trellis/npm/src/errors/ValidationError.d.ts +51 -0
  365. package/script/js/packages/trellis/npm/src/errors/ValidationError.d.ts.map +1 -0
  366. package/script/js/packages/trellis/npm/src/errors/ValidationError.js +84 -0
  367. package/script/js/packages/trellis/npm/src/errors/index.d.ts +178 -0
  368. package/script/js/packages/trellis/npm/src/errors/index.d.ts.map +1 -0
  369. package/script/js/packages/trellis/npm/src/errors/index.js +137 -0
  370. package/script/js/packages/trellis/npm/src/globals.d.ts +10 -0
  371. package/script/js/packages/trellis/npm/src/globals.d.ts.map +1 -0
  372. package/script/js/packages/trellis/npm/src/globals.js +19 -0
  373. package/script/js/packages/trellis/npm/src/health.d.ts +5 -0
  374. package/script/js/packages/trellis/npm/src/health.d.ts.map +1 -0
  375. package/script/js/packages/trellis/npm/src/health.js +19 -0
  376. package/script/js/packages/trellis/npm/src/helpers.d.ts +10 -0
  377. package/script/js/packages/trellis/npm/src/helpers.d.ts.map +1 -0
  378. package/script/js/packages/trellis/npm/src/helpers.js +44 -0
  379. package/script/js/packages/trellis/npm/src/host/deno.d.ts +3 -0
  380. package/script/js/packages/trellis/npm/src/host/deno.d.ts.map +1 -0
  381. package/script/js/packages/trellis/npm/src/host/deno.js +18 -0
  382. package/script/js/packages/trellis/npm/src/host/mod.d.ts +3 -0
  383. package/script/js/packages/trellis/npm/src/host/mod.d.ts.map +1 -0
  384. package/script/js/packages/trellis/npm/src/host/mod.js +18 -0
  385. package/script/js/packages/trellis/npm/src/host/node.d.ts +3 -0
  386. package/script/js/packages/trellis/npm/src/host/node.d.ts.map +1 -0
  387. package/script/js/packages/trellis/npm/src/host/node.js +18 -0
  388. package/script/js/packages/trellis/npm/src/index.d.ts +29 -0
  389. package/script/js/packages/trellis/npm/src/index.d.ts.map +1 -0
  390. package/script/js/packages/trellis/npm/src/index.js +82 -0
  391. package/script/js/packages/trellis/npm/src/kv.d.ts +72 -0
  392. package/script/js/packages/trellis/npm/src/kv.d.ts.map +1 -0
  393. package/script/js/packages/trellis/npm/src/kv.js +383 -0
  394. package/script/js/packages/trellis/npm/src/models/trellis/TrellisError.d.ts +20 -0
  395. package/script/js/packages/trellis/npm/src/models/trellis/TrellisError.d.ts.map +1 -0
  396. package/script/js/packages/trellis/npm/src/models/trellis/TrellisError.js +21 -0
  397. package/script/js/packages/trellis/npm/src/operations.d.ts +103 -0
  398. package/script/js/packages/trellis/npm/src/operations.d.ts.map +1 -0
  399. package/script/js/packages/trellis/npm/src/operations.js +235 -0
  400. package/script/js/packages/trellis/npm/src/runtime_transport.d.ts +21 -0
  401. package/script/js/packages/trellis/npm/src/runtime_transport.d.ts.map +1 -0
  402. package/script/js/packages/trellis/npm/src/runtime_transport.js +77 -0
  403. package/script/js/packages/trellis/npm/src/sdk/core.d.ts +3 -0
  404. package/script/js/packages/trellis/npm/src/sdk/core.d.ts.map +1 -0
  405. package/script/js/packages/trellis/npm/src/sdk/core.js +20 -0
  406. package/script/js/packages/trellis/npm/src/server/deno.d.ts +2 -0
  407. package/script/js/packages/trellis/npm/src/server/deno.d.ts.map +1 -0
  408. package/script/js/packages/trellis/npm/src/server/deno.js +6 -0
  409. package/script/js/packages/trellis/npm/src/server/health.d.ts +161 -0
  410. package/script/js/packages/trellis/npm/src/server/health.d.ts.map +1 -0
  411. package/script/js/packages/trellis/npm/src/server/health.js +291 -0
  412. package/script/js/packages/trellis/npm/src/server/health_rpc.d.ts +17 -0
  413. package/script/js/packages/trellis/npm/src/server/health_rpc.d.ts.map +1 -0
  414. package/script/js/packages/trellis/npm/src/server/health_rpc.js +28 -0
  415. package/script/js/packages/trellis/npm/src/server/health_schemas.d.ts +71 -0
  416. package/script/js/packages/trellis/npm/src/server/health_schemas.d.ts.map +1 -0
  417. package/script/js/packages/trellis/npm/src/server/health_schemas.js +57 -0
  418. package/script/js/packages/trellis/npm/src/server/mod.d.ts +15 -0
  419. package/script/js/packages/trellis/npm/src/server/mod.d.ts.map +1 -0
  420. package/script/js/packages/trellis/npm/src/server/mod.js +39 -0
  421. package/script/js/packages/trellis/npm/src/server/node.d.ts +2 -0
  422. package/script/js/packages/trellis/npm/src/server/node.d.ts.map +1 -0
  423. package/script/js/packages/trellis/npm/src/server/node.js +6 -0
  424. package/script/js/packages/trellis/npm/src/server/runtime.d.ts +16 -0
  425. package/script/js/packages/trellis/npm/src/server/runtime.d.ts.map +1 -0
  426. package/script/js/packages/trellis/npm/src/server/runtime.js +2 -0
  427. package/script/js/packages/trellis/npm/src/server/service.d.ts +205 -0
  428. package/script/js/packages/trellis/npm/src/server/service.d.ts.map +1 -0
  429. package/script/js/packages/trellis/npm/src/server/service.js +654 -0
  430. package/script/js/packages/trellis/npm/src/server/subscription.d.ts +99 -0
  431. package/script/js/packages/trellis/npm/src/server/subscription.d.ts.map +1 -0
  432. package/script/js/packages/trellis/npm/src/server/subscription.js +29 -0
  433. package/script/js/packages/trellis/npm/src/server/transfer.d.ts +57 -0
  434. package/script/js/packages/trellis/npm/src/server/transfer.d.ts.map +1 -0
  435. package/script/js/packages/trellis/npm/src/server/transfer.js +607 -0
  436. package/script/js/packages/trellis/npm/src/server.d.ts +40 -0
  437. package/script/js/packages/trellis/npm/src/server.d.ts.map +1 -0
  438. package/script/js/packages/trellis/npm/src/server.js +811 -0
  439. package/script/js/packages/trellis/npm/src/server_logger.d.ts +3 -0
  440. package/script/js/packages/trellis/npm/src/server_logger.d.ts.map +1 -0
  441. package/script/js/packages/trellis/npm/src/server_logger.js +10 -0
  442. package/script/js/packages/trellis/npm/src/store.d.ts +60 -0
  443. package/script/js/packages/trellis/npm/src/store.d.ts.map +1 -0
  444. package/script/js/packages/trellis/npm/src/store.js +377 -0
  445. package/script/js/packages/trellis/npm/src/tasks.d.ts +11 -0
  446. package/script/js/packages/trellis/npm/src/tasks.d.ts.map +1 -0
  447. package/script/js/packages/trellis/npm/src/tasks.js +45 -0
  448. package/script/js/packages/trellis/npm/src/telemetry/carrier.d.ts.map +1 -0
  449. package/script/js/packages/trellis/npm/src/telemetry/core.d.ts.map +1 -0
  450. package/script/js/packages/trellis/npm/src/telemetry/env.d.ts.map +1 -0
  451. package/script/js/packages/trellis/npm/src/telemetry/env.js +36 -0
  452. package/script/js/packages/trellis/npm/src/telemetry/init.d.ts +4 -0
  453. package/script/js/packages/trellis/npm/src/telemetry/init.d.ts.map +1 -0
  454. package/script/js/packages/trellis/npm/src/telemetry/init.js +11 -0
  455. package/script/js/packages/trellis/npm/src/telemetry/mod.d.ts +10 -0
  456. package/script/js/packages/trellis/npm/src/telemetry/mod.d.ts.map +1 -0
  457. package/script/js/packages/trellis/npm/src/telemetry/mod.js +26 -0
  458. package/script/js/packages/trellis/npm/src/telemetry/nats.d.ts +7 -0
  459. package/script/js/packages/trellis/npm/src/telemetry/nats.d.ts.map +1 -0
  460. package/script/js/packages/trellis/npm/src/telemetry/result.d.ts.map +1 -0
  461. package/script/js/packages/trellis/npm/src/telemetry/runtime.d.ts.map +1 -0
  462. package/script/js/packages/trellis/npm/src/telemetry/runtime.js +60 -0
  463. package/script/js/packages/trellis/npm/src/telemetry/trace.d.ts.map +1 -0
  464. package/script/js/packages/trellis/npm/src/telemetry/trace.js +31 -0
  465. package/script/js/packages/trellis/npm/src/telemetry/trellis.d.ts +2 -0
  466. package/script/js/packages/trellis/npm/src/telemetry/trellis.d.ts.map +1 -0
  467. package/script/js/packages/trellis/npm/src/telemetry/trellis.js +7 -0
  468. package/script/js/packages/trellis/npm/src/tracing.d.ts +5 -0
  469. package/script/js/packages/trellis/npm/src/tracing.d.ts.map +1 -0
  470. package/script/js/packages/trellis/npm/src/tracing.js +49 -0
  471. package/script/js/packages/trellis/npm/src/transfer.d.ts +114 -0
  472. package/script/js/packages/trellis/npm/src/transfer.d.ts.map +1 -0
  473. package/script/js/packages/trellis/npm/src/transfer.js +363 -0
  474. package/script/js/packages/trellis/npm/src/trellis.d.ts +314 -0
  475. package/script/js/packages/trellis/npm/src/trellis.d.ts.map +1 -0
  476. package/script/js/packages/trellis/npm/src/trellis.js +1062 -0
  477. package/script/js/packages/trellis/operations.d.ts +103 -0
  478. package/script/js/packages/trellis/operations.d.ts.map +1 -0
  479. package/script/js/packages/trellis/operations.js +235 -0
  480. package/script/js/packages/trellis/runtime_transport.d.ts +21 -0
  481. package/script/js/packages/trellis/runtime_transport.d.ts.map +1 -0
  482. package/script/js/packages/trellis/runtime_transport.js +53 -0
  483. package/script/js/packages/trellis/sdk/core.d.ts +3 -0
  484. package/script/js/packages/trellis/sdk/core.d.ts.map +1 -0
  485. package/script/js/packages/trellis/sdk/core.js +20 -0
  486. package/script/js/packages/trellis/server/health.d.ts +170 -0
  487. package/script/js/packages/trellis/server/health.d.ts.map +1 -0
  488. package/script/js/packages/trellis/server/health.js +267 -0
  489. package/script/js/packages/trellis/server/health_schemas.d.ts +71 -0
  490. package/script/js/packages/trellis/server/health_schemas.d.ts.map +1 -0
  491. package/script/js/packages/trellis/server/health_schemas.js +57 -0
  492. package/script/js/packages/trellis/store.d.ts +60 -0
  493. package/script/js/packages/trellis/store.d.ts.map +1 -0
  494. package/script/js/packages/trellis/store.js +377 -0
  495. package/script/js/packages/trellis/tasks.d.ts.map +1 -0
  496. package/script/js/packages/trellis/tasks.js +45 -0
  497. package/script/js/packages/trellis/telemetry/carrier.d.ts +9 -0
  498. package/script/js/packages/trellis/telemetry/carrier.d.ts.map +1 -0
  499. package/script/js/packages/trellis/telemetry/carrier.js +25 -0
  500. package/script/js/packages/trellis/telemetry/core.d.ts +8 -0
  501. package/script/js/packages/trellis/telemetry/core.d.ts.map +1 -0
  502. package/script/js/packages/trellis/telemetry/core.js +24 -0
  503. package/script/js/packages/trellis/telemetry/env.d.ts +2 -0
  504. package/script/js/packages/trellis/telemetry/env.d.ts.map +1 -0
  505. package/script/js/packages/trellis/telemetry/init.d.ts.map +1 -0
  506. package/script/js/packages/trellis/telemetry/init.js +11 -0
  507. package/script/js/packages/trellis/telemetry/mod.d.ts.map +1 -0
  508. package/script/js/packages/trellis/telemetry/mod.js +26 -0
  509. package/script/js/packages/trellis/telemetry/nats.d.ts.map +1 -0
  510. package/script/js/packages/trellis/telemetry/nats.js +9 -0
  511. package/script/js/packages/trellis/telemetry/result.d.ts +2 -0
  512. package/script/js/packages/trellis/telemetry/result.d.ts.map +1 -0
  513. package/script/js/packages/trellis/telemetry/result.js +21 -0
  514. package/script/js/packages/trellis/telemetry/runtime.d.ts +2 -0
  515. package/script/js/packages/trellis/telemetry/runtime.d.ts.map +1 -0
  516. package/script/js/packages/trellis/telemetry/runtime.js +60 -0
  517. package/script/js/packages/trellis/telemetry/trace.d.ts +5 -0
  518. package/script/js/packages/trellis/telemetry/trace.d.ts.map +1 -0
  519. package/script/js/packages/trellis/telemetry/trace.js +31 -0
  520. package/script/js/packages/trellis/telemetry/trellis.d.ts.map +1 -0
  521. package/script/js/packages/trellis/telemetry/trellis.js +7 -0
  522. package/script/js/packages/trellis/tracing.d.ts +4 -0
  523. package/script/js/packages/trellis/tracing.d.ts.map +1 -0
  524. package/script/js/packages/trellis/tracing.js +46 -0
  525. package/script/js/packages/trellis/transfer.d.ts +114 -0
  526. package/script/js/packages/trellis/transfer.d.ts.map +1 -0
  527. package/script/js/packages/trellis/transfer.js +363 -0
  528. package/script/js/packages/trellis/trellis.d.ts +314 -0
  529. package/script/js/packages/trellis/trellis.d.ts.map +1 -0
  530. package/script/js/packages/trellis/trellis.js +1062 -0
  531. package/esm/contracts/canonical.d.ts.map +0 -1
  532. package/esm/contracts/mod.d.ts +0 -482
  533. package/esm/contracts/mod.d.ts.map +0 -1
  534. package/esm/contracts/mod.js +0 -558
  535. package/esm/contracts/protocol.d.ts.map +0 -1
  536. package/esm/contracts/protocol.js +0 -145
  537. package/esm/contracts/runtime.d.ts +0 -48
  538. package/esm/contracts/runtime.d.ts.map +0 -1
  539. package/esm/contracts/schema_pointers.d.ts.map +0 -1
  540. package/esm/trellis/_sdk/activity/_dnt.polyfills.d.ts +0 -12
  541. package/esm/trellis/_sdk/activity/_dnt.polyfills.d.ts.map +0 -1
  542. package/esm/trellis/_sdk/activity/_dnt.polyfills.js +0 -15
  543. package/esm/trellis/_sdk/activity/api.d.ts.map +0 -1
  544. package/esm/trellis/_sdk/activity/api.js +0 -43
  545. package/esm/trellis/_sdk/activity/contract.d.ts +0 -8
  546. package/esm/trellis/_sdk/activity/contract.d.ts.map +0 -1
  547. package/esm/trellis/_sdk/activity/contract.js +0 -59
  548. package/esm/trellis/_sdk/activity/mod.d.ts +0 -7
  549. package/esm/trellis/_sdk/activity/mod.d.ts.map +0 -1
  550. package/esm/trellis/_sdk/activity/mod.js +0 -5
  551. package/esm/trellis/_sdk/activity/package.json +0 -3
  552. package/esm/trellis/_sdk/activity/schemas.d.ts +0 -607
  553. package/esm/trellis/_sdk/activity/schemas.d.ts.map +0 -1
  554. package/esm/trellis/_sdk/activity/schemas.js +0 -33
  555. package/esm/trellis/_sdk/activity/types.d.ts +0 -96
  556. package/esm/trellis/_sdk/activity/types.d.ts.map +0 -1
  557. package/esm/trellis/_sdk/activity/types.js +0 -3
  558. package/esm/trellis/_sdk/auth/_dnt.polyfills.d.ts +0 -12
  559. package/esm/trellis/_sdk/auth/_dnt.polyfills.d.ts.map +0 -1
  560. package/esm/trellis/_sdk/auth/_dnt.polyfills.js +0 -15
  561. package/esm/trellis/_sdk/auth/api.d.ts +0 -10
  562. package/esm/trellis/_sdk/auth/api.d.ts.map +0 -1
  563. package/esm/trellis/_sdk/auth/api.js +0 -376
  564. package/esm/trellis/_sdk/auth/contract.d.ts +0 -28
  565. package/esm/trellis/_sdk/auth/contract.d.ts.map +0 -1
  566. package/esm/trellis/_sdk/auth/contract.js +0 -83
  567. package/esm/trellis/_sdk/auth/mod.d.ts +0 -7
  568. package/esm/trellis/_sdk/auth/mod.d.ts.map +0 -1
  569. package/esm/trellis/_sdk/auth/mod.js +0 -5
  570. package/esm/trellis/_sdk/auth/package.json +0 -3
  571. package/esm/trellis/_sdk/auth/schemas.d.ts +0 -10110
  572. package/esm/trellis/_sdk/auth/schemas.d.ts.map +0 -1
  573. package/esm/trellis/_sdk/auth/schemas.js +0 -325
  574. package/esm/trellis/_sdk/auth/types.d.ts +0 -1382
  575. package/esm/trellis/_sdk/auth/types.d.ts.map +0 -1
  576. package/esm/trellis/_sdk/auth/types.js +0 -3
  577. package/esm/trellis/_sdk/core/_dnt.polyfills.d.ts +0 -12
  578. package/esm/trellis/_sdk/core/_dnt.polyfills.d.ts.map +0 -1
  579. package/esm/trellis/_sdk/core/_dnt.polyfills.js +0 -15
  580. package/esm/trellis/_sdk/core/api.d.ts +0 -10
  581. package/esm/trellis/_sdk/core/api.d.ts.map +0 -1
  582. package/esm/trellis/_sdk/core/api.js +0 -36
  583. package/esm/trellis/_sdk/core/contract.d.ts +0 -8
  584. package/esm/trellis/_sdk/core/contract.d.ts.map +0 -1
  585. package/esm/trellis/_sdk/core/contract.js +0 -59
  586. package/esm/trellis/_sdk/core/mod.d.ts +0 -7
  587. package/esm/trellis/_sdk/core/mod.d.ts.map +0 -1
  588. package/esm/trellis/_sdk/core/mod.js +0 -5
  589. package/esm/trellis/_sdk/core/package.json +0 -3
  590. package/esm/trellis/_sdk/core/schemas.d.ts +0 -1266
  591. package/esm/trellis/_sdk/core/schemas.d.ts.map +0 -1
  592. package/esm/trellis/_sdk/core/schemas.js +0 -28
  593. package/esm/trellis/_sdk/core/types.d.ts +0 -193
  594. package/esm/trellis/_sdk/core/types.d.ts.map +0 -1
  595. package/esm/trellis/_sdk/core/types.js +0 -3
  596. package/esm/trellis/_sdk/state/_dnt.polyfills.d.ts +0 -12
  597. package/esm/trellis/_sdk/state/_dnt.polyfills.d.ts.map +0 -1
  598. package/esm/trellis/_sdk/state/_dnt.polyfills.js +0 -15
  599. package/esm/trellis/_sdk/state/api.d.ts +0 -10
  600. package/esm/trellis/_sdk/state/api.d.ts.map +0 -1
  601. package/esm/trellis/_sdk/state/api.js +0 -71
  602. package/esm/trellis/_sdk/state/contract.d.ts +0 -8
  603. package/esm/trellis/_sdk/state/contract.d.ts.map +0 -1
  604. package/esm/trellis/_sdk/state/contract.js +0 -59
  605. package/esm/trellis/_sdk/state/mod.d.ts +0 -7
  606. package/esm/trellis/_sdk/state/mod.d.ts.map +0 -1
  607. package/esm/trellis/_sdk/state/mod.js +0 -5
  608. package/esm/trellis/_sdk/state/package.json +0 -3
  609. package/esm/trellis/_sdk/state/schemas.d.ts +0 -1437
  610. package/esm/trellis/_sdk/state/schemas.d.ts.map +0 -1
  611. package/esm/trellis/_sdk/state/schemas.js +0 -62
  612. package/esm/trellis/_sdk/state/types.d.ts +0 -206
  613. package/esm/trellis/_sdk/state/types.d.ts.map +0 -1
  614. package/esm/trellis/_sdk/state/types.js +0 -3
  615. package/esm/trellis/auth/browser.d.ts +0 -3
  616. package/esm/trellis/auth/browser.d.ts.map +0 -1
  617. package/esm/trellis/auth/browser.js +0 -2
  618. package/esm/trellis/auth.d.ts +0 -3
  619. package/esm/trellis/auth.d.ts.map +0 -1
  620. package/esm/trellis/auth.js +0 -2
  621. package/esm/trellis/browser.d.ts +0 -6
  622. package/esm/trellis/browser.d.ts.map +0 -1
  623. package/esm/trellis/browser.js +0 -5
  624. package/esm/trellis/client.d.ts.map +0 -1
  625. package/esm/trellis/client_connect.d.ts +0 -53
  626. package/esm/trellis/client_connect.d.ts.map +0 -1
  627. package/esm/trellis/client_connect.js +0 -300
  628. package/esm/trellis/codec.d.ts.map +0 -1
  629. package/esm/trellis/contract.d.ts +0 -20
  630. package/esm/trellis/contract.d.ts.map +0 -1
  631. package/esm/trellis/contract.js +0 -4
  632. package/esm/trellis/contracts.d.ts +0 -5
  633. package/esm/trellis/contracts.d.ts.map +0 -1
  634. package/esm/trellis/contracts.js +0 -3
  635. package/esm/trellis/device.d.ts +0 -41
  636. package/esm/trellis/device.d.ts.map +0 -1
  637. package/esm/trellis/device.js +0 -209
  638. package/esm/trellis/env.d.ts +0 -2
  639. package/esm/trellis/env.d.ts.map +0 -1
  640. package/esm/trellis/env.js +0 -1
  641. package/esm/trellis/errors/AuthError.d.ts +0 -30
  642. package/esm/trellis/errors/AuthError.d.ts.map +0 -1
  643. package/esm/trellis/errors/AuthError.js +0 -76
  644. package/esm/trellis/errors/KVError.d.ts.map +0 -1
  645. package/esm/trellis/errors/RemoteError.d.ts +0 -47
  646. package/esm/trellis/errors/RemoteError.d.ts.map +0 -1
  647. package/esm/trellis/errors/RemoteError.js +0 -80
  648. package/esm/trellis/errors/StoreError.d.ts.map +0 -1
  649. package/esm/trellis/errors/TransferError.d.ts.map +0 -1
  650. package/esm/trellis/errors/TrellisError.d.ts.map +0 -1
  651. package/esm/trellis/errors/ValidationError.d.ts.map +0 -1
  652. package/esm/trellis/errors/index.d.ts +0 -47
  653. package/esm/trellis/errors/index.d.ts.map +0 -1
  654. package/esm/trellis/errors/index.js +0 -35
  655. package/esm/trellis/globals.d.ts.map +0 -1
  656. package/esm/trellis/helpers.d.ts +0 -13
  657. package/esm/trellis/helpers.d.ts.map +0 -1
  658. package/esm/trellis/helpers.js +0 -48
  659. package/esm/trellis/index.d.ts +0 -25
  660. package/esm/trellis/index.d.ts.map +0 -1
  661. package/esm/trellis/index.js +0 -13
  662. package/esm/trellis/kv.d.ts.map +0 -1
  663. package/esm/trellis/models/trellis/TrellisError.d.ts +0 -57
  664. package/esm/trellis/models/trellis/TrellisError.d.ts.map +0 -1
  665. package/esm/trellis/models/trellis/TrellisError.js +0 -20
  666. package/esm/trellis/operations.d.ts +0 -81
  667. package/esm/trellis/operations.d.ts.map +0 -1
  668. package/esm/trellis/operations.js +0 -206
  669. package/esm/trellis/runtime_transport.d.ts +0 -12
  670. package/esm/trellis/runtime_transport.d.ts.map +0 -1
  671. package/esm/trellis/runtime_transport.js +0 -35
  672. package/esm/trellis/sdk/activity.d.ts +0 -3
  673. package/esm/trellis/sdk/activity.d.ts.map +0 -1
  674. package/esm/trellis/sdk/activity.js +0 -2
  675. package/esm/trellis/sdk/auth.d.ts +0 -4
  676. package/esm/trellis/sdk/auth.d.ts.map +0 -1
  677. package/esm/trellis/sdk/auth.js +0 -3
  678. package/esm/trellis/sdk/core.d.ts +0 -4
  679. package/esm/trellis/sdk/core.d.ts.map +0 -1
  680. package/esm/trellis/sdk/core.js +0 -3
  681. package/esm/trellis/sdk/state.d.ts +0 -4
  682. package/esm/trellis/sdk/state.d.ts.map +0 -1
  683. package/esm/trellis/sdk/state.js +0 -3
  684. package/esm/trellis/server/deno.d.ts +0 -3
  685. package/esm/trellis/server/deno.d.ts.map +0 -1
  686. package/esm/trellis/server/deno.js +0 -2
  687. package/esm/trellis/server/health.d.ts +0 -5
  688. package/esm/trellis/server/health.d.ts.map +0 -1
  689. package/esm/trellis/server/health.js +0 -3
  690. package/esm/trellis/server/mod.d.ts +0 -3
  691. package/esm/trellis/server/mod.d.ts.map +0 -1
  692. package/esm/trellis/server/mod.js +0 -2
  693. package/esm/trellis/server/node.d.ts +0 -3
  694. package/esm/trellis/server/node.d.ts.map +0 -1
  695. package/esm/trellis/server/node.js +0 -2
  696. package/esm/trellis/server/runtime.d.ts +0 -4
  697. package/esm/trellis/server/runtime.d.ts.map +0 -1
  698. package/esm/trellis/server/runtime.js +0 -2
  699. package/esm/trellis/server.d.ts +0 -21
  700. package/esm/trellis/server.d.ts.map +0 -1
  701. package/esm/trellis/server.js +0 -536
  702. package/esm/trellis/server_logger.d.ts.map +0 -1
  703. package/esm/trellis/store.d.ts +0 -51
  704. package/esm/trellis/store.d.ts.map +0 -1
  705. package/esm/trellis/store.js +0 -310
  706. package/esm/trellis/tasks.d.ts.map +0 -1
  707. package/esm/trellis/tracing.d.ts +0 -5
  708. package/esm/trellis/tracing.d.ts.map +0 -1
  709. package/esm/trellis/tracing.js +0 -7
  710. package/esm/trellis/transfer.d.ts +0 -118
  711. package/esm/trellis/transfer.d.ts.map +0 -1
  712. package/esm/trellis/transfer.js +0 -357
  713. package/esm/trellis/trellis.d.ts +0 -210
  714. package/esm/trellis/trellis.d.ts.map +0 -1
  715. package/esm/trellis/trellis.js +0 -935
  716. package/script/auth/browser/login.d.ts +0 -27
  717. package/script/auth/browser/login.d.ts.map +0 -1
  718. package/script/auth/browser/login.js +0 -100
  719. package/script/auth/browser/portal.d.ts.map +0 -1
  720. package/script/auth/browser/portal.js +0 -40
  721. package/script/auth/browser/session.d.ts.map +0 -1
  722. package/script/auth/browser/session.js +0 -79
  723. package/script/auth/browser/storage.d.ts.map +0 -1
  724. package/script/auth/browser.d.ts +0 -13
  725. package/script/auth/browser.d.ts.map +0 -1
  726. package/script/auth/browser.js +0 -46
  727. package/script/auth/device_activation.d.ts +0 -194
  728. package/script/auth/device_activation.d.ts.map +0 -1
  729. package/script/auth/device_activation.js +0 -333
  730. package/script/auth/keys.d.ts.map +0 -1
  731. package/script/auth/keys.js +0 -56
  732. package/script/auth/mod.d.ts +0 -18
  733. package/script/auth/mod.d.ts.map +0 -1
  734. package/script/auth/mod.js +0 -180
  735. package/script/auth/proof.d.ts.map +0 -1
  736. package/script/auth/proof.js +0 -48
  737. package/script/auth/protocol.d.ts +0 -1315
  738. package/script/auth/protocol.d.ts.map +0 -1
  739. package/script/auth/protocol.js +0 -735
  740. package/script/auth/schemas.d.ts +0 -93
  741. package/script/auth/schemas.d.ts.map +0 -1
  742. package/script/auth/schemas.js +0 -67
  743. package/script/auth/session_auth.d.ts +0 -20
  744. package/script/auth/session_auth.d.ts.map +0 -1
  745. package/script/auth/session_auth.js +0 -45
  746. package/script/auth/trellis_id.d.ts.map +0 -1
  747. package/script/auth/trellis_id.js +0 -8
  748. package/script/auth/types.d.ts.map +0 -1
  749. package/script/auth/utils.d.ts.map +0 -1
  750. package/script/contracts/canonical.d.ts.map +0 -1
  751. package/script/contracts/mod.d.ts +0 -482
  752. package/script/contracts/mod.d.ts.map +0 -1
  753. package/script/contracts/mod.js +0 -583
  754. package/script/contracts/protocol.d.ts.map +0 -1
  755. package/script/contracts/protocol.js +0 -151
  756. package/script/contracts/runtime.d.ts +0 -48
  757. package/script/contracts/runtime.d.ts.map +0 -1
  758. package/script/contracts/schema_pointers.d.ts.map +0 -1
  759. package/script/telemetry/carrier.d.ts.map +0 -1
  760. package/script/telemetry/core.d.ts.map +0 -1
  761. package/script/telemetry/env.d.ts.map +0 -1
  762. package/script/telemetry/init.d.ts.map +0 -1
  763. package/script/telemetry/init.js +0 -11
  764. package/script/telemetry/mod.d.ts.map +0 -1
  765. package/script/telemetry/mod.js +0 -26
  766. package/script/telemetry/nats.d.ts.map +0 -1
  767. package/script/telemetry/result.d.ts.map +0 -1
  768. package/script/telemetry/runtime.d.ts.map +0 -1
  769. package/script/telemetry/runtime.js +0 -60
  770. package/script/telemetry/trace.d.ts.map +0 -1
  771. package/script/telemetry/trace.js +0 -31
  772. package/script/telemetry/trellis.d.ts.map +0 -1
  773. package/script/telemetry/trellis.js +0 -7
  774. package/script/trellis/_sdk/activity/_dnt.polyfills.d.ts +0 -12
  775. package/script/trellis/_sdk/activity/_dnt.polyfills.d.ts.map +0 -1
  776. package/script/trellis/_sdk/activity/api.d.ts +0 -10
  777. package/script/trellis/_sdk/activity/api.d.ts.map +0 -1
  778. package/script/trellis/_sdk/activity/api.js +0 -46
  779. package/script/trellis/_sdk/activity/contract.d.ts +0 -8
  780. package/script/trellis/_sdk/activity/contract.d.ts.map +0 -1
  781. package/script/trellis/_sdk/activity/contract.js +0 -62
  782. package/script/trellis/_sdk/activity/mod.d.ts +0 -7
  783. package/script/trellis/_sdk/activity/mod.d.ts.map +0 -1
  784. package/script/trellis/_sdk/activity/mod.js +0 -30
  785. package/script/trellis/_sdk/activity/package.json +0 -3
  786. package/script/trellis/_sdk/activity/schemas.d.ts +0 -607
  787. package/script/trellis/_sdk/activity/schemas.d.ts.map +0 -1
  788. package/script/trellis/_sdk/activity/schemas.js +0 -36
  789. package/script/trellis/_sdk/activity/types.d.ts +0 -96
  790. package/script/trellis/_sdk/activity/types.d.ts.map +0 -1
  791. package/script/trellis/_sdk/activity/types.js +0 -6
  792. package/script/trellis/_sdk/auth/_dnt.polyfills.d.ts +0 -12
  793. package/script/trellis/_sdk/auth/_dnt.polyfills.d.ts.map +0 -1
  794. package/script/trellis/_sdk/auth/_dnt.polyfills.js +0 -16
  795. package/script/trellis/_sdk/auth/api.d.ts +0 -10
  796. package/script/trellis/_sdk/auth/api.d.ts.map +0 -1
  797. package/script/trellis/_sdk/auth/api.js +0 -379
  798. package/script/trellis/_sdk/auth/contract.d.ts +0 -28
  799. package/script/trellis/_sdk/auth/contract.d.ts.map +0 -1
  800. package/script/trellis/_sdk/auth/contract.js +0 -86
  801. package/script/trellis/_sdk/auth/mod.d.ts +0 -7
  802. package/script/trellis/_sdk/auth/mod.d.ts.map +0 -1
  803. package/script/trellis/_sdk/auth/mod.js +0 -31
  804. package/script/trellis/_sdk/auth/package.json +0 -3
  805. package/script/trellis/_sdk/auth/schemas.d.ts +0 -10110
  806. package/script/trellis/_sdk/auth/schemas.d.ts.map +0 -1
  807. package/script/trellis/_sdk/auth/schemas.js +0 -328
  808. package/script/trellis/_sdk/auth/types.d.ts +0 -1382
  809. package/script/trellis/_sdk/auth/types.d.ts.map +0 -1
  810. package/script/trellis/_sdk/auth/types.js +0 -6
  811. package/script/trellis/_sdk/core/_dnt.polyfills.d.ts +0 -12
  812. package/script/trellis/_sdk/core/_dnt.polyfills.d.ts.map +0 -1
  813. package/script/trellis/_sdk/core/_dnt.polyfills.js +0 -16
  814. package/script/trellis/_sdk/core/api.d.ts +0 -10
  815. package/script/trellis/_sdk/core/api.d.ts.map +0 -1
  816. package/script/trellis/_sdk/core/api.js +0 -39
  817. package/script/trellis/_sdk/core/contract.d.ts +0 -8
  818. package/script/trellis/_sdk/core/contract.d.ts.map +0 -1
  819. package/script/trellis/_sdk/core/contract.js +0 -62
  820. package/script/trellis/_sdk/core/mod.d.ts +0 -7
  821. package/script/trellis/_sdk/core/mod.d.ts.map +0 -1
  822. package/script/trellis/_sdk/core/mod.js +0 -30
  823. package/script/trellis/_sdk/core/package.json +0 -3
  824. package/script/trellis/_sdk/core/schemas.d.ts +0 -1266
  825. package/script/trellis/_sdk/core/schemas.d.ts.map +0 -1
  826. package/script/trellis/_sdk/core/schemas.js +0 -31
  827. package/script/trellis/_sdk/core/types.d.ts +0 -193
  828. package/script/trellis/_sdk/core/types.d.ts.map +0 -1
  829. package/script/trellis/_sdk/core/types.js +0 -6
  830. package/script/trellis/_sdk/state/_dnt.polyfills.d.ts +0 -12
  831. package/script/trellis/_sdk/state/_dnt.polyfills.d.ts.map +0 -1
  832. package/script/trellis/_sdk/state/_dnt.polyfills.js +0 -16
  833. package/script/trellis/_sdk/state/api.d.ts +0 -10
  834. package/script/trellis/_sdk/state/api.d.ts.map +0 -1
  835. package/script/trellis/_sdk/state/api.js +0 -74
  836. package/script/trellis/_sdk/state/contract.d.ts +0 -8
  837. package/script/trellis/_sdk/state/contract.d.ts.map +0 -1
  838. package/script/trellis/_sdk/state/contract.js +0 -62
  839. package/script/trellis/_sdk/state/mod.d.ts +0 -7
  840. package/script/trellis/_sdk/state/mod.d.ts.map +0 -1
  841. package/script/trellis/_sdk/state/mod.js +0 -30
  842. package/script/trellis/_sdk/state/package.json +0 -3
  843. package/script/trellis/_sdk/state/schemas.d.ts +0 -1437
  844. package/script/trellis/_sdk/state/schemas.d.ts.map +0 -1
  845. package/script/trellis/_sdk/state/schemas.js +0 -65
  846. package/script/trellis/_sdk/state/types.d.ts +0 -206
  847. package/script/trellis/_sdk/state/types.d.ts.map +0 -1
  848. package/script/trellis/_sdk/state/types.js +0 -6
  849. package/script/trellis/auth.d.ts +0 -2
  850. package/script/trellis/auth.d.ts.map +0 -1
  851. package/script/trellis/auth.js +0 -17
  852. package/script/trellis/client.d.ts.map +0 -1
  853. package/script/trellis/client.js +0 -67
  854. package/script/trellis/client_connect.d.ts +0 -53
  855. package/script/trellis/client_connect.d.ts.map +0 -1
  856. package/script/trellis/client_connect.js +0 -304
  857. package/script/trellis/codec.d.ts.map +0 -1
  858. package/script/trellis/codec.js +0 -80
  859. package/script/trellis/contract.d.ts +0 -20
  860. package/script/trellis/contract.d.ts.map +0 -1
  861. package/script/trellis/contract.js +0 -7
  862. package/script/trellis/contracts.d.ts +0 -4
  863. package/script/trellis/contracts.d.ts.map +0 -1
  864. package/script/trellis/contracts.js +0 -20
  865. package/script/trellis/device.d.ts +0 -41
  866. package/script/trellis/device.d.ts.map +0 -1
  867. package/script/trellis/device.js +0 -213
  868. package/script/trellis/errors/AuthError.d.ts +0 -30
  869. package/script/trellis/errors/AuthError.d.ts.map +0 -1
  870. package/script/trellis/errors/AuthError.js +0 -83
  871. package/script/trellis/errors/KVError.d.ts.map +0 -1
  872. package/script/trellis/errors/KVError.js +0 -53
  873. package/script/trellis/errors/RemoteError.d.ts +0 -47
  874. package/script/trellis/errors/RemoteError.d.ts.map +0 -1
  875. package/script/trellis/errors/RemoteError.js +0 -87
  876. package/script/trellis/errors/StoreError.d.ts.map +0 -1
  877. package/script/trellis/errors/StoreError.js +0 -48
  878. package/script/trellis/errors/TransferError.d.ts.map +0 -1
  879. package/script/trellis/errors/TransferError.js +0 -48
  880. package/script/trellis/errors/TrellisError.d.ts +0 -16
  881. package/script/trellis/errors/TrellisError.d.ts.map +0 -1
  882. package/script/trellis/errors/TrellisError.js +0 -19
  883. package/script/trellis/errors/ValidationError.d.ts.map +0 -1
  884. package/script/trellis/errors/ValidationError.js +0 -84
  885. package/script/trellis/errors/index.d.ts +0 -46
  886. package/script/trellis/errors/index.d.ts.map +0 -1
  887. package/script/trellis/errors/index.js +0 -52
  888. package/script/trellis/globals.d.ts.map +0 -1
  889. package/script/trellis/helpers.d.ts +0 -12
  890. package/script/trellis/helpers.d.ts.map +0 -1
  891. package/script/trellis/helpers.js +0 -54
  892. package/script/trellis/index.d.ts +0 -24
  893. package/script/trellis/index.d.ts.map +0 -1
  894. package/script/trellis/index.js +0 -70
  895. package/script/trellis/kv.d.ts.map +0 -1
  896. package/script/trellis/kv.js +0 -383
  897. package/script/trellis/models/trellis/TrellisError.d.ts +0 -57
  898. package/script/trellis/models/trellis/TrellisError.d.ts.map +0 -1
  899. package/script/trellis/models/trellis/TrellisError.js +0 -26
  900. package/script/trellis/operations.d.ts +0 -81
  901. package/script/trellis/operations.d.ts.map +0 -1
  902. package/script/trellis/operations.js +0 -212
  903. package/script/trellis/runtime_transport.d.ts +0 -12
  904. package/script/trellis/runtime_transport.d.ts.map +0 -1
  905. package/script/trellis/runtime_transport.js +0 -37
  906. package/script/trellis/sdk/core.d.ts +0 -3
  907. package/script/trellis/sdk/core.d.ts.map +0 -1
  908. package/script/trellis/sdk/core.js +0 -20
  909. package/script/trellis/store.d.ts +0 -51
  910. package/script/trellis/store.d.ts.map +0 -1
  911. package/script/trellis/store.js +0 -316
  912. package/script/trellis/tasks.d.ts.map +0 -1
  913. package/script/trellis/tasks.js +0 -45
  914. package/script/trellis/tracing.d.ts +0 -4
  915. package/script/trellis/tracing.d.ts.map +0 -1
  916. package/script/trellis/tracing.js +0 -46
  917. package/script/trellis/transfer.d.ts +0 -118
  918. package/script/trellis/transfer.d.ts.map +0 -1
  919. package/script/trellis/transfer.js +0 -367
  920. package/script/trellis/trellis.d.ts +0 -210
  921. package/script/trellis/trellis.d.ts.map +0 -1
  922. package/script/trellis/trellis.js +0 -948
  923. /package/esm/{trellis/client.d.ts → client.d.ts} +0 -0
  924. /package/esm/{trellis/client.js → client.js} +0 -0
  925. /package/esm/{trellis/codec.d.ts → codec.d.ts} +0 -0
  926. /package/esm/{trellis/codec.js → codec.js} +0 -0
  927. /package/esm/{contracts → contract_support}/canonical.d.ts +0 -0
  928. /package/esm/{contracts → contract_support}/canonical.js +0 -0
  929. /package/esm/{contracts → contract_support}/protocol.d.ts +0 -0
  930. /package/esm/{contracts → contract_support}/runtime.js +0 -0
  931. /package/esm/{contracts → contract_support}/schema_pointers.d.ts +0 -0
  932. /package/esm/{contracts → contract_support}/schema_pointers.js +0 -0
  933. /package/esm/{trellis/errors → errors}/KVError.d.ts +0 -0
  934. /package/esm/{trellis/errors → errors}/KVError.js +0 -0
  935. /package/esm/{trellis/errors → errors}/StoreError.d.ts +0 -0
  936. /package/esm/{trellis/errors → errors}/StoreError.js +0 -0
  937. /package/esm/{trellis/errors → errors}/TransferError.d.ts +0 -0
  938. /package/esm/{trellis/errors → errors}/TransferError.js +0 -0
  939. /package/esm/{trellis/errors → errors}/TrellisError.d.ts +0 -0
  940. /package/esm/{trellis/errors → errors}/TrellisError.js +0 -0
  941. /package/esm/{trellis/errors → errors}/ValidationError.d.ts +0 -0
  942. /package/esm/{trellis/errors → errors}/ValidationError.js +0 -0
  943. /package/esm/{trellis/globals.d.ts → globals.d.ts} +0 -0
  944. /package/esm/{trellis/globals.js → globals.js} +0 -0
  945. /package/esm/{trellis/kv.d.ts → kv.d.ts} +0 -0
  946. /package/esm/{trellis/kv.js → kv.js} +0 -0
  947. /package/esm/{trellis/server_logger.d.ts → server_logger.d.ts} +0 -0
  948. /package/esm/{trellis/server_logger.js → server_logger.js} +0 -0
  949. /package/esm/{trellis/tasks.d.ts → tasks.d.ts} +0 -0
  950. /package/esm/{trellis/tasks.js → tasks.js} +0 -0
  951. /package/{esm/trellis/_sdk/activity → script/generated/js/sdks/trellis-core}/api.d.ts +0 -0
  952. /package/script/{auth → js/packages/trellis/auth}/browser/portal.d.ts +0 -0
  953. /package/script/{auth → js/packages/trellis/auth}/browser/session.d.ts +0 -0
  954. /package/script/{auth → js/packages/trellis/auth}/browser/storage.d.ts +0 -0
  955. /package/script/{auth → js/packages/trellis/auth}/browser/storage.js +0 -0
  956. /package/script/{auth → js/packages/trellis/auth}/keys.d.ts +0 -0
  957. /package/script/{auth → js/packages/trellis/auth}/proof.d.ts +0 -0
  958. /package/script/{auth → js/packages/trellis/auth}/trellis_id.d.ts +0 -0
  959. /package/script/{auth → js/packages/trellis/auth}/types.d.ts +0 -0
  960. /package/script/{auth → js/packages/trellis/auth}/types.js +0 -0
  961. /package/script/{auth → js/packages/trellis/auth}/utils.d.ts +0 -0
  962. /package/script/{auth → js/packages/trellis/auth}/utils.js +0 -0
  963. /package/script/{trellis → js/packages/trellis}/client.d.ts +0 -0
  964. /package/script/{trellis → js/packages/trellis}/codec.d.ts +0 -0
  965. /package/script/{contracts → js/packages/trellis/contract_support}/canonical.d.ts +0 -0
  966. /package/script/{contracts → js/packages/trellis/contract_support}/canonical.js +0 -0
  967. /package/script/{contracts → js/packages/trellis/contract_support}/protocol.d.ts +0 -0
  968. /package/script/{contracts → js/packages/trellis/contract_support}/runtime.js +0 -0
  969. /package/script/{contracts → js/packages/trellis/contract_support}/schema_pointers.d.ts +0 -0
  970. /package/script/{contracts → js/packages/trellis/contract_support}/schema_pointers.js +0 -0
  971. /package/script/{trellis → js/packages/trellis}/errors/KVError.d.ts +0 -0
  972. /package/script/{trellis → js/packages/trellis}/errors/StoreError.d.ts +0 -0
  973. /package/script/{trellis → js/packages/trellis}/errors/TransferError.d.ts +0 -0
  974. /package/script/{trellis → js/packages/trellis}/errors/ValidationError.d.ts +0 -0
  975. /package/script/{trellis → js/packages/trellis}/globals.d.ts +0 -0
  976. /package/script/{trellis → js/packages/trellis}/globals.js +0 -0
  977. /package/script/{trellis → js/packages/trellis}/kv.d.ts +0 -0
  978. /package/script/{trellis/_sdk/activity → js/packages/trellis/npm/src}/_dnt.polyfills.js +0 -0
  979. /package/script/{telemetry → js/packages/trellis/npm/src/telemetry}/carrier.d.ts +0 -0
  980. /package/script/{telemetry → js/packages/trellis/npm/src/telemetry}/carrier.js +0 -0
  981. /package/script/{telemetry → js/packages/trellis/npm/src/telemetry}/core.d.ts +0 -0
  982. /package/script/{telemetry → js/packages/trellis/npm/src/telemetry}/core.js +0 -0
  983. /package/script/{telemetry → js/packages/trellis/npm/src/telemetry}/env.d.ts +0 -0
  984. /package/script/{telemetry → js/packages/trellis/npm/src/telemetry}/nats.js +0 -0
  985. /package/script/{telemetry → js/packages/trellis/npm/src/telemetry}/result.d.ts +0 -0
  986. /package/script/{telemetry → js/packages/trellis/npm/src/telemetry}/result.js +0 -0
  987. /package/script/{telemetry → js/packages/trellis/npm/src/telemetry}/runtime.d.ts +0 -0
  988. /package/script/{telemetry → js/packages/trellis/npm/src/telemetry}/trace.d.ts +0 -0
  989. /package/script/{trellis → js/packages/trellis}/tasks.d.ts +0 -0
  990. /package/script/{telemetry → js/packages/trellis/telemetry}/env.js +0 -0
  991. /package/script/{telemetry → js/packages/trellis/telemetry}/init.d.ts +0 -0
  992. /package/script/{telemetry → js/packages/trellis/telemetry}/mod.d.ts +0 -0
  993. /package/script/{telemetry → js/packages/trellis/telemetry}/nats.d.ts +0 -0
  994. /package/script/{telemetry → js/packages/trellis/telemetry}/trellis.d.ts +0 -0
package/esm/trellis.js ADDED
@@ -0,0 +1,1049 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _Trellis_instances, _Trellis_log, _Trellis_tasks, _Trellis_hasExplicitApi, _Trellis_noResponderMaxRetries, _Trellis_noResponderRetryMs, _Trellis_authBypassMethods, _Trellis_operationStore, _Trellis_unknownApiError, _Trellis_handleRPC, _Trellis_processRPCMessage, _Trellis_respondWithError, _Trellis_startEphemeralEvent, _Trellis_handleDurableEvent, _Trellis_parseEventMessage, _Trellis_escapeSubjectToken, _Trellis_createProof, _Trellis_requestJson, _Trellis_watchJson;
13
+ import { jetstream, jetstreamManager, } from "@nats-io/jetstream";
14
+ import { createInbox, headers as natsHeaders, } from "@nats-io/nats-core";
15
+ import { AsyncResult, BaseError, err, isErr, ok, Result, } from "@qlever-llc/result";
16
+ import { createNatsHeaderCarrier, extractTraceContext, injectTraceContext, SpanStatusCode, startClientSpan, startServerSpan, withSpanAsync, } from "./tracing.js";
17
+ import { Type } from "typebox";
18
+ import { Pointer } from "typebox/value";
19
+ import { ulid } from "ulid";
20
+ import { encodeSchema, parse, parseUnknownSchema, } from "./codec.js";
21
+ import { TransferError, AuthError, getBuiltinRpcError, UnexpectedError, ValidationError, } from "./errors/index.js";
22
+ import { RemoteError } from "./errors/RemoteError.js";
23
+ import { logger } from "./globals.js";
24
+ import { TypedKV } from "./kv.js";
25
+ import { TrellisErrorDataSchema } from "./models/trellis/TrellisError.js";
26
+ import { OperationInvoker, } from "./operations.js";
27
+ import { createTransferHandle, } from "./transfer.js";
28
+ import { TrellisTasks } from "./tasks.js";
29
+ /**
30
+ * Safely extract JSON from a NATS message.
31
+ * The .json() method can throw if the message data is not valid JSON.
32
+ */
33
+ export function safeJson(msg) {
34
+ return Result.try(() => msg.json());
35
+ }
36
+ function encodeRuntimeSchema(schema, data) {
37
+ return encodeSchema(schema, data);
38
+ }
39
+ function parseRuntimeSchema(schema, data) {
40
+ return parseUnknownSchema(schema, data);
41
+ }
42
+ export function base64urlEncode(data) {
43
+ const b64 = btoa(String.fromCharCode(...data));
44
+ return b64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
45
+ }
46
+ export function base64urlDecode(s) {
47
+ const normalized = s.replace(/-/g, "+").replace(/_/g, "/");
48
+ const padLen = (4 - (normalized.length % 4)) % 4;
49
+ const padded = normalized + "=".repeat(padLen);
50
+ const bin = atob(padded);
51
+ const out = new Uint8Array(bin.length);
52
+ for (let i = 0; i < bin.length; i++)
53
+ out[i] = bin.charCodeAt(i);
54
+ return out;
55
+ }
56
+ export function toArrayBuffer(data) {
57
+ const buf = data.buffer;
58
+ if (buf instanceof ArrayBuffer) {
59
+ return buf.slice(data.byteOffset, data.byteOffset + data.byteLength);
60
+ }
61
+ const copy = new Uint8Array(data.byteLength);
62
+ copy.set(data);
63
+ return copy.buffer;
64
+ }
65
+ export async function sha256(data) {
66
+ const digest = await crypto.subtle.digest("SHA-256", toArrayBuffer(data));
67
+ return new Uint8Array(digest);
68
+ }
69
+ export function buildProofInput(sessionKey, subject, payloadHash) {
70
+ const enc = new TextEncoder();
71
+ const sessionKeyBytes = enc.encode(sessionKey);
72
+ const subjectBytes = enc.encode(subject);
73
+ const buf = new Uint8Array(4 +
74
+ sessionKeyBytes.length +
75
+ 4 +
76
+ subjectBytes.length +
77
+ 4 +
78
+ payloadHash.length);
79
+ const view = new DataView(buf.buffer);
80
+ let offset = 0;
81
+ view.setUint32(offset, sessionKeyBytes.length);
82
+ offset += 4;
83
+ buf.set(sessionKeyBytes, offset);
84
+ offset += sessionKeyBytes.length;
85
+ view.setUint32(offset, subjectBytes.length);
86
+ offset += 4;
87
+ buf.set(subjectBytes, offset);
88
+ offset += subjectBytes.length;
89
+ view.setUint32(offset, payloadHash.length);
90
+ offset += 4;
91
+ buf.set(payloadHash, offset);
92
+ return buf;
93
+ }
94
+ export function isResultLike(value) {
95
+ return value instanceof Result;
96
+ }
97
+ const DurableOperationSnapshotSchema = Type.Object({
98
+ id: Type.String(),
99
+ service: Type.String(),
100
+ operation: Type.String(),
101
+ revision: Type.Number(),
102
+ state: Type.Union([
103
+ Type.Literal("pending"),
104
+ Type.Literal("running"),
105
+ Type.Literal("completed"),
106
+ Type.Literal("failed"),
107
+ Type.Literal("cancelled"),
108
+ ]),
109
+ createdAt: Type.String(),
110
+ updatedAt: Type.String(),
111
+ completedAt: Type.Optional(Type.String()),
112
+ progress: Type.Optional(Type.Any()),
113
+ transfer: Type.Optional(Type.Object({
114
+ chunkIndex: Type.Number(),
115
+ chunkBytes: Type.Number(),
116
+ transferredBytes: Type.Number(),
117
+ })),
118
+ output: Type.Optional(Type.Any()),
119
+ error: Type.Optional(Type.Object({
120
+ type: Type.String(),
121
+ message: Type.String(),
122
+ })),
123
+ });
124
+ export const DurableOperationRecordSchema = Type.Object({
125
+ ownerSessionKey: Type.String(),
126
+ sequence: Type.Number(),
127
+ snapshot: DurableOperationSnapshotSchema,
128
+ });
129
+ export function buildRuntimeOperationSnapshot(runtime, state, patch) {
130
+ const updatedAt = new Date().toISOString();
131
+ const completedAt = state === "completed" || state === "failed" || state === "cancelled"
132
+ ? (patch?.completedAt ?? updatedAt)
133
+ : patch?.completedAt;
134
+ return {
135
+ id: runtime.id,
136
+ service: runtime.service,
137
+ operation: runtime.operation,
138
+ revision: patch?.revision ?? runtime.snapshot.revision + 1,
139
+ state,
140
+ createdAt: patch?.createdAt ?? runtime.snapshot.createdAt,
141
+ updatedAt,
142
+ ...(completedAt ? { completedAt } : {}),
143
+ ...(patch?.progress !== undefined
144
+ ? { progress: patch.progress }
145
+ : runtime.snapshot.progress !== undefined
146
+ ? { progress: runtime.snapshot.progress }
147
+ : {}),
148
+ ...(patch?.transfer !== undefined
149
+ ? { transfer: patch.transfer }
150
+ : runtime.snapshot.transfer !== undefined
151
+ ? { transfer: runtime.snapshot.transfer }
152
+ : {}),
153
+ ...(patch?.output !== undefined
154
+ ? { output: patch.output }
155
+ : runtime.snapshot.output !== undefined
156
+ ? { output: runtime.snapshot.output }
157
+ : {}),
158
+ ...(patch?.error
159
+ ? { error: patch.error }
160
+ : runtime.snapshot.error
161
+ ? { error: runtime.snapshot.error }
162
+ : {}),
163
+ };
164
+ }
165
+ function isRuntimeOperationSnapshot(value) {
166
+ return !!value && typeof value === "object" &&
167
+ typeof value.id === "string" &&
168
+ typeof value.service === "string" &&
169
+ typeof value.operation === "string" &&
170
+ typeof value.revision === "number" &&
171
+ typeof value.state === "string" &&
172
+ typeof value.createdAt === "string" &&
173
+ typeof value.updatedAt === "string";
174
+ }
175
+ export function isTerminalRuntimeOperationSnapshot(value) {
176
+ return isRuntimeOperationSnapshot(value) && (value.state === "completed" || value.state === "failed" ||
177
+ value.state === "cancelled");
178
+ }
179
+ const NATS_SUBJECT_TOKEN_FORBIDDEN = /[\u0000\s.*>~]/gu;
180
+ const DEFAULT_NO_RESPONDER_MAX_RETRIES = 2;
181
+ const DEFAULT_NO_RESPONDER_RETRY_MS = 200;
182
+ const DEFAULT_AUTH_VALIDATE_SESSION_RETRY_ATTEMPTS = 3;
183
+ const DEFAULT_AUTH_VALIDATE_SESSION_RETRY_MS = 25;
184
+ const EMPTY_TRELLIS_API = {
185
+ rpc: {},
186
+ operations: {},
187
+ events: {},
188
+ subjects: {},
189
+ };
190
+ function isTransientAuthValidateSessionError(error) {
191
+ if (error instanceof AuthError) {
192
+ return error.reason === "session_not_found";
193
+ }
194
+ if (error instanceof RemoteError &&
195
+ error.remoteError.type === "AuthError") {
196
+ const reason = Reflect.get(error.remoteError, "reason");
197
+ return typeof reason === "string" && reason === "session_not_found";
198
+ }
199
+ return false;
200
+ }
201
+ function isDeclaredRpcError(errorNames, type) {
202
+ return !!errorNames?.includes(type);
203
+ }
204
+ function isRuntimeRpcErrorDesc(value) {
205
+ return !!value && typeof value === "object" &&
206
+ typeof Reflect.get(value, "type") === "string" &&
207
+ typeof Reflect.get(value, "fromSerializable") === "function";
208
+ }
209
+ function reconstructDeclaredRpcError(errorNames, runtimeErrors, data, json) {
210
+ if (!isDeclaredRpcError(errorNames, data.type)) {
211
+ return null;
212
+ }
213
+ const runtimeError = getBuiltinRpcError(data.type) ??
214
+ runtimeErrors?.find((candidate) => candidate.type === data.type);
215
+ if (!runtimeError) {
216
+ return null;
217
+ }
218
+ const parsed = runtimeError.schema
219
+ ? parseRuntimeSchema(runtimeError.schema, json).take()
220
+ : data;
221
+ if (isErr(parsed)) {
222
+ return parsed.error instanceof ValidationError ||
223
+ parsed.error instanceof UnexpectedError
224
+ ? parsed.error
225
+ : new UnexpectedError({ cause: parsed.error });
226
+ }
227
+ try {
228
+ const reconstructed = runtimeError.fromSerializable(parsed);
229
+ if (reconstructed instanceof BaseError) {
230
+ return reconstructed;
231
+ }
232
+ return new UnexpectedError({
233
+ cause: new Error(`RPC error '${data.type}' reconstructed to a non-Trellis error instance`),
234
+ });
235
+ }
236
+ catch (cause) {
237
+ return new UnexpectedError({ cause });
238
+ }
239
+ }
240
+ async function sleep(ms) {
241
+ await new Promise((resolve) => setTimeout(resolve, ms));
242
+ }
243
+ export class Trellis {
244
+ constructor(name, // Must be unique for a service
245
+ nats, auth, opts) {
246
+ _Trellis_instances.add(this);
247
+ Object.defineProperty(this, "name", {
248
+ enumerable: true,
249
+ configurable: true,
250
+ writable: true,
251
+ value: void 0
252
+ });
253
+ Object.defineProperty(this, "timeout", {
254
+ enumerable: true,
255
+ configurable: true,
256
+ writable: true,
257
+ value: void 0
258
+ });
259
+ Object.defineProperty(this, "stream", {
260
+ enumerable: true,
261
+ configurable: true,
262
+ writable: true,
263
+ value: void 0
264
+ });
265
+ Object.defineProperty(this, "nats", {
266
+ enumerable: true,
267
+ configurable: true,
268
+ writable: true,
269
+ value: void 0
270
+ });
271
+ Object.defineProperty(this, "js", {
272
+ enumerable: true,
273
+ configurable: true,
274
+ writable: true,
275
+ value: void 0
276
+ });
277
+ Object.defineProperty(this, "auth", {
278
+ enumerable: true,
279
+ configurable: true,
280
+ writable: true,
281
+ value: void 0
282
+ });
283
+ Object.defineProperty(this, "api", {
284
+ enumerable: true,
285
+ configurable: true,
286
+ writable: true,
287
+ value: void 0
288
+ });
289
+ _Trellis_log.set(this, void 0);
290
+ _Trellis_tasks.set(this, void 0);
291
+ _Trellis_hasExplicitApi.set(this, void 0);
292
+ _Trellis_noResponderMaxRetries.set(this, void 0);
293
+ _Trellis_noResponderRetryMs.set(this, void 0);
294
+ _Trellis_authBypassMethods.set(this, void 0);
295
+ _Trellis_operationStore.set(this, void 0);
296
+ const api = opts?.api;
297
+ this.name = name;
298
+ this.nats = nats;
299
+ this.js = jetstream(this.nats);
300
+ this.auth = auth;
301
+ this.api = (api ?? EMPTY_TRELLIS_API);
302
+ __classPrivateFieldSet(this, _Trellis_log, (opts?.log ?? logger).child({ lib: "trellis" }), "f");
303
+ this.timeout = opts?.timeout ?? 3000;
304
+ this.stream = opts?.stream ?? "trellis";
305
+ __classPrivateFieldSet(this, _Trellis_hasExplicitApi, api !== undefined, "f");
306
+ __classPrivateFieldSet(this, _Trellis_noResponderMaxRetries, opts?.noResponderRetry?.maxAttempts ??
307
+ DEFAULT_NO_RESPONDER_MAX_RETRIES, "f");
308
+ __classPrivateFieldSet(this, _Trellis_noResponderRetryMs, opts?.noResponderRetry?.baseDelayMs ??
309
+ DEFAULT_NO_RESPONDER_RETRY_MS, "f");
310
+ __classPrivateFieldSet(this, _Trellis_authBypassMethods, new Set(opts?.authBypassMethods ?? []), "f");
311
+ __classPrivateFieldSet(this, _Trellis_tasks, new TrellisTasks({ log: __classPrivateFieldGet(this, _Trellis_log, "f") }), "f");
312
+ }
313
+ /**
314
+ * Returns the underlying NATS connection.
315
+ */
316
+ get natsConnection() {
317
+ return this.nats;
318
+ }
319
+ async operationStoreHandle() {
320
+ if (!__classPrivateFieldGet(this, _Trellis_operationStore, "f")) {
321
+ const bucket = `trellis_operations_${this.auth.sessionKey.slice(0, 16)}`;
322
+ __classPrivateFieldSet(this, _Trellis_operationStore, (async () => {
323
+ const result = await TypedKV.open(this.nats, bucket, DurableOperationRecordSchema, {
324
+ history: 5,
325
+ ttl: 0,
326
+ });
327
+ const value = result.take();
328
+ if (isErr(value)) {
329
+ throw value.error;
330
+ }
331
+ return value;
332
+ })(), "f");
333
+ }
334
+ return __classPrivateFieldGet(this, _Trellis_operationStore, "f");
335
+ }
336
+ async loadOperationRecord(operationId) {
337
+ const store = await this.operationStoreHandle();
338
+ const entry = await store.get(operationId);
339
+ const value = entry.take();
340
+ if (isErr(value)) {
341
+ return null;
342
+ }
343
+ return value.value;
344
+ }
345
+ async saveOperationRecord(runtime) {
346
+ const store = await this.operationStoreHandle();
347
+ const record = {
348
+ ownerSessionKey: runtime.ownerSessionKey,
349
+ sequence: runtime.sequence,
350
+ snapshot: runtime.snapshot,
351
+ };
352
+ await store.put(runtime.id, record);
353
+ }
354
+ /**
355
+ * Makes an authenticated request to a Trellis RPC method.
356
+ *
357
+ * @template M The specific RPC method being called.
358
+ * @param method The name of the RPC method to call.
359
+ * @param input The input data for the method, conforming to its schema.
360
+ * @param opts Optional request-specific options.
361
+ * @returns A promise that resolves with a `Result` containing either the method's
362
+ * output or an error.
363
+ * @returns A `Result` object:
364
+ * ok: A validated reponse of method M
365
+ * err: declared RPC errors | RemoteError | ValidationError | UnexpectedError
366
+ */
367
+ async request(method, input, opts) {
368
+ __classPrivateFieldGet(this, _Trellis_log, "f").trace({ method: String(method) }, `Calling ${method.toString()}.`);
369
+ const methodName = method;
370
+ const ctx = this.api["rpc"][methodName];
371
+ if (!ctx) {
372
+ return err(new UnexpectedError({
373
+ cause: __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_unknownApiError).call(this, "RPC method", method.toString()),
374
+ context: { method: method.toString() },
375
+ }));
376
+ }
377
+ const msg = encodeRuntimeSchema(ctx.input, input).take();
378
+ if (isErr(msg)) {
379
+ return msg;
380
+ }
381
+ const subject = this.template(ctx.subject, input).take();
382
+ if (isErr(subject)) {
383
+ return subject;
384
+ }
385
+ // Start a client span for this RPC request
386
+ const span = startClientSpan(method, subject);
387
+ const attempt = async () => {
388
+ const proof = await __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_createProof).call(this, subject, msg);
389
+ const headers = natsHeaders();
390
+ headers.set("session-key", this.auth.sessionKey);
391
+ headers.set("proof", proof);
392
+ // Inject trace context into NATS headers for propagation
393
+ injectTraceContext(createNatsHeaderCarrier(headers), span);
394
+ // Attempt request with retry for transient "no responders" errors
395
+ const requestWithRetry = async () => {
396
+ for (let retry = 0; retry <= __classPrivateFieldGet(this, _Trellis_noResponderMaxRetries, "f"); retry++) {
397
+ const result = await AsyncResult.try(() => this.nats.request(subject, msg, {
398
+ headers,
399
+ timeout: opts?.timeout ?? this.timeout,
400
+ }));
401
+ if (result.isOk()) {
402
+ return ok((await result).take());
403
+ }
404
+ const cause = result.error.cause;
405
+ const message = cause instanceof Error
406
+ ? cause.message
407
+ : String(cause);
408
+ const isNoResponders = message.includes("no responders");
409
+ // If it's a no-responders error and we have retries left, retry
410
+ if (isNoResponders && retry < __classPrivateFieldGet(this, _Trellis_noResponderMaxRetries, "f")) {
411
+ __classPrivateFieldGet(this, _Trellis_log, "f").debug({ method, subject, retry }, "No responders, retrying...");
412
+ await new Promise((r) => setTimeout(r, __classPrivateFieldGet(this, _Trellis_noResponderRetryMs, "f") * (retry + 1)));
413
+ continue;
414
+ }
415
+ // Final attempt failed or non-retryable error
416
+ __classPrivateFieldGet(this, _Trellis_log, "f").warn({ method, subject, error: message }, "NATS request failed");
417
+ const isNatsPermission = message.includes("Permissions Violation");
418
+ const reason = isNatsPermission
419
+ ? `Permission denied. You need one of these capabilities: ${ctx.callerCapabilities.join(", ")}`
420
+ : message;
421
+ return err(new UnexpectedError({
422
+ cause,
423
+ context: {
424
+ method,
425
+ subject,
426
+ reason,
427
+ requiredCapabilities: ctx.callerCapabilities,
428
+ noResponders: isNoResponders,
429
+ },
430
+ }));
431
+ }
432
+ // Should be unreachable, but TypeScript needs explicit return
433
+ return err(new UnexpectedError({
434
+ context: { method, subject, reason: "retry loop exhausted" },
435
+ }));
436
+ };
437
+ const msgResult = await requestWithRetry();
438
+ const m = msgResult.take();
439
+ if (isErr(m)) {
440
+ return m;
441
+ }
442
+ if (m.headers?.get("status") === "error") {
443
+ const json = safeJson(m).take();
444
+ if (isErr(json)) {
445
+ return json;
446
+ }
447
+ const errorData = parse(TrellisErrorDataSchema, json).take();
448
+ if (isErr(errorData)) {
449
+ return errorData;
450
+ }
451
+ const declaredErrorTypes = Array.isArray(ctx.declaredErrorTypes)
452
+ ? ctx.declaredErrorTypes.filter((value) => typeof value === "string")
453
+ : ctx.errors;
454
+ const runtimeErrors = Array.isArray(ctx.runtimeErrors)
455
+ ? ctx.runtimeErrors.filter(isRuntimeRpcErrorDesc)
456
+ : undefined;
457
+ const reconstructed = reconstructDeclaredRpcError(declaredErrorTypes, runtimeErrors, errorData, json);
458
+ if (reconstructed) {
459
+ return err(reconstructed);
460
+ }
461
+ return err(new RemoteError({ error: errorData }));
462
+ }
463
+ const json = safeJson(m).take();
464
+ if (isErr(json)) {
465
+ return json;
466
+ }
467
+ const outputResult = parseRuntimeSchema(ctx.output, json).take();
468
+ if (isErr(outputResult)) {
469
+ return err(outputResult.error);
470
+ }
471
+ return ok(outputResult);
472
+ };
473
+ return withSpanAsync(span, async () => {
474
+ try {
475
+ const result = await attempt();
476
+ const value = result.take();
477
+ if (isErr(value)) {
478
+ span.setStatus({
479
+ code: SpanStatusCode.ERROR,
480
+ message: value.error.message,
481
+ });
482
+ }
483
+ else {
484
+ span.setStatus({ code: SpanStatusCode.OK });
485
+ }
486
+ return result;
487
+ }
488
+ catch (cause) {
489
+ const unexpected = new UnexpectedError({ cause });
490
+ span.setStatus({
491
+ code: SpanStatusCode.ERROR,
492
+ message: unexpected.message,
493
+ });
494
+ span.recordException(unexpected);
495
+ return err(unexpected);
496
+ }
497
+ finally {
498
+ span.end();
499
+ }
500
+ });
501
+ }
502
+ async requestOrThrow(method, input, opts) {
503
+ const result = await this.request(method, input, opts);
504
+ const value = result.take();
505
+ if (isErr(value)) {
506
+ throw value.error;
507
+ }
508
+ return value;
509
+ }
510
+ operation(operation) {
511
+ const descriptor = this.api["operations"]?.[operation];
512
+ if (!descriptor) {
513
+ throw __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_unknownApiError).call(this, "operation", operation.toString());
514
+ }
515
+ const transport = {
516
+ requestJson: (subject, body) => __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_requestJson).call(this, subject, body),
517
+ watchJson: (subject, body) => __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_watchJson).call(this, subject, body),
518
+ putTransfer: async (grant, body) => {
519
+ const handle = createTransferHandle(this.nats, this.auth, this.timeout, grant);
520
+ if (!(handle instanceof Object) || !("put" in handle)) {
521
+ return err(new TransferError({
522
+ operation: "transfer",
523
+ context: { reason: "invalid_operation_transfer_grant" },
524
+ }));
525
+ }
526
+ return await handle.put(body);
527
+ },
528
+ };
529
+ return new OperationInvoker(transport, descriptor);
530
+ }
531
+ /*
532
+ * Mount a handler to process requests made to a specific Trellis API
533
+ */
534
+ async mount(method, fn) {
535
+ const methodName = method;
536
+ const ctx = this.api["rpc"][methodName];
537
+ if (!ctx) {
538
+ throw __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_unknownApiError).call(this, "RPC method", method.toString());
539
+ }
540
+ const task = __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_handleRPC).call(this, methodName, fn);
541
+ __classPrivateFieldGet(this, _Trellis_tasks, "f").add(methodName, task);
542
+ }
543
+ respondWithError(msg, error) {
544
+ __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_respondWithError).call(this, msg, error);
545
+ }
546
+ async publish(event, data) {
547
+ const eventName = event;
548
+ const ctx = this.api["events"][eventName];
549
+ if (!ctx) {
550
+ return err(new UnexpectedError({
551
+ cause: __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_unknownApiError).call(this, "event", event.toString()),
552
+ context: { event: event.toString() },
553
+ }));
554
+ }
555
+ const subject = this.template(ctx.subject, data).take();
556
+ if (isErr(subject)) {
557
+ logger.error({ err: subject.error }, "Failed to template event.");
558
+ return subject;
559
+ }
560
+ const payload = {
561
+ ...data,
562
+ header: {
563
+ id: ulid(),
564
+ time: new Date().toISOString(),
565
+ },
566
+ };
567
+ const msg = encodeSchema(ctx.event, payload).take();
568
+ if (isErr(msg)) {
569
+ logger.error({ err: msg.error }, "Failed to encode event.");
570
+ return err(new UnexpectedError({ cause: msg.error }));
571
+ }
572
+ logger.trace({ subject }, `Publishing ${event.toString()} event.`);
573
+ await this.js.publish(subject, msg);
574
+ return ok(undefined);
575
+ }
576
+ async event(event, subjectData, fn, opts) {
577
+ const eventName = event;
578
+ const ctx = this.api["events"][eventName];
579
+ if (!ctx) {
580
+ return err(new UnexpectedError({
581
+ cause: __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_unknownApiError).call(this, "event", event.toString()),
582
+ context: { event: event.toString() },
583
+ }));
584
+ }
585
+ const subject = this.template(ctx.subject, subjectData, true).take();
586
+ if (isErr(subject))
587
+ return subject;
588
+ if (opts?.mode === "ephemeral") {
589
+ return __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_startEphemeralEvent).call(this, eventName, ctx, subject, fn, opts.signal);
590
+ }
591
+ const jsm = await jetstreamManager(this.nats);
592
+ const consumerName = opts?.durableName ??
593
+ `${this.name}-${event.replaceAll(".", "_")}`;
594
+ const addResult = await AsyncResult.try(() => jsm.consumers.add(this.stream, {
595
+ durable_name: consumerName,
596
+ ack_policy: "explicit",
597
+ deliver_policy: opts?.replay === "new" ? "new" : "all",
598
+ filter_subjects: [subject],
599
+ }));
600
+ // If add failed (consumer already exists), try to get existing consumer info
601
+ const consumerInfoResult = addResult.isOk()
602
+ ? addResult
603
+ : await AsyncResult.try(() => jsm.consumers.info(this.stream, consumerName));
604
+ const info = consumerInfoResult.take();
605
+ if (isErr(info))
606
+ return info;
607
+ const consumer = this.js.consumers.getConsumerFromInfo(info);
608
+ const messages = await consumer.consume();
609
+ if (opts?.signal) {
610
+ if (opts.signal.aborted) {
611
+ messages.stop();
612
+ }
613
+ else {
614
+ opts.signal.addEventListener("abort", () => messages.stop(), {
615
+ once: true,
616
+ });
617
+ }
618
+ }
619
+ __classPrivateFieldGet(this, _Trellis_tasks, "f").add(`event:${eventName}:${ulid()}`, __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_handleDurableEvent).call(this, eventName, ctx, messages, fn));
620
+ return ok(undefined);
621
+ }
622
+ wait() {
623
+ return __classPrivateFieldGet(this, _Trellis_tasks, "f").wait();
624
+ }
625
+ // FIXME: If are validating things twice in most cases...
626
+ template(subject, data, allowWildcards = false) {
627
+ // Find all template placeholders and check if values exist
628
+ const placeholders = subject.match(/\{([^}]+)\}/g) || [];
629
+ for (const placeholder of placeholders) {
630
+ const key = placeholder.slice(1, -1); // Remove { and }
631
+ const value = Pointer.Get(data, key);
632
+ if ((value === undefined || value === null) && !allowWildcards) {
633
+ return err(new ValidationError({
634
+ errors: [
635
+ {
636
+ path: key,
637
+ message: "Missing required data for subject template",
638
+ },
639
+ ],
640
+ context: { key },
641
+ }));
642
+ }
643
+ }
644
+ const result = subject.replace(/\{([^}]+)\}/g, (_, key) => {
645
+ const value = Pointer.Get(data, key);
646
+ if (allowWildcards && value === "*") {
647
+ return "*";
648
+ }
649
+ if (allowWildcards && (value === undefined || value === null)) {
650
+ return "*";
651
+ }
652
+ return __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_escapeSubjectToken).call(this, `${value}`);
653
+ });
654
+ return ok(result);
655
+ }
656
+ async requestAuthValidate(input) {
657
+ const request = this.request.bind(this);
658
+ const result = await request("Auth.ValidateRequest", input);
659
+ return result;
660
+ }
661
+ }
662
+ _Trellis_log = new WeakMap(), _Trellis_tasks = new WeakMap(), _Trellis_hasExplicitApi = new WeakMap(), _Trellis_noResponderMaxRetries = new WeakMap(), _Trellis_noResponderRetryMs = new WeakMap(), _Trellis_authBypassMethods = new WeakMap(), _Trellis_operationStore = new WeakMap(), _Trellis_instances = new WeakSet(), _Trellis_unknownApiError = function _Trellis_unknownApiError(kind, name) {
663
+ const base = `Unknown ${kind} '${name}'.`;
664
+ if (__classPrivateFieldGet(this, _Trellis_hasExplicitApi, "f")) {
665
+ return new Error(`${base} Did you forget to include its API module?`);
666
+ }
667
+ return new Error(`${base} No API surface was provided. Pass opts.api, use createClient(contract, ...), or await createCoreClient(...) instead.`);
668
+ }, _Trellis_handleRPC = function _Trellis_handleRPC(method, fn, subjectData = {}) {
669
+ // Get API details
670
+ const ctx = this.api["rpc"][method];
671
+ const subject = this.template(ctx.subject, subjectData, true).take();
672
+ if (isErr(subject)) {
673
+ return AsyncResult.lift(subject);
674
+ }
675
+ const handlerTrellis = this;
676
+ __classPrivateFieldGet(this, _Trellis_log, "f").info({ method: String(method) }, `Mounting ${method.toString()} RPC handler`);
677
+ const sub = this.nats.subscribe(subject);
678
+ return AsyncResult.try(async () => {
679
+ for await (const msg of sub) {
680
+ const resultPromise = await __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_processRPCMessage).call(this, method, ctx, msg, fn, handlerTrellis);
681
+ const result = resultPromise.take();
682
+ if (isErr(result)) {
683
+ __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_respondWithError).call(this, msg, result.error);
684
+ continue;
685
+ }
686
+ msg.respond(result);
687
+ }
688
+ });
689
+ }, _Trellis_processRPCMessage = async function _Trellis_processRPCMessage(method, ctx, msg, fn, handlerTrellis) {
690
+ __classPrivateFieldGet(this, _Trellis_log, "f").debug({ method: String(method), subject: msg.subject }, "Processing RPC message");
691
+ // Extract trace context from incoming NATS headers
692
+ const parentContext = extractTraceContext(createNatsHeaderCarrier({
693
+ get: (k) => msg.headers?.get(k) ?? undefined,
694
+ set: () => { }, // Server doesn't need to set headers on incoming messages
695
+ }));
696
+ // Start a server span for this RPC handler
697
+ const span = startServerSpan(method, msg.subject, parentContext);
698
+ // Execute the handler within the span's context
699
+ return withSpanAsync(span, async () => {
700
+ const execute = async () => {
701
+ const jsonData = safeJson(msg).take();
702
+ if (isErr(jsonData)) {
703
+ __classPrivateFieldGet(this, _Trellis_log, "f").warn({ method, error: jsonData.error.message }, "Failed to parse JSON");
704
+ span.setStatus({
705
+ code: SpanStatusCode.ERROR,
706
+ message: "Failed to parse JSON",
707
+ });
708
+ return jsonData;
709
+ }
710
+ const parsedInput = parseRuntimeSchema(ctx.input, jsonData).take();
711
+ if (isErr(parsedInput)) {
712
+ span.setStatus({
713
+ code: SpanStatusCode.ERROR,
714
+ message: "Input validation failed",
715
+ });
716
+ return parsedInput;
717
+ }
718
+ let caller;
719
+ const callerSessionKey = msg.headers?.get("session-key") ?? "";
720
+ const authRequired = ctx.authRequired ?? true;
721
+ if (!authRequired || __classPrivateFieldGet(this, _Trellis_authBypassMethods, "f").has(method)) {
722
+ caller = {
723
+ type: "service",
724
+ id: "system",
725
+ active: true,
726
+ name: "System",
727
+ capabilities: ["service"],
728
+ };
729
+ }
730
+ else {
731
+ const sessionKey = msg.headers?.get("session-key");
732
+ const proof = msg.headers?.get("proof");
733
+ if (!sessionKey) {
734
+ __classPrivateFieldGet(this, _Trellis_log, "f").warn({ method }, "Missing session-key header");
735
+ span.setStatus({
736
+ code: SpanStatusCode.ERROR,
737
+ message: "Missing session-key",
738
+ });
739
+ return err(new AuthError({ reason: "missing_session_key" }));
740
+ }
741
+ if (!proof) {
742
+ __classPrivateFieldGet(this, _Trellis_log, "f").warn({ method }, "Missing proof in request");
743
+ span.setStatus({
744
+ code: SpanStatusCode.ERROR,
745
+ message: "Missing proof",
746
+ });
747
+ return err(new AuthError({ reason: "missing_proof" }));
748
+ }
749
+ // Verify proof signature locally using the raw request bytes we received.
750
+ const payloadBytes = msg.data ?? new Uint8Array();
751
+ const payloadHash = await sha256(payloadBytes);
752
+ const proofInput = buildProofInput(sessionKey, msg.subject, payloadHash);
753
+ const digest = await sha256(proofInput);
754
+ const verifyResult = await AsyncResult.try(async () => {
755
+ const publicKeyRaw = base64urlDecode(sessionKey);
756
+ const pub = await crypto.subtle.importKey("raw", toArrayBuffer(publicKeyRaw), { name: "Ed25519" }, true, ["verify"]);
757
+ return crypto.subtle.verify({ name: "Ed25519" }, pub, toArrayBuffer(base64urlDecode(proof)), toArrayBuffer(digest));
758
+ });
759
+ const signatureOk = verifyResult.isOk() &&
760
+ (await verifyResult).take() === true;
761
+ if (!signatureOk) {
762
+ span.setStatus({
763
+ code: SpanStatusCode.ERROR,
764
+ message: "Invalid signature",
765
+ });
766
+ return err(new AuthError({
767
+ reason: "invalid_signature",
768
+ context: { sessionKey },
769
+ }));
770
+ }
771
+ let auth;
772
+ for (let attempt = 0; attempt < DEFAULT_AUTH_VALIDATE_SESSION_RETRY_ATTEMPTS; attempt++) {
773
+ const authResult = await this.requestAuthValidate({
774
+ sessionKey,
775
+ proof,
776
+ subject: msg.subject,
777
+ payloadHash: base64urlEncode(payloadHash),
778
+ capabilities: [...ctx.callerCapabilities],
779
+ });
780
+ const authValue = authResult.take();
781
+ if (!isErr(authValue)) {
782
+ auth = authValue;
783
+ break;
784
+ }
785
+ const authError = authValue.error;
786
+ if (!isTransientAuthValidateSessionError(authError) ||
787
+ attempt === DEFAULT_AUTH_VALIDATE_SESSION_RETRY_ATTEMPTS - 1) {
788
+ auth = authError;
789
+ break;
790
+ }
791
+ await sleep(DEFAULT_AUTH_VALIDATE_SESSION_RETRY_MS * (attempt + 1));
792
+ }
793
+ if (!auth) {
794
+ return err(new UnexpectedError({
795
+ context: { reason: "missing_auth_validate_result" },
796
+ }));
797
+ }
798
+ if (auth instanceof Error) {
799
+ __classPrivateFieldGet(this, _Trellis_log, "f").warn({
800
+ method,
801
+ error: auth.message,
802
+ errorType: auth.name,
803
+ remoteError: auth instanceof RemoteError
804
+ ? auth.toSerializable()
805
+ : undefined,
806
+ }, "Auth.ValidateRequest failed");
807
+ span.setStatus({
808
+ code: SpanStatusCode.ERROR,
809
+ message: "Auth.ValidateRequest failed",
810
+ });
811
+ if (auth instanceof BaseError) {
812
+ return err(auth);
813
+ }
814
+ return err(new UnexpectedError({ cause: auth }));
815
+ }
816
+ if (!auth.allowed) {
817
+ span.setStatus({
818
+ code: SpanStatusCode.ERROR,
819
+ message: "Insufficient permissions",
820
+ });
821
+ return err(new AuthError({
822
+ reason: "insufficient_permissions",
823
+ context: {
824
+ requiredCapabilities: ctx.callerCapabilities,
825
+ userCapabilities: auth.caller.capabilities,
826
+ },
827
+ }));
828
+ }
829
+ if (typeof msg.reply !== "string" ||
830
+ !msg.reply.startsWith(`${auth.inboxPrefix}.`)) {
831
+ span.setStatus({
832
+ code: SpanStatusCode.ERROR,
833
+ message: "Reply subject mismatch",
834
+ });
835
+ return err(new AuthError({
836
+ reason: "reply_subject_mismatch",
837
+ context: { expected: auth.inboxPrefix, actual: msg.reply },
838
+ }));
839
+ }
840
+ caller = auth.caller;
841
+ }
842
+ span.setAttribute("auth.caller.type", caller.type);
843
+ if (caller.type === "user") {
844
+ span.setAttribute("user.id", caller.id);
845
+ span.setAttribute("user.origin", caller.origin);
846
+ }
847
+ if (caller.type === "service") {
848
+ span.setAttribute("service.id", caller.id);
849
+ }
850
+ if (caller.type === "device") {
851
+ span.setAttribute("device.id", caller.deviceId);
852
+ span.setAttribute("device.profile_id", caller.profileId);
853
+ }
854
+ const invokeHandler = fn;
855
+ const handlerResultWrapped = await AsyncResult.try(async () => await Promise.resolve(invokeHandler(parsedInput, {
856
+ caller,
857
+ sessionKey: callerSessionKey,
858
+ }, handlerTrellis)));
859
+ if (handlerResultWrapped.isErr()) {
860
+ const error = handlerResultWrapped.error.withContext({ method });
861
+ __classPrivateFieldGet(this, _Trellis_log, "f").error({
862
+ method,
863
+ error: error.message,
864
+ cause: error.cause instanceof Error
865
+ ? { message: error.cause.message, stack: error.cause.stack }
866
+ : error.cause,
867
+ }, "Handler threw unexpectedly.");
868
+ span.setStatus({
869
+ code: SpanStatusCode.ERROR,
870
+ message: error.message,
871
+ });
872
+ span.recordException(error);
873
+ return err(error);
874
+ }
875
+ const handlerResult = (await handlerResultWrapped).take();
876
+ const handlerOutcome = handlerResult.take();
877
+ if (isErr(handlerOutcome)) {
878
+ const handlerError = handlerOutcome.error;
879
+ const error = handlerError instanceof BaseError &&
880
+ !(handlerError instanceof RemoteError)
881
+ ? handlerError
882
+ : new UnexpectedError({ cause: handlerError });
883
+ __classPrivateFieldGet(this, _Trellis_log, "f").error({
884
+ method,
885
+ error: error.message,
886
+ errorType: error.name,
887
+ cause: error.cause instanceof Error
888
+ ? { message: error.cause.message, stack: error.cause.stack }
889
+ : error.cause,
890
+ }, "Handler returned error.");
891
+ span.setStatus({
892
+ code: SpanStatusCode.ERROR,
893
+ message: error.message,
894
+ });
895
+ return err(error);
896
+ }
897
+ const encoded = encodeSchema(ctx.output, handlerOutcome).take();
898
+ if (isErr(encoded)) {
899
+ span.setStatus({
900
+ code: SpanStatusCode.ERROR,
901
+ message: "Output encoding failed",
902
+ });
903
+ return encoded;
904
+ }
905
+ span.setStatus({ code: SpanStatusCode.OK });
906
+ return ok(encoded);
907
+ };
908
+ const result = await execute();
909
+ span.end();
910
+ return result;
911
+ });
912
+ }, _Trellis_respondWithError = function _Trellis_respondWithError(msg, error) {
913
+ const trellisError = error instanceof BaseError &&
914
+ !(error instanceof RemoteError)
915
+ ? error
916
+ : new UnexpectedError({ cause: error });
917
+ __classPrivateFieldGet(this, _Trellis_log, "f").error({ error: trellisError.toSerializable() }, "RPC error");
918
+ const errorData = trellisError.toSerializable();
919
+ const hdrs = natsHeaders();
920
+ hdrs.set("status", "error");
921
+ const serialized = Result.try(() => JSON.stringify(errorData));
922
+ if (serialized.isErr()) {
923
+ __classPrivateFieldGet(this, _Trellis_log, "f").error({ error: serialized.error }, "Failed to serialize error response");
924
+ msg.respond('{"type":"UnexpectedError","message":"Failed to serialize error"}', { headers: hdrs });
925
+ return;
926
+ }
927
+ msg.respond(serialized.take(), { headers: hdrs });
928
+ }, _Trellis_startEphemeralEvent = function _Trellis_startEphemeralEvent(event, ctx, subject, fn, signal) {
929
+ const sub = this.nats.subscribe(subject);
930
+ if (signal) {
931
+ if (signal.aborted) {
932
+ sub.unsubscribe();
933
+ return ok(undefined);
934
+ }
935
+ signal.addEventListener("abort", () => sub.unsubscribe(), { once: true });
936
+ }
937
+ const task = AsyncResult.try(async () => {
938
+ for await (const msg of sub) {
939
+ const parsedEvent = __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_parseEventMessage).call(this, event, ctx, msg);
940
+ const m = parsedEvent.take();
941
+ if (isErr(m)) {
942
+ __classPrivateFieldGet(this, _Trellis_log, "f").error({ error: m.error }, "Event validation failed");
943
+ continue;
944
+ }
945
+ const handlerResult = await AsyncResult.lift(fn(m));
946
+ if (handlerResult.isErr()) {
947
+ __classPrivateFieldGet(this, _Trellis_log, "f").error({
948
+ error: handlerResult.error.toSerializable(),
949
+ event,
950
+ subject: msg.subject,
951
+ }, "Event handler failed");
952
+ }
953
+ }
954
+ });
955
+ __classPrivateFieldGet(this, _Trellis_tasks, "f").add(`event:${event}:${ulid()}`, task);
956
+ return ok(undefined);
957
+ }, _Trellis_handleDurableEvent = function _Trellis_handleDurableEvent(event, ctx, messages, fn) {
958
+ return AsyncResult.try(async () => {
959
+ for await (const msg of messages) {
960
+ const parsedEvent = __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_parseEventMessage).call(this, event, ctx, msg);
961
+ const m = parsedEvent.take();
962
+ if (isErr(m)) {
963
+ __classPrivateFieldGet(this, _Trellis_log, "f").error({ error: m.error }, "Event validation failed");
964
+ msg.term();
965
+ continue;
966
+ }
967
+ const handlerResult = await AsyncResult.lift(fn(m));
968
+ if (handlerResult.isErr()) {
969
+ __classPrivateFieldGet(this, _Trellis_log, "f").error({
970
+ error: handlerResult.error.toSerializable(),
971
+ event,
972
+ subject: msg.subject,
973
+ }, "Event handler failed");
974
+ msg.nak();
975
+ continue;
976
+ }
977
+ msg.ack();
978
+ }
979
+ });
980
+ }, _Trellis_parseEventMessage = function _Trellis_parseEventMessage(event, ctx, msg) {
981
+ const jsonData = Result.try(() => msg.json());
982
+ const json = jsonData.take();
983
+ if (isErr(json)) {
984
+ __classPrivateFieldGet(this, _Trellis_log, "f").error({ error: json.error, event, subject: msg.subject }, "Event parse failed");
985
+ return json;
986
+ }
987
+ return parseRuntimeSchema(ctx.event, json);
988
+ }, _Trellis_escapeSubjectToken = function _Trellis_escapeSubjectToken(token) {
989
+ const out = token.replace(NATS_SUBJECT_TOKEN_FORBIDDEN, (ch) => `~${ch.codePointAt(0).toString(16).toUpperCase()}~`);
990
+ // Protect stapRet with $ due to NATS internal use of it
991
+ if (out.length === 0 || out.startsWith("$")) {
992
+ return `_${out}`;
993
+ }
994
+ return out;
995
+ }, _Trellis_createProof = async function _Trellis_createProof(subject, payload) {
996
+ const payloadBytes = new TextEncoder().encode(payload);
997
+ const payloadHash = await sha256(payloadBytes);
998
+ const input = buildProofInput(this.auth.sessionKey, subject, payloadHash);
999
+ const digest = await sha256(input);
1000
+ const sigBytes = await this.auth.sign(digest);
1001
+ return base64urlEncode(sigBytes);
1002
+ }, _Trellis_requestJson = async function _Trellis_requestJson(subject, body) {
1003
+ const payload = JSON.stringify(body);
1004
+ const proof = await __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_createProof).call(this, subject, payload);
1005
+ const headers = natsHeaders();
1006
+ headers.set("session-key", this.auth.sessionKey);
1007
+ headers.set("proof", proof);
1008
+ const response = await AsyncResult.try(() => this.nats.request(subject, payload, {
1009
+ timeout: this.timeout,
1010
+ headers,
1011
+ })).take();
1012
+ if (isErr(response)) {
1013
+ return response;
1014
+ }
1015
+ return safeJson(response);
1016
+ }, _Trellis_watchJson = async function _Trellis_watchJson(subject, body) {
1017
+ const payload = JSON.stringify(body);
1018
+ const proof = await __classPrivateFieldGet(this, _Trellis_instances, "m", _Trellis_createProof).call(this, subject, payload);
1019
+ const headers = natsHeaders();
1020
+ headers.set("session-key", this.auth.sessionKey);
1021
+ headers.set("proof", proof);
1022
+ const inbox = createInbox(`_INBOX.${this.auth.sessionKey.slice(0, 16)}`);
1023
+ const sub = this.nats.subscribe(inbox);
1024
+ try {
1025
+ this.nats.publish(subject, payload, {
1026
+ headers,
1027
+ reply: inbox,
1028
+ });
1029
+ await this.nats.flush();
1030
+ }
1031
+ catch (cause) {
1032
+ sub.unsubscribe();
1033
+ return err(new UnexpectedError({ cause }));
1034
+ }
1035
+ return ok((async function* () {
1036
+ try {
1037
+ for await (const msg of sub) {
1038
+ if (msg.headers?.get("status") === "error") {
1039
+ yield err(new UnexpectedError({ cause: new Error(msg.string()) }));
1040
+ continue;
1041
+ }
1042
+ yield safeJson(msg);
1043
+ }
1044
+ }
1045
+ finally {
1046
+ sub.unsubscribe();
1047
+ }
1048
+ })());
1049
+ };