@medyll/idae-machine 0.127.0 → 0.129.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.
@@ -1,9 +1,4 @@
1
- import type { DbCharacterLink, DBAgent, DbAgentOf, DbAgentPrompt, DbBook, DbBookPrompts, DbCategory, DbChapter, DbCharacter, DbCharacterChapterStatus, DbChat, DbTags, DbWritingGoal, PromptType, DbSpaces } from '$types/db';
2
- import type { DBMessage } from '$types/db';
3
- import type { SettingsType } from '$types/settings.js';
4
- import type { UserType } from '$types/user';
5
- import { type IdbqModel } from '@medyll/idae-idbql';
6
- import type { DbDataModelTs } from './dataModel.js';
1
+ import type { DBAgent, DbAgentOf, DbAgentPrompt, DbCategory, DbChat, DbTags, PromptType, DBMessage, UserType } from '../demo/types.js';
7
2
  export declare const schemeModelDb: {
8
3
  agent: {
9
4
  keyPath: string;
@@ -109,22 +104,6 @@ export declare const schemeModelDb: {
109
104
  fks: {};
110
105
  };
111
106
  };
112
- space: {
113
- keyPath: string;
114
- model: DbSpaces;
115
- ts: DbSpaces;
116
- template: {
117
- index: string;
118
- presentation: string;
119
- fields: {
120
- id: "id";
121
- code: "text";
122
- name: "text";
123
- ia_lock: "boolean (private)";
124
- };
125
- fks: {};
126
- };
127
- };
128
107
  tags: {
129
108
  keyPath: string;
130
109
  model: DbTags;
@@ -219,238 +198,4 @@ export declare const schemeModelDb: {
219
198
  fks: {};
220
199
  };
221
200
  };
222
- book: {
223
- keyPath: string;
224
- model: DbBook;
225
- ts: DbBook;
226
- template: {
227
- index: string;
228
- presentation: string;
229
- fields: {
230
- id: "id (readonly)";
231
- userId: "id";
232
- title: "text-long (required)";
233
- description: "text-area";
234
- created_at: "date (readonly)";
235
- updated_at: "date";
236
- status: "text";
237
- ia_lock: "boolean (private)";
238
- };
239
- fks: {
240
- user: {
241
- code: string;
242
- multiple: false;
243
- rules: "readonly";
244
- };
245
- };
246
- };
247
- };
248
- chapter: {
249
- keyPath: string;
250
- model: DbChapter;
251
- ts: DbChapter;
252
- template: {
253
- index: string;
254
- presentation: string;
255
- fields: {
256
- id: "id (readonly)";
257
- bookId: "id";
258
- title: "text-long (required)";
259
- content: "text-area";
260
- order: "number";
261
- created_at: "date (readonly)";
262
- updated_at: "date";
263
- ia_lock: "boolean (private readonly)";
264
- };
265
- fks: {
266
- book: {
267
- code: string;
268
- multiple: false;
269
- rules: "readonly";
270
- };
271
- };
272
- };
273
- };
274
- writingGoal: {
275
- keyPath: string;
276
- model: DbWritingGoal;
277
- ts: DbWritingGoal;
278
- template: {
279
- index: string;
280
- presentation: string;
281
- fields: {
282
- id: "id (readonly)";
283
- userId: "id";
284
- bookId: "id";
285
- description: "text (required)";
286
- targetWordCount: "number";
287
- deadline: "date";
288
- created_at: "date (readonly)";
289
- updated_at: "date";
290
- ia_lock: "boolean (private)";
291
- };
292
- fks: {
293
- user: {
294
- code: string;
295
- multiple: false;
296
- rules: "readonly";
297
- };
298
- book: {
299
- code: string;
300
- multiple: false;
301
- rules: "readonly";
302
- };
303
- };
304
- };
305
- };
306
- character: {
307
- keyPath: string;
308
- model: DbCharacter;
309
- ts: DbCharacter;
310
- template: {
311
- index: string;
312
- presentation: string;
313
- fields: {
314
- id: "id (readonly)";
315
- bookId: "id";
316
- characterLinkIds: "array-of-fk-characterLink.id (private)";
317
- characterAttributesIds: "array-of-fk-characterAttributes.id (private)";
318
- firstName: "text (required)";
319
- lastName: "text";
320
- nickname: "text";
321
- age: "number";
322
- gender: "text";
323
- occupation: "text";
324
- role: "text";
325
- description: "text-area";
326
- backstory: "text-area";
327
- physicalDescription: "text-area";
328
- personalityTraits: "array-of-text";
329
- goals: "text-area";
330
- conflicts: "text-area";
331
- created_at: "date (readonly private)";
332
- updated_at: "date (readonly private)";
333
- ia_lock: "boolean (private)";
334
- };
335
- fks: {
336
- characterAttributes: {
337
- code: string;
338
- multiple: true;
339
- rules: "";
340
- };
341
- book: {
342
- code: string;
343
- multiple: false;
344
- rules: "readonly";
345
- };
346
- characterLink: {
347
- code: string;
348
- multiple: true;
349
- rules: "";
350
- };
351
- };
352
- };
353
- };
354
- characterAttributes: {
355
- keyPath: string;
356
- model: DbCharacter;
357
- ts: DbCharacter;
358
- template: {
359
- index: string;
360
- presentation: string;
361
- fields: {
362
- id: "id (readonly)";
363
- attribute: "text";
364
- name: "text";
365
- created_at: "date (readonly)";
366
- updated_at: "date";
367
- };
368
- fks: {};
369
- };
370
- };
371
- characterLink: {
372
- keyPath: string;
373
- model: DbCharacterLink;
374
- ts: DbCharacterLink;
375
- template: {
376
- index: string;
377
- presentation: string;
378
- fields: {
379
- id: "id";
380
- characterId: "array-of-fk-character.id";
381
- type: "text-short";
382
- description: "text-medium";
383
- active: "boolean";
384
- };
385
- fks: {
386
- character: {
387
- code: string;
388
- multiple: true;
389
- rules: "";
390
- };
391
- };
392
- };
393
- };
394
- characterChapterStatus: {
395
- keyPath: string;
396
- model: DbCharacterChapterStatus;
397
- ts: DbCharacterChapterStatus;
398
- template: {
399
- index: string;
400
- presentation: string;
401
- fields: {
402
- id: "id (readonly)";
403
- characterId: "id";
404
- chapterId: "id";
405
- status: "text";
406
- role: "text";
407
- actions: "text-long";
408
- development: "text-area";
409
- notes: "text-long";
410
- created_at: "date (readonly)";
411
- updated_at: "date";
412
- };
413
- fks: {
414
- character: {
415
- code: string;
416
- multiple: false;
417
- rules: "readonly";
418
- };
419
- chapter: {
420
- code: string;
421
- multiple: false;
422
- rules: "readonly";
423
- };
424
- };
425
- };
426
- };
427
- bookPrompts: {
428
- keyPath: string;
429
- model: DbBookPrompts;
430
- ts: DbBookPrompts;
431
- template: {
432
- index: string;
433
- presentation: string;
434
- fields: {
435
- id: "id (readonly)";
436
- bookId: "id";
437
- name: "text (required)";
438
- category: "text";
439
- content: "text-area";
440
- created_at: "date (readonly)";
441
- updated_at: "date";
442
- ia_lock: "boolean (private)";
443
- };
444
- fks: {
445
- book: {
446
- code: string;
447
- multiple: false;
448
- rules: "readonly";
449
- };
450
- };
451
- };
452
- };
453
201
  };
