@almadar/core 2.5.0 → 2.5.1
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 -1
- package/dist/builders.js +414 -1
- package/dist/builders.js.map +1 -1
- package/dist/compose-behaviors-ClEyviUI.d.ts +119 -0
- package/dist/domain-language/index.d.ts +1 -1
- package/dist/domain-language/index.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +199 -1
- package/dist/index.js.map +1 -1
- package/dist/{schema-BrFR8WMF.d.ts → schema-DmrHbrqM.d.ts} +228 -20
- package/dist/state-machine/index.d.ts +90 -27
- package/dist/state-machine/index.js.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -770,16 +770,46 @@ declare const EntitySchema: z.ZodObject<{
|
|
|
770
770
|
} | undefined;
|
|
771
771
|
}>;
|
|
772
772
|
/**
|
|
773
|
-
*
|
|
774
|
-
*
|
|
773
|
+
* Derives the collection name for a persistent entity.
|
|
774
|
+
*
|
|
775
|
+
* Generates the database collection name by converting the entity name
|
|
776
|
+
* to lowercase and adding an 's' suffix (simple pluralization).
|
|
777
|
+
* Returns undefined for non-persistent entities (runtime/singleton).
|
|
778
|
+
*
|
|
779
|
+
* @param {OrbitalEntity} entity - Entity to derive collection name for
|
|
780
|
+
* @returns {string | undefined} Collection name or undefined for non-persistent entities
|
|
781
|
+
*
|
|
782
|
+
* @example
|
|
783
|
+
* deriveCollection({ name: 'User', persistence: 'persistent' }); // returns 'users'
|
|
784
|
+
* deriveCollection({ name: 'Task', persistence: 'runtime' }); // returns undefined
|
|
775
785
|
*/
|
|
776
786
|
declare function deriveCollection(entity: OrbitalEntity): string | undefined;
|
|
777
787
|
/**
|
|
778
|
-
*
|
|
788
|
+
* Checks if an entity is runtime-only (not persisted).
|
|
789
|
+
*
|
|
790
|
+
* Type guard to determine if an entity exists only at runtime
|
|
791
|
+
* and is not stored in the database.
|
|
792
|
+
*
|
|
793
|
+
* @param {OrbitalEntity} entity - Entity to check
|
|
794
|
+
* @returns {boolean} True if entity is runtime-only, false otherwise
|
|
795
|
+
*
|
|
796
|
+
* @example
|
|
797
|
+
* isRuntimeEntity({ persistence: 'runtime' }); // returns true
|
|
798
|
+
* isRuntimeEntity({ persistence: 'persistent' }); // returns false
|
|
779
799
|
*/
|
|
780
800
|
declare function isRuntimeEntity(entity: OrbitalEntity): boolean;
|
|
781
801
|
/**
|
|
782
|
-
*
|
|
802
|
+
* Checks if an entity is a singleton.
|
|
803
|
+
*
|
|
804
|
+
* Type guard to determine if an entity has a single global instance
|
|
805
|
+
* rather than multiple records in a collection.
|
|
806
|
+
*
|
|
807
|
+
* @param {OrbitalEntity} entity - Entity to check
|
|
808
|
+
* @returns {boolean} True if entity is a singleton, false otherwise
|
|
809
|
+
*
|
|
810
|
+
* @example
|
|
811
|
+
* isSingletonEntity({ persistence: 'singleton' }); // returns true
|
|
812
|
+
* isSingletonEntity({ persistence: 'persistent' }); // returns false
|
|
783
813
|
*/
|
|
784
814
|
declare function isSingletonEntity(entity: OrbitalEntity): boolean;
|
|
785
815
|
|
|
@@ -3188,17 +3218,65 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
|
3188
3218
|
/**
|
|
3189
3219
|
* Check if a trait ref is an inline Trait definition
|
|
3190
3220
|
*/
|
|
3221
|
+
/**
|
|
3222
|
+
* Checks if a trait reference is an inline trait definition.
|
|
3223
|
+
*
|
|
3224
|
+
* Type guard to determine if a TraitRef is an inline trait object
|
|
3225
|
+
* (with 'name' property) rather than a string reference or object reference.
|
|
3226
|
+
*
|
|
3227
|
+
* @param {TraitRef} traitRef - Trait reference to check
|
|
3228
|
+
* @returns {boolean} True if traitRef is an inline trait, false otherwise
|
|
3229
|
+
*
|
|
3230
|
+
* @example
|
|
3231
|
+
* isInlineTrait({ name: 'MyTrait' }); // returns true (inline)
|
|
3232
|
+
* isInlineTrait('MyTrait'); // returns false (string reference)
|
|
3233
|
+
* isInlineTrait({ ref: 'MyTrait' }); // returns false (object reference)
|
|
3234
|
+
*/
|
|
3191
3235
|
declare function isInlineTrait(traitRef: TraitRef): traitRef is Trait;
|
|
3192
3236
|
/**
|
|
3193
|
-
*
|
|
3237
|
+
* Extracts the trait name from a trait reference.
|
|
3238
|
+
*
|
|
3239
|
+
* Handles all trait reference formats (string, inline object, object reference)
|
|
3240
|
+
* and returns the canonical trait name.
|
|
3241
|
+
*
|
|
3242
|
+
* @param {TraitRef} traitRef - Trait reference to extract name from
|
|
3243
|
+
* @returns {string} Trait name
|
|
3244
|
+
*
|
|
3245
|
+
* @example
|
|
3246
|
+
* getTraitName('MyTrait'); // returns 'MyTrait'
|
|
3247
|
+
* getTraitName({ name: 'MyTrait' }); // returns 'MyTrait'
|
|
3248
|
+
* getTraitName({ ref: 'MyTrait' }); // returns 'MyTrait'
|
|
3194
3249
|
*/
|
|
3195
3250
|
declare function getTraitName(traitRef: TraitRef): string;
|
|
3196
3251
|
/**
|
|
3197
|
-
*
|
|
3252
|
+
* Extracts the configuration from a trait reference.
|
|
3253
|
+
*
|
|
3254
|
+
* Returns the configuration object for trait references that support it
|
|
3255
|
+
* (object references with 'config' property). Returns undefined for
|
|
3256
|
+
* string references and inline traits.
|
|
3257
|
+
*
|
|
3258
|
+
* @param {TraitRef} traitRef - Trait reference to extract config from
|
|
3259
|
+
* @returns {Record<string, unknown> | undefined} Trait configuration or undefined
|
|
3260
|
+
*
|
|
3261
|
+
* @example
|
|
3262
|
+
* getTraitConfig('MyTrait'); // returns undefined
|
|
3263
|
+
* getTraitConfig({ name: 'MyTrait' }); // returns undefined
|
|
3264
|
+
* getTraitConfig({ ref: 'MyTrait', config: { option: 'value' } }); // returns config object
|
|
3198
3265
|
*/
|
|
3199
3266
|
declare function getTraitConfig(traitRef: TraitRef): Record<string, unknown> | undefined;
|
|
3200
3267
|
/**
|
|
3201
|
-
*
|
|
3268
|
+
* Normalizes a trait reference to object form.
|
|
3269
|
+
*
|
|
3270
|
+
* Converts any trait reference format (string, inline, object) to a
|
|
3271
|
+
* standardized object format with 'ref' and optional 'config' properties.
|
|
3272
|
+
*
|
|
3273
|
+
* @param {TraitRef} traitRef - Trait reference to normalize
|
|
3274
|
+
* @returns {{ ref: string; config?: Record<string, unknown> }} Normalized trait reference
|
|
3275
|
+
*
|
|
3276
|
+
* @example
|
|
3277
|
+
* normalizeTraitRef('MyTrait'); // returns { ref: 'MyTrait' }
|
|
3278
|
+
* normalizeTraitRef({ name: 'MyTrait' }); // returns { ref: 'MyTrait' }
|
|
3279
|
+
* normalizeTraitRef({ ref: 'MyTrait', config: {...} }); // returns original
|
|
3202
3280
|
*/
|
|
3203
3281
|
declare function normalizeTraitRef(traitRef: TraitRef): {
|
|
3204
3282
|
ref: string;
|
|
@@ -5109,7 +5187,20 @@ declare const UseDeclarationSchema: z.ZodObject<{
|
|
|
5109
5187
|
*/
|
|
5110
5188
|
type EntityRef = Entity | string;
|
|
5111
5189
|
/**
|
|
5112
|
-
*
|
|
5190
|
+
* Checks if an entity reference is a string reference.
|
|
5191
|
+
*
|
|
5192
|
+
* Type guard to determine if an EntityRef is a string reference
|
|
5193
|
+
* (format: "Alias.entity") rather than an inline entity definition.
|
|
5194
|
+
*
|
|
5195
|
+
* @param {EntityRef} entity - Entity reference to check
|
|
5196
|
+
* @returns {boolean} True if entity is a string reference, false if inline definition
|
|
5197
|
+
*
|
|
5198
|
+
* @example
|
|
5199
|
+
* const ref1 = "User.entity"; // string reference
|
|
5200
|
+
* const ref2 = { name: "User", fields: [...] }; // inline definition
|
|
5201
|
+
*
|
|
5202
|
+
* isEntityReference(ref1); // returns true
|
|
5203
|
+
* isEntityReference(ref2); // returns false
|
|
5113
5204
|
*/
|
|
5114
5205
|
declare function isEntityReference(entity: EntityRef): entity is string;
|
|
5115
5206
|
/**
|
|
@@ -5215,15 +5306,56 @@ interface PageRefObject {
|
|
|
5215
5306
|
*/
|
|
5216
5307
|
type PageRef = Page | string | PageRefObject;
|
|
5217
5308
|
/**
|
|
5218
|
-
*
|
|
5309
|
+
* Checks if a page reference is a string reference.
|
|
5310
|
+
*
|
|
5311
|
+
* Type guard to determine if a PageRef is a simple string reference
|
|
5312
|
+
* (format: "Alias.pages.PageName") rather than an inline page definition or object reference.
|
|
5313
|
+
*
|
|
5314
|
+
* @param {PageRef} page - Page reference to check
|
|
5315
|
+
* @returns {boolean} True if page is a string reference, false otherwise
|
|
5316
|
+
*
|
|
5317
|
+
* @example
|
|
5318
|
+
* const ref1 = "User.pages.Profile"; // string reference
|
|
5319
|
+
* const ref2 = { name: "Dashboard", path: "/" }; // inline definition
|
|
5320
|
+
*
|
|
5321
|
+
* isPageReferenceString(ref1); // returns true
|
|
5322
|
+
* isPageReferenceString(ref2); // returns false
|
|
5219
5323
|
*/
|
|
5220
5324
|
declare function isPageReferenceString(page: PageRef): page is string;
|
|
5221
5325
|
/**
|
|
5222
|
-
*
|
|
5326
|
+
* Checks if a page reference is a reference object.
|
|
5327
|
+
*
|
|
5328
|
+
* Type guard to determine if a PageRef is an object reference
|
|
5329
|
+
* with a 'ref' property rather than an inline page definition.
|
|
5330
|
+
*
|
|
5331
|
+
* @param {PageRef} page - Page reference to check
|
|
5332
|
+
* @returns {boolean} True if page is a reference object, false otherwise
|
|
5333
|
+
*
|
|
5334
|
+
* @example
|
|
5335
|
+
* const ref1 = { ref: "User.pages.Profile", path: "/custom" }; // reference object
|
|
5336
|
+
* const ref2 = { name: "Dashboard", path: "/" }; // inline definition
|
|
5337
|
+
*
|
|
5338
|
+
* isPageReferenceObject(ref1); // returns true
|
|
5339
|
+
* isPageReferenceObject(ref2); // returns false
|
|
5223
5340
|
*/
|
|
5224
5341
|
declare function isPageReferenceObject(page: PageRef): page is PageRefObject;
|
|
5225
5342
|
/**
|
|
5226
|
-
*
|
|
5343
|
+
* Checks if a page reference is any type of reference.
|
|
5344
|
+
*
|
|
5345
|
+
* Type guard to determine if a PageRef is a reference (string or object)
|
|
5346
|
+
* rather than an inline page definition.
|
|
5347
|
+
*
|
|
5348
|
+
* @param {PageRef} page - Page reference to check
|
|
5349
|
+
* @returns {boolean} True if page is a reference, false if inline definition
|
|
5350
|
+
*
|
|
5351
|
+
* @example
|
|
5352
|
+
* const ref1 = "User.pages.Profile"; // string reference
|
|
5353
|
+
* const ref2 = { ref: "User.pages.Profile", path: "/custom" }; // object reference
|
|
5354
|
+
* const ref3 = { name: "Dashboard", path: "/" }; // inline definition
|
|
5355
|
+
*
|
|
5356
|
+
* isPageReference(ref1); // returns true
|
|
5357
|
+
* isPageReference(ref2); // returns true
|
|
5358
|
+
* isPageReference(ref3); // returns false
|
|
5227
5359
|
*/
|
|
5228
5360
|
declare function isPageReference(page: PageRef): page is string | PageRefObject;
|
|
5229
5361
|
/**
|
|
@@ -5295,27 +5427,64 @@ declare const PageRefSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
5295
5427
|
path?: string | undefined;
|
|
5296
5428
|
}>]>;
|
|
5297
5429
|
/**
|
|
5298
|
-
*
|
|
5430
|
+
* Checks if a trait reference is an imported reference.
|
|
5431
|
+
*
|
|
5432
|
+
* Determines if a trait reference uses the imported format
|
|
5433
|
+
* "Alias.traits.TraitName" rather than a simple "TraitName".
|
|
5434
|
+
*
|
|
5435
|
+
* @param {string} ref - Trait reference to check
|
|
5436
|
+
* @returns {boolean} True if reference is imported format, false otherwise
|
|
5437
|
+
*
|
|
5438
|
+
* @example
|
|
5439
|
+
* isImportedTraitRef("User.traits.Profile"); // returns true
|
|
5440
|
+
* isImportedTraitRef("Profile"); // returns false
|
|
5299
5441
|
*/
|
|
5300
5442
|
declare function isImportedTraitRef(ref: string): boolean;
|
|
5301
5443
|
/**
|
|
5302
|
-
*
|
|
5303
|
-
*
|
|
5444
|
+
* Parses an imported trait reference.
|
|
5445
|
+
*
|
|
5446
|
+
* Extracts the alias and trait name from an imported trait reference
|
|
5447
|
+
* in format "Alias.traits.TraitName". Returns null if not a valid imported reference.
|
|
5448
|
+
*
|
|
5449
|
+
* @param {string} ref - Trait reference to parse
|
|
5450
|
+
* @returns {{ alias: string; traitName: string } | null} Parsed reference or null
|
|
5451
|
+
*
|
|
5452
|
+
* @example
|
|
5453
|
+
* parseImportedTraitRef("User.traits.Profile"); // returns { alias: "User", traitName: "Profile" }
|
|
5454
|
+
* parseImportedTraitRef("Profile"); // returns null
|
|
5304
5455
|
*/
|
|
5305
5456
|
declare function parseImportedTraitRef(ref: string): {
|
|
5306
5457
|
alias: string;
|
|
5307
5458
|
traitName: string;
|
|
5308
5459
|
} | null;
|
|
5309
5460
|
/**
|
|
5310
|
-
*
|
|
5311
|
-
*
|
|
5461
|
+
* Parses an entity reference.
|
|
5462
|
+
*
|
|
5463
|
+
* Extracts the alias from an entity reference in format "Alias.entity".
|
|
5464
|
+
* Returns null if not a valid entity reference.
|
|
5465
|
+
*
|
|
5466
|
+
* @param {string} ref - Entity reference to parse
|
|
5467
|
+
* @returns {{ alias: string } | null} Parsed reference or null
|
|
5468
|
+
*
|
|
5469
|
+
* @example
|
|
5470
|
+
* parseEntityRef("User.entity"); // returns { alias: "User" }
|
|
5471
|
+
* parseEntityRef("User"); // returns null
|
|
5312
5472
|
*/
|
|
5313
5473
|
declare function parseEntityRef(ref: string): {
|
|
5314
5474
|
alias: string;
|
|
5315
5475
|
} | null;
|
|
5316
5476
|
/**
|
|
5317
|
-
*
|
|
5318
|
-
*
|
|
5477
|
+
* Parses a page reference.
|
|
5478
|
+
*
|
|
5479
|
+
* Extracts the alias and page name from a page reference
|
|
5480
|
+
* in format "Alias.pages.PageName". Returns null if not a valid page reference.
|
|
5481
|
+
*
|
|
5482
|
+
* @param {string} ref - Page reference to parse
|
|
5483
|
+
* @returns {{ alias: string; pageName: string } | null} Parsed reference or null
|
|
5484
|
+
*
|
|
5485
|
+
* @example
|
|
5486
|
+
* parsePageRef("User.pages.Profile"); // returns { alias: "User", pageName: "Profile" }
|
|
5487
|
+
* parsePageRef("Profile"); // returns null
|
|
5319
5488
|
*/
|
|
5320
5489
|
declare function parsePageRef(ref: string): {
|
|
5321
5490
|
alias: string;
|
|
@@ -13320,11 +13489,50 @@ declare const OrbitalSchemaSchema: z.ZodObject<{
|
|
|
13320
13489
|
}> | undefined;
|
|
13321
13490
|
}>;
|
|
13322
13491
|
/**
|
|
13323
|
-
*
|
|
13492
|
+
* Parses raw data into a validated OrbitalSchema.
|
|
13493
|
+
*
|
|
13494
|
+
* Uses Zod validation to ensure the data conforms to the OrbitalSchema structure.
|
|
13495
|
+
* Throws a ZodError if validation fails. For safe parsing that doesn't throw,
|
|
13496
|
+
* use `safeParseOrbitalSchema()` instead.
|
|
13497
|
+
*
|
|
13498
|
+
* @param {unknown} data - Raw data to parse (typically JSON)
|
|
13499
|
+
* @returns {OrbitalSchema} Validated orbital schema
|
|
13500
|
+
* @throws {z.ZodError} If data doesn't match OrbitalSchema structure
|
|
13501
|
+
*
|
|
13502
|
+
* @example
|
|
13503
|
+
* ```typescript
|
|
13504
|
+
* try {
|
|
13505
|
+
* const schema = parseOrbitalSchema(jsonData);
|
|
13506
|
+
* console.log('Valid schema:', schema.name);
|
|
13507
|
+
* } catch (error) {
|
|
13508
|
+
* console.error('Invalid schema:', error);
|
|
13509
|
+
* }
|
|
13510
|
+
* ```
|
|
13511
|
+
*
|
|
13512
|
+
* @see safeParseOrbitalSchema
|
|
13324
13513
|
*/
|
|
13325
13514
|
declare function parseOrbitalSchema(data: unknown): OrbitalSchema;
|
|
13326
13515
|
/**
|
|
13327
|
-
*
|
|
13516
|
+
* Safely parses raw data into a validated OrbitalSchema without throwing.
|
|
13517
|
+
*
|
|
13518
|
+
* Uses Zod's safeParse method to validate data and return a result object
|
|
13519
|
+
* instead of throwing errors. This is useful for form validation and
|
|
13520
|
+
* user input handling where you want to gracefully handle invalid data.
|
|
13521
|
+
*
|
|
13522
|
+
* @param {unknown} data - Raw data to parse (typically JSON)
|
|
13523
|
+
* @returns {z.SafeParseReturnType<OrbitalSchema, OrbitalSchema>} Parse result with success/status
|
|
13524
|
+
*
|
|
13525
|
+
* @example
|
|
13526
|
+
* ```typescript
|
|
13527
|
+
* const result = safeParseOrbitalSchema(jsonData);
|
|
13528
|
+
* if (result.success) {
|
|
13529
|
+
* console.log('Valid schema:', result.data.name);
|
|
13530
|
+
* } else {
|
|
13531
|
+
* console.error('Validation errors:', result.error);
|
|
13532
|
+
* }
|
|
13533
|
+
* ```
|
|
13534
|
+
*
|
|
13535
|
+
* @see parseOrbitalSchema
|
|
13328
13536
|
*/
|
|
13329
13537
|
declare function safeParseOrbitalSchema(data: unknown): z.SafeParseReturnType<{
|
|
13330
13538
|
name: string;
|
|
@@ -87,23 +87,41 @@ declare function buildStateGraph(transitions: GraphTransition[]): Map<string, St
|
|
|
87
87
|
*/
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
*
|
|
90
|
+
* Collects all reachable states from an initial state using breadth-first search.
|
|
91
91
|
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
92
|
+
* Performs BFS traversal of the state machine to find all states reachable
|
|
93
|
+
* from the initial state, up to the specified maximum depth. Used for
|
|
94
|
+
* state machine analysis, verification, and test coverage assessment.
|
|
95
|
+
*
|
|
96
|
+
* @param {GraphTransition[]} transitions - Array of state transitions
|
|
97
|
+
* @param {string} initialState - Starting state name
|
|
98
|
+
* @param {number} [maxDepth=5] - Maximum search depth
|
|
99
|
+
* @returns {Set<string>} Set of reachable state names
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* const reachable = collectReachableStates(transitions, 'initial', 10);
|
|
103
|
+
* console.log('Reachable states:', Array.from(reachable));
|
|
96
104
|
*/
|
|
97
105
|
declare function collectReachableStates(transitions: GraphTransition[], initialState: string, maxDepth?: number): Set<string>;
|
|
98
106
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* @param
|
|
106
|
-
*
|
|
107
|
+
* Walks all reachable (state, event) pairs using BFS and invokes callback for each.
|
|
108
|
+
*
|
|
109
|
+
* Traverses the state machine using breadth-first search and calls the visitor
|
|
110
|
+
* function for each (state, edge) pair encountered. Used by server verification
|
|
111
|
+
* to test transitions by POSTing to endpoints and checking responses.
|
|
112
|
+
*
|
|
113
|
+
* @param {GraphTransition[]} transitions - Array of state transitions
|
|
114
|
+
* @param {string} initialState - Starting state name
|
|
115
|
+
* @param {number} maxDepth - Maximum BFS depth
|
|
116
|
+
* @param {(state: string, edge: StateEdge, depth: number) => Promise<boolean>} visitor - Callback for each pair
|
|
117
|
+
* @returns {Promise<{ visitedPairs: Set<string>; walkedEdges: number }>} Traversal statistics
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* const result = await walkStatePairs(transitions, 'initial', 5, async (state, edge) => {
|
|
121
|
+
* console.log(`Transition: ${state} --${edge.event}--> ${edge.to}`);
|
|
122
|
+
* return true; // Continue exploration
|
|
123
|
+
* });
|
|
124
|
+
* console.log(`Visited ${result.visitedPairs.size} state-event pairs`);
|
|
107
125
|
*/
|
|
108
126
|
declare function walkStatePairs(transitions: GraphTransition[], initialState: string, maxDepth: number, visitor: (state: string, edge: StateEdge, depth: number) => Promise<boolean>): Promise<{
|
|
109
127
|
visitedPairs: Set<string>;
|
|
@@ -120,21 +138,49 @@ declare function walkStatePairs(transitions: GraphTransition[], initialState: st
|
|
|
120
138
|
*/
|
|
121
139
|
|
|
122
140
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
141
|
+
* Extracts the first segment of a payload field reference.
|
|
142
|
+
*
|
|
143
|
+
* Parses binding references in the format "@payload.field" and extracts
|
|
144
|
+
* the first field name segment. Used for identifying payload fields in
|
|
145
|
+
* guard conditions for test data generation.
|
|
146
|
+
*
|
|
147
|
+
* @param {unknown} ref - Binding reference to extract from
|
|
148
|
+
* @returns {string | null} First field segment or null for non-payload references
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* extractPayloadFieldRef('@payload.item'); // returns 'item'
|
|
152
|
+
* extractPayloadFieldRef('@payload.data.weight'); // returns 'data'
|
|
153
|
+
* extractPayloadFieldRef('@entity.id'); // returns null
|
|
154
|
+
* extractPayloadFieldRef('@user.name'); // returns null
|
|
126
155
|
*/
|
|
127
156
|
declare function extractPayloadFieldRef(ref: unknown): string | null;
|
|
128
157
|
/**
|
|
129
|
-
*
|
|
158
|
+
* Builds test payloads that satisfy or violate guard conditions.
|
|
159
|
+
*
|
|
160
|
+
* Generates pass/fail test data for guard s-expressions used in state machine
|
|
161
|
+
* transitions. Pass payloads satisfy the guard condition (allowing transition),
|
|
162
|
+
* fail payloads violate it (blocking transition). Used for automated testing
|
|
163
|
+
* and validation of state machine behavior.
|
|
130
164
|
*
|
|
131
|
-
*
|
|
132
|
-
* Fail payload: violates the guard condition (transition is blocked).
|
|
165
|
+
* Supports operators: not-nil, nil, eq, not-eq, gt, gte, lt, lte, and, or, not
|
|
133
166
|
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
167
|
+
* @param {unknown} guard - Guard s-expression to analyze
|
|
168
|
+
* @returns {GuardPayload} Object with pass and fail payloads
|
|
136
169
|
*
|
|
137
|
-
*
|
|
170
|
+
* @example
|
|
171
|
+
* // Guard: ['not-nil', '@payload.completed']
|
|
172
|
+
* buildGuardPayloads(['not-nil', '@payload.completed']);
|
|
173
|
+
* // Returns: { pass: { completed: 'mock-test-value' }, fail: { completed: null } }
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* // Guard: ['eq', '@payload.status', 'active']
|
|
177
|
+
* buildGuardPayloads(['eq', '@payload.status', 'active']);
|
|
178
|
+
* // Returns: { pass: { status: 'active' }, fail: { status: 'not-active' } }
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* // Guard: ['and', ['not-nil', '@payload.id'], ['eq', '@payload.status', 'ready']]
|
|
182
|
+
* buildGuardPayloads(['and', ['not-nil', '@payload.id'], ['eq', '@payload.status', 'ready']]);
|
|
183
|
+
* // Returns: { pass: { id: 'mock-test-value', status: 'ready' }, fail: { id: null } }
|
|
138
184
|
*/
|
|
139
185
|
declare function buildGuardPayloads(guard: unknown): GuardPayload;
|
|
140
186
|
|
|
@@ -165,12 +211,29 @@ interface ReplayTransition extends GraphTransition {
|
|
|
165
211
|
}>;
|
|
166
212
|
}
|
|
167
213
|
/**
|
|
168
|
-
*
|
|
214
|
+
* Builds the shortest replay paths from initial state to all reachable states.
|
|
215
|
+
*
|
|
216
|
+
* Computes step-by-step navigation paths for state machine testing and verification.
|
|
217
|
+
* Uses breadth-first search to find shortest paths up to specified depth limit.
|
|
218
|
+
* Each path contains replay steps with event, state, and payload information
|
|
219
|
+
* needed to reproduce state transitions in tests.
|
|
220
|
+
*
|
|
221
|
+
* @param {ReplayTransition[]} transitions - Transitions with render/payload information
|
|
222
|
+
* @param {string} initialState - Starting state name
|
|
223
|
+
* @param {number} [maxDepth=3] - Maximum path length (default: 3)
|
|
224
|
+
* @returns {Map<string, ReplayStep[]>} Map of state names to replay step arrays
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* // Build paths from 'initial' state
|
|
228
|
+
* const paths = buildReplayPaths(transitions, 'initial', 5);
|
|
229
|
+
*
|
|
230
|
+
* // Get steps to reach 'completed' state
|
|
231
|
+
* const stepsToComplete = paths.get('completed');
|
|
169
232
|
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
233
|
+
* // Execute replay steps
|
|
234
|
+
* for (const step of stepsToComplete) {
|
|
235
|
+
* await dispatchEvent(step.event, step.payload);
|
|
236
|
+
* }
|
|
174
237
|
*/
|
|
175
238
|
declare function buildReplayPaths(transitions: ReplayTransition[], initialState: string, maxDepth?: number): Map<string, ReplayStep[]>;
|
|
176
239
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/state-machine/graph.ts","../../src/state-machine/bf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","sourcesContent":["/**\n * State Graph Construction\n *\n * Build an adjacency list from state machine transitions.\n * Extracted from orbital-verify-unified/src/analyze.ts.\n *\n * @packageDocumentation\n */\n\nimport type { GraphTransition, StateEdge } from './types.js';\n\n/**\n * Build an adjacency list: state -> [{ event, to }].\n * Wildcard transitions (from === '*') are excluded since they\n * don't represent fixed edges in the graph.\n */\nexport function buildStateGraph(\n transitions: GraphTransition[]\n): Map<string, StateEdge[]> {\n const graph = new Map<string, StateEdge[]>();\n for (const t of transitions) {\n if (t.from === '*') continue;\n if (!graph.has(t.from)) graph.set(t.from, []);\n graph.get(t.from)!.push({ event: t.event, to: t.to });\n }\n return graph;\n}\n","/**\n * BFS Reachability Algorithms\n *\n * Breadth-first search over state machine graphs.\n * Extracted from orbital-verify-unified/src/analyze.ts and phase3-server.ts.\n *\n * @packageDocumentation\n */\n\nimport type { BFSNode, StateEdge } from './types.js';\nimport { buildStateGraph } from './graph.js';\nimport type { GraphTransition } from './types.js';\n\n/**\n * Collect all reachable states from an initial state via BFS.\n *\n * @param transitions - State machine transitions\n * @param initialState - Starting state\n * @param maxDepth - Maximum BFS depth (default: 5)\n * @returns Set of reachable state names\n */\nexport function collectReachableStates(\n transitions: GraphTransition[],\n initialState: string,\n maxDepth = 5\n): Set<string> {\n const graph = buildStateGraph(transitions);\n const visited = new Set<string>([initialState]);\n const queue: BFSNode[] = [{ state: initialState, depth: 0 }];\n\n while (queue.length > 0) {\n const current = queue.shift()!;\n if (current.depth >= maxDepth) continue;\n\n const edges = graph.get(current.state) ?? [];\n for (const edge of edges) {\n if (!visited.has(edge.to)) {\n visited.add(edge.to);\n queue.push({ state: edge.to, depth: current.depth + 1 });\n }\n }\n }\n\n return visited;\n}\n\n/**\n * Walk all (state, event) pairs reachable via BFS and invoke a callback for each.\n * Used by the server verification to POST each transition and check the response.\n *\n * @param transitions - State machine transitions\n * @param initialState - Starting state\n * @param maxDepth - Maximum BFS depth (default: 5)\n * @param visitor - Callback invoked for each (state, edge) pair.\n * Return true to enqueue the target state for further exploration.\n */\nexport async function walkStatePairs(\n transitions: GraphTransition[],\n initialState: string,\n maxDepth: number,\n visitor: (state: string, edge: StateEdge, depth: number) => Promise<boolean>\n): Promise<{ visitedPairs: Set<string>; walkedEdges: number }> {\n const graph = buildStateGraph(transitions);\n const visitedPairs = new Set<string>();\n const queue: BFSNode[] = [{ state: initialState, depth: 0 }];\n let walkedEdges = 0;\n\n while (queue.length > 0) {\n const current = queue.shift()!;\n if (current.depth >= maxDepth) continue;\n\n const edges = graph.get(current.state) ?? [];\n for (const edge of edges) {\n const pairKey = `${current.state}:${edge.event}`;\n if (visitedPairs.has(pairKey)) continue;\n visitedPairs.add(pairKey);\n\n const shouldEnqueue = await visitor(current.state, edge, current.depth);\n walkedEdges++;\n\n if (shouldEnqueue) {\n const stateVisited = [...visitedPairs].some((k) => k.startsWith(`${edge.to}:`));\n if (!stateVisited) {\n queue.push({ state: edge.to, depth: current.depth + 1 });\n }\n }\n }\n }\n\n return { visitedPairs, walkedEdges };\n}\n","/**\n * Guard Payload Builder\n *\n * Derive pass and fail payloads from guard s-expressions.\n * Extracted from orbital-verify-unified/src/analyze.ts.\n *\n * @packageDocumentation\n */\n\nimport type { GuardPayload } from './types.js';\n\n/**\n * Extract the first @payload path segment from a binding reference.\n * \"@payload.item\" -> \"item\", \"@payload.data.weight\" -> \"data\".\n * Returns null for non-payload refs (@entity, @state, @user, etc.).\n */\nexport function extractPayloadFieldRef(ref: unknown): string | null {\n if (typeof ref !== 'string') return null;\n const match = ref.match(/^@payload\\.([A-Za-z0-9_]+)/);\n return match ? match[1] : null;\n}\n\n/**\n * Derive pass and fail payloads from a guard s-expression.\n *\n * Pass payload: satisfies the guard condition (transition fires).\n * Fail payload: violates the guard condition (transition is blocked).\n *\n * For @entity.* and @user.* guards: returns { pass: {}, fail: {} } because\n * these reference runtime state that cannot be directly faked in tests.\n *\n * Handles operators: not-nil, nil, eq, not-eq, gt, gte, lt, lte, and, or, not\n */\nexport function buildGuardPayloads(guard: unknown): GuardPayload {\n if (!Array.isArray(guard) || guard.length === 0) {\n return { pass: {}, fail: {} };\n }\n\n const op = String(guard[0]);\n\n if (op === 'not-nil' || op === 'not_nil') {\n const field = extractPayloadFieldRef(guard[1]);\n if (field) return { pass: { [field]: 'mock-test-value' }, fail: { [field]: null } };\n }\n\n if (op === 'nil') {\n const field = extractPayloadFieldRef(guard[1]);\n if (field) return { pass: {}, fail: { [field]: 'mock-test-value' } };\n }\n\n if (op === 'eq' || op === '==' || op === '=') {\n const field = extractPayloadFieldRef(guard[1]);\n const val = guard[2];\n if (field && val !== undefined) {\n const failVal =\n typeof val === 'number' ? val + 1\n : typeof val === 'string' ? `not-${val}`\n : null;\n return { pass: { [field]: val }, fail: { [field]: failVal } };\n }\n }\n\n if (op === 'not-eq' || op === '!=' || op === 'neq') {\n const field = extractPayloadFieldRef(guard[1]);\n const val = guard[2];\n if (field && val !== undefined) {\n const passVal =\n typeof val === 'number' ? val + 1\n : typeof val === 'string' ? `not-${val}`\n : 'other';\n return { pass: { [field]: passVal }, fail: { [field]: val } };\n }\n }\n\n if (op === 'gt' || op === '>') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n + 1 }, fail: { [field]: n - 1 } };\n }\n\n if (op === 'gte' || op === '>=') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n }, fail: { [field]: n - 1 } };\n }\n\n if (op === 'lt' || op === '<') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n - 1 }, fail: { [field]: n + 1 } };\n }\n\n if (op === 'lte' || op === '<=') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n }, fail: { [field]: n + 1 } };\n }\n\n if (op === 'and') {\n const subs = (guard.slice(1) as unknown[]).filter(Array.isArray);\n if (subs.length >= 2) {\n const s1 = buildGuardPayloads(subs[0]);\n const s2 = buildGuardPayloads(subs[1]);\n return { pass: { ...s1.pass, ...s2.pass }, fail: s1.fail };\n }\n if (subs.length === 1) return buildGuardPayloads(subs[0]);\n }\n\n if (op === 'or') {\n const subs = (guard.slice(1) as unknown[]).filter(Array.isArray);\n if (subs.length >= 2) {\n const s1 = buildGuardPayloads(subs[0]);\n const s2 = buildGuardPayloads(subs[1]);\n return { pass: s1.pass, fail: { ...s1.fail, ...s2.fail } };\n }\n if (subs.length === 1) return buildGuardPayloads(subs[0]);\n }\n\n if (op === 'not') {\n const inner = buildGuardPayloads(guard[1]);\n return { pass: inner.fail, fail: inner.pass };\n }\n\n return { pass: {}, fail: {} };\n}\n","/**\n * Replay Path Builder\n *\n * Compute the shortest path (replay steps) from an initial state\n * to every reachable state in a state machine. Used by browser\n * verification to navigate through states before running assertions.\n *\n * Extracted from orbital-verify-unified/src/analyze.ts (collectDataMutationTests).\n *\n * @packageDocumentation\n */\n\nimport type { GraphTransition, ReplayStep, PayloadFieldSchema } from './types.js';\n\n/** Entity-data sentinel payload fields: presence means transition needs a selected row */\nconst ENTITY_PAYLOAD_FIELDS = new Set(['data', 'row', 'item', 'id']);\n\n/**\n * Extended transition with render and payload info needed for replay path building.\n * Compatible with orbital-verify's UnifiedTransition.\n */\nexport interface ReplayTransition extends GraphTransition {\n hasGuard: boolean;\n guard?: unknown[];\n payloadFields: string[];\n payloadSchema: PayloadFieldSchema[];\n renderEffects: Array<{\n slot: string;\n patternType: string | null;\n }>;\n}\n\n/**\n * Build the shortest replay path from initialState to every reachable state.\n *\n * @param transitions - Transitions with render/payload info\n * @param initialState - Starting state\n * @param maxDepth - Maximum path length (default: 3, shorter than BFS exploration)\n * @returns Map of state -> replay steps to reach it\n */\nexport function buildReplayPaths(\n transitions: ReplayTransition[],\n initialState: string,\n maxDepth = 3\n): Map<string, ReplayStep[]> {\n type QueueNode = { state: string; path: ReplayStep[] };\n\n const queue: QueueNode[] = [{ state: initialState, path: [] }];\n const replayPaths = new Map<string, ReplayStep[]>();\n replayPaths.set(initialState, []);\n\n while (queue.length > 0) {\n const { state, path } = queue.shift()!;\n if (path.length >= maxDepth) continue;\n\n const fromHere = transitions.filter(\n (t) => t.from === state && t.event !== 'INIT',\n );\n\n for (const transition of fromHere) {\n if (replayPaths.has(transition.to)) continue;\n\n const renderEffect = transition.renderEffects.find((re) => re.patternType !== null);\n const stepNeedsEntityData =\n transition.hasGuard ||\n transition.payloadFields.some((f) => ENTITY_PAYLOAD_FIELDS.has(f));\n\n const step: ReplayStep = {\n event: transition.event,\n fromState: state,\n toState: transition.to,\n slot: renderEffect?.slot ?? 'main',\n expectedPattern: renderEffect?.patternType ?? undefined,\n needsEntityData: stepNeedsEntityData,\n payloadSchema: transition.payloadSchema.length > 0 ? transition.payloadSchema : undefined,\n };\n\n const newPath = [...path, step];\n replayPaths.set(transition.to, newPath);\n queue.push({ state: transition.to, path: newPath });\n }\n }\n\n return replayPaths;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/state-machine/graph.ts","../../src/state-machine/bfs.ts","../../src/state-machine/guard-payloads.ts","../../src/state-machine/replay-paths.ts"],"names":[],"mappings":";AAgBO,SAAS,gBACd,WAAA,EAC0B;AAC1B,EAAA,MAAM,KAAA,uBAAY,GAAA,EAAyB;AAC3C,EAAA,KAAA,MAAW,KAAK,WAAA,EAAa;AAC3B,IAAA,IAAI,CAAA,CAAE,SAAS,GAAA,EAAK;AACpB,IAAA,IAAI,CAAC,KAAA,CAAM,GAAA,CAAI,CAAA,CAAE,IAAI,CAAA,EAAG,KAAA,CAAM,GAAA,CAAI,CAAA,CAAE,IAAA,EAAM,EAAE,CAAA;AAC5C,IAAA,KAAA,CAAM,GAAA,CAAI,CAAA,CAAE,IAAI,CAAA,CAAG,IAAA,CAAK,EAAE,KAAA,EAAO,CAAA,CAAE,KAAA,EAAO,EAAA,EAAI,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AAA,CAAK,CAAC,CAAA,KAAM,qBAAA,CAAsB,GAAA,CAAI,CAAC,CAAC,CAAA;AAEnE,MAAA,MAAM,IAAA,GAAmB;AAAA,QACvB,OAAO,UAAA,CAAW,KAAA;AAAA,QAClB,SAAA,EAAW,KAAA;AAAA,QACX,SAAS,UAAA,CAAW,EAAA;AAAA,QACpB,IAAA,EAAM,cAAc,IAAA,IAAQ,MAAA;AAAA,QAC5B,eAAA,EAAiB,cAAc,WAAA,IAAe,MAAA;AAAA,QAC9C,eAAA,EAAiB,mBAAA;AAAA,QACjB,eAAe,UAAA,CAAW,aAAA,CAAc,MAAA,GAAS,CAAA,GAAI,WAAW,aAAA,GAAgB;AAAA,OAClF;AAEA,MAAA,MAAM,OAAA,GAAU,CAAC,GAAG,IAAA,EAAM,IAAI,CAAA;AAC9B,MAAA,WAAA,CAAY,GAAA,CAAI,UAAA,CAAW,EAAA,EAAI,OAAO,CAAA;AACtC,MAAA,KAAA,CAAM,KAAK,EAAE,KAAA,EAAO,WAAW,EAAA,EAAI,IAAA,EAAM,SAAS,CAAA;AAAA,IACpD;AAAA,EACF;AAEA,EAAA,OAAO,WAAA;AACT","file":"index.js","sourcesContent":["/**\n * State Graph Construction\n *\n * Build an adjacency list from state machine transitions.\n * Extracted from orbital-verify-unified/src/analyze.ts.\n *\n * @packageDocumentation\n */\n\nimport type { GraphTransition, StateEdge } from './types.js';\n\n/**\n * Build an adjacency list: state -> [{ event, to }].\n * Wildcard transitions (from === '*') are excluded since they\n * don't represent fixed edges in the graph.\n */\nexport function buildStateGraph(\n transitions: GraphTransition[]\n): Map<string, StateEdge[]> {\n const graph = new Map<string, StateEdge[]>();\n for (const t of transitions) {\n if (t.from === '*') continue;\n if (!graph.has(t.from)) graph.set(t.from, []);\n graph.get(t.from)!.push({ event: t.event, to: t.to });\n }\n return graph;\n}\n","/**\n * BFS Reachability Algorithms\n *\n * Breadth-first search over state machine graphs.\n * Extracted from orbital-verify-unified/src/analyze.ts and phase3-server.ts.\n *\n * @packageDocumentation\n */\n\nimport type { BFSNode, StateEdge } from './types.js';\nimport { buildStateGraph } from './graph.js';\nimport type { GraphTransition } from './types.js';\n\n/**\n * Collects all reachable states from an initial state using breadth-first search.\n * \n * Performs BFS traversal of the state machine to find all states reachable\n * from the initial state, up to the specified maximum depth. Used for\n * state machine analysis, verification, and test coverage assessment.\n * \n * @param {GraphTransition[]} transitions - Array of state transitions\n * @param {string} initialState - Starting state name\n * @param {number} [maxDepth=5] - Maximum search depth\n * @returns {Set<string>} Set of reachable state names\n * \n * @example\n * const reachable = collectReachableStates(transitions, 'initial', 10);\n * console.log('Reachable states:', Array.from(reachable));\n */\nexport function collectReachableStates(\n transitions: GraphTransition[],\n initialState: string,\n maxDepth = 5\n): Set<string> {\n const graph = buildStateGraph(transitions);\n const visited = new Set<string>([initialState]);\n const queue: BFSNode[] = [{ state: initialState, depth: 0 }];\n\n while (queue.length > 0) {\n const current = queue.shift()!;\n if (current.depth >= maxDepth) continue;\n\n const edges = graph.get(current.state) ?? [];\n for (const edge of edges) {\n if (!visited.has(edge.to)) {\n visited.add(edge.to);\n queue.push({ state: edge.to, depth: current.depth + 1 });\n }\n }\n }\n\n return visited;\n}\n\n/**\n * Walks all reachable (state, event) pairs using BFS and invokes callback for each.\n * \n * Traverses the state machine using breadth-first search and calls the visitor\n * function for each (state, edge) pair encountered. Used by server verification\n * to test transitions by POSTing to endpoints and checking responses.\n * \n * @param {GraphTransition[]} transitions - Array of state transitions\n * @param {string} initialState - Starting state name\n * @param {number} maxDepth - Maximum BFS depth\n * @param {(state: string, edge: StateEdge, depth: number) => Promise<boolean>} visitor - Callback for each pair\n * @returns {Promise<{ visitedPairs: Set<string>; walkedEdges: number }>} Traversal statistics\n * \n * @example\n * const result = await walkStatePairs(transitions, 'initial', 5, async (state, edge) => {\n * console.log(`Transition: ${state} --${edge.event}--> ${edge.to}`);\n * return true; // Continue exploration\n * });\n * console.log(`Visited ${result.visitedPairs.size} state-event pairs`);\n */\nexport async function walkStatePairs(\n transitions: GraphTransition[],\n initialState: string,\n maxDepth: number,\n visitor: (state: string, edge: StateEdge, depth: number) => Promise<boolean>\n): Promise<{ visitedPairs: Set<string>; walkedEdges: number }> {\n const graph = buildStateGraph(transitions);\n const visitedPairs = new Set<string>();\n const queue: BFSNode[] = [{ state: initialState, depth: 0 }];\n let walkedEdges = 0;\n\n while (queue.length > 0) {\n const current = queue.shift()!;\n if (current.depth >= maxDepth) continue;\n\n const edges = graph.get(current.state) ?? [];\n for (const edge of edges) {\n const pairKey = `${current.state}:${edge.event}`;\n if (visitedPairs.has(pairKey)) continue;\n visitedPairs.add(pairKey);\n\n const shouldEnqueue = await visitor(current.state, edge, current.depth);\n walkedEdges++;\n\n if (shouldEnqueue) {\n const stateVisited = [...visitedPairs].some((k) => k.startsWith(`${edge.to}:`));\n if (!stateVisited) {\n queue.push({ state: edge.to, depth: current.depth + 1 });\n }\n }\n }\n }\n\n return { visitedPairs, walkedEdges };\n}\n","/**\n * Guard Payload Builder\n *\n * Derive pass and fail payloads from guard s-expressions.\n * Extracted from orbital-verify-unified/src/analyze.ts.\n *\n * @packageDocumentation\n */\n\nimport type { GuardPayload } from './types.js';\n\n/**\n * Extracts the first segment of a payload field reference.\n * \n * Parses binding references in the format \"@payload.field\" and extracts\n * the first field name segment. Used for identifying payload fields in\n * guard conditions for test data generation.\n * \n * @param {unknown} ref - Binding reference to extract from\n * @returns {string | null} First field segment or null for non-payload references\n * \n * @example\n * extractPayloadFieldRef('@payload.item'); // returns 'item'\n * extractPayloadFieldRef('@payload.data.weight'); // returns 'data'\n * extractPayloadFieldRef('@entity.id'); // returns null\n * extractPayloadFieldRef('@user.name'); // returns null\n */\nexport function extractPayloadFieldRef(ref: unknown): string | null {\n if (typeof ref !== 'string') return null;\n const match = ref.match(/^@payload\\.([A-Za-z0-9_]+)/);\n return match ? match[1] : null;\n}\n\n/**\n * Builds test payloads that satisfy or violate guard conditions.\n * \n * Generates pass/fail test data for guard s-expressions used in state machine\n * transitions. Pass payloads satisfy the guard condition (allowing transition),\n * fail payloads violate it (blocking transition). Used for automated testing\n * and validation of state machine behavior.\n * \n * Supports operators: not-nil, nil, eq, not-eq, gt, gte, lt, lte, and, or, not\n * \n * @param {unknown} guard - Guard s-expression to analyze\n * @returns {GuardPayload} Object with pass and fail payloads\n * \n * @example\n * // Guard: ['not-nil', '@payload.completed']\n * buildGuardPayloads(['not-nil', '@payload.completed']);\n * // Returns: { pass: { completed: 'mock-test-value' }, fail: { completed: null } }\n * \n * @example\n * // Guard: ['eq', '@payload.status', 'active']\n * buildGuardPayloads(['eq', '@payload.status', 'active']);\n * // Returns: { pass: { status: 'active' }, fail: { status: 'not-active' } }\n * \n * @example\n * // Guard: ['and', ['not-nil', '@payload.id'], ['eq', '@payload.status', 'ready']]\n * buildGuardPayloads(['and', ['not-nil', '@payload.id'], ['eq', '@payload.status', 'ready']]);\n * // Returns: { pass: { id: 'mock-test-value', status: 'ready' }, fail: { id: null } }\n */\nexport function buildGuardPayloads(guard: unknown): GuardPayload {\n if (!Array.isArray(guard) || guard.length === 0) {\n return { pass: {}, fail: {} };\n }\n\n const op = String(guard[0]);\n\n if (op === 'not-nil' || op === 'not_nil') {\n const field = extractPayloadFieldRef(guard[1]);\n if (field) return { pass: { [field]: 'mock-test-value' }, fail: { [field]: null } };\n }\n\n if (op === 'nil') {\n const field = extractPayloadFieldRef(guard[1]);\n if (field) return { pass: {}, fail: { [field]: 'mock-test-value' } };\n }\n\n if (op === 'eq' || op === '==' || op === '=') {\n const field = extractPayloadFieldRef(guard[1]);\n const val = guard[2];\n if (field && val !== undefined) {\n const failVal =\n typeof val === 'number' ? val + 1\n : typeof val === 'string' ? `not-${val}`\n : null;\n return { pass: { [field]: val }, fail: { [field]: failVal } };\n }\n }\n\n if (op === 'not-eq' || op === '!=' || op === 'neq') {\n const field = extractPayloadFieldRef(guard[1]);\n const val = guard[2];\n if (field && val !== undefined) {\n const passVal =\n typeof val === 'number' ? val + 1\n : typeof val === 'string' ? `not-${val}`\n : 'other';\n return { pass: { [field]: passVal }, fail: { [field]: val } };\n }\n }\n\n if (op === 'gt' || op === '>') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n + 1 }, fail: { [field]: n - 1 } };\n }\n\n if (op === 'gte' || op === '>=') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n }, fail: { [field]: n - 1 } };\n }\n\n if (op === 'lt' || op === '<') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n - 1 }, fail: { [field]: n + 1 } };\n }\n\n if (op === 'lte' || op === '<=') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n }, fail: { [field]: n + 1 } };\n }\n\n if (op === 'and') {\n const subs = (guard.slice(1) as unknown[]).filter(Array.isArray);\n if (subs.length >= 2) {\n const s1 = buildGuardPayloads(subs[0]);\n const s2 = buildGuardPayloads(subs[1]);\n return { pass: { ...s1.pass, ...s2.pass }, fail: s1.fail };\n }\n if (subs.length === 1) return buildGuardPayloads(subs[0]);\n }\n\n if (op === 'or') {\n const subs = (guard.slice(1) as unknown[]).filter(Array.isArray);\n if (subs.length >= 2) {\n const s1 = buildGuardPayloads(subs[0]);\n const s2 = buildGuardPayloads(subs[1]);\n return { pass: s1.pass, fail: { ...s1.fail, ...s2.fail } };\n }\n if (subs.length === 1) return buildGuardPayloads(subs[0]);\n }\n\n if (op === 'not') {\n const inner = buildGuardPayloads(guard[1]);\n return { pass: inner.fail, fail: inner.pass };\n }\n\n return { pass: {}, fail: {} };\n}\n","/**\n * Replay Path Builder\n *\n * Compute the shortest path (replay steps) from an initial state\n * to every reachable state in a state machine. Used by browser\n * verification to navigate through states before running assertions.\n *\n * Extracted from orbital-verify-unified/src/analyze.ts (collectDataMutationTests).\n *\n * @packageDocumentation\n */\n\nimport type { GraphTransition, ReplayStep, PayloadFieldSchema } from './types.js';\n\n/** Entity-data sentinel payload fields: presence means transition needs a selected row */\nconst ENTITY_PAYLOAD_FIELDS = new Set(['data', 'row', 'item', 'id']);\n\n/**\n * Extended transition with render and payload info needed for replay path building.\n * Compatible with orbital-verify's UnifiedTransition.\n */\nexport interface ReplayTransition extends GraphTransition {\n hasGuard: boolean;\n guard?: unknown[];\n payloadFields: string[];\n payloadSchema: PayloadFieldSchema[];\n renderEffects: Array<{\n slot: string;\n patternType: string | null;\n }>;\n}\n\n/**\n * Builds the shortest replay paths from initial state to all reachable states.\n * \n * Computes step-by-step navigation paths for state machine testing and verification.\n * Uses breadth-first search to find shortest paths up to specified depth limit.\n * Each path contains replay steps with event, state, and payload information\n * needed to reproduce state transitions in tests.\n * \n * @param {ReplayTransition[]} transitions - Transitions with render/payload information\n * @param {string} initialState - Starting state name\n * @param {number} [maxDepth=3] - Maximum path length (default: 3)\n * @returns {Map<string, ReplayStep[]>} Map of state names to replay step arrays\n * \n * @example\n * // Build paths from 'initial' state\n * const paths = buildReplayPaths(transitions, 'initial', 5);\n * \n * // Get steps to reach 'completed' state\n * const stepsToComplete = paths.get('completed');\n * \n * // Execute replay steps\n * for (const step of stepsToComplete) {\n * await dispatchEvent(step.event, step.payload);\n * }\n */\nexport function buildReplayPaths(\n transitions: ReplayTransition[],\n initialState: string,\n maxDepth = 3\n): Map<string, ReplayStep[]> {\n type QueueNode = { state: string; path: ReplayStep[] };\n\n const queue: QueueNode[] = [{ state: initialState, path: [] }];\n const replayPaths = new Map<string, ReplayStep[]>();\n replayPaths.set(initialState, []);\n\n while (queue.length > 0) {\n const { state, path } = queue.shift()!;\n if (path.length >= maxDepth) continue;\n\n const fromHere = transitions.filter(\n (t) => t.from === state && t.event !== 'INIT',\n );\n\n for (const transition of fromHere) {\n if (replayPaths.has(transition.to)) continue;\n\n const renderEffect = transition.renderEffects.find((re) => re.patternType !== null);\n const stepNeedsEntityData =\n transition.hasGuard ||\n transition.payloadFields.some((f) => ENTITY_PAYLOAD_FIELDS.has(f));\n\n const step: ReplayStep = {\n event: transition.event,\n fromState: state,\n toState: transition.to,\n slot: renderEffect?.slot ?? 'main',\n expectedPattern: renderEffect?.patternType ?? undefined,\n needsEntityData: stepNeedsEntityData,\n payloadSchema: transition.payloadSchema.length > 0 ? transition.payloadSchema : undefined,\n };\n\n const newPath = [...path, step];\n replayPaths.set(transition.to, newPath);\n queue.push({ state: transition.to, path: newPath });\n }\n }\n\n return replayPaths;\n}\n"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bs as SExpr } from '../schema-
|
|
2
|
-
export { A as AGENT_DOMAIN_CATEGORIES, e as ALLOWED_CUSTOM_COMPONENTS, f as AgentDomainCategory, g as AgentDomainCategorySchema, h as AllowedCustomComponent, i as AnimationDef, j as AnimationDefInput, k as AnimationDefSchema, b as AppSchema, l as AssetMap, m as AssetMapInput, n as AssetMapSchema, o as AssetMapping, p as AssetMappingInput, q as AssetMappingSchema, C as CORE_BINDINGS, r as CallServiceConfig, s as ComputedEventContract, t as ComputedEventContractSchema, u as ComputedEventListener, v as ComputedEventListenerSchema, w as CoreBinding, x as CustomPatternDefinition, y as CustomPatternDefinitionInput, z as CustomPatternDefinitionSchema, B as CustomPatternMap, D as CustomPatternMapInput, F as CustomPatternMapSchema, G as DesignPreferences, H as DesignPreferencesInput, I as DesignPreferencesSchema, J as DesignTokens, K as DesignTokensInput, L as DesignTokensSchema, M as DomainCategory, N as DomainCategorySchema, Q as DomainContext, R as DomainContextInput, U as DomainContextSchema, V as DomainVocabulary, W as DomainVocabularySchema, X as ENTITY_ROLES, Y as Effect, Z as EffectInput, _ as EffectSchema, d as Entity, E as EntityField, $ as EntityFieldInput, a0 as EntityFieldSchema, a as EntityPersistence, a1 as EntityPersistenceSchema, a2 as EntityRef, a3 as EntityRefSchema, a4 as EntityRefStringSchema, a5 as EntityRole, a6 as EntityRoleSchema, a7 as EntitySchema, a8 as EntitySemanticRole, a9 as EntitySemanticRoleSchema, aa as Event, ab as EventInput, ac as EventListener, ad as EventListenerSchema, ae as EventPayloadField, af as EventPayloadFieldSchema, ag as EventSchema, ah as EventScope, ai as EventScopeSchema, aj as EventSemanticRole, ak as EventSemanticRoleSchema, al as EventSource, am as EventSourceSchema, an as Expression, ao as ExpressionInput, ap as ExpressionSchema, aq as Field, ar as FieldFormat, as as FieldFormatSchema, at as FieldSchema, au as FieldType, av as FieldTypeSchema, aw as FullOrbitalUnit, ax as GAME_TYPES, ay as GameSubCategory, az as GameSubCategorySchema, aA as GameType, aB as GameTypeSchema, aC as Guard, aD as GuardInput, aE as GuardSchema, aF as McpServiceDef, aG as McpServiceDefSchema, aH as NodeClassification, aI as NodeClassificationSchema, aw as Orbital, aJ as OrbitalConfig, aK as OrbitalConfigInput, aL as OrbitalConfigSchema, O as OrbitalDefinition, aM as OrbitalDefinitionSchema, aN as OrbitalEntity, aO as OrbitalEntityInput, aP as OrbitalEntitySchema, aQ as OrbitalInput, aR as OrbitalPage, aS as OrbitalPageInput, aT as OrbitalPageSchema, aU as OrbitalPageStrictInput, aV as OrbitalPageStrictSchema, b as OrbitalSchema, aW as OrbitalSchemaInput, aX as OrbitalSchemaSchema, aY as OrbitalTraitRef, aZ as OrbitalTraitRefSchema, a_ as OrbitalUnit, a$ as OrbitalUnitSchema, b0 as OrbitalZodSchema, P as Page, b1 as PageRef, b2 as PageRefObject, b3 as PageRefObjectSchema, b4 as PageRefSchema, b5 as PageRefStringSchema, b6 as PageSchema, b7 as PageTraitRef, b8 as PageTraitRefSchema, b9 as ParsedBinding, ba as PayloadField, bb as PayloadFieldSchema, bc as PresentationType, bd as RelatedLink, be as RelatedLinkSchema, bf as RelationConfig, bg as RelationConfigSchema, bh as RenderUIConfig, bi as RequiredField, bj as RequiredFieldSchema, bk as ResolvedAsset, bl as ResolvedAssetInput, bm as ResolvedAssetSchema, bn as RestAuthConfig, bo as RestAuthConfigSchema, bp as RestServiceDef, bq as RestServiceDefSchema, br as SERVICE_TYPES, bt as SExprAtom, bu as SExprAtomSchema, bv as SExprInput, bw as SExprSchema, bx as SemanticAssetRef, by as SemanticAssetRefInput, bz as SemanticAssetRefSchema, bA as ServiceDefinition, bB as ServiceDefinitionSchema, bC as ServiceRef, bD as ServiceRefSchema, bE as ServiceRefStringSchema, bF as ServiceType, bG as ServiceTypeSchema, bH as SocketEvents, bI as SocketEventsSchema, bJ as SocketServiceDef, bK as SocketServiceDefSchema, S as State, bL as StateInput, bM as StateMachine, bN as StateMachineInput, bO as StateMachineSchema, bP as StateSchema, bQ as StateSemanticRole, bR as StateSemanticRoleSchema, bS as SuggestedGuard, bT as SuggestedGuardSchema, bU as ThemeDefinition, bV as ThemeDefinitionSchema, bW as ThemeRef, bX as ThemeRefSchema, bY as ThemeRefStringSchema, bZ as ThemeTokens, b_ as ThemeTokensSchema, b$ as ThemeVariant, c0 as ThemeVariantSchema, c as Trait, c1 as TraitCategory, c2 as TraitCategorySchema, c3 as TraitDataEntity, c4 as TraitDataEntitySchema, c5 as TraitEntityField, c6 as TraitEntityFieldSchema, T as TraitEventContract, c7 as TraitEventContractSchema, c8 as TraitEventListener, c9 as TraitEventListenerSchema, ca as TraitInput, cb as TraitRef, cc as TraitRefSchema, cd as TraitReference, ce as TraitReferenceInput, cf as TraitReferenceSchema, cg as TraitSchema, ch as TraitTick, ci as TraitTickSchema, cj as TraitUIBinding, ck as Transition, cl as TransitionInput, cm as TransitionSchema, cn as UISlot, co as UISlotSchema, cp as UI_SLOTS, cq as UXHints, cr as UXHintsSchema, cs as UseDeclaration, ct as UseDeclarationSchema, cu as UserPersona, cv as UserPersonaInput, cw as UserPersonaSchema, cx as VISUAL_STYLES, cy as ViewType, cz as ViewTypeSchema, cA as VisualStyle, cB as VisualStyleSchema, cC as callService, cD as collectBindings, cE as createAssetKey, cF as deriveCollection, cG as despawn, cH as doEffects, cI as emit, cJ as findService, cK as getArgs, cL as getDefaultAnimationsForRole, cM as getOperator, cN as getServiceNames, cO as getTraitConfig, cP as getTraitName, cQ as hasService, cR as isBinding, cS as isCircuitEvent, cT as isEffect, cU as isEntityReference, cV as isImportedTraitRef, cW as isInlineTrait, cX as isMcpService, cY as isOrbitalDefinition, cZ as isPageReference, c_ as isPageReferenceObject, c$ as isPageReferenceString, d0 as isRestService, d1 as isRuntimeEntity, d2 as isSExpr, d3 as isSExprAtom, d4 as isSExprCall, d5 as isSExprEffect, d6 as isServiceReference, d7 as isSingletonEntity, d8 as isSocketService, d9 as isThemeReference, da as isValidBinding, db as navigate, dc as normalizeTraitRef, dd as notify, de as parseAssetKey, df as parseBinding, dg as parseEntityRef, dh as parseImportedTraitRef, di as parseOrbitalSchema, dj as parsePageRef, dk as parseServiceRef, dl as persist, dm as renderUI, dn as safeParseOrbitalSchema, dp as set, dq as sexpr, dr as spawn, ds as validateAssetAnimations, dt as walkSExpr } from '../schema-
|
|
1
|
+
import { bs as SExpr } from '../schema-DmrHbrqM.js';
|
|
2
|
+
export { A as AGENT_DOMAIN_CATEGORIES, e as ALLOWED_CUSTOM_COMPONENTS, f as AgentDomainCategory, g as AgentDomainCategorySchema, h as AllowedCustomComponent, i as AnimationDef, j as AnimationDefInput, k as AnimationDefSchema, b as AppSchema, l as AssetMap, m as AssetMapInput, n as AssetMapSchema, o as AssetMapping, p as AssetMappingInput, q as AssetMappingSchema, C as CORE_BINDINGS, r as CallServiceConfig, s as ComputedEventContract, t as ComputedEventContractSchema, u as ComputedEventListener, v as ComputedEventListenerSchema, w as CoreBinding, x as CustomPatternDefinition, y as CustomPatternDefinitionInput, z as CustomPatternDefinitionSchema, B as CustomPatternMap, D as CustomPatternMapInput, F as CustomPatternMapSchema, G as DesignPreferences, H as DesignPreferencesInput, I as DesignPreferencesSchema, J as DesignTokens, K as DesignTokensInput, L as DesignTokensSchema, M as DomainCategory, N as DomainCategorySchema, Q as DomainContext, R as DomainContextInput, U as DomainContextSchema, V as DomainVocabulary, W as DomainVocabularySchema, X as ENTITY_ROLES, Y as Effect, Z as EffectInput, _ as EffectSchema, d as Entity, E as EntityField, $ as EntityFieldInput, a0 as EntityFieldSchema, a as EntityPersistence, a1 as EntityPersistenceSchema, a2 as EntityRef, a3 as EntityRefSchema, a4 as EntityRefStringSchema, a5 as EntityRole, a6 as EntityRoleSchema, a7 as EntitySchema, a8 as EntitySemanticRole, a9 as EntitySemanticRoleSchema, aa as Event, ab as EventInput, ac as EventListener, ad as EventListenerSchema, ae as EventPayloadField, af as EventPayloadFieldSchema, ag as EventSchema, ah as EventScope, ai as EventScopeSchema, aj as EventSemanticRole, ak as EventSemanticRoleSchema, al as EventSource, am as EventSourceSchema, an as Expression, ao as ExpressionInput, ap as ExpressionSchema, aq as Field, ar as FieldFormat, as as FieldFormatSchema, at as FieldSchema, au as FieldType, av as FieldTypeSchema, aw as FullOrbitalUnit, ax as GAME_TYPES, ay as GameSubCategory, az as GameSubCategorySchema, aA as GameType, aB as GameTypeSchema, aC as Guard, aD as GuardInput, aE as GuardSchema, aF as McpServiceDef, aG as McpServiceDefSchema, aH as NodeClassification, aI as NodeClassificationSchema, aw as Orbital, aJ as OrbitalConfig, aK as OrbitalConfigInput, aL as OrbitalConfigSchema, O as OrbitalDefinition, aM as OrbitalDefinitionSchema, aN as OrbitalEntity, aO as OrbitalEntityInput, aP as OrbitalEntitySchema, aQ as OrbitalInput, aR as OrbitalPage, aS as OrbitalPageInput, aT as OrbitalPageSchema, aU as OrbitalPageStrictInput, aV as OrbitalPageStrictSchema, b as OrbitalSchema, aW as OrbitalSchemaInput, aX as OrbitalSchemaSchema, aY as OrbitalTraitRef, aZ as OrbitalTraitRefSchema, a_ as OrbitalUnit, a$ as OrbitalUnitSchema, b0 as OrbitalZodSchema, P as Page, b1 as PageRef, b2 as PageRefObject, b3 as PageRefObjectSchema, b4 as PageRefSchema, b5 as PageRefStringSchema, b6 as PageSchema, b7 as PageTraitRef, b8 as PageTraitRefSchema, b9 as ParsedBinding, ba as PayloadField, bb as PayloadFieldSchema, bc as PresentationType, bd as RelatedLink, be as RelatedLinkSchema, bf as RelationConfig, bg as RelationConfigSchema, bh as RenderUIConfig, bi as RequiredField, bj as RequiredFieldSchema, bk as ResolvedAsset, bl as ResolvedAssetInput, bm as ResolvedAssetSchema, bn as RestAuthConfig, bo as RestAuthConfigSchema, bp as RestServiceDef, bq as RestServiceDefSchema, br as SERVICE_TYPES, bt as SExprAtom, bu as SExprAtomSchema, bv as SExprInput, bw as SExprSchema, bx as SemanticAssetRef, by as SemanticAssetRefInput, bz as SemanticAssetRefSchema, bA as ServiceDefinition, bB as ServiceDefinitionSchema, bC as ServiceRef, bD as ServiceRefSchema, bE as ServiceRefStringSchema, bF as ServiceType, bG as ServiceTypeSchema, bH as SocketEvents, bI as SocketEventsSchema, bJ as SocketServiceDef, bK as SocketServiceDefSchema, S as State, bL as StateInput, bM as StateMachine, bN as StateMachineInput, bO as StateMachineSchema, bP as StateSchema, bQ as StateSemanticRole, bR as StateSemanticRoleSchema, bS as SuggestedGuard, bT as SuggestedGuardSchema, bU as ThemeDefinition, bV as ThemeDefinitionSchema, bW as ThemeRef, bX as ThemeRefSchema, bY as ThemeRefStringSchema, bZ as ThemeTokens, b_ as ThemeTokensSchema, b$ as ThemeVariant, c0 as ThemeVariantSchema, c as Trait, c1 as TraitCategory, c2 as TraitCategorySchema, c3 as TraitDataEntity, c4 as TraitDataEntitySchema, c5 as TraitEntityField, c6 as TraitEntityFieldSchema, T as TraitEventContract, c7 as TraitEventContractSchema, c8 as TraitEventListener, c9 as TraitEventListenerSchema, ca as TraitInput, cb as TraitRef, cc as TraitRefSchema, cd as TraitReference, ce as TraitReferenceInput, cf as TraitReferenceSchema, cg as TraitSchema, ch as TraitTick, ci as TraitTickSchema, cj as TraitUIBinding, ck as Transition, cl as TransitionInput, cm as TransitionSchema, cn as UISlot, co as UISlotSchema, cp as UI_SLOTS, cq as UXHints, cr as UXHintsSchema, cs as UseDeclaration, ct as UseDeclarationSchema, cu as UserPersona, cv as UserPersonaInput, cw as UserPersonaSchema, cx as VISUAL_STYLES, cy as ViewType, cz as ViewTypeSchema, cA as VisualStyle, cB as VisualStyleSchema, cC as callService, cD as collectBindings, cE as createAssetKey, cF as deriveCollection, cG as despawn, cH as doEffects, cI as emit, cJ as findService, cK as getArgs, cL as getDefaultAnimationsForRole, cM as getOperator, cN as getServiceNames, cO as getTraitConfig, cP as getTraitName, cQ as hasService, cR as isBinding, cS as isCircuitEvent, cT as isEffect, cU as isEntityReference, cV as isImportedTraitRef, cW as isInlineTrait, cX as isMcpService, cY as isOrbitalDefinition, cZ as isPageReference, c_ as isPageReferenceObject, c$ as isPageReferenceString, d0 as isRestService, d1 as isRuntimeEntity, d2 as isSExpr, d3 as isSExprAtom, d4 as isSExprCall, d5 as isSExprEffect, d6 as isServiceReference, d7 as isSingletonEntity, d8 as isSocketService, d9 as isThemeReference, da as isValidBinding, db as navigate, dc as normalizeTraitRef, dd as notify, de as parseAssetKey, df as parseBinding, dg as parseEntityRef, dh as parseImportedTraitRef, di as parseOrbitalSchema, dj as parsePageRef, dk as parseServiceRef, dl as persist, dm as renderUI, dn as safeParseOrbitalSchema, dp as set, dq as sexpr, dr as spawn, ds as validateAssetAnimations, dt as walkSExpr } from '../schema-DmrHbrqM.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
export { CATEGORIES, CategoryMeta, OPERATORS, OPERATORS_SCHEMA, OPERATOR_NAMES, OperatorCategory, OperatorMeta, OperatorStats, OperatorsSchema, TargetPlatform, getOperatorMeta, getOperatorStats, getOperatorsByCategory, getOperatorsForTarget, isEffectOperator, isGuardOperator, isKnownOperator, validateOperatorArity } from '@almadar/operators';
|
|
5
5
|
export { PATTERN_TYPES, PatternConfig, PatternType, isValidPatternType } from '@almadar/patterns';
|