@astrale-os/sdk 0.1.0 → 0.1.2

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 (193) 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 +22 -0
  10. package/dist/auth/compose.d.ts.map +1 -0
  11. package/dist/auth/compose.js +23 -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 +28 -0
  26. package/dist/auth/kernel-client.d.ts.map +1 -0
  27. package/dist/auth/kernel-client.js +84 -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 +86 -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 +237 -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 +30 -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 +2 -2
@@ -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,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,C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,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,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,oBAAoB,CAAA;QAC9D,MAAM,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,wBAAwB,CAAA;QAE1E,yEAAyE;QACzE,wEAAwE;QACxE,MAAM,aAAa,GAAqB,MAAM;YAC5C,CAAC,CAAC,UAAU,CAAC;gBACT,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM;gBAC5B,QAAQ,EAAE,MAAM,CAAC,I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,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,CAAA;IAEvE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;IACzB,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAW,CAAA;IAC5C,MAAM,MAAM,GAAG,UAAU,CAAC;QACxB,MAAM;QACN,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,GAAG;QACH,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,eAAe,EAAE,MAAM,CAAC,eAAe;KACxC,CAAC,CAAA;IACF,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,IAAe,CAAC,CAAA;IAC9D,OAAO;QACL,QAAQ;QACR,SAAS,EAAE;YACT,GAAG;YACH,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,sBAAsB,EAAE,MAAM,CAAC,sBAAsB;SACtD;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,49 @@
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 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,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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,CAAC,OAAO,CAAC,QAAiC,CAAA;AAC7E,0CAA0C;AAC1C,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,IAA6B,CAAA;AACrE,yDAAyD;AACzD,MAAM,mBAAmB,GAAG,YAAY,CAAC,OAAO,CAAC,QAAiC,CAAA;AAKlF,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAA;AAC3C,MAAM,CAAC,MAAM,wBAAwB,GAAG,WAAW,CAAA;AACnD,MAAM,OAAO,GAAG,mBAAmB,CA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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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,aAAa,EACb,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,s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E,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ export { remoteMethod, remoteClassMethods, remoteInterfaceMethods } from './method';
2
+ // ─── Domain ──────────────────────────────────────────────────────────────
3
+ export { defineRemoteDomain, buildInstallGraph, buildInstallGraphHash } from './domain';
4
+ // ─── Declarative resource helpers ────────────────────────────────────────
5
+ // Author Views (iframe-mountable) and RemoteFunctions (standalone callables)
6
+ // at the domain definition site. Each `defineView` / `defineRemoteFunction`
7
+ // entry is auto-materialized by `defineRemoteDomain` into a graph node (a
8
+ // `View`, or the canonical kernel `Function` for standalone callables) under
9
+ // the reserved views / functions folder, keyed by its map slug; the same
10
+ // entry's `render` / `execute` (+ auth hooks) is mounted as a worker route by
11
+ // `createRemoteServer`.
12
+ export { defineView, defineRemoteFunction } from './define';
13
+ // ─── Server ──────────────────────────────────────────────────────────────
14
+ // `createRemoteServer` dynamically imports `@hono/node-server` via `./server/start`.
15
+ // Exporting the server surface from the barrel poisons browser bundlers
16
+ // (Vite/esbuild) that traverse every re-export and try to bundle the dynamic
17
+ // chunk — which fails on Node built-ins. Consumers that need the server
18
+ // runtime import from '@astrale-os/sdk/server' directly.
19
+ // ─── Deploy ──────────────────────────────────────────────────────────────
20
+ // `deployCheck` and `hashSpecFile` use Node-only modules (`node:crypto`,
21
+ // `node:fs`, `node:child_process`) at module load time. Exporting them from
22
+ // the barrel poisons browser bundlers (Vite/esbuild) that transitively load
23
+ // every re-export. Consumers that need them import from './deploy' directly.
24
+ export { MetaSchema } from './deploy/meta';
25
+ export { authenticateRequest, buildComposedGrant, signCredential } from './auth';
26
+ export { AuthMissingError, AuthInvalidError } from './auth';
27
+ export { assertPerm, requireOwnership, READ, EDIT, USE, SHARE, ALL } from './auth';
28
+ export { selfGrant } from '@astrale-os/kernel-core';
29
+ // ─── Dispatch (escape hatch for custom integrations) ─────────────────────
30
+ export { SdkDispatcher } from './dispatch';
31
+ export { AuthorizationDeniedError, MethodNotFoundError, SdkValidationError, SdkResultValidationError, } from './dispatch';
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAEnF,4EAA4E;AAC5E,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAGvF,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,0EAA0E;AAC1E,6EAA6E;AAC7E,yEAAyE;AACzE,8EAA8E;AAC9E,wBAAwB;AACxB,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAG3D,4EAA4E;AAC5E,qFAAqF;AACrF,wEAAwE;AACxE,6EAA6E;AAC7E,wEAAwE;AACxE,yDAAyD;AAEzD,4EAA4E;AAC5E,yEAAyE;AACzE,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAiB1C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AASlF,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAEnD,4EAA4E;AAC5E,OAAO,EAAE,aAAa,EAA4B,MAAM,YAAY,CAAA;AACpE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,YAAY,CAAA"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Class-level method aggregation.
3
+ *
4
+ * Where `RemoteHandler` describes one method, the types here describe a
5
+ * whole class's worth of methods. `ClassMethodsImpl<S, K, TDeps>` enforces
6
+ * that every implementable method on class `K` is provided. The interface
7
+ * variant handles abstract definitions; the schema variant indexes by class
8
+ * name.
9
+ *
10
+ * `remoteClassMethods` is the identity helper an author calls when supplying
11
+ * a class's full method record — it gives full inference for the class
12
+ * methods at once, complementing `remoteMethod` (one method at a time).
13
+ */
14
+ import type { DefForInterface, InterfaceMethodDefs, InterfaceMethodKeys, MethodClassKeys, NonSealedMethodKeys, OwnMethodKeys, ResolveParams, ResolveReturn, SealedKeys } from '@astrale-os/kernel-core/domain';
15
+ import type { ImplementableOwnKeys, Schema } from '@astrale-os/kernel-dsl';
16
+ import type { SelfResult } from '../dispatch/self';
17
+ import type { MethodImpl, RemoteHandler } from './single';
18
+ /** Per-class method implementations for a remote domain. */
19
+ export type ClassMethodsImpl<S extends Schema, K extends MethodClassKeys<S> & string, TDeps = unknown> = {
20
+ [M in OwnMethodKeys<S, K>]: MethodImpl<S, K, M, TDeps>;
21
+ } & {
22
+ [M in NonSealedMethodKeys<S, K>]: MethodImpl<S, K, M, TDeps>;
23
+ } & {
24
+ [M in SealedKeys<S, K>]?: never;
25
+ };
26
+ /** Resolve interface method handler directly (InterfaceMethodKeys ≠ MethodKeys). */
27
+ type InterfaceMethodHandler<S extends Schema, K extends string, M extends string, TDeps> = M extends keyof InterfaceMethodDefs<S, K> ? InterfaceMethodDefs<S, K>[M] extends {
28
+ readonly config: infer MC;
29
+ } ? MC extends {
30
+ readonly static: true;
31
+ } ? RemoteHandler<ResolveParams<MC>, ResolveReturn<MC>, undefined, TDeps> : RemoteHandler<ResolveParams<MC>, ResolveReturn<MC>, SelfResult, TDeps> : never : never;
32
+ /** Per-interface method implementations. */
33
+ export type InterfaceMethodsImpl<S extends Schema, K extends InterfaceMethodKeys<S> & string, TDeps = unknown> = {
34
+ [M in ImplementableOwnKeys<DefForInterface<S, K>> & string]: InterfaceMethodHandler<S, K, M, TDeps>;
35
+ };
36
+ /**
37
+ * Namespace-keyed full schema methods map, parameterized by deps.
38
+ * Handlers for classes and interfaces live under distinct `class` / `interface`
39
+ * slots, preventing name collisions between a class and an interface with the
40
+ * same name.
41
+ *
42
+ * `interface` is optional — schemas without non-abstract interface methods
43
+ * (or with no interfaces at all) do not need to provide it.
44
+ */
45
+ export type SchemaMethodsImpl<S extends Schema, TDeps = unknown> = {
46
+ class: {
47
+ [K in MethodClassKeys<S> & string]: ClassMethodsImpl<S, K, TDeps>;
48
+ };
49
+ interface?: {
50
+ [K in InterfaceMethodKeys<S> & string]: InterfaceMethodsImpl<S, K, TDeps>;
51
+ };
52
+ };
53
+ type RejectSealedKeys<S extends Schema, K extends string, I> = keyof I & SealedKeys<S, K> extends never ? I : `Error: sealed methods must not be implemented by class '${K}': ${keyof I & SealedKeys<S, K> & string}`;
54
+ /** Identity helper for authoring one class's remote methods with full schema typing. */
55
+ export declare function remoteClassMethods<TDeps>(): <S extends Schema, K extends MethodClassKeys<S> & string, I extends ClassMethodsImpl<S, K, TDeps>>(schema: S, className: K, impl: I & RejectSealedKeys<S, K, I>) => I;
56
+ export declare function remoteClassMethods<S extends Schema, K extends MethodClassKeys<S> & string, I extends ClassMethodsImpl<S, K>>(schema: S, className: K, impl: I & RejectSealedKeys<S, K, I>): I;
57
+ /**
58
+ * Identity helper for authoring one interface's remote methods with full
59
+ * schema typing — the interface-hosted counterpart of `remoteClassMethods`.
60
+ *
61
+ * Methods declared on an interface (e.g. a static `createNote` on `NoteOps`)
62
+ * live under the `interface:` slot of `SchemaMethodsImpl`. Without this helper
63
+ * an author has to fall back to `any` (there is no other way to name the
64
+ * per-method handler type — `InterfaceMethodHandler` is internal). Returns the
65
+ * per-interface impl object the `interface: { <Name>: … }` slot expects.
66
+ */
67
+ export declare function remoteInterfaceMethods<TDeps>(): <S extends Schema, K extends InterfaceMethodKeys<S> & string, I extends InterfaceMethodsImpl<S, K, TDeps>>(schema: S, interfaceName: K, impl: I) => I;
68
+ export declare function remoteInterfaceMethods<S extends Schema, K extends InterfaceMethodKeys<S> & string, I extends InterfaceMethodsImpl<S, K>>(schema: S, interfaceName: K, impl: I): I;
69
+ export {};
70
+ //# sourceMappingURL=class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../src/method/class.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACX,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAE1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAEzD,4DAA4D;AAC5D,MAAM,MAAM,gBAAgB,CAC1B,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,eAAe,CAAC,CAAC,CAAC,GAAG,MAAM,EACrC,KAAK,GAAG,OAAO,IACb;KACD,CAAC,IAAI,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC;CACvD,GAAG;KACD,CAAC,IAAI,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC;CAC7D,GAAG;KACD,CAAC,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK;CAChC,CAAA;AAED,oFAAoF;AACpF,KAAK,sBAAsB,CACzB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,MAAM,EACh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BAAgB,sBAAsB,CACpC,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,mBAAmB,CAAC,CAAC,CAAC,GAAG,MAAM,EACzC,CAAC,SAAS,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,EACpC,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAAA"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Class-level method aggregation.
3
+ *
4
+ * Where `RemoteHandler` describes one method, the types here describe a
5
+ * whole class's worth of methods. `ClassMethodsImpl<S, K, TDeps>` enforces
6
+ * that every implementable method on class `K` is provided. The interface
7
+ * variant handles abstract definitions; the schema variant indexes by class
8
+ * name.
9
+ *
10
+ * `remoteClassMethods` is the identity helper an author calls when supplying
11
+ * a class's full method record — it gives full inference for the class
12
+ * methods at once, complementing `remoteMethod` (one method at a time).
13
+ */
14
+ export function remoteClassMethods(...args) {
15
+ if (args.length === 0) {
16
+ return (...innerArgs) => innerArgs[2];
17
+ }
18
+ return args[2];
19
+ }
20
+ export function remoteInterfaceMethods(...args) {
21
+ if (args.length === 0) {
22
+ return (...innerArgs) => innerArgs[2];
23
+ }
24
+ return args[2];
25
+ }
26
+ //# sourceMappingURL=class.js.map