@servlyadmin/runtime-core 0.1.0 → 0.1.3
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/chunk-CIUQK4GA.js +182 -0
- package/dist/index.cjs +1456 -206
- package/dist/index.d.cts +629 -7
- package/dist/index.d.ts +629 -7
- package/dist/index.js +1254 -214
- package/dist/registry-GCCVK65D.js +16 -0
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -26,6 +26,10 @@ interface ElementConfig {
|
|
|
26
26
|
src?: string;
|
|
27
27
|
/** Dynamic image source */
|
|
28
28
|
dynamicSrc?: string;
|
|
29
|
+
/** Dynamic href */
|
|
30
|
+
dynamicHref?: string;
|
|
31
|
+
/** Dynamic value */
|
|
32
|
+
dynamicValue?: string;
|
|
29
33
|
/** Alt text for images */
|
|
30
34
|
alt?: string;
|
|
31
35
|
/** Link href */
|
|
@@ -48,6 +52,16 @@ interface ElementConfig {
|
|
|
48
52
|
readOnly?: boolean;
|
|
49
53
|
/** Inline styles */
|
|
50
54
|
style?: Record<string, any>;
|
|
55
|
+
/** Reference to another component (for componentView elements) */
|
|
56
|
+
componentViewRef?: string;
|
|
57
|
+
/** Version specifier for the referenced component */
|
|
58
|
+
componentViewVersion?: string;
|
|
59
|
+
/** Props to pass to the referenced component */
|
|
60
|
+
componentViewProps?: Record<string, any>;
|
|
61
|
+
/** Blueprint ID for renderDynamicList */
|
|
62
|
+
blueprint?: string;
|
|
63
|
+
/** Blueprint version specifier */
|
|
64
|
+
blueprintVersion?: string;
|
|
51
65
|
/** Data attributes */
|
|
52
66
|
[key: `data-${string}`]: string | undefined;
|
|
53
67
|
/** Aria attributes */
|
|
@@ -87,6 +101,17 @@ interface BindingContext {
|
|
|
87
101
|
/** Additional context data */
|
|
88
102
|
context?: Record<string, any>;
|
|
89
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Registry of available components for dependency resolution
|
|
106
|
+
*/
|
|
107
|
+
interface ComponentRegistry {
|
|
108
|
+
/** Get component by ID and optional version */
|
|
109
|
+
get(id: string, version?: string): BundledComponent | undefined;
|
|
110
|
+
/** Check if component exists */
|
|
111
|
+
has(id: string, version?: string): boolean;
|
|
112
|
+
/** Register a component */
|
|
113
|
+
set(id: string, version: string, component: BundledComponent): void;
|
|
114
|
+
}
|
|
90
115
|
/**
|
|
91
116
|
* Options for rendering a component
|
|
92
117
|
*/
|
|
@@ -99,6 +124,12 @@ interface RenderOptions {
|
|
|
99
124
|
context: BindingContext;
|
|
100
125
|
/** Event handlers keyed by element ID then event name */
|
|
101
126
|
eventHandlers?: Record<string, Record<string, (e: Event) => void>>;
|
|
127
|
+
/** Registry of components for resolving componentViewRef and blueprints */
|
|
128
|
+
componentRegistry?: ComponentRegistry;
|
|
129
|
+
/** Callback when a dependency needs to be loaded */
|
|
130
|
+
onDependencyNeeded?: (id: string, version?: string) => Promise<BundledComponent | undefined>;
|
|
131
|
+
/** Callback when rendering a referenced component */
|
|
132
|
+
onComponentRender?: (id: string, container: HTMLElement) => void;
|
|
102
133
|
}
|
|
103
134
|
/**
|
|
104
135
|
* Result of a render operation
|
|
@@ -154,6 +185,47 @@ interface TestCase$1 {
|
|
|
154
185
|
/** Assertions to validate */
|
|
155
186
|
assertions?: Assertion$1[];
|
|
156
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Type of component dependency
|
|
190
|
+
*/
|
|
191
|
+
type DependencyType = 'blueprint' | 'viewRef' | 'slot';
|
|
192
|
+
/**
|
|
193
|
+
* Single dependency entry in manifest
|
|
194
|
+
*/
|
|
195
|
+
interface DependencyEntry {
|
|
196
|
+
/** Requested version specifier (e.g., "^1.0.0") */
|
|
197
|
+
version: string;
|
|
198
|
+
/** Actual resolved version (e.g., "1.2.3") */
|
|
199
|
+
resolved: string;
|
|
200
|
+
/** Type of dependency */
|
|
201
|
+
type: DependencyType;
|
|
202
|
+
/** Parent dependency ID (for nested deps) */
|
|
203
|
+
via?: string;
|
|
204
|
+
/** If true, component works without this dependency */
|
|
205
|
+
optional?: boolean;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Manifest of all component dependencies
|
|
209
|
+
*/
|
|
210
|
+
interface DependencyManifest {
|
|
211
|
+
[componentId: string]: DependencyEntry;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Bundled component data (minimal for bundle)
|
|
215
|
+
*/
|
|
216
|
+
interface BundledComponent {
|
|
217
|
+
/** Layout JSON elements */
|
|
218
|
+
layout: LayoutElement[];
|
|
219
|
+
/** Props interface definition */
|
|
220
|
+
propsInterface?: PropDefinition[];
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Bundle of all dependencies
|
|
224
|
+
* Key format: "componentId@version"
|
|
225
|
+
*/
|
|
226
|
+
interface ComponentBundle {
|
|
227
|
+
[componentIdAtVersion: string]: BundledComponent;
|
|
228
|
+
}
|
|
157
229
|
/**
|
|
158
230
|
* Component data from registry
|
|
159
231
|
*/
|
|
@@ -180,6 +252,10 @@ interface ComponentData {
|
|
|
180
252
|
createdAt?: string;
|
|
181
253
|
/** Updated timestamp */
|
|
182
254
|
updatedAt?: string;
|
|
255
|
+
/** Dependency manifest - lists all required components */
|
|
256
|
+
dependencies?: DependencyManifest;
|
|
257
|
+
/** Bundled dependencies - included component data */
|
|
258
|
+
bundle?: ComponentBundle;
|
|
183
259
|
}
|
|
184
260
|
/**
|
|
185
261
|
* Cache entry for component data
|
|
@@ -224,6 +300,10 @@ interface RetryConfig {
|
|
|
224
300
|
/** Backoff multiplier */
|
|
225
301
|
backoffMultiplier?: number;
|
|
226
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Bundle loading strategy
|
|
305
|
+
*/
|
|
306
|
+
type BundleStrategy = 'eager' | 'lazy' | 'none';
|
|
227
307
|
/**
|
|
228
308
|
* Options for fetching a component
|
|
229
309
|
*/
|
|
@@ -242,6 +322,12 @@ interface FetchOptions {
|
|
|
242
322
|
forceRefresh?: boolean;
|
|
243
323
|
/** Abort signal for cancellation */
|
|
244
324
|
signal?: AbortSignal;
|
|
325
|
+
/** How to handle dependencies: eager (bundle all), lazy (fetch on demand), none */
|
|
326
|
+
bundleStrategy?: BundleStrategy;
|
|
327
|
+
/** Include bundled dependencies in response */
|
|
328
|
+
includeBundle?: boolean;
|
|
329
|
+
/** Maximum bundle size in bytes before switching to lazy */
|
|
330
|
+
maxBundleSize?: number;
|
|
245
331
|
}
|
|
246
332
|
/**
|
|
247
333
|
* Result of a fetch operation
|
|
@@ -253,6 +339,13 @@ interface FetchResult {
|
|
|
253
339
|
fromCache: boolean;
|
|
254
340
|
/** Resolved version */
|
|
255
341
|
version: string;
|
|
342
|
+
/** Pre-built component registry from bundle */
|
|
343
|
+
registry?: ComponentRegistry;
|
|
344
|
+
/** List of dependencies that need lazy loading */
|
|
345
|
+
pendingDependencies?: Array<{
|
|
346
|
+
id: string;
|
|
347
|
+
version: string;
|
|
348
|
+
}>;
|
|
256
349
|
}
|
|
257
350
|
/**
|
|
258
351
|
* Result of a single assertion
|
|
@@ -301,12 +394,37 @@ interface TestSummary$1 {
|
|
|
301
394
|
/**
|
|
302
395
|
* Vanilla DOM Renderer
|
|
303
396
|
* Renders Layout JSON to native DOM elements
|
|
397
|
+
* Supports component dependencies via componentViewRef and blueprint
|
|
304
398
|
*/
|
|
305
399
|
|
|
306
400
|
/**
|
|
307
401
|
* Render Layout JSON to DOM
|
|
308
402
|
*/
|
|
309
403
|
declare function render(options: RenderOptions): RenderResult;
|
|
404
|
+
/**
|
|
405
|
+
* Render a dynamic list using a blueprint component
|
|
406
|
+
* This is called by event handlers that use renderDynamicList
|
|
407
|
+
*/
|
|
408
|
+
declare function renderDynamicList(options: {
|
|
409
|
+
/** Target container element or selector */
|
|
410
|
+
targetContainer: HTMLElement | string;
|
|
411
|
+
/** Blueprint component ID */
|
|
412
|
+
blueprint: string;
|
|
413
|
+
/** Blueprint version (optional) */
|
|
414
|
+
blueprintVersion?: string;
|
|
415
|
+
/** Data array to render */
|
|
416
|
+
data: any[];
|
|
417
|
+
/** How to render: 'renderInto' clears container, 'append' adds to end */
|
|
418
|
+
renderType?: 'renderInto' | 'append' | 'prepend';
|
|
419
|
+
/** Item variable name in template (default: 'item') */
|
|
420
|
+
itemKey?: string;
|
|
421
|
+
/** Index variable name in template (default: 'index') */
|
|
422
|
+
indexKey?: string;
|
|
423
|
+
/** Component registry for blueprint lookup */
|
|
424
|
+
componentRegistry: ComponentRegistry;
|
|
425
|
+
/** Parent context */
|
|
426
|
+
context?: BindingContext;
|
|
427
|
+
}): RenderResult[];
|
|
310
428
|
|
|
311
429
|
/**
|
|
312
430
|
* Template Binding Resolution
|
|
@@ -331,14 +449,19 @@ declare function resolveBindingPath(path: string, context: BindingContext): any;
|
|
|
331
449
|
*
|
|
332
450
|
* @param template - The template string containing {{path}} bindings
|
|
333
451
|
* @param context - The binding context
|
|
452
|
+
* @param componentId - Optional component ID for error tracking
|
|
334
453
|
* @returns The resolved string
|
|
335
454
|
*/
|
|
336
|
-
declare function resolveTemplate(template: string, context: BindingContext): string;
|
|
455
|
+
declare function resolveTemplate(template: string, context: BindingContext, componentId?: string): string;
|
|
337
456
|
/**
|
|
338
457
|
* Resolve a template and return the raw value (not stringified)
|
|
339
458
|
* Useful for non-string values like objects, arrays, booleans
|
|
459
|
+
*
|
|
460
|
+
* @param template - The template string
|
|
461
|
+
* @param context - The binding context
|
|
462
|
+
* @param componentId - Optional component ID for error tracking
|
|
340
463
|
*/
|
|
341
|
-
declare function resolveTemplateValue(template: string, context: BindingContext): any;
|
|
464
|
+
declare function resolveTemplateValue(template: string, context: BindingContext, componentId?: string): any;
|
|
342
465
|
/**
|
|
343
466
|
* Recursively resolve all template bindings in an object or array
|
|
344
467
|
*
|
|
@@ -434,8 +557,11 @@ declare function clearAllCaches(config?: CacheConfig): void;
|
|
|
434
557
|
declare function invalidateCache(id: string, version?: string, config?: CacheConfig): void;
|
|
435
558
|
|
|
436
559
|
/**
|
|
437
|
-
*
|
|
438
|
-
* Fetches
|
|
560
|
+
* View Registry Fetcher
|
|
561
|
+
* Fetches view data from the View Registry API with retry logic
|
|
562
|
+
*
|
|
563
|
+
* API Base: /api/views/registry
|
|
564
|
+
* Supports: versioning, bundling, batch fetch, dependency resolution
|
|
439
565
|
*/
|
|
440
566
|
|
|
441
567
|
/** Default retry configuration */
|
|
@@ -453,18 +579,47 @@ declare function getRegistryUrl(): string;
|
|
|
453
579
|
*/
|
|
454
580
|
declare function fetchComponent(id: string, options?: FetchOptions): Promise<FetchResult>;
|
|
455
581
|
/**
|
|
456
|
-
*
|
|
582
|
+
* Fetch component with all dependencies resolved
|
|
583
|
+
* Convenience wrapper that handles lazy loading
|
|
584
|
+
*/
|
|
585
|
+
declare function fetchComponentWithDependencies(id: string, options?: FetchOptions): Promise<FetchResult>;
|
|
586
|
+
/**
|
|
587
|
+
* Batch fetch multiple views in a single request
|
|
588
|
+
* Uses: POST /api/views/registry/batch
|
|
589
|
+
*/
|
|
590
|
+
declare function batchFetchComponents(components: Array<{
|
|
591
|
+
id: string;
|
|
592
|
+
version?: string;
|
|
593
|
+
}>, options?: Pick<FetchOptions, 'apiKey'>): Promise<Record<string, BundledComponent>>;
|
|
594
|
+
/**
|
|
595
|
+
* Prefetch views for faster loading
|
|
596
|
+
* Uses: POST /api/views/registry/prefetch for version resolution
|
|
457
597
|
*/
|
|
458
598
|
declare function prefetchComponents(ids: Array<{
|
|
459
599
|
id: string;
|
|
460
600
|
version?: string;
|
|
461
601
|
}>, options?: Omit<FetchOptions, 'version'>): Promise<void>;
|
|
462
602
|
/**
|
|
463
|
-
* Check if
|
|
603
|
+
* Check if view is available (in cache or online)
|
|
604
|
+
* Uses: GET /api/views/registry/:viewId/available?version=^1.0.0
|
|
464
605
|
*/
|
|
465
606
|
declare function isComponentAvailable(id: string, version?: string, options?: Pick<FetchOptions, 'apiKey' | 'cacheStrategy' | 'cacheConfig'>): Promise<{
|
|
466
607
|
available: boolean;
|
|
467
608
|
cached: boolean;
|
|
609
|
+
version?: string;
|
|
610
|
+
}>;
|
|
611
|
+
/**
|
|
612
|
+
* Get dependency tree for a view
|
|
613
|
+
* Uses: GET /api/views/registry/:viewId/dependencies?version=^1.0.0&depth=10
|
|
614
|
+
*/
|
|
615
|
+
declare function getDependencyTree(id: string, options?: {
|
|
616
|
+
version?: string;
|
|
617
|
+
depth?: number;
|
|
618
|
+
apiKey?: string;
|
|
619
|
+
}): Promise<{
|
|
620
|
+
tree: any;
|
|
621
|
+
totalDependencies: number;
|
|
622
|
+
maxDepthReached: number;
|
|
468
623
|
}>;
|
|
469
624
|
|
|
470
625
|
/**
|
|
@@ -579,4 +734,471 @@ declare function validateProps(props: Record<string, any>, definitions: PropDefi
|
|
|
579
734
|
*/
|
|
580
735
|
declare function generateTestCases(definitions: PropDefinition[]): TestCase[];
|
|
581
736
|
|
|
582
|
-
|
|
737
|
+
/**
|
|
738
|
+
* Component Registry
|
|
739
|
+
*
|
|
740
|
+
* Manages a collection of components for dependency resolution.
|
|
741
|
+
* Used by the renderer to resolve componentViewRef and blueprint references.
|
|
742
|
+
*/
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Create a component registry from bundled data
|
|
746
|
+
*/
|
|
747
|
+
declare function createRegistry(): ComponentRegistry;
|
|
748
|
+
/**
|
|
749
|
+
* Build a registry from component data with bundle
|
|
750
|
+
*/
|
|
751
|
+
declare function buildRegistryFromBundle(data: ComponentData): ComponentRegistry;
|
|
752
|
+
/**
|
|
753
|
+
* Extract dependencies from layout elements
|
|
754
|
+
* Scans for componentViewRef and blueprint references
|
|
755
|
+
*/
|
|
756
|
+
declare function extractDependencies(elements: LayoutElement[]): Array<{
|
|
757
|
+
id: string;
|
|
758
|
+
version?: string;
|
|
759
|
+
type: 'viewRef' | 'blueprint';
|
|
760
|
+
elementId: string;
|
|
761
|
+
}>;
|
|
762
|
+
/**
|
|
763
|
+
* Extract dependencies from event handler code
|
|
764
|
+
* Looks for renderDynamicList calls
|
|
765
|
+
*/
|
|
766
|
+
declare function extractDependenciesFromCode(code: string): Array<{
|
|
767
|
+
id: string;
|
|
768
|
+
type: 'blueprint';
|
|
769
|
+
}>;
|
|
770
|
+
/**
|
|
771
|
+
* Recursively collect all dependencies from a component
|
|
772
|
+
* Handles nested dependencies (A → B → C)
|
|
773
|
+
*/
|
|
774
|
+
declare function collectAllDependencies(rootId: string, rootVersion: string, fetchComponent: (id: string, version?: string) => Promise<ComponentData | undefined>, maxDepth?: number): Promise<DependencyManifest>;
|
|
775
|
+
/**
|
|
776
|
+
* Check for circular dependencies
|
|
777
|
+
*/
|
|
778
|
+
declare function detectCircularDependencies(manifest: DependencyManifest): string[] | null;
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Component Analytics Types
|
|
782
|
+
* Type definitions for analytics event collection and transmission
|
|
783
|
+
*/
|
|
784
|
+
/**
|
|
785
|
+
* Analytics configuration options
|
|
786
|
+
*/
|
|
787
|
+
interface AnalyticsConfig {
|
|
788
|
+
/** Enable/disable analytics collection */
|
|
789
|
+
enabled: boolean;
|
|
790
|
+
/** Analytics API endpoint */
|
|
791
|
+
endpoint: string;
|
|
792
|
+
/** API key for authentication */
|
|
793
|
+
apiKey?: string;
|
|
794
|
+
/** Application ID to include in all events */
|
|
795
|
+
appId?: string;
|
|
796
|
+
/** Batch size before auto-flush */
|
|
797
|
+
batchSize: number;
|
|
798
|
+
/** Flush interval in milliseconds */
|
|
799
|
+
flushInterval: number;
|
|
800
|
+
/** Sample rate (0-1) for high-volume events */
|
|
801
|
+
sampleRate: number;
|
|
802
|
+
/** Environment identifier */
|
|
803
|
+
environment: 'development' | 'staging' | 'production';
|
|
804
|
+
/** Enable debug logging */
|
|
805
|
+
debug: boolean;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Analytics event types
|
|
809
|
+
*/
|
|
810
|
+
type AnalyticsEventType = 'render' | 'fetch' | 'error';
|
|
811
|
+
/**
|
|
812
|
+
* Base analytics event
|
|
813
|
+
*/
|
|
814
|
+
interface AnalyticsEvent {
|
|
815
|
+
/** Event type */
|
|
816
|
+
type: AnalyticsEventType;
|
|
817
|
+
/** Component identifier */
|
|
818
|
+
componentId: string;
|
|
819
|
+
/** Component version */
|
|
820
|
+
version: string;
|
|
821
|
+
/** Unix timestamp in milliseconds */
|
|
822
|
+
timestamp: number;
|
|
823
|
+
/** Anonymous session ID */
|
|
824
|
+
sessionId?: string;
|
|
825
|
+
/** Application ID */
|
|
826
|
+
appId?: string;
|
|
827
|
+
/** Duration in milliseconds */
|
|
828
|
+
duration?: number;
|
|
829
|
+
/** Event-specific metadata */
|
|
830
|
+
metadata?: Record<string, unknown>;
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Metadata for render events
|
|
834
|
+
*/
|
|
835
|
+
interface RenderMetadata {
|
|
836
|
+
/** Number of DOM elements rendered */
|
|
837
|
+
elementCount?: number;
|
|
838
|
+
/** Whether component was served from cache */
|
|
839
|
+
fromCache?: boolean;
|
|
840
|
+
/** Memory heap change in KB (Chrome only) */
|
|
841
|
+
heapDeltaKB?: number;
|
|
842
|
+
/** Number of DOM nodes created */
|
|
843
|
+
domNodesCreated?: number;
|
|
844
|
+
/** Number of long tasks (>50ms) during render */
|
|
845
|
+
longTaskCount?: number;
|
|
846
|
+
/** Whether component has event handlers */
|
|
847
|
+
hasEventHandlers?: boolean;
|
|
848
|
+
/** Whether component has dependencies */
|
|
849
|
+
hasDependencies?: boolean;
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Metadata for fetch events
|
|
853
|
+
*/
|
|
854
|
+
interface FetchMetadata {
|
|
855
|
+
/** Whether fetch was a cache hit */
|
|
856
|
+
cacheHit: boolean;
|
|
857
|
+
/** Fetch duration in milliseconds */
|
|
858
|
+
fetchDuration: number;
|
|
859
|
+
/** Bundle size in bytes */
|
|
860
|
+
bundleSize?: number;
|
|
861
|
+
/** Number of dependencies */
|
|
862
|
+
dependencyCount?: number;
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Error types for error events
|
|
866
|
+
*/
|
|
867
|
+
type ErrorType = 'render' | 'fetch' | 'binding';
|
|
868
|
+
/**
|
|
869
|
+
* Metadata for error events
|
|
870
|
+
*/
|
|
871
|
+
interface ErrorMetadata {
|
|
872
|
+
/** Type of error */
|
|
873
|
+
errorType: ErrorType;
|
|
874
|
+
/** Error message (max 1000 chars) */
|
|
875
|
+
errorMessage: string;
|
|
876
|
+
/** Stack trace (truncated to 500 chars) */
|
|
877
|
+
stackTrace?: string;
|
|
878
|
+
/** Failed binding path (for binding errors) */
|
|
879
|
+
bindingPath?: string;
|
|
880
|
+
/** Element ID where error occurred */
|
|
881
|
+
elementId?: string;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Client info included in batch requests
|
|
885
|
+
*/
|
|
886
|
+
interface ClientInfo {
|
|
887
|
+
/** SDK version */
|
|
888
|
+
sdkVersion: string;
|
|
889
|
+
/** Environment */
|
|
890
|
+
environment: string;
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* Batch events request body
|
|
894
|
+
*/
|
|
895
|
+
interface BatchEventsRequest {
|
|
896
|
+
/** Array of analytics events */
|
|
897
|
+
events: AnalyticsEvent[];
|
|
898
|
+
/** Client information */
|
|
899
|
+
clientInfo: ClientInfo;
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* Batch events response
|
|
903
|
+
*/
|
|
904
|
+
interface BatchEventsResponse {
|
|
905
|
+
/** Whether request was successful */
|
|
906
|
+
success: boolean;
|
|
907
|
+
/** Number of events accepted */
|
|
908
|
+
accepted: number;
|
|
909
|
+
/** Number of events rejected */
|
|
910
|
+
rejected: number;
|
|
911
|
+
/** Error messages for rejected events */
|
|
912
|
+
errors?: string[];
|
|
913
|
+
/** Retry-After header value (for rate limiting) */
|
|
914
|
+
retryAfter?: number;
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Session information
|
|
918
|
+
*/
|
|
919
|
+
interface SessionInfo {
|
|
920
|
+
/** Session ID */
|
|
921
|
+
id: string;
|
|
922
|
+
/** Timestamp when session was created */
|
|
923
|
+
createdAt: number;
|
|
924
|
+
/** Timestamp of last activity */
|
|
925
|
+
lastActivityAt: number;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* Component Analytics
|
|
930
|
+
* Collects and transmits component usage, performance, and error metrics
|
|
931
|
+
*/
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Analytics Collector class
|
|
935
|
+
* Manages event collection, batching, and transmission
|
|
936
|
+
*/
|
|
937
|
+
declare class AnalyticsCollector {
|
|
938
|
+
private config;
|
|
939
|
+
private eventQueue;
|
|
940
|
+
private flushTimer;
|
|
941
|
+
private isEnabled;
|
|
942
|
+
private isFlushing;
|
|
943
|
+
private retryDelay;
|
|
944
|
+
constructor(config?: Partial<AnalyticsConfig>);
|
|
945
|
+
/**
|
|
946
|
+
* Configure analytics
|
|
947
|
+
*/
|
|
948
|
+
configure(config: Partial<AnalyticsConfig>): void;
|
|
949
|
+
/**
|
|
950
|
+
* Disable analytics collection
|
|
951
|
+
*/
|
|
952
|
+
disable(): void;
|
|
953
|
+
/**
|
|
954
|
+
* Enable analytics collection
|
|
955
|
+
*/
|
|
956
|
+
enable(): void;
|
|
957
|
+
/**
|
|
958
|
+
* Destroy and cleanup
|
|
959
|
+
*/
|
|
960
|
+
destroy(): void;
|
|
961
|
+
/**
|
|
962
|
+
* Track component render
|
|
963
|
+
*/
|
|
964
|
+
trackRender(componentId: string, version: string, duration: number, metadata?: RenderMetadata): void;
|
|
965
|
+
/**
|
|
966
|
+
* Track component fetch
|
|
967
|
+
*/
|
|
968
|
+
trackFetch(componentId: string, version: string, duration: number, fromCache: boolean, metadata?: Partial<FetchMetadata>): void;
|
|
969
|
+
/**
|
|
970
|
+
* Track error
|
|
971
|
+
*/
|
|
972
|
+
trackError(componentId: string, version: string, error: Error, context?: Partial<ErrorMetadata>): void;
|
|
973
|
+
/**
|
|
974
|
+
* Check if event should be tracked (sampling + enabled)
|
|
975
|
+
*/
|
|
976
|
+
private shouldTrack;
|
|
977
|
+
/**
|
|
978
|
+
* Add event to queue
|
|
979
|
+
*/
|
|
980
|
+
private queueEvent;
|
|
981
|
+
/**
|
|
982
|
+
* Get current queue size
|
|
983
|
+
*/
|
|
984
|
+
getQueueSize(): number;
|
|
985
|
+
/**
|
|
986
|
+
* Start the flush timer
|
|
987
|
+
*/
|
|
988
|
+
private startFlushTimer;
|
|
989
|
+
/**
|
|
990
|
+
* Stop the flush timer
|
|
991
|
+
*/
|
|
992
|
+
private stopFlushTimer;
|
|
993
|
+
/**
|
|
994
|
+
* Flush events to server
|
|
995
|
+
*/
|
|
996
|
+
flush(): Promise<void>;
|
|
997
|
+
/**
|
|
998
|
+
* Perform the actual flush
|
|
999
|
+
*/
|
|
1000
|
+
private doFlush;
|
|
1001
|
+
/**
|
|
1002
|
+
* Send events to the API
|
|
1003
|
+
*/
|
|
1004
|
+
private sendEvents;
|
|
1005
|
+
/**
|
|
1006
|
+
* Handle failed events (partial success)
|
|
1007
|
+
*/
|
|
1008
|
+
private handleFailedEvents;
|
|
1009
|
+
/**
|
|
1010
|
+
* Handle network error
|
|
1011
|
+
*/
|
|
1012
|
+
private handleNetworkError;
|
|
1013
|
+
/**
|
|
1014
|
+
* Schedule a retry flush
|
|
1015
|
+
*/
|
|
1016
|
+
private scheduleRetry;
|
|
1017
|
+
/**
|
|
1018
|
+
* Truncate string to max length
|
|
1019
|
+
*/
|
|
1020
|
+
private truncateString;
|
|
1021
|
+
/**
|
|
1022
|
+
* Log debug message
|
|
1023
|
+
*/
|
|
1024
|
+
private log;
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* Get the analytics collector singleton
|
|
1028
|
+
*/
|
|
1029
|
+
declare function getAnalytics(): AnalyticsCollector;
|
|
1030
|
+
/**
|
|
1031
|
+
* Configure analytics (convenience function)
|
|
1032
|
+
*/
|
|
1033
|
+
declare function configureAnalytics(config: Partial<AnalyticsConfig>): void;
|
|
1034
|
+
/**
|
|
1035
|
+
* Reset analytics (for testing)
|
|
1036
|
+
*/
|
|
1037
|
+
declare function resetAnalytics(): void;
|
|
1038
|
+
declare const analytics: {
|
|
1039
|
+
readonly instance: AnalyticsCollector;
|
|
1040
|
+
configure: typeof configureAnalytics;
|
|
1041
|
+
trackRender: (componentId: string, version: string, duration: number, metadata?: RenderMetadata) => void;
|
|
1042
|
+
trackFetch: (componentId: string, version: string, duration: number, fromCache: boolean, metadata?: Partial<FetchMetadata>) => void;
|
|
1043
|
+
trackError: (componentId: string, version: string, error: Error, context?: Partial<ErrorMetadata>) => void;
|
|
1044
|
+
flush: () => Promise<void>;
|
|
1045
|
+
disable: () => void;
|
|
1046
|
+
enable: () => void;
|
|
1047
|
+
};
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Session Manager
|
|
1051
|
+
* Manages anonymous session IDs for analytics tracking
|
|
1052
|
+
*/
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Session Manager class
|
|
1056
|
+
* Manages anonymous session IDs with automatic rotation
|
|
1057
|
+
*/
|
|
1058
|
+
declare class SessionManager {
|
|
1059
|
+
private session;
|
|
1060
|
+
constructor();
|
|
1061
|
+
/**
|
|
1062
|
+
* Initialize session manager
|
|
1063
|
+
*/
|
|
1064
|
+
private initialize;
|
|
1065
|
+
/**
|
|
1066
|
+
* Create a new session
|
|
1067
|
+
*/
|
|
1068
|
+
private createNewSession;
|
|
1069
|
+
/**
|
|
1070
|
+
* Get current session ID
|
|
1071
|
+
* Creates new session if expired
|
|
1072
|
+
*/
|
|
1073
|
+
getSessionId(): string;
|
|
1074
|
+
/**
|
|
1075
|
+
* Update last activity timestamp
|
|
1076
|
+
*/
|
|
1077
|
+
touch(): void;
|
|
1078
|
+
/**
|
|
1079
|
+
* Force create a new session
|
|
1080
|
+
*/
|
|
1081
|
+
rotate(): void;
|
|
1082
|
+
/**
|
|
1083
|
+
* Clear current session
|
|
1084
|
+
*/
|
|
1085
|
+
clear(): void;
|
|
1086
|
+
/**
|
|
1087
|
+
* Get session info (for debugging)
|
|
1088
|
+
*/
|
|
1089
|
+
getSessionInfo(): SessionInfo | null;
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Get the session manager singleton
|
|
1093
|
+
*/
|
|
1094
|
+
declare function getSessionManager(): SessionManager;
|
|
1095
|
+
/**
|
|
1096
|
+
* Reset the session manager (for testing)
|
|
1097
|
+
*/
|
|
1098
|
+
declare function resetSessionManager(): void;
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* Memory Sampler
|
|
1102
|
+
* Samples memory usage using Chrome's performance.memory API
|
|
1103
|
+
* Gracefully degrades on unsupported browsers
|
|
1104
|
+
*/
|
|
1105
|
+
/**
|
|
1106
|
+
* Memory sample data
|
|
1107
|
+
*/
|
|
1108
|
+
interface MemorySample {
|
|
1109
|
+
/** Used JS heap size in KB */
|
|
1110
|
+
heapUsedKB: number;
|
|
1111
|
+
/** Total JS heap size in KB */
|
|
1112
|
+
heapTotalKB: number;
|
|
1113
|
+
/** Timestamp when sample was taken */
|
|
1114
|
+
timestamp: number;
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Memory Sampler class
|
|
1118
|
+
* Provides memory sampling functionality for Chrome browsers
|
|
1119
|
+
*/
|
|
1120
|
+
declare class MemorySampler {
|
|
1121
|
+
private isSupported;
|
|
1122
|
+
constructor();
|
|
1123
|
+
/**
|
|
1124
|
+
* Check if memory API is available
|
|
1125
|
+
*/
|
|
1126
|
+
private checkSupport;
|
|
1127
|
+
/**
|
|
1128
|
+
* Check if memory sampling is available
|
|
1129
|
+
*/
|
|
1130
|
+
isAvailable(): boolean;
|
|
1131
|
+
/**
|
|
1132
|
+
* Take a memory sample
|
|
1133
|
+
* Returns null if memory API is not available
|
|
1134
|
+
*/
|
|
1135
|
+
sample(): MemorySample | null;
|
|
1136
|
+
/**
|
|
1137
|
+
* Calculate heap delta between two samples
|
|
1138
|
+
* Returns the difference in KB (positive = memory increased)
|
|
1139
|
+
*/
|
|
1140
|
+
calculateDelta(before: MemorySample | null, after: MemorySample | null): number | null;
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Get the memory sampler singleton
|
|
1144
|
+
*/
|
|
1145
|
+
declare function getMemorySampler(): MemorySampler;
|
|
1146
|
+
/**
|
|
1147
|
+
* Reset the memory sampler (for testing)
|
|
1148
|
+
*/
|
|
1149
|
+
declare function resetMemorySampler(): void;
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* Long Task Observer
|
|
1153
|
+
* Observes long tasks (>50ms) using PerformanceObserver API
|
|
1154
|
+
* Gracefully degrades on unsupported browsers
|
|
1155
|
+
*/
|
|
1156
|
+
/**
|
|
1157
|
+
* Long Task Observer class
|
|
1158
|
+
* Counts tasks that take longer than 50ms during a measurement period
|
|
1159
|
+
*/
|
|
1160
|
+
declare class LongTaskObserver {
|
|
1161
|
+
private observer;
|
|
1162
|
+
private longTaskCount;
|
|
1163
|
+
private isSupported;
|
|
1164
|
+
private isObserving;
|
|
1165
|
+
constructor();
|
|
1166
|
+
/**
|
|
1167
|
+
* Check if PerformanceObserver with longtask support is available
|
|
1168
|
+
*/
|
|
1169
|
+
private checkSupport;
|
|
1170
|
+
/**
|
|
1171
|
+
* Check if long task observation is available
|
|
1172
|
+
*/
|
|
1173
|
+
isAvailable(): boolean;
|
|
1174
|
+
/**
|
|
1175
|
+
* Start observing long tasks
|
|
1176
|
+
*/
|
|
1177
|
+
start(): void;
|
|
1178
|
+
/**
|
|
1179
|
+
* Stop observing and return the count of long tasks
|
|
1180
|
+
*/
|
|
1181
|
+
stop(): number;
|
|
1182
|
+
/**
|
|
1183
|
+
* Reset the long task counter
|
|
1184
|
+
*/
|
|
1185
|
+
reset(): void;
|
|
1186
|
+
/**
|
|
1187
|
+
* Get current count without stopping observation
|
|
1188
|
+
*/
|
|
1189
|
+
getCount(): number;
|
|
1190
|
+
/**
|
|
1191
|
+
* Check if currently observing
|
|
1192
|
+
*/
|
|
1193
|
+
isActive(): boolean;
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Get the long task observer singleton
|
|
1197
|
+
*/
|
|
1198
|
+
declare function getLongTaskObserver(): LongTaskObserver;
|
|
1199
|
+
/**
|
|
1200
|
+
* Reset the long task observer (for testing)
|
|
1201
|
+
*/
|
|
1202
|
+
declare function resetLongTaskObserver(): void;
|
|
1203
|
+
|
|
1204
|
+
export { AnalyticsCollector, type AnalyticsConfig, type AnalyticsEvent, type AnalyticsEventType, type Assertion$1 as Assertion, type AssertionResult$1 as AssertionResult, type BatchEventsRequest, type BatchEventsResponse, type BindingContext, type BundleStrategy, type BundledComponent, type CacheConfig, type CacheEntry, type CacheStrategy, type ClientInfo, type ComponentBundle, type ComponentData, type ComponentRegistry, DEFAULT_CACHE_CONFIG, DEFAULT_RETRY_CONFIG, type DependencyEntry, type DependencyManifest, type DependencyType, type ElementConfig, type ErrorMetadata, type ErrorType, type FetchMetadata, type FetchOptions, type FetchResult, type LayoutElement, LongTaskObserver, MemorySampler, type ParsedVersion, type PropDefinition, type RenderMetadata, type RenderOptions, type RenderResult, type RetryConfig, type SessionInfo, SessionManager, type AssertionResult as TestAssertionResult, type TestCase$1 as TestCase, type TestCase as TestCaseInput, type TestCaseResult, type TestResult, type TestSummary as TestRunSummary, type TestSummary$1 as TestSummary, analytics, applyStyles, batchFetchComponents, buildClassName, buildElementStyles, buildRegistryFromBundle, bumpVersion, camelToKebab, clearAllCaches, clearLocalStorageCache, clearMemoryCache, clearStyles, collectAllDependencies, compareVersions, configureAnalytics, createRegistry, detectCircularDependencies, extractBindingKeys, extractDependencies, extractDependenciesFromCode, fetchComponent, fetchComponentWithDependencies, formatStyleValue, formatVersion, generateTestCases, getAnalytics, getCacheKey, getDependencyTree, getFromCache, getLongTaskObserver, getMemoryCacheSize, getMemorySampler, getRegistryUrl, getSessionManager, hasTemplateSyntax, invalidateCache, isComponentAvailable, isValidSpecifier, parseVersion, prefetchComponents, processStyles, render, renderDynamicList, resetAnalytics, resetLongTaskObserver, resetMemorySampler, resetSessionManager, resolveBindingPath, resolveTemplate, resolveTemplateValue, resolveTemplatesDeep, resolveVersion, runAllTests, runTestCase, satisfiesVersion, setInCache, setRegistryUrl, updateStyles, validateAssertion, validateProps };
|