@astrale-os/sdk 0.1.10 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/auth/index.d.ts +1 -1
  2. package/dist/auth/index.d.ts.map +1 -1
  3. package/dist/auth/index.js +1 -1
  4. package/dist/auth/index.js.map +1 -1
  5. package/dist/cli/run.d.ts +0 -1
  6. package/dist/cli/run.d.ts.map +1 -1
  7. package/dist/cli/run.js +17 -10
  8. package/dist/cli/run.js.map +1 -1
  9. package/dist/config/adapter.d.ts +12 -11
  10. package/dist/config/adapter.d.ts.map +1 -1
  11. package/dist/config/adapter.js.map +1 -1
  12. package/dist/config/define-domain.d.ts +13 -29
  13. package/dist/config/define-domain.d.ts.map +1 -1
  14. package/dist/config/define-domain.js +22 -33
  15. package/dist/config/define-domain.js.map +1 -1
  16. package/dist/config/deploy.d.ts +1 -1
  17. package/dist/config/deploy.js +1 -1
  18. package/dist/config/index.d.ts +1 -1
  19. package/dist/config/index.d.ts.map +1 -1
  20. package/dist/define/remote-function.d.ts +9 -14
  21. package/dist/define/remote-function.d.ts.map +1 -1
  22. package/dist/define/remote-function.js +9 -8
  23. package/dist/define/remote-function.js.map +1 -1
  24. package/dist/define/view.d.ts +8 -6
  25. package/dist/define/view.d.ts.map +1 -1
  26. package/dist/define/view.js +8 -6
  27. package/dist/define/view.js.map +1 -1
  28. package/dist/dispatch/identity.d.ts +10 -9
  29. package/dist/dispatch/identity.d.ts.map +1 -1
  30. package/dist/dispatch/identity.js +9 -15
  31. package/dist/dispatch/identity.js.map +1 -1
  32. package/dist/domain/binding.d.ts +18 -0
  33. package/dist/domain/binding.d.ts.map +1 -0
  34. package/dist/domain/binding.js +29 -0
  35. package/dist/domain/binding.js.map +1 -0
  36. package/dist/domain/build-spec.d.ts.map +1 -1
  37. package/dist/domain/build-spec.js +10 -7
  38. package/dist/domain/build-spec.js.map +1 -1
  39. package/dist/domain/define.d.ts +27 -27
  40. package/dist/domain/define.d.ts.map +1 -1
  41. package/dist/domain/define.js +31 -49
  42. package/dist/domain/define.js.map +1 -1
  43. package/dist/domain/extend-functions.d.ts +44 -0
  44. package/dist/domain/extend-functions.d.ts.map +1 -0
  45. package/dist/domain/extend-functions.js +69 -0
  46. package/dist/domain/extend-functions.js.map +1 -0
  47. package/dist/domain/extend-views.d.ts +45 -0
  48. package/dist/domain/extend-views.d.ts.map +1 -0
  49. package/dist/domain/extend-views.js +116 -0
  50. package/dist/domain/extend-views.js.map +1 -0
  51. package/dist/index.d.ts +2 -2
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +1 -1
  54. package/dist/index.js.map +1 -1
  55. package/dist/server/auxiliary-routes.js +1 -1
  56. package/dist/server/auxiliary-routes.js.map +1 -1
  57. package/dist/server/worker-entry.d.ts +3 -3
  58. package/dist/server/worker-entry.js +3 -3
  59. package/package.json +2 -5
  60. package/src/auth/index.ts +1 -1
  61. package/src/cli/run.ts +17 -12
  62. package/src/config/adapter.ts +9 -11
  63. package/src/config/define-domain.ts +34 -56
  64. package/src/config/deploy.ts +1 -1
  65. package/src/config/index.ts +1 -1
  66. package/src/define/remote-function.ts +9 -14
  67. package/src/define/view.ts +8 -6
  68. package/src/dispatch/identity.ts +15 -21
  69. package/src/domain/binding.ts +37 -0
  70. package/src/domain/build-spec.ts +18 -7
  71. package/src/domain/define.ts +67 -62
  72. package/src/domain/extend-functions.ts +86 -0
  73. package/src/domain/extend-views.ts +151 -0
  74. package/src/index.ts +7 -2
  75. package/src/server/auxiliary-routes.ts +1 -1
  76. package/src/server/worker-entry.ts +3 -3
  77. package/src/domain/extend-core.ts +0 -301
@@ -2,14 +2,16 @@
2
2
  * Authoring a `View` — iframe-mountable callable served by the domain worker.
