From ad35314bfa67eca198585a9e76184dd6d0dbb1c3 Mon Sep 17 00:00:00 2001 From: Brendan Hamill Date: Tue, 9 Feb 2021 14:08:54 -0500 Subject: [PATCH] Use 'slug' instead of 'tags' as query variable for caching purposes (#42) * Use 'slug' instead of 'tags' as query variable for caching purposes * Add Swift types * Add TypeScript types Co-authored-by: Brendan Hamill Co-authored-by: GitHub Action --- Queries/Emails/EmailsByTag.gql | 4 ++-- Schemas/ContentSchema.operations.json | 4 ++-- Web/EmailsByTag.ts | 8 ++++---- Web/dist-cjs/EmailsByTag.d.ts | 8 ++++---- Web/dist-cjs/EmailsByTag.js | 6 +++--- Web/dist/EmailsByTag.d.ts | 8 ++++---- Web/dist/EmailsByTag.js | 6 +++--- iOS/QuartzContent/QuartzContent.swift | 16 ++++++++-------- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Queries/Emails/EmailsByTag.gql b/Queries/Emails/EmailsByTag.gql index 5e74b2d2..3f757f18 100644 --- a/Queries/Emails/EmailsByTag.gql +++ b/Queries/Emails/EmailsByTag.gql @@ -1,9 +1,9 @@ query EmailsByTag( - $tags: [String] + $slug: [String] ) { emails( where:{ - tagSlugIn: $tags + tagSlugIn: $slug } ) { nodes { diff --git a/Schemas/ContentSchema.operations.json b/Schemas/ContentSchema.operations.json index 600f9a33..fb93893e 100644 --- a/Schemas/ContentSchema.operations.json +++ b/Schemas/ContentSchema.operations.json @@ -107,9 +107,9 @@ "name": "EmailsByList", "source": "query EmailsByList($after: String = \"\", $perPage: Int = 10, $slug: [String]!, $tags: [String]) {\n emailLists(where: {slug: $slug}) {\n __typename\n nodes {\n __typename\n ...EmailListParts\n emails(after: $after, first: $perPage, where: {tagSlugIn: $tags}) {\n __typename\n nodes {\n __typename\n ...EmailParts\n }\n pageInfo {\n __typename\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\nfragment EmailListParts on EmailList {\n __typename\n id\n description\n featuredImage {\n __typename\n ...MediaParts\n }\n isPrivate: private\n link\n listId\n name\n slug\n summary\n subtitle\n}\nfragment MediaParts on MediaItem {\n __typename\n altText\n caption\n credit\n id\n mediaDetails {\n __typename\n height\n width\n }\n sourceUrl\n title\n}\nfragment EmailParts on Email {\n __typename\n id\n dateGmt\n emailId\n featuredImage {\n __typename\n ...MediaParts\n }\n segment\n socialImage {\n __typename\n ...MediaParts\n }\n seoTitle\n socialDescription\n subject\n title\n}" }, - "db66b81b635a5da948abc984494cb96c7f7a4bc2db28a7985d394cddb3afaca7": { + "3632861deaae8e19c2df2232fbe9b3d4d756e17ba8038c19e05be67634ad39d3": { "name": "EmailsByTag", - "source": "query EmailsByTag($tags: [String]) {\n emails(where: {tagSlugIn: $tags}) {\n __typename\n nodes {\n __typename\n ...EmailParts\n html\n emailLists {\n __typename\n nodes {\n __typename\n ...EmailListParts\n }\n }\n }\n }\n}\nfragment EmailParts on Email {\n __typename\n id\n dateGmt\n emailId\n featuredImage {\n __typename\n ...MediaParts\n }\n segment\n socialImage {\n __typename\n ...MediaParts\n }\n seoTitle\n socialDescription\n subject\n title\n}\nfragment MediaParts on MediaItem {\n __typename\n altText\n caption\n credit\n id\n mediaDetails {\n __typename\n height\n width\n }\n sourceUrl\n title\n}\nfragment EmailListParts on EmailList {\n __typename\n id\n description\n featuredImage {\n __typename\n ...MediaParts\n }\n isPrivate: private\n link\n listId\n name\n slug\n summary\n subtitle\n}" + "source": "query EmailsByTag($slug: [String]) {\n emails(where: {tagSlugIn: $slug}) {\n __typename\n nodes {\n __typename\n ...EmailParts\n html\n emailLists {\n __typename\n nodes {\n __typename\n ...EmailListParts\n }\n }\n }\n }\n}\nfragment EmailParts on Email {\n __typename\n id\n dateGmt\n emailId\n featuredImage {\n __typename\n ...MediaParts\n }\n segment\n socialImage {\n __typename\n ...MediaParts\n }\n seoTitle\n socialDescription\n subject\n title\n}\nfragment MediaParts on MediaItem {\n __typename\n altText\n caption\n credit\n id\n mediaDetails {\n __typename\n height\n width\n }\n sourceUrl\n title\n}\nfragment EmailListParts on EmailList {\n __typename\n id\n description\n featuredImage {\n __typename\n ...MediaParts\n }\n isPrivate: private\n link\n listId\n name\n slug\n summary\n subtitle\n}" }, "9c67d1bec30edb71a0862e3a2a4564191360bd0f6ac186b30a0b20fcd8d49e53": { "name": "Guides", diff --git a/Web/EmailsByTag.ts b/Web/EmailsByTag.ts index cebe084b..09436e0e 100644 --- a/Web/EmailsByTag.ts +++ b/Web/EmailsByTag.ts @@ -7,7 +7,7 @@ import { EmailPartsFragmentDoc } from './EmailParts'; import { EmailListPartsFragmentDoc } from './EmailListParts'; import * as Apollo from '@apollo/client'; export type EmailsByTagQueryVariables = Types.Exact<{ - tags?: Types.Maybe>>; + slug?: Types.Maybe>>; }>; @@ -21,8 +21,8 @@ export type EmailsByTagQuery = { __typename?: 'RootQuery', emails?: Types.Maybe< export const EmailsByTagDocument = /*#__PURE__*/ gql` - query EmailsByTag($tags: [String]) { - emails(where: {tagSlugIn: $tags}) { + query EmailsByTag($slug: [String]) { + emails(where: {tagSlugIn: $slug}) { nodes { ...EmailParts html @@ -49,7 +49,7 @@ ${EmailListPartsFragmentDoc}`; * @example * const { data, loading, error } = useEmailsByTagQuery({ * variables: { - * tags: // value for 'tags' + * slug: // value for 'slug' * }, * }); */ diff --git a/Web/dist-cjs/EmailsByTag.d.ts b/Web/dist-cjs/EmailsByTag.d.ts index 75439797..78929462 100644 --- a/Web/dist-cjs/EmailsByTag.d.ts +++ b/Web/dist-cjs/EmailsByTag.d.ts @@ -3,7 +3,7 @@ import type { EmailPartsFragment } from './EmailParts'; import type { EmailListPartsFragment } from './EmailListParts'; import * as Apollo from '@apollo/client'; export declare type EmailsByTagQueryVariables = Types.Exact<{ - tags?: Types.Maybe>>; + slug?: Types.Maybe>>; }>; export declare type EmailsByTagQuery = { __typename?: 'RootQuery'; @@ -34,15 +34,15 @@ export declare const EmailsByTagDocument: Apollo.DocumentNode; * @example * const { data, loading, error } = useEmailsByTagQuery({ * variables: { - * tags: // value for 'tags' + * slug: // value for 'slug' * }, * }); */ export declare function useEmailsByTagQuery(baseOptions?: Apollo.QueryHookOptions): Apollo.QueryResult>; export declare function useEmailsByTagLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions): Apollo.QueryTuple>; export declare type EmailsByTagQueryHookResult = ReturnType; export declare type EmailsByTagLazyQueryHookResult = ReturnType; diff --git a/Web/dist-cjs/EmailsByTag.js b/Web/dist-cjs/EmailsByTag.js index fed69947..08b2d8d7 100644 --- a/Web/dist-cjs/EmailsByTag.js +++ b/Web/dist-cjs/EmailsByTag.js @@ -25,8 +25,8 @@ const EmailParts_1 = require("./EmailParts"); const EmailListParts_1 = require("./EmailListParts"); const Apollo = __importStar(require("@apollo/client")); exports.EmailsByTagDocument = client_1.gql ` - query EmailsByTag($tags: [String]) { - emails(where: {tagSlugIn: $tags}) { + query EmailsByTag($slug: [String]) { + emails(where: {tagSlugIn: $slug}) { nodes { ...EmailParts html @@ -52,7 +52,7 @@ ${EmailListParts_1.EmailListPartsFragmentDoc}`; * @example * const { data, loading, error } = useEmailsByTagQuery({ * variables: { - * tags: // value for 'tags' + * slug: // value for 'slug' * }, * }); */ diff --git a/Web/dist/EmailsByTag.d.ts b/Web/dist/EmailsByTag.d.ts index 75439797..78929462 100644 --- a/Web/dist/EmailsByTag.d.ts +++ b/Web/dist/EmailsByTag.d.ts @@ -3,7 +3,7 @@ import type { EmailPartsFragment } from './EmailParts'; import type { EmailListPartsFragment } from './EmailListParts'; import * as Apollo from '@apollo/client'; export declare type EmailsByTagQueryVariables = Types.Exact<{ - tags?: Types.Maybe>>; + slug?: Types.Maybe>>; }>; export declare type EmailsByTagQuery = { __typename?: 'RootQuery'; @@ -34,15 +34,15 @@ export declare const EmailsByTagDocument: Apollo.DocumentNode; * @example * const { data, loading, error } = useEmailsByTagQuery({ * variables: { - * tags: // value for 'tags' + * slug: // value for 'slug' * }, * }); */ export declare function useEmailsByTagQuery(baseOptions?: Apollo.QueryHookOptions): Apollo.QueryResult>; export declare function useEmailsByTagLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions): Apollo.QueryTuple>; export declare type EmailsByTagQueryHookResult = ReturnType; export declare type EmailsByTagLazyQueryHookResult = ReturnType; diff --git a/Web/dist/EmailsByTag.js b/Web/dist/EmailsByTag.js index 20ca23e9..91a3caa5 100644 --- a/Web/dist/EmailsByTag.js +++ b/Web/dist/EmailsByTag.js @@ -3,8 +3,8 @@ import { EmailPartsFragmentDoc } from './EmailParts'; import { EmailListPartsFragmentDoc } from './EmailListParts'; import * as Apollo from '@apollo/client'; export const EmailsByTagDocument = /*#__PURE__*/ gql ` - query EmailsByTag($tags: [String]) { - emails(where: {tagSlugIn: $tags}) { + query EmailsByTag($slug: [String]) { + emails(where: {tagSlugIn: $slug}) { nodes { ...EmailParts html @@ -30,7 +30,7 @@ ${EmailListPartsFragmentDoc}`; * @example * const { data, loading, error } = useEmailsByTagQuery({ * variables: { - * tags: // value for 'tags' + * slug: // value for 'slug' * }, * }); */ diff --git a/iOS/QuartzContent/QuartzContent.swift b/iOS/QuartzContent/QuartzContent.swift index 0f145ec4..77ad1e16 100644 --- a/iOS/QuartzContent/QuartzContent.swift +++ b/iOS/QuartzContent/QuartzContent.swift @@ -9615,8 +9615,8 @@ public final class EmailsByTagQuery: GraphQLQuery { /// The raw GraphQL definition of this operation. public let operationDefinition: String = """ - query EmailsByTag($tags: [String]) { - emails(where: {tagSlugIn: $tags}) { + query EmailsByTag($slug: [String]) { + emails(where: {tagSlugIn: $slug}) { __typename nodes { __typename @@ -9636,18 +9636,18 @@ public final class EmailsByTagQuery: GraphQLQuery { public let operationName: String = "EmailsByTag" - public let operationIdentifier: String? = "db66b81b635a5da948abc984494cb96c7f7a4bc2db28a7985d394cddb3afaca7" + public let operationIdentifier: String? = "3632861deaae8e19c2df2232fbe9b3d4d756e17ba8038c19e05be67634ad39d3" public var queryDocument: String { return operationDefinition.appending("\n" + EmailParts.fragmentDefinition).appending("\n" + MediaParts.fragmentDefinition).appending("\n" + EmailListParts.fragmentDefinition) } - public var tags: [String?]? + public var slug: [String?]? - public init(tags: [String?]? = nil) { - self.tags = tags + public init(slug: [String?]? = nil) { + self.slug = slug } public var variables: GraphQLMap? { - return ["tags": tags] + return ["slug": slug] } public struct Data: GraphQLSelectionSet { @@ -9655,7 +9655,7 @@ public final class EmailsByTagQuery: GraphQLQuery { public static var selections: [GraphQLSelection] { return [ - GraphQLField("emails", arguments: ["where": ["tagSlugIn": GraphQLVariable("tags")]], type: .object(Email.selections)), + GraphQLField("emails", arguments: ["where": ["tagSlugIn": GraphQLVariable("slug")]], type: .object(Email.selections)), ] }