@astrale-os/sdk 0.1.1 → 0.1.3

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 (198) hide show
  1. package/dist/auth/authenticate.d.ts +24 -0
  2. package/dist/auth/authenticate.d.ts.map +1 -0
  3. package/dist/auth/authenticate.js +29 -0
  4. package/dist/auth/authenticate.js.map +1 -0
  5. package/dist/auth/check.d.ts +39 -0
  6. package/dist/auth/check.d.ts.map +1 -0
  7. package/dist/auth/check.js +54 -0
  8. package/dist/auth/check.js.map +1 -0
  9. package/dist/auth/compose.d.ts +41 -0
  10. package/dist/auth/compose.d.ts.map +1 -0
  11. package/dist/auth/compose.js +45 -0
  12. package/dist/auth/compose.js.map +1 -0
  13. package/dist/auth/errors.d.ts +16 -0
  14. package/dist/auth/errors.d.ts.map +1 -0
  15. package/dist/auth/errors.js +26 -0
  16. package/dist/auth/errors.js.map +1 -0
  17. package/dist/auth/identity.d.ts +16 -0
  18. package/dist/auth/identity.d.ts.map +1 -0
  19. package/dist/auth/identity.js +2 -0
  20. package/dist/auth/identity.js.map +1 -0
  21. package/dist/auth/index.d.ts +12 -0
  22. package/dist/auth/index.d.ts.map +1 -0
  23. package/dist/auth/index.js +9 -0
  24. package/dist/auth/index.js.map +1 -0
  25. package/dist/auth/kernel-client.d.ts +43 -0
  26. package/dist/auth/kernel-client.d.ts.map +1 -0
  27. package/dist/auth/kernel-client.js +146 -0
  28. package/dist/auth/kernel-client.js.map +1 -0
  29. package/dist/auth/resolve.d.ts +19 -0
  30. package/dist/auth/resolve.d.ts.map +1 -0
  31. package/dist/auth/resolve.js +43 -0
  32. package/dist/auth/resolve.js.map +1 -0
  33. package/dist/auth/sign.d.ts +15 -0
  34. package/dist/auth/sign.d.ts.map +1 -0
  35. package/dist/auth/sign.js +24 -0
  36. package/dist/auth/sign.js.map +1 -0
  37. package/dist/auth/verify.d.ts +26 -0
  38. package/dist/auth/verify.d.ts.map +1 -0
  39. package/dist/auth/verify.js +96 -0
  40. package/dist/auth/verify.js.map +1 -0
  41. package/dist/define/index.d.ts +5 -0
  42. package/dist/define/index.d.ts.map +1 -0
  43. package/dist/define/index.js +3 -0
  44. package/dist/define/index.js.map +1 -0
  45. package/dist/define/remote-function.d.ts +96 -0
  46. package/dist/define/remote-function.d.ts.map +1 -0
  47. package/dist/define/remote-function.js +25 -0
  48. package/dist/define/remote-function.js.map +1 -0
  49. package/dist/define/view.d.ts +86 -0
  50. package/dist/define/view.d.ts.map +1 -0
  51. package/dist/define/view.js +28 -0
  52. package/dist/define/view.js.map +1 -0
  53. package/dist/deploy/check.d.ts +30 -0
  54. package/dist/deploy/check.d.ts.map +1 -0
  55. package/dist/deploy/check.js +82 -0
  56. package/dist/deploy/check.js.map +1 -0
  57. package/dist/deploy/hash-spec.d.ts +9 -0
  58. package/dist/deploy/hash-spec.d.ts.map +1 -0
  59. package/dist/deploy/hash-spec.js +29 -0
  60. package/dist/deploy/hash-spec.js.map +1 -0
  61. package/dist/deploy/index.d.ts +4 -0
  62. package/dist/deploy/index.d.ts.map +1 -0
  63. package/dist/deploy/index.js +4 -0
  64. package/dist/deploy/index.js.map +1 -0
  65. package/dist/deploy/meta.d.ts +18 -0
  66. package/dist/deploy/meta.d.ts.map +1 -0
  67. package/dist/deploy/meta.js +22 -0
  68. package/dist/deploy/meta.js.map +1 -0
  69. package/dist/dispatch/authorize.d.ts +14 -0
  70. package/dist/dispatch/authorize.d.ts.map +1 -0
  71. package/dist/dispatch/authorize.js +24 -0
  72. package/dist/dispatch/authorize.js.map +1 -0
  73. package/dist/dispatch/call-remote.d.ts +35 -0
  74. package/dist/dispatch/call-remote.d.ts.map +1 -0
  75. package/dist/dispatch/call-remote.js +37 -0
  76. package/dist/dispatch/call-remote.js.map +1 -0
  77. package/dist/dispatch/dispatcher.d.ts +60 -0
  78. package/dist/dispatch/dispatcher.d.ts.map +1 -0
  79. package/dist/dispatch/dispatcher.js +177 -0
  80. package/dist/dispatch/dispatcher.js.map +1 -0
  81. package/dist/dispatch/errors.d.ts +47 -0
  82. package/dist/dispatch/errors.d.ts.map +1 -0
  83. package/dist/dispatch/errors.js +76 -0
  84. package/dist/dispatch/errors.js.map +1 -0
  85. package/dist/dispatch/execute.d.ts +33 -0
  86. package/dist/dispatch/execute.d.ts.map +1 -0
  87. package/dist/dispatch/execute.js +24 -0
  88. package/dist/dispatch/execute.js.map +1 -0
  89. package/dist/dispatch/identity.d.ts +73 -0
  90. package/dist/dispatch/identity.d.ts.map +1 -0
  91. package/dist/dispatch/identity.js +106 -0
  92. package/dist/dispatch/identity.js.map +1 -0
  93. package/dist/dispatch/index.d.ts +8 -0
  94. package/dist/dispatch/index.d.ts.map +1 -0
  95. package/dist/dispatch/index.js +8 -0
  96. package/dist/dispatch/index.js.map +1 -0
  97. package/dist/dispatch/resolve.d.ts +27 -0
  98. package/dist/dispatch/resolve.d.ts.map +1 -0
  99. package/dist/dispatch/resolve.js +65 -0
  100. package/dist/dispatch/resolve.js.map +1 -0
  101. package/dist/dispatch/self.d.ts +27 -0
  102. package/dist/dispatch/self.d.ts.map +1 -0
  103. package/dist/dispatch/self.js +25 -0
  104. package/dist/dispatch/self.js.map +1 -0
  105. package/dist/dispatch/validate.d.ts +35 -0
  106. package/dist/dispatch/validate.d.ts.map +1 -0
  107. package/dist/dispatch/validate.js +27 -0
  108. package/dist/dispatch/validate.js.map +1 -0
  109. package/dist/domain/build-spec.d.ts +37 -0
  110. package/dist/domain/build-spec.d.ts.map +1 -0
  111. package/dist/domain/build-spec.js +95 -0
  112. package/dist/domain/build-spec.js.map +1 -0
  113. package/dist/domain/contract.d.ts +17 -0
  114. package/dist/domain/contract.d.ts.map +1 -0
  115. package/dist/domain/contract.js +26 -0
  116. package/dist/domain/contract.js.map +1 -0
  117. package/dist/domain/define.d.ts +82 -0
  118. package/dist/domain/define.d.ts.map +1 -0
  119. package/dist/domain/define.js +99 -0
  120. package/dist/domain/define.js.map +1 -0
  121. package/dist/domain/extend-core.d.ts +49 -0
  122. package/dist/domain/extend-core.d.ts.map +1 -0
  123. package/dist/domain/extend-core.js +182 -0
  124. package/dist/domain/extend-core.js.map +1 -0
  125. package/dist/domain/index.d.ts +5 -0
  126. package/dist/domain/index.d.ts.map +1 -0
  127. package/dist/domain/index.js +4 -0
  128. package/dist/domain/index.js.map +1 -0
  129. package/dist/index.d.ts +19 -0
  130. package/dist/index.d.ts.map +1 -0
  131. package/dist/index.js +32 -0
  132. package/dist/index.js.map +1 -0
  133. package/dist/method/class.d.ts +70 -0
  134. package/dist/method/class.d.ts.map +1 -0
  135. package/dist/method/class.js +26 -0
  136. package/dist/method/class.js.map +1 -0
  137. package/dist/method/context.d.ts +43 -0
  138. package/dist/method/context.d.ts.map +1 -0
  139. package/dist/method/context.js +10 -0
  140. package/dist/method/context.js.map +1 -0
  141. package/dist/method/index.d.ts +6 -0
  142. package/dist/method/index.d.ts.map +1 -0
  143. package/dist/method/index.js +3 -0
  144. package/dist/method/index.js.map +1 -0
  145. package/dist/method/single.d.ts +88 -0
  146. package/dist/method/single.d.ts.map +1 -0
  147. package/dist/method/single.js +18 -0
  148. package/dist/method/single.js.map +1 -0
  149. package/dist/server/auxiliary-routes.d.ts +44 -0
  150. package/dist/server/auxiliary-routes.d.ts.map +1 -0
  151. package/dist/server/auxiliary-routes.js +239 -0
  152. package/dist/server/auxiliary-routes.js.map +1 -0
  153. package/dist/server/config.d.ts +83 -0
  154. package/dist/server/config.d.ts.map +1 -0
  155. package/dist/server/config.js +8 -0
  156. package/dist/server/config.js.map +1 -0
  157. package/dist/server/create.d.ts +21 -0
  158. package/dist/server/create.d.ts.map +1 -0
  159. package/dist/server/create.js +210 -0
  160. package/dist/server/create.js.map +1 -0
  161. package/dist/server/handle.d.ts +35 -0
  162. package/dist/server/handle.d.ts.map +1 -0
  163. package/dist/server/handle.js +9 -0
  164. package/dist/server/handle.js.map +1 -0
  165. package/dist/server/index.d.ts +11 -0
  166. package/dist/server/index.d.ts.map +1 -0
  167. package/dist/server/index.js +8 -0
  168. package/dist/server/index.js.map +1 -0
  169. package/dist/server/jwks.d.ts +11 -0
  170. package/dist/server/jwks.d.ts.map +1 -0
  171. package/dist/server/jwks.js +15 -0
  172. package/dist/server/jwks.js.map +1 -0
  173. package/dist/server/require-env.d.ts +15 -0
  174. package/dist/server/require-env.d.ts.map +1 -0
  175. package/dist/server/require-env.js +21 -0
  176. package/dist/server/require-env.js.map +1 -0
  177. package/dist/server/serving-url.d.ts +14 -0
  178. package/dist/server/serving-url.d.ts.map +1 -0
  179. package/dist/server/serving-url.js +28 -0
  180. package/dist/server/serving-url.js.map +1 -0
  181. package/dist/server/start.d.ts +11 -0
  182. package/dist/server/start.d.ts.map +1 -0
  183. package/dist/server/start.js +34 -0
  184. package/dist/server/start.js.map +1 -0
  185. package/dist/server/worker-entry.d.ts +60 -0
  186. package/dist/server/worker-entry.d.ts.map +1 -0
  187. package/dist/server/worker-entry.js +79 -0
  188. package/dist/server/worker-entry.js.map +1 -0
  189. package/dist/server/worker-meta.d.ts +6 -0
  190. package/dist/server/worker-meta.d.ts.map +1 -0
  191. package/dist/server/worker-meta.js +10 -0
  192. package/dist/server/worker-meta.js.map +1 -0
  193. package/package.json +5 -5
  194. package/src/auth/compose.ts +27 -2
  195. package/src/auth/kernel-client.ts +103 -11
  196. package/src/define/remote-function.ts +10 -0
  197. package/src/server/auxiliary-routes.ts +3 -1
  198. package/src/server/start.ts +5 -1