3
3
  *
4
4
  * Each entry in `defineRemoteDomain({ views: { ... } })` becomes both:
5
- * - a graph node at `/${origin}/core/<viewsFolder>/<slug>` (auto-materialized
6
- * by the SDK; the `core/` segment is the universal anchor injected by
7
- * `buildCorePath`. `<slug>` is the map key, so it lives in exactly one place)
5
+ * - a first-class domain MEMBER: a `View` node at `/${origin}/views/<slug>`
6
+ * attached to the Domain via an `of_domain` edge (slug `view.<slug>`),
7
+ * addressable as `/:${origin}:view.<slug>`. `<slug>` is the map key, so it
8
+ * lives in exactly one place.
8
9
  * - a Hono route on the worker at the path implied by `binding`
9
- * (`/<viewsFolder>/<slug>` by default — note: no `core/` in the URL).
10
+ * (`/<viewsFolder>/<slug>` by default).
10
11
  *
11
- * The `core/` segment appears in the GRAPH path only; the URL path that
12
- * lands in `Function.binding.remoteUrl` is `${url}/<viewsFolder>/<slug>`.
12
+ * The graph layout (`/<origin>/views/<slug>`) is a fixed kernel convention; the
13
+ * URL path that lands in `Function.binding.remoteUrl` is
14
+ * `${url}/<viewsFolder>/<slug>` — DECOUPLED from the graph layout.
13
15
  *
14
16
  * The author can override the URL via `binding` — host and/or path
