@laioutr/app-hygraph 1.7.1 → 1.8.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/const/passthroughTokens.d.ts +6 -0
- package/dist/runtime/server/const/passthroughTokens.js +1 -0
- package/dist/runtime/server/generated/graphql.d.ts +5426 -932
- package/dist/runtime/server/generated/graphql.js +115 -0
- package/dist/runtime/server/orchestr/blog/blogCollectionPosts.link.js +18 -8
- package/dist/runtime/server/orchestr/blog/blogPostsByTopic.query.d.ts +2 -0
- package/dist/runtime/server/orchestr/blog/blogPostsByTopic.query.js +27 -0
- package/dist/runtime/server/orchestr/blog/blogPostsByTopic.template.d.ts +2 -0
- package/dist/runtime/server/orchestr/blog/blogPostsByTopic.template.js +16 -0
- package/dist/runtime/server/queries/blog.d.ts +3 -0
- package/dist/runtime/server/queries/blog.js +48 -0
- package/dist/runtime/shared/tokens/blog-topic.d.ts +21 -0
- package/dist/runtime/shared/tokens/blog-topic.js +8 -0
- package/package.json +17 -16
|
@@ -28,6 +28,21 @@ export var AssetUploadStatus = /* @__PURE__ */ ((AssetUploadStatus2) => {
|
|
|
28
28
|
AssetUploadStatus2["AssetUploadComplete"] = "ASSET_UPLOAD_COMPLETE";
|
|
29
29
|
return AssetUploadStatus2;
|
|
30
30
|
})(AssetUploadStatus || {});
|
|
31
|
+
export var AudienceOrderByInput = /* @__PURE__ */ ((AudienceOrderByInput2) => {
|
|
32
|
+
AudienceOrderByInput2["CreatedAtAsc"] = "createdAt_ASC";
|
|
33
|
+
AudienceOrderByInput2["CreatedAtDesc"] = "createdAt_DESC";
|
|
34
|
+
AudienceOrderByInput2["IdAsc"] = "id_ASC";
|
|
35
|
+
AudienceOrderByInput2["IdDesc"] = "id_DESC";
|
|
36
|
+
AudienceOrderByInput2["PublishedAtAsc"] = "publishedAt_ASC";
|
|
37
|
+
AudienceOrderByInput2["PublishedAtDesc"] = "publishedAt_DESC";
|
|
38
|
+
AudienceOrderByInput2["SlugAsc"] = "slug_ASC";
|
|
39
|
+
AudienceOrderByInput2["SlugDesc"] = "slug_DESC";
|
|
40
|
+
AudienceOrderByInput2["TitleAsc"] = "title_ASC";
|
|
41
|
+
AudienceOrderByInput2["TitleDesc"] = "title_DESC";
|
|
42
|
+
AudienceOrderByInput2["UpdatedAtAsc"] = "updatedAt_ASC";
|
|
43
|
+
AudienceOrderByInput2["UpdatedAtDesc"] = "updatedAt_DESC";
|
|
44
|
+
return AudienceOrderByInput2;
|
|
45
|
+
})(AudienceOrderByInput || {});
|
|
31
46
|
export var BlogCollectionOrderByInput = /* @__PURE__ */ ((BlogCollectionOrderByInput2) => {
|
|
32
47
|
BlogCollectionOrderByInput2["CreatedAtAsc"] = "createdAt_ASC";
|
|
33
48
|
BlogCollectionOrderByInput2["CreatedAtDesc"] = "createdAt_DESC";
|
|
@@ -48,6 +63,12 @@ export var BlogOrderByInput = /* @__PURE__ */ ((BlogOrderByInput2) => {
|
|
|
48
63
|
BlogOrderByInput2["CreatedAtDesc"] = "createdAt_DESC";
|
|
49
64
|
BlogOrderByInput2["IdAsc"] = "id_ASC";
|
|
50
65
|
BlogOrderByInput2["IdDesc"] = "id_DESC";
|
|
66
|
+
BlogOrderByInput2["MetaDescriptionAsc"] = "metaDescription_ASC";
|
|
67
|
+
BlogOrderByInput2["MetaDescriptionDesc"] = "metaDescription_DESC";
|
|
68
|
+
BlogOrderByInput2["MetaKeywordsAsc"] = "metaKeywords_ASC";
|
|
69
|
+
BlogOrderByInput2["MetaKeywordsDesc"] = "metaKeywords_DESC";
|
|
70
|
+
BlogOrderByInput2["MetaTitleAsc"] = "metaTitle_ASC";
|
|
71
|
+
BlogOrderByInput2["MetaTitleDesc"] = "metaTitle_DESC";
|
|
51
72
|
BlogOrderByInput2["PublishedAtAsc"] = "publishedAt_ASC";
|
|
52
73
|
BlogOrderByInput2["PublishedAtDesc"] = "publishedAt_DESC";
|
|
53
74
|
BlogOrderByInput2["SlugAsc"] = "slug_ASC";
|
|
@@ -58,6 +79,50 @@ export var BlogOrderByInput = /* @__PURE__ */ ((BlogOrderByInput2) => {
|
|
|
58
79
|
BlogOrderByInput2["UpdatedAtDesc"] = "updatedAt_DESC";
|
|
59
80
|
return BlogOrderByInput2;
|
|
60
81
|
})(BlogOrderByInput || {});
|
|
82
|
+
export var BlueprintCollectionOrderByInput = /* @__PURE__ */ ((BlueprintCollectionOrderByInput2) => {
|
|
83
|
+
BlueprintCollectionOrderByInput2["CreatedAtAsc"] = "createdAt_ASC";
|
|
84
|
+
BlueprintCollectionOrderByInput2["CreatedAtDesc"] = "createdAt_DESC";
|
|
85
|
+
BlueprintCollectionOrderByInput2["IdAsc"] = "id_ASC";
|
|
86
|
+
BlueprintCollectionOrderByInput2["IdDesc"] = "id_DESC";
|
|
87
|
+
BlueprintCollectionOrderByInput2["NameAsc"] = "name_ASC";
|
|
88
|
+
BlueprintCollectionOrderByInput2["NameDesc"] = "name_DESC";
|
|
89
|
+
BlueprintCollectionOrderByInput2["OrderAsc"] = "order_ASC";
|
|
90
|
+
BlueprintCollectionOrderByInput2["OrderDesc"] = "order_DESC";
|
|
91
|
+
BlueprintCollectionOrderByInput2["PublishedAtAsc"] = "publishedAt_ASC";
|
|
92
|
+
BlueprintCollectionOrderByInput2["PublishedAtDesc"] = "publishedAt_DESC";
|
|
93
|
+
BlueprintCollectionOrderByInput2["SlugAsc"] = "slug_ASC";
|
|
94
|
+
BlueprintCollectionOrderByInput2["SlugDesc"] = "slug_DESC";
|
|
95
|
+
BlueprintCollectionOrderByInput2["UpdatedAtAsc"] = "updatedAt_ASC";
|
|
96
|
+
BlueprintCollectionOrderByInput2["UpdatedAtDesc"] = "updatedAt_DESC";
|
|
97
|
+
return BlueprintCollectionOrderByInput2;
|
|
98
|
+
})(BlueprintCollectionOrderByInput || {});
|
|
99
|
+
export var BlueprintOrderByInput = /* @__PURE__ */ ((BlueprintOrderByInput2) => {
|
|
100
|
+
BlueprintOrderByInput2["CreatedAtAsc"] = "createdAt_ASC";
|
|
101
|
+
BlueprintOrderByInput2["CreatedAtDesc"] = "createdAt_DESC";
|
|
102
|
+
BlueprintOrderByInput2["DemoUrlAsc"] = "demoUrl_ASC";
|
|
103
|
+
BlueprintOrderByInput2["DemoUrlDesc"] = "demoUrl_DESC";
|
|
104
|
+
BlueprintOrderByInput2["DescriptionAsc"] = "description_ASC";
|
|
105
|
+
BlueprintOrderByInput2["DescriptionDesc"] = "description_DESC";
|
|
106
|
+
BlueprintOrderByInput2["FeaturesAsc"] = "features_ASC";
|
|
107
|
+
BlueprintOrderByInput2["FeaturesDesc"] = "features_DESC";
|
|
108
|
+
BlueprintOrderByInput2["IdAsc"] = "id_ASC";
|
|
109
|
+
BlueprintOrderByInput2["IdDesc"] = "id_DESC";
|
|
110
|
+
BlueprintOrderByInput2["MetaDescriptionAsc"] = "metaDescription_ASC";
|
|
111
|
+
BlueprintOrderByInput2["MetaDescriptionDesc"] = "metaDescription_DESC";
|
|
112
|
+
BlueprintOrderByInput2["MetaTitleAsc"] = "metaTitle_ASC";
|
|
113
|
+
BlueprintOrderByInput2["MetaTitleDesc"] = "metaTitle_DESC";
|
|
114
|
+
BlueprintOrderByInput2["NameAsc"] = "name_ASC";
|
|
115
|
+
BlueprintOrderByInput2["NameDesc"] = "name_DESC";
|
|
116
|
+
BlueprintOrderByInput2["PublishedAtAsc"] = "publishedAt_ASC";
|
|
117
|
+
BlueprintOrderByInput2["PublishedAtDesc"] = "publishedAt_DESC";
|
|
118
|
+
BlueprintOrderByInput2["SlugAsc"] = "slug_ASC";
|
|
119
|
+
BlueprintOrderByInput2["SlugDesc"] = "slug_DESC";
|
|
120
|
+
BlueprintOrderByInput2["TaglineAsc"] = "tagline_ASC";
|
|
121
|
+
BlueprintOrderByInput2["TaglineDesc"] = "tagline_DESC";
|
|
122
|
+
BlueprintOrderByInput2["UpdatedAtAsc"] = "updatedAt_ASC";
|
|
123
|
+
BlueprintOrderByInput2["UpdatedAtDesc"] = "updatedAt_DESC";
|
|
124
|
+
return BlueprintOrderByInput2;
|
|
125
|
+
})(BlueprintOrderByInput || {});
|
|
61
126
|
export var DocumentFileTypes = /* @__PURE__ */ ((DocumentFileTypes2) => {
|
|
62
127
|
DocumentFileTypes2["AutoImage"] = "autoImage";
|
|
63
128
|
DocumentFileTypes2["Avif"] = "avif";
|
|
@@ -73,10 +138,15 @@ export var DocumentFileTypes = /* @__PURE__ */ ((DocumentFileTypes2) => {
|
|
|
73
138
|
})(DocumentFileTypes || {});
|
|
74
139
|
export var EntityTypeName = /* @__PURE__ */ ((EntityTypeName2) => {
|
|
75
140
|
EntityTypeName2["Asset"] = "Asset";
|
|
141
|
+
EntityTypeName2["Audience"] = "Audience";
|
|
76
142
|
EntityTypeName2["Blog"] = "Blog";
|
|
77
143
|
EntityTypeName2["BlogCollection"] = "BlogCollection";
|
|
144
|
+
EntityTypeName2["Blueprint"] = "Blueprint";
|
|
145
|
+
EntityTypeName2["BlueprintCollection"] = "BlueprintCollection";
|
|
78
146
|
EntityTypeName2["Event"] = "Event";
|
|
79
147
|
EntityTypeName2["EventCollection"] = "EventCollection";
|
|
148
|
+
EntityTypeName2["Format"] = "Format";
|
|
149
|
+
EntityTypeName2["Glossary"] = "Glossary";
|
|
80
150
|
EntityTypeName2["LearningResource"] = "LearningResource";
|
|
81
151
|
EntityTypeName2["LearningResourceCollection"] = "LearningResourceCollection";
|
|
82
152
|
EntityTypeName2["ScheduledOperation"] = "ScheduledOperation";
|
|
@@ -107,6 +177,10 @@ export var EventOrderByInput = /* @__PURE__ */ ((EventOrderByInput2) => {
|
|
|
107
177
|
EventOrderByInput2["EndDateDesc"] = "endDate_DESC";
|
|
108
178
|
EventOrderByInput2["IdAsc"] = "id_ASC";
|
|
109
179
|
EventOrderByInput2["IdDesc"] = "id_DESC";
|
|
180
|
+
EventOrderByInput2["MetaDescriptionAsc"] = "metaDescription_ASC";
|
|
181
|
+
EventOrderByInput2["MetaDescriptionDesc"] = "metaDescription_DESC";
|
|
182
|
+
EventOrderByInput2["MetaTitleAsc"] = "metaTitle_ASC";
|
|
183
|
+
EventOrderByInput2["MetaTitleDesc"] = "metaTitle_DESC";
|
|
110
184
|
EventOrderByInput2["PublishedAtAsc"] = "publishedAt_ASC";
|
|
111
185
|
EventOrderByInput2["PublishedAtDesc"] = "publishedAt_DESC";
|
|
112
186
|
EventOrderByInput2["SlugAsc"] = "slug_ASC";
|
|
@@ -119,6 +193,40 @@ export var EventOrderByInput = /* @__PURE__ */ ((EventOrderByInput2) => {
|
|
|
119
193
|
EventOrderByInput2["UpdatedAtDesc"] = "updatedAt_DESC";
|
|
120
194
|
return EventOrderByInput2;
|
|
121
195
|
})(EventOrderByInput || {});
|
|
196
|
+
export var FormatOrderByInput = /* @__PURE__ */ ((FormatOrderByInput2) => {
|
|
197
|
+
FormatOrderByInput2["CreatedAtAsc"] = "createdAt_ASC";
|
|
198
|
+
FormatOrderByInput2["CreatedAtDesc"] = "createdAt_DESC";
|
|
199
|
+
FormatOrderByInput2["IdAsc"] = "id_ASC";
|
|
200
|
+
FormatOrderByInput2["IdDesc"] = "id_DESC";
|
|
201
|
+
FormatOrderByInput2["PublishedAtAsc"] = "publishedAt_ASC";
|
|
202
|
+
FormatOrderByInput2["PublishedAtDesc"] = "publishedAt_DESC";
|
|
203
|
+
FormatOrderByInput2["SlugAsc"] = "slug_ASC";
|
|
204
|
+
FormatOrderByInput2["SlugDesc"] = "slug_DESC";
|
|
205
|
+
FormatOrderByInput2["TitleAsc"] = "title_ASC";
|
|
206
|
+
FormatOrderByInput2["TitleDesc"] = "title_DESC";
|
|
207
|
+
FormatOrderByInput2["UpdatedAtAsc"] = "updatedAt_ASC";
|
|
208
|
+
FormatOrderByInput2["UpdatedAtDesc"] = "updatedAt_DESC";
|
|
209
|
+
return FormatOrderByInput2;
|
|
210
|
+
})(FormatOrderByInput || {});
|
|
211
|
+
export var GlossaryOrderByInput = /* @__PURE__ */ ((GlossaryOrderByInput2) => {
|
|
212
|
+
GlossaryOrderByInput2["CreatedAtAsc"] = "createdAt_ASC";
|
|
213
|
+
GlossaryOrderByInput2["CreatedAtDesc"] = "createdAt_DESC";
|
|
214
|
+
GlossaryOrderByInput2["IdAsc"] = "id_ASC";
|
|
215
|
+
GlossaryOrderByInput2["IdDesc"] = "id_DESC";
|
|
216
|
+
GlossaryOrderByInput2["MetaDescriptionAsc"] = "metaDescription_ASC";
|
|
217
|
+
GlossaryOrderByInput2["MetaDescriptionDesc"] = "metaDescription_DESC";
|
|
218
|
+
GlossaryOrderByInput2["MetaTitleAsc"] = "metaTitle_ASC";
|
|
219
|
+
GlossaryOrderByInput2["MetaTitleDesc"] = "metaTitle_DESC";
|
|
220
|
+
GlossaryOrderByInput2["PublishedAtAsc"] = "publishedAt_ASC";
|
|
221
|
+
GlossaryOrderByInput2["PublishedAtDesc"] = "publishedAt_DESC";
|
|
222
|
+
GlossaryOrderByInput2["SlugAsc"] = "slug_ASC";
|
|
223
|
+
GlossaryOrderByInput2["SlugDesc"] = "slug_DESC";
|
|
224
|
+
GlossaryOrderByInput2["TitleAsc"] = "title_ASC";
|
|
225
|
+
GlossaryOrderByInput2["TitleDesc"] = "title_DESC";
|
|
226
|
+
GlossaryOrderByInput2["UpdatedAtAsc"] = "updatedAt_ASC";
|
|
227
|
+
GlossaryOrderByInput2["UpdatedAtDesc"] = "updatedAt_DESC";
|
|
228
|
+
return GlossaryOrderByInput2;
|
|
229
|
+
})(GlossaryOrderByInput || {});
|
|
122
230
|
export var ImageFit = /* @__PURE__ */ ((ImageFit2) => {
|
|
123
231
|
ImageFit2["Clip"] = "clip";
|
|
124
232
|
ImageFit2["Crop"] = "crop";
|
|
@@ -146,8 +254,14 @@ export var LearningResourceOrderByInput = /* @__PURE__ */ ((LearningResourceOrde
|
|
|
146
254
|
LearningResourceOrderByInput2["CreatedAtDesc"] = "createdAt_DESC";
|
|
147
255
|
LearningResourceOrderByInput2["HubspotFormIdAsc"] = "hubspotFormId_ASC";
|
|
148
256
|
LearningResourceOrderByInput2["HubspotFormIdDesc"] = "hubspotFormId_DESC";
|
|
257
|
+
LearningResourceOrderByInput2["HubspotPortalIdAsc"] = "hubspotPortalId_ASC";
|
|
258
|
+
LearningResourceOrderByInput2["HubspotPortalIdDesc"] = "hubspotPortalId_DESC";
|
|
149
259
|
LearningResourceOrderByInput2["IdAsc"] = "id_ASC";
|
|
150
260
|
LearningResourceOrderByInput2["IdDesc"] = "id_DESC";
|
|
261
|
+
LearningResourceOrderByInput2["MetaDescriptionAsc"] = "metaDescription_ASC";
|
|
262
|
+
LearningResourceOrderByInput2["MetaDescriptionDesc"] = "metaDescription_DESC";
|
|
263
|
+
LearningResourceOrderByInput2["MetaTitleAsc"] = "metaTitle_ASC";
|
|
264
|
+
LearningResourceOrderByInput2["MetaTitleDesc"] = "metaTitle_DESC";
|
|
151
265
|
LearningResourceOrderByInput2["PublishedAtAsc"] = "publishedAt_ASC";
|
|
152
266
|
LearningResourceOrderByInput2["PublishedAtDesc"] = "publishedAt_DESC";
|
|
153
267
|
LearningResourceOrderByInput2["SlugAsc"] = "slug_ASC";
|
|
@@ -161,6 +275,7 @@ export var LearningResourceOrderByInput = /* @__PURE__ */ ((LearningResourceOrde
|
|
|
161
275
|
export var Locale = /* @__PURE__ */ ((Locale2) => {
|
|
162
276
|
Locale2["De"] = "de";
|
|
163
277
|
Locale2["En"] = "en";
|
|
278
|
+
Locale2["Fr"] = "fr";
|
|
164
279
|
return Locale2;
|
|
165
280
|
})(Locale || {});
|
|
166
281
|
export var PartnerLevel = /* @__PURE__ */ ((PartnerLevel2) => {
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
import { BlogCollectionPostsLink } from "@laioutr-core/canonical-types/blog";
|
|
2
|
-
import { blogPostsToken } from "../../const/passthroughTokens.js";
|
|
2
|
+
import { blogPostsToken, blogPostsTopicSourceToken } from "../../const/passthroughTokens.js";
|
|
3
3
|
import { resolveHygraphLocales } from "../../hygraph-utils/locale.js";
|
|
4
4
|
import { defineHygraph } from "../../middleware/defineHygraph.js";
|
|
5
|
-
import { BLOGS_QUERY } from "../../queries/blog.js";
|
|
5
|
+
import { BLOGS_BY_TOPIC_QUERY, BLOGS_QUERY } from "../../queries/blog.js";
|
|
6
6
|
export default defineHygraph.linkHandler({
|
|
7
7
|
implements: BlogCollectionPostsLink,
|
|
8
8
|
run: async ({ context, entityIds, pagination, passthrough, clientEnv }) => {
|
|
9
9
|
const locales = resolveHygraphLocales(clientEnv.locale);
|
|
10
|
+
const topicSourceIds = passthrough.get(blogPostsTopicSourceToken);
|
|
10
11
|
const results = await Promise.all(
|
|
11
12
|
entityIds.map(
|
|
12
|
-
(id) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
(id) => (
|
|
14
|
+
// Ids exposed by the "Blog Posts by Topic" query are topic ids and must
|
|
15
|
+
// be filtered via the topic relation; all others are blog-collection ids.
|
|
16
|
+
topicSourceIds?.has(id) ? context.hygraph.request(BLOGS_BY_TOPIC_QUERY, {
|
|
17
|
+
skip: pagination.offset,
|
|
18
|
+
first: pagination.limit,
|
|
19
|
+
topicId: id,
|
|
20
|
+
locales
|
|
21
|
+
}) : context.hygraph.request(BLOGS_QUERY, {
|
|
22
|
+
skip: pagination.offset,
|
|
23
|
+
first: pagination.limit,
|
|
24
|
+
collectionId: id,
|
|
25
|
+
locales
|
|
26
|
+
})
|
|
27
|
+
)
|
|
18
28
|
)
|
|
19
29
|
);
|
|
20
30
|
const allPosts = results.flatMap((r) => r.data.blogs);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BlogPostsByTopic } from "../../../shared/tokens/blog-topic.js";
|
|
2
|
+
import { blogCollectionToken, blogPostsTopicSourceToken } from "../../const/passthroughTokens.js";
|
|
3
|
+
import { resolveHygraphLocales } from "../../hygraph-utils/locale.js";
|
|
4
|
+
import { defineHygraph } from "../../middleware/defineHygraph.js";
|
|
5
|
+
import { BLOG_TOPIC_BY_SLUG_QUERY } from "../../queries/blog.js";
|
|
6
|
+
export default defineHygraph.queryHandler({
|
|
7
|
+
implements: BlogPostsByTopic,
|
|
8
|
+
run: async ({ context, input, passthrough, clientEnv }) => {
|
|
9
|
+
const result = await context.hygraph.request(BLOG_TOPIC_BY_SLUG_QUERY, {
|
|
10
|
+
slug: input.slug,
|
|
11
|
+
locales: resolveHygraphLocales(clientEnv.locale)
|
|
12
|
+
});
|
|
13
|
+
const topic = result.data.topic;
|
|
14
|
+
if (!topic) {
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
passthrough.set(blogCollectionToken, {
|
|
18
|
+
id: topic.id,
|
|
19
|
+
slug: topic.slug ?? input.slug,
|
|
20
|
+
title: topic.title ?? topic.slug ?? input.slug
|
|
21
|
+
});
|
|
22
|
+
passthrough.set(blogPostsTopicSourceToken, /* @__PURE__ */ new Set([topic.id]));
|
|
23
|
+
return {
|
|
24
|
+
id: topic.id
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BlogPostsByTopic } from "../../../shared/tokens/blog-topic.js";
|
|
2
|
+
import { resolveHygraphLocales } from "../../hygraph-utils/locale.js";
|
|
3
|
+
import { defineHygraph } from "../../middleware/defineHygraph.js";
|
|
4
|
+
import { BLOG_TOPICS_QUERY } from "../../queries/blog.js";
|
|
5
|
+
export default defineHygraph.queryTemplateProvider({
|
|
6
|
+
for: BlogPostsByTopic,
|
|
7
|
+
run: async ({ context, clientEnv }) => {
|
|
8
|
+
const result = await context.hygraph.request(BLOG_TOPICS_QUERY, {
|
|
9
|
+
locales: resolveHygraphLocales(clientEnv.locale)
|
|
10
|
+
});
|
|
11
|
+
return result.data.topics.filter((topic) => Boolean(topic.slug && topic.title)).map((topic) => ({
|
|
12
|
+
input: { slug: topic.slug },
|
|
13
|
+
label: topic.title
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare const BLOGS_QUERY = "\n #graphql\n \n #graphql\n \n #graphql\n fragment Asset on Asset {\n url\n fileName\n mimeType\n width\n height\n handle\n }\n\n fragment Blog on Blog {\n id\n title\n slug\n content {\n html\n }\n image {\n ...Asset\n }\n publishedAt\n metaTitle\n metaDescription\n }\n\n query Blogs($skip: Int, $first: Int, $collectionId: ID, $locales: [Locale!]!) {\n blogs(\n skip: $skip\n first: $first\n orderBy: createdAt_DESC\n where: { blogCollection: { id: $collectionId } }\n locales: $locales\n ) {\n ...Blog\n }\n blogsConnection(where: { blogCollection: { id: $collectionId } }, locales: $locales) {\n aggregate {\n count\n }\n }\n }\n";
|
|
2
|
+
export declare const BLOGS_BY_TOPIC_QUERY = "\n #graphql\n \n #graphql\n \n #graphql\n fragment Asset on Asset {\n url\n fileName\n mimeType\n width\n height\n handle\n }\n\n fragment Blog on Blog {\n id\n title\n slug\n content {\n html\n }\n image {\n ...Asset\n }\n publishedAt\n metaTitle\n metaDescription\n }\n\n query BlogsByTopic($skip: Int, $first: Int, $topicId: ID, $locales: [Locale!]!) {\n blogs(\n skip: $skip\n first: $first\n orderBy: createdAt_DESC\n where: { topics_some: { id: $topicId } }\n locales: $locales\n ) {\n ...Blog\n }\n blogsConnection(where: { topics_some: { id: $topicId } }, locales: $locales) {\n aggregate {\n count\n }\n }\n }\n";
|
|
2
3
|
export declare const BLOG_POST_BY_SLUG_QUERY = "\n #graphql\n \n #graphql\n \n #graphql\n fragment Asset on Asset {\n url\n fileName\n mimeType\n width\n height\n handle\n }\n\n fragment Blog on Blog {\n id\n title\n slug\n content {\n html\n }\n image {\n ...Asset\n }\n publishedAt\n metaTitle\n metaDescription\n }\n\n query BlogPostBySlug($slug: String!, $locales: [Locale!]!) {\n blog(where: { slug: $slug }, locales: $locales) {\n ...Blog\n }\n }\n";
|
|
3
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";
|
|
4
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
|
+
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";
|
|
@@ -43,6 +43,29 @@ export const BLOGS_QUERY = (
|
|
|
43
43
|
}
|
|
44
44
|
`
|
|
45
45
|
);
|
|
46
|
+
export const BLOGS_BY_TOPIC_QUERY = (
|
|
47
|
+
/* GraphQL */
|
|
48
|
+
`
|
|
49
|
+
#graphql
|
|
50
|
+
${BlogFragment}
|
|
51
|
+
query BlogsByTopic($skip: Int, $first: Int, $topicId: ID, $locales: [Locale!]!) {
|
|
52
|
+
blogs(
|
|
53
|
+
skip: $skip
|
|
54
|
+
first: $first
|
|
55
|
+
orderBy: createdAt_DESC
|
|
56
|
+
where: { topics_some: { id: $topicId } }
|
|
57
|
+
locales: $locales
|
|
58
|
+
) {
|
|
59
|
+
...Blog
|
|
60
|
+
}
|
|
61
|
+
blogsConnection(where: { topics_some: { id: $topicId } }, locales: $locales) {
|
|
62
|
+
aggregate {
|
|
63
|
+
count
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`
|
|
68
|
+
);
|
|
46
69
|
export const BLOG_POST_BY_SLUG_QUERY = (
|
|
47
70
|
/* GraphQL */
|
|
48
71
|
`
|
|
@@ -80,3 +103,28 @@ export const BLOG_COLLECTIONS_QUERY = (
|
|
|
80
103
|
}
|
|
81
104
|
`
|
|
82
105
|
);
|
|
106
|
+
export const BLOG_TOPIC_BY_SLUG_QUERY = (
|
|
107
|
+
/* GraphQL */
|
|
108
|
+
`
|
|
109
|
+
#graphql
|
|
110
|
+
query BlogTopicBySlug($slug: String!, $locales: [Locale!]!) {
|
|
111
|
+
topic(where: { slug: $slug }, locales: $locales) {
|
|
112
|
+
id
|
|
113
|
+
slug
|
|
114
|
+
title
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
`
|
|
118
|
+
);
|
|
119
|
+
export const BLOG_TOPICS_QUERY = (
|
|
120
|
+
/* GraphQL */
|
|
121
|
+
`
|
|
122
|
+
#graphql
|
|
123
|
+
query BlogTopics($locales: [Locale!]!) {
|
|
124
|
+
topics(locales: $locales) {
|
|
125
|
+
slug
|
|
126
|
+
title
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
`
|
|
130
|
+
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import z from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* Exposes a blog topic AS a `BlogCollection` entity, so it appears in the
|
|
4
|
+
* existing BlogCollection-typed Studio query fields (e.g. "Blog Post Collection
|
|
5
|
+
* With Posts") and reuses the `blog/collection/posts` link — no `BlogTopic`
|
|
6
|
+
* entity and no ui-app changes required.
|
|
7
|
+
*
|
|
8
|
+
* The handler resolves the topic by slug and fills the blog-collection
|
|
9
|
+
* passthrough with the topic; the shared posts link then filters by the topic
|
|
10
|
+
* relation for this id (see `blogPostsTopicSourceToken`).
|
|
11
|
+
*/
|
|
12
|
+
export declare const BlogPostsByTopic: import("@laioutr-core/core-types/orchestr").QueryToken<{
|
|
13
|
+
name: "blog/posts-by-topic";
|
|
14
|
+
} & {
|
|
15
|
+
entity: string;
|
|
16
|
+
type: "single";
|
|
17
|
+
label: string;
|
|
18
|
+
input: z.ZodObject<{
|
|
19
|
+
slug: z.ZodString;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import z from "zod/v4";
|
|
2
|
+
import { defineQueryToken } from "@laioutr-core/core-types/orchestr";
|
|
3
|
+
export const BlogPostsByTopic = defineQueryToken("blog/posts-by-topic", {
|
|
4
|
+
entity: "BlogCollection",
|
|
5
|
+
type: "single",
|
|
6
|
+
label: "Blog Posts by Topic",
|
|
7
|
+
input: z.object({ slug: z.string() })
|
|
8
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laioutr/app-hygraph",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Laioutr Hygraph App",
|
|
5
5
|
"repository": "your-org/@laioutr/app-hygraph",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,6 +43,17 @@
|
|
|
43
43
|
"files": [
|
|
44
44
|
"dist"
|
|
45
45
|
],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"dev": "npm run dev:prepare && nuxi dev playground",
|
|
48
|
+
"dev:build": "nuxi build playground",
|
|
49
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
50
|
+
"lint": "eslint .",
|
|
51
|
+
"prepack": "nuxt-module-build build",
|
|
52
|
+
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish --access public && git push --follow-tags",
|
|
53
|
+
"test": "vitest run",
|
|
54
|
+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
55
|
+
"test:watch": "vitest watch"
|
|
56
|
+
},
|
|
46
57
|
"dependencies": {
|
|
47
58
|
"@nuxt/kit": "3.16.2",
|
|
48
59
|
"zod": "3.25.61"
|
|
@@ -75,10 +86,10 @@
|
|
|
75
86
|
},
|
|
76
87
|
"peerDependencies": {
|
|
77
88
|
"@graphql-codegen/cli": "^6.0.0",
|
|
78
|
-
"@laioutr-core/canonical-types": ">=0.
|
|
79
|
-
"@laioutr-core/core-types": ">=0.
|
|
80
|
-
"@laioutr-core/frontend-core": ">=0.
|
|
81
|
-
"@laioutr-core/kit": ">=0.
|
|
89
|
+
"@laioutr-core/canonical-types": ">=0.25.0",
|
|
90
|
+
"@laioutr-core/core-types": ">=0.33.1",
|
|
91
|
+
"@laioutr-core/frontend-core": ">=0.33.1",
|
|
92
|
+
"@laioutr-core/kit": ">=0.33.1",
|
|
82
93
|
"graphql": "^16.0.0"
|
|
83
94
|
},
|
|
84
95
|
"peerDependenciesMeta": {
|
|
@@ -92,15 +103,5 @@
|
|
|
92
103
|
"engines": {
|
|
93
104
|
"node": ">=22.12.0",
|
|
94
105
|
"pnpm": ">=10.15.0"
|
|
95
|
-
},
|
|
96
|
-
"scripts": {
|
|
97
|
-
"dev": "npm run dev:prepare && nuxi dev playground",
|
|
98
|
-
"dev:build": "nuxi build playground",
|
|
99
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
100
|
-
"lint": "eslint .",
|
|
101
|
-
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish --access public && git push --follow-tags",
|
|
102
|
-
"test": "vitest run",
|
|
103
|
-
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
104
|
-
"test:watch": "vitest watch"
|
|
105
106
|
}
|
|
106
|
-
}
|
|
107
|
+
}
|