@tinacms/graphql 1.4.0 → 1.4.1

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.es.js CHANGED
@@ -2220,11 +2220,11 @@ Visit https://tina.io/docs/errors/ui-not-supported/ for more information
2220
2220
  switch (field.type) {
2221
2221
  case "boolean":
2222
2222
  case "datetime":
2223
- case "image":
2224
2223
  case "number":
2225
2224
  if (field.list) {
2226
2225
  console.warn(listWarningMsg);
2227
2226
  }
2227
+ case "image":
2228
2228
  case "string":
2229
2229
  return astBuilder.FieldDefinition({
2230
2230
  name: field.name,
@@ -2491,7 +2491,7 @@ var validateField = async (field) => {
2491
2491
  // package.json
2492
2492
  var package_default = {
2493
2493
  name: "@tinacms/graphql",
2494
- version: "1.4.0",
2494
+ version: "1.4.1",
2495
2495
  main: "dist/index.js",
2496
2496
  module: "dist/index.es.js",
2497
2497
  typings: "dist/index.d.ts",
@@ -5443,9 +5443,15 @@ var getTemplateForFile = (templateInfo, data) => {
5443
5443
  }
5444
5444
  if (templateInfo.type === "union") {
5445
5445
  if (hasOwnProperty(data, "_template")) {
5446
- return templateInfo.templates.find(
5446
+ const template = templateInfo.templates.find(
5447
5447
  (t) => lastItem(t.namespace) === data._template
5448
5448
  );
5449
+ if (!template) {
5450
+ throw new Error(
5451
+ `Unable to find template "${data._template}". Possible templates are: ${templateInfo.templates.map((template2) => `"${template2.name}"`).join(", ")}.`
5452
+ );
5453
+ }
5454
+ return template;
5449
5455
  } else {
5450
5456
  throw new Error(
5451
5457
  `Expected _template to be provided for document in an ambiguous collection`
package/dist/index.js CHANGED
@@ -2269,11 +2269,11 @@ Visit https://tina.io/docs/errors/ui-not-supported/ for more information
2269
2269
  switch (field.type) {
2270
2270
  case "boolean":
2271
2271
  case "datetime":
2272
- case "image":
2273
2272
  case "number":
2274
2273
  if (field.list) {
2275
2274
  console.warn(listWarningMsg);
2276
2275
  }
2276
+ case "image":
2277
2277
  case "string":
2278
2278
  return astBuilder.FieldDefinition({
2279
2279
  name: field.name,
@@ -2542,7 +2542,7 @@ var validateField = async (field) => {
2542
2542
  // package.json
2543
2543
  var package_default = {
2544
2544
  name: "@tinacms/graphql",
2545
- version: "1.4.0",
2545
+ version: "1.4.1",
2546
2546
  main: "dist/index.js",
2547
2547
  module: "dist/index.es.js",
2548
2548
  typings: "dist/index.d.ts",
@@ -5501,9 +5501,15 @@ var getTemplateForFile = (templateInfo, data) => {
5501
5501
  }
5502
5502
  if (templateInfo.type === "union") {
5503
5503
  if (hasOwnProperty(data, "_template")) {
5504
- return templateInfo.templates.find(
5504
+ const template = templateInfo.templates.find(
5505
5505
  (t) => lastItem(t.namespace) === data._template
5506
5506
  );
5507
+ if (!template) {
5508
+ throw new Error(
5509
+ `Unable to find template "${data._template}". Possible templates are: ${templateInfo.templates.map((template2) => `"${template2.name}"`).join(", ")}.`
5510
+ );
5511
+ }
5512
+ return template;
5507
5513
  } else {
5508
5514
  throw new Error(
5509
5515
  `Expected _template to be provided for document in an ambiguous collection`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "typings": "dist/index.d.ts",
@@ -25,8 +25,8 @@
25
25
  "dependencies": {
26
26
  "@graphql-tools/relay-operation-optimizer": "^6.4.1",
27
27
  "@iarna/toml": "^2.2.5",
28
- "@tinacms/mdx": "1.3.5",
29
- "@tinacms/schema-tools": "1.4.0",
28
+ "@tinacms/mdx": "1.3.6",
29
+ "@tinacms/schema-tools": "1.4.1",
30
30
  "abstract-level": "^1.0.3",
31
31
  "body-parser": "^1.19.0",
32
32
  "cors": "^2.8.5",
@@ -83,7 +83,7 @@
83
83
  "directory": "packages/tina-graphql"
84
84
  },
85
85
  "devDependencies": {
86
- "@tinacms/schema-tools": "1.4.0",
86
+ "@tinacms/schema-tools": "1.4.1",
87
87
  "@tinacms/scripts": "1.1.0",
88
88
  "@types/cors": "^2.8.7",
89
89
  "@types/estree": "^0.0.50",