@almadar/core 7.16.0 → 7.18.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/builders.d.ts +2 -2
- package/dist/{compose-behaviors-D2vPjRpX.d.ts → compose-behaviors-DWMFJEz3.d.ts} +1 -1
- package/dist/domain-language/index.d.ts +164 -3
- package/dist/domain-language/index.js +180 -85
- package/dist/domain-language/index.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +180 -85
- package/dist/index.js.map +1 -1
- package/dist/{schema-DJzXvJHi.d.ts → schema-WX5fN1Ra.d.ts} +1 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/builders.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d7 as UISlot, Z as Effect, cE as Trait, bN as RenderUIEffect, cQ as TraitEventContract, a2 as Entity, cS as TraitEventListener, cH as TraitConfig, a6 as EntityField, a9 as EntityPersistence, ag as EntityRow, dc as UseDeclaration, ab as EntityRef, cV as TraitRef, bs as PageRef, b6 as OrbitalDefinition, bh as OrbitalSchema, br as Page, bt as PageRefObject, cX as TraitReference } from './schema-WX5fN1Ra.js';
|
|
2
2
|
import { S as SExpr } from './expression-BVRFm0sV.js';
|
|
3
|
-
export { C as ComposeBehaviorsInput, a as ComposeBehaviorsResult, E as EventWiringEntry, L as LayoutStrategy, b as applyEventWiring, c as composeBehaviors, d as detectLayoutStrategy } from './compose-behaviors-
|
|
3
|
+
export { C as ComposeBehaviorsInput, a as ComposeBehaviorsResult, E as EventWiringEntry, L as LayoutStrategy, b as applyEventWiring, c as composeBehaviors, d as detectLayoutStrategy } from './compose-behaviors-DWMFJEz3.js';
|
|
4
4
|
import { AnyPatternConfig } from '@almadar/patterns';
|
|
5
5
|
import 'zod';
|
|
6
6
|
|
|
@@ -1,8 +1,36 @@
|
|
|
1
|
+
import { c$ as TraitScope, a9 as EntityPersistence, a2 as Entity, br as Page, bh as OrbitalSchema, cE as Trait } from '../schema-WX5fN1Ra.js';
|
|
1
2
|
import { S as SExpr } from '../expression-BVRFm0sV.js';
|
|
2
|
-
import { a2 as Entity, br as Page, bh as OrbitalSchema, cE as Trait } from '../schema-DJzXvJHi.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '@almadar/patterns';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Domain Language Types
|
|
8
|
+
*
|
|
9
|
+
* AST node types for the domain language that maps to KFlow schema.
|
|
10
|
+
* All entity references use explicit names (e.g., Order, Task, CurrentUser)
|
|
11
|
+
* per GAP-002 - no magic variables like `entity.` or `context.`.
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Field type mapping: OrbitalSchema type → Domain Language keyword
|
|
18
|
+
*
|
|
19
|
+
* This is the single source of truth for type conversion.
|
|
20
|
+
* When adding new field types to OrbitalSchema, add the mapping here.
|
|
21
|
+
*/
|
|
22
|
+
declare const FIELD_TYPE_MAPPING: {
|
|
23
|
+
readonly string: "text";
|
|
24
|
+
readonly number: "number";
|
|
25
|
+
readonly boolean: "yes/no";
|
|
26
|
+
readonly date: "date";
|
|
27
|
+
readonly timestamp: "timestamp";
|
|
28
|
+
readonly datetime: "datetime";
|
|
29
|
+
readonly array: "list";
|
|
30
|
+
readonly object: "object";
|
|
31
|
+
readonly enum: "enum";
|
|
32
|
+
readonly relation: "relation";
|
|
33
|
+
};
|
|
6
34
|
/**
|
|
7
35
|
* Effect operator mapping: Both systems use the same operator names
|
|
8
36
|
*/
|
|
@@ -31,6 +59,27 @@ interface ASTNode {
|
|
|
31
59
|
* Note: These map to OrbitalSchema types via DOMAIN_TO_SCHEMA_FIELD_TYPE
|
|
32
60
|
*/
|
|
33
61
|
type DomainFieldType = 'text' | 'long text' | 'number' | 'currency' | 'date' | 'timestamp' | 'datetime' | 'yes/no' | 'enum' | 'list' | 'object' | 'relation';
|
|
62
|
+
/**
|
|
63
|
+
* OrbitalSchema field types (for reference)
|
|
64
|
+
*/
|
|
65
|
+
type SchemaFieldType = keyof typeof FIELD_TYPE_MAPPING;
|
|
66
|
+
/**
|
|
67
|
+
* Default value for a `DomainField`. Mirrors the JSON-leaf shape an
|
|
68
|
+
* `EntityField.default` may carry on `OrbitalSchema`: scalar, list, or
|
|
69
|
+
* nested object (when the field type is `'object'` or `'list'`).
|
|
70
|
+
*/
|
|
71
|
+
type DomainFieldDefault = string | number | boolean | null | DomainFieldDefault[] | {
|
|
72
|
+
[k: string]: DomainFieldDefault;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* For `fieldType: 'list'`, the typed shape of each item. Mirrors
|
|
76
|
+
* `EntityField.items` on `OrbitalSchema`. Currently a single-level
|
|
77
|
+
* type tag (matching how the schema uses it); extend if/when nested
|
|
78
|
+
* list-of-list / list-of-object signatures are required.
|
|
79
|
+
*/
|
|
80
|
+
interface DomainFieldItems {
|
|
81
|
+
type: DomainFieldType;
|
|
82
|
+
}
|
|
34
83
|
interface DomainField extends ASTNode {
|
|
35
84
|
type: 'field';
|
|
36
85
|
name: string;
|
|
@@ -38,8 +87,10 @@ interface DomainField extends ASTNode {
|
|
|
38
87
|
required: boolean;
|
|
39
88
|
unique: boolean;
|
|
40
89
|
auto: boolean;
|
|
41
|
-
default?:
|
|
90
|
+
default?: DomainFieldDefault;
|
|
42
91
|
enumValues?: string[];
|
|
92
|
+
/** List-of-X item type when `fieldType === 'list'`. */
|
|
93
|
+
items?: DomainFieldItems;
|
|
43
94
|
}
|
|
44
95
|
type RelationshipType = 'belongs_to' | 'has_many' | 'has_one';
|
|
45
96
|
interface DomainRelationship extends ASTNode {
|
|
@@ -56,6 +107,13 @@ interface DomainEntity extends ASTNode {
|
|
|
56
107
|
relationships: DomainRelationship[];
|
|
57
108
|
states?: string[];
|
|
58
109
|
initialState?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Storage mode on the resolved schema. Mirrors `EntityPersistence` in
|
|
112
|
+
* `@almadar/core/types/entity.ts`. Omitted ⇒ projector defaults to
|
|
113
|
+
* `'persistent'`. Domain text syntax: `Persistence: <value>` line in
|
|
114
|
+
* the entity section.
|
|
115
|
+
*/
|
|
116
|
+
persistence?: EntityPersistence;
|
|
59
117
|
}
|
|
60
118
|
interface DomainPageSection extends ASTNode {
|
|
61
119
|
type: 'page_section';
|
|
@@ -146,6 +204,13 @@ interface DomainBehavior extends ASTNode {
|
|
|
146
204
|
transitions: DomainTransition[];
|
|
147
205
|
ticks: DomainTick[];
|
|
148
206
|
rules: string[];
|
|
207
|
+
/**
|
|
208
|
+
* Instance- vs collection-scoped state machine. Mirrors
|
|
209
|
+
* `Trait.scope: TraitScope` in `@almadar/core/types/trait.ts`.
|
|
210
|
+
* Omitted ⇒ projector defaults to `'instance'`. Domain text syntax:
|
|
211
|
+
* `Scope: instance|collection` line in the behavior section.
|
|
212
|
+
*/
|
|
213
|
+
scope?: TraitScope;
|
|
149
214
|
}
|
|
150
215
|
interface DomainDocument extends ASTNode {
|
|
151
216
|
type: 'document';
|
|
@@ -173,6 +238,102 @@ interface ParseResult<T> {
|
|
|
173
238
|
errors: ParseError[];
|
|
174
239
|
warnings: ParseError[];
|
|
175
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Inferred role of a trait within an orbital. Driven by heuristics over
|
|
243
|
+
* the trait body (state-machine event names, AppLayout suffix, etc.)
|
|
244
|
+
* during signature extraction. Stays a closed union so the Phase 2
|
|
245
|
+
* projector can pattern-match exhaustively; `'other'` is the
|
|
246
|
+
* catch-all for traits that don't fit a known kind.
|
|
247
|
+
*/
|
|
248
|
+
type FactoryTraitKind = 'list' | 'detail' | 'modal' | 'layout' | 'wizard' | 'tabs' | 'realtime' | 'browse' | 'inspector' | 'navigation' | 'lifecycle' | 'access-control' | 'audit' | 'persistor' | 'other';
|
|
249
|
+
/**
|
|
250
|
+
* One field on a factory's canonical entity, in signature form. Mirrors
|
|
251
|
+
* the subset of `EntityField` that the projector needs to score a
|
|
252
|
+
* domain-entity match. Auto-added audit fields (id / createdAt /
|
|
253
|
+
* updatedAt) are omitted by the extractor.
|
|
254
|
+
*/
|
|
255
|
+
interface FactorySignatureEntityField {
|
|
256
|
+
name: string;
|
|
257
|
+
type: SchemaFieldType;
|
|
258
|
+
required: boolean;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* The canonical entity a factory produces. Almost always one entity
|
|
262
|
+
* per orbital; modeled as an array to keep the door open for orbitals
|
|
263
|
+
* that compose multiple entities.
|
|
264
|
+
*/
|
|
265
|
+
interface FactoryEntitySignature {
|
|
266
|
+
/** Canonical entity name the factory's params build (e.g. `"ChatMessage"`). */
|
|
267
|
+
name: string;
|
|
268
|
+
/** Fields the factory emits, post-auto-field stripping. */
|
|
269
|
+
fields: ReadonlyArray<FactorySignatureEntityField>;
|
|
270
|
+
/** Default persistence mode the factory emits; overridable by params. */
|
|
271
|
+
persistence: EntityPersistence;
|
|
272
|
+
/** True when the factory's params accept an `entityName` override. */
|
|
273
|
+
renameable: boolean;
|
|
274
|
+
/**
|
|
275
|
+
* True when the factory's params accept appending extra fields via
|
|
276
|
+
* `params.fields[]`. Almost always true; declared explicitly so the
|
|
277
|
+
* projector can introspect.
|
|
278
|
+
*/
|
|
279
|
+
fieldsExtensible: boolean;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* One trait the factory composes into the orbital. The projector reads
|
|
283
|
+
* these to determine which factory's trait stack covers a given
|
|
284
|
+
* `DomainBehavior` + which override knobs a presentation overlay can
|
|
285
|
+
* deterministically target.
|
|
286
|
+
*/
|
|
287
|
+
interface FactoryTraitSignature {
|
|
288
|
+
/** Canonical trait name post-rename (e.g. `"ChatMessageList"`). */
|
|
289
|
+
name: string;
|
|
290
|
+
kind: FactoryTraitKind;
|
|
291
|
+
/** Event keys this trait emits (post-rename). */
|
|
292
|
+
emittedEvents: ReadonlyArray<string>;
|
|
293
|
+
/** Event keys this trait listens for. */
|
|
294
|
+
listenedEvents: ReadonlyArray<string>;
|
|
295
|
+
/** Config keys overridable via `traitOverrides.<name>.config.<key>`. */
|
|
296
|
+
overridableConfigKeys: ReadonlyArray<string>;
|
|
297
|
+
}
|
|
298
|
+
/** One page the factory emits. The path is the factory default; the
|
|
299
|
+
* projector may override via `params.pagePath` or `params.pages[].path`. */
|
|
300
|
+
interface FactoryPageSignature {
|
|
301
|
+
name: string;
|
|
302
|
+
defaultPath: string;
|
|
303
|
+
primaryEntity: string;
|
|
304
|
+
}
|
|
305
|
+
interface FactorySignature {
|
|
306
|
+
/** Organism the factory belongs to (e.g. `"std-realtime-chat"`). */
|
|
307
|
+
organism: string;
|
|
308
|
+
/** Orbital this factory builds within that organism. */
|
|
309
|
+
orbital: string;
|
|
310
|
+
/** Tier the factory sits in (informational; drives nothing today). */
|
|
311
|
+
tier: 'atoms' | 'molecules' | 'organisms';
|
|
312
|
+
/** Path of the generated factory source (relative to the std root). */
|
|
313
|
+
factoryPath: string;
|
|
314
|
+
/** Canonical entity surface(s) the factory produces. */
|
|
315
|
+
entities: ReadonlyArray<FactoryEntitySignature>;
|
|
316
|
+
/** Trait stack the factory composes. */
|
|
317
|
+
traits: ReadonlyArray<FactoryTraitSignature>;
|
|
318
|
+
/** Pages the factory emits. */
|
|
319
|
+
pages: ReadonlyArray<FactoryPageSignature>;
|
|
320
|
+
/** Union of all `traits[].emittedEvents`. */
|
|
321
|
+
emittedEvents: ReadonlyArray<string>;
|
|
322
|
+
/** Union of all `traits[].listenedEvents`. */
|
|
323
|
+
listenedEvents: ReadonlyArray<string>;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Aggregate catalog written to
|
|
327
|
+
* `packages/almadar-std/behaviors/registry/factory-signatures.json`.
|
|
328
|
+
* Sorted by organism then orbital. One entry per factory in the
|
|
329
|
+
* regenerate pipeline.
|
|
330
|
+
*/
|
|
331
|
+
interface FactorySignatureCatalog {
|
|
332
|
+
/** Generated-by version stamp (the `@almadar/std` minor it shipped in). */
|
|
333
|
+
generatedFromStdVersion: string;
|
|
334
|
+
/** Sorted list of factory signatures. */
|
|
335
|
+
signatures: ReadonlyArray<FactorySignature>;
|
|
336
|
+
}
|
|
176
337
|
|
|
177
338
|
/**
|
|
178
339
|
* Domain Language Tokens
|
|
@@ -926,4 +1087,4 @@ declare function getRegistryStats(): {
|
|
|
926
1087
|
*/
|
|
927
1088
|
declare function generateDomainLanguageReference(): string;
|
|
928
1089
|
|
|
929
|
-
export { type ASTNode, type ComparisonCondition, type ComparisonOperator, type DomainBehavior, type DomainChunk, type DomainDocument, type DomainEffect, type DomainEntity, type DomainField, type DomainFieldType, type DomainGuard, type DomainPage, type DomainPageAction, type DomainPageSection, type DomainRelationship, type DomainTick, type DomainToSchemaResult, type DomainTransition, EFFECT_REGISTRY, type EffectMapping, type EffectType, FIELD_TYPE_REGISTRY, type FieldCheckCondition, type FieldReference, type FieldTypeMapping, GUARD_REGISTRY, type GuardCondition, type GuardMapping, KEYWORDS, Lexer, type LogicalCondition, type LogicalOperator, MULTI_WORD_KEYWORDS, type MappingStore, type MergeResult, type ParseError, type ParseResult, type RelationshipType, type SchemaToDomainResult, type SectionMapping, type SourceLocation, type SourceRange, type Token, TokenType, type UserCheckCondition, applySectionUpdate, computeSchemaHash, convertDomainToSchema, convertEntitiesToDomain, convertPagesToDomain, convertSchemaToDomain, convertTraitsToDomain, createMappingStore, deleteSection, detectChanges, domainKeywordToSchemaType, findMapping, findMappingByPath, findMappingsByType, formatBehaviorToDomain, formatBehaviorToSchema, formatDomainGuardToSchema, formatEntityToDomain, formatEntityToSchema, formatGuardConditionToDomain, formatGuardToDomain, formatGuardToSchema, formatMergeSummary, formatPageToDomain, formatPageToSchema, formatSchemaEntityToDomain, formatSchemaGuardToDomain, formatSchemaPageToDomain, formatSchemaTraitToDomain, generateDomainLanguageReference, generateSectionId, getEffectMapping, getFieldTypeMapping, getGuardMapping, getRegisteredEffects, getRegisteredFieldTypes, getRegisteredGuards, getRegistryStats, getSchemaPath, hasSchemaChanged, isEffectRegistered, isFieldTypeRegistered, isGuardRegistered, mergeDomainChunks, parseBehavior, parseDomainEffect, parseDomainEffects, parseDomainGuard, parseEntity, parseGuard, parsePage, parseSectionId, removeMapping, resolveConflict, schemaEntityToDomainEntity, schemaPageToDomainPage, schemaTraitToDomainBehavior, schemaTypeToDomainKeyword, tokenize, updateMappingRange, updateSchemaHash, upsertMapping, validateDomainChunk };
|
|
1090
|
+
export { type ASTNode, type ComparisonCondition, type ComparisonOperator, type DomainBehavior, type DomainChunk, type DomainDocument, type DomainEffect, type DomainEntity, type DomainField, type DomainFieldDefault, type DomainFieldItems, type DomainFieldType, type DomainGuard, type DomainPage, type DomainPageAction, type DomainPageSection, type DomainRelationship, type DomainTick, type DomainToSchemaResult, type DomainTransition, EFFECT_REGISTRY, type EffectMapping, type EffectType, EntityPersistence, FIELD_TYPE_REGISTRY, type FactoryEntitySignature, type FactoryPageSignature, type FactorySignature, type FactorySignatureCatalog, type FactorySignatureEntityField, type FactoryTraitKind, type FactoryTraitSignature, type FieldCheckCondition, type FieldReference, type FieldTypeMapping, GUARD_REGISTRY, type GuardCondition, type GuardMapping, KEYWORDS, Lexer, type LogicalCondition, type LogicalOperator, MULTI_WORD_KEYWORDS, type MappingStore, type MergeResult, type ParseError, type ParseResult, type RelationshipType, type SchemaToDomainResult, type SectionMapping, type SourceLocation, type SourceRange, type Token, TokenType, TraitScope, type UserCheckCondition, applySectionUpdate, computeSchemaHash, convertDomainToSchema, convertEntitiesToDomain, convertPagesToDomain, convertSchemaToDomain, convertTraitsToDomain, createMappingStore, deleteSection, detectChanges, domainKeywordToSchemaType, findMapping, findMappingByPath, findMappingsByType, formatBehaviorToDomain, formatBehaviorToSchema, formatDomainGuardToSchema, formatEntityToDomain, formatEntityToSchema, formatGuardConditionToDomain, formatGuardToDomain, formatGuardToSchema, formatMergeSummary, formatPageToDomain, formatPageToSchema, formatSchemaEntityToDomain, formatSchemaGuardToDomain, formatSchemaPageToDomain, formatSchemaTraitToDomain, generateDomainLanguageReference, generateSectionId, getEffectMapping, getFieldTypeMapping, getGuardMapping, getRegisteredEffects, getRegisteredFieldTypes, getRegisteredGuards, getRegistryStats, getSchemaPath, hasSchemaChanged, isEffectRegistered, isFieldTypeRegistered, isGuardRegistered, mergeDomainChunks, parseBehavior, parseDomainEffect, parseDomainEffects, parseDomainGuard, parseEntity, parseGuard, parsePage, parseSectionId, removeMapping, resolveConflict, schemaEntityToDomainEntity, schemaPageToDomainPage, schemaTraitToDomainBehavior, schemaTypeToDomainKeyword, tokenize, updateMappingRange, updateSchemaHash, upsertMapping, validateDomainChunk };
|