@medyll/idae-machine 0.128.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.
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/main/machine/IDbCollection.d.ts +0 -2
- package/dist/main/machine/IDbCollection.js +0 -4
- package/dist/main/machine/IDbCollectionFieldValues.d.ts +9 -20
- package/dist/main/machine/IDbCollectionFieldValues.js +17 -37
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -5,17 +5,17 @@ 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';
|
|
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
19
|
export * from './demo/types.js';
|
|
20
20
|
export * from './demo/testDbSchema.js';
|
|
21
21
|
export * from './db/types.js';
|
package/dist/index.js
CHANGED
|
@@ -6,17 +6,17 @@ 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';
|
|
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
20
|
export * from './demo/types.js';
|
|
21
21
|
export * from './demo/testDbSchema.js';
|
|
22
22
|
export * from './db/types.js';
|
|
@@ -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
|
-
*
|
|
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
|
-
|
|
37
|
+
iterateArrayField(fieldName: keyof TplFields, data: any[]): IDbForge[];
|
|
51
38
|
/**
|
|
52
|
-
* Iterate over an object field and return
|
|
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
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
41
|
+
iterateArrayField(fieldName, data) {
|
|
46
42
|
const fieldInfo = this.#collectionValues.idbBase.parseCollectionFieldName(this.#collection, fieldName);
|
|
47
|
-
if (fieldInfo?.is
|
|
48
|
-
return
|
|
43
|
+
if (fieldInfo?.is !== 'array' || !Array.isArray(data)) {
|
|
44
|
+
return [];
|
|
49
45
|
}
|
|
50
|
-
|
|
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
|
|
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
|
-
|
|
80
|
-
|
|
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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medyll/idae-machine",
|
|
3
|
-
"version": "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.
|
|
53
|
-
"@medyll/idae-idbql": "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",
|