@tinacms/graphql 0.59.7 → 0.59.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # tina-graphql
2
2
 
3
+ ## 0.59.8
4
+
5
+ ### Patch Changes
6
+
7
+ - e7b27ba3b: Fix issue where un-normalized rich-text fields which send `null` values to the server on save would cause a parsing error
8
+ - 11d55f441: Add experimental useGraphQLForms hook
9
+
3
10
  ## 0.59.7
4
11
 
5
12
  ### Patch Changes
package/dist/index.js CHANGED
@@ -12370,7 +12370,7 @@ var validateField = async (field) => {
12370
12370
 
12371
12371
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/package.json
12372
12372
  var name = "@tinacms/graphql";
12373
- var version = "0.59.7";
12373
+ var version = "0.59.8";
12374
12374
  var main = "dist/index.js";
12375
12375
  var typings = "dist/index.d.ts";
12376
12376
  var files = [
@@ -12415,6 +12415,7 @@ var scripts = {
12415
12415
  test: "jest"
12416
12416
  };
12417
12417
  var dependencies = {
12418
+ "@graphql-tools/relay-operation-optimizer": "^6.4.1",
12418
12419
  "body-parser": "^1.19.0",
12419
12420
  cors: "^2.8.5",
12420
12421
  dataloader: "^2.0.0",
@@ -12753,6 +12754,17 @@ var _buildSchema = async (builder, tinaSchema) => {
12753
12754
  const queryTypeDefinitionFields = [];
12754
12755
  const mutationTypeDefinitionFields = [];
12755
12756
  const collections = tinaSchema.getCollections();
12757
+ queryTypeDefinitionFields.push(astBuilder.FieldDefinition({
12758
+ name: "getOptimizedQuery",
12759
+ args: [
12760
+ astBuilder.InputValueDefinition({
12761
+ name: "queryString",
12762
+ type: astBuilder.TYPES.String,
12763
+ required: true
12764
+ })
12765
+ ],
12766
+ type: astBuilder.TYPES.String
12767
+ }));
12756
12768
  queryTypeDefinitionFields.push(await builder.buildCollectionDefinition(collections));
12757
12769
  queryTypeDefinitionFields.push(await builder.buildMultiCollectionDefinition(collections));
12758
12770
  queryTypeDefinitionFields.push(await builder.multiNodeDocument());
@@ -21883,6 +21895,9 @@ var allChildrenEmpty = (children) => {
21883
21895
  return false;
21884
21896
  };
21885
21897
  var stringifyChildren = (children, field) => {
21898
+ if (!children) {
21899
+ return [];
21900
+ }
21886
21901
  return children.map((child) => stringify(child, field)).filter(Boolean);
21887
21902
  };
21888
21903
  var stringify = (node, field) => {
@@ -22866,6 +22881,7 @@ var resolveDateInput = (value) => {
22866
22881
  };
22867
22882
 
22868
22883
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/src/resolve.ts
22884
+ var import_relay_operation_optimizer = __toModule(require("@graphql-tools/relay-operation-optimizer"));
22869
22885
  var resolve = async ({
22870
22886
  query,
22871
22887
  variables,
@@ -22966,6 +22982,18 @@ var resolve = async ({
22966
22982
  if (info.fieldName === "getDocumentFields") {
22967
22983
  return resolver2.getDocumentFields();
22968
22984
  }
22985
+ if (info.fieldName === "getOptimizedQuery") {
22986
+ try {
22987
+ const [optimizedQuery] = (0, import_relay_operation_optimizer.optimizeDocuments)(info.schema, [(0, import_graphql3.parse)(args.queryString)], {
22988
+ assumeValid: true,
22989
+ includeFragments: false,
22990
+ noLocation: true
22991
+ });
22992
+ return (0, import_graphql3.print)(optimizedQuery);
22993
+ } catch (e) {
22994
+ throw new Error(`Invalid query provided, Error message: ${e.message}`);
22995
+ }
22996
+ }
22969
22997
  if (!lookup) {
22970
22998
  return value;
22971
22999
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "0.59.7",
3
+ "version": "0.59.8",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -45,6 +45,7 @@
45
45
  "test": "jest"
46
46
  },
47
47
  "dependencies": {
48
+ "@graphql-tools/relay-operation-optimizer": "^6.4.1",
48
49
  "body-parser": "^1.19.0",
49
50
  "cors": "^2.8.5",
50
51
  "dataloader": "^2.0.0",
@@ -95,7 +96,7 @@
95
96
  },
96
97
  "devDependencies": {
97
98
  "@tinacms/datalayer": "0.0.2",
98
- "@tinacms/scripts": "0.50.6",
99
+ "@tinacms/scripts": "0.50.7",
99
100
  "@types/cors": "^2.8.7",
100
101
  "@types/estree": "^0.0.50",
101
102
  "@types/express": "^4.17.8",