@astrale-os/sdk 0.4.11 → 0.4.13

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 (331) hide show
  1. package/dist/auth/authenticate.d.ts +1 -1
  2. package/dist/auth/authenticate.d.ts.map +1 -1
  3. package/dist/auth/authenticate.js +2 -2
  4. package/dist/auth/authenticate.js.map +1 -1
  5. package/dist/auth/check.js +1 -1
  6. package/dist/auth/check.js.map +1 -1
  7. package/dist/auth/function-context.d.ts +1 -1
  8. package/dist/auth/function-context.d.ts.map +1 -1
  9. package/dist/auth/function-context.js +3 -3
  10. package/dist/auth/function-context.js.map +1 -1
  11. package/dist/auth/index.d.ts +15 -15
  12. package/dist/auth/index.d.ts.map +1 -1
  13. package/dist/auth/index.js +10 -10
  14. package/dist/auth/index.js.map +1 -1
  15. package/dist/auth/issuer-mint.d.ts +1 -1
  16. package/dist/auth/issuer-mint.d.ts.map +1 -1
  17. package/dist/auth/issuer-mint.js +2 -2
  18. package/dist/auth/issuer-mint.js.map +1 -1
  19. package/dist/auth/kernel-client.d.ts +1 -1
  20. package/dist/auth/kernel-client.d.ts.map +1 -1
  21. package/dist/auth/kernel-client.js +2 -2
  22. package/dist/auth/kernel-client.js.map +1 -1
  23. package/dist/auth/resolve.d.ts +2 -2
  24. package/dist/auth/resolve.d.ts.map +1 -1
  25. package/dist/auth/resolve.js +2 -2
  26. package/dist/auth/resolve.js.map +1 -1
  27. package/dist/auth/verify.d.ts +1 -1
  28. package/dist/auth/verify.d.ts.map +1 -1
  29. package/dist/auth/verify.js +2 -2
  30. package/dist/auth/verify.js.map +1 -1
  31. package/dist/cli/bin.js +1 -1
  32. package/dist/cli/bin.js.map +1 -1
  33. package/dist/cli/index.d.ts +2 -2
  34. package/dist/cli/index.d.ts.map +1 -1
  35. package/dist/cli/index.js +2 -2
  36. package/dist/cli/index.js.map +1 -1
  37. package/dist/cli/publish.js +1 -1
  38. package/dist/cli/publish.js.map +1 -1
  39. package/dist/cli/run.d.ts +9 -3
  40. package/dist/cli/run.d.ts.map +1 -1
  41. package/dist/cli/run.js +55 -5
  42. package/dist/cli/run.js.map +1 -1
  43. package/dist/cli/spec.d.ts +1 -1
  44. package/dist/cli/spec.d.ts.map +1 -1
  45. package/dist/cli/spec.js +1 -1
  46. package/dist/cli/spec.js.map +1 -1
  47. package/dist/config/define-domain.d.ts +2 -2
  48. package/dist/config/define-domain.d.ts.map +1 -1
  49. package/dist/config/deploy.d.ts +2 -2
  50. package/dist/config/deploy.d.ts.map +1 -1
  51. package/dist/config/index.d.ts +6 -6
  52. package/dist/config/index.d.ts.map +1 -1
  53. package/dist/config/index.js +3 -3
  54. package/dist/config/index.js.map +1 -1
  55. package/dist/define/index.d.ts +4 -4
  56. package/dist/define/index.d.ts.map +1 -1
  57. package/dist/define/index.js +2 -2
  58. package/dist/define/index.js.map +1 -1
  59. package/dist/define/remote-function.d.ts +7 -5
  60. package/dist/define/remote-function.d.ts.map +1 -1
  61. package/dist/define/remote-function.js.map +1 -1
  62. package/dist/define/view.d.ts +3 -3
  63. package/dist/define/view.d.ts.map +1 -1
  64. package/dist/deploy/check.d.ts +1 -1
  65. package/dist/deploy/check.d.ts.map +1 -1
  66. package/dist/deploy/check.js +1 -1
  67. package/dist/deploy/check.js.map +1 -1
  68. package/dist/deploy/index.d.ts +2 -2
  69. package/dist/deploy/index.d.ts.map +1 -1
  70. package/dist/deploy/index.js +2 -2
  71. package/dist/deploy/index.js.map +1 -1
  72. package/dist/dispatch/authorize.js +1 -1
  73. package/dist/dispatch/authorize.js.map +1 -1
  74. package/dist/dispatch/dispatcher.d.ts +11 -21
  75. package/dist/dispatch/dispatcher.d.ts.map +1 -1
  76. package/dist/dispatch/dispatcher.js +66 -65
  77. package/dist/dispatch/dispatcher.js.map +1 -1
  78. package/dist/dispatch/execute.d.ts +7 -6
  79. package/dist/dispatch/execute.d.ts.map +1 -1
  80. package/dist/dispatch/execute.js +1 -0
  81. package/dist/dispatch/execute.js.map +1 -1
  82. package/dist/dispatch/identity.d.ts +2 -2
  83. package/dist/dispatch/identity.d.ts.map +1 -1
  84. package/dist/dispatch/index.d.ts +6 -6
  85. package/dist/dispatch/index.d.ts.map +1 -1
  86. package/dist/dispatch/index.js +6 -6
  87. package/dist/dispatch/index.js.map +1 -1
  88. package/dist/dispatch/resolve.d.ts +1 -1
  89. package/dist/dispatch/resolve.d.ts.map +1 -1
  90. package/dist/dispatch/self.d.ts +1 -1
  91. package/dist/dispatch/self.d.ts.map +1 -1
  92. package/dist/domain/build-spec.d.ts +1 -1
  93. package/dist/domain/build-spec.d.ts.map +1 -1
  94. package/dist/domain/build-spec.js +2 -2
  95. package/dist/domain/build-spec.js.map +1 -1
  96. package/dist/domain/contract.d.ts +1 -1
  97. package/dist/domain/contract.d.ts.map +1 -1
  98. package/dist/domain/define.d.ts +4 -4
  99. package/dist/domain/define.d.ts.map +1 -1
  100. package/dist/domain/define.js +2 -2
  101. package/dist/domain/define.js.map +1 -1
  102. package/dist/domain/extend-functions.d.ts +1 -1
  103. package/dist/domain/extend-functions.d.ts.map +1 -1
  104. package/dist/domain/extend-functions.js +1 -1
  105. package/dist/domain/extend-functions.js.map +1 -1
  106. package/dist/domain/extend-views.d.ts +1 -1
  107. package/dist/domain/extend-views.d.ts.map +1 -1
  108. package/dist/domain/extend-views.js +1 -1
  109. package/dist/domain/extend-views.js.map +1 -1
  110. package/dist/domain/index.d.ts +4 -4
  111. package/dist/domain/index.d.ts.map +1 -1
  112. package/dist/domain/index.js +3 -3
  113. package/dist/domain/index.js.map +1 -1
  114. package/dist/index.d.ts +19 -19
  115. package/dist/index.d.ts.map +1 -1
  116. package/dist/index.js +10 -10
  117. package/dist/index.js.map +1 -1
  118. package/dist/linter/analyze.d.ts +6 -0
  119. package/dist/linter/analyze.d.ts.map +1 -0
  120. package/dist/linter/analyze.js +12 -0
  121. package/dist/linter/analyze.js.map +1 -0
  122. package/dist/linter/diagnostic.d.ts +32 -0
  123. package/dist/linter/diagnostic.d.ts.map +1 -0
  124. package/dist/linter/diagnostic.js +35 -0
  125. package/dist/linter/diagnostic.js.map +1 -0
  126. package/dist/linter/index.d.ts +10 -0
  127. package/dist/linter/index.d.ts.map +1 -0
  128. package/dist/linter/index.js +6 -0
  129. package/dist/linter/index.js.map +1 -0
  130. package/dist/linter/lint.d.ts +8 -0
  131. package/dist/linter/lint.d.ts.map +1 -0
  132. package/dist/linter/lint.js +26 -0
  133. package/dist/linter/lint.js.map +1 -0
  134. package/dist/linter/oxlint/config.d.ts +14 -0
  135. package/dist/linter/oxlint/config.d.ts.map +1 -0
  136. package/dist/linter/oxlint/config.js +18 -0
  137. package/dist/linter/oxlint/config.js.map +1 -0
  138. package/dist/linter/oxlint/plugin.d.ts +13 -0
  139. package/dist/linter/oxlint/plugin.d.ts.map +1 -0
  140. package/dist/linter/oxlint/plugin.js +14 -0
  141. package/dist/linter/oxlint/plugin.js.map +1 -0
  142. package/dist/linter/oxlint/run.d.ts +7 -0
  143. package/dist/linter/oxlint/run.d.ts.map +1 -0
  144. package/dist/linter/oxlint/run.js +122 -0
  145. package/dist/linter/oxlint/run.js.map +1 -0
  146. package/dist/linter/preflight.d.ts +2 -0
  147. package/dist/linter/preflight.d.ts.map +1 -0
  148. package/dist/linter/preflight.js +162 -0
  149. package/dist/linter/preflight.js.map +1 -0
  150. package/dist/linter/project.d.ts +12 -0
  151. package/dist/linter/project.d.ts.map +1 -0
  152. package/dist/linter/project.js +88 -0
  153. package/dist/linter/project.js.map +1 -0
  154. package/dist/linter/report.d.ts +4 -0
  155. package/dist/linter/report.d.ts.map +1 -0
  156. package/dist/linter/report.js +22 -0
  157. package/dist/linter/report.js.map +1 -0
  158. package/dist/linter/rules/catalog.d.ts +56 -0
  159. package/dist/linter/rules/catalog.d.ts.map +1 -0
  160. package/dist/linter/rules/catalog.js +53 -0
  161. package/dist/linter/rules/catalog.js.map +1 -0
  162. package/dist/linter/rules/core-has-no-async.d.ts +3 -0
  163. package/dist/linter/rules/core-has-no-async.d.ts.map +1 -0
  164. package/dist/linter/rules/core-has-no-async.js +43 -0
  165. package/dist/linter/rules/core-has-no-async.js.map +1 -0
  166. package/dist/linter/rules/core-is-pure.d.ts +3 -0
  167. package/dist/linter/rules/core-is-pure.d.ts.map +1 -0
  168. package/dist/linter/rules/core-is-pure.js +74 -0
  169. package/dist/linter/rules/core-is-pure.js.map +1 -0
  170. package/dist/linter/rules/no-nested-steps.d.ts +3 -0
  171. package/dist/linter/rules/no-nested-steps.d.ts.map +1 -0
  172. package/dist/linter/rules/no-nested-steps.js +32 -0
  173. package/dist/linter/rules/no-nested-steps.js.map +1 -0
  174. package/dist/linter/rules/no-read-inside-mutate.d.ts +3 -0
  175. package/dist/linter/rules/no-read-inside-mutate.d.ts.map +1 -0
  176. package/dist/linter/rules/no-read-inside-mutate.js +64 -0
  177. package/dist/linter/rules/no-read-inside-mutate.js.map +1 -0
  178. package/dist/linter/rules/one-remote-definition-per-file.d.ts +3 -0
  179. package/dist/linter/rules/one-remote-definition-per-file.d.ts.map +1 -0
  180. package/dist/linter/rules/one-remote-definition-per-file.js +23 -0
  181. package/dist/linter/rules/one-remote-definition-per-file.js.map +1 -0
  182. package/dist/linter/rules/oxlint-ast.d.ts +30 -0
  183. package/dist/linter/rules/oxlint-ast.d.ts.map +1 -0
  184. package/dist/linter/rules/oxlint-ast.js +104 -0
  185. package/dist/linter/rules/oxlint-ast.js.map +1 -0
  186. package/dist/linter/rules/oxlint-rule.d.ts +45 -0
  187. package/dist/linter/rules/oxlint-rule.d.ts.map +1 -0
  188. package/dist/linter/rules/oxlint-rule.js +2 -0
  189. package/dist/linter/rules/oxlint-rule.js.map +1 -0
  190. package/dist/linter/rules/project-rule.d.ts +10 -0
  191. package/dist/linter/rules/project-rule.d.ts.map +1 -0
  192. package/dist/linter/rules/project-rule.js +24 -0
  193. package/dist/linter/rules/project-rule.js.map +1 -0
  194. package/dist/linter/rules/thin-schema-composition-root.d.ts +3 -0
  195. package/dist/linter/rules/thin-schema-composition-root.d.ts.map +1 -0
  196. package/dist/linter/rules/thin-schema-composition-root.js +23 -0
  197. package/dist/linter/rules/thin-schema-composition-root.js.map +1 -0
  198. package/dist/linter/source.d.ts +24 -0
  199. package/dist/linter/source.d.ts.map +1 -0
  200. package/dist/linter/source.js +279 -0
  201. package/dist/linter/source.js.map +1 -0
  202. package/dist/linter/suppression.d.ts +3 -0
  203. package/dist/linter/suppression.d.ts.map +1 -0
  204. package/dist/linter/suppression.js +11 -0
  205. package/dist/linter/suppression.js.map +1 -0
  206. package/dist/method/class.d.ts +3 -3
  207. package/dist/method/class.d.ts.map +1 -1
  208. package/dist/method/context.d.ts +6 -4
  209. package/dist/method/context.d.ts.map +1 -1
  210. package/dist/method/index.d.ts +5 -5
  211. package/dist/method/index.d.ts.map +1 -1
  212. package/dist/method/index.js +2 -2
  213. package/dist/method/index.js.map +1 -1
  214. package/dist/method/single.d.ts +2 -2
  215. package/dist/method/single.d.ts.map +1 -1
  216. package/dist/server/auxiliary-routes.d.ts +3 -3
  217. package/dist/server/auxiliary-routes.d.ts.map +1 -1
  218. package/dist/server/auxiliary-routes.js +11 -11
  219. package/dist/server/auxiliary-routes.js.map +1 -1
  220. package/dist/server/config.d.ts +1 -1
  221. package/dist/server/config.d.ts.map +1 -1
  222. package/dist/server/create.d.ts +2 -2
  223. package/dist/server/create.d.ts.map +1 -1
  224. package/dist/server/create.js +11 -11
  225. package/dist/server/create.js.map +1 -1
  226. package/dist/server/domain-entry.d.ts +5 -5
  227. package/dist/server/domain-entry.d.ts.map +1 -1
  228. package/dist/server/domain-entry.js +2 -2
  229. package/dist/server/domain-entry.js.map +1 -1
  230. package/dist/server/index.d.ts +11 -11
  231. package/dist/server/index.d.ts.map +1 -1
  232. package/dist/server/index.js +7 -7
  233. package/dist/server/index.js.map +1 -1
  234. package/dist/server/start.d.ts +1 -1
  235. package/dist/server/start.d.ts.map +1 -1
  236. package/dist/server/start.js.map +1 -1
  237. package/dist/server/worker-entry.d.ts +1 -1
  238. package/dist/server/worker-entry.d.ts.map +1 -1
  239. package/dist/server/worker-entry.js +3 -3
  240. package/dist/server/worker-entry.js.map +1 -1
  241. package/dist/step/index.d.ts +4 -4
  242. package/dist/step/index.d.ts.map +1 -1
  243. package/dist/step/index.js +2 -2
  244. package/dist/step/index.js.map +1 -1
  245. package/dist/step/inline.d.ts +1 -1
  246. package/dist/step/inline.d.ts.map +1 -1
  247. package/dist/step/inline.js +1 -1
  248. package/dist/step/inline.js.map +1 -1
  249. package/package.json +29 -8
  250. package/src/auth/authenticate.ts +3 -3
  251. package/src/auth/check.ts +1 -1
  252. package/src/auth/function-context.ts +4 -4
  253. package/src/auth/index.ts +15 -15
  254. package/src/auth/issuer-mint.ts +3 -3
  255. package/src/auth/kernel-client.ts +3 -3
  256. package/src/auth/resolve.ts +4 -4
  257. package/src/auth/verify.ts +3 -3
  258. package/src/cli/bin.ts +1 -1
  259. package/src/cli/index.ts +2 -2
  260. package/src/cli/publish.ts +1 -1
  261. package/src/cli/run.ts +59 -8
  262. package/src/cli/spec.ts +3 -3
  263. package/src/config/define-domain.ts +2 -2
  264. package/src/config/deploy.ts +2 -2
  265. package/src/config/index.ts +6 -6
  266. package/src/define/index.ts +4 -4
  267. package/src/define/remote-function.ts +7 -5
  268. package/src/define/view.ts +3 -3
  269. package/src/deploy/check.ts +2 -2
  270. package/src/deploy/index.ts +2 -2
  271. package/src/dispatch/authorize.ts +1 -1
  272. package/src/dispatch/dispatcher.ts +76 -83
  273. package/src/dispatch/execute.ts +8 -6
  274. package/src/dispatch/identity.ts +2 -2
  275. package/src/dispatch/index.ts +6 -6
  276. package/src/dispatch/resolve.ts +1 -1
  277. package/src/dispatch/self.ts +1 -1
  278. package/src/domain/build-spec.ts +4 -4
  279. package/src/domain/contract.ts +1 -1
  280. package/src/domain/define.ts +6 -6
  281. package/src/domain/extend-functions.ts +2 -2
  282. package/src/domain/extend-views.ts +2 -2
  283. package/src/domain/index.ts +4 -4
  284. package/src/index.ts +20 -20
  285. package/src/linter/analyze.ts +17 -0
  286. package/src/linter/diagnostic.ts +68 -0
  287. package/src/linter/docs/DIAGNOSTICS.md +47 -0
  288. package/src/linter/docs/JUDGMENT.md +81 -0
  289. package/src/linter/docs/PRINCIPLES.md +97 -0
  290. package/src/linter/docs/README.md +38 -0
  291. package/src/linter/docs/RULE-AUTHORING.md +144 -0
  292. package/src/linter/docs/RULES.md +153 -0
  293. package/src/linter/index.ts +14 -0
  294. package/src/linter/lint.ts +32 -0
  295. package/src/linter/oxlint/astrale-ox.d.ts +5 -0
  296. package/src/linter/oxlint/config.ts +19 -0
  297. package/src/linter/oxlint/plugin.js +16 -0
  298. package/src/linter/oxlint/run.ts +162 -0
  299. package/src/linter/preflight.ts +181 -0
  300. package/src/linter/project.ts +108 -0
  301. package/src/linter/report.ts +25 -0
  302. package/src/linter/rules/catalog.ts +67 -0
  303. package/src/linter/rules/core-has-no-async.js +43 -0
  304. package/src/linter/rules/core-is-pure.ts +103 -0
  305. package/src/linter/rules/no-nested-steps.js +37 -0
  306. package/src/linter/rules/no-read-inside-mutate.js +72 -0
  307. package/src/linter/rules/one-remote-definition-per-file.ts +29 -0
  308. package/src/linter/rules/oxlint-ast.js +110 -0
  309. package/src/linter/rules/oxlint-rule.ts +35 -0
  310. package/src/linter/rules/project-rule.ts +37 -0
  311. package/src/linter/rules/thin-schema-composition-root.ts +26 -0
  312. package/src/linter/source.ts +323 -0
  313. package/src/linter/suppression.ts +11 -0
  314. package/src/method/class.ts +3 -3
  315. package/src/method/context.ts +6 -4
  316. package/src/method/index.ts +5 -5
  317. package/src/method/single.ts +2 -2
  318. package/src/server/auxiliary-routes.ts +22 -17
  319. package/src/server/config.ts +1 -1
  320. package/src/server/create.ts +15 -15
  321. package/src/server/domain-entry.ts +7 -7
  322. package/src/server/index.ts +11 -11
  323. package/src/server/start.ts +3 -2
  324. package/src/server/worker-entry.ts +4 -4
  325. package/src/step/index.ts +4 -4
  326. package/src/step/inline.ts +2 -2
  327. package/dist/defer/index.d.ts +0 -24
  328. package/dist/defer/index.d.ts.map +0 -1
  329. package/dist/defer/index.js +0 -42
  330. package/dist/defer/index.js.map +0 -1
  331. package/src/defer/index.ts +0 -64