454
- export declare const schemeModel: IdbqModel;
455
- export type DataModelFinal = DbDataModelTs<typeof schemeModelDb>;
456
- export declare const idbql: import("@medyll/idae-idbql").ReadonlyCollections<IdbqModel<Record<string, Record<string, any>>>>, idbqlState: import("@medyll/idae-idbql").StateCollections<IdbqModel<Record<string, Record<string, any>>>>, idbDatabase: import("@medyll/idae-idbql").IdbqlIndexedCore<IdbqModel<Record<string, Record<string, any>>>>, idbqModel: IdbqModel<Record<string, Record<string, any>>>;
@@ -1,4 +1,4 @@
1
- import { createIdbqDb } from '@medyll/idae-idbql';
1
+ import {} from '@medyll/idae-idbql';
2
2
  /* here is an example of how to declare a dataModel*/
3
3
  export const schemeModelDb = {
4
4
  agent: {
@@ -105,22 +105,6 @@ export const schemeModelDb = {
105
105
  fks: {}
106
106
  }
107
107
  },
108
- space: {
109
- keyPath: '++id, code',
110
- model: {},
111
- ts: {},
112
- template: {
113
- index: 'id',
114
- presentation: 'name',
115
- fields: {
116
- id: 'id',
117
- code: 'text',
118
- name: 'text',
119
- ia_lock: 'boolean (private)'
120
- },
121
- fks: {}
122
- }
123
- },
124
108
  tags: {
125
109
  keyPath: '++id, code',
126
110
  model: {},
@@ -214,242 +198,8 @@ export const schemeModelDb = {
214
198
  },
215
199
  fks: {}
216
200
  }
217
- },
218
- // Nouvelles entités pour le Book Creator Helper
219
- book: {
220
- keyPath: '++id, userId, created_at',
221
- model: {},
222
- ts: {},
223
- template: {
224
- index: 'id',
225
- presentation: 'title',
226
- fields: {
227
- id: 'id (readonly)',
228
- userId: 'id',
229
- title: 'text-long (required)',
230
- description: 'text-area',
231
- created_at: 'date (readonly)',
232
- updated_at: 'date',
233
- status: 'text',
234
- ia_lock: 'boolean (private)'
235
- },
236
- fks: {
237
- user: {
238
- code: 'user',
239
- multiple: false,
240
- rules: 'readonly'
241
- }
242
- }
243
- }
244
- },
245
- chapter: {
246
- keyPath: '++id, bookId, order',
247
- model: {},
248
- ts: {},
249
- template: {
250
- index: 'id',
251
- presentation: 'title',
252
- fields: {
253
- id: 'id (readonly)',
254
- bookId: 'id',
255
- title: 'text-long (required)',
256
- content: 'text-area',
257
- order: 'number',
258
- created_at: 'date (readonly)',
259
- updated_at: 'date',
260
- ia_lock: 'boolean (private readonly)'
261
- },
262
- fks: {
263
- book: {
264
- code: 'book',
265
- multiple: false,
266
- rules: 'readonly'
267
- }
268
- }
269
- }
270
- },
271
- writingGoal: {
272
- keyPath: '++id, userId, bookId',
273
- model: {},
274
- ts: {},
275
- template: {
276
- index: 'id',
277
- presentation: 'description',
278
- fields: {
279
- id: 'id (readonly)',
280
- userId: 'id',
281
- bookId: 'id',
282
- description: 'text (required)',
283
- targetWordCount: 'number',
284
- deadline: 'date',
285
- created_at: 'date (readonly)',
286
- updated_at: 'date',
287
- ia_lock: 'boolean (private)'
288
- },
289
- fks: {
290
- user: {
291
- code: 'user',
292
- multiple: false,
293
- rules: 'readonly'
294
- },
295
- book: {
296
- code: 'book',
297
- multiple: false,
298
- rules: 'readonly'
299
- }
300
- }
301
- }
302
- },
303
- character: {
304
- keyPath: '++id, bookId',
305
- model: {},
306
- ts: {},
307
- template: {
308
- index: 'id',
309
- presentation: 'firstName lastName',
310
- fields: {
311
- id: 'id (readonly)',
312
- bookId: 'id',
313
- characterLinkIds: 'array-of-fk-characterLink.id (private)',
314
- characterAttributesIds: 'array-of-fk-characterAttributes.id (private)',
315
- firstName: 'text (required)',
316
- lastName: 'text',
317
- nickname: 'text',
318
- age: 'number',
319
- gender: 'text',
320
- occupation: 'text',
321
- role: 'text',
322
- description: 'text-area',
323
- backstory: 'text-area',
324
- physicalDescription: 'text-area',
325
- personalityTraits: 'array-of-text',
326
- goals: 'text-area',
327
- conflicts: 'text-area',
328
- created_at: 'date (readonly private)',
329
- updated_at: 'date (readonly private)',
330
- ia_lock: 'boolean (private)'
331
- },
332
- fks: {
333
- characterAttributes: {
334
- code: 'characterAttributes',
335
- multiple: true,
336
- rules: ''
337
- },
338
- book: {
339
- code: 'book',
340
- multiple: false,
341
- rules: 'readonly'
342
- },
343
- characterLink: {
344
- code: 'characterLink',
345
- multiple: true,
346
- rules: ''
347
- }
348
- }
349
- }
350
- },
351
- characterAttributes: {
352
- keyPath: '++id',
353
- model: {},
354
- ts: {},
355
- template: {
356
- index: 'id',
357
- presentation: 'name',
358
- fields: {
359
- id: 'id (readonly)',
360
- attribute: 'text',
361
- name: 'text',
362
- created_at: 'date (readonly)',
363
- updated_at: 'date'
364
- },
365
- fks: {}
366
- }
367
- },
368
- characterLink: {
369
- keyPath: '++id',
370
- model: {},
371
- ts: {},
372
- template: {
373
- index: 'id',
374
- presentation: 'type',
375
- fields: {
376
- id: 'id',
377
- characterId: 'array-of-fk-character.id',
378
- type: 'text-short',
379
- description: 'text-medium',
380
- active: 'boolean'
381
- },
382
- fks: {
383
- character: {
384
- code: 'character',
385
- multiple: true,
386
- rules: ''
387
- }
388
- }
389
- }
390
- },
391
- characterChapterStatus: {
392
- keyPath: '++id, characterId, chapterId',
393
- model: {},
394
- ts: {},
395
- template: {
396
- index: 'id',
397
- presentation: 'characterId chapterId status',
398
- fields: {
399
- id: 'id (readonly)',
400
- characterId: 'id',
401
- chapterId: 'id',
402
- status: 'text',
403
- role: 'text',
404
- actions: 'text-long',
405
- development: 'text-area',
406
- notes: 'text-long',
407
- created_at: 'date (readonly)',
408
- updated_at: 'date'
409
- },
410
- fks: {
411
- character: {
412
- code: 'character',
413
- multiple: false,
414
- rules: 'readonly'
415
- },
416
- chapter: {
417
- code: 'chapter',
418
- multiple: false,
419
- rules: 'readonly'
420
- }
421
- }
422
- }
423
- },
424
- bookPrompts: {
425
- keyPath: '++id, bookId',
426
- model: {},
427
- ts: {},
428
- template: {
429
- index: 'id',
430
- presentation: 'name',
431
- fields: {
432
- id: 'id (readonly)',
433
- bookId: 'id',
434
- name: 'text (required)',
435
- category: 'text',
436
- content: 'text-area',
437
- created_at: 'date (readonly)',
438
- updated_at: 'date',
439
- ia_lock: 'boolean (private)'
440
- },
441
- fks: {
442
- book: {
443
- code: 'book',
444
- multiple: false,
445
- rules: 'readonly'
446
- }
447
- }
448
- }
449
201
  }
