@microverse.ts/host-surface 0.2.0 → 0.3.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 (40) hide show
  1. package/README.md +45 -15
  2. package/dist/application/ports/ScriptReferenceResolverPort.d.ts +13 -0
  3. package/dist/application/ports/ScriptReferenceResolverPort.d.ts.map +1 -0
  4. package/dist/application/useCases/compileBridgeDeclarationsFromHostSurfaceSpec.d.ts +3 -3
  5. package/dist/application/useCases/compileBridgeDeclarationsFromHostSurfaceSpec.d.ts.map +1 -1
  6. package/dist/application/useCases/compileHostSurface.d.ts +4 -3
  7. package/dist/application/useCases/compileHostSurface.d.ts.map +1 -1
  8. package/dist/domain/componentSlotPrelude.d.ts +8 -0
  9. package/dist/domain/componentSlotPrelude.d.ts.map +1 -1
  10. package/dist/domain/componentTypeSpec.d.ts +12 -0
  11. package/dist/domain/componentTypeSpec.d.ts.map +1 -0
  12. package/dist/domain/hostSurfaceManifest.d.ts +3 -2
  13. package/dist/domain/hostSurfaceManifest.d.ts.map +1 -1
  14. package/dist/domain/hostSurfaceSpecTypes.d.ts +89 -0
  15. package/dist/domain/hostSurfaceSpecTypes.d.ts.map +1 -0
  16. package/dist/domain/hostSurfaceTypes.d.ts +11 -90
  17. package/dist/domain/hostSurfaceTypes.d.ts.map +1 -1
  18. package/dist/domain/safeObjectKey.d.ts +1 -1
  19. package/dist/domain/safeObjectKey.d.ts.map +1 -1
  20. package/dist/domain/scriptCatalogManifest.d.ts +14 -0
  21. package/dist/domain/scriptCatalogManifest.d.ts.map +1 -0
  22. package/dist/domain/scriptProfileSpec.d.ts +31 -0
  23. package/dist/domain/scriptProfileSpec.d.ts.map +1 -0
  24. package/dist/domain/surfaceCapabilities.d.ts +1 -1
  25. package/dist/domain/surfaceCapabilities.d.ts.map +1 -1
  26. package/dist/domain/surfaceMethodDef.d.ts +1 -1
  27. package/dist/domain/surfaceMethodDef.d.ts.map +1 -1
  28. package/dist/index.d.ts +13 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +616 -296
  31. package/dist/index.js.map +1 -1
  32. package/dist/infrastructure/builders/bridgeMergeEnv.d.ts +5 -10
  33. package/dist/infrastructure/builders/bridgeMergeEnv.d.ts.map +1 -1
  34. package/dist/infrastructure/builders/filterBridgeDeclarations.d.ts +11 -0
  35. package/dist/infrastructure/builders/filterBridgeDeclarations.d.ts.map +1 -0
  36. package/dist/infrastructure/builders/surfaceBuilder.d.ts +7 -2
  37. package/dist/infrastructure/builders/surfaceBuilder.d.ts.map +1 -1
  38. package/dist/infrastructure/components/hostScriptSession.d.ts +20 -5
  39. package/dist/infrastructure/components/hostScriptSession.d.ts.map +1 -1
  40. package/package.json +8 -8
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@microverse.ts/host-surface`
2
2
 
3
- Declare a **host surface** in TypeScript: Zod schemas, capabilities, and handlers that compile into:
3
+ Declare a **host surface** in TypeScript: Zod schemas, capabilities, component types, and handlers that compile into:
4
4
 
5
5
  1. **Runtime bridge tables** for `mergeEnv` (what Lua calls at execution time).
6
6
  2. A **`LuaDefManifest`** for `@microverse.ts/lua-defs` (`.d.lua` stubs for LuaLS).
@@ -16,6 +16,19 @@ import { defineHostSurfaceFor } from '@microverse.ts/microverse-lua';
16
16
  import { z } from 'zod';
17
17
 
18
18
  export default defineHostSurfaceFor<MyHost>()
19
+ .componentType('OrderEcho', {
20
+ extends: 'AuditOnly',
21
+ capabilities: ['orders:read', 'notifications:send'],
22
+ props: z.object({ label: z.string().optional() }),
23
+ state: z.object({}),
24
+ hooks: ['OrderPlaced'],
25
+ })
26
+ .componentType('AuditOnly', {
27
+ capabilities: ['audit:record'],
28
+ props: z.object({}),
29
+ state: z.object({}),
30
+ hooks: ['OrderPlaced'],
31
+ })
19
32
  .bridge('orders')
20
33
  .method('get', {
21
34
  requires: 'orders:read',
@@ -31,14 +44,15 @@ export default defineHostSurfaceFor<MyHost>()
31
44
  | Step | Role |
32
45
  |------|------|
33
46
  | `defineHostSurfaceFor<THost>()` | Start builder; `handler` receives typed `host`. |
34
- | `.bridge('orders')` | Bridge table on `self.bridges` after `component:extend()`. |
47
+ | `.componentType(name, …)` | Declares props, state, capability set, and hook subset for Lua `Name:extend()`. |
48
+ | `.bridge('orders')` | Bridge table on `self.bridges` after `OrderEcho:extend()` (only bridges allowed by the active type). |
35
49
  | `.method('get', { … })` | One bridge method: `requires`, `input`, `output`, `handler`. |
36
- | `.componentHooks(…)` | Optional Zod map → `on*` domain events on `Component`. |
37
- | `.build()` | Compiled {@link HostSurface}. |
50
+ | `.componentHooks(…)` | Optional Zod map → `on*` domain events; each type lists which hooks it implements. |
51
+ | `.build()` | Compiled {@link HostSurface} with `componentTypes` registry. |
38
52
 
39
- `requires` is a `domain:action` capability string. `async` is inferred from `async function` handlers.
53
+ `requires` is a `domain:action` capability string on each bridge method. Each **component type** lists which capabilities its instances may use; runtime mounts only those bridges/methods on `self.bridges`. Disallowed bridges are **absent** (`nil` in Lua), not denied at call time.
40
54
 
41
- Bridges are **not** global in the slot: use `self.bridges.orders:get(…)` from component methods.
55
+ Bridges are **not** global in the slot: use `self.bridges.orders:get(…)` from component methods after `YourType:extend()`.
42
56
 
43
57
  ### Host object
44
58
 
@@ -49,12 +63,22 @@ The **host** is your engine context (services, repos, config). It is not generat
49
63
  Call `.componentHooks({ OrderPlaced: z.object({ … }), … })` before `.build()`.
50
64
 
51
65
  - TypeScript emits via `emitToAllInstances('OrderPlaced', payload)`.
52
- - Lua implements `onOrderPlaced` on the table from `component:extend()`.
53
- - Manifest includes `MicroverseEvt_*` payload classes and `on*` fields on `Component` in `.d.lua`.
66
+ - Lua implements `onOrderPlaced` on the table from `OrderEcho:extend()` (when that type’s `hooks` includes `OrderPlaced`).
67
+ - Manifest emits `MicroverseEvt_*` payload classes and per-type `on*` fields on `OrderEchoComponent` in `.d.lua`.
68
+
69
+ ### Component types and inheritance
70
+
71
+ | Field | Rule |
72
+ |-------|------|
73
+ | `capabilities` | Union of parent + child (deduplicated). |
74
+ | `props` / `state` | Zod `parent.extend(childShape)`. |
75
+ | `hooks` | Union of parent + child hook names. |
76
+
77
+ `extends` must reference another type on the same surface. Names must be unique; cycles are rejected at `build()`.
54
78
 
55
79
  ## `HostScriptSession`
56
80
 
57
- Lower-level API when you manage slots yourself (one session = one env slot + capability allowlist):
81
+ Lower-level API when you manage slots yourself (one session = one env slot):
58
82
 
59
83
  ```ts
