@laioutr/app-hygraph 1.8.0 → 1.9.0
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/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/server/generated/graphql.d.ts +2 -0
- package/dist/runtime/server/orchestr/blog/blogPostsByTopic.template.js +7 -2
- package/dist/runtime/server/queries/blog.d.ts +1 -1
- package/dist/runtime/server/queries/blog.js +2 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -12617,6 +12617,8 @@ export type BlogTopicBySlugQuery = {
|
|
|
12617
12617
|
};
|
|
12618
12618
|
export type BlogTopicsQueryVariables = Exact<{
|
|
12619
12619
|
locales: Array<Locale> | Locale;
|
|
12620
|
+
first?: InputMaybe<Scalars['Int']['input']>;
|
|
12621
|
+
where?: InputMaybe<TopicWhereInput>;
|
|
12620
12622
|
}>;
|
|
12621
12623
|
export type BlogTopicsQuery = {
|
|
12622
12624
|
topics: Array<{
|
|
@@ -4,9 +4,14 @@ import { defineHygraph } from "../../middleware/defineHygraph.js";
|
|
|
4
4
|
import { BLOG_TOPICS_QUERY } from "../../queries/blog.js";
|
|
5
5
|
export default defineHygraph.queryTemplateProvider({
|
|
6
6
|
for: BlogPostsByTopic,
|
|
7
|
-
run: async ({ context, clientEnv }) => {
|
|
7
|
+
run: async ({ context, clientEnv, input }) => {
|
|
8
|
+
const term = input.term?.trim();
|
|
8
9
|
const result = await context.hygraph.request(BLOG_TOPICS_QUERY, {
|
|
9
|
-
locales: resolveHygraphLocales(clientEnv.locale)
|
|
10
|
+
locales: resolveHygraphLocales(clientEnv.locale),
|
|
11
|
+
// Hygraph caps a page at 100 items; load the full first page instead of
|
|
12
|
+
// the default 10 so every topic is available in the picker.
|
|
13
|
+
first: 100,
|
|
14
|
+
where: term ? { _search: term } : void 0
|
|
10
15
|
});
|
|
11
16
|
return result.data.topics.filter((topic) => Boolean(topic.slug && topic.title)).map((topic) => ({
|
|
12
17
|
input: { slug: topic.slug },
|
|
@@ -4,4 +4,4 @@ export declare const BLOG_POST_BY_SLUG_QUERY = "\n #graphql\n \n #graphql\n
|
|
|
4
4
|
export declare const BLOG_COLLECTION_BY_SLUG_QUERY = "\n #graphql\n query BlogCollectionBySlug($slug: String!, $locales: [Locale!]!) {\n blogCollection(where: { slug: $slug }, locales: $locales) {\n id\n slug\n title\n }\n }\n";
|
|
5
5
|
export declare const BLOG_COLLECTIONS_QUERY = "\n #graphql\n query BlogCollections($locales: [Locale!]!) {\n blogCollections(locales: $locales) {\n slug\n title\n }\n }\n";
|
|
6
6
|
export declare const BLOG_TOPIC_BY_SLUG_QUERY = "\n #graphql\n query BlogTopicBySlug($slug: String!, $locales: [Locale!]!) {\n topic(where: { slug: $slug }, locales: $locales) {\n id\n slug\n title\n }\n }\n";
|
|
7
|
-
export declare const BLOG_TOPICS_QUERY = "\n #graphql\n query BlogTopics($locales: [Locale!]
|
|
7
|
+
export declare const BLOG_TOPICS_QUERY = "\n #graphql\n query BlogTopics($locales: [Locale!]!, $first: Int, $where: TopicWhereInput) {\n topics(locales: $locales, first: $first, where: $where) {\n slug\n title\n }\n }\n";
|
|
@@ -120,8 +120,8 @@ export const BLOG_TOPICS_QUERY = (
|
|
|
120
120
|
/* GraphQL */
|
|
121
121
|
`
|
|
122
122
|
#graphql
|
|
123
|
-
query BlogTopics($locales: [Locale!]
|
|
124
|
-
topics(locales: $locales) {
|
|
123
|
+
query BlogTopics($locales: [Locale!]!, $first: Int, $where: TopicWhereInput) {
|
|
124
|
+
topics(locales: $locales, first: $first, where: $where) {
|
|
125
125
|
slug
|
|
126
126
|
title
|
|
127
127
|
}
|