@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laioutr/app-hygraph",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "configKey": "@laioutr/app-hygraph",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
package/dist/module.mjs CHANGED
@@ -3,7 +3,7 @@ import { defu } from 'defu';
3
3
  import { registerLaioutrApp } from '@laioutr-core/kit';
4
4
 
5
5
  const name = "@laioutr/app-hygraph";
6
- const version = "1.8.0";
6
+ const version = "1.9.0";
7
7
 
8
8
  const module = defineNuxtModule({
9
9
  meta: {
@@ -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!]!) {\n topics(locales: $locales) {\n slug\n title\n }\n }\n";
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laioutr/app-hygraph",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Laioutr Hygraph App",
5
5
  "repository": "your-org/@laioutr/app-hygraph",
6
6
  "license": "MIT",