@tinacms/schema-tools 0.0.0-c8b1d84-20241003015733 → 0.0.0-d524599-20241115065930
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 +6 -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
|
@@ -161,6 +161,9 @@ export type ImageField = (FieldGeneric<string, undefined> | FieldGeneric<string,
|
|
|
161
161
|
};
|
|
162
162
|
type ReferenceFieldOptions = {
|
|
163
163
|
optionComponent?: OptionComponent;
|
|
164
|
+
/**
|
|
165
|
+
* @deprecated use `collectionFilter` instead as experimental___Filter will be removed in a future release
|
|
166
|
+
*/
|
|
164
167
|
experimental___filter?: (list: Array<any>, searchQuery: string) => Array<any>;
|
|
165
168
|
collectionFilter?: Record<string, Record<string, FilterValue>> | (() => Record<string, Record<string, FilterValue>>);
|
|
166
169
|
};
|
|
@@ -182,7 +185,7 @@ export type ReferenceField = (FieldGeneric<string, undefined, ReferenceFieldOpti
|
|
|
182
185
|
export type PasswordField = (FieldGeneric<string, undefined> | FieldGeneric<string, false>) & BaseField & {
|
|
183
186
|
type: 'password';
|
|
184
187
|
};
|
|
185
|
-
type
|
|
188
|
+
type ToolbarOverrideType = 'heading' | 'link' | 'image' | 'quote' | 'ul' | 'ol' | 'code' | 'codeBlock' | 'bold' | 'italic' | 'raw' | 'embed' | 'mermaid' | 'table';
|
|
186
189
|
type RichTextAst = {
|
|
187
190
|
type: 'root';
|
|
188
191
|
children: Record<string, unknown>[];
|
|
@@ -195,7 +198,7 @@ export type RichTextField<WithNamespace extends boolean = false> = (FieldGeneric
|
|
|
195
198
|
* will be stored as frontmatter
|
|
196
199
|
*/
|
|
197
200
|
isBody?: boolean;
|
|
198
|
-
toolbarOverride?:
|
|
201
|
+
toolbarOverride?: ToolbarOverrideType[];
|
|
199
202
|
templates?: RichTextTemplate<WithNamespace>[];
|
|
200
203
|
/**
|
|
201
204
|
* By default, Tina parses markdown with MDX, this is a more strict parser
|
|
@@ -627,6 +630,7 @@ type Document = {
|
|
|
627
630
|
relativePath: string;
|
|
628
631
|
filename: string;
|
|
629
632
|
extension: string;
|
|
633
|
+
hasReferences?: boolean;
|
|
630
634
|
};
|
|
631
635
|
};
|
|
632
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": "0.0.0-
|
|
3
|
+
"version": "0.0.0-d524599-20241115065930",
|
|
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": "
|
|
35
|
+
"@tinacms/scripts": "0.0.0-d524599-20241115065930"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": ">=16.14.0",
|