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