60
84
  const session = new HostScriptSession({
@@ -62,10 +86,10 @@ const session = new HostScriptSession({
62
86
  surface,
63
87
  host,
64
88
  slotKey: createLuaEnvSlotKey('script:my-id'),
65
- allowedCapabilities: surface.pickCapabilities('orders:read'),
66
89
  });
67
90
  await session.openSession();
68
- await session.runChunk(luaSource);
91
+ await session.runChunk(luaSource); // script must call YourType:extend() first
92
+ await session.setProps({ … }); // validated against active type’s props schema
69
93
  ```
70
94
 
71
95
  `MicroverseLua` in `@microverse.ts/microverse-lua` wraps this for the common case (shared VM, script catalog + instances, broadcast hooks).
@@ -76,9 +100,15 @@ await session.runChunk(luaSource);
76
100
  microverse generate-lua-defs --surface src/mySurface.ts
77
101
  ```
78
102
 
79
- Requires `export default` of the compiled surface (`.build()` result). See [`@microverse.ts/cli`](../cli/README.md) and [`@microverse.ts/lua-defs`](../lua-defs/README.md).
103
+ Requires `export default` of the compiled surface (`.build()` result). The manifest emits, per component type:
104
+
105
+ - `AuditOnlyProps`, `AuditOnlyState`, `AuditOnlyBridges`
106
+ - `AuditOnlyComponent` (with `on*` only for that type’s hooks)
107
+ - `AuditOnly:extend() → AuditOnlyComponent` singleton stub
108
+
109
+ See [`@microverse.ts/cli`](../cli/README.md) and [`@microverse.ts/lua-defs`](../lua-defs/README.md).
80
110
 
81
- Optional **Lua type names** on Zod schemas (`luaType('OrderDto', z.object({ … }))`) improve stub names—see `examples/business-scripting-engine/src/schemas/surface/bridgePayloads.ts`.
111
+ Optional **Lua type names** on Zod schemas (`luaType('OrderDto', z.object({ … }))`) improve stub names—see bridge payload patterns in consumer surfaces (e.g. `examples/sorting-lab`).
82
112
 
83
113
  ## Async bridges and Lua patterns
84
114
 
@@ -86,9 +116,9 @@ Bridge handlers are **synchronous at the Lua boundary**; Wasmoon does not auto-r
86
116
 
87
117
  - [Async bridges — `@microverse.ts/microverse-lua`](../microverse-lua/README.md#async-bridges)
88
118
  - [Lua authoring (components)](../microverse-lua/README.md#lua-authoring)
89
- - Example: [`order_asyncio_tick.lua`](../../examples/business-scripting-engine/lua/components/order_asyncio_tick.lua)
119
+ - Example: [`bubble_sort.lua`](../../examples/sorting-lab/lua/bubble_sort.lua)
90
120
 
91
121
  ## Reference
92
122
 
93
- - Example surface: [`examples/business-scripting-engine/src/businessSurface.ts`](../../examples/business-scripting-engine/src/businessSurface.ts)
123
+ - Example surface: [`examples/sorting-lab/src/engine/sortingSurface.ts`](../../examples/sorting-lab/src/engine/sortingSurface.ts)
94
124
  - Tests: `src/domain/`, `src/application/`, `src/infrastructure/`
@@ -0,0 +1,13 @@
1
+ import { ScriptReferenceKind } from '@microverse.ts/runtime-core';
2
+ export type ScriptReferenceWrapContext = {
3
+ readonly slotKey: string;
4
+ readonly field: string;
5
+ readonly raw: string | null;
6
+ readonly kind: ScriptReferenceKind;
7
+ readonly componentType?: string | undefined;
8
+ };
9
+ /** Host-provided wrapper for `self.references.*` (opaque Lua userdata/table). */
10
+ export type ScriptReferenceResolverPort = {
11
+ readonly wrap: (ctx: ScriptReferenceWrapContext) => unknown;
12
+ };
13
+ //# sourceMappingURL=ScriptReferenceResolverPort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScriptReferenceResolverPort.d.ts","sourceRoot":"","sources":["../../../src/application/ports/ScriptReferenceResolverPort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,iFAAiF;AACjF,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,0BAA0B,KAAK,OAAO,CAAC;CAC7D,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { DeclarativeBridgeDeclaration } from '@microverse.ts/runtime-bridge';
2
- import { WithMicroverseCapabilityRegistry } from '../../domain/capabilityRegistrySymbol';
3
- import { HostSurfaceSpec } from '../../domain/hostSurfaceTypes';
2
+ import { WithMicroverseScriptContext } from '../../domain/scriptContextSymbol';
3
+ import { HostSurfaceSpec } from '../../domain/hostSurfaceSpecTypes';
4
4
  import { SchemaValidationPort } from '../ports/SchemaValidationPort';
5
5
  /**
6
6
  * Builds declarative bridge declarations from a host surface spec, using the schema validation port for Lua ↔ host payloads.
7
7
  */
8
- export declare function createBridgeDeclarationsFromHostSurfaceSpec<TSpec extends HostSurfaceSpec>(schemaValidation: SchemaValidationPort, spec: TSpec): ReadonlyArray<DeclarativeBridgeDeclaration<WithMicroverseCapabilityRegistry, string>>;
8
+ export declare function createBridgeDeclarationsFromHostSurfaceSpec<TSpec extends HostSurfaceSpec>(schemaValidation: SchemaValidationPort, spec: TSpec): ReadonlyArray<DeclarativeBridgeDeclaration<WithMicroverseScriptContext, string>>;
9
9
  //# sourceMappingURL=compileBridgeDeclarationsFromHostSurfaceSpec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compileBridgeDeclarationsFromHostSurfaceSpec.d.ts","sourceRoot":"","sources":["../../../src/application/useCases/compileBridgeDeclarationsFromHostSurfaceSpec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAGlF,OAAO,EAAkC,KAAK,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAM9H,OAAO,KAAK,EAAwB,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAa1E;;GAEG;AACH,wBAAgB,2CAA2C,CAAC,KAAK,SAAS,eAAe,EACvF,gBAAgB,EAAE,oBAAoB,EACtC,IAAI,EAAE,KAAK,GACV,aAAa,CAAC,4BAA4B,CAAC,gCAAgC,EAAE,MAAM,CAAC,CAAC,CA0DvF"}
1
+ {"version":3,"file":"compileBridgeDeclarationsFromHostSurfaceSpec.d.ts","sourceRoot":"","sources":["../../../src/application/useCases/compileBridgeDeclarationsFromHostSurfaceSpec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAKlF,OAAO,EAA6B,KAAK,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/G,OAAO,KAAK,EAAwB,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAa1E;;GAEG;AACH,wBAAgB,2CAA2C,CAAC,KAAK,SAAS,eAAe,EACvF,gBAAgB,EAAE,oBAAoB,EACtC,IAAI,EAAE,KAAK,GACV,aAAa,CAAC,4BAA4B,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAoDlF"}
@@ -1,13 +1,14 @@
1
+ import { ComponentTypeDefRegistry } from '../../domain/componentTypeSpec';
1
2
  import { InferSurfaceCapabilities } from '../../domain/surfaceCapabilities';
2
3
  import { HostSurface, HostSurfaceSpec, HostComponentHooksSpec } from '../../domain/hostSurfaceTypes';
3
4
  import { SchemaValidationPort } from '../ports/SchemaValidationPort';
4
5
  /**
5
6
  * Compiles a host surface using the injected schema validation port (tuple matches `UseCase` conventions in `@microverse.ts/shared`).
6
7
  */
7
- export declare function compileHostSurface<const TSpec extends HostSurfaceSpec>(ports: readonly [SchemaValidationPort], spec: TSpec): HostSurface<undefined, InferSurfaceCapabilities<TSpec>>;
8
- export declare function compileHostSurface<const TSpec extends HostSurfaceSpec, const THooks extends HostComponentHooksSpec>(ports: readonly [SchemaValidationPort], spec: TSpec, componentHooks: THooks): HostSurface<THooks, InferSurfaceCapabilities<TSpec>>;
8
+ export declare function compileHostSurface<const TSpec extends HostSurfaceSpec>(ports: readonly [SchemaValidationPort], spec: TSpec, componentTypeRegistry: ComponentTypeDefRegistry): HostSurface<undefined, InferSurfaceCapabilities<TSpec>>;
9
+ export declare function compileHostSurface<const TSpec extends HostSurfaceSpec, const THooks extends HostComponentHooksSpec>(ports: readonly [SchemaValidationPort], spec: TSpec, componentTypeRegistry: ComponentTypeDefRegistry, componentHooks: THooks): HostSurface<THooks, InferSurfaceCapabilities<TSpec>>;
9
10
  /**
10
11
  * Same as {@link compileHostSurface}, but requires every bridge method to be typed with the same `THost`.
11
12
  */
12
- export declare function compileHostSurfaceFor<const TSpec extends HostSurfaceSpec, const THooks extends HostComponentHooksSpec | undefined = undefined>(ports: readonly [SchemaValidationPort], spec: TSpec, componentHooks?: THooks): THooks extends HostComponentHooksSpec ? HostSurface<THooks, InferSurfaceCapabilities<TSpec>> : HostSurface<undefined, InferSurfaceCapabilities<TSpec>>;
13
+ export declare function compileHostSurfaceFor<const TSpec extends HostSurfaceSpec, const THooks extends HostComponentHooksSpec | undefined = undefined>(ports: readonly [SchemaValidationPort], spec: TSpec, componentTypeRegistry: ComponentTypeDefRegistry, componentHooks?: THooks): THooks extends HostComponentHooksSpec ? HostSurface<THooks, InferSurfaceCapabilities<TSpec>> : HostSurface<undefined, InferSurfaceCapabilities<TSpec>>;
13
14
  //# sourceMappingURL=compileHostSurface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compileHostSurface.d.ts","sourceRoot":"","sources":["../../../src/application/useCases/compileHostSurface.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EACV,WAAW,EAEX,eAAe,EACf,sBAAsB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAoB1E;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,KAAK,SAAS,eAAe,EACpE,KAAK,EAAE,SAAS,CAAC,oBAAoB,CAAC,EACtC,IAAI,EAAE,KAAK,GACV,WAAW,CAAC,SAAS,EAAE,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3D,wBAAgB,kBAAkB,CAChC,KAAK,CAAC,KAAK,SAAS,eAAe,EACnC,KAAK,CAAC,MAAM,SAAS,sBAAsB,EAE3C,KAAK,EAAE,SAAS,CAAC,oBAAoB,CAAC,EACtC,IAAI,EAAE,KAAK,EACX,cAAc,EAAE,MAAM,GACrB,WAAW,CAAC,MAAM,EAAE,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC;AAcxD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,CAAC,KAAK,SAAS,eAAe,EACnC,KAAK,CAAC,MAAM,SAAS,sBAAsB,GAAG,SAAS,GAAG,SAAS,EAEnE,KAAK,EAAE,SAAS,CAAC,oBAAoB,CAAC,EACtC,IAAI,EAAE,KAAK,EACX,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM,SAAS,sBAAsB,GACpC,WAAW,CAAC,MAAM,EAAE,wBAAwB,CAAC,KAAK,CAAC,CAAC,GACpD,WAAW,CAAC,SAAS,EAAE,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAQ1D"}
1
+ {"version":3,"file":"compileHostSurface.d.ts","sourceRoot":"","sources":["../../../src/application/useCases/compileHostSurface.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAA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ICROVERSE_LUA_COMPONENT_SLOT_PRELUDE */
2
3
  export declare const MICROVERSE_LUA_COMPONENT_SLOT_PRELUDE: string;
4
+ /** Lua prelude that registers `TypeName:extend()` singletons for each component type. */
5
+ export declare function profileBridgeSlotKey(typeName: string, bridgeName: string): string;
6
+ export declare function profileBridgeNamesMergeEnvKey(typeName: string): string;
7
+ export declare function buildComponentTypeBridgeNamesPreludeLua(componentTypes: ResolvedScriptProfileRegistry): string;
8
+ export declare function buildComponentTypeSingletonsPreludeLua(typeNames: readonly string[]): string;
9
+ /** Applies host-selected profile (same as `Type:extend()` without requiring Lua to call it). */
10
+ export declare function buildApplyHostScriptProfileChunkLua(profileName: string): string;
3
11
  //# sourceMappingURL=componentSlotPrelude.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"componentSlotPrelude.d.ts","sourceRoot":"","sources":["../../src/domain/componentSlotPrelude.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,eAAO,MAAM,qCAAqC,QAyF1C,CAAC"}
1
+ {"version":3,"file":"componentSlotPrelude.d.ts","sourceRoot":"","sources":["../../src/domain/componentSlotPrelude.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAEzE,iDAAiD;AACjD,eAAO,MAAM,qCAAqC,QAiF1C,CAAC;AAET,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,uCAAuC,CACrD,cAAc,EAAE,6BAA6B,GAC5C,MAAM,CAaR;AAED,wBAAgB,sCAAsC,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAuC3F;AAED,gGAAgG;AAChG,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAU/E"}
@@ -0,0 +1,12 @@
1
+ import { ScriptProfileDefInput } from '@microverse.ts/runtime-core';
2
+ import { z } from 'zod';
3
+ import { HostComponentHooksSpec, HostSurfaceSpec } from './hostSurfaceSpecTypes';
4
+ import { ScriptProfileDefRegistry } from './scriptProfileSpec';
5
+ /** Fluent input for {@link SurfaceBuilder.componentType} (requires `state`; catalog profiles may omit it). */
6
+ export type ComponentTypeDefInput<TCap extends `${string}:${string}` = `${string}:${string}`, THooks extends HostComponentHooksSpec | undefined = undefined> = ScriptProfileDefInput<TCap> & {
7
+ readonly state: z.ZodObject<z.ZodRawShape>;
8
+ readonly hooks?: THooks extends HostComponentHooksSpec ? readonly (keyof THooks & string)[] : readonly string[] | undefined;
9
+ };
10
+ export type ComponentTypeDefRegistry = ScriptProfileDefRegistry;
11
+ export declare function validateComponentTypeRegistry(registry: ComponentTypeDefRegistry, spec: HostSurfaceSpec, componentHooks?: HostComponentHooksSpec): void;
12
+ //# sourceMappingURL=componentTypeSpec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentTypeSpec.d.ts","sourceRoot":"","sources":["../../src/domain/componentTypeSpec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,qBAAqB,CAAC;AAE7B,8GAA8G;AAC9G,MAAM,MAAM,qBAAqB,CAC/B,IAAI,SAAS,GAAG,MAAM,IAAI,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,EAC1D,MAAM,SAAS,sBAAsB,GAAG,SAAS,GAAG,SAAS,IAC3D,qBAAqB,CAAC,IAAI,CAAC,GAAG;IAChC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,SAAS,sBAAsB,GAClD,SAAS,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,GAClC,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,wBAAwB,CAAC;AAEhE,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,wBAAwB,EAClC,IAAI,EAAE,eAAe,EACrB,cAAc,CAAC,EAAE,sBAAsB,GACtC,IAAI,CAEN"}
@@ -1,8 +1,9 @@
1
1
  import { LuaDefManifest } from '@microverse.ts/lua-defs';
2
- import { HostSurfaceSpec, HostComponentHooksSpec } from './hostSurfaceTypes';
2
+ import { ResolvedScriptProfileRegistry } from './scriptProfileSpec';
3
+ import { HostComponentHooksSpec, HostSurfaceSpec } from './hostSurfaceSpecTypes';
3
4
  export declare function buildLuaDefManifestFromHostSurfaceSpec(spec: HostSurfaceSpec, opts: {
4
5
  readonly output: string;
5
6
  readonly headerNote?: string | undefined;
6
7
  readonly luaTypeAliases?: Readonly<Record<string, string>> | undefined;
7
- }, componentHooks?: HostComponentHooksSpec): LuaDefManifest;
8
+ }, componentHooks?: HostComponentHooksSpec, componentTypes?: ResolvedScriptProfileRegistry): LuaDefManifest;
8
9
  //# sourceMappingURL=hostSurfaceManifest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hostSurfaceManifest.d.ts","sourceRoot":"","sources":["../../src/domain/hostSurfaceManifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAMf,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAwIlF,wBAAgB,sCAAsC,CACpD,IAAI,EAAE,eAAe,EACrB,IAAI,EAAE;IACJ,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;CACxE,EACD,cAAc,CAAC,EAAE,sBAAsB,GACtC,cAAc,CAsEhB"}
1
+ {"version":3,"file":"hostSurfaceManifest.d.ts","sourceRoot":"","sources":["../../src/domain/hostSurfaceManifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAMf,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAML,KAAK,6BAA6B,EACnC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAkMtF,wBAAgB,sCAAsC,CACpD,IAAI,EAAE,eAAe,EACrB,IAAI,EAAE;IACJ,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;CACxE,EACD,cAAc,CAAC,EAAE,sBAAsB,EACvC,cAAc,CAAC,EAAE,6BAA6B,GAC7C,cAAc,CAuEhB"}
@@ -0,0 +1,89 @@
1
+ import { ScriptInstanceContext } from '@microverse.ts/runtime-core';
2
+ import { CapabilityId } from '@microverse.ts/runtime-capabilities';
3
+ import { z } from 'zod';
4
+ /**
5
+ * Context passed to every surface `handler`: your typed host plus the active Lua **slot key** (string form).
6
+ *
7
+ * @typeParam THost - Host services / world object you declare for bridge handlers.
8
+ */
9
+ export type HostFnContext<THost> = {
10
+ readonly host: THost;
11
+ /** Stable slot identifier for this sandbox (same convention as `DeclarativeBridgeDeclaration`). */
12
+ readonly slotKey: string;
13
+ /** Mounted script instance identity (audit, logging). */
14
+ readonly script: ScriptInstanceContext;
15
+ };
16
+ /**
17
+ * Strongly typed description of one bridge method (produced by the fluent `.method(…)` builder).
18
+ * TypeScript checks `handler` against `input` / `output` schemas.
19
+ *
20
+ * @typeParam THost - Host type available as `ctx.host` inside `handler`.
21
+ * @typeParam TIn - Payload type after Zod `input` parsing (Lua calls the bridge with one table argument).
22
+ * @typeParam TOut - Return type validated by Zod `output` before crossing back to Lua.
23
+ * @typeParam TCap - Capability id for this method (from fluent `requires: 'domain:action'`).
24
+ */
25
+ export type HostSurfaceMethodEntry<THost, TIn, TOut, TCap extends CapabilityId = CapabilityId> = {
26
+ /** Capability required to invoke this method; checked against the session registry before the handler runs. */
27
+ readonly capability: TCap;
28
+ /** Zod schema for the single payload object from Lua (e.g. `z.object({ id: z.string() })`). */
29
+ readonly input: z.ZodType<TIn>;
30
+ /** Zod schema for the value returned to Lua. */
31
+ readonly output: z.ZodType<TOut>;
32
+ /**
33
+ * Host logic at the Lua↔JS boundary. May return `Promise<TOut>`; Lua must use `:await()` on the returned handle
34
+ * or pass an `onComplete` callback as the second argument (see `MICROVERSE_LUA_SLOT_VM_BOOTSTRAP` in `@microverse.ts/runtime-wasm`).
35
+ */
36
+ readonly handler: (ctx: HostFnContext<THost>, input: TIn) => TOut | Promise<TOut>;
37
+ /**
38
+ * When true, manifest and Lua runtime treat this method as async (`MethodHandle` + optional `onComplete`).
39
+ * Set automatically for `async function` handlers in the fluent builder.
40
+ */
41
+ readonly async?: boolean | undefined;
42
+ /** Optional description emitted into the LuaCATS manifest. */
43
+ readonly description?: string | undefined;
44
+ /**
45
+ * Advanced escape hatch for manifest emission. Prefer registering Zod schemas with {@link luaType}
46
+ * (see `bridgePayloads` in the business example) so `.d.lua` stays inferred from `input` / `output`.
47
+ * Does not replace async bridge typing (`async: true` emits handle + `onComplete` in `.d.lua`).
48
+ * `paramTypes` keys must match `input` object keys (or `value` for non-object inputs).
49
+ */
50
+ readonly lua?: {
51
+ readonly paramTypes?: Partial<Record<string, string>> | undefined;
52
+ readonly returns?: string | undefined;
53
+ };
54
+ };
55
+ /**
56
+ * Erased method entry stored inside a {@link HostSurfaceSpec}. Assignability widens at the spec boundary.
57
+ */
58
+ export type AnyHostSurfaceMethod = {
59
+ readonly capability: CapabilityId;
60
+ readonly input: z.ZodTypeAny;
61
+ readonly output: z.ZodTypeAny;
62
+ readonly handler: (ctx: HostFnContext<any>, input: any) => unknown;
63
+ readonly async?: boolean | undefined;
64
+ readonly description?: string | undefined;
65
+ readonly lua?: {
66
+ readonly paramTypes?: Partial<Record<string, string>> | undefined;
67
+ readonly returns?: string | undefined;
68
+ };
69
+ };
70
+ /**
71
+ * Tree shape accepted by {@link defineHostSurface}: top-level keys become Lua global bridge **tables**
72
+ * (e.g. `orders`, `billing`); inner keys become **methods** on that table.
73
+ */
74
+ export type HostSurfaceSpec = Readonly<Record<string, Readonly<Record<string, AnyHostSurfaceMethod | HostSurfaceMethodEntry<any, any, any, any>>>>>;
75
+ /**
76
+ * Surface spec where every method entry uses the same host type as your engine context
77
+ * (the `THost` you pass as `host` into {@link HostScriptSession}).
78
+ */
79
+ export type HostSurfaceSpecForHost<THost> = Readonly<{
80
+ readonly [bridge: string]: Readonly<{
81
+ readonly [method: string]: HostSurfaceMethodEntry<THost, any, any, any>;
82
+ }>;
83
+ }>;
84
+ /**
85
+ * Zod object schemas keyed by PascalCase event kind (`OrderPlaced` → Lua method `onOrderPlaced` on the component from `component:extend()`).
86
+ * Passed to {@link SurfaceBuilder.componentHooks} to emit domain event typings into `.d.lua`.
87
+ */
88
+ export type HostComponentHooksSpec = Readonly<Record<string, z.ZodObject<any>>>;
89
+ //# sourceMappingURL=hostSurfaceSpecTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostSurfaceSpecTypes.d.ts","sourceRoot":"","sources":["../../src/domain/hostSurfaceSpecTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,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H,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC"}
@@ -1,106 +1,27 @@
1
1
  import { LuaDefManifest } from '@microverse.ts/lua-defs';
2
- import { ScriptInstanceContext } from '@microverse.ts/runtime-core';
3
2
  import { DeclarativeBridgeDeclaration } from '@microverse.ts/runtime-bridge';
4
3
  import { CapabilityId } from '@microverse.ts/runtime-capabilities';
5
- import { z } from 'zod';
4
+ import { ResolvedScriptProfile, ResolvedScriptProfileRegistry } from './scriptProfileSpec';
6
5
  import { SurfaceCapabilityString } from './surfaceCapabilityString';
7
- import { WithMicroverseCapabilityRegistry } from './capabilityRegistrySymbol';
8
- /**
9
- * Context passed to every surface `handler`: your typed host plus the active Lua **slot key** (string form).
10
- *
11
- * @typeParam THost - Host services / world object you declare for bridge handlers.
12
- */
13
- export type HostFnContext<THost> = {
14
- readonly host: THost;
15
- /** Stable slot identifier for this sandbox (same convention as `DeclarativeBridgeDeclaration`). */
16
- readonly slotKey: string;
17
- /** Mounted script instance identity (audit, logging). */
18
- readonly script: ScriptInstanceContext;
19
- };
20
- /**
21
- * Strongly typed description of one bridge method (produced by the fluent `.method(…)` builder).
22
- * TypeScript checks `handler` against `input` / `output` schemas.
23
- *
24
- * @typeParam THost - Host type available as `ctx.host` inside `handler`.
25
- * @typeParam TIn - Payload type after Zod `input` parsing (Lua calls the bridge with one table argument).
26
- * @typeParam TOut - Return type validated by Zod `output` before crossing back to Lua.
27
- * @typeParam TCap - Capability id for this method (from fluent `requires: 'domain:action'`).
28
- */
29
- export type HostSurfaceMethodEntry<THost, TIn, TOut, TCap extends CapabilityId = CapabilityId> = {
30
- /** Capability required to invoke this method; checked against the session registry before the handler runs. */
31
- readonly capability: TCap;
32
- /** Zod schema for the single payload object from Lua (e.g. `z.object({ id: z.string() })`). */
33
- readonly input: z.ZodType<TIn>;
34
- /** Zod schema for the value returned to Lua. */
35
- readonly output: z.ZodType<TOut>;
36
- /**
37
- * Host logic at the Lua↔JS boundary. May return `Promise<TOut>`; Lua must use `:await()` on the returned handle
38
- * or pass an `onComplete` callback as the second argument (see `MICROVERSE_LUA_SLOT_VM_BOOTSTRAP` in `@microverse.ts/runtime-wasm`).
39
- */
40
- readonly handler: (ctx: HostFnContext<THost>, input: TIn) => TOut | Promise<TOut>;
41
- /**
42
- * When true, manifest and Lua runtime treat this method as async (`MethodHandle` + optional `onComplete`).
43
- * Set automatically for `async function` handlers in the fluent builder.
44
- */
45
- readonly async?: boolean | undefined;
46
- /** Optional description emitted into the LuaCATS manifest. */
47
- readonly description?: string | undefined;
48
- /**
49
- * Advanced escape hatch for manifest emission. Prefer registering Zod schemas with {@link luaType}
50
- * (see `bridgePayloads` in the business example) so `.d.lua` stays inferred from `input` / `output`.
51
- * Does not replace async bridge typing (`async: true` emits handle + `onComplete` in `.d.lua`).
52
- * `paramTypes` keys must match `input` object keys (or `value` for non-object inputs).
53
- */
54
- readonly lua?: {
55
- readonly paramTypes?: Partial<Record<string, string>> | undefined;
56
- readonly returns?: string | undefined;
57
- };
58
- };
59
- /**
60
- * Erased method entry stored inside a {@link HostSurfaceSpec}. Assignability widens at the spec boundary.
61
- */
62
- export type AnyHostSurfaceMethod = {
63
- readonly capability: CapabilityId;
64
- readonly input: z.ZodTypeAny;
65
- readonly output: z.ZodTypeAny;
66
- readonly handler: (ctx: HostFnContext<any>, input: any) => unknown;
67
- readonly async?: boolean | undefined;
68
- readonly description?: string | undefined;
69
- readonly lua?: {
70
- readonly paramTypes?: Partial<Record<string, string>> | undefined;
71
- readonly returns?: string | undefined;
72
- };
73
- };
74
- /**
75
- * Tree shape accepted by {@link defineHostSurface}: top-level keys become Lua global bridge **tables**
76
- * (e.g. `orders`, `billing`); inner keys become **methods** on that table.
77
- */
78
- export type HostSurfaceSpec = Readonly<Record<string, Readonly<Record<string, AnyHostSurfaceMethod | HostSurfaceMethodEntry<any, any, any, any>>>>>;
79
- /**
80
- * Surface spec where every method entry uses the same host type as your engine context
81
- * (the `THost` you pass as `host` into {@link HostScriptSession}).
82
- */
83
- export type HostSurfaceSpecForHost<THost> = Readonly<{
84
- readonly [bridge: string]: Readonly<{
85
- readonly [method: string]: HostSurfaceMethodEntry<THost, any, any, any>;
86
- }>;
87
- }>;
88
- /**
89
- * Zod object schemas keyed by PascalCase event kind (`OrderPlaced` → Lua method `onOrderPlaced` on the component from `component:extend()`).
90
- * Passed to {@link SurfaceBuilder.componentHooks} to emit domain event typings into `.d.lua`.
91
- */
92
- export type HostComponentHooksSpec = Readonly<Record<string, z.ZodObject<any>>>;
6
+ import { WithMicroverseScriptContext } from './scriptContextSymbol';
7
+ import { HostComponentHooksSpec, HostSurfaceSpec } from './hostSurfaceSpecTypes';
8
+ export type { AnyHostSurfaceMethod, HostComponentHooksSpec, HostFnContext, HostSurfaceMethodEntry, HostSurfaceSpec, HostSurfaceSpecForHost, } from './hostSurfaceSpecTypes';
93
9
  /**
94
10
  * Bridge + manifest API shared by every {@link HostSurface} (with or without workflow hooks).
95
11
  *
96
12
  * @typeParam TCapabilities - Union of capability ids declared on the surface spec (see {@link InferSurfaceCapabilities}).
97
13
  */
98
14
  export type HostSurfaceCore<TCapabilities extends CapabilityId = CapabilityId> = {
15
+ /** Internal bridge/method tree (for profile filtering and manifest). */
16
+ readonly getHostSurfaceSpec: () => HostSurfaceSpec;
99
17
  /**
100
18
  * Declarative bridge declarations compatible with {@link buildDeclarativeBridgeTable}.
101
- * The host must satisfy {@link WithMicroverseCapabilityRegistry} (see {@link HostScriptSession}).
102
19
  */
103
- readonly toBridgeDeclarations: () => ReadonlyArray<DeclarativeBridgeDeclaration<WithMicroverseCapabilityRegistry, string>>;
20
+ readonly toBridgeDeclarations: () => ReadonlyArray<DeclarativeBridgeDeclaration<WithMicroverseScriptContext, string>>;
21
+ /** Resolved script profiles declared via `.componentType()`. */
22
+ readonly componentTypes: ResolvedScriptProfileRegistry;
23
+ /** Lookup a script profile by name (throws if unknown). */
24
+ readonly getComponentType: (name: string) => ResolvedScriptProfile;
104
25
  /**
105
26
  * Builds a `LuaDefManifest` for `@microverse.ts/lua-defs` (`buildLuaCatsDocument`, `generateDefs`, CLI).
106
27
  *
@@ -1 +1 @@
1
- {"version":3,"file":"hostSurfaceTypes.d.ts","sourceRoot":"","sources":["../../src/domain/hostSurfaceTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AAEnF;;;;GAIG;AACH,MAAM,MAAM,aAAa,CAAC,KAAK,IAAI;IACjC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,mGAAmG;IACnG,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;CACxC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,CAChC,KAAK,EACL,GAAG,EACH,IAAI,EACJ,IAAI,SAAS,YAAY,GAAG,YAAY,IACtC;IACF,+GAA+G;IAC/G,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;IAC1B,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,gDAAgD;IAChD,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,IA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C,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,GAC5B,eAAe,CAAC,aAAa,CAAC,GAC9B,eAAe,CAAC,aAAa,CAAC,GAAG;IAAE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE,kEAAkE;AAClE,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Rejects bridge/method names that could trigger prototype pollution when used as object keys.
3
3
  */
4
- export declare function assertSafeObjectKey(kind: 'bridge' | 'method', name: string): void;
4
+ export declare function assertSafeObjectKey(kind: 'bridge' | 'method' | 'componentType', name: string): void;
5
5
  /** Record with no inherited prototype — safe for dynamic string keys at runtime. */
6
6
  export declare function createNullPrototypeRecord<T extends object>(): T;
7
7
  //# sourceMappingURL=safeObjectKey.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"safeObjectKey.d.ts","sourceRoot":"","sources":["../../src/domain/safeObjectKey.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAIjF;AAED,oFAAoF;AACpF,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,MAAM,KAAK,CAAC,CAE/D"}
1
+ {"version":3,"file":"safeObjectKey.d.ts","sourceRoot":"","sources":["../../src/domain/safeObjectKey.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAInG;AAED,oFAAoF;AACpF,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,MAAM,KAAK,CAAC,CAE/D"}
@@ -0,0 +1,14 @@
1
+ import { LuaDefManifest } from '@microverse.ts/lua-defs';
2
+ export type ScriptCatalogEntry = {
3
+ readonly scriptId: string;
4
+ readonly profileId: string;
5
+ /**
6
+ * When true, the script's `.lua` file defines `---@class …ScriptComponent` (e.g. script-local methods).
7
+ * Omit the catalog `---@alias` so LuaLS does not report duplicate-doc-alias.
8
+ */
9
+ readonly localComponentClass?: boolean | undefined;
10
+ };
11
+ /** LuaCATS aliases per catalog scriptId → resolved component class (for `---@type` in `.lua` files). */
12
+ export declare function buildScriptCatalogLuaDefManifest(entries: readonly ScriptCatalogEntry[]): LuaDefManifest;
13
+ export declare function scriptCatalogComponentAlias(scriptId: string): string;
14
+ //# sourceMappingURL=scriptCatalogManifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scriptCatalogManifest.d.ts","sourceRoot":"","sources":["../../src/domain/scriptCatalogManifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,yBAAyB,CAAC;AAI7E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACpD,CAAC;AAEF,wGAAwG;AACxG,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,SAAS,kBAAkB,EAAE,GACrC,cAAc,CAsBhB;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGpE"}
@@ -0,0 +1,31 @@
1
+ import { CapabilityId } from '@microverse.ts/runtime-capabilities';
2
+ import { ScriptProfileDefInput } from '@microverse.ts/runtime-core';
3
+ import { z } from 'zod';
4
+ import { HostComponentHooksSpec, HostSurfaceSpec } from './hostSurfaceSpecTypes';
5
+ export type ScriptProfileDefRegistry = Readonly<Record<string, ScriptProfileDefInput>>;
6
+ export type ResolvedScriptProfile = {
7
+ readonly name: string;
8
+ readonly extends?: string | undefined;
9
+ readonly capabilities: readonly CapabilityId[];
10
+ readonly props: z.ZodObject<z.ZodRawShape>;
11
+ readonly state: z.ZodObject<z.ZodRawShape>;
12
+ readonly hooks: readonly string[];
13
+ readonly bridgeNames: readonly string[];
14
+ readonly references?: ScriptProfileDefInput['references'];
15
+ };
16
+ export type ResolvedScriptProfileRegistry = Readonly<Record<string, ResolvedScriptProfile>>;
17
+ declare const EMPTY_PROPS: z.ZodObject<z.ZodRawShape>;
18
+ declare const EMPTY_STATE: z.ZodObject<z.ZodRawShape>;
19
+ export declare function scriptProfileComponentClassName(profileName: string): string;
20
+ export declare function scriptProfilePropsAlias(profileName: string): string;
21
+ export declare function scriptProfileStateAlias(profileName: string): string;
22
+ export declare function scriptProfileBridgesClassName(profileName: string): string;
23
+ /** Bridge table names whose methods include at least one capability from the profile. */
24
+ export declare function bridgeNamesForCapabilities(spec: HostSurfaceSpec, capabilities: readonly CapabilityId[]): readonly string[];
25
+ export declare function resolveScriptProfile(registry: ScriptProfileDefRegistry, name: string, spec: HostSurfaceSpec): ResolvedScriptProfile;
26
+ export declare function buildResolvedScriptProfileRegistry(registry: ScriptProfileDefRegistry, spec: HostSurfaceSpec): ResolvedScriptProfileRegistry;
27
+ export declare function validateScriptProfileRegistry(registry: ScriptProfileDefRegistry, spec: HostSurfaceSpec, componentHooks?: HostComponentHooksSpec, opts?: {
28
+ readonly requireAtLeastOne?: boolean | undefined;
29
+ }): void;
30
+ export { EMPTY_PROPS, EMPTY_STATE };
31
+ //# sourceMappingURL=scriptProfileSpec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scriptProfileSpec.d.ts","sourceRoot":"","sources":["../../src/domain/scriptProfileSpec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAC5F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,CAAC,EAAE,MAA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CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED,yFAAyF;AACzF,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,eAAe,EACrB,YAAY,EAAE,SAAS,YAAY,EAAE,GACpC,SAAS,MAAM,EAAE,CAcnB;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,wBAAwB,EAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,eAAe,GACpB,qBAAqB,CAqDvB;AAED,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,wBAAwB,EAClC,IAAI,EAAE,eAAe,GACpB,6BAA6B,CAM/B;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,wBAAwB,EAClC,IAAI,EAAE,eAAe,EACrB,cAAc,CAAC,EAAE,sBAAsB,EACvC,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,GAC1D,IAAI,CA6CN;AAED,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { CapabilityId } from '@microverse.ts/runtime-capabilities';
2
- import { HostSurfaceMethodEntry, HostSurfaceSpec } from './hostSurfaceTypes';
2
+ import { HostSurfaceMethodEntry, HostSurfaceSpec } from './hostSurfaceSpecTypes';
3
3
  type InferMethodCapability<M> = M extends {
4
4
  readonly capability: infer C extends CapabilityId;
5
5
  } ? C : never;
@@ -1 +1 @@
1
- {"version":3,"file":"surfaceCapabilities.d.ts","sourceRoot":"","sources":["../../src/domain/surfaceCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAExE,OAAO,KAAK,EAAwB,sBAAsB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAExG,KAAK,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,Y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CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,YAAY,CAAA;CAAE,GAC3F,CAAC,GACD,KAAK,CAAC;AAEV,KAAK,uBAAuB,CAAC,CAAC,IAAI,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACzE,qBAAqB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GACjC,KAAK,CAAC;AAEV;;;GAGG;AACH,MAAM,MAAM,wBAAwB,CAAC,KAAK,SAAS,eAAe,IAAI,uBAAuB,CAC3F,KAAK,CAAC,MAAM,KAAK,CAAC,CACnB,CAAC;AAEF,0EAA0E;AAC1E,wBAAgB,sCAAsC,CAAC,KAAK,CAAC,KAAK,SAAS,eAAe,EACxF,IAAI,EAAE,KAAK,GACV,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAAE,CAgB5C;AAED,+EAA+E;AAC/E,wBAAgB,uBAAuB,CACrC,KAAK,CAAC,QAAQ,SAAS,SAAS,YAAY,EAAE,EAC9C,KAAK,CAAC,CAAC,SAAS,SAAS,GAAG,MAAM,IAAI,MAAM,EAAE,EAAE,EAEhD,mBAAmB,EAAE,QAAQ,EAC7B,GAAG,YAAY,EAAE,CAAC,GACjB,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,CAAC,CAUxD;AAED,kFAAkF;AAClF,MAAM,MAAM,sBAAsB,CAAC,IAAI,SAAS,YAAY,IAAI,sBAAsB,CACpF,OAAO,EACP,OAAO,EACP,OAAO,CACR,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAA;CAAE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { CapabilityId } from '@microverse.ts/runtime-capabilities';
2
2
  import { z } from 'zod';
3
- import { HostFnContext, HostSurfaceMethodEntry } from './hostSurfaceTypes';
3
+ import { HostFnContext, HostSurfaceMethodEntry } from './hostSurfaceSpecTypes';
4
4
  /**
5
5
  * Consumer-facing method definition for the fluent {@link SurfaceBuilder} API.
6
6
  * Use `requires: 'domain:action'` for the capability id.
@@ -1 +1 @@
1
- {"version":3,"file":"surfaceMethodDef.d.ts","sourceRoot":"","sources":["../../src/domain/surfaceMethodDef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAC5F,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEhF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAC1B,KAAK,EACL,GAAG,EACH,IAAI,EACJ,IAAI,SAAS,GAAG,MAAM,IAAI,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,IACxD;IACF,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClF,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,GAAG,CAAC,EAAE;QACb,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;QAClE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,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