450
202
  };
451
- export const schemeModel = {
452
- ...schemeModelDb
453
- };
454
- const idbqStore = createIdbqDb(schemeModel, 13);
455
- export const { idbql, idbqlState, idbDatabase, idbqModel } = idbqStore.create('idae-machine');
203
+ /* const idbqStore = createIdbqDb<typeof schemeModelDb>(schemeModelDb, 13);
204
+ export const { idbql,idbqlState , idbDatabase, idbqModel } = idbqStore.create('idae-machine');
205
+ */
@@ -1,6 +1,6 @@
1
- export type FieldTypeId = 'id' | 'text' | 'text-short' | 'text-medium' | 'text-long' | 'text-area' | 'number' | 'boolean' | 'date' | 'email' | 'password' | 'object-any' | `fk-${string}.id` | `array-of-${string}` | `object-of-${string}` | `array-of-fk-${string}.id`;
1
+ import type { TplTypes } from "@medyll/idae-idbql";
2
2
  export interface FieldTypeDef {
3
- id: FieldTypeId;
3
+ id: TplTypes;
4
4
  formatter: (value: any) => any;
5
5
  validator?: (value: any) => boolean;
6
6
  }
@@ -9,5 +9,5 @@ export declare function registerFieldType(def: FieldTypeDef): void;
9
9
  * Ajoute plusieurs types de champs d'un coup
