@tinacms/schema-tools 0.0.0-ef282d9-20241024212433 → 0.0.0-fbcd928-20241024223724
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 +1 -0
- package/package.json +1 -1
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