@@ -9,7 +9,7 @@ import type { CorsConfig, WsAdapter } from '@astrale-os/kernel-server'
9
9
  import type { Context } from 'hono'
10
10
  import type { Hono } from 'hono'
11
11
 
12
- import type { RemoteDomain } from '../domain/define'
12
+ import type { RemoteDomain } from '../domain/define.js'
13
13
 
14
14
  export type RemoteServerConfig<TDeps> = {
15
15
  /** Domain produced by `defineRemoteDomain(...)`. */
@@ -15,20 +15,20 @@ import { createKernelApp } from '@astrale-os/kernel-server'
15
15
  import { Hono } from 'hono'
16
16
  import { importJWK, SignJWT } from 'jose'
17
17
 
18
- import type { ViewDef } from '../define'
19
- import type { RemoteServerConfig } from './config'
20
- import type { RemoteServer, RemoteServerHandle } from './handle'
21
-
22
- import { MetaSchema } from '../deploy/meta'
23
- import { SdkDispatcher } from '../dispatch/dispatcher'
24
- import { buildAuxIdentityMap } from '../dispatch/identity'
25
- import { buildMethodIndex } from '../dispatch/resolve'
26
- import { buildInstallGraph, buildInstallGraphHash } from '../domain/build-spec'
27
- import { toSdkContract } from '../domain/contract'
28
- import { materializeRemoteDomain } from '../domain/define'
29
- import { mountAuxiliaryRoutes } from './auxiliary-routes'
30
- import { derivePublicJwk } from './jwks'
31
- import { canonicalizeServingUrl } from './serving-url'
18
+ import type { ViewDef } from '../define/index.js'
19
+ import type { RemoteServerConfig } from './config.js'
20
+ import type { RemoteServer, RemoteServerHandle } from './handle.js'
21
+
22
+ import { MetaSchema } from '../deploy/meta.js'
23
+ import { SdkDispatcher } from '../dispatch/dispatcher.js'
24
+ import { buildAuxIdentityMap } from '../dispatch/identity.js'
25
+ import { buildMethodIndex } from '../dispatch/resolve.js'
26
+ import { buildInstallGraph, buildInstallGraphHash } from '../domain/build-spec.js'
27
+ import { toSdkContract } from '../domain/contract.js'
28
+ import { materializeRemoteDomain } from '../domain/define.js'
29
+ import { mountAuxiliaryRoutes } from './auxiliary-routes.js'
30
+ import { derivePublicJwk } from './jwks.js'
31
+ import { canonicalizeServingUrl } from './serving-url.js'
32
32
 
33
33
  export function createRemoteServer<TDeps>(config: RemoteServerConfig<TDeps>): RemoteServer {
34
34
  const methods = buildMethodIndex(config.domain.methods)
@@ -143,7 +143,7 @@ export function createRemoteServer<TDeps>(config: RemoteServerConfig<TDeps>): Re
143
143
  }
144
144
 
145
145
  const { app } = createKernelApp({
146
- kernel: dispatcher,
146
+ dispatcher,
147
147
  domain: config.domain.methods.map(toSdkContract),
148
148
  host: { url: config.url },
149
149
  jwks,
@@ -18,14 +18,14 @@
18
18
  import type { Core, Schema } from '@astrale-os/kernel-dsl'
19
19
  import type { Hono } from 'hono'
20
20
 
21
- import type { DomainManifest } from '../config/define-domain'
22
- import type { AnyRemoteFunctionDef, ViewDef } from '../define'
23
- import type { SchemaMethodsImpl } from '../method'
24
- import type { RemoteServerConfig } from './config'
25
- import type { WorkerEntry, WorkerEntryConfig } from './worker-entry'
21
+ import type { DomainManifest } from '../config/define-domain.js'
22
+ import type { AnyRemoteFunctionDef, ViewDef } from '../define/index.js'
23
+ import type { SchemaMethodsImpl } from '../method/index.js'
24
+ import type { RemoteServerConfig } from './config.js'
25
+ import type { WorkerEntry, WorkerEntryConfig } from './worker-entry.js'
26
26
 
27
- import { defineRemoteDomain } from '../domain'
28
- import { createWorkerEntry } from './worker-entry'
27
+ import { defineRemoteDomain } from '../domain/index.js'
28
+ import { createWorkerEntry } from './worker-entry.js'
29
29
 
30
30
  export interface DomainWorkerEntryConfig<S extends Schema, TEnv, TDeps> {
31
31
  /** The domain schema. */
@@ -1,11 +1,11 @@
1
- export { createRemoteServer } from './create'
2
- export type { RemoteServerConfig } from './config'
3
- export type { RemoteServer, RemoteServerHandle } from './handle'
4
- export { derivePublicJwk } from './jwks'
5
- export { requireEnv } from './require-env'
6
- export { canonicalizeServingUrl } from './serving-url'
7
- export { assets, createWorkerEntry } from './worker-entry'
8
- export type { WorkerEntry, WorkerEntryConfig } from './worker-entry'
9
- export { domainWorkerEntry } from './domain-entry'
10
- export type { DomainWorkerEntryConfig } from './domain-entry'
11
- export { startNodeServer } from './start'
1
+ export { createRemoteServer } from './create.js'
2
+ export type { RemoteServerConfig } from './config.js'
3
+ export type { RemoteServer, RemoteServerHandle } from './handle.js'
4
+ export { derivePublicJwk } from './jwks.js'
5
+ export { requireEnv } from './require-env.js'
6
+ export { canonicalizeServingUrl } from './serving-url.js'
7
+ export { assets, createWorkerEntry } from './worker-entry.js'
8
+ export type { WorkerEntry, WorkerEntryConfig } from './worker-entry.js'
9
+ export { domainWorkerEntry } from './domain-entry.js'
10
+ export type { DomainWorkerEntryConfig } from './domain-entry.js'
11
+ export { startNodeServer } from './start.js'
@@ -6,16 +6,17 @@
6
6
  * Cloudflare, consumers go through `server.app.fetch` directly.
7
7
  */
8
8
 
9
+ import type { serve as nodeServe } from '@hono/node-server'
9
10
  import type { Hono } from 'hono'
10
11
 
11
- import type { RemoteServerHandle } from './handle'
12
+ import type { RemoteServerHandle } from './handle.js'
12
13
 
13
14
  export async function startNodeServer(app: Hono, port = 3000): Promise<RemoteServerHandle> {
14
15
  // Opaque specifier: the `./server` barrel re-exports this module, so worker
15
16
  // bundles (wrangler/esbuild) traverse it even though they never call it. A
16
17
  // literal import() would make them resolve the optional peer and fail.
17
18
  const nodeServerModule = '@hono/node-server'
18
- const { serve } = (await import(nodeServerModule)) as typeof import('@hono/node-server')
19
+ const { serve } = (await import(nodeServerModule)) as { serve: typeof nodeServe }
19
20
  // oxlint-disable-next-line no-explicit-any
20
21
  const server = serve({ fetch: app.fetch, port }) as any
21
22
 
@@ -24,11 +24,11 @@
24
24
 
25
25
  import type { ExecutionContext } from 'hono'
26
26
 
27
- import type { RemoteServerConfig } from './config'
27
+ import type { RemoteServerConfig } from './config.js'
28
28
 
29
- import { createRemoteServer } from './create'
30
- import { requireEnv } from './require-env'
31
- import { canonicalizeServingUrl } from './serving-url'
29
+ import { createRemoteServer } from './create.js'
30
+ import { requireEnv } from './require-env.js'
31
+ import { canonicalizeServingUrl } from './serving-url.js'
32
32
 
33
33
  type Fetcher = { fetch(request: Request): Response | Promise<Response> }
34
34
  type App = {
package/src/step/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { createInlineStep } from './inline'
2
- export type { InlineStepOptions, StepExecutor } from './inline'
3
- export { buildStepRun } from './step'
4
- export type { FunctionStepScope, MethodStepScope, Step, StepRun, StepScope } from './step'
1
+ export { createInlineStep } from './inline.js'
2
+ export type { InlineStepOptions, StepExecutor } from './inline.js'
3
+ export { buildStepRun } from './step.js'
4
+ export type { FunctionStepScope, MethodStepScope, Step, StepRun, StepScope } from './step.js'
@@ -1,6 +1,6 @@
1
- import type { Step, StepRun, StepScope } from './step'
1
+ import type { Step, StepRun, StepScope } from './step.js'
2
2
 
3
- import { buildStepRun, roundTripStepResult } from './step'
3
+ import { buildStepRun, roundTripStepResult } from './step.js'
4
4
 
5
5
  export type StepExecutor = <T>(run: StepRun, handler: () => T | Promise<T>) => Promise<T>
6
6
 
@@ -1,24 +0,0 @@
1
- import type { Context } from 'hono';
2
- /** Internal structural host capability; not part of the author-facing SDK contract. */
3
- export type HandlerExecutionLifetime = {
4
- waitUntil(promise: Promise<unknown>): void;
5
- };
6
- /**
7
- * Work detached from the current handler result.
8
- *
9
- * The callback is deliberately lazy: the SDK registers the resulting task with
10
- * the active execution backend before it starts. Current request-based hosts
11
- * extend their request lifetime; future durable backends may provide stronger
12
- * execution guarantees without changing the author-facing API.
13
- */
14
- export type DeferredTask = () => void | PromiseLike<unknown>;
15
- export type Defer = (task: DeferredTask) => void;
16
- export type HandlerLifecycle = {
17
- defer: Defer;
18
- settle(): Promise<void>;
19
- };
20
- /** Bind detached work to the host, with a safe blocking fallback for other runtimes. */
21
- export declare function createHandlerLifecycle(lifetime?: HandlerExecutionLifetime): HandlerLifecycle;
22
- /** Hono omits its execution context in Node and in lightweight unit tests. */
23
- export declare function executionLifetime(c: Context): HandlerExecutionLifetime | undefined;
24
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/defer/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,uFAAuF;AACvF,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;CAC3C,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;AAE5D,MAAM,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAA;AAEhD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,KAAK,CAAA;IACZ,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACxB,CAAA;AAED,wFAAwF;AACxF,wBAAgB,sBAAsB,CAAC,QAAQ,CAAC,EAAE,wBAAwB,GAAG,gBAAgB,CA4B5F;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,OAAO,GAAG,wBAAwB,GAAG,SAAS,CAOlF"}
@@ -1,42 +0,0 @@
1
- /** Bind detached work to the host, with a safe blocking fallback for other runtimes. */
2
- export function createHandlerLifecycle(lifetime) {
3
- const pending = [];
4
- return {
5
- defer(task) {
6
- const promise = Promise.resolve().then(task);
7
- if (lifetime)
8
- lifetime.waitUntil(promise);
9
- else
10
- pending.push(promise);
11
- },
12
- async settle() {
13
- if (lifetime || pending.length === 0)
14
- return;
15
- // A deferred task may register more work before it settles. Drain until
16
- // the lifecycle is stable so non-request runtimes never abandon children.
17
- let cursor = 0;
18
- while (cursor < pending.length) {
19
- const batch = pending.slice(cursor);
20
- cursor = pending.length;
21
- const results = await Promise.allSettled(batch);
22
- for (const result of results) {
23
- if (result.status === 'rejected') {
24
- // oxlint-disable-next-line no-console
25
- console.error('[sdk] deferred task failed:', result.reason);
26
- }
27
- }
28
- }
29
- },
30
- };
31
- }
32
- /** Hono omits its execution context in Node and in lightweight unit tests. */
33
- export function executionLifetime(c) {
34
- try {
35
- const host = c.executionCtx;
36
- return { waitUntil: (promise) => host.waitUntil(promise) };
37
- }
38
- catch {
39
- return undefined;
40
- }
41
- }
42
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/defer/index.ts"],"names":[],"mappings":"AAwBA,wFAAwF;AACxF,MAAM,UAAU,sBAAsB,CAAC,QAAmC;IACxE,MAAM,OAAO,GAAuB,EAAE,CAAA;IAEtC,OAAO;QACL,KAAK,CAAC,IAAI;YACR,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC5C,IAAI,QAAQ;gBAAE,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;;gBACpC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC5B,CAAC;QACD,KAAK,CAAC,MAAM;YACV,IAAI,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAM;YAE5C,wEAAwE;YACxE,0EAA0E;YAC1E,IAAI,MAAM,GAAG,CAAC,CAAA;YACd,OAAO,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;gBAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;gBACnC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;gBACvB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;gBAC/C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;oBAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;wBACjC,sCAAsC;wBACtC,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;oBAC7D,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,iBAAiB,CAAC,CAAU;IAC1C,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,CAAC,CAAC,YAAY,CAAA;QAC3B,OAAO,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAA;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC"}
@@ -1,64 +0,0 @@
1
- import type { Context } from 'hono'
2
-
3
- /** Internal structural host capability; not part of the author-facing SDK contract. */
4
- export type HandlerExecutionLifetime = {
5
- waitUntil(promise: Promise<unknown>): void
6
- }
7
-
8
- /**
9
- * Work detached from the current handler result.
10
- *
11
- * The callback is deliberately lazy: the SDK registers the resulting task with
12
- * the active execution backend before it starts. Current request-based hosts
13
- * extend their request lifetime; future durable backends may provide stronger
14
- * execution guarantees without changing the author-facing API.
15
- */
16
- export type DeferredTask = () => void | PromiseLike<unknown>
17
-
18
- export type Defer = (task: DeferredTask) => void
19
-
20
- export type HandlerLifecycle = {
21
- defer: Defer
22
- settle(): Promise<void>
23
- }
24
-
25
- /** Bind detached work to the host, with a safe blocking fallback for other runtimes. */
26
- export function createHandlerLifecycle(lifetime?: HandlerExecutionLifetime): HandlerLifecycle {
27
- const pending: Promise<unknown>[] = []
28
-
29
- return {
30
- defer(task) {
31
- const promise = Promise.resolve().then(task)
32
- if (lifetime) lifetime.waitUntil(promise)
33
- else pending.push(promise)
34
- },
35
- async settle() {
36
- if (lifetime || pending.length === 0) return
37
-
38
- // A deferred task may register more work before it settles. Drain until
39
- // the lifecycle is stable so non-request runtimes never abandon children.
40
- let cursor = 0
41
- while (cursor < pending.length) {
42
- const batch = pending.slice(cursor)
43
- cursor = pending.length
44
- const results = await Promise.allSettled(batch)
45
- for (const result of results) {
46
- if (result.status === 'rejected') {
47
- // oxlint-disable-next-line no-console
48
- console.error('[sdk] deferred task failed:', result.reason)
49
- }
50
- }
51
- }
52
- },
53
- }
54
- }
55
-
56
- /** Hono omits its execution context in Node and in lightweight unit tests. */
57
- export function executionLifetime(c: Context): HandlerExecutionLifetime | undefined {
58
- try {
59
- const host = c.executionCtx
60
- return { waitUntil: (promise) => host.waitUntil(promise) }
61
- } catch {
62
- return undefined
63
- }
64
- }