@tinacms/schema-tools 1.4.12 → 1.4.13
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/LICENSE +1 -9
- package/dist/index.js +3 -2
- package/dist/index.mjs +3 -2
- package/dist/types/index.d.ts +6 -0
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Portions of the TinaCMS software are licensed as follows:
|
|
4
|
-
|
|
5
|
-
* All software that resides under the "packages/@tinacms/datalayer/" and the "packages/@tinacms/graphql/" directories (the "Tina Data Layer"), is licensed under the license defined in "packages/@tinacms/datalayer/LICENSE".
|
|
6
|
-
|
|
7
|
-
* All software outside of the above-mentioned directories is available under the "Apache 2.0" license as set forth below.
|
|
8
|
-
|
|
9
|
-
Apache License
|
|
1
|
+
Apache License
|
|
10
2
|
Version 2.0, January 2004
|
|
11
3
|
http://www.apache.org/licenses/
|
|
12
4
|
|
package/dist/index.js
CHANGED
|
@@ -231,6 +231,7 @@
|
|
|
231
231
|
};
|
|
232
232
|
this.getCollectionByFullPath = (filepath) => {
|
|
233
233
|
const fileExtension = filepath.split(".").pop();
|
|
234
|
+
const normalizedPath = filepath.replace(/\\/g, "/");
|
|
234
235
|
const possibleCollections = this.getCollections().filter((collection) => {
|
|
235
236
|
var _a, _b;
|
|
236
237
|
if (fileExtension !== (collection.format || "md")) {
|
|
@@ -238,13 +239,13 @@
|
|
|
238
239
|
}
|
|
239
240
|
if (((_a = collection == null ? void 0 : collection.match) == null ? void 0 : _a.include) || ((_b = collection == null ? void 0 : collection.match) == null ? void 0 : _b.exclude)) {
|
|
240
241
|
const matches = this.getMatches({ collection });
|
|
241
|
-
const match = picomatch.isMatch(
|
|
242
|
+
const match = picomatch.isMatch(normalizedPath, matches);
|
|
242
243
|
if (!match) {
|
|
243
244
|
return false;
|
|
244
245
|
}
|
|
245
246
|
}
|
|
246
247
|
const path = collection.path ? collection.path.replace(/\/?$/, "/") : "";
|
|
247
|
-
return
|
|
248
|
+
return normalizedPath.startsWith(path);
|
|
248
249
|
});
|
|
249
250
|
if (possibleCollections.length === 0) {
|
|
250
251
|
throw new Error(`Unable to find collection for file at ${filepath}`);
|
package/dist/index.mjs
CHANGED
|
@@ -214,6 +214,7 @@ class TinaSchema {
|
|
|
214
214
|
};
|
|
215
215
|
this.getCollectionByFullPath = (filepath) => {
|
|
216
216
|
const fileExtension = filepath.split(".").pop();
|
|
217
|
+
const normalizedPath = filepath.replace(/\\/g, "/");
|
|
217
218
|
const possibleCollections = this.getCollections().filter((collection) => {
|
|
218
219
|
var _a, _b;
|
|
219
220
|
if (fileExtension !== (collection.format || "md")) {
|
|
@@ -221,13 +222,13 @@ class TinaSchema {
|
|
|
221
222
|
}
|
|
222
223
|
if (((_a = collection == null ? void 0 : collection.match) == null ? void 0 : _a.include) || ((_b = collection == null ? void 0 : collection.match) == null ? void 0 : _b.exclude)) {
|
|
223
224
|
const matches = this.getMatches({ collection });
|
|
224
|
-
const match = picomatch.isMatch(
|
|
225
|
+
const match = picomatch.isMatch(normalizedPath, matches);
|
|
225
226
|
if (!match) {
|
|
226
227
|
return false;
|
|
227
228
|
}
|
|
228
229
|
}
|
|
229
230
|
const path = collection.path ? collection.path.replace(/\/?$/, "/") : "";
|
|
230
|
-
return
|
|
231
|
+
return normalizedPath.startsWith(path);
|
|
231
232
|
});
|
|
232
233
|
if (possibleCollections.length === 0) {
|
|
233
234
|
throw new Error(`Unable to find collection for file at ${filepath}`);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -397,6 +397,12 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
|
|
|
397
397
|
* @default 2
|
|
398
398
|
*/
|
|
399
399
|
referenceDepth?: number;
|
|
400
|
+
/**
|
|
401
|
+
* Determines how the client will handle errors. If it is set to `throw` the client will throw an error when a query fails. If it is set to `include` the client will return the error in the response.
|
|
402
|
+
*
|
|
403
|
+
* @default 'throw'
|
|
404
|
+
*/
|
|
405
|
+
errorPolicy?: 'throw' | 'include';
|
|
400
406
|
};
|
|
401
407
|
/**
|
|
402
408
|
*
|