Browse Source

query node - GraphQL Playground dependency overload III

ondratra 3 years ago
parent
commit
8a06bc10a5
2 changed files with 32 additions and 12 deletions
  1. 28 8
      query-node/generated/graphql-server/src/queryTemplates.ts
  2. 4 4
      yarn.lock

+ 28 - 8
query-node/generated/graphql-server/src/queryTemplates.ts

@@ -1,12 +1,29 @@
 import { IQueryTemplate, queryTemplateUtils } from '@apollographql/graphql-playground-react/lib/components/Playground/QueryTemplates/templateUtils'
 
+// fields that will be ignored by autofill
+const commonIgnoredFields = [
+  'deletedAt',
+  'createdById',
+  'updatedById',
+  'deletedById',
+  'version',
+]
+
+const dataObjectIgnoredFields = [
+  ...commonIgnoredFields,
+
+  // dataObject's `owner` is problematic because it's variant and will need some special handling
+  'owner',
+]
+
 const exampleDate = `"2018-01-31 23:59"`
 
 export const queryTemplates: IQueryTemplate[] = [
-  ...queryTemplateUtils.getOneGetAllTemplates('video', 'videos', 'videos'),
+  ...queryTemplateUtils.getOneGetAllTemplates('video', 'videos', 'videos', commonIgnoredFields),
   {
     title: 'Featured videos',
     description: 'Get all featured videos.',
+    ignoredFields: commonIgnoredFields,
     query: `query {
       ${queryTemplateUtils.descriptionMarker}
       videos(where: { isFeatured_eq: true }) { ${queryTemplateUtils.allPropsMarker} }
@@ -14,6 +31,7 @@ export const queryTemplates: IQueryTemplate[] = [
   }, {
     title: 'All recent videos',
     description: 'Get all videos after created or updated after the given date.',
+    ignoredFields: commonIgnoredFields,
     query: `query {
       ${queryTemplateUtils.descriptionMarker}
       videos(where: {
@@ -23,30 +41,32 @@ export const queryTemplates: IQueryTemplate[] = [
     }`,
   },
 
-  ...queryTemplateUtils.getOneGetAllTemplates('video category', 'video categories', 'videoCategories'),
+  ...queryTemplateUtils.getOneGetAllTemplates('video category', 'video categories', 'videoCategories', commonIgnoredFields),
   {
     title: `All videos in category`,
     description: `Get all videos associated with the given video category.`,
+    ignoredFields: commonIgnoredFields,
     query: `query {
       ${queryTemplateUtils.descriptionMarker}
       videos(where: { categoryId_eq: 1 }) { ${queryTemplateUtils.allPropsMarker} }
     }`,
   },
-  ...queryTemplateUtils.getOneGetAllTemplates('channel', 'channels', 'channels'),
-  ...queryTemplateUtils.getOneGetAllTemplates('channel category', 'channels categories', 'channelCategories'),
+  ...queryTemplateUtils.getOneGetAllTemplates('channel', 'channels', 'channels', commonIgnoredFields),
+  ...queryTemplateUtils.getOneGetAllTemplates('channel category', 'channels categories', 'channelCategories', commonIgnoredFields),
 
   {
     title: `Channel's videos`,
     description: `Get all videos associated with the given channel.`,
+    ignoredFields: commonIgnoredFields,
     query: `query {
       ${queryTemplateUtils.descriptionMarker}
       videos(where: { channelId_eq: 1 }) { ${queryTemplateUtils.allPropsMarker} }
     }`,
   },
 
-  ...queryTemplateUtils.getOneGetAllTemplates('asset', 'assets', 'dataObjects'),
-  ...queryTemplateUtils.getOneGetAllTemplates('membership', 'memberships', 'memberships'),
+  ...queryTemplateUtils.getOneGetAllTemplates('asset', 'assets', 'dataObjects', dataObjectIgnoredFields),
+  ...queryTemplateUtils.getOneGetAllTemplates('membership', 'memberships', 'memberships', commonIgnoredFields),
 
-  ...queryTemplateUtils.getOneGetAllTemplates('curator group', 'curator groups', 'curatorGroups'),
-  ...queryTemplateUtils.getOneGetAllTemplates('worker', 'workers', 'workers'),
+  ...queryTemplateUtils.getOneGetAllTemplates('curator group', 'curator groups', 'curatorGroups', commonIgnoredFields),
+  ...queryTemplateUtils.getOneGetAllTemplates('worker', 'workers', 'workers', commonIgnoredFields),
 ].map(queryTemplateUtils.formatQuery)

+ 4 - 4
yarn.lock

@@ -75,9 +75,9 @@
   dependencies:
     xss "^1.0.8"
 
-"@apollographql/graphql-playground-react@https://github.com/Joystream/graphql-playground/releases/download/query-templates%401.7.27/graphql-playground-react-1.7.27.tgz":
+"@apollographql/graphql-playground-react@https://github.com/Joystream/graphql-playground/releases/download/query-templates%401.7.27/graphql-playground-react-v1.7.27.tgz":
   version "1.7.27"
-  resolved "https://github.com/Joystream/graphql-playground/releases/download/query-templates%401.7.27/graphql-playground-react-1.7.27.tgz#d19cddaca0be119c1f8a50d8e3b939ae61da7d3d"
+  resolved "https://github.com/Joystream/graphql-playground/releases/download/query-templates%401.7.27/graphql-playground-react-v1.7.27.tgz#f29765a3a182204bf2bb166a3ed10c7273637af9"
   dependencies:
     "@types/lru-cache" "^4.1.1"
     apollo-link "^1.2.13"
@@ -28738,9 +28738,9 @@ warning@^4.0.1, warning@^4.0.2, warning@^4.0.3:
 
 "warthog@https://github.com/metmirr/warthog/releases/download/v2.23.0/warthog-v2.23.0.tgz", "warthog@https://github.com/ondratra/warthog/releases/download/v2.23.1/warthog-v2.23.1.tgz":
   version "2.23.1"
-  resolved "https://github.com/ondratra/warthog/releases/download/v2.23.1/warthog-v2.23.1.tgz#a782a941bc1e09722fb0736a092fe6494cd86615"
+  resolved "https://github.com/ondratra/warthog/releases/download/v2.23.1/warthog-v2.23.1.tgz#06308310382d29697636af862a2fa307d962f25f"
   dependencies:
-    "@apollographql/graphql-playground-react" "https://github.com/Joystream/graphql-playground/releases/download/query-templates%401.7.27/graphql-playground-react-1.7.27.tgz"
+    "@apollographql/graphql-playground-react" "https://github.com/Joystream/graphql-playground/releases/download/query-templates%401.7.27/graphql-playground-react-v1.7.27.tgz"
     "@types/app-root-path" "^1.2.4"
     "@types/bn.js" "^4.11.6"
     "@types/caller" "^1.0.0"