@tinacms/schema-tools 1.6.6 → 1.6.8
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.js +14 -0
- package/dist/index.mjs +14 -0
- package/dist/schema/TinaSchema.d.ts +4 -0
- package/dist/types/index.d.ts +3 -2
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2004,6 +2004,20 @@
|
|
|
2004
2004
|
field.uid = field.uid || false;
|
|
2005
2005
|
});
|
|
2006
2006
|
}
|
|
2007
|
+
findReferences(name2) {
|
|
2008
|
+
const result = {};
|
|
2009
|
+
this.walkFields(({ field, collection: c, path }) => {
|
|
2010
|
+
if (field.type === "reference") {
|
|
2011
|
+
if (field.collections.includes(name2)) {
|
|
2012
|
+
if (result[c.name] === void 0) {
|
|
2013
|
+
result[c.name] = [];
|
|
2014
|
+
}
|
|
2015
|
+
result[c.name].push({ path, field });
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
});
|
|
2019
|
+
return result;
|
|
2020
|
+
}
|
|
2007
2021
|
/**
|
|
2008
2022
|
* This function returns an array of glob matches for a given collection.
|
|
2009
2023
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1986,6 +1986,20 @@ class TinaSchema {
|
|
|
1986
1986
|
field.uid = field.uid || false;
|
|
1987
1987
|
});
|
|
1988
1988
|
}
|
|
1989
|
+
findReferences(name2) {
|
|
1990
|
+
const result = {};
|
|
1991
|
+
this.walkFields(({ field, collection: c, path }) => {
|
|
1992
|
+
if (field.type === "reference") {
|
|
1993
|
+
if (field.collections.includes(name2)) {
|
|
1994
|
+
if (result[c.name] === void 0) {
|
|
1995
|
+
result[c.name] = [];
|
|
1996
|
+
}
|
|
1997
|
+
result[c.name].push({ path, field });
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
});
|
|
2001
|
+
return result;
|
|
2002
|
+
}
|
|
1989
2003
|
/**
|
|
1990
2004
|
* This function returns an array of glob matches for a given collection.
|
|
1991
2005
|
*
|
|
@@ -28,6 +28,10 @@ export declare class TinaSchema {
|
|
|
28
28
|
} & Schema);
|
|
29
29
|
getIsTitleFieldName: (collection: string) => string;
|
|
30
30
|
getCollectionsByName: (collectionNames: string[]) => Collection<true>[];
|
|
31
|
+
findReferences(name: string): Record<string, {
|
|
32
|
+
path: string[];
|
|
33
|
+
field: TinaField;
|
|
34
|
+
}[]>;
|
|
31
35
|
getCollection: (collectionName: string) => Collection<true>;
|
|
32
36
|
getCollections: () => Collection<true>[];
|
|
33
37
|
getCollectionByFullPath: (filepath: string) => Collection<true>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -185,7 +185,7 @@ export type ReferenceField = (FieldGeneric<string, undefined, ReferenceFieldOpti
|
|
|
185
185
|
export type PasswordField = (FieldGeneric<string, undefined> | FieldGeneric<string, false>) & BaseField & {
|
|
186
186
|
type: 'password';
|
|
187
187
|
};
|
|
188
|
-
type
|
|
188
|
+
type ToolbarOverrideType = 'heading' | 'link' | 'image' | 'quote' | 'ul' | 'ol' | 'code' | 'codeBlock' | 'bold' | 'italic' | 'raw' | 'embed' | 'mermaid' | 'table';
|
|
189
189
|
type RichTextAst = {
|
|
190
190
|
type: 'root';
|
|
191
191
|
children: Record<string, unknown>[];
|
|
@@ -198,7 +198,7 @@ export type RichTextField<WithNamespace extends boolean = false> = (FieldGeneric
|
|
|
198
198
|
* will be stored as frontmatter
|
|
199
199
|
*/
|
|
200
200
|
isBody?: boolean;
|
|
201
|
-
toolbarOverride?:
|
|
201
|
+
toolbarOverride?: ToolbarOverrideType[];
|
|
202
202
|
templates?: RichTextTemplate<WithNamespace>[];
|
|
203
203
|
/**
|
|
204
204
|
* By default, Tina parses markdown with MDX, this is a more strict parser
|
|
@@ -630,6 +630,7 @@ type Document = {
|
|
|
630
630
|
relativePath: string;
|
|
631
631
|
filename: string;
|
|
632
632
|
extension: string;
|
|
633
|
+
hasReferences?: boolean;
|
|
633
634
|
};
|
|
634
635
|
};
|
|
635
636
|
export interface UICollection<Form = any, CMS = any, TinaForm = any> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/schema-tools",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.8",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
]
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/jest": "^29.5.
|
|
26
|
+
"@types/jest": "^29.5.14",
|
|
27
27
|
"@types/micromatch": "^4.0.9",
|
|
28
|
-
"@types/react": "^18.3.
|
|
28
|
+
"@types/react": "^18.3.12",
|
|
29
29
|
"@types/yup": "^0.29.14",
|
|
30
30
|
"jest": "^29.7.0",
|
|
31
31
|
"react": "^18.3.1",
|
|
32
32
|
"ts-jest": "^29.2.5",
|
|
33
|
-
"typescript": "^5.6.
|
|
33
|
+
"typescript": "^5.6.3",
|
|
34
34
|
"yup": "^0.32.11",
|
|
35
|
-
"@tinacms/scripts": "1.3.
|
|
35
|
+
"@tinacms/scripts": "1.3.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": ">=16.14.0",
|