10
10
  */
11
11
  export declare function registerFieldTypes(defs: FieldTypeDef[]): void;
12
- export declare function getFieldType(id: FieldTypeId): FieldTypeDef | undefined;
12
+ export declare function getFieldType(id: TplTypes): FieldTypeDef | undefined;
13
13
  export declare function getAllFieldTypes(): FieldTypeDef[];
@@ -5,11 +5,11 @@
5
5
 
6
6
  <script lang="ts" generics="COL = Record<string,any>">
7
7
 
8
- import { IDbFormValidate } from '../main/IDbFormValidate';
8
+ import { IDbFormValidate } from '../../main/IDbFormValidate';
9
9
  import type { CreateUpdateProps } from './types';
10
10
  import CollectionReverseFks from './CollectionReverseFks.svelte';
11
11
  import FieldInput from './FieldValue.svelte';
12
- import {machine} from '../main/machine.js';
12
+ import {machine} from '../../main/machine.js';
13
13
 
14
14
  let {
15
15
  collection,
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" generics="T = Record<string, any>">
2
2
  import { Button, openWindow, type Props } from '@medyll/idae-slotui-svelte';
3
- import { idbqlState } from '../db/dbSchema.js';
3
+ import { idbqlState } from '../../db/dbSchema.js';
4
4
  import CrudDataList from './CollectionListMenu.svelte';
5
5
 
6
6
  interface CrudZoneProps {
@@ -3,7 +3,7 @@
3
3
  // Importation des types et composants nécessaires
4
4
  import type { TplCollectionName } from '@medyll/idae-idbql';
5
5
  import { getContext } from 'svelte';
6
- import {machine} from '../main/machine.js';
6
+ import {machine} from '../../main/machine.js';
7
7
  interface FieldValueProps {
8
8
  collection: TplCollectionName;
9
9
  collectionId?: any;
@@ -1,56 +1,6 @@
1
- import type { DBAgent, DbAgentPrompt } from '$types/db';
2
1
  import { type IdbqModel } from '@medyll/idae-idbql';
3
2
  import type { DbDataModelTs } from '../db/dataModel.js';
4
- export declare const schemeModelTestDb: {
5
- agent: {
6
- keyPath: string;
7
- model: DBAgent;
8
- ts: DBAgent;
9
- template: {
10
- index: string;
11
- presentation: string;
12
- fields: {
13
- id: string;
14
- name: string;
15
- code: string;
16
- model: string;
17
- prompt: string;
18
- created_at: string;
19
- ia_lock: string;
20
- agentPromptId: string;
21
- tags: string;
22
- meta: string;
23
- relatedAgents: string;
24
- status: string;
25
- };
26
- fks: {
27
- agentPrompt: {
28
- code: string;
29
- rules: string;
30
- multiple: boolean;
31
- };
32
- };
33
- };
34
- };
35
- agentPrompt: {
36
- keyPath: string;
37
- model: DbAgentPrompt;
38
- ts: DbAgentPrompt;
39
- template: {
40
- index: string;
41
- presentation: string;
42
- fields: {
43
- id: string;
44
- created_at: string;
45
- value: string;
46
- name: string;
47
- code: string;
48
- ia_lock: string;
49
- };
50
- fks: {};
51
- };
52
- };
53
- };
3
+ export declare const schemeModelTestDb: DbDataModel;
54
4
  export declare const schemeModelTest: IdbqModel;
55
5
  export type DataModelTestFinal = DbDataModelTs<typeof schemeModelTestDb>;
56
6
  export declare const idbql: import("@medyll/idae-idbql").ReadonlyCollections<IdbqModel<Record<string, Record<string, any>>>>, idbqlState: import("@medyll/idae-idbql").StateCollections<IdbqModel<Record<string, Record<string, any>>>>, idbDatabase: import("@medyll/idae-idbql").IdbqlIndexedCore<IdbqModel<Record<string, Record<string, any>>>>, idbqModel: IdbqModel<Record<string, Record<string, any>>>;
@@ -0,0 +1,140 @@
1
+ import type { TplFieldType } from '@medyll/idae-idbql';
2
+ export type UserType = {
3
+ id: number;
4
+ name: string;
5
+ email: string;
6
+ gravatarEmail: string;
7
+ avatarImg: string;
8
+ color: string;
9
+ createdAt: string;
10
+ updated_at: string;
11
+ };
12
+ /**
13
+ * Represents a chat.
14
+ */
15
+ export type DbChat = {
16
+ id: number;
17
+ chatId: string;
18
+ chatPassKey: string;
19
+ categoryId: number;
20
+ title: string;
21
+ description: string;
22
+ models: string[];
23
+ created_at: Date;
24
+ category: string;
25
+ dateLastMessage: Date;
26
+ tags: DbTags[];
27
+ systemPrompt: PromptType;
28
+ context: number[];
29
+ bookId?: number;
30
+ };
31
+ export type DbCategory = {
32
+ id: number;
33
+ name: string;
34
+ code: string;
35
+ ia_lock: boolean;
36
+ };
37
+ export type DbTags = {
38
+ id: number;
39
+ name: string;
40
+ code: string;
41
+ ia_lock: boolean;
42
+ };
43
+ /**
44
+ * Represents a chat list type.
45
+ */
46
+ export interface ChatListType {
47
+ [key: string]: DbChat;
48
+ }
49
+ /**
50
+ * Represents a message.
51
+ */
52
+ export type DBMessage = {
53
+ id: number;
54
+ messageId?: string;
55
+ chatId: number;
56
+ content: string;
57
+ created_at: number;
58
+ images?: MessageImageType;
59
+ status: 'idle' | 'done' | 'sent' | 'streaming' | 'error';
60
+ context: number[];
61
+ resume: string;
62
+ model?: string;
63
+ ia_lock?: boolean;
64
+ urls?: {
65
+ url: string;
66
+ image?: string;
67
+ order: number;
68
+ title?: string;
69
+ }[];
70
+ } & ({
71
+ role: 'system';
72
+ } | {
73
+ role: 'user';
74
+ } | {
75
+ role: 'tool';
76
+ } | {
77
+ role: 'assistant';
78
+ model?: string;
79
+ });
80
+ export type DbPrimitive = 'date' | 'text' | 'number' | 'boolean' | 'array' | 'object' | `${string}.${string}`;
81
+ export type DbFieldTypes = DbPrimitive | `array-of-${DbPrimitive}` | `object-${DbPrimitive}` | `fk-${DbPrimitive}`;
82
+ export type DbTemplateModel<TPL> = {
83
+ [COL in keyof TPL]: {
84
+ fields: {
85
+ [T in keyof TPL[COL]]: TPL[COL][T];
86
+ };
87
+ };
88
+ };
89
+ export type DbTemplate<T> = {
90
+ fields: {
91
+ [K in keyof T]: TplFieldType;
92
+ };
93
+ };
94
+ export type DBAgent = {
95
+ id: number;
96
+ name: string;
97
+ code: string;
98
+ model: string;
99
+ prompt: string;
100
+ agentPromptId: number;
101
+ ia_lock: boolean;
102
+ created_at: Date;
103
+ specialization?: 'character development' | 'plot outline' | 'world building' | 'dialogue' | 'general';
104
+ };
105
+ export type DbAgentPrompt = {
106
+ id: number;
107
+ created_at: Date;
108
+ value: string;
109
+ name: string;
110
+ code: string;
111
+ ia_lock: boolean;
112
+ };
113
+ export type DbAgentOf = {
114
+ id: number;
115
+ created_at: Date;
116
+ value: string;
117
+ name: string;
118
+ code: string;
119
+ collection: string;
120
+ collectionId: number;
121
+ ia_lock: boolean;
122
+ };
123
+ export type DbMessageListType = {
124
+ [key: string]: DBMessage;
125
+ };
126
+ export type MessageImageType = {
127
+ name: string;
128
+ type: string;
129
+ dataUri: string;
130
+ header: string;
131
+ base64: string;
132
+ };
133
+ export type PromptType = {
134
+ id: string;
135
+ createdAt: Date;
136
+ value: string;
137
+ title: string;
138
+ code: string;
139
+ ia_lock: boolean;
140
+ };
@@ -1,2 +1 @@
1
1
  export {};
2
- //
package/dist/index.d.ts CHANGED
@@ -5,23 +5,18 @@ export { default as CollectionFks } from './ui/CollectionFks.svelte';
5
5
  export { default as CollectionFieldGuess } from './ui/CollectionFieldGuess.svelte';
6
6
  export { default as CollectionButton } from './ui/CollectionButton.svelte';
7
7
  export * from './types/appschemeTypes.js';
8
- export * from './main/machineForge.js';
9
- export * from './main/machineDb.js';
10
- export * from './main/machineDb.spec.js';
11
- export * from './main/machine.js';
12
- export * from './main/machine.spec.js';
13
8
  export { default as Skeleton } from './fragments/Skeleton.svelte';
14
9
  export { default as Selector } from './fragments/Selector.svelte';
15
10
  export { default as List } from './fragments/List.svelte';
16
11
  export { default as InfoLine } from './fragments/InfoLine.svelte';
17
12
  export { default as Frame } from './fragments/Frame.svelte';
18
13
  export { default as Confirm } from './fragments/Confirm.svelte';
19
- export * from './form/types.js';
20
- export { default as FieldValue } from './form/FieldValue.svelte';
21
- export { default as FieldInPlace } from './form/FieldInPlace.svelte';
22
- export { default as DataProvider } from './form/DataProvider.svelte';
23
- export { default as CrudZone } from './form/CrudZone.svelte';
24
- export { default as CreateUpdate } from './form/CreateUpdate.svelte';
14
+ export * from './main/machineForge.js';
15
+ export * from './main/machineDb.js';
16
+ export * from './main/machineDb.spec.js';
17
+ export * from './main/machine.js';
18
+ export * from './main/machine.spec.js';
19
+ export * from './demo/types.js';
25
20
  export * from './demo/testDbSchema.js';
26
21
  export * from './db/types.js';
27
22
  export * from './db/fieldTypes.js';
@@ -31,7 +26,6 @@ export * from './db/dbFormValidate.spec.js';
31
26
  export * from './db/dbCollectionValues.spec.js';
32
27
  export * from './db/dbCollectionFieldValues.spec.js';
33
28
  export * from './db/dbCollectionFieldForge.spec.js';
34
- export * from './db/dataModel.js';
35
29
  export * from './db/CrudService.js';
36
30
  export * from './main/machine/types.js';
37
31
  export * from './main/machine/IDbValidationError.js';
@@ -41,3 +35,9 @@ export * from './main/machine/IDbCollectionValues.js';
41
35
  export * from './main/machine/IDbCollectionFieldValues.js';
42
36
  export * from './main/machine/IDbCollectionFieldForge.js';
43
37
  export * from './main/machine/IDbCollection.js';
38
+ export * from './demo/form/types.js';
39
+ export { default as FieldValue } from './demo/form/FieldValue.svelte';
40
+ export { default as FieldInPlace } from './demo/form/FieldInPlace.svelte';
41
+ export { default as DataProvider } from './demo/form/DataProvider.svelte';
42
+ export { default as CrudZone } from './demo/form/CrudZone.svelte';
43
+ export { default as CreateUpdate } from './demo/form/CreateUpdate.svelte';
package/dist/index.js CHANGED
@@ -6,23 +6,18 @@ export { default as CollectionFks } from './ui/CollectionFks.svelte';
6
6
  export { default as CollectionFieldGuess } from './ui/CollectionFieldGuess.svelte';
7
7
  export { default as CollectionButton } from './ui/CollectionButton.svelte';
8
8
  export * from './types/appschemeTypes.js';
9
- export * from './main/machineForge.js';
10
- export * from './main/machineDb.js';
11
- export * from './main/machineDb.spec.js';
12
- export * from './main/machine.js';
13
- export * from './main/machine.spec.js';
14
9
  export { default as Skeleton } from './fragments/Skeleton.svelte';
15
10
  export { default as Selector } from './fragments/Selector.svelte';
16
11
  export { default as List } from './fragments/List.svelte';
17
12
  export { default as InfoLine } from './fragments/InfoLine.svelte';
18
13
  export { default as Frame } from './fragments/Frame.svelte';
19
14
  export { default as Confirm } from './fragments/Confirm.svelte';
20
- export * from './form/types.js';
21
- export { default as FieldValue } from './form/FieldValue.svelte';
22
- export { default as FieldInPlace } from './form/FieldInPlace.svelte';
23
- export { default as DataProvider } from './form/DataProvider.svelte';
24
- export { default as CrudZone } from './form/CrudZone.svelte';
25
- export { default as CreateUpdate } from './form/CreateUpdate.svelte';
15
+ export * from './main/machineForge.js';
16
+ export * from './main/machineDb.js';
17
+ export * from './main/machineDb.spec.js';
18
+ export * from './main/machine.js';
19
+ export * from './main/machine.spec.js';
20
+ export * from './demo/types.js';
26
21
  export * from './demo/testDbSchema.js';
27
22
  export * from './db/types.js';
28
23
  export * from './db/fieldTypes.js';
@@ -32,7 +27,6 @@ export * from './db/dbFormValidate.spec.js';
32
27
  export * from './db/dbCollectionValues.spec.js';
33
28
  export * from './db/dbCollectionFieldValues.spec.js';
34
29
  export * from './db/dbCollectionFieldForge.spec.js';
35
- export * from './db/dataModel.js';
36
30
  export * from './db/CrudService.js';
37
31
  export * from './main/machine/types.js';
38
32
  export * from './main/machine/IDbValidationError.js';
@@ -42,3 +36,9 @@ export * from './main/machine/IDbCollectionValues.js';
42
36
  export * from './main/machine/IDbCollectionFieldValues.js';
43
37
  export * from './main/machine/IDbCollectionFieldForge.js';
44
38
  export * from './main/machine/IDbCollection.js';
39
+ export * from './demo/form/types.js';
40
+ export { default as FieldValue } from './demo/form/FieldValue.svelte';
41
+ export { default as FieldInPlace } from './demo/form/FieldInPlace.svelte';
42
+ export { default as DataProvider } from './demo/form/DataProvider.svelte';
43
+ export { default as CrudZone } from './demo/form/CrudZone.svelte';
44
+ export { default as CreateUpdate } from './demo/form/CreateUpdate.svelte';
@@ -2,7 +2,6 @@ import type { TplCollectionName, Tpl, IdbqModel, TplFields } from "@medyll/idae-
2
2
  import { MachineDb, type IDbFieldRules } from "../machineDb.js";
3
3
  import { IDbFormValidate } from "./IDbFormValidate.js";
4
4
  import { IDbCollectionFieldForge } from "./IDbCollectionFieldForge.js";
5
- import { IDbCollectionFieldValues } from "./IDbCollectionFieldValues.js";
6
5
  import { IDbCollectionValues } from "./IDbCollectionValues.js";
7
6
  /**
8
7
  * IDbCollection
@@ -65,7 +64,6 @@ export declare class IDbCollection {
65
64
  * Get a new IDbCollectionValues instance for this collection.
66
65
  */
67
66
  collectionValues(): IDbCollectionValues<Record<string, any>>;
68
- collectionFieldValues<T extends Record<string, any>>(data: T): IDbCollectionFieldValues<T>;
69
67
  fieldForge<T extends Record<string, any>>(fieldName: keyof T, data: T): IDbCollectionFieldForge<T>;
70
68
  getFormValidate(): IDbFormValidate;
71
69
  }
@@ -1,7 +1,6 @@
1
1
  import { MachineDb } from "../machineDb.js";
2
2
  import { IDbFormValidate } from "./IDbFormValidate.js";
3
3
  import { IDbCollectionFieldForge } from "./IDbCollectionFieldForge.js";
4
- import { IDbCollectionFieldValues } from "./IDbCollectionFieldValues.js";
5
4
  import { IDbCollectionValues } from "./IDbCollectionValues.js";
6
5
  /**
7
6
  * IDbCollection
@@ -90,9 +89,6 @@ export class IDbCollection {
90
89
  collectionValues() {
91
90
  return new IDbCollectionValues(this.collection, this.#machineDb);
92
91
  }
93
- collectionFieldValues(data) {
94
- return new IDbCollectionFieldValues(this.collection, data, this.collectionValues());
95
- }
96
92
  fieldForge(fieldName, data) {
97
93
  return new IDbCollectionFieldForge(this.collection, fieldName, data, this.collectionValues());
98
94
  }
@@ -1,4 +1,4 @@
1
- import type { TplCollectionName } from '@medyll/idae-idbql';
1
+ import type { TplCollectionName, TplFields } from '@medyll/idae-idbql';
2
2
  import { IDbCollectionValues } from './IDbCollectionValues.js';
3
3
  import type { IDbForge } from '../machineForge.js';
4
4
  /**
@@ -20,11 +20,6 @@ import type { IDbForge } from '../machineForge.js';
20
20
  */
21
21
  export declare class IDbCollectionFieldValues<T extends Record<string, any>> {
22
22
  #private;
23
- /**
24
- * Returns the IDbForge metadata for a given field name.
25
- * @param fieldName The field name to introspect.
26
- */
27
- getForge(fieldName: keyof T): IDbForge | undefined;
28
23
  /**
29
24
  * Create a new IDbCollectionFieldValues instance.
30
25
  * @param collection The collection name.
@@ -33,25 +28,19 @@ export declare class IDbCollectionFieldValues<T extends Record<string, any>> {
33
28
  */
34
29
  constructor(collection: TplCollectionName, data: T, collectionValues?: IDbCollectionValues<T>);
35
30
  /**
36
- * Format the value of a field, handling arrays and objects.
37
- * @param fieldName The field name.
38
- */
39
- format(fieldName: keyof T): string | string[];
40
- /**
41
- * Get input attributes for a field.
42
- * @param fieldName The field name.
43
- */
44
- getInputDataSet(fieldName: keyof T): Record<"data-fieldArgs" | "data-fieldType" | "data-fieldName" | "data-collection" | "data-collectionId", string>;
45
- /**
46
- * Iterate over an array field and return field metadata for each item.
31
+ * Iterate over an array field and return an array of IDbForge objects for each element.
47
32
  * @param fieldName The field name.
48
33
  * @param data The array data.
34
+ * @returns An array of IDbForge objects.
35
+ * @deprecated use IDbCollectionValues.iterateArrayField instead
49
36
  */
50
- iterateArray(fieldName: string, data: any[]): IDbForge[];
37
+ iterateArrayField(fieldName: keyof TplFields, data: any[]): IDbForge[];
51
38
  /**
52
- * Iterate over an object field and return field metadata for each property.
39
+ * Iterate over an object field and return an array of IDbForge objects for each property.
53
40
  * @param fieldName The field name.
54
41
  * @param data The object data.
42
+ * @returns An array of IDbForge objects.
43
+ * @deprecated use IDbCollectionValues.iterateObjectField instead
55
44
  */
56
- iterateObject(fieldName: string, data: Record<string, any>): IDbForge[];
45
+ iterateObjectField(fieldName: keyof TplFields, data: Record<string, unknown>): IDbForge[];
57
46
  }
@@ -20,13 +20,6 @@ export class IDbCollectionFieldValues {
20
20
  #collection;
21
21
  #collectionValues;
22
22
  #data;
23
- /**
24
- * Returns the IDbForge metadata for a given field name.
25
- * @param fieldName The field name to introspect.
26
- */
27
- getForge(fieldName) {
28
- return this.#collectionValues.idbBase.parseCollectionFieldName(this.#collection, String(fieldName));
29
- }
30
23
  /**
31
24
  * Create a new IDbCollectionFieldValues instance.
32
25
  * @param collection The collection name.
@@ -39,44 +32,31 @@ export class IDbCollectionFieldValues {
39
32
  this.#data = data;
40
33
  }
41
34
  /**
42
- * Format the value of a field, handling arrays and objects.
35
+ * Iterate over an array field and return an array of IDbForge objects for each element.
43
36
  * @param fieldName The field name.
37
+ * @param data The array data.
38
+ * @returns An array of IDbForge objects.
39
+ * @deprecated use IDbCollectionValues.iterateArrayField instead
44
40
  */
45
- format(fieldName) {
41
+ iterateArrayField(fieldName, data) {
46
42
  const fieldInfo = this.#collectionValues.idbBase.parseCollectionFieldName(this.#collection, fieldName);
47
- if (fieldInfo?.is === 'array') {
48
- return this.iterateArray(String(fieldName), this.#data);
43
+ if (fieldInfo?.is !== 'array' || !Array.isArray(data)) {
44
+ return [];
49
45
  }
50
- if (fieldInfo?.is === 'object') {
51
- return this.iterateObject(String(fieldName), this.#data);
52
- }
53
- return this.#collectionValues.format(fieldName, this.#data);
54
- }
55
- /**
56
- * Get input attributes for a field.
57
- * @param fieldName The field name.
58
- */
59
- getInputDataSet(fieldName) {
60
- return this.#collectionValues.getInputDataSet(String(fieldName), this.#data);
61
- }
62
- // renamed from parseCollectionFieldName
63
- // get forge(): IDbForge | undefined {
64
- // return undefined; // Pas de #fieldName dans cette classe, getter non pertinent
65
- // }
66
- /**
67
- * Iterate over an array field and return field metadata for each item.
68
- * @param fieldName The field name.
69
- * @param data The array data.
70
- */
71
- iterateArray(fieldName, data) {
72
- return this.#collectionValues.iterateArrayField(fieldName, data);
46
+ return data.map((_, idx) => ({ ...fieldInfo, fieldName: `${String(fieldName)}[${idx}]` }));
73
47
  }
74
48
  /**
75
- * Iterate over an object field and return field metadata for each property.
49
+ * Iterate over an object field and return an array of IDbForge objects for each property.
76
50
  * @param fieldName The field name.
77
51
  * @param data The object data.
52
+ * @returns An array of IDbForge objects.
53
+ * @deprecated use IDbCollectionValues.iterateObjectField instead
78
54
  */
79
- iterateObject(fieldName, data) {
80
- return this.#collectionValues.iterateObjectField(fieldName, data);
55
+ iterateObjectField(fieldName, data) {
56
+ const fieldInfo = this.#collectionValues.idbBase.parseCollectionFieldName(this.#collection, fieldName);
57
+ if (fieldInfo?.is !== 'object' || typeof data !== 'object' || data === null) {
58
+ return [];
59
+ }
60
+ return Object.keys(data).map((key) => ({ ...fieldInfo, fieldName: `${String(fieldName)}.${key}` }));
81
61
  }
82
62
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  path: D:\boulot\python\wollama\src\lib\db\dbFields.ts
3
3
  */
4
- import { schemeModel } from "../db/dbSchema.js";
4
+ import { schemeModelDb } from "../db/dbSchema.js";
5
5
  import { IDbCollection } from "./machine/IDbCollection.js";
6
6
  import { IDbError } from "./machine/IDbError.js";
7
7
  import { MachineForge } from "./machineForge.js";
@@ -36,7 +36,7 @@ export class MachineDb {
36
36
  /**
37
37
  * The database model (schema) used for introspection.
38
38
  */
39
- model = schemeModel;
39
+ model = schemeModelDb;
40
40
  machineForge = new MachineForge();
41
41
  #idbCollectionsList = {};
42
42
  /**
@@ -44,7 +44,7 @@ export class MachineDb {
44
44
  * @param model Optional custom model to use (default: schemeModel)
45
45
  */
46
46
  constructor(model) {
47
- this.model = model ?? schemeModel;
47
+ this.model = model ?? schemeModelDb;
48
48
  this.machineForge = new MachineForge();
49
49
  }
50
50
  /**
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { MachineDb } from '../main/machineDb.js';
3
- import { schemeModel, idbqlState } from '../db/dbSchema.js';
3
+
4
4
  import type { TplCollectionName, Where } from '@medyll/idae-idbql';
5
5
  import { Looper } from '@medyll/idae-slotui-svelte';
6
6
 
@@ -15,7 +15,7 @@
15
15
  -->
16
16
  <script lang="ts">
17
17
  import { MachineDb } from '../main/machineDb.js';
18
- import { schemeModel, idbqlState } from '../db/dbSchema';
18
+ import { schemeModelDb, idbqlState } from '../db/dbSchema.js';
19
19
  import type { Tpl, TplCollectionName, Where } from '@medyll/idae-idbql';
20
20
  import { Looper } from '@medyll/idae-slotui-svelte';
21
21
  import type { Snippet, SvelteComponent } from 'svelte';
@@ -30,7 +30,7 @@
30
30
  componentProps?: Record<string, any>;
31
31
  };
32
32
  let { collection, children: child, showTitle = false, component, componentProps = {} }: CollectionFksProps = $props();
33
- const dbFields = new MachineDb(schemeModel);
33
+ const dbFields = new MachineDb(schemeModelDb);
34
34
  const fks = $derived(dbFields.reverseFks(collection));
35
35
 
36
36
  function getTitle() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medyll/idae-machine",
3
- "version": "0.127.0",
3
+ "version": "0.129.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",
@@ -49,8 +49,8 @@
49
49
  "scope": "@medyll",
50
50
  "dependencies": {
51
51
  "@huggingface/prettier-plugin-vertical-align": "^0.2.3",
52
- "@medyll/idae-slotui-svelte": "0.180.0",
53
- "@medyll/idae-idbql": "0.177.0"
52
+ "@medyll/idae-slotui-svelte": "0.182.0",
53
+ "@medyll/idae-idbql": "0.179.0"
54
54
  },
55
55
  "scripts": {
56
56
  "dev": "vite dev",
@@ -1,24 +0,0 @@
1
- import type { FieldType } from './fieldTypes';
2
- export type DbDataModel<T = Record<string, CollectionDbModel>> = {
3
- readonly [K in keyof T]: CollectionDbModel<T[K]>;
4
- };
5
- export interface CollectionDbModel<T = Record<string, any>> {
6
- keyPath: string | any;
7
- ts: any;
8
- model: any;
9
- template?: {
10
- index: string;
11
- presentation: any;
12
- fields?: Record<string, FieldType | string>;
13
- fks?: {
14
- code: string;
15
- multiple: boolean;
16
- rules: string;
17
- };
18
- };
19
- }
20
- export type DbDataModelTs<T extends Record<string, {
21
- ts: any;
22
- }> = DbDataModel> = {
23
- [K in keyof T]: T[K]['ts'];
24
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes