@appport/sdk 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (387) hide show
  1. package/LICENSE +126 -0
  2. package/README.md +39 -0
  3. package/dist/index.d.ts +14 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +14 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/node.d.ts +3 -0
  8. package/dist/node.d.ts.map +1 -0
  9. package/dist/node.js +3 -0
  10. package/dist/node.js.map +1 -0
  11. package/node_modules/@appport/authorization/README.md +28 -0
  12. package/node_modules/@appport/authorization/dist/index.d.ts +94 -0
  13. package/node_modules/@appport/authorization/dist/index.d.ts.map +1 -0
  14. package/node_modules/@appport/authorization/dist/index.js +131 -0
  15. package/node_modules/@appport/authorization/dist/index.js.map +1 -0
  16. package/node_modules/@appport/authorization/package.json +28 -0
  17. package/node_modules/@appport/client/README.md +35 -0
  18. package/node_modules/@appport/client/dist/channel.d.ts +14 -0
  19. package/node_modules/@appport/client/dist/channel.d.ts.map +1 -0
  20. package/node_modules/@appport/client/dist/channel.js +58 -0
  21. package/node_modules/@appport/client/dist/channel.js.map +1 -0
  22. package/node_modules/@appport/client/dist/client.d.ts +61 -0
  23. package/node_modules/@appport/client/dist/client.d.ts.map +1 -0
  24. package/node_modules/@appport/client/dist/client.js +214 -0
  25. package/node_modules/@appport/client/dist/client.js.map +1 -0
  26. package/node_modules/@appport/client/dist/contract.d.ts +55 -0
  27. package/node_modules/@appport/client/dist/contract.d.ts.map +1 -0
  28. package/node_modules/@appport/client/dist/contract.js +12 -0
  29. package/node_modules/@appport/client/dist/contract.js.map +1 -0
  30. package/node_modules/@appport/client/dist/discovery.d.ts +17 -0
  31. package/node_modules/@appport/client/dist/discovery.d.ts.map +1 -0
  32. package/node_modules/@appport/client/dist/discovery.js +56 -0
  33. package/node_modules/@appport/client/dist/discovery.js.map +1 -0
  34. package/node_modules/@appport/client/dist/duplex.d.ts +25 -0
  35. package/node_modules/@appport/client/dist/duplex.d.ts.map +1 -0
  36. package/node_modules/@appport/client/dist/duplex.js +194 -0
  37. package/node_modules/@appport/client/dist/duplex.js.map +1 -0
  38. package/node_modules/@appport/client/dist/index.d.ts +13 -0
  39. package/node_modules/@appport/client/dist/index.d.ts.map +1 -0
  40. package/node_modules/@appport/client/dist/index.js +13 -0
  41. package/node_modules/@appport/client/dist/index.js.map +1 -0
  42. package/node_modules/@appport/client/dist/transport.d.ts +42 -0
  43. package/node_modules/@appport/client/dist/transport.d.ts.map +1 -0
  44. package/node_modules/@appport/client/dist/transport.js +2 -0
  45. package/node_modules/@appport/client/dist/transport.js.map +1 -0
  46. package/node_modules/@appport/client/package.json +32 -0
  47. package/node_modules/@appport/core/README.md +91 -0
  48. package/node_modules/@appport/core/dist/appboundry-contract.d.ts +80 -0
  49. package/node_modules/@appport/core/dist/appboundry-contract.d.ts.map +1 -0
  50. package/node_modules/@appport/core/dist/appboundry-contract.js +160 -0
  51. package/node_modules/@appport/core/dist/appboundry-contract.js.map +1 -0
  52. package/node_modules/@appport/core/dist/application-implementation.d.ts +125 -0
  53. package/node_modules/@appport/core/dist/application-implementation.d.ts.map +1 -0
  54. package/node_modules/@appport/core/dist/application-implementation.js +220 -0
  55. package/node_modules/@appport/core/dist/application-implementation.js.map +1 -0
  56. package/node_modules/@appport/core/dist/application-lifecycle.d.ts +150 -0
  57. package/node_modules/@appport/core/dist/application-lifecycle.d.ts.map +1 -0
  58. package/node_modules/@appport/core/dist/application-lifecycle.js +70 -0
  59. package/node_modules/@appport/core/dist/application-lifecycle.js.map +1 -0
  60. package/node_modules/@appport/core/dist/application-source.d.ts +109 -0
  61. package/node_modules/@appport/core/dist/application-source.d.ts.map +1 -0
  62. package/node_modules/@appport/core/dist/application-source.js +186 -0
  63. package/node_modules/@appport/core/dist/application-source.js.map +1 -0
  64. package/node_modules/@appport/core/dist/application.d.ts +122 -0
  65. package/node_modules/@appport/core/dist/application.d.ts.map +1 -0
  66. package/node_modules/@appport/core/dist/application.js +515 -0
  67. package/node_modules/@appport/core/dist/application.js.map +1 -0
  68. package/node_modules/@appport/core/dist/artifact.d.ts +395 -0
  69. package/node_modules/@appport/core/dist/artifact.d.ts.map +1 -0
  70. package/node_modules/@appport/core/dist/artifact.js +392 -0
  71. package/node_modules/@appport/core/dist/artifact.js.map +1 -0
  72. package/node_modules/@appport/core/dist/assembly.d.ts +237 -0
  73. package/node_modules/@appport/core/dist/assembly.d.ts.map +1 -0
  74. package/node_modules/@appport/core/dist/assembly.js +458 -0
  75. package/node_modules/@appport/core/dist/assembly.js.map +1 -0
  76. package/node_modules/@appport/core/dist/authority-attestation.d.ts +34 -0
  77. package/node_modules/@appport/core/dist/authority-attestation.d.ts.map +1 -0
  78. package/node_modules/@appport/core/dist/authority-attestation.js +72 -0
  79. package/node_modules/@appport/core/dist/authority-attestation.js.map +1 -0
  80. package/node_modules/@appport/core/dist/authorization-grant.d.ts +107 -0
  81. package/node_modules/@appport/core/dist/authorization-grant.d.ts.map +1 -0
  82. package/node_modules/@appport/core/dist/authorization-grant.js +131 -0
  83. package/node_modules/@appport/core/dist/authorization-grant.js.map +1 -0
  84. package/node_modules/@appport/core/dist/binding.d.ts +294 -0
  85. package/node_modules/@appport/core/dist/binding.d.ts.map +1 -0
  86. package/node_modules/@appport/core/dist/binding.js +263 -0
  87. package/node_modules/@appport/core/dist/binding.js.map +1 -0
  88. package/node_modules/@appport/core/dist/builtins.d.ts +18 -0
  89. package/node_modules/@appport/core/dist/builtins.d.ts.map +1 -0
  90. package/node_modules/@appport/core/dist/builtins.js +38 -0
  91. package/node_modules/@appport/core/dist/builtins.js.map +1 -0
  92. package/node_modules/@appport/core/dist/capability.d.ts +94 -0
  93. package/node_modules/@appport/core/dist/capability.d.ts.map +1 -0
  94. package/node_modules/@appport/core/dist/capability.js +85 -0
  95. package/node_modules/@appport/core/dist/capability.js.map +1 -0
  96. package/node_modules/@appport/core/dist/concurrency.d.ts +16 -0
  97. package/node_modules/@appport/core/dist/concurrency.d.ts.map +1 -0
  98. package/node_modules/@appport/core/dist/concurrency.js +46 -0
  99. package/node_modules/@appport/core/dist/concurrency.js.map +1 -0
  100. package/node_modules/@appport/core/dist/context.d.ts +59 -0
  101. package/node_modules/@appport/core/dist/context.d.ts.map +1 -0
  102. package/node_modules/@appport/core/dist/context.js +14 -0
  103. package/node_modules/@appport/core/dist/context.js.map +1 -0
  104. package/node_modules/@appport/core/dist/contract-artifact.d.ts +15 -0
  105. package/node_modules/@appport/core/dist/contract-artifact.d.ts.map +1 -0
  106. package/node_modules/@appport/core/dist/contract-artifact.js +152 -0
  107. package/node_modules/@appport/core/dist/contract-artifact.js.map +1 -0
  108. package/node_modules/@appport/core/dist/contract-attestation.d.ts +68 -0
  109. package/node_modules/@appport/core/dist/contract-attestation.d.ts.map +1 -0
  110. package/node_modules/@appport/core/dist/contract-attestation.js +76 -0
  111. package/node_modules/@appport/core/dist/contract-attestation.js.map +1 -0
  112. package/node_modules/@appport/core/dist/crash-injection.d.ts +3 -0
  113. package/node_modules/@appport/core/dist/crash-injection.d.ts.map +1 -0
  114. package/node_modules/@appport/core/dist/crash-injection.js +8 -0
  115. package/node_modules/@appport/core/dist/crash-injection.js.map +1 -0
  116. package/node_modules/@appport/core/dist/events.d.ts +33 -0
  117. package/node_modules/@appport/core/dist/events.d.ts.map +1 -0
  118. package/node_modules/@appport/core/dist/events.js +79 -0
  119. package/node_modules/@appport/core/dist/events.js.map +1 -0
  120. package/node_modules/@appport/core/dist/execution-barrier.d.ts +13 -0
  121. package/node_modules/@appport/core/dist/execution-barrier.d.ts.map +1 -0
  122. package/node_modules/@appport/core/dist/execution-barrier.js +33 -0
  123. package/node_modules/@appport/core/dist/execution-barrier.js.map +1 -0
  124. package/node_modules/@appport/core/dist/execution-ledger.d.ts +81 -0
  125. package/node_modules/@appport/core/dist/execution-ledger.d.ts.map +1 -0
  126. package/node_modules/@appport/core/dist/execution-ledger.js +173 -0
  127. package/node_modules/@appport/core/dist/execution-ledger.js.map +1 -0
  128. package/node_modules/@appport/core/dist/execution.d.ts +387 -0
  129. package/node_modules/@appport/core/dist/execution.d.ts.map +1 -0
  130. package/node_modules/@appport/core/dist/execution.js +165 -0
  131. package/node_modules/@appport/core/dist/execution.js.map +1 -0
  132. package/node_modules/@appport/core/dist/idempotency.d.ts +36 -0
  133. package/node_modules/@appport/core/dist/idempotency.d.ts.map +1 -0
  134. package/node_modules/@appport/core/dist/idempotency.js +36 -0
  135. package/node_modules/@appport/core/dist/idempotency.js.map +1 -0
  136. package/node_modules/@appport/core/dist/implementation.d.ts +110 -0
  137. package/node_modules/@appport/core/dist/implementation.d.ts.map +1 -0
  138. package/node_modules/@appport/core/dist/implementation.js +65 -0
  139. package/node_modules/@appport/core/dist/implementation.js.map +1 -0
  140. package/node_modules/@appport/core/dist/index.d.ts +44 -0
  141. package/node_modules/@appport/core/dist/index.d.ts.map +1 -0
  142. package/node_modules/@appport/core/dist/index.js +44 -0
  143. package/node_modules/@appport/core/dist/index.js.map +1 -0
  144. package/node_modules/@appport/core/dist/invocation.d.ts +253 -0
  145. package/node_modules/@appport/core/dist/invocation.d.ts.map +1 -0
  146. package/node_modules/@appport/core/dist/invocation.js +258 -0
  147. package/node_modules/@appport/core/dist/invocation.js.map +1 -0
  148. package/node_modules/@appport/core/dist/manifest.d.ts +157 -0
  149. package/node_modules/@appport/core/dist/manifest.d.ts.map +1 -0
  150. package/node_modules/@appport/core/dist/manifest.js +255 -0
  151. package/node_modules/@appport/core/dist/manifest.js.map +1 -0
  152. package/node_modules/@appport/core/dist/memory-application-data-store.d.ts +19 -0
  153. package/node_modules/@appport/core/dist/memory-application-data-store.d.ts.map +1 -0
  154. package/node_modules/@appport/core/dist/memory-application-data-store.js +161 -0
  155. package/node_modules/@appport/core/dist/memory-application-data-store.js.map +1 -0
  156. package/node_modules/@appport/core/dist/operations.d.ts +61 -0
  157. package/node_modules/@appport/core/dist/operations.d.ts.map +1 -0
  158. package/node_modules/@appport/core/dist/operations.js +210 -0
  159. package/node_modules/@appport/core/dist/operations.js.map +1 -0
  160. package/node_modules/@appport/core/dist/public.d.ts +19 -0
  161. package/node_modules/@appport/core/dist/public.d.ts.map +1 -0
  162. package/node_modules/@appport/core/dist/public.js +18 -0
  163. package/node_modules/@appport/core/dist/public.js.map +1 -0
  164. package/node_modules/@appport/core/dist/registration.d.ts +165 -0
  165. package/node_modules/@appport/core/dist/registration.d.ts.map +1 -0
  166. package/node_modules/@appport/core/dist/registration.js +253 -0
  167. package/node_modules/@appport/core/dist/registration.js.map +1 -0
  168. package/node_modules/@appport/core/dist/registry.d.ts +29 -0
  169. package/node_modules/@appport/core/dist/registry.d.ts.map +1 -0
  170. package/node_modules/@appport/core/dist/registry.js +148 -0
  171. package/node_modules/@appport/core/dist/registry.js.map +1 -0
  172. package/node_modules/@appport/core/dist/repository-connection.d.ts +100 -0
  173. package/node_modules/@appport/core/dist/repository-connection.d.ts.map +1 -0
  174. package/node_modules/@appport/core/dist/repository-connection.js +57 -0
  175. package/node_modules/@appport/core/dist/repository-connection.js.map +1 -0
  176. package/node_modules/@appport/core/dist/resolver.d.ts +130 -0
  177. package/node_modules/@appport/core/dist/resolver.d.ts.map +1 -0
  178. package/node_modules/@appport/core/dist/resolver.js +252 -0
  179. package/node_modules/@appport/core/dist/resolver.js.map +1 -0
  180. package/node_modules/@appport/core/dist/runtime-manifest.d.ts +68 -0
  181. package/node_modules/@appport/core/dist/runtime-manifest.d.ts.map +1 -0
  182. package/node_modules/@appport/core/dist/runtime-manifest.js +84 -0
  183. package/node_modules/@appport/core/dist/runtime-manifest.js.map +1 -0
  184. package/node_modules/@appport/core/dist/sanitize.d.ts +14 -0
  185. package/node_modules/@appport/core/dist/sanitize.d.ts.map +1 -0
  186. package/node_modules/@appport/core/dist/sanitize.js +49 -0
  187. package/node_modules/@appport/core/dist/sanitize.js.map +1 -0
  188. package/node_modules/@appport/core/dist/server-internal.d.ts +5 -0
  189. package/node_modules/@appport/core/dist/server-internal.d.ts.map +1 -0
  190. package/node_modules/@appport/core/dist/server-internal.js +4 -0
  191. package/node_modules/@appport/core/dist/server-internal.js.map +1 -0
  192. package/node_modules/@appport/core/dist/sessions.d.ts +29 -0
  193. package/node_modules/@appport/core/dist/sessions.d.ts.map +1 -0
  194. package/node_modules/@appport/core/dist/sessions.js +39 -0
  195. package/node_modules/@appport/core/dist/sessions.js.map +1 -0
  196. package/node_modules/@appport/core/dist/sha256.d.ts +3 -0
  197. package/node_modules/@appport/core/dist/sha256.d.ts.map +1 -0
  198. package/node_modules/@appport/core/dist/sha256.js +46 -0
  199. package/node_modules/@appport/core/dist/sha256.js.map +1 -0
  200. package/node_modules/@appport/core/dist/source-verification.d.ts +53 -0
  201. package/node_modules/@appport/core/dist/source-verification.d.ts.map +1 -0
  202. package/node_modules/@appport/core/dist/source-verification.js +92 -0
  203. package/node_modules/@appport/core/dist/source-verification.js.map +1 -0
  204. package/node_modules/@appport/core/dist/state-context.d.ts +312 -0
  205. package/node_modules/@appport/core/dist/state-context.d.ts.map +1 -0
  206. package/node_modules/@appport/core/dist/state-context.js +100 -0
  207. package/node_modules/@appport/core/dist/state-context.js.map +1 -0
  208. package/node_modules/@appport/core/dist/state.d.ts +96 -0
  209. package/node_modules/@appport/core/dist/state.d.ts.map +1 -0
  210. package/node_modules/@appport/core/dist/state.js +89 -0
  211. package/node_modules/@appport/core/dist/state.js.map +1 -0
  212. package/node_modules/@appport/core/dist/streams.d.ts +38 -0
  213. package/node_modules/@appport/core/dist/streams.d.ts.map +1 -0
  214. package/node_modules/@appport/core/dist/streams.js +123 -0
  215. package/node_modules/@appport/core/dist/streams.js.map +1 -0
  216. package/node_modules/@appport/core/dist/telemetry.d.ts +42 -0
  217. package/node_modules/@appport/core/dist/telemetry.d.ts.map +1 -0
  218. package/node_modules/@appport/core/dist/telemetry.js +32 -0
  219. package/node_modules/@appport/core/dist/telemetry.js.map +1 -0
  220. package/node_modules/@appport/core/dist/wasm-engine.d.ts +22 -0
  221. package/node_modules/@appport/core/dist/wasm-engine.d.ts.map +1 -0
  222. package/node_modules/@appport/core/dist/wasm-engine.js +367 -0
  223. package/node_modules/@appport/core/dist/wasm-engine.js.map +1 -0
  224. package/node_modules/@appport/core/package.json +58 -0
  225. package/node_modules/@appport/mobile/README.md +10 -0
  226. package/node_modules/@appport/mobile/dist/index.d.ts +66 -0
  227. package/node_modules/@appport/mobile/dist/index.d.ts.map +1 -0
  228. package/node_modules/@appport/mobile/dist/index.js +182 -0
  229. package/node_modules/@appport/mobile/dist/index.js.map +1 -0
  230. package/node_modules/@appport/mobile/package.json +33 -0
  231. package/node_modules/@appport/protocol/README.md +41 -0
  232. package/node_modules/@appport/protocol/dist/blob.d.ts +46 -0
  233. package/node_modules/@appport/protocol/dist/blob.d.ts.map +1 -0
  234. package/node_modules/@appport/protocol/dist/blob.js +23 -0
  235. package/node_modules/@appport/protocol/dist/blob.js.map +1 -0
  236. package/node_modules/@appport/protocol/dist/compatibility.d.ts +25 -0
  237. package/node_modules/@appport/protocol/dist/compatibility.d.ts.map +1 -0
  238. package/node_modules/@appport/protocol/dist/compatibility.js +189 -0
  239. package/node_modules/@appport/protocol/dist/compatibility.js.map +1 -0
  240. package/node_modules/@appport/protocol/dist/envelopes.d.ts +175 -0
  241. package/node_modules/@appport/protocol/dist/envelopes.d.ts.map +1 -0
  242. package/node_modules/@appport/protocol/dist/envelopes.js +97 -0
  243. package/node_modules/@appport/protocol/dist/envelopes.js.map +1 -0
  244. package/node_modules/@appport/protocol/dist/errors.d.ts +74 -0
  245. package/node_modules/@appport/protocol/dist/errors.d.ts.map +1 -0
  246. package/node_modules/@appport/protocol/dist/errors.js +91 -0
  247. package/node_modules/@appport/protocol/dist/errors.js.map +1 -0
  248. package/node_modules/@appport/protocol/dist/ids.d.ts +12 -0
  249. package/node_modules/@appport/protocol/dist/ids.d.ts.map +1 -0
  250. package/node_modules/@appport/protocol/dist/ids.js +50 -0
  251. package/node_modules/@appport/protocol/dist/ids.js.map +1 -0
  252. package/node_modules/@appport/protocol/dist/index.d.ts +20 -0
  253. package/node_modules/@appport/protocol/dist/index.d.ts.map +1 -0
  254. package/node_modules/@appport/protocol/dist/index.js +20 -0
  255. package/node_modules/@appport/protocol/dist/index.js.map +1 -0
  256. package/node_modules/@appport/protocol/dist/jsonschema.d.ts +50 -0
  257. package/node_modules/@appport/protocol/dist/jsonschema.d.ts.map +1 -0
  258. package/node_modules/@appport/protocol/dist/jsonschema.js +6 -0
  259. package/node_modules/@appport/protocol/dist/jsonschema.js.map +1 -0
  260. package/node_modules/@appport/protocol/dist/manifest.d.ts +131 -0
  261. package/node_modules/@appport/protocol/dist/manifest.d.ts.map +1 -0
  262. package/node_modules/@appport/protocol/dist/manifest.js +20 -0
  263. package/node_modules/@appport/protocol/dist/manifest.js.map +1 -0
  264. package/node_modules/@appport/protocol/dist/names.d.ts +26 -0
  265. package/node_modules/@appport/protocol/dist/names.d.ts.map +1 -0
  266. package/node_modules/@appport/protocol/dist/names.js +85 -0
  267. package/node_modules/@appport/protocol/dist/names.js.map +1 -0
  268. package/node_modules/@appport/protocol/dist/operations.d.ts +34 -0
  269. package/node_modules/@appport/protocol/dist/operations.d.ts.map +1 -0
  270. package/node_modules/@appport/protocol/dist/operations.js +9 -0
  271. package/node_modules/@appport/protocol/dist/operations.js.map +1 -0
  272. package/node_modules/@appport/protocol/dist/session.d.ts +27 -0
  273. package/node_modules/@appport/protocol/dist/session.d.ts.map +1 -0
  274. package/node_modules/@appport/protocol/dist/session.js +7 -0
  275. package/node_modules/@appport/protocol/dist/session.js.map +1 -0
  276. package/node_modules/@appport/protocol/dist/validate.d.ts +37 -0
  277. package/node_modules/@appport/protocol/dist/validate.d.ts.map +1 -0
  278. package/node_modules/@appport/protocol/dist/validate.js +321 -0
  279. package/node_modules/@appport/protocol/dist/validate.js.map +1 -0
  280. package/node_modules/@appport/protocol/dist/version.d.ts +27 -0
  281. package/node_modules/@appport/protocol/dist/version.d.ts.map +1 -0
  282. package/node_modules/@appport/protocol/dist/version.js +26 -0
  283. package/node_modules/@appport/protocol/dist/version.js.map +1 -0
  284. package/node_modules/@appport/protocol/package.json +25 -0
  285. package/node_modules/@appport/schema/README.md +32 -0
  286. package/node_modules/@appport/schema/dist/builder.d.ts +85 -0
  287. package/node_modules/@appport/schema/dist/builder.d.ts.map +1 -0
  288. package/node_modules/@appport/schema/dist/builder.js +278 -0
  289. package/node_modules/@appport/schema/dist/builder.js.map +1 -0
  290. package/node_modules/@appport/schema/dist/from-json-schema.d.ts +12 -0
  291. package/node_modules/@appport/schema/dist/from-json-schema.d.ts.map +1 -0
  292. package/node_modules/@appport/schema/dist/from-json-schema.js +186 -0
  293. package/node_modules/@appport/schema/dist/from-json-schema.js.map +1 -0
  294. package/node_modules/@appport/schema/dist/index.d.ts +23 -0
  295. package/node_modules/@appport/schema/dist/index.d.ts.map +1 -0
  296. package/node_modules/@appport/schema/dist/index.js +22 -0
  297. package/node_modules/@appport/schema/dist/index.js.map +1 -0
  298. package/node_modules/@appport/schema/dist/standard.d.ts +46 -0
  299. package/node_modules/@appport/schema/dist/standard.d.ts.map +1 -0
  300. package/node_modules/@appport/schema/dist/standard.js +42 -0
  301. package/node_modules/@appport/schema/dist/standard.js.map +1 -0
  302. package/node_modules/@appport/schema/dist/types.d.ts +40 -0
  303. package/node_modules/@appport/schema/dist/types.d.ts.map +1 -0
  304. package/node_modules/@appport/schema/dist/types.js +19 -0
  305. package/node_modules/@appport/schema/dist/types.js.map +1 -0
  306. package/node_modules/@appport/schema/package.json +28 -0
  307. package/node_modules/@appport/server/README.md +39 -0
  308. package/node_modules/@appport/server/dist/connection.d.ts +45 -0
  309. package/node_modules/@appport/server/dist/connection.d.ts.map +1 -0
  310. package/node_modules/@appport/server/dist/connection.js +217 -0
  311. package/node_modules/@appport/server/dist/connection.js.map +1 -0
  312. package/node_modules/@appport/server/dist/fetch.d.ts +10 -0
  313. package/node_modules/@appport/server/dist/fetch.d.ts.map +1 -0
  314. package/node_modules/@appport/server/dist/fetch.js +50 -0
  315. package/node_modules/@appport/server/dist/fetch.js.map +1 -0
  316. package/node_modules/@appport/server/dist/http.d.ts +80 -0
  317. package/node_modules/@appport/server/dist/http.d.ts.map +1 -0
  318. package/node_modules/@appport/server/dist/http.js +306 -0
  319. package/node_modules/@appport/server/dist/http.js.map +1 -0
  320. package/node_modules/@appport/server/dist/index.d.ts +11 -0
  321. package/node_modules/@appport/server/dist/index.d.ts.map +1 -0
  322. package/node_modules/@appport/server/dist/index.js +11 -0
  323. package/node_modules/@appport/server/dist/index.js.map +1 -0
  324. package/node_modules/@appport/server/dist/node-entry.d.ts +4 -0
  325. package/node_modules/@appport/server/dist/node-entry.d.ts.map +1 -0
  326. package/node_modules/@appport/server/dist/node-entry.js +4 -0
  327. package/node_modules/@appport/server/dist/node-entry.js.map +1 -0
  328. package/node_modules/@appport/server/dist/node.d.ts +45 -0
  329. package/node_modules/@appport/server/dist/node.d.ts.map +1 -0
  330. package/node_modules/@appport/server/dist/node.js +190 -0
  331. package/node_modules/@appport/server/dist/node.js.map +1 -0
  332. package/node_modules/@appport/server/dist/server.d.ts +83 -0
  333. package/node_modules/@appport/server/dist/server.d.ts.map +1 -0
  334. package/node_modules/@appport/server/dist/server.js +114 -0
  335. package/node_modules/@appport/server/dist/server.js.map +1 -0
  336. package/node_modules/@appport/server/dist/websocket.d.ts +25 -0
  337. package/node_modules/@appport/server/dist/websocket.d.ts.map +1 -0
  338. package/node_modules/@appport/server/dist/websocket.js +221 -0
  339. package/node_modules/@appport/server/dist/websocket.js.map +1 -0
  340. package/node_modules/@appport/server/package.json +34 -0
  341. package/node_modules/@appport/transport-electron/README.md +56 -0
  342. package/node_modules/@appport/transport-electron/dist/index.d.ts +11 -0
  343. package/node_modules/@appport/transport-electron/dist/index.d.ts.map +1 -0
  344. package/node_modules/@appport/transport-electron/dist/index.js +11 -0
  345. package/node_modules/@appport/transport-electron/dist/index.js.map +1 -0
  346. package/node_modules/@appport/transport-electron/dist/main.d.ts +31 -0
  347. package/node_modules/@appport/transport-electron/dist/main.d.ts.map +1 -0
  348. package/node_modules/@appport/transport-electron/dist/main.js +61 -0
  349. package/node_modules/@appport/transport-electron/dist/main.js.map +1 -0
  350. package/node_modules/@appport/transport-electron/dist/preload.d.ts +22 -0
  351. package/node_modules/@appport/transport-electron/dist/preload.d.ts.map +1 -0
  352. package/node_modules/@appport/transport-electron/dist/preload.js +29 -0
  353. package/node_modules/@appport/transport-electron/dist/preload.js.map +1 -0
  354. package/node_modules/@appport/transport-electron/dist/renderer.d.ts +16 -0
  355. package/node_modules/@appport/transport-electron/dist/renderer.d.ts.map +1 -0
  356. package/node_modules/@appport/transport-electron/dist/renderer.js +36 -0
  357. package/node_modules/@appport/transport-electron/dist/renderer.js.map +1 -0
  358. package/node_modules/@appport/transport-electron/dist/types.d.ts +49 -0
  359. package/node_modules/@appport/transport-electron/dist/types.d.ts.map +1 -0
  360. package/node_modules/@appport/transport-electron/dist/types.js +5 -0
  361. package/node_modules/@appport/transport-electron/dist/types.js.map +1 -0
  362. package/node_modules/@appport/transport-electron/package.json +46 -0
  363. package/node_modules/@appport/transport-http/README.md +24 -0
  364. package/node_modules/@appport/transport-http/dist/index.d.ts +18 -0
  365. package/node_modules/@appport/transport-http/dist/index.d.ts.map +1 -0
  366. package/node_modules/@appport/transport-http/dist/index.js +223 -0
  367. package/node_modules/@appport/transport-http/dist/index.js.map +1 -0
  368. package/node_modules/@appport/transport-http/package.json +29 -0
  369. package/node_modules/@appport/transport-inprocess/README.md +24 -0
  370. package/node_modules/@appport/transport-inprocess/dist/index.d.ts +16 -0
  371. package/node_modules/@appport/transport-inprocess/dist/index.d.ts.map +1 -0
  372. package/node_modules/@appport/transport-inprocess/dist/index.js +30 -0
  373. package/node_modules/@appport/transport-inprocess/dist/index.js.map +1 -0
  374. package/node_modules/@appport/transport-inprocess/package.json +30 -0
  375. package/node_modules/@appport/transport-tauri/README.md +45 -0
  376. package/node_modules/@appport/transport-tauri/dist/index.d.ts +23 -0
  377. package/node_modules/@appport/transport-tauri/dist/index.d.ts.map +1 -0
  378. package/node_modules/@appport/transport-tauri/dist/index.js +44 -0
  379. package/node_modules/@appport/transport-tauri/dist/index.js.map +1 -0
  380. package/node_modules/@appport/transport-tauri/package.json +29 -0
  381. package/node_modules/@appport/transport-websocket/README.md +22 -0
  382. package/node_modules/@appport/transport-websocket/dist/index.d.ts +26 -0
  383. package/node_modules/@appport/transport-websocket/dist/index.d.ts.map +1 -0
  384. package/node_modules/@appport/transport-websocket/dist/index.js +72 -0
  385. package/node_modules/@appport/transport-websocket/dist/index.js.map +1 -0
  386. package/node_modules/@appport/transport-websocket/package.json +29 -0
  387. package/package.json +79 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAuC,MAAM,mBAAmB,CAAC;AAY9F,MAAM,aAAa,GAAG,qFAAqF,CAAC;AAE5G,sDAAsD;AACtD,MAAM,UAAU,MAAM,CAAC,KAAgB,EAAE,KAAK,GAAG,CAAC;IAChD,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC3E,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;IAChF,MAAM,GAAG,GAA8B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,GAAG,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,KA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G,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClF,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC3G,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** Private bridge used by the bundled server workspace. Not re-exported by the SDK. */
2
+ export { AsyncChannel, type StreamExecution } from "./public.js";
3
+ export { toWireError } from "./sanitize.js";
4
+ export type { AppPortApplication } from "./application.js";
5
+ //# sourceMappingURL=server-internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-internal.d.ts","sourceRoot":"","sources":["../src/server-internal.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Private bridge used by the bundled server workspace. Not re-exported by the SDK. */
2
+ export { AsyncChannel } from "./public.js";
3
+ export { toWireError } from "./sanitize.js";
4
+ //# sourceMappingURL=server-internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-internal.js","sourceRoot":"","sources":["../src/server-internal.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAAE,YAAY,EAAwB,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { type Principal, type Session } from "@appport/protocol";
2
+ export interface CreateSessionInput {
3
+ applicationId: string;
4
+ principal?: Principal;
5
+ permissions?: readonly string[];
6
+ ttlMs?: number;
7
+ attributes?: Session["attributes"];
8
+ }
9
+ /**
10
+ * Session storage (specification §36). Sessions are transport-neutral: the same
11
+ * session may be observed over IPC and HTTP.
12
+ */
13
+ export interface SessionStore {
14
+ create(input: CreateSessionInput): Promise<Session>;
15
+ get(id: string): Promise<Session | undefined>;
16
+ /** Replaces a session record; used to refresh expiry or permissions. */
17
+ put(session: Session): Promise<void>;
18
+ delete(id: string): Promise<void>;
19
+ }
20
+ /** In-memory session store. The default for local runtimes and tests. */
21
+ export declare class MemorySessionStore implements SessionStore {
22
+ #private;
23
+ create(input: CreateSessionInput): Promise<Session>;
24
+ get(id: string): Promise<Session | undefined>;
25
+ put(session: Session): Promise<void>;
26
+ delete(id: string): Promise<void>;
27
+ get size(): number;
28
+ }
29
+ //# sourceMappingURL=sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../src/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjG,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACpD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;IAC9C,wEAAwE;IACxE,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED,yEAAyE;AACzE,qBAAa,kBAAmB,YAAW,YAAY;;IAG/C,MAAM,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAenD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAU7C,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
@@ -0,0 +1,39 @@
1
+ import { isSessionExpired, newSessionId } from "@appport/protocol";
2
+ /** In-memory session store. The default for local runtimes and tests. */
3
+ export class MemorySessionStore {
4
+ #sessions = new Map();
5
+ async create(input) {
6
+ const now = Date.now();
7
+ const session = {
8
+ id: newSessionId(),
9
+ applicationId: input.applicationId,
10
+ createdAt: new Date(now).toISOString(),
11
+ ...(input.principal ? { principal: input.principal } : {}),
12
+ ...(input.permissions ? { permissions: [...input.permissions] } : {}),
13
+ ...(input.ttlMs ? { expiresAt: new Date(now + input.ttlMs).toISOString() } : {}),
14
+ ...(input.attributes ? { attributes: input.attributes } : {})
15
+ };
16
+ this.#sessions.set(session.id, session);
17
+ return session;
18
+ }
19
+ async get(id) {
20
+ const session = this.#sessions.get(id);
21
+ if (!session)
22
+ return undefined;
23
+ if (isSessionExpired(session)) {
24
+ this.#sessions.delete(id);
25
+ return undefined;
26
+ }
27
+ return session;
28
+ }
29
+ async put(session) {
30
+ this.#sessions.set(session.id, session);
31
+ }
32
+ async delete(id) {
33
+ this.#sessions.delete(id);
34
+ }
35
+ get size() {
36
+ return this.#sessions.size;
37
+ }
38
+ }
39
+ //# sourceMappingURL=sessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.js","sourceRoot":"","sources":["../src/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAgC,MAAM,mBAAmB,CAAC;AAsBjG,yEAAyE;AACzE,MAAM,OAAO,kBAAkB;IACpB,SAAS,GAAG,IAAI,GAAG,EAAmB,CAAC;IAEhD,KAAK,CAAC,MAAM,CAAC,KAAyB;QACpC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,OAAO,GAAY;YACvB,EAAE,EAAE,YAAY,EAAE;YAClB,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,SAAS,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE;YACtC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1D,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAChF,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9D,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QACxC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAC/B,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC1B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,OAAgB;QACxB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC7B,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ /** Small synchronous SHA-256 used for canonical protocol fingerprints in every runtime. */
2
+ export declare function sha256(value: string): string;
3
+ //# sourceMappingURL=sha256.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256.d.ts","sourceRoot":"","sources":["../src/sha256.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAsB5C"}
@@ -0,0 +1,46 @@
1
+ /** Small synchronous SHA-256 used for canonical protocol fingerprints in every runtime. */
2
+ export function sha256(value) {
3
+ const bytes = new TextEncoder().encode(value);
4
+ const length = bytes.length;
5
+ const padded = new Uint8Array(((length + 9 + 63) >> 6) << 6);
6
+ padded.set(bytes);
7
+ padded[length] = 0x80;
8
+ const bits = length * 8;
9
+ const view = new DataView(padded.buffer);
10
+ view.setUint32(padded.length - 4, bits >>> 0);
11
+ view.setUint32(padded.length - 8, Math.floor(bits / 0x100000000));
12
+ const k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
13
+ const h = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];
14
+ const w = new Uint32Array(64);
15
+ const r = (x, n) => (x >>> n) | (x << (32 - n));
16
+ for (let offset = 0; offset < padded.length; offset += 64) {
17
+ for (let i = 0; i < 16; i++)
18
+ w[i] = view.getUint32(offset + i * 4);
19
+ for (let i = 16; i < 64; i++) {
20
+ const a = r(w[i - 15], 7) ^ r(w[i - 15], 18) ^ (w[i - 15] >>> 3), b = r(w[i - 2], 17) ^ r(w[i - 2], 19) ^ (w[i - 2] >>> 10);
21
+ w[i] = (w[i - 16] + a + w[i - 7] + b) >>> 0;
22
+ }
23
+ let [a, b, c, d, e, f, g, hh] = h;
24
+ for (let i = 0; i < 64; i++) {
25
+ const s1 = r(e, 6) ^ r(e, 11) ^ r(e, 25), ch = (e & f) ^ (~e & g), t1 = (hh + s1 + ch + k[i] + w[i]) >>> 0, s0 = r(a, 2) ^ r(a, 13) ^ r(a, 22), maj = (a & b) ^ (a & c) ^ (b & c), t2 = (s0 + maj) >>> 0;
26
+ hh = g;
27
+ g = f;
28
+ f = e;
29
+ e = (d + t1) >>> 0;
30
+ d = c;
31
+ c = b;
32
+ b = a;
33
+ a = (t1 + t2) >>> 0;
34
+ }
35
+ h[0] = (h[0] + a) >>> 0;
36
+ h[1] = (h[1] + b) >>> 0;
37
+ h[2] = (h[2] + c) >>> 0;
38
+ h[3] = (h[3] + d) >>> 0;
39
+ h[4] = (h[4] + e) >>> 0;
40
+ h[5] = (h[5] + f) >>> 0;
41
+ h[6] = (h[6] + g) >>> 0;
42
+ h[7] = (h[7] + hh) >>> 0;
43
+ }
44
+ return h.map(n => n.toString(16).padStart(8, "0")).join("");
45
+ }
46
+ //# sourceMappingURL=sha256.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256.js","sourceRoot":"","sources":["../src/sha256.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5B,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAClB,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAA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C,CAAC,GAAC,CAAC,EAAE,GAAC,EAAE,CAAC,KAAG,CAAC,CAAC;QAAC,CAAC;QAClQ,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAE,GAAC,CAAE,CAAC,KAAG,CAAC,CAAC;QAAC,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAE,GAAC,CAAE,CAAC,KAAG,CAAC,CAAC;QAAC,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAE,GAAC,CAAE,CAAC,KAAG,CAAC,CAAC;QAAC,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAE,GAAC,CAAE,CAAC,KAAG,CAAC,CAAC;QAAC,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAE,GAAC,CAAE,CAAC,KAAG,CAAC,CAAC;QAAC,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAE,GAAC,CAAE,CAAC,KAAG,CAAC,CAAC;QAAC,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAE,GAAC,CAAE,CAAC,KAAG,CAAC,CAAC;QAAC,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAE,GAAC,EAAG,CAAC,KAAG,CAAC,CAAC;IAC1K,CAAC;IACD,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Source Verification (F6)
3
+ *
4
+ * A repository URL is not verification. A source becomes eligible to provide an
5
+ * implementation only after it establishes, together:
6
+ *
7
+ * repository/source identity
8
+ * + verified commit/ref
9
+ * + appboundry.contract.json fingerprint
10
+ * + runtime implementation coverage
11
+ *
12
+ * Verification is provider-neutral: `sourceType = "repository"` is the AppPort
13
+ * concept, and a GitHub (or any other) adapter merely populates the fields.
14
+ */
15
+ import { type AppBoundryContractDocument } from "./appboundry-contract.js";
16
+ import { type AuthoritativeContract, type ContractAttestation, type CoverageEvaluation } from "./contract-attestation.js";
17
+ import { type RuntimeImplementationManifest } from "./runtime-manifest.js";
18
+ /** Evidence a source presents for verification. */
19
+ export interface RepositorySourceObservation {
20
+ readonly sourceType: "repository";
21
+ /** Provider-neutral source identity, e.g. "github/acme/tracker-history". */
22
+ readonly repositoryIdentity: string;
23
+ readonly ref?: string;
24
+ /** Verified commit. Without it the source is unverified by construction. */
25
+ readonly commitSha?: string;
26
+ /** Raw contents of `appboundry.contract.json`. */
27
+ readonly contractDocument: unknown;
28
+ /** Raw contents of the runtime implementation manifest. */
29
+ readonly runtimeManifest: unknown;
30
+ }
31
+ export type SourceVerificationFailure = "CONTRACT_DOCUMENT_INVALID" | "CONTRACT_DOCUMENT_NOT_A_CONTRACT" | "CONTRACT_DOCUMENT_FINGERPRINT_INVALID" | "CONTRACT_MISMATCH" | "IDENTITY_MISMATCH" | "RUNTIME_MANIFEST_INVALID" | "RUNTIME_MANIFEST_IS_A_CONTRACT" | "RUNTIME_MANIFEST_APPLICATION_MISMATCH" | "UNVERIFIED_SOURCE" | "NO_COVERED_CAPABILITY";
32
+ /** The outcome of verifying one source observation. */
33
+ export interface SourceVerification {
34
+ readonly verified: boolean;
35
+ readonly repositoryIdentity: string;
36
+ readonly ref?: string;
37
+ readonly verifiedCommitSha?: string;
38
+ readonly contract?: AppBoundryContractDocument;
39
+ readonly attestation?: ContractAttestation;
40
+ readonly runtime?: RuntimeImplementationManifest;
41
+ readonly coverage: CoverageEvaluation;
42
+ readonly failures: readonly SourceVerificationFailure[];
43
+ readonly reasons: readonly string[];
44
+ }
45
+ /**
46
+ * Verify a source observation against the authoritative application contract.
47
+ *
48
+ * The contract attestation and the implementation coverage are computed from
49
+ * two different documents on purpose: a contract mismatch can never be repaired
50
+ * by a runtime manifest that happens to look compatible.
51
+ */
52
+ export declare function verifySourceObservation(applicationId: string, observation: RepositorySourceObservation, authoritative: AuthoritativeContract, attestedAt?: string): SourceVerification;
53
+ //# sourceMappingURL=source-verification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-verification.d.ts","sourceRoot":"","sources":["../src/source-verification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAA2B,KAAK,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACpG,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAoE,KAAK,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAE7I,mDAAmD;AACnD,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC;IAClC,4EAA4E;IAC5E,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,kDAAkD;IAClD,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,2DAA2D;IAC3D,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,MAAM,yBAAyB,GACjC,2BAA2B,GAC3B,kCAAkC,GAClC,uCAAuC,GACvC,mBAAmB,GACnB,mBAAmB,GACnB,0BAA0B,GAC1B,gCAAgC,GAChC,uCAAuC,GACvC,mBAAmB,GACnB,uBAAuB,CAAC;AAE5B,uDAAuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,0BAA0B,CAAC;IAC/C,QAAQ,CAAC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,6BAA6B,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,SAAS,yBAAyB,EAAE,CAAC;IACxD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAID;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,2BAA2B,EACxC,aAAa,EAAE,qBAAqB,EACpC,UAAU,GAAE,MAAiC,GAC5C,kBAAkB,CAsEpB"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Source Verification (F6)
3
+ *
4
+ * A repository URL is not verification. A source becomes eligible to provide an
5
+ * implementation only after it establishes, together:
6
+ *
7
+ * repository/source identity
8
+ * + verified commit/ref
9
+ * + appboundry.contract.json fingerprint
10
+ * + runtime implementation coverage
11
+ *
12
+ * Verification is provider-neutral: `sourceType = "repository"` is the AppPort
13
+ * concept, and a GitHub (or any other) adapter merely populates the fields.
14
+ */
15
+ import { parseAppBoundryContract } from "./appboundry-contract.js";
16
+ import { attestAppBoundryContract, evaluateCoverage } from "./contract-attestation.js";
17
+ import { deriveImplementationCoverage, parseRuntimeImplementationManifest } from "./runtime-manifest.js";
18
+ const EMPTY_COVERAGE = { covered: [], undeclared: [], uncovered: [], reasons: [] };
19
+ /**
20
+ * Verify a source observation against the authoritative application contract.
21
+ *
22
+ * The contract attestation and the implementation coverage are computed from
23
+ * two different documents on purpose: a contract mismatch can never be repaired
24
+ * by a runtime manifest that happens to look compatible.
25
+ */
26
+ export function verifySourceObservation(applicationId, observation, authoritative, attestedAt = new Date().toISOString()) {
27
+ const failures = [];
28
+ const reasons = [];
29
+ if (observation.sourceType !== "repository") {
30
+ failures.push("UNVERIFIED_SOURCE");
31
+ reasons.push(`Unsupported source type "${String(observation.sourceType)}"`);
32
+ }
33
+ if (!observation.repositoryIdentity || !observation.repositoryIdentity.trim()) {
34
+ failures.push("UNVERIFIED_SOURCE");
35
+ reasons.push("A source identity is required");
36
+ }
37
+ if (!observation.commitSha || !observation.commitSha.trim()) {
38
+ failures.push("UNVERIFIED_SOURCE");
39
+ reasons.push("A verified commit is required: a source location alone is not verification");
40
+ }
41
+ let contract;
42
+ try {
43
+ contract = parseAppBoundryContract(observation.contractDocument);
44
+ }
45
+ catch (error) {
46
+ const code = error.code ?? "CONTRACT_DOCUMENT_INVALID";
47
+ failures.push(code);
48
+ reasons.push(error instanceof Error ? error.message : String(error));
49
+ }
50
+ let runtime;
51
+ try {
52
+ runtime = parseRuntimeImplementationManifest(observation.runtimeManifest);
53
+ if (runtime.applicationId !== applicationId) {
54
+ runtime = undefined;
55
+ failures.push("RUNTIME_MANIFEST_APPLICATION_MISMATCH");
56
+ reasons.push("The runtime implementation manifest references a different application");
57
+ }
58
+ }
59
+ catch (error) {
60
+ const code = error.code ?? "RUNTIME_MANIFEST_INVALID";
61
+ failures.push(code);
62
+ reasons.push(error instanceof Error ? error.message : String(error));
63
+ }
64
+ const attestation = contract ? attestAppBoundryContract(applicationId, contract, authoritative, attestedAt) : undefined;
65
+ if (attestation && attestation.status !== "verified") {
66
+ failures.push(attestation.status);
67
+ reasons.push(...attestation.reasons);
68
+ }
69
+ // Coverage is derived from the runtime manifest and validated against the
70
+ // authoritative contract; it is never derived from the contract document.
71
+ const coverage = runtime ? evaluateCoverage(deriveImplementationCoverage(runtime), authoritative) : EMPTY_COVERAGE;
72
+ reasons.push(...coverage.reasons);
73
+ // Undeclared coverage is dropped, not fatal: a source may still implement the
74
+ // capabilities the contract does declare (F6.6).
75
+ if (runtime && coverage.covered.length === 0) {
76
+ failures.push("NO_COVERED_CAPABILITY");
77
+ reasons.push("The source implements no capability declared by the application contract");
78
+ }
79
+ return {
80
+ verified: failures.length === 0,
81
+ repositoryIdentity: observation.repositoryIdentity,
82
+ ...(observation.ref ? { ref: observation.ref } : {}),
83
+ ...(observation.commitSha ? { verifiedCommitSha: observation.commitSha } : {}),
84
+ ...(contract ? { contract } : {}),
85
+ ...(attestation ? { attestation } : {}),
86
+ ...(runtime ? { runtime } : {}),
87
+ coverage,
88
+ failures,
89
+ reasons
90
+ };
91
+ }
92
+ //# sourceMappingURL=source-verification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-verification.js","sourceRoot":"","sources":["../src/source-verification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,uBAAuB,EAAmC,MAAM,0BAA0B,CAAC;AACpG,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAIjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,4BAA4B,EAAE,kCAAkC,EAAsC,MAAM,uBAAuB,CAAC;AA0C7I,MAAM,cAAc,GAAuB,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAEvG;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,aAAqB,EACrB,WAAwC,EACxC,aAAoC,EACpC,aAAqB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;IAE7C,MAAM,QAAQ,GAAgC,EAAE,CAAC;IACjD,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,IAAI,WAAW,CAAC,UAAU,KAAK,YAAY,EAAE,CAAC;QAC5C,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QACnC,OAAO,CAAC,IAAI,CAAC,4BAA4B,MAAM,CAAC,WAAW,CAAC,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AG,EAAE,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpD,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9E,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,QAAQ;QACR,QAAQ;QACR,OAAO;KACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,312 @@
1
+ /**
2
+ * Application State Context & Transaction (PR27)
3
+ *
4
+ * Establishes the invariant:
5
+ * WASM execution is ephemeral; application state is durable.
6
+ *
7
+ * The ApplicationStateContext is the contract available to one invocation.
8
+ * It provides typed state access with isolation, authorization, and transaction semantics.
9
+ *
10
+ * State is scoped to:
11
+ * - Application identity (owns the state)
12
+ * - Invocation identity (unique per execution)
13
+ * - Transaction identity (unique per invocation)
14
+ *
15
+ * State operations:
16
+ * - get(key): Read value, observing transaction writes
17
+ * - set(key, value): Write value, isolated until commit
18
+ * - delete(key): Remove value, isolated until commit
19
+ * - query(pattern): Search state by key pattern
20
+ *
21
+ * Transaction lifecycle:
22
+ * - OPEN: Accepts reads and writes
23
+ * - COMMITTED: Durable, no mutations allowed
24
+ * - ABORTED: Discarded, no mutations allowed
25
+ */
26
+ /**
27
+ * Execution-facing state context for one invocation.
28
+ *
29
+ * Represents the contract between the host and guest for accessing
30
+ * application durable state within a transactional boundary.
31
+ *
32
+ * The context is scoped to exactly one invocation and its transaction.
33
+ */
34
+ export interface ApplicationStateContext {
35
+ /**
36
+ * Unique identifier for this state context.
37
+ * Matches the invocation's transaction ID.
38
+ */
39
+ readonly transactionId: string;
40
+ /**
41
+ * The application that owns this state.
42
+ */
43
+ readonly applicationId: string;
44
+ /**
45
+ * The invocation accessing this state.
46
+ */
47
+ readonly invocationId: string;
48
+ /**
49
+ * Read a state value by key.
50
+ *
51
+ * Reads observe the transaction's current view:
52
+ * - Values written in this transaction are visible
53
+ * - Values from prior committed transactions are visible
54
+ * - Aborted transactions' writes are never visible
55
+ *
56
+ * @param key The state key to read
57
+ * @returns The state value, or undefined if not found
58
+ * @throws StateOperationError if authorization denies read
59
+ * @throws TransactionStateError if transaction is not OPEN
60
+ */
61
+ get(key: string): Promise<unknown>;
62
+ /**
63
+ * Write a state value by key.
64
+ *
65
+ * Writes are isolated to this transaction:
66
+ * - Visible to subsequent reads in this transaction
67
+ * - Not visible to other concurrent transactions until this commits
68
+ * - Discarded if this transaction aborts
69
+ *
70
+ * @param key The state key to write
71
+ * @param value The value to write (serializable)
72
+ * @throws StateOperationError if authorization denies write
73
+ * @throws TransactionStateError if transaction is not OPEN
74
+ * @throws InvalidValueError if value is not serializable
75
+ */
76
+ set(key: string, value: unknown): Promise<void>;
77
+ /**
78
+ * Delete a state value by key.
79
+ *
80
+ * Deletion is isolated to this transaction:
81
+ * - Subsequent reads in this transaction won't find the key
82
+ * - Not visible to other transactions until this commits
83
+ * - Discarded if this transaction aborts
84
+ *
85
+ * @param key The state key to delete
86
+ * @throws StateOperationError if authorization denies delete
87
+ * @throws TransactionStateError if transaction is not OPEN
88
+ */
89
+ delete(key: string): Promise<void>;
90
+ /**
91
+ * Query state entries by key pattern.
92
+ *
93
+ * Returns entries matching a key prefix or pattern,
94
+ * observing the transaction's current writes.
95
+ *
96
+ * @param pattern Key prefix or query pattern
97
+ * @param limit Optional result limit (default 100, max 1000)
98
+ * @returns Array of matching entries [{ key, value }, ...]
99
+ * @throws StateOperationError if authorization denies read
100
+ * @throws TransactionStateError if transaction is not OPEN
101
+ */
102
+ query(pattern: string, limit?: number): Promise<readonly {
103
+ key: string;
104
+ value: unknown;
105
+ }[]>;
106
+ }
107
+ /**
108
+ * Application state transaction lifecycle.
109
+ *
110
+ * Explicit state machine:
111
+ * OPEN → COMMITTED
112
+ * → ABORTED
113
+ *
114
+ * Invariants:
115
+ * - Transition to COMMITTED or ABORTED is explicit
116
+ * - No implicit auto-commit
117
+ * - Committed transactions cannot be mutated
118
+ * - Aborted transactions cannot be mutated
119
+ * - Both commit and abort are idempotent
120
+ * - Transaction identity is unique per invocation
121
+ */
122
+ export declare enum ApplicationStateTransactionState {
123
+ /**
124
+ * Transaction is open and accepting operations.
125
+ * Reads and writes are allowed.
126
+ */
127
+ OPEN = "OPEN",
128
+ /**
129
+ * Transaction has been committed durably.
130
+ * All writes are now visible to subsequent transactions.
131
+ * No further mutations are allowed.
132
+ */
133
+ COMMITTED = "COMMITTED",
134
+ /**
135
+ * Transaction has been aborted.
136
+ * All writes have been discarded.
137
+ * No further mutations are allowed.
138
+ */
139
+ ABORTED = "ABORTED"
140
+ }
141
+ /**
142
+ * Application state transaction.
143
+ *
144
+ * Represents an atomic unit of state mutations scoped to one invocation.
145
+ *
146
+ * The transaction:
147
+ * - Starts in OPEN state
148
+ * - Accepts reads and writes in OPEN state
149
+ * - Transitions to COMMITTED or ABORTED explicitly
150
+ * - Never reverts once committed or aborted
151
+ * - Is idempotent (commit/abort can be called multiple times safely)
152
+ *
153
+ * CRITICAL: There is no auto-commit. The host is responsible for
154
+ * explicit commit or abort based on execution outcome.
155
+ */
156
+ export interface ApplicationStateTransaction {
157
+ /**
158
+ * Unique transaction identifier.
159
+ * Scoped to one invocation.
160
+ */
161
+ readonly transactionId: string;
162
+ /**
163
+ * Current transaction state.
164
+ */
165
+ readonly state: ApplicationStateTransactionState;
166
+ /**
167
+ * The application ID this transaction belongs to.
168
+ */
169
+ readonly applicationId: string;
170
+ /**
171
+ * The invocation ID this transaction serves.
172
+ */
173
+ readonly invocationId: string;
174
+ /**
175
+ * Commit this transaction durably.
176
+ *
177
+ * Transitions from OPEN to COMMITTED.
178
+ * All writes become visible to subsequent transactions.
179
+ *
180
+ * Effects:
181
+ * - OPEN state: transition to COMMITTED, persist writes
182
+ * - COMMITTED state: idempotent, no-op
183
+ * - ABORTED state: error, cannot commit after abort
184
+ *
185
+ * @returns Promise that resolves when commit is durable
186
+ * @throws TransactionStateError if already ABORTED
187
+ * @throws CommitFailureError if persistence fails
188
+ */
189
+ commit(): Promise<void>;
190
+ /**
191
+ * Abort this transaction.
192
+ *
193
+ * Transitions from OPEN to ABORTED.
194
+ * All writes are discarded and never visible to other transactions.
195
+ *
196
+ * Effects:
197
+ * - OPEN state: transition to ABORTED, discard writes
198
+ * - ABORTED state: idempotent, no-op
199
+ * - COMMITTED state: error, cannot abort after commit
200
+ *
201
+ * @returns Promise that resolves when abort is complete
202
+ * @throws TransactionStateError if already COMMITTED
203
+ */
204
+ abort(): Promise<void>;
205
+ }
206
+ /**
207
+ * State operation error: operation rejected by authorization or state.
208
+ */
209
+ export declare class StateOperationError extends Error {
210
+ readonly message: string;
211
+ readonly code: "unauthorized" | "not_found" | "already_exists" | "invalid_key" | "other";
212
+ constructor(message: string, code?: "unauthorized" | "not_found" | "already_exists" | "invalid_key" | "other");
213
+ }
214
+ /**
215
+ * Transaction state error: operation attempted in wrong transaction state.
216
+ */
217
+ export declare class TransactionStateError extends Error {
218
+ readonly currentState: ApplicationStateTransactionState;
219
+ readonly attemptedOperation: string;
220
+ constructor(currentState: ApplicationStateTransactionState, attemptedOperation: string);
221
+ }
222
+ /**
223
+ * Commit failure error: transaction commit failed.
224
+ */
225
+ export declare class CommitFailureError extends Error {
226
+ readonly transactionId: string;
227
+ readonly message: string;
228
+ constructor(transactionId: string, message: string);
229
+ }
230
+ /**
231
+ * State capability authorization.
232
+ *
233
+ * Defines the state operations an application is authorized to perform.
234
+ * Authorization is checked at the host boundary before any FeltDB operation.
235
+ *
236
+ * The absence of an authorization grants deny-by-default.
237
+ */
238
+ export interface StateCapabilityAuthorization {
239
+ /**
240
+ * Application can read state.
241
+ * Allows: get(), query()
242
+ */
243
+ readonly read?: boolean;
244
+ /**
245
+ * Application can write state.
246
+ * Allows: set()
247
+ */
248
+ readonly write?: boolean;
249
+ /**
250
+ * Application can delete state.
251
+ * Allows: delete()
252
+ */
253
+ readonly delete?: boolean;
254
+ /**
255
+ * Application can query state.
256
+ * Allows: query()
257
+ */
258
+ readonly query?: boolean;
259
+ }
260
+ /**
261
+ * Application state store: abstracts the durable state implementation.
262
+ *
263
+ * Stores application data (key-value pairs) that belong to applications,
264
+ * separate from ApplicationState (which stores app metadata/registration).
265
+ *
266
+ * The store:
267
+ * - Creates transactions scoped to invocations
268
+ * - Persists state durably
269
+ * - Enforces isolation between transactions
270
+ * - Manages transaction lifecycle
271
+ *
272
+ * Implementation examples:
273
+ * - FeltDbApplicationDataStore (real FeltDB)
274
+ * - MemoryApplicationDataStore (for testing)
275
+ *
276
+ * Do NOT implement in-memory fakes in production paths.
277
+ */
278
+ export interface ApplicationDataStore {
279
+ /**
280
+ * Create a new transaction for an invocation.
281
+ *
282
+ * @param options Transaction creation options
283
+ * @returns A new OPEN transaction
284
+ */
285
+ createTransaction(options: CreateTransactionOptions): Promise<ApplicationStateTransaction>;
286
+ /**
287
+ * Get an existing transaction by ID.
288
+ *
289
+ * @param transactionId The transaction to retrieve
290
+ * @returns The transaction, or undefined if not found
291
+ */
292
+ getTransaction(transactionId: string): Promise<ApplicationStateTransaction | undefined>;
293
+ }
294
+ /**
295
+ * Options for creating a new state transaction.
296
+ */
297
+ export interface CreateTransactionOptions {
298
+ /**
299
+ * The application owning this state.
300
+ */
301
+ readonly applicationId: string;
302
+ /**
303
+ * The invocation using this transaction.
304
+ */
305
+ readonly invocationId: string;
306
+ /**
307
+ * State capability authorization for this invocation.
308
+ * If undefined, all operations are denied.
309
+ */
310
+ readonly authorization?: StateCapabilityAuthorization;
311
+ }
312
+ //# sourceMappingURL=state-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3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