15
17
  * placeholders are supported (the kernel's `route` mechanism does the
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/define/view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAChF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD,MAAM,MAAM,iBAAiB,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,SAAS,UAAU,GAAG,UAAU,IAAI;IACtF,+DAA+D;IAC/D,CAAC,EAAE,OAAO,CAAA;IACV;;;;OAIG;IACH,MAA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;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1E;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC/E;;;;;OAKG;IACH,OAAO,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;IACvC,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,SAAS,UAAU,GAAG,UAAU,EAC/E,GAAG,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,GACzB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAEvB"}
@@ -2,14 +2,16 @@
2
2
  * Authoring a `View` — iframe-mountable callable served by the domain worker.
3
3
  *
4
4
  * Each entry in `defineRemoteDomain({ views: { ... } })` becomes both:
5
- * - a graph node at `/${origin}/core/<viewsFolder>/<slug>` (auto-materialized
6
- * by the SDK; the `core/` segment is the universal anchor injected by
7
- * `buildCorePath`. `<slug>` is the map key, so it lives in exactly one place)
5
+ * - a first-class domain MEMBER: a `View` node at `/${origin}/views/<slug>`
6
+ * attached to the Domain via an `of_domain` edge (slug `view.<slug>`),
7
+ * addressable as `/:${origin}:view.<slug>`. `<slug>` is the map key, so it
8
+ * lives in exactly one place.
8
9
  * - a Hono route on the worker at the path implied by `binding`
9
- * (`/<viewsFolder>/<slug>` by default — note: no `core/` in the URL).
10
+ * (`/<viewsFolder>/<slug>` by default).
10
11
  *
11
- * The `core/` segment appears in the GRAPH path only; the URL path that
12
- * lands in `Function.binding.remoteUrl` is `${url}/<viewsFolder>/<slug>`.
12
+ * The graph layout (`/<origin>/views/<slug>`) is a fixed kernel convention; the
13
+ * URL path that lands in `Function.binding.remoteUrl` is
14
+ * `${url}/<viewsFolder>/<slug>` — DECOUPLED from the graph layout.
13
15
  *
14
16
  * The author can override the URL via `binding` — host and/or path
15
17
  * placeholders are supported (the kernel's `route` mechanism does the
@@ -1 +1 @@
1
- {"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/define/view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAsFH;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,GAA0B;IAE1B,OAAO,GAAG,CAAA;AACZ,CAAC"}
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/define/view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAsFH;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,GAA0B;IAE1B,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Per-callable identity — dispatcher runtime + install-time wiring.
3
3
  *
4
- * Two flavors of callable get an identity per the install-time identity
5
- * binding: Methods on classes/interfaces (sub = MethodPath) and auto-
6
- * materialized core function nodes RemoteFunctions and Views (sub =
7
- * AbsolutePath of the node under `core/{functions,views}/<slug>`).
4
+ * Three flavors of callable get an identity per the install-time identity
5
+ * binding: Methods on classes/interfaces (sub = MethodPath), standalone-function
6
+ * MEMBERS (sub = AbsolutePath at `/<origin>/functions/<slug>`), and view MEMBERS
7
+ * (sub = AbsolutePath at `/<origin>/views/<slug>`).
8
8
  *
9
9
  * At server startup the method dispatcher and the View / RemoteFunction
10
10
  * route mounter pre-compute, for every materialized callable, the
@@ -41,11 +41,12 @@ export type AuxBuckets<T> = {
41
41
  remoteFunctions: Record<string, T>;
42
42
  };
43
43
  /**
44
- * slug → `AbsolutePath.raw` for each auto-materialized aux node
45
- * (RemoteFunction / View). These nodes live at
46
- * `/<origin>/core/{functions,views}/<slug>` and have no class+method
47
- * decomposition that would justify a MethodPath — their identity is their
48
- * graph position.
44
+ * slug → `AbsolutePath.raw` for each aux callable MEMBER node:
45
+ * - standalone-function members (`kind: 'function'`) at `/<origin>/functions/<slug>`;
46
+ * - view members (`kind: 'view'`) at `/<origin>/views/<slug>` (plus any
47
+ * hand-authored/legacy core `View` nodes, `kind: 'core'` className `View`).
48
+ * Neither has a class+method decomposition that would justify a MethodPath —
49
+ * their identity is their graph position.
49
50
  */
50
51
  export type AuxIdentityPaths = AuxBuckets<string>;
51
52
  export declare function collectAuxIdentityPaths(compiled: CompiledDomain): AuxIdentityPaths;
@@ -1 +1 @@
1
- {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/dispatch/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAIjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAExD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMnF;AAED;gEACgE;AAChE,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IACxB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;CACnC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;AAEjD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,cAAc,GAAG,gBAAgB,CAoBlF;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAA;AAE7D,wBAAgB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,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,GACb,cAAc,CAWhB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,WAAW,CAAC,gBAAgB,CAAC,EAAE,EACxC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,GACb,GAAG,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE,oBAAoB,CAAC,CAmB1D"}
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Per-callable identity — dispatcher runtime + install-time wiring.
3
3
  *
4
- * Two flavors of callable get an identity per the install-time identity
5
- * binding: Methods on classes/interfaces (sub = MethodPath) and auto-
6
- * materialized core function nodes RemoteFunctions and Views (sub =
7
- * AbsolutePath of the node under `core/{functions,views}/<slug>`).
4
+ * Three flavors of callable get an identity per the install-time identity
5
+ * binding: Methods on classes/interfaces (sub = MethodPath), standalone-function
6
+ * MEMBERS (sub = AbsolutePath at `/<origin>/functions/<slug>`), and view MEMBERS
7
+ * (sub = AbsolutePath at `/<origin>/views/<slug>`).
8
8
  *
9
9
  * At server startup the method dispatcher and the View / RemoteFunction
10
10
  * route mounter pre-compute, for every materialized callable, the
@@ -43,21 +43,15 @@ export function collectAuxIdentityPaths(compiled) {
43
43
  const views = {};
44
44
  const remoteFunctions = {};
45
45
  for (const c of resolveCallables(compiled)) {
46
- if (c.kind !== 'core' || !c.slug)
46
+ if (!c.slug)
47
47
  continue;
48
- if (c.className === 'View') {
49
- views[c.slug] = c.sub;
50
- }
51
- else if (c.className === 'Function') {
52
- // Standalone callables (the former `RemoteFunction`) materialize as the
53
- // canonical kernel `Function` class.
48
+ if (c.kind === 'function') {
54
49
  remoteFunctions[c.slug] = c.sub;
55
50
  }
56
- else {
57
- throw new Error(`collectAuxIdentityPaths: unrecognised aux callable className "${c.className}" ` +
58
- `at ${c.ref}. If you've added a new auto-materialized Function class to extendCore, ` +
59
- `extend this collector + the kernel walker (resolveCallables) to handle it.`);
51
+ else if (c.kind === 'view' || (c.kind === 'core' && c.className === 'View')) {
52
+ views[c.slug] = c.sub;
60
53
  }
54
+ // Methods (`kind: 'method'`) get their identity via `collectMethodPaths`.
61
55
  }
62
56
  return { views, remoteFunctions };
63
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/dispatch/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAKjE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAwB;IACzD,MAAM,GAAG,GAA2B,EAAE,CAAA;IACtC,KAAK,MAAM,CAAC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3C,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ;YAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAA;IAC7C,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAkBD,MAAM,UAAU,uBAAuB,CAAC,QAAwB;IAC9D,MAAM,KAAK,GAA2B,EAAE,CAAA;IACxC,MAAM,eAAe,GAA2B,EAAE,CAAA;IAClD,KAAK,MAAM,CAAC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3C,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,CAAC,IAAI;YAAE,SAAQ;QAC1C,IAAI,CAAC,CAAC,SAAS,KAAK,MAAM,EAAE,CAAC;YAC3B,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAA;QACvB,CAAC;aAAM,IAAI,CAAC,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;YACtC,wEAAwE;YACxE,qCAAqC;YACrC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CA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AAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAChC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,yEAAyE;YACzE,wEAAwE;YACxE,gEAAgE;YAChE,yEAAyE;YACzE,2DAA2D;YAC3D,MAAM,IAAI,KAAK,CACb,6BAA6B,KAAK,CAAC,GAAG,wCAAwC;gBAC5E,qEAAqE,CACxE,CAAA;QACH,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;IACjD,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Shared binding helpers for auto-materialized members (functions + views).
3
+ *
4
+ * The worker ROUTE URL a member is served at — `<url>/<folderSlug>/<slug>` — is
5
+ * decoupled from the member's GRAPH layout (`/<origin>/{functions,views}/<slug>`,
6
+ * a fixed kernel convention). `folderSlug` names only the URL segment.
7
+ */
8
+ import type { FunctionBinding } from '@astrale-os/kernel-api/routed';
9
+ /** Join a worker-relative mount path onto the serving url (single slash). */
10
+ export declare function joinWorkerPath(url: string, mount: string): string;
11
+ /**
12
+ * Resolve a member's effective binding against the serving `url`. An explicit
13
+ * `override.remoteUrl` wins; otherwise defaults to `<url>/<folderSlug>/<slug>`.
14
+ * Same trailing-slash discipline as {@link joinWorkerPath} — a `url` ending in
15
+ * `/` must not produce `//` (the kernel pins `iss` by exact string).
16
+ */
17
+ export declare function resolveBinding(override: FunctionBinding | undefined, url: string, folderSlug: string, slug: string): FunctionBinding;
18
+ //# sourceMappingURL=binding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../../src/domain/binding.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEpE,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGjE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,eAAe,GAAG,SAAS,EACrC,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GACX,eAAe,CASjB"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Shared binding helpers for auto-materialized members (functions + views).
3
+ *
4
+ * The worker ROUTE URL a member is served at — `<url>/<folderSlug>/<slug>` — is
5
+ * decoupled from the member's GRAPH layout (`/<origin>/{functions,views}/<slug>`,
6
+ * a fixed kernel convention). `folderSlug` names only the URL segment.
7
+ */
8
+ /** Join a worker-relative mount path onto the serving url (single slash). */
9
+ export function joinWorkerPath(url, mount) {
10
+ const base = url.replace(/\/+$/, '');
11
+ return `${base}/${mount.replace(/^\/+/, '')}`;
12
+ }
13
+ /**
14
+ * Resolve a member's effective binding against the serving `url`. An explicit
15
+ * `override.remoteUrl` wins; otherwise defaults to `<url>/<folderSlug>/<slug>`.
16
+ * Same trailing-slash discipline as {@link joinWorkerPath} — a `url` ending in
17
+ * `/` must not produce `//` (the kernel pins `iss` by exact string).
18
+ */
19
+ export function resolveBinding(override, url, folderSlug, slug) {
20
+ const base = url.replace(/\/+$/, '');
21
+ if (override) {
22
+ return {
23
+ ...override,
24
+ remoteUrl: override.remoteUrl ?? `${base}/${folderSlug}/${slug}`,
25
+ };
26
+ }
27
+ return { remoteUrl: `${base}/${folderSlug}/${slug}` };
28
+ }
29
+ //# sourceMappingURL=binding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/domain/binding.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,6EAA6E;AAC7E,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,KAAa;IACvD,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IACpC,OAAO,GAAG,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAA;AAC/C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,QAAqC,EACrC,GAAW,EACX,UAAkB,EAClB,IAAY;IAEZ,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IACpC,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO;YACL,GAAG,QAAQ;YACX,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,GAAG,IAAI,IAAI,UAAU,IAAI,IAAI,EAAE;SACjE,CAAA;IACH,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,IAAI,UAAU,IAAI,IAAI,EAAE,EAAE,CAAA;AACvD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"build-spec.d.ts","sourceRoot":"","sources":["../../src/domain/build-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAS,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAE/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAKpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAK5C;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EACvB,GAAG,EAAE,MAAM,GACV,SAAS,CAGX;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EACvB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAEjB"}
1
+ {"version":3,"file":"build-spec.d.ts","sourceRoot":"","sources":["../../src/domain/build-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAS,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAE/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAKpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAK5C;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EACvB,GAAG,EAAE,MAAM,GACV,SAAS,CASX;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EACvB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAEjB"}
@@ -28,8 +28,8 @@ import { materializeRemoteDomain } from './define';
28
28
  * kernel install guard rejects it).
29
29
  */
30
30
  export function buildInstallGraph(domain, url) {
31
- const { compiled } = materializeRemoteDomain(domain, url);
32
- return buildSpecInternal(compiled, domain.methods, url).toWire();
31
+ const { compiled, auxiliary } = materializeRemoteDomain(domain, url);
32
+ return buildSpecInternal(compiled, domain.methods, url, auxiliary?.functionSchemas ?? [], auxiliary?.viewSchemas ?? []).toWire();
33
33
  }
34
34
  /**
35
35
  * Content hash of the install graph. Delegates the canonical hash to kernel-core's
@@ -40,12 +40,15 @@ export function buildInstallGraphHash(domain, url) {
40
40
  return hashInstallGraph(buildInstallGraph(domain, url));
41
41
  }
42
42
  // ── Internal ────────────────────────────────────────────────
43
- function buildSpecInternal(compiled, methods, url) {
43
+ function buildSpecInternal(compiled, methods, url, functionSchemas, viewSchemas) {
44
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.
45
+ // Method impls + standalone-function-member impls travel in the same callable
46
+ // array (distinct refs: `class.X.method.y` vs `function.<slug>`); view-member
47
+ // impls travel in `options.views` (a view differs structurally — handshake,
48
+ // view_for, View class). The serializer emits method nodes from the IR,
49
+ // function/view members from `compiled.$.refs.{functions,views}`, pulling each
50
+ // impl by ref.
51
+ const tree = serialize(compiled, [...serialized, ...functionSchemas], { views: viewSchemas });
49
52
  return tree.toGraph();
50
53
  }
51
54
  /**
@@ -1 +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,UAAU,iBAAiB,CAC/B,MAAuB,EACvB,GAAW;IAEX,MAAM,EAAE,QAAQ,EAAE,GAAG,uBAAuB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACzD,OAAO,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,MAAM,EAAe,CAAA;AAC/E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAuB,EACvB,GAAW;IAEX,OAAO,gBAAgB,CAAC,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;AACzD,CAAC;AAED,+DAA+D;AAE/D,SAAS,iBAAiB,CACxB,QAAkC,EAClC,OAAwC,EACxC,GAAW;IAEX,MAAM,UAAU,GAAG,yBAAyB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,CAAC,CAAA;IACpE,MAAM,IAAI,GAAG,SAAS,CA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;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"}
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * `defineRemoteDomain` — turn a typed schema + methods map into a mountable domain.
3
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'
4
+ * `views` and `functions` entries become first-class DOMAIN MEMBERS: a `View` /
5
+ * `Function` node attached to the Domain via an `of_domain` edge (slug
6
+ * `view.<slug>` / `function.<slug>`), laid out at `/<origin>/{views,functions}/<slug>`.
7
+ * Their contract half (the member ref) threads through `compileDomain`; their
8
+ * impl/binding half threads through `serialize`. The same entries'
10
9
  * `render` / `execute` handlers are mounted as Hono routes by
11
- * `createRemoteServer`. Slug = map key.
10
+ * `createRemoteServer` at `<url>/<viewsFolder|functionsFolder>/<slug>` (the route
11
+ * URL is decoupled from the graph layout). Slug = map key.
12
12
  *
13
13
  * The domain definition is deployment-agnostic: it carries NO serving url. The
14
14
  * url is supplied late by the spec producer (`createRemoteServer({ url })` at
@@ -17,8 +17,8 @@
17
17
  * — the worker serving URL, which is also `iss` and the binding base.
18
18
  */
19
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';
20
+ import type { BoundMethod, CompiledDomain, FunctionSchema, ViewSchema } from '@astrale-os/kernel-core/domain';
21
+ import type { Core, Schema } from '@astrale-os/kernel-dsl';
22
22
  import type { AnyRemoteFunctionDef, ViewDef } from '../define';
23
23
  import type { SchemaMethodsImpl } from '../method/class';
24
24
  import type { AnyRemoteHandler } from '../method/single';
@@ -27,24 +27,26 @@ export type RemoteDomainConfig<S extends Schema, TDeps> = {
27
27
  methods: SchemaMethodsImpl<S, TDeps>;
28
28
  core?: Core<S>;
29
29
  views?: Record<string, ViewDef<TDeps>>;
30
- viewClass?: AnyNodeDef;
31
- viewForEdgeClass?: AnyEdgeDef;
32
30
  viewsFolder?: string;
33
31
  remoteFunctions?: Record<string, AnyRemoteFunctionDef>;
34
32
  functionsFolder?: string;
35
33
  };
36
- /** Effective bindings + folder layout for auxiliary routes, resolved against `url`. */
34
+ /** Effective bindings + folder layout + member schemas for auxiliary routes, resolved against `url`. */
37
35
  export type AuxiliaryMetadata = {
38
36
  url: string;
39
37
  viewsFolder: string;
40
38
  functionsFolder: string;
41
39
  viewBindings: Record<string, FunctionBinding>;
42
40
  remoteFunctionBindings: Record<string, FunctionBinding>;
41
+ /** Function members' impl/binding half (`function.<slug>`) for `serialize`. */
42
+ functionSchemas: FunctionSchema[];
43
+ /** View members' impl/binding half (`view.<slug>`) for `serialize`. */
44
+ viewSchemas: ViewSchema[];
43
45
  };
44
46
  export type RemoteDomain<S extends Schema = Schema> = {
45
47
  /**
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
+ * Define-time compile: full domain STRUCTURE (classes, methods, and the
49
+ * view/function members' paths/names/refs — what identity, subs, and contract
48
50
  * resolution need). It carries NO `binding` values: bindings derive from the
49
51
  * serving url, which only the spec producers know — they call
50
52
  * `materializeRemoteDomain(domain, url)` for the install-ready compile.
@@ -53,26 +55,24 @@ export type RemoteDomain<S extends Schema = Schema> = {
53
55
  methods: BoundMethod<AnyRemoteHandler>[];
54
56
  views?: Record<string, ViewDef<any>>;
55
57
  remoteFunctions?: Record<string, AnyRemoteFunctionDef>;
56
- /** The original config, so `materializeRemoteDomain` re-extends from source. */
57
- config: ExtendInputs;
58
+ /** The original config, so `materializeRemoteDomain` re-materializes from source. */
59
+ config: MaterializeInputs;
58
60
  };
59
- /** The defineRemoteDomain inputs `materializeRemoteDomain` needs to re-extend. */
60
- type ExtendInputs = {
61
+ /** The defineRemoteDomain inputs `materializeRemoteDomain` needs to re-materialize. */
62
+ type MaterializeInputs = {
61
63
  userCore?: Core;
62
- viewClass?: AnyNodeDef;
63
- viewForEdgeClass?: AnyEdgeDef;
64
64
  viewsFolder: string;
65
65
  functionsFolder: string;
66
66
  };
67
67
  export declare function defineRemoteDomain<TDeps>(): <S extends Schema>(config: RemoteDomainConfig<S, TDeps>) => RemoteDomain<S>;
68
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
73
- * `astrale-domain` 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).
69
+ * Materialize a `RemoteDomain` at its real serving `url`: re-compiles the domain
70
+ * and builds every member's url-stamped impl schema + binding, returning the
71
+ * binding maps the auxiliary routes mount from and the member schemas `serialize`
72
+ * emits from. Called by the only two spec producers — `createRemoteServer`
73
+ * (`config.url`) and the `astrale-domain` CLI. Returns the define-time `compiled`
74
+ * untouched when there is no aux to stamp. Pure, so safe to call repeatedly (and
75
+ * memoized per cold isolate by the callers).
76
76
  */
77
77
  export declare function materializeRemoteDomain<S extends Schema>(domain: RemoteDomain<S>, url: string): {
78
78
  compiled: CompiledDomain<S>;
@@ -1 +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,gCAAgC,CAAA;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAIlF,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAIxD,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,IAAI;IACxD,MAAM,EAAE,CAAC,CAAA;IACT,OAAO,EAAE,iBAAiB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IACpC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IAEd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IACtC,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,gBAAgB,CAAC,EAAE,UAAU,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAA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
2
  * `defineRemoteDomain` — turn a typed schema + methods map into a mountable domain.
3
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'
4
+ * `views` and `functions` entries become first-class DOMAIN MEMBERS: a `View` /
5
+ * `Function` node attached to the Domain via an `of_domain` edge (slug
6
+ * `view.<slug>` / `function.<slug>`), laid out at `/<origin>/{views,functions}/<slug>`.
7
+ * Their contract half (the member ref) threads through `compileDomain`; their
8
+ * impl/binding half threads through `serialize`. The same entries'
10
9
  * `render` / `execute` handlers are mounted as Hono routes by
11
- * `createRemoteServer`. Slug = map key.
10
+ * `createRemoteServer` at `<url>/<viewsFolder|functionsFolder>/<slug>` (the route
11
+ * URL is decoupled from the graph layout). Slug = map key.
12
12
  *
13
13
  * The domain definition is deployment-agnostic: it carries NO serving url. The
14
14
  * url is supplied late by the spec producer (`createRemoteServer({ url })` at
@@ -17,28 +17,16 @@
17
17
  * — the worker serving URL, which is also `iss` and the binding base.
18
18
  */
19
19
  import { bindMethods, compileDomain } from '@astrale-os/kernel-core/domain';
20
- import { DEFAULT_FUNCTIONS_FOLDER, DEFAULT_VIEWS_FOLDER, extendCore } from './extend-core';
20
+ import { buildFunctionDeclarations, buildFunctionSchemas, DEFAULT_FUNCTIONS_FOLDER, } from './extend-functions';
21
+ import { buildViewDeclarations, buildViewSchemas, DEFAULT_VIEWS_FOLDER } from './extend-views';
21
22
  export function defineRemoteDomain() {
22
23
  return function (config) {
23
- const hasAux = Boolean(config.views || config.remoteFunctions);
24
24
  const viewsFolder = config.viewsFolder ?? DEFAULT_VIEWS_FOLDER;
25
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);
26
+ // Views + functions are domain MEMBERS their contract enters compile via
27
+ // the `functions` / `views` args (no Core involvement). `config.core` is the
28
+ // author's own genuine genesis instance data, untouched.
29
+ const compiled = compileDomain(config.schema, config.core, undefined, config.remoteFunctions ? buildFunctionDeclarations(config.remoteFunctions) : undefined, config.views ? buildViewDeclarations(config.views) : undefined);
42
30
  const methods = bindMethods(compiled.$.schema, compiled.$.methods,
43
31
  // oxlint-disable-next-line no-explicit-any
44
32
  config.methods);
@@ -49,8 +37,6 @@ export function defineRemoteDomain() {
49
37
  ...(config.remoteFunctions ? { remoteFunctions: config.remoteFunctions } : {}),
50
38
  config: {
51
39
  userCore: config.core,
52
- viewClass: config.viewClass,
53
- viewForEdgeClass: config.viewForEdgeClass,
54
40
  viewsFolder,
55
41
  functionsFolder,
56
42
  },
@@ -58,13 +44,13 @@ export function defineRemoteDomain() {
58
44
  };
59
45
  }
60
46
  /**
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
65
- * `astrale-domain` 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).
47
+ * Materialize a `RemoteDomain` at its real serving `url`: re-compiles the domain
48
+ * and builds every member's url-stamped impl schema + binding, returning the
49
+ * binding maps the auxiliary routes mount from and the member schemas `serialize`
50
+ * emits from. Called by the only two spec producers — `createRemoteServer`
51
+ * (`config.url`) and the `astrale-domain` CLI. Returns the define-time `compiled`
52
+ * untouched when there is no aux to stamp. Pure, so safe to call repeatedly (and
53
+ * memoized per cold isolate by the callers).
68
54
  */
69
55
  export function materializeRemoteDomain(domain, url) {
70
56
  const hasAux = Boolean(domain.views || domain.remoteFunctions);
@@ -72,27 +58,23 @@ export function materializeRemoteDomain(domain, url) {
72
58
  return { compiled: domain.compiled, auxiliary: undefined };
73
59
  const { config } = domain;
74
60
  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);
61
+ const compiled = compileDomain(schema, config.userCore, undefined, domain.remoteFunctions ? buildFunctionDeclarations(domain.remoteFunctions) : undefined, domain.views ? buildViewDeclarations(domain.views) : undefined);
62
+ const fns = domain.remoteFunctions
63
+ ? buildFunctionSchemas(domain.remoteFunctions, url, config.functionsFolder)
64
+ : { schemas: [], bindings: {} };
65
+ const vws = domain.views
66
+ ? buildViewSchemas(domain.views, url, config.viewsFolder, schema)
67
+ : { schemas: [], bindings: {} };
88
68
  return {
89
69
  compiled,
90
70
  auxiliary: {
91
71
  url,
92
72
  viewsFolder: config.viewsFolder,
93
73
  functionsFolder: config.functionsFolder,
94
- viewBindings: result.viewBindings,
95
- remoteFunctionBindings: result.remoteFunctionBindings,
74
+ viewBindings: vws.bindings,
75
+ remoteFunctionBindings: fns.bindings,
76
+ functionSchemas: fns.schemas,
77
+ viewSchemas: vws.schemas,
96
78
  },
97
79
  };
98
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"define.js","sourceRoot":"","sources":["../../src/domain/define.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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Ae;QAChC,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,eAAe,EAAE,GAAG,EAAE,MAAM,CAAC,eAAe,CAAC;QAC3E,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;IACjC,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK;QACtB,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC;QACjE,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;IAEjC,OAAO;QACL,QAAQ;QACR,SAAS,EAAE;YACT,GAAG;YACH,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,YAAY,EAAE,GAAG,CAAC,QAAQ;YAC1B,sBAAsB,EAAE,GAAG,CAAC,QAAQ;YACpC,eAAe,EAAE,GAAG,CAAC,OAAO;YAC5B,WAAW,EAAE,GAAG,CAAC,OAAO;SACzB;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Materialize the `functions` map (`defineRemoteFunction` entries) into the two
3
+ * halves a standalone-function DOMAIN MEMBER contributes — mirroring how a class
4
+ * method splits across compile + serialize:
5
+ *
6
+ * - `FunctionDeclarations` — the CONTRACT half, fed to `compileDomain`'s 4th
7
+ * arg. The member ref (`function.<slug>`), the layout
8
+ * (`/<origin>/functions/<slug>`), and the `of_domain` edge slug all derive
9
+ * from the map key; the kernel owns that mapping.
10
+ * - `FunctionSchema[]` + per-slug `FunctionBinding` — the IMPL/BINDING half,
11
+ * fed to `serialize` (url-stamped). The worker route is
12
+ * `<url>/<functionsFolder>/<slug>`, DECOUPLED from the graph layout — so
13
+ * `functionsFolder` only names the URL segment, not the node position.
14
+ *
15
+ * A standalone function is NOT a core/instance node: it is attached directly to
16
+ * the Domain via `of_domain` by the kernel-core serializer, so this module never
17
+ * touches `Core`.
18
+ */
19
+ import type { FunctionBinding } from '@astrale-os/kernel-api/routed';
20
+ import type { FunctionDeclarations, FunctionSchema } from '@astrale-os/kernel-core/domain';
21
+ import type { AnyRemoteFunctionDef } from '../define/remote-function';
22
+ /**
23
+ * Default URL segment for a function's worker route (`<url>/functions/<slug>`).
24
+ * Names the HTTP route only — the graph layout (`/<origin>/functions/<slug>`) is
25
+ * a fixed kernel convention, independent of this.
26
+ */
27
+ export declare const DEFAULT_FUNCTIONS_FOLDER = "functions";
28
+ /**
29
+ * Contract half — one declaration per `functions` map key, for `compileDomain`'s
30
+ * `functions` arg. The slug drives ref/path/of_domain; impl/binding arrive at
31
+ * serialize.
32
+ */
33
+ export declare function buildFunctionDeclarations(functions: Record<string, AnyRemoteFunctionDef>): FunctionDeclarations;
34
+ /**
35
+ * Impl/binding half — `FunctionSchema[]` for `serialize` plus the per-slug
36
+ * `FunctionBinding` map the worker mounts routes from. `ref` is the canonical
37
+ * `function.<slug>` member ref (matching `compiled.$.refs.functions`), so the
38
+ * serializer's per-member impl lookup finds it.
39
+ */
40
+ export declare function buildFunctionSchemas(functions: Record<string, AnyRemoteFunctionDef>, url: string, functionsFolder: string): {
41
+ schemas: FunctionSchema[];
42
+ bindings: Record<string, FunctionBinding>;
43
+ };
44
+ //# sourceMappingURL=extend-functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extend-functions.d.ts","sourceRoot":"","sources":["../../src/domain/extend-functions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAI1F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAIrE;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,cAAc,CAAA;AAanD;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAC9C,oBAAoB,CAKtB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAC/C,GAAG,EAAE,MAAM,EACX,eAAe,EAAE,MAAM,GACtB;IAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CAAE,CAe1E"}