@almadar/patterns 2.34.1 → 2.36.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.
- package/dist/component-mapping.json +1 -1
- package/dist/event-contracts.json +1 -1
- package/dist/helpers/pattern-swap.d.ts +25 -0
- package/dist/index.d.ts +329 -136
- package/dist/index.js +339 -163
- package/dist/index.js.map +1 -1
- package/dist/pattern-embeddings.json +227927 -0
- package/dist/patterns-registry.json +298 -160
- package/dist/registry.json +298 -160
- package/dist/types.d.ts +44 -3
- package/package.json +6 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern-swap compatibility — the deterministic shape gate for a contextual
|
|
3
|
+
* pattern swap. A swap keeps the circuit closed when the replacement shares the
|
|
4
|
+
* current pattern's entity-inlet cardinality and can emit the events the
|
|
5
|
+
* consumer's trait listens for. Semantic ranking (which compatible pattern best
|
|
6
|
+
* matches the user's instruction) is the embedding step, layered on top of this
|
|
7
|
+
* gate — never the other way around.
|
|
8
|
+
*/
|
|
9
|
+
/** The data-inlet cardinality of a pattern (`record`/`collection`), or `null`
|
|
10
|
+
* when the pattern has no entity inlet (layout / leaf patterns). */
|
|
11
|
+
export declare function getEntityCardinality(patternType: string): 'record' | 'collection' | null;
|
|
12
|
+
/** Events a pattern emits, from its declared event-outlet contract. */
|
|
13
|
+
export declare function getEmittedEvents(patternType: string): string[];
|
|
14
|
+
export interface PatternSwapGate {
|
|
15
|
+
/** Events the replacement MUST be able to emit (the trait's listened set), so
|
|
16
|
+
* handlers still fire after the swap. Omit to skip the outlet gate. */
|
|
17
|
+
requiredEmits?: readonly string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Pattern types a `currentType` node can be swapped to while keeping the circuit
|
|
21
|
+
* closed: same entity-inlet cardinality, and — when `requiredEmits` is given —
|
|
22
|
+
* able to emit every required event. Deterministic and unranked; the caller
|
|
23
|
+
* ranks the result semantically (embeddings).
|
|
24
|
+
*/
|
|
25
|
+
export declare function findCompatiblePatterns(currentType: string, gate?: PatternSwapGate): string[];
|