@@ -0,0 +1,95 @@
1
+ /**
2
+ * SDK-side spec builder: CompiledDomain → serialize → Graph.
3
+ *
4
+ * Serializes BoundMethod[] into FunctionSchema[], generates entries for
5
+ * inherited methods not covered by the domain's handlers, then delegates
6
+ * to serialize() for graph blueprint generation.
7
+ *
8
+ * Domain-side Methods are remote-bound: dispatch routes through
9
+ * `binding.remoteUrl` and never reaches the kernel sandbox. We therefore
10
+ * do NOT stamp `code` on emitted FunctionSchema entries — there is no
11
+ * sandbox-eval'able body. Only the kernel domain (compiled in-process)
12
+ * carries `code` strings.
13
+ *
14
+ * The emitted graph is absolute — the Tree produced by `serialize()` is
15
+ * already mounted at `/<origin>`, so `tree.toGraph()` lifts every internal
16
+ * relative path into its host-graph absolute form. Wire serialization is the
17
+ * caller's responsibility (`graph.toWire()`).
18
+ */
19
+ import { hashInstallGraph, serialize, zodToJsonSchema } from '@astrale-os/kernel-core/domain';
20
+ import { extractBinding } from './contract';
21
+ import { materializeRemoteDomain } from './define';
22
+ /**
23
+ * Build the install-ready wire graph for a domain served at `url`: materialize
24
+ * the domain at its real serving URL (so every binding carries the live URL —
25
+ * the define-time compile carries none), serialize, and emit the wire form.
26
+ * This is the graph the kernel installs and re-hashes to verify. There is no
27
+ * url-less variant: an install graph without bindings is uninstallable (the
28
+ * kernel install guard rejects it).
29
+ */
30
+ export function buildInstallGraph(domain, url) {
31
+ const { compiled } = materializeRemoteDomain(domain, url);
32
+ return buildSpecInternal(compiled, domain.methods, url).toWire();
33
+ }
34
+ /**
35
+ * Content hash of the install graph. Delegates the canonical hash to kernel-core's
36
+ * `hashInstallGraph` — the same algorithm the kernel re-runs on install to verify
37
+ * the received graph against the signed hash.
38
+ */
39
+ export function buildInstallGraphHash(domain, url) {
40
+ return hashInstallGraph(buildInstallGraph(domain, url));
41
+ }
42
+ // ── Internal ────────────────────────────────────────────────
43
+ function buildSpecInternal(compiled, methods, url) {
44
+ const serialized = serializeMethodsWithStubs(compiled, methods, url);
45
+ const tree = serialize(compiled, serialized);
46
+ // Views / RemoteFunctions are auto-materialized into the Core BEFORE
47
+ // `compileDomain` runs (see `extend-core.ts`). By the time we reach
48
+ // `serialize` here the Tree already contains their nodes/edges.
49
+ return tree.toGraph();
50
+ }
51
+ /**
52
+ * Serialize BoundMethod[] and generate stubs for methods in compiled.$.methods
53
+ * that have no corresponding BoundMethod (inherited-sealed, inherited-default).
54
+ *
55
+ * Every Method's binding defaults its `remoteUrl` to the serving URL: domain
56
+ * methods are remote-bound — the kernel dispatches them by redirecting to the
57
+ * worker — so a method node without a remote binding is uninstallable (the
58
+ * kernel install guard rejects it). An explicit per-method `remoteUrl` wins.
59
+ */
60
+ function serializeMethodsWithStubs(compiled, methods, url) {
61
+ const bound = new Set(methods.map((m) => m.ref));
62
+ const result = methods.map((m) => serializeFromBoundMethod(m, url));
63
+ // Generate entries for unbound methods (replaces fillMissingCallables).
64
+ // No `code` is stamped — domain-side Methods are binding-only. The `ref` MUST
65
+ // be the QUALIFIED `ResolvedMethod.ref` (`<ns>.<Type>.method.<m>`) — the exact
66
+ // form `serialize`'s method-node lookup uses; re-deriving a bare `Type.method`
67
+ // is the F11 bug (interface methods then never resolve → MISSING_HANDLER).
68
+ for (const classMethods of Object.values(compiled.$.methods)) {
69
+ for (const rm of Object.values(classMethods)) {
70
+ const ref = rm.ref;
71
+ if (bound.has(ref))
72
+ continue;
73
+ result.push({
74
+ ref,
75
+ inputSchema: { type: 'object' },
76
+ outputSchema: {},
77
+ output: 'value',
78
+ binding: { remoteUrl: url },
79
+ });
80
+ }
81
+ }
82
+ return result;
83
+ }
84
+ function serializeFromBoundMethod(method, url) {
85
+ const binding = extractBinding(method.handler);
86
+ return {
87
+ ref: method.ref,
88
+ inputSchema: zodToJsonSchema(method.inputSchema),
89
+ outputSchema: zodToJsonSchema(method.outputSchema),
90
+ isStatic: method.isStatic || undefined,
91
+ output: method.output,
92
+ binding: binding?.remoteUrl ? binding : { ...binding, remoteUrl: url },
93
+ };
94
+ }
95
+ //# sourceMappingURL=build-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-spec.js","sourceRoot":"","sources":["../../src/domain/build-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAK7F,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAElD;;;;;;;GAOG;AACH,MAAM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QAC7D,KAAK,MAAM,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;YAC7C,MAAM,GAAG,GAAG,EAAE,CAAC,GAAG,CAAA;YAClB,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,SAAQ;YAC5B,MAAM,CAAC,IAAI,CAAC;gBACV,GAAG;gBACH,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC/B,YAAY,EAAE,EAAE;gBAChB,MAAM,EAAE,OAAO;gBACf,OAAO,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE;aAC5B,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,wBAAwB,CAC/B,MAAqC,EACrC,GAAW;IAEX,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAC9C,OAAO;QACL,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,WAAW,EAAE,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC;QAChD,YAAY,EAAE,eAAe,CAAC,MAAM,CAAC,YAAY,CAAC;QAClD,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,SAAS;QACtC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE;KACvE,CAAA;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * BoundMethod → MountableContract translator.
3
+ *
4
+ * The narrow view carries only what the server's mount planner reads —
5
+ * `ref` plus optional `binding` — because the SDK's SdkDispatcher
6
+ * handles dispatch via KernelAPI.call, not via runtime contract hooks.
7
+ */
8
+ import type { AuthPolicy, FunctionBinding, MountableContract, RouteBinding } from '@astrale-os/kernel-api/routed';
9
+ import type { BoundMethod } from '@astrale-os/kernel-core/domain';
10
+ import type { AnyRemoteHandler } from '../method/single';
11
+ export declare function toSdkContract(method: BoundMethod<AnyRemoteHandler>): MountableContract;
12
+ export declare function extractBinding(handler: {
13
+ route?: RouteBinding;
14
+ remoteUrl?: string;
15
+ auth?: AuthPolicy;
16
+ }): FunctionBinding | undefined;
17
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/domain/contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,YAAY,EACb,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAExD,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,iBAAiB,CAQtF;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE;IACtC,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB,GAAG,eAAe,GAAG,SAAS,CAQ9B"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * BoundMethod → MountableContract translator.
3
+ *
4
+ * The narrow view carries only what the server's mount planner reads —
5
+ * `ref` plus optional `binding` — because the SDK's SdkDispatcher
6
+ * handles dispatch via KernelAPI.call, not via runtime contract hooks.
7
+ */
8
+ export function toSdkContract(method) {
9
+ const handler = method.handler;
10
+ const binding = extractBinding(handler);
11
+ return binding === undefined ? { ref: method.ref } : { ref: method.ref, binding };
12
+ }
13
+ export function extractBinding(handler) {
14
+ const { route, remoteUrl, auth } = handler;
15
+ if (route === undefined && remoteUrl === undefined && auth === undefined)
16
+ return undefined;
17
+ const binding = {};
18
+ if (remoteUrl !== undefined)
19
+ binding.remoteUrl = remoteUrl;
20
+ if (route !== undefined)
21
+ binding.route = route;
22
+ if (auth !== undefined)
23
+ binding.auth = auth;
24
+ return binding;
25
+ }
26
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/domain/contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,MAAM,UAAU,aAAa,CAAC,MAAqC;IACjE,MAAM,OAAO,GAAG,MAAM,CAAC,OAItB,CAAA;IACD,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IACvC,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,CAAA;AACnF,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAI9B;IACC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;IAC1C,IAAI,KAAK,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IAC1F,MAAM,OAAO,GAAoB,EAAE,CAAA;IACnC,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,CAAC,SAAS,GAAG,SAAS,CAAA;IAC1D,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;IAC9C,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAA;IAC3C,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * `defineRemoteDomain` — turn a typed schema + methods map into a mountable domain.
3
+ *
4
+ * When `views` and/or `remoteFunctions` entries are provided, the SDK
5
+ * auto-materializes graph nodes
6
+ * under reserved folders (`viewsFolder` / `functionsFolder`, defaults `'views'`
7
+ * / `'functions'`). Views and standalone functions materialize as canonical
8
+ * kernel `View` / `Function` classes by default (no per-domain class to
9
+ * configure). The same entries'
10
+ * `render` / `execute` handlers are mounted as Hono routes by
11
+ * `createRemoteServer`. Slug = map key.
12
+ *
13
+ * The domain definition is deployment-agnostic: it carries NO serving url. The
14
+ * url is supplied late by the spec producer (`createRemoteServer({ url })` at
15
+ * runtime, the devkit CLI offline) and stamped onto every `binding.remoteUrl`
16
+ * by `materializeRemoteDomain`. There is exactly one notion of `url` in the SDK
17
+ * — the worker serving URL, which is also `iss` and the binding base.
18
+ */
19
+ import type { FunctionBinding } from '@astrale-os/kernel-api/routed';
20
+ import type { BoundMethod, CompiledDomain } from '@astrale-os/kernel-core/domain';
21
+ import type { AnyEdgeDef, AnyNodeDef, Core, Schema } from '@astrale-os/kernel-dsl';
22
+ import type { AnyRemoteFunctionDef, ViewDef } from '../define';
23
+ import type { SchemaMethodsImpl } from '../method/class';
24
+ import type { AnyRemoteHandler } from '../method/single';
25
+ export type RemoteDomainConfig<S extends Schema, TDeps> = {
26
+ schema: S;
27
+ methods: SchemaMethodsImpl<S, TDeps>;
28
+ core?: Core<S>;
29
+ views?: Record<string, ViewDef<TDeps>>;
30
+ viewClass?: AnyNodeDef;
31
+ viewForEdgeClass?: AnyEdgeDef;
32
+ viewsFolder?: string;
33
+ remoteFunctions?: Record<string, AnyRemoteFunctionDef>;
34
+ functionsFolder?: string;
35
+ };
36
+ /** Effective bindings + folder layout for auxiliary routes, resolved against `url`. */
37
+ export type AuxiliaryMetadata = {
38
+ url: string;
39
+ viewsFolder: string;
40
+ functionsFolder: string;
41
+ viewBindings: Record<string, FunctionBinding>;
42
+ remoteFunctionBindings: Record<string, FunctionBinding>;
43
+ };
44
+ export type RemoteDomain<S extends Schema = Schema> = {
45
+ /**
46
+ * Define-time compile: full domain STRUCTURE (classes, methods, and the aux
47
+ * View/Function nodes' paths/names/refs — what identity, subs, and contract
48
+ * resolution need). It carries NO `binding` values: bindings derive from the
49
+ * serving url, which only the spec producers know — they call
50
+ * `materializeRemoteDomain(domain, url)` for the install-ready compile.
51
+ */
52
+ compiled: CompiledDomain<S>;
53
+ methods: BoundMethod<AnyRemoteHandler>[];
54
+ views?: Record<string, ViewDef<any>>;
55
+ remoteFunctions?: Record<string, AnyRemoteFunctionDef>;
56
+ /** The original config, so `materializeRemoteDomain` re-extends from source. */
57
+ config: ExtendInputs;
58
+ };
59
+ /** The defineRemoteDomain inputs `materializeRemoteDomain` needs to re-extend. */
60
+ type ExtendInputs = {
61
+ userCore?: Core;
62
+ viewClass?: AnyNodeDef;
63
+ viewForEdgeClass?: AnyEdgeDef;
64
+ viewsFolder: string;
65
+ functionsFolder: string;
66
+ };
67
+ export declare function defineRemoteDomain<TDeps>(): <S extends Schema>(config: RemoteDomainConfig<S, TDeps>) => RemoteDomain<S>;
68
+ /**
69
+ * Materialize a `RemoteDomain` at its real serving `url`: re-runs `extendCore`
70
+ * so every aux View/Function `binding.remoteUrl` points at the actual host,
71
+ * and returns the binding maps the auxiliary routes mount from. Called by the
72
+ * only two spec producers — `createRemoteServer` (`config.url`) and the devkit
73
+ * CLI. Returns the define-time `compiled` untouched when there is no aux to
74
+ * stamp. `extendCore`/`compileDomain` are pure, so this is safe to call
75
+ * repeatedly (and is memoized per cold isolate by the callers).
76
+ */
77
+ export declare function materializeRemoteDomain<S extends Schema>(domain: RemoteDomain<S>, url: string): {
78
+ compiled: CompiledDomain<S>;
79
+ auxiliary: AuxiliaryMetadata | undefined;
80
+ };
81
+ export {};
82
+ //# sourceMappingURL=define.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../src/domain/define.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,g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B,OAAO,EAAE,WAAW,CAAC,gBAAgB,CAAC,EAAE,CAAA;IAExC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;IACtD,gFAAgF;IAChF,MAAM,EAAE,YAAY,CAAA;CACrB,CAAA;AAED,kFAAkF;AAClF,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,EAAE,IAAI,CAAA;IACf,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,gBAAgB,CAAC,EAAE,UAAU,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,MACrB,CAAC,SAAS,MAAM,UAAU,kBAAkB,CAAC,CAAC,EAAE,KAAK,CAAC,KAAG,YAAY,CAAC,CAAC,CAAC,CA2C1F;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,MAAM,EACtD,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EACvB,GAAG,EAAE,MAAM,GACV;IAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAAC,SAAS,EAAE,iBAAiB,GAAG,SAAS,CAAA;CAAE,CA6B3E"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * `defineRemoteDomain` — turn a typed schema + methods map into a mountable domain.
3
+ *
4
+ * When `views` and/or `remoteFunctions` entries are provided, the SDK
5
+ * auto-materializes graph nodes
6
+ * under reserved folders (`viewsFolder` / `functionsFolder`, defaults `'views'`
7
+ * / `'functions'`). Views and standalone functions materialize as canonical
8
+ * kernel `View` / `Function` classes by default (no per-domain class to
9
+ * configure). The same entries'
10
+ * `render` / `execute` handlers are mounted as Hono routes by
11
+ * `createRemoteServer`. Slug = map key.
12
+ *
13
+ * The domain definition is deployment-agnostic: it carries NO serving url. The
14
+ * url is supplied late by the spec producer (`createRemoteServer({ url })` at
15
+ * runtime, the devkit CLI offline) and stamped onto every `binding.remoteUrl`
16
+ * by `materializeRemoteDomain`. There is exactly one notion of `url` in the SDK
17
+ * — the worker serving URL, which is also `iss` and the binding base.
18
+ */
19
+ import { bindMethods, compileDomain } from '@astrale-os/kernel-core/domain';
20
+ import { DEFAULT_FUNCTIONS_FOLDER, DEFAULT_VIEWS_FOLDER, extendCore } from './extend-core';
21
+ export function defineRemoteDomain() {
22
+ return function (config) {
23
+ const hasAux = Boolean(config.views || config.remoteFunctions);
24
+ const viewsFolder = config.viewsFolder ?? DEFAULT_VIEWS_FOLDER;
25
+ const functionsFolder = config.functionsFolder ?? DEFAULT_FUNCTIONS_FOLDER;
26
+ // Structure-only extension (no url → no bindings stamped): the aux nodes
27
+ // exist with their paths so subs/identity/contract resolution see them.
28
+ const effectiveCore = hasAux
29
+ ? extendCore({
30
+ schema: config.schema,
31
+ origin: config.schema.domain,
32
+ userCore: config.core,
33
+ viewClass: config.viewClass,
34
+ viewForEdgeClass: config.viewForEdgeClass,
35
+ viewsFolder,
36
+ views: config.views,
37
+ functionsFolder,
38
+ remoteFunctions: config.remoteFunctions,
39
+ }).core
40
+ : config.core;
41
+ const compiled = compileDomain(config.schema, effectiveCore);
42
+ const methods = bindMethods(compiled.$.schema, compiled.$.methods,
43
+ // oxlint-disable-next-line no-explicit-any
44
+ config.methods);
45
+ return Object.freeze({
46
+ compiled,
47
+ methods,
48
+ ...(config.views ? { views: config.views } : {}),
49
+ ...(config.remoteFunctions ? { remoteFunctions: config.remoteFunctions } : {}),
50
+ config: {
51
+ userCore: config.core,
52
+ viewClass: config.viewClass,
53
+ viewForEdgeClass: config.viewForEdgeClass,
54
+ viewsFolder,
55
+ functionsFolder,
56
+ },
57
+ });
58
+ };
59
+ }
60
+ /**
61
+ * Materialize a `RemoteDomain` at its real serving `url`: re-runs `extendCore`
62
+ * so every aux View/Function `binding.remoteUrl` points at the actual host,
63
+ * and returns the binding maps the auxiliary routes mount from. Called by the
64
+ * only two spec producers — `createRemoteServer` (`config.url`) and the devkit
65
+ * CLI. Returns the define-time `compiled` untouched when there is no aux to
66
+ * stamp. `extendCore`/`compileDomain` are pure, so this is safe to call
67
+ * repeatedly (and is memoized per cold isolate by the callers).
68
+ */
69
+ export function materializeRemoteDomain(domain, url) {
70
+ const hasAux = Boolean(domain.views || domain.remoteFunctions);
71
+ if (!hasAux)
72
+ return { compiled: domain.compiled, auxiliary: undefined };
73
+ const { config } = domain;
74
+ const schema = domain.compiled.$.schema;
75
+ const result = extendCore({
76
+ schema,
77
+ origin: schema.domain,
78
+ userCore: config.userCore,
79
+ url,
80
+ viewClass: config.viewClass,
81
+ viewForEdgeClass: config.viewForEdgeClass,
82
+ viewsFolder: config.viewsFolder,
83
+ views: domain.views,
84
+ functionsFolder: config.functionsFolder,
85
+ remoteFunctions: domain.remoteFunctions,
86
+ });
87
+ const compiled = compileDomain(schema, result.core);
88
+ return {
89
+ compiled,
90
+ auxiliary: {
91
+ url,
92
+ viewsFolder: config.viewsFolder,
93
+ functionsFolder: config.functionsFolder,
94
+ viewBindings: result.viewBindings,
95
+ remoteFunctionBindings: result.remoteFunctionBindings,
96
+ },
97
+ };
98
+ }
99
+ //# sourceMappingURL=define.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define.js","sourceRoot":"","sources":["../../src/domain/define.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAM3E,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAmD1F,MAAM,UAAU,kBAAkB;IAChC,OAAO,UAA4B,MAAoC;QACrE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,eAAe,CAAC,CAAA;QAC9D,MAAM,WAA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that includes auto-materialized View and
3
+ * standalone-function nodes (one per entry in `defineRemoteDomain`'s `views` /
4
+ * `remoteFunctions` config), plus their parent Folder + optional `view_for`
5
+ * edges. Returns the resolved effective bindings alongside so callers don't
6
+ * recompute them.
7
+ *
8
+ * Standalone callables (the former `RemoteFunction` class) are materialized as
9
+ * the canonical kernel `Function` node class — "remote" is just a `binding`,
10
+ * not a distinct kind, so there is no per-domain class to configure.
11
+ *
12
+ * Conflicts: if the user core already declares a top-level node at
13
+ * `<viewsFolder>` or `<functionsFolder>`, throws — the auto-materialization
14
+ * reserves those slugs.
15
+ */
16
+ import type { FunctionBinding } from '@astrale-os/kernel-api/routed';
17
+ import type { AnyEdgeDef, AnyNodeDef, Core, Schema } from '@astrale-os/kernel-dsl';
18
+ import type { AnyRemoteFunctionDef } from '../define/remote-function';
19
+ import type { ViewDef } from '../define/view';
20
+ export declare const DEFAULT_VIEWS_FOLDER = "views";
21
+ export declare const DEFAULT_FUNCTIONS_FOLDER = "functions";
22
+ export type ExtendCoreConfig = {
23
+ schema: Schema;
24
+ origin: string;
25
+ userCore?: Core;
26
+ /**
27
+ * The worker's serving URL — the base every auto-materialized binding
28
+ * resolves against. OMITTED at define time (the URL is known only to the
29
+ * spec producers): the aux nodes then materialize structure-only (paths,
30
+ * names, refs — what identity/subs resolution needs) with no `binding`
31
+ * stamped and empty binding maps. Every install graph comes from a
32
+ * `materializeRemoteDomain(domain, url)` call where it is present.
33
+ */
34
+ url?: string;
35
+ viewClass?: AnyNodeDef;
36
+ viewForEdgeClass?: AnyEdgeDef;
37
+ viewsFolder?: string;
38
+ views?: Record<string, ViewDef<any>>;
39
+ functionsFolder?: string;
40
+ remoteFunctions?: Record<string, AnyRemoteFunctionDef>;
41
+ };
42
+ export type ExtendCoreResult = {
43
+ core: Core;
44
+ viewBindings: Record<string, FunctionBinding>;
45
+ remoteFunctionBindings: Record<string, FunctionBinding>;
46
+ };
47
+ export declare function extendCore(config: ExtendCoreConfig): ExtendCoreResult;
48
+ export declare function resolveBinding(override: FunctionBinding | undefined, url: string, folderSlug: string, slug: string): FunctionBinding;
49
+ //# sourceMappingURL=extend-core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extend-core.d.ts","sourceRoot":"","sources":["../../src/domain/extend-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,IAAI,EAGJ,MAAM,EACP,MAAM,wBAAwB,CAAA;AAY/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,eAAO,MAAM,oBAAoB,UAAU,CAAA;AAC3C,eAAO,MAAM,wBAAwB,cAAc,CAAA;AAGnD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,IAAI,CAAA;IACf;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,gBAAgB,CAAC,EAAE,UAAU,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;IAEpC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;CACvD,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,IAAI,CAAA;IACV,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC7C,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CACxD,CAAA;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAsFrE;AAQD,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,eAAe,GAAG,SAAS,EACrC,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GACX,eAAe,CAWjB"}
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Build an augmented `Core<S>` that includes auto-materialized View and
3
+ * standalone-function nodes (one per entry in `defineRemoteDomain`'s `views` /
4
+ * `remoteFunctions` config), plus their parent Folder + optional `view_for`
5
+ * edges. Returns the resolved effective bindings alongside so callers don't
6
+ * recompute them.
7
+ *
8
+ * Standalone callables (the former `RemoteFunction` class) are materialized as
9
+ * the canonical kernel `Function` node class — "remote" is just a `binding`,
10
+ * not a distinct kind, so there is no per-domain class to configure.
11
+ *
12
+ * Conflicts: if the user core already declares a top-level node at
13
+ * `<viewsFolder>` or `<functionsFolder>`, throws — the auto-materialization
14
+ * reserves those slugs.
15
+ */
16
+ import { Folder, K, KernelSchema } from '@astrale-os/kernel-core';
17
+ import { buildCorePath } from '@astrale-os/kernel-dsl';
18
+ /** Canonical node class for standalone callables (the former `RemoteFunction`). */
19
+ const FUNCTION_CLASS = KernelSchema.classes.Function;
20
+ /** Canonical node class for GUI views. */
21
+ const VIEW_CLASS = KernelSchema.classes.View;
22
+ /** Canonical edge class linking a View to its target. */
23
+ const VIEW_FOR_EDGE_CLASS = KernelSchema.classes.view_for;
24
+ export const DEFAULT_VIEWS_FOLDER = 'views';
25
+ export const DEFAULT_FUNCTIONS_FOLDER = 'functions';
26
+ const SLUG_RE = /^[a-z][a-z0-9-]*$/;
27
+ export function extendCore(config) {
28
+ const { schema, origin, userCore, url, viewClass = VIEW_CLASS, viewForEdgeClass = VIEW_FOR_EDGE_CLASS, viewsFolder = DEFAULT_VIEWS_FOLDER, views, functionsFolder = DEFAULT_FUNCTIONS_FOLDER, remoteFunctions, } = config;
29
+ validateInputs(config);
30
+ const nodes = userCore ? [...userCore.__nodes] : [];
31
+ const edges = userCore ? [...userCore.__edges] : [];
32
+ const viewBindings = {};
33
+ const remoteFunctionBindings = {};
34
+ if (views && viewClass) {
35
+ // Enforce ViewDef's documented exclusivity: `mount` (SPA route) cannot be
36
+ // combined with `render` (inline HTML handler) or an explicit `binding` —
37
+ // silently ignoring one of them would deploy a view that behaves
38
+ // differently than its definition reads.
39
+ for (const [slug, def] of Object.entries(views)) {
40
+ if (def.mount && (def.render || def.binding)) {
41
+ throw new Error(`defineRemoteDomain: view "${slug}" sets \`mount\` together with ` +
42
+ `${def.render ? '`render`' : '`binding`'} — they are mutually exclusive.`);
43
+ }
44
+ }
45
+ assertNoConflict(nodes, origin, viewsFolder);
46
+ addFolderAndEntries({
47
+ origin,
48
+ folderSlug: viewsFolder,
49
+ nodes,
50
+ entries: Object.entries(views).map(([slug, def]) => {
51
+ const binding = url
52
+ ? def.mount
53
+ ? { remoteUrl: joinWorkerPath(url, def.mount) }
54
+ : resolveBinding(def.binding, url, viewsFolder, slug)
55
+ : undefined;
56
+ if (binding)
57
+ viewBindings[slug] = binding;
58
+ return {
59
+ slug,
60
+ nodeClass: viewClass,
61
+ data: buildFunctionData(slug, binding),
62
+ edges: buildViewForEdges(slug, def, viewForEdgeClass, viewsFolder, origin),
63
+ };
64
+ }),
65
+ edges,
66
+ });
67
+ }
68
+ if (remoteFunctions) {
69
+ assertNoConflict(nodes, origin, functionsFolder);
70
+ addFolderAndEntries({
71
+ origin,
72
+ folderSlug: functionsFolder,
73
+ nodes,
74
+ entries: Object.entries(remoteFunctions).map(([slug, def]) => {
75
+ const binding = url ? resolveBinding(def.binding, url, functionsFolder, slug) : undefined;
76
+ if (binding)
77
+ remoteFunctionBindings[slug] = binding;
78
+ return {
79
+ slug,
80
+ // Standalone callables materialize as the canonical kernel Function class.
81
+ nodeClass: FUNCTION_CLASS,
82
+ data: {
83
+ ...buildFunctionData(slug, binding),
84
+ [K.$.i('Function').ref.key]: def.ref ?? `function.${slug}`,
85
+ },
86
+ edges: [],
87
+ };
88
+ }),
89
+ edges,
90
+ });
91
+ }
92
+ return {
93
+ core: { schema, domain: origin, __nodes: nodes, __edges: edges },
94
+ viewBindings,
95
+ remoteFunctionBindings,
96
+ };
97
+ }
98
+ /** Join a worker-relative mount path onto the serving url (single slash). */
99
+ function joinWorkerPath(url, mount) {
100
+ const base = url.replace(/\/+$/, '');
101
+ return `${base}/${mount.replace(/^\/+/, '')}`;
102
+ }
103
+ export function resolveBinding(override, url, folderSlug, slug) {
104
+ // Same trailing-slash discipline as `joinWorkerPath` — a `url` ending in `/`
105
+ // must not produce `//` in the binding (the kernel pins iss by exact string).
106
+ const base = url.replace(/\/+$/, '');
107
+ if (override) {
108
+ return {
109
+ ...override,
110
+ remoteUrl: override.remoteUrl ?? `${base}/${folderSlug}/${slug}`,
111
+ };
112
+ }
113
+ return { remoteUrl: `${base}/${folderSlug}/${slug}` };
114
+ }
115
+ // ── Internal ───────────────────────────────────────────────────────────────
116
+ function validateInputs(config) {
117
+ if (config.views) {
118
+ for (const slug of Object.keys(config.views)) {
119
+ if (!SLUG_RE.test(slug)) {
120
+ throw new Error(`defineRemoteDomain: invalid view slug "${slug}" — must match ${SLUG_RE}.`);
121
+ }
122
+ }
123
+ }
124
+ if (config.remoteFunctions) {
125
+ for (const slug of Object.keys(config.remoteFunctions)) {
126
+ if (!SLUG_RE.test(slug)) {
127
+ throw new Error(`defineRemoteDomain: invalid remote-function slug "${slug}" — must match ${SLUG_RE}.`);
128
+ }
129
+ }
130
+ }
131
+ }
132
+ function assertNoConflict(nodes, origin, folderSlug) {
133
+ const folderPath = buildCorePath(origin, [folderSlug]);
134
+ if (nodes.some((n) => n.path === folderPath)) {
135
+ throw new Error(`defineRemoteDomain: top-level core slug "${folderSlug}" is reserved by ` +
136
+ 'SDK auto-materialization. Move the conflicting node or rename the ' +
137
+ '`viewsFolder` / `functionsFolder` config.');
138
+ }
139
+ }
140
+ function addFolderAndEntries(args) {
141
+ const { origin, folderSlug, entries, nodes, edges } = args;
142
+ const folderPath = buildCorePath(origin, [folderSlug]);
143
+ nodes.push({
144
+ path: folderPath,
145
+ def: Folder,
146
+ data: { [K.Named.name.key]: folderSlug },
147
+ });
148
+ for (const entry of entries) {
149
+ nodes.push({
150
+ path: buildCorePath(origin, [folderSlug, entry.slug]),
151
+ def: entry.nodeClass,
152
+ data: entry.data,
153
+ parent: folderPath,
154
+ });
155
+ for (const e of entry.edges)
156
+ edges.push(e);
157
+ }
158
+ }
159
+ function buildFunctionData(slug, binding) {
160
+ // Match the kernel-core schema serializer which JSON-stringifies the
161
+ // `Function.binding` value on Function nodes (see
162
+ // kernel/core/domain/serialize/schema.ts). The kernel install validator
163
+ // checks `typeof binding === 'string'` then parses; storing a raw object
164
+ // trips the validator with "missing remote binding" even when the object IS
165
+ // the binding. No binding at all (define-time, no url) → no prop stamped.
166
+ return {
167
+ [K.Named.name.key]: slug,
168
+ ...(binding ? { [K.$.i('Function').binding.key]: JSON.stringify(binding) } : {}),
169
+ };
170
+ }
171
+ function buildViewForEdges(slug, def, edgeClass, viewsFolder, origin) {
172
+ if (!def.viewFor || !edgeClass)
173
+ return [];
174
+ const targets = Array.isArray(def.viewFor) ? def.viewFor : [def.viewFor];
175
+ const from = buildCorePath(origin, [viewsFolder, slug]);
176
+ return targets.map((target) => ({
177
+ from,
178
+ edge: edgeClass,
179
+ to: target,
180
+ }));
181
+ }
182
+ //# sourceMappingURL=extend-core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extend-core.js","sourceRoot":"","sources":["../../src/domain/extend-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAEtD,mFAAmF;AACnF,MAAM,cAAc,GAAG,YAAY,CA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C,CAAC,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjF,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CACxB,IAAY,EACZ,GAAY,EACZ,SAAiC,EACjC,WAAmB,EACnB,MAAc;IAEd,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,CAAA;IACzC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACxE,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAA;IACvD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9B,IAAI;QACJ,IAAI,EAAE,SAAS;QACf,EAAE,EAAE,MAA6B;KAClC,CAAC,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { defineRemoteDomain } from './define';
2
+ export type { RemoteDomain, RemoteDomainConfig } from './define';
3
+ export { buildInstallGraph, buildInstallGraphHash } from './build-spec';
4
+ export { toSdkContract } from './contract';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { defineRemoteDomain } from './define';
2
+ export { buildInstallGraph, buildInstallGraphHash } from './build-spec';
3
+ export { toSdkContract } from './contract';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE7C,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA"}
@@ -0,0 +1,19 @@
1
+ export type { RemoteContext, RemoteHandler, MethodImpl, ClassMethodsImpl, InterfaceMethodsImpl, SchemaMethodsImpl, } from './method';
2
+ export { remoteMethod, remoteClassMethods, remoteInterfaceMethods } from './method';
3
+ export { defineRemoteDomain, buildInstallGraph, buildInstallGraphHash } from './domain';
4
+ export type { RemoteDomain, RemoteDomainConfig } from './domain';
5
+ export { defineView, defineRemoteFunction } from './define';
6
+ export type { ViewDef, ViewRenderContext, RemoteFunctionDef, RemoteFunctionContext } from './define';
7
+ export { MetaSchema } from './deploy/meta';
8
+ export type { Meta } from './deploy/meta';
9
+ export type { AuthPolicy, RouteBinding, FunctionBinding, CredentialSource, SingleCredentialSource, HttpMethod, RouteBody, OutputMode, } from '@astrale-os/kernel-api/routed';
10
+ export type { RemoteIdentityConfig, AuthenticateResult } from './auth';
11
+ export { authenticateRequest, buildComposedGrant, signCredential } from './auth';
12
+ export { AuthMissingError, AuthInvalidError } from './auth';
13
+ export { assertPerm, requireOwnership, READ, EDIT, USE, SHARE, ALL } from './auth';
14
+ export type { AuthContext, Attestation, Authenticated, Delegation, IdentityId, IssuerId, } from '@astrale-os/kernel-core';
15
+ export { selfGrant } from '@astrale-os/kernel-core';
16
+ export { SdkDispatcher, type SdkDispatcherConfig } from './dispatch';
17
+ export { AuthorizationDeniedError, MethodNotFoundError, SdkValidationError, SdkResultValidationError, } from './dispatch';
18
+ export type { SelfResult, CallRemoteFn } from './dispatch';
19
+ //# sourceMappingURL=index.d.ts.map