@medyll/idae-machine 0.136.4 → 0.136.6
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/config.d.ts
CHANGED
|
@@ -14,4 +14,4 @@ export declare const API_URL: string;
|
|
|
14
14
|
* Available organizations/tenants. Centralized here to avoid hardcoding in multiple places.
|
|
15
15
|
* This list should be kept in sync with the actual available organizations in the system.
|
|
16
16
|
*/
|
|
17
|
-
export declare const ORGS: readonly ["
|
|
17
|
+
export declare const ORGS: readonly ["demo", "crfr", "idaenext", "tactac", "latent"];
|
package/dist/config.js
CHANGED
|
@@ -16,4 +16,4 @@ export const API_URL = import.meta.env.PUBLIC_API_URL ??
|
|
|
16
16
|
* Available organizations/tenants. Centralized here to avoid hardcoding in multiple places.
|
|
17
17
|
* This list should be kept in sync with the actual available organizations in the system.
|
|
18
18
|
*/
|
|
19
|
-
export const ORGS = ['
|
|
19
|
+
export const ORGS = ['demo', 'crfr', 'idaenext', 'tactac', 'latent'];
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* groupFieldBy → HOW to group them (looked up in appscheme_field, grouped on its FK)
|
|
10
10
|
*/
|
|
11
11
|
export declare function useViewFields(collection: () => string | undefined, view: () => string | undefined, groupFieldBy?: () => string | undefined): {
|
|
12
|
-
readonly fieldNames:
|
|
12
|
+
readonly fieldNames: string[];
|
|
13
13
|
readonly fieldKinds: Record<string, {
|
|
14
14
|
kind: "scalar" | "fk";
|
|
15
15
|
fieldName: string;
|
|
@@ -314,30 +314,35 @@ undefined client-side. publishModel writes both the flags and the equivalent
|
|
|
314
314
|
<space-main>
|
|
315
315
|
<space-header>
|
|
316
316
|
{#if schemeInfo?.icon}<Icon icon={schemeInfo.icon} class="space-header-icon" />{/if}
|
|
317
|
-
<
|
|
318
|
-
{schemeInfo?.
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
<
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
317
|
+
<space-header-content>
|
|
318
|
+
<h2 style={schemeInfo?.color ? `color: ${schemeInfo.color};` : undefined}>
|
|
319
|
+
Gestion {schemeInfo?.name ?? collection}
|
|
320
|
+
</h2>
|
|
321
|
+
{#if collectionId != null}<span class="space-record">{collectionId}</span>{/if}
|
|
322
|
+
<group-action>
|
|
323
|
+
{#if canCreate}
|
|
324
|
+
<button type="button" class="btn-primary" onclick={openCreate}>
|
|
325
|
+
Créer {schemeInfo?.name ?? collection}
|
|
326
|
+
</button>
|
|
327
|
+
{/if}
|
|
328
|
+
<DataCount {collection} label="Total" />
|
|
329
|
+
</group-action>
|
|
330
|
+
|
|
331
|
+
{#if recentHistory.length}
|
|
332
|
+
<space-header-recent>
|
|
333
|
+
{#each recentHistory as entry (entry.id)}
|
|
334
|
+
<button type="button" class="space-recent-item" onclick={() => openRecord(entry.collection_value)}>
|
|
335
|
+
{entry.label ?? entry.collection_value}
|
|
336
|
+
</button>
|
|
337
|
+
{/each}
|
|
338
|
+
</space-header-recent>
|
|
339
|
+
{/if}
|
|
340
|
+
</space-header-content>
|
|
327
341
|
</space-header>
|
|
328
342
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
<button type="button" class="space-recent-item" onclick={() => openRecord(entry.collection_value)}>
|
|
333
|
-
{entry.label ?? entry.collection_value}
|
|
334
|
-
</button>
|
|
335
|
-
{/each}
|
|
336
|
-
</space-header-recent>
|
|
337
|
-
{/if}
|
|
338
|
-
|
|
339
|
-
{#if classificationPanels.some((p) => p.options.length)}
|
|
340
|
-
<space-classifications>
|
|
343
|
+
<space-overview>
|
|
344
|
+
{#if classificationPanels.some((p) => p.options.length)}
|
|
345
|
+
<space-classifications>
|
|
341
346
|
{#each classificationPanels as panel (panel.fkName)}
|
|
342
347
|
{#if panel.options.length}
|
|
343
348
|
<Tile title={panel.fkName}>
|
|
@@ -352,11 +357,11 @@ undefined client-side. publishModel writes both the flags and the equivalent
|
|
|
352
357
|
</Tile>
|
|
353
358
|
{/if}
|
|
354
359
|
{/each}
|
|
355
|
-
|
|
356
|
-
|
|
360
|
+
</space-classifications>
|
|
361
|
+
{/if}
|
|
357
362
|
|
|
358
|
-
|
|
359
|
-
|
|
363
|
+
{#if forwardFkPanels.length}
|
|
364
|
+
<space-repartitions>
|
|
360
365
|
{#each forwardFkPanels as panel (panel.fkName)}
|
|
361
366
|
<Tile
|
|
362
367
|
title={panel.meta?.name ?? panel.targetCollection}
|
|
@@ -372,30 +377,11 @@ undefined client-side. publishModel writes both the flags and the equivalent
|
|
|
372
377
|
{/if}
|
|
373
378
|
</Tile>
|
|
374
379
|
{/each}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
{#if seeAlsoGroups.length}
|
|
379
|
-
<space-see-also>
|
|
380
|
-
<Tile title="Voir aussi">
|
|
381
|
-
{#each seeAlsoGroups as group (group.key)}
|
|
382
|
-
<space-see-also-group>
|
|
383
|
-
<h4>{group.label}</h4>
|
|
384
|
-
{#each group.items as item (item.collection)}
|
|
385
|
-
<button type="button" class="space-see-also-item" onclick={() => openSpace(item.collection)}>
|
|
386
|
-
{#if item.icon}<Icon icon={item.icon} />{/if}
|
|
387
|
-
{item.name}
|
|
388
|
-
<DataCount collection={item.collection} />
|
|
389
|
-
</button>
|
|
390
|
-
{/each}
|
|
391
|
-
</space-see-also-group>
|
|
392
|
-
{/each}
|
|
393
|
-
</Tile>
|
|
394
|
-
</space-see-also>
|
|
395
|
-
{/if}
|
|
380
|
+
</space-repartitions>
|
|
381
|
+
{/if}
|
|
396
382
|
|
|
397
|
-
|
|
398
|
-
|
|
383
|
+
{#if dateFieldsStatic.length}
|
|
384
|
+
<space-periods>
|
|
399
385
|
<Tile title="Périodes">
|
|
400
386
|
{#snippet header()}
|
|
401
387
|
<select class="form-select" bind:value={periodField}>
|
|
@@ -408,19 +394,43 @@ undefined client-side. publishModel writes both the flags and the equivalent
|
|
|
408
394
|
<InfoLine label={period.label} value={period.count} />
|
|
409
395
|
{/each}
|
|
410
396
|
</Tile>
|
|
411
|
-
|
|
412
|
-
|
|
397
|
+
</space-periods>
|
|
398
|
+
{/if}
|
|
399
|
+
</space-overview>
|
|
400
|
+
|
|
401
|
+
<!-- app_explorer_home: central list with reverse relations alongside it. -->
|
|
402
|
+
<space-workspace>
|
|
403
|
+
<space-list>
|
|
404
|
+
<DataList
|
|
405
|
+
{collection}
|
|
406
|
+
where={listWhere}
|
|
407
|
+
{prefsScope}
|
|
408
|
+
sortBy={logicScheme?.defaultSort}
|
|
409
|
+
link="loadInDialog:fiche"
|
|
410
|
+
pageSize={30}
|
|
411
|
+
/>
|
|
412
|
+
</space-list>
|
|
413
|
+
|
|
414
|
+
{#if seeAlsoGroups.length}
|
|
415
|
+
<space-related>
|
|
416
|
+
<Tile title="Voir aussi">
|
|
417
|
+
{#each seeAlsoGroups as group (group.key)}
|
|
418
|
+
<space-see-also-group>
|
|
419
|
+
<h4>{group.label}</h4>
|
|
420
|
+
{#each group.items as item (item.collection)}
|
|
421
|
+
<button type="button" class="space-see-also-item" onclick={() => openSpace(item.collection)}>
|
|
422
|
+
{#if item.icon}<Icon icon={item.icon} />{/if}
|
|
423
|
+
{item.name}
|
|
424
|
+
<DataCount collection={item.collection} />
|
|
425
|
+
</button>
|
|
426
|
+
{/each}
|
|
427
|
+
</space-see-also-group>
|
|
428
|
+
{/each}
|
|
429
|
+
</Tile>
|
|
430
|
+
</space-related>
|
|
431
|
+
{/if}
|
|
432
|
+
</space-workspace>
|
|
413
433
|
|
|
414
|
-
<space-list>
|
|
415
|
-
<DataList
|
|
416
|
-
{collection}
|
|
417
|
-
where={listWhere}
|
|
418
|
-
{prefsScope}
|
|
419
|
-
sortBy={logicScheme?.defaultSort}
|
|
420
|
-
link="loadInDialog:fiche"
|
|
421
|
-
pageSize={30}
|
|
422
|
-
/>
|
|
423
|
-
</space-list>
|
|
424
434
|
</space-main>
|
|
425
435
|
|
|
426
436
|
<space-search>
|
|
@@ -441,28 +451,49 @@ undefined client-side. publishModel writes both the flags and the equivalent
|
|
|
441
451
|
@layer components {
|
|
442
452
|
space-component {
|
|
443
453
|
display: grid;
|
|
444
|
-
grid-template-columns:
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
454
|
+
grid-template-columns:
|
|
455
|
+
clamp(calc(var(--gutter-3xl) * 3), 16vw, calc(var(--gutter-3xl) * 4))
|
|
456
|
+
minmax(0, 1fr);
|
|
457
|
+
grid-template-areas: 'search main';
|
|
458
|
+
min-block-size: 100%;
|
|
459
|
+
overflow: hidden;
|
|
449
460
|
}
|
|
450
461
|
space-main {
|
|
451
462
|
display: flex;
|
|
463
|
+
grid-area: main;
|
|
452
464
|
flex-direction: column;
|
|
453
|
-
gap: var(--gutter-sm);
|
|
454
465
|
min-width: 0;
|
|
466
|
+
min-block-size: 0;
|
|
455
467
|
}
|
|
456
468
|
space-header {
|
|
469
|
+
display: grid;
|
|
470
|
+
grid-template-columns: var(--gutter-3xl) minmax(0, 1fr);
|
|
471
|
+
grid-template-areas: 'icon content';
|
|
472
|
+
min-block-size: calc(var(--gutter-3xl) + var(--gutter-2xl));
|
|
473
|
+
}
|
|
474
|
+
space-header :global(.space-header-icon) {
|
|
475
|
+
grid-area: icon;
|
|
476
|
+
align-self: center;
|
|
477
|
+
justify-self: center;
|
|
478
|
+
}
|
|
479
|
+
space-header-content {
|
|
457
480
|
display: flex;
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
481
|
+
grid-area: content;
|
|
482
|
+
flex-direction: column;
|
|
483
|
+
align-items: flex-start;
|
|
484
|
+
gap: var(--gutter-xs);
|
|
485
|
+
padding: var(--pad-xs);
|
|
486
|
+
min-width: 0;
|
|
461
487
|
}
|
|
462
|
-
space-header h2 {
|
|
488
|
+
space-header-content h2 {
|
|
463
489
|
margin: 0;
|
|
464
490
|
text-transform: capitalize;
|
|
465
491
|
}
|
|
492
|
+
group-action {
|
|
493
|
+
display: flex;
|
|
494
|
+
align-items: center;
|
|
495
|
+
gap: var(--gutter-sm);
|
|
496
|
+
}
|
|
466
497
|
.space-record {
|
|
467
498
|
color: var(--color-text-muted);
|
|
468
499
|
font-size: var(--text-sm);
|
|
@@ -491,6 +522,11 @@ undefined client-side. publishModel writes both the flags and the equivalent
|
|
|
491
522
|
grid-template-columns: repeat(auto-fit, minmax(calc(var(--gutter-3xl) * 4), 1fr));
|
|
492
523
|
gap: var(--gutter-sm);
|
|
493
524
|
}
|
|
525
|
+
space-overview {
|
|
526
|
+
display: flex;
|
|
527
|
+
flex-direction: column;
|
|
528
|
+
gap: var(--gutter-sm);
|
|
529
|
+
}
|
|
494
530
|
.space-fk-count {
|
|
495
531
|
font-weight: var(--font-semibold);
|
|
496
532
|
}
|
|
@@ -501,8 +537,21 @@ undefined client-side. publishModel writes both the flags and the equivalent
|
|
|
501
537
|
color: var(--color-critical);
|
|
502
538
|
font-size: var(--text-sm);
|
|
503
539
|
}
|
|
504
|
-
space-
|
|
540
|
+
space-workspace {
|
|
541
|
+
display: grid;
|
|
542
|
+
grid-template-columns:
|
|
543
|
+
minmax(0, 1fr)
|
|
544
|
+
clamp(calc(var(--gutter-3xl) * 3), 16vw, calc(var(--gutter-3xl) * 4));
|
|
545
|
+
gap: var(--gutter-sm);
|
|
546
|
+
flex: 1;
|
|
547
|
+
min-block-size: 0;
|
|
548
|
+
}
|
|
549
|
+
space-list:only-child {
|
|
550
|
+
grid-column: 1 / -1;
|
|
551
|
+
}
|
|
552
|
+
space-related {
|
|
505
553
|
display: block;
|
|
554
|
+
overflow: auto;
|
|
506
555
|
}
|
|
507
556
|
space-see-also-group {
|
|
508
557
|
display: flex;
|
|
@@ -533,17 +582,19 @@ undefined client-side. publishModel writes both the flags and the equivalent
|
|
|
533
582
|
space-list {
|
|
534
583
|
display: block;
|
|
535
584
|
min-block-size: 0;
|
|
585
|
+
overflow: auto;
|
|
536
586
|
}
|
|
537
587
|
space-search {
|
|
538
588
|
display: flex;
|
|
589
|
+
grid-area: search;
|
|
539
590
|
flex-direction: column;
|
|
540
591
|
gap: var(--gutter-sm);
|
|
541
592
|
position: sticky;
|
|
542
593
|
top: 0;
|
|
543
594
|
padding: var(--pad-sm);
|
|
544
|
-
border: var(--border-width) solid var(--color-border);
|
|
545
|
-
border-radius: var(--radius-xs);
|
|
595
|
+
border-inline-end: var(--border-width) solid var(--color-border);
|
|
546
596
|
background: var(--color-surface-alt);
|
|
597
|
+
overflow: auto;
|
|
547
598
|
}
|
|
548
599
|
space-search-fk-filters {
|
|
549
600
|
display: flex;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"bin": {
|
|
5
5
|
"idae-machine": "./cli.cjs"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.136.
|
|
7
|
+
"version": "0.136.6",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
10
|
"!dist/**/*.test.*",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"vite": "^8.2.0",
|
|
63
63
|
"vitest": "^4.1.10",
|
|
64
64
|
"@medyll/idae-eslint-config": "0.1.6",
|
|
65
|
-
"@medyll/idae-shared": "1.0.5",
|
|
66
65
|
"@medyll/idae-router": "0.1.1",
|
|
67
66
|
"@medyll/idae-socket": "0.0.5",
|
|
68
|
-
"@medyll/
|
|
67
|
+
"@medyll/idae-shared": "1.0.5",
|
|
68
|
+
"@medyll/qoolie": "0.0.4"
|
|
69
69
|
},
|
|
70
70
|
"scope": "medyll",
|
|
71
71
|
"keywords": [
|
|
@@ -82,10 +82,10 @@
|
|
|
82
82
|
"@medyll/css-base": "^0.7.10",
|
|
83
83
|
"command": "^1.1.1",
|
|
84
84
|
"commander": "^15.0.0",
|
|
85
|
+
"@medyll/idae-api": "0.187.3",
|
|
85
86
|
"@medyll/idae-be": "1.96.3",
|
|
86
87
|
"@medyll/idae-idbql": "0.185.3",
|
|
87
|
-
"@medyll/qoolie": "0.0.
|
|
88
|
-
"@medyll/idae-api": "0.187.3"
|
|
88
|
+
"@medyll/qoolie": "0.0.4"
|
|
89
89
|
},
|
|
90
90
|
"scripts": {
|
|
91
91
|
"dev": "vite dev --host",
|
package/dist/main/machine.d.ts
DELETED
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import { MachineDb } from './machineDb.js';
|
|
2
|
-
import { createQoolie, type SyncConfig, type SyncErrorContext, type ResultSet } from '@medyll/qoolie';
|
|
3
|
-
import { useQoolieQuery } from '@medyll/qoolie/svelte';
|
|
4
|
-
import type { EventDataClientInstance } from '@medyll/idae-socket';
|
|
5
|
-
import { be as _be } from '@medyll/idae-be';
|
|
6
|
-
import { MachineRouter, type MachineRouterConfig } from './machine/MachineRouter.js';
|
|
7
|
-
import { type SchemaDiagnosticReport } from './machineSchemaDoctor.js';
|
|
8
|
-
import { type ComponentRegistry } from './router/componentRegistry.js';
|
|
9
|
-
import type { IdaeMenuManager } from '../idae/menu/IdaeMenuManager.js';
|
|
10
|
-
import type { MachineModel } from '../types/index.js';
|
|
11
|
-
type SyncEvent = {
|
|
12
|
-
type: string;
|
|
13
|
-
collection?: string;
|
|
14
|
-
entryId?: string;
|
|
15
|
-
reason?: unknown;
|
|
16
|
-
};
|
|
17
|
-
export type MachineBootPhase = 'boot' | 'schema' | 'model' | 'storage' | 'frames' | 'seed' | 'ui';
|
|
18
|
-
export type MachineBootStatus = 'start' | 'done' | 'error';
|
|
19
|
-
export interface MachineBootTraceEntry {
|
|
20
|
-
phase: MachineBootPhase;
|
|
21
|
-
status: MachineBootStatus;
|
|
22
|
-
at: string;
|
|
23
|
-
detail?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface MachineStoreDiagnostic {
|
|
26
|
-
collection: string;
|
|
27
|
-
calls: number;
|
|
28
|
-
}
|
|
29
|
-
export type MachineComponentRegistry = Readonly<Pick<ComponentRegistry, 'register' | 'registerMany' | 'unregister' | 'resolve' | 'has' | 'keys'>>;
|
|
30
|
-
/**
|
|
31
|
-
* @class Machine
|
|
32
|
-
* @role Main entry point for managing the IDBQL connection and centralized data access.
|
|
33
|
-
*/
|
|
34
|
-
export declare class Machine {
|
|
35
|
-
/**
|
|
36
|
-
* Static registry of named Machine instances
|
|
37
|
-
*/
|
|
38
|
-
static instanceRegistry: Record<string, Machine>;
|
|
39
|
-
/**
|
|
40
|
-
* Instance name (optional)
|
|
41
|
-
*/
|
|
42
|
-
instanceName?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Qoolie instance — data layer (IndexedDB + optional sync)
|
|
45
|
-
*/
|
|
46
|
-
_qoolie: ReturnType<typeof createQoolie> | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Centralized access to schema and collection logic
|
|
49
|
-
*/
|
|
50
|
-
_machineDb: MachineDb;
|
|
51
|
-
/**
|
|
52
|
-
* Database name (IDB). Derived from org+domain if not explicit.
|
|
53
|
-
*/
|
|
54
|
-
_dbName: string;
|
|
55
|
-
/**
|
|
56
|
-
* Schema version
|
|
57
|
-
*/
|
|
58
|
-
_version: number;
|
|
59
|
-
/** System/framework collections (appscheme, appuser_*, …). Usually omitted — schema is fetched during boot(). */
|
|
60
|
-
_core?: MachineModel;
|
|
61
|
-
/** Application business collections (vehicle, reservation, …). */
|
|
62
|
-
_business?: MachineModel;
|
|
63
|
-
/**
|
|
64
|
-
* Effective model = system collections + business model. Built once at boot().
|
|
65
|
-
*/
|
|
66
|
-
_effectiveModel: MachineModel;
|
|
67
|
-
/** Organisation identifier — prefixes all DB names. e.g. 'test', 'crfr' */
|
|
68
|
-
_org?: string;
|
|
69
|
-
/** Domain/site name. e.g. 'machine', 'sitebase' */
|
|
70
|
-
_domain?: string;
|
|
71
|
-
/**
|
|
72
|
-
* Schema router instance (lazy-initialized)
|
|
73
|
-
*/
|
|
74
|
-
_router?: MachineRouter;
|
|
75
|
-
/** Global sync config forwarded to createQoolie(). false = sync disabled. */
|
|
76
|
-
_syncOptions?: SyncConfig | false;
|
|
77
|
-
/** Reactive state engine: 'svelte5' (default) | 'stator' */
|
|
78
|
-
_stateEngine?: 'svelte5' | 'stator';
|
|
79
|
-
/** Qoolie lifecycle hooks */
|
|
80
|
-
_hooks?: {
|
|
81
|
-
onSyncEvent?: (event: SyncEvent) => void;
|
|
82
|
-
onError?: (error: Error, context: SyncErrorContext) => void;
|
|
83
|
-
};
|
|
84
|
-
/** Seed data for mobile-first mode — auto-called with onlyIfEmpty on boot if mode === 'mobile-first' */
|
|
85
|
-
_seed?: Record<string, unknown[]>;
|
|
86
|
-
/** Frame manager — handles dynamic frame registration and content loading */
|
|
87
|
-
private readonly _frameManager;
|
|
88
|
-
/** Menu manager — created during boot to avoid module-level machine dependency. */
|
|
89
|
-
private _menuManager?;
|
|
90
|
-
/** Cleanup fn returned by setupContextMenuListener — called in destroy(). */
|
|
91
|
-
private _contextMenuCleanup?;
|
|
92
|
-
/** Last boot trace — intentionally plain data so recovery screens can render it after failure. */
|
|
93
|
-
private _bootTrace;
|
|
94
|
-
/** Last pure schema inspection, refreshed whenever the effective model changes. */
|
|
95
|
-
private _schemaDiagnostics;
|
|
96
|
-
/** Development signal for spotting repeated store subscriptions per collection. */
|
|
97
|
-
private _storeAccessCounts;
|
|
98
|
-
/**
|
|
99
|
-
* Promise that resolves when boot() has completed.
|
|
100
|
-
* Use `await machine.ready` after createInstance() to ensure the machine is fully initialized.
|
|
101
|
-
*/
|
|
102
|
-
ready: Promise<void>;
|
|
103
|
-
/**
|
|
104
|
-
* Main constructor
|
|
105
|
-
* @role Constructor
|
|
106
|
-
* @param {string=} dbName The name of the database.
|
|
107
|
-
* @param {number=} version The schema version number.
|
|
108
|
-
* @param {MachineModel=} business The business data model.
|
|
109
|
-
*/
|
|
110
|
-
constructor(dbName?: string, version?: number, business?: MachineModel);
|
|
111
|
-
/**
|
|
112
|
-
* Initialize the machine with configuration parameters.
|
|
113
|
-
* dbName is derived from org+domain when both are provided and no explicit dbName is given.
|
|
114
|
-
* @role Initializer
|
|
115
|
-
*/
|
|
116
|
-
init(options?: {
|
|
117
|
-
dbName?: string;
|
|
118
|
-
version?: number;
|
|
119
|
-
/** System/framework collections. Usually omitted — schema is fetched from the server during boot(). */
|
|
120
|
-
core?: MachineModel;
|
|
121
|
-
/** Application business collections (vehicle, reservation, …). */
|
|
122
|
-
business?: MachineModel;
|
|
123
|
-
org?: string;
|
|
124
|
-
domain?: string;
|
|
125
|
-
sync?: SyncConfig | false;
|
|
126
|
-
stateEngine?: 'svelte5' | 'stator';
|
|
127
|
-
hooks?: {
|
|
128
|
-
onSyncEvent?: (event: SyncEvent) => void;
|
|
129
|
-
onError?: (error: Error, context: SyncErrorContext) => void;
|
|
130
|
-
};
|
|
131
|
-
/** Seed data for mobile-first mode. When sync.mode === 'mobile-first', boot() auto-calls seed(seed, { onlyIfEmpty: true }). */
|
|
132
|
-
seed?: Record<string, unknown[]>;
|
|
133
|
-
}): void;
|
|
134
|
-
/** Fully qualified DB name for a given base: {org}_{base} */
|
|
135
|
-
moduleDbName(base: string): string;
|
|
136
|
-
private markBoot;
|
|
137
|
-
get bootTrace(): readonly MachineBootTraceEntry[];
|
|
138
|
-
get schemaDiagnostics(): SchemaDiagnosticReport;
|
|
139
|
-
get storeDiagnostics(): readonly MachineStoreDiagnostic[];
|
|
140
|
-
/** Pending IDB upgrade scheduled by drift detection — consumed by next createStore(). */
|
|
141
|
-
private _pendingIdbUpgrade;
|
|
142
|
-
private createStore;
|
|
143
|
-
private _scheduleDrift;
|
|
144
|
-
/**
|
|
145
|
-
* Shared model-rebuild sequence for both the initial boot path and the onDrift
|
|
146
|
-
* schema-reload path. Keeps the two callers in sync without duplication.
|
|
147
|
-
*
|
|
148
|
-
* replaceExisting=false → initial boot: read actual IDB version first (never downgrade).
|
|
149
|
-
* replaceExisting=true → schema drift reload: skip version check (already managed).
|
|
150
|
-
*/
|
|
151
|
-
private _applyModel;
|
|
152
|
-
/**
|
|
153
|
-
* @framework-bootstrap — called automatically during boot().
|
|
154
|
-
* Not for application code. Detects IDB drift and upgrades stores immediately.
|
|
155
|
-
*/
|
|
156
|
-
upgradeIdb(): Promise<void>;
|
|
157
|
-
/**
|
|
158
|
-
* Atomic boot — single async entry point for the app shell.
|
|
159
|
-
*
|
|
160
|
-
* Resolves the schema (server or local), builds MachineDb, adapts IDB drift,
|
|
161
|
-
* creates the qoolie store. Returns only once `machine.logic` + `machine.store`
|
|
162
|
-
* are ready. UI must `await machine.boot(...)` before mounting machine-aware
|
|
163
|
-
* components — no partial render, no reactivity races.
|
|
164
|
-
*
|
|
165
|
-
* Data hydration (IDB ← server) is owned by qoolie's sync layer, not by boot.
|
|
166
|
-
*
|
|
167
|
-
* @param options - Same shape as init(); typically { org, domain, version, sync }.
|
|
168
|
-
* @throws If sync is enabled but schema is unavailable (no cache, no network, no local model).
|
|
169
|
-
*/
|
|
170
|
-
boot(options?: Parameters<Machine['init']>[0]): Promise<void>;
|
|
171
|
-
/**
|
|
172
|
-
* Get the IDbBase (schema logic) instance.
|
|
173
|
-
* Recommended accessor for schema and collection logic.
|
|
174
|
-
* @role Accessor
|
|
175
|
-
* @return {MachineDb} The schema and collection logic instance.
|
|
176
|
-
*/
|
|
177
|
-
get logic(): MachineDb;
|
|
178
|
-
/**
|
|
179
|
-
* Reactive collection reader — returns live-updating { records } via Svelte 5 runes.
|
|
180
|
-
* `records` is a ResultSet<T> (array + .sortBy/.groupBy/.getPage/.distinct/…).
|
|
181
|
-
* Usage: const { records } = machine.store('users');
|
|
182
|
-
* const { records } = machine.store('users', { status: 'active' });
|
|
183
|
-
*
|
|
184
|
-
* Must be called from within a Svelte component or .svelte.ts context.
|
|
185
|
-
* For imperative CRUD use machine.collection(name) instead.
|
|
186
|
-
*/
|
|
187
|
-
store<T = any>(name: string, query?: Parameters<typeof useQoolieQuery>[2]): {
|
|
188
|
-
records: ResultSet<T>;
|
|
189
|
-
};
|
|
190
|
-
/**
|
|
191
|
-
* Direct collection accessor — returns the QoolieCollection for CRUD ops, with
|
|
192
|
-
* create/update/updateWhere wrapped to denormalize FK target snapshots into
|
|
193
|
-
* `record.fks.<field>` before persisting (single write choke-point — see
|
|
194
|
-
* MachineFkFold). Every other method forwards untouched.
|
|
195
|
-
* Usage: await machine.collection('users').create(data)
|
|
196
|
-
* await machine.collection('users').get(id)
|
|
197
|
-
* Note: machine.logic.collection(name) returns the MachineScheme (schema layer).
|
|
198
|
-
*/
|
|
199
|
-
collection(name: string): any;
|
|
200
|
-
/** Access rights manager — checkAccess, setCurrentUser, setPolicies, etc. */
|
|
201
|
-
get rights(): import("./machine/MachineRights.js").MachineRights;
|
|
202
|
-
/**
|
|
203
|
-
* Generic write dispatcher — `machine.action(collection, vars, opts?)`.
|
|
204
|
-
* One imperative entry point for every user-scoped write (prefs, history, activity, …).
|
|
205
|
-
* Auto-injects `userId` + `id`. Use opts for upsert / bump / touch / code-template behavior.
|
|
206
|
-
*/
|
|
207
|
-
get action(): import("./machine/MachineAction.js").MachineActionCallable;
|
|
208
|
-
/**
|
|
209
|
-
* Sync controller — pause/resume/status/flush/dlq.
|
|
210
|
-
* Only available when sync is enabled in init() options.
|
|
211
|
-
*/
|
|
212
|
-
get sync(): any;
|
|
213
|
-
/**
|
|
214
|
-
* Socket client — EventDataClientInstance from idae-socket, owned by qoolie's
|
|
215
|
-
* push listener (single connection). Available when `sync.push.protocol === 'socketio'`
|
|
216
|
-
* and the listener has connected. Configure via `init({ sync: { push: { protocol: 'socketio', ... } } })`.
|
|
217
|
-
*/
|
|
218
|
-
get socket(): EventDataClientInstance | undefined;
|
|
219
|
-
/**
|
|
220
|
-
* Release all Qoolie resources (stops sync adapter, clears collections).
|
|
221
|
-
* Call when the Machine instance is no longer needed.
|
|
222
|
-
*/
|
|
223
|
-
destroy(): void;
|
|
224
|
-
/** Pre-fetch collections into IDB before UI renders. Derives list from model when not provided. */
|
|
225
|
-
warmup(collections?: string[]): Promise<void>;
|
|
226
|
-
resetClientData(): Promise<void>;
|
|
227
|
-
/**
|
|
228
|
-
* Get or create the MachineRouter instance (lazy).
|
|
229
|
-
* @role Accessor
|
|
230
|
-
* @return {MachineRouter} The machine router instance.
|
|
231
|
-
*/
|
|
232
|
-
get router(): MachineRouter;
|
|
233
|
-
initRouter(config: MachineRouterConfig): MachineRouter;
|
|
234
|
-
private _buildRouter;
|
|
235
|
-
/** Compute a record label from `template.presentation`. Used by nav history writes and dialog titles. @internal */
|
|
236
|
-
_renderLabel(collection: string, collectionId: string | number): Promise<string | undefined>;
|
|
237
|
-
/** Access to the frame manager singleton. */
|
|
238
|
-
get framer(): import("./frame/MachineFrameManager.js").MachineFrameManager;
|
|
239
|
-
/**
|
|
240
|
-
* Access to the menu manager. Created lazily. Snapshot reader wired on first
|
|
241
|
-
* access so `getTree`/`getFlatItems`/`isVisible` read live appuser_prefs/
|
|
242
|
-
* appscheme/appscheme_type via machine.store (reactive read layer) instead of
|
|
243
|
-
* staying empty forever. Component-level reactivity belongs in
|
|
244
|
-
* useMenuTree.svelte.ts, not here — this getter only guarantees the manager
|
|
245
|
-
* is never wired to stale/empty data.
|
|
246
|
-
*/
|
|
247
|
-
get menu(): IdaeMenuManager;
|
|
248
|
-
/** Access to the component registry singleton. */
|
|
249
|
-
get componentRegistry(): Readonly<Pick<ComponentRegistry, "keys" | "register" | "registerMany" | "unregister" | "resolve" | "has">>;
|
|
250
|
-
/** DOM manipulation utility — wraps @medyll/idae-be. Usage: machine.be('#el').addClass('active') */
|
|
251
|
-
get be(): typeof _be;
|
|
252
|
-
/**
|
|
253
|
-
* Create and register a new Machine instance.
|
|
254
|
-
* Registers the instance in the static registry for later retrieval.
|
|
255
|
-
* @role Factory method
|
|
256
|
-
* @param {string} [instanceName] Optional name to register the instance under.
|
|
257
|
-
* @param {string} [dbName] Database name for the new instance.
|
|
258
|
-
* @param {number} [version] Schema version for the new instance.
|
|
259
|
-
* @param {MachineModel} [business] Business data model for the new instance.
|
|
260
|
-
* @returns {Machine} The newly created and started Machine instance.
|
|
261
|
-
*/
|
|
262
|
-
createInstance(instanceName?: string, dbName?: string, version?: number, business?: MachineModel): Machine;
|
|
263
|
-
/**
|
|
264
|
-
* Get a Machine instance by name from the registry.
|
|
265
|
-
* @role Accessor
|
|
266
|
-
* @param {string} instanceName The name of the instance.
|
|
267
|
-
* @return {Machine | undefined} The Machine instance, or undefined if not found.
|
|
268
|
-
*/
|
|
269
|
-
static instance(instanceName: string): Machine | undefined;
|
|
270
|
-
}
|
|
271
|
-
export { buildLoadInUrl } from './frame/frameUrl.js';
|
|
272
|
-
export declare const machine: Machine;
|