@medyll/idae-machine 0.108.0 → 0.109.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- export * from './machine.js';
2
1
  export * from './types/appschemeTypes.js';
2
+ export * from './main/machine.js';
3
+ export * from './main/machine.spec.js';
3
4
  export { default as Skeleton } from './fragments/Skeleton.svelte';
4
5
  export { default as Selector } from './fragments/Selector.svelte';
5
6
  export { default as List } from './fragments/List.svelte';
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // auto exports of entry components
2
- export * from './machine.js';
3
2
  export * from './types/appschemeTypes.js';
3
+ export * from './main/machine.js';
4
+ export * from './main/machine.spec.js';
4
5
  export { default as Skeleton } from './fragments/Skeleton.svelte';
5
6
  export { default as Selector } from './fragments/Selector.svelte';
6
7
  export { default as List } from './fragments/List.svelte';
@@ -0,0 +1,78 @@
1
+ import { IDbCollections } from '../db/dbFields.js';
2
+ import { createIdbqDb, type IdbqModel } from '@medyll/idae-idbql';
3
+ /**
4
+ * Machine: main entry point for managing the IDBQL connection and centralized data access.
5
+ */
6
+ export declare class Machine {
7
+ /**
8
+
9
+ * IDBQL (readonly collections instance)
10
+ */
11
+ _idbql: ReturnType<ReturnType<typeof createIdbqDb>["create"]>["idbql"] | undefined;
12
+ /**
13
+ * IDBQL (stateful collections instance)
14
+ */
15
+ _idbqlState: ReturnType<ReturnType<typeof createIdbqDb>["create"]>["idbqlState"] | undefined;
16
+ /**
17
+ * Direct access to IndexedDB (core)
18
+ */
19
+ _idbDatabase: ReturnType<ReturnType<typeof createIdbqDb>["create"]>["idbDatabase"] | undefined;
20
+ /**
21
+ * IDBQL data model
22
+ */
23
+ _idbqModel: ReturnType<ReturnType<typeof createIdbqDb>["create"]>["idbqModel"] | undefined;
24
+ /**
25
+ * Centralized access to schema and collection logic
26
+ */
27
+ _collections: IDbCollections | undefined;
28
+ /**
29
+ * Database name
30
+ */
31
+ _dbName: string;
32
+ /**
33
+ * Schema version
34
+ */
35
+ _version: number;
36
+ /**
37
+ * Data model
38
+ */
39
+ _model: IdbqModel;
40
+ /**
41
+ * Main constructor
42
+ * @param dbName Database name (default: 'idae-machine')
43
+ * @param version Schema version (default: 1)
44
+ * @param model Data model (default: schemeModel)
45
+ */
46
+ constructor(dbName?: string, version?: number, model?: IdbqModel);
47
+ /**
48
+ * Start the machine: initialize collections and IDBQL connection.
49
+ * @param options Optional overrides: { dbName, version, model }
50
+ */
51
+ start(options?: {
52
+ dbName?: string;
53
+ version?: number;
54
+ model?: IdbqModel;
55
+ }): void;
56
+ private createCollections;
57
+ private createStore;
58
+ /**
59
+ * Get the IDbCollections (schema logic) instance
60
+ */
61
+ get collections(): IDbCollections | undefined;
62
+ /**
63
+ * IDBQL (readonly) instance
64
+ */
65
+ get idbql(): import("@medyll/idae-idbql").ReadonlyCollections<IdbqModel<Record<string, Record<string, any>>>> | undefined;
66
+ /**
67
+ * IDBQL (stateful) instance
68
+ */
69
+ get idbqlState(): import("@medyll/idae-idbql").StateCollections<IdbqModel<Record<string, Record<string, any>>>> | undefined;
70
+ /**
71
+ * IndexedDB (core) instance
72
+ */
73
+ get indexedb(): import("@medyll/idae-idbql").IdbqlIndexedCore<IdbqModel<Record<string, Record<string, any>>>> | undefined;
74
+ /**
75
+ * IDBQL data model instance
76
+ */
77
+ get idbqModel(): IdbqModel<Record<string, Record<string, any>>> | undefined;
78
+ }
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Example usage:
3
+ *
4
+ * import { Machine } from './machine.js';
5
+ *
6
+ * // Create a new Machine instance with default parameters
7
+ * const machine = new Machine( 'example-db', 1, { collections: {} });
8
+ *
9
+ * // Start the machine (initialize collections and IDBQL connection)
10
+ * machine.start();
11
+ *
12
+ * // Access collections (schema logic)
13
+ * const collections = machine.collections;
14
+ *
15
+ * // Access IDBQL (readonly)
16
+ * const idbql = machine.idbql;
17
+ *
18
+ * // Access IDBQL (stateful)
19
+ * const idbqlState = machine.idbqlState;
20
+ *
21
+ * // Access IndexedDB core
22
+ * const db = machine.indexedb;
23
+ *
24
+ * // Access the IDBQL data model
25
+ * const model = machine.idbqModel;
26
+ */
27
+ import { schemeModel } from '../db/dbSchema.js';
28
+ import { IDbCollections } from '../db/dbFields.js';
29
+ import { createIdbqDb } from '@medyll/idae-idbql';
30
+ /**
31
+ * Machine: main entry point for managing the IDBQL connection and centralized data access.
32
+ */
33
+ export class Machine {
34
+ /**
35
+
36
+ * IDBQL (readonly collections instance)
37
+ */
38
+ _idbql;
39
+ /**
40
+ * IDBQL (stateful collections instance)
41
+ */
42
+ _idbqlState;
43
+ /**
44
+ * Direct access to IndexedDB (core)
45
+ */
46
+ _idbDatabase;
47
+ /**
48
+ * IDBQL data model
49
+ */
50
+ _idbqModel;
51
+ /**
52
+ * Centralized access to schema and collection logic
53
+ */
54
+ _collections;
55
+ /**
56
+ * Database name
57
+ */
58
+ _dbName;
59
+ /**
60
+ * Schema version
61
+ */
62
+ _version;
63
+ /**
64
+ * Data model
65
+ */
66
+ _model;
67
+ /**
68
+ * Main constructor
69
+ * @param dbName Database name (default: 'idae-machine')
70
+ * @param version Schema version (default: 1)
71
+ * @param model Data model (default: schemeModel)
72
+ */
73
+ constructor(dbName = 'idae-machine', version = 1, model = schemeModel) {
74
+ this._dbName = dbName;
75
+ this._version = version;
76
+ this._model = model;
77
+ }
78
+ /**
79
+ * Start the machine: initialize collections and IDBQL connection.
80
+ * @param options Optional overrides: { dbName, version, model }
81
+ */
82
+ start(options) {
83
+ this._dbName = options?.dbName ?? this._dbName;
84
+ this._version = options?.version ?? this._version;
85
+ this._model = options?.model ?? this._model;
86
+ this.createCollections();
87
+ this.createStore();
88
+ }
89
+ createCollections() {
90
+ if (!this._model) {
91
+ throw new Error('Data model is not defined');
92
+ }
93
+ this._collections = new IDbCollections(this._model);
94
+ }
95
+ createStore() {
96
+ if (!this._model || !this._dbName || !this._version) {
97
+ throw new Error('Model, dbName, or version is not defined');
98
+ }
99
+ const idbqStore = createIdbqDb(this._model, this._version);
100
+ const { idbql, idbqlState, idbDatabase, idbqModel } = idbqStore.create(this._dbName);
101
+ this._idbql = idbql;
102
+ this._idbqlState = idbqlState;
103
+ this._idbDatabase = idbDatabase;
104
+ this._idbqModel = idbqModel;
105
+ }
106
+ /**
107
+ * Get the IDbCollections (schema logic) instance
108
+ */
109
+ get collections() {
110
+ return this._collections;
111
+ }
112
+ /**
113
+ * IDBQL (readonly) instance
114
+ */
115
+ get idbql() {
116
+ return this._idbql;
117
+ }
118
+ /**
119
+ * IDBQL (stateful) instance
120
+ */
121
+ get idbqlState() {
122
+ return this._idbqlState;
123
+ }
124
+ /**
125
+ * IndexedDB (core) instance
126
+ */
127
+ get indexedb() {
128
+ return this._idbDatabase;
129
+ }
130
+ /**
131
+ * IDBQL data model instance
132
+ */
133
+ get idbqModel() {
134
+ return this._idbqModel;
135
+ }
136
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medyll/idae-machine",
3
- "version": "0.108.0",
3
+ "version": "0.109.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
package/dist/machine.d.ts DELETED
@@ -1,76 +0,0 @@
1
- import { IDbCollections } from './db/dbFields.js';
2
- import { createIdbqDb } from '@medyll/idae-idbql';
3
- /**
4
- * Machine: main entry point for managing the IDBQL connection and centralized data access.
5
- */
6
- export declare class Machine {
7
- /**
8
-
9
- * IDBQL (readonly collections instance)
10
- */
11
- idbql: ReturnType<ReturnType<typeof createIdbqDb>["create"]>["idbql"] | undefined;
12
- /**
13
- * IDBQL (stateful collections instance)
14
- */
15
- idbqlState: ReturnType<ReturnType<typeof createIdbqDb>["create"]>["idbqlState"] | undefined;
16
- /**
17
- * Direct access to IndexedDB (core)
18
- */
19
- idbDatabase: ReturnType<ReturnType<typeof createIdbqDb>["create"]>["idbDatabase"] | undefined;
20
- /**
21
- * IDBQL data model
22
- */
23
- idbqModel: ReturnType<ReturnType<typeof createIdbqDb>["create"]>["idbqModel"] | undefined;
24
- /**
25
- * Centralized access to schema and collection logic
26
- */
27
- collections: IDbCollections | undefined;
28
- /**
29
- * Database name
30
- */
31
- dbName: string;
32
- /**
33
- * Schema version
34
- */
35
- version: number;
36
- /**
37
- * Data model
38
- */
39
- model: any;
40
- /**
41
- * Main constructor
42
- * @param dbName Database name (default: 'idae-machine')
43
- * @param version Schema version (default: 1)
44
- * @param model Data model (default: schemeModel)
45
- */
46
- constructor(dbName?: string, version?: number, model?: import("@medyll/idae-idbql").IdbqModel<Record<string, Record<string, any>>>);
47
- /**
48
- * Start the machine: initialize collections and IDBQL connection.
49
- * @param options Optional overrides: { dbName, version, model }
50
- */
51
- start(options?: {
52
- dbName?: string;
53
- version?: number;
54
- model?: any;
55
- }): void;
56
- /**
57
- * Get the IDbCollections (schema logic) instance
58
- */
59
- getCollections(): IDbCollections | undefined;
60
- /**
61
- * Get the IDBQL (readonly) instance
62
- */
63
- getIdbql(): import("@medyll/idae-idbql").ReadonlyCollections<import("@medyll/idae-idbql").IdbqModel<Record<string, Record<string, any>>>> | undefined;
64
- /**
65
- * Get the IDBQL (stateful) instance
66
- */
67
- getIdbqlState(): import("@medyll/idae-idbql").StateCollections<import("@medyll/idae-idbql").IdbqModel<Record<string, Record<string, any>>>> | undefined;
68
- /**
69
- * Get the IndexedDB (core) instance
70
- */
71
- getIdbDatabase(): import("@medyll/idae-idbql").IdbqlIndexedCore<import("@medyll/idae-idbql").IdbqModel<Record<string, Record<string, any>>>> | undefined;
72
- /**
73
- * Get the IDBQL data model instance
74
- */
75
- getIdbqModel(): import("@medyll/idae-idbql").IdbqModel<Record<string, Record<string, any>>> | undefined;
76
- }
package/dist/machine.js DELETED
@@ -1,129 +0,0 @@
1
- /**
2
- * Example usage:
3
- *
4
- * import { Machine } from './machine.js';
5
- *
6
- * // Create a new Machine instance with default parameters
7
- * const machine = new Machine();
8
- *
9
- * // Start the machine (initialize collections and IDBQL connection)
10
- * machine.start();
11
- *
12
- * // Access collections (schema logic)
13
- * const collections = machine.getCollections();
14
- *
15
- * // Access IDBQL (readonly)
16
- * const idbql = machine.getIdbql();
17
- *
18
- * // Access IDBQL (stateful)
19
- * const idbqlState = machine.getIdbqlState();
20
- *
21
- * // Access IndexedDB core
22
- * const db = machine.getIdbDatabase();
23
- *
24
- * // Access the IDBQL data model
25
- * const model = machine.getIdbqModel();
26
- */
27
- import { schemeModel } from './db/dbSchema.js';
28
- import { IDbCollections } from './db/dbFields.js';
29
- import { createIdbqDb } from '@medyll/idae-idbql';
30
- /**
31
- * Machine: main entry point for managing the IDBQL connection and centralized data access.
32
- */
33
- export class Machine {
34
- /**
35
-
36
- * IDBQL (readonly collections instance)
37
- */
38
- idbql;
39
- /**
40
- * IDBQL (stateful collections instance)
41
- */
42
- idbqlState;
43
- /**
44
- * Direct access to IndexedDB (core)
45
- */
46
- idbDatabase;
47
- /**
48
- * IDBQL data model
49
- */
50
- idbqModel;
51
- /**
52
- * Centralized access to schema and collection logic
53
- */
54
- collections;
55
- /**
56
- * Database name
57
- */
58
- dbName;
59
- /**
60
- * Schema version
61
- */
62
- version;
63
- /**
64
- * Data model
65
- */
66
- model;
67
- /**
68
- * Main constructor
69
- * @param dbName Database name (default: 'idae-machine')
70
- * @param version Schema version (default: 1)
71
- * @param model Data model (default: schemeModel)
72
- */
73
- constructor(dbName = 'idae-machine', version = 1, model = schemeModel) {
74
- this.dbName = dbName;
75
- this.version = version;
76
- this.model = model;
77
- this.collections = undefined;
78
- this.idbql = undefined;
79
- this.idbqlState = undefined;
80
- this.idbDatabase = undefined;
81
- this.idbqModel = undefined;
82
- }
83
- /**
84
- * Start the machine: initialize collections and IDBQL connection.
85
- * @param options Optional overrides: { dbName, version, model }
86
- */
87
- start(options) {
88
- const dbName = options?.dbName ?? this.dbName;
89
- const version = options?.version ?? this.version;
90
- const model = options?.model ?? this.model;
91
- this.collections = new IDbCollections(model);
92
- const idbqStore = createIdbqDb(model, version);
93
- const { idbql, idbqlState, idbDatabase, idbqModel } = idbqStore.create(dbName);
94
- this.idbql = idbql;
95
- this.idbqlState = idbqlState;
96
- this.idbDatabase = idbDatabase;
97
- this.idbqModel = idbqModel;
98
- }
99
- /**
100
- * Get the IDbCollections (schema logic) instance
101
- */
102
- getCollections() {
103
- return this.collections;
104
- }
105
- /**
106
- * Get the IDBQL (readonly) instance
107
- */
108
- getIdbql() {
109
- return this.idbql;
110
- }
111
- /**
112
- * Get the IDBQL (stateful) instance
113
- */
114
- getIdbqlState() {
115
- return this.idbqlState;
116
- }
117
- /**
118
- * Get the IndexedDB (core) instance
119
- */
120
- getIdbDatabase() {
121
- return this.idbDatabase;
122
- }
123
- /**
124
- * Get the IDBQL data model instance
125
- */
126
- getIdbqModel() {
127
- return this.idbqModel;
128
- }
129
- }