@firecms/schema_inference 3.0.0-canary.43 → 3.0.0-canary.44
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/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "3.0.0-canary.
|
2
|
+
"version": "3.0.0-canary.44",
|
3
3
|
"type": "module",
|
4
4
|
"name": "@firecms/schema_inference",
|
5
5
|
"access": "public",
|
@@ -8,7 +8,7 @@
|
|
8
8
|
"types": "dist/index.d.ts",
|
9
9
|
"source": "src/index.ts",
|
10
10
|
"devDependencies": {
|
11
|
-
"@firecms/core": "^3.0.0-canary.
|
11
|
+
"@firecms/core": "^3.0.0-canary.44",
|
12
12
|
"@types/node": "^20.12.7",
|
13
13
|
"typescript": "^5.4.5",
|
14
14
|
"vite": "^5.2.9"
|
@@ -30,5 +30,5 @@
|
|
30
30
|
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json",
|
31
31
|
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f"
|
32
32
|
},
|
33
|
-
"gitHead": "
|
33
|
+
"gitHead": "15e52171f137c2876a3566bbc2752d140b9d0c7a"
|
34
34
|
}
|
@@ -3,13 +3,12 @@ import { InferencePropertyBuilderProps, ValuesCountEntry } from "../types";
|
|
3
3
|
import { findCommonInitialStringInPath } from "../strings";
|
4
4
|
import { extractEnumFromValues } from "../util";
|
5
5
|
|
6
|
-
const IMAGE_EXTENSIONS = [".jpg", ".png", ".webp", ".gif"];
|
6
|
+
const IMAGE_EXTENSIONS = [".jpg", ".jpeg", ".png", ".webp", ".gif", ".avif"];
|
7
7
|
const AUDIO_EXTENSIONS = [".mp3", ".ogg", ".opus", ".aac"];
|
8
8
|
const VIDEO_EXTENSIONS = [".avi", ".mp4"];
|
9
9
|
|
10
10
|
const emailRegEx = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
11
11
|
|
12
|
-
|
13
12
|
export function buildStringProperty({
|
14
13
|
totalDocsCount,
|
15
14
|
valuesResult
|
@@ -59,9 +59,13 @@ export function buildPropertyFromData(data: any[], property: Property, getType:
|
|
59
59
|
return mergeDeep(generatedProperty, property);
|
60
60
|
}
|
61
61
|
|
62
|
-
export function buildPropertiesOrder(properties: Properties<any
|
62
|
+
export function buildPropertiesOrder(properties: Properties<any>, priorityKeys?: string[]): string [] {
|
63
|
+
const lowerCasePriorityKeys = (priorityKeys ?? []).map((key) => key.toLowerCase());
|
64
|
+
|
63
65
|
function propOrder(s: string) {
|
64
66
|
const k = s.toLowerCase();
|
67
|
+
if (lowerCasePriorityKeys.includes(k)) return 4;
|
68
|
+
if (k === "title" || k === "name") return 3;
|
65
69
|
if (k === "title" || k === "name") return 3;
|
66
70
|
if (k.includes("title") || k.includes("name")) return 2;
|
67
71
|
if (k.includes("image") || k.includes("picture")) return 1;
|