@laioutr/app-hygraph 1.7.0 → 1.7.2
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 +1 -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/hygraph-utils/mediaMapper.js +2 -1
- package/dist/runtime/server/orchestr/blog/blogTopic.resolver.d.ts +2 -0
- package/dist/runtime/server/orchestr/blog/blogTopic.resolver.js +22 -0
- package/dist/runtime/server/orchestr/blog/blogTopicBySlug.query.d.ts +2 -0
- package/dist/runtime/server/orchestr/blog/blogTopicBySlug.query.js +22 -0
- package/dist/runtime/server/orchestr/blog/blogTopicBySlug.template.d.ts +2 -0
- package/dist/runtime/server/orchestr/blog/blogTopicBySlug.template.js +16 -0
- package/dist/runtime/server/orchestr/blog/blogTopicPosts.link.d.ts +2 -0
- package/dist/runtime/server/orchestr/blog/blogTopicPosts.link.js +33 -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 +42 -0
- package/dist/runtime/shared/tokens/blog-topic.js +32 -0
- package/package.json +16 -17
|
@@ -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) => {
|
|
@@ -11,7 +11,8 @@ export const mapHygraphMedia = (asset) => {
|
|
|
11
11
|
src: asset.url,
|
|
12
12
|
width: asset.width ?? void 0,
|
|
13
13
|
height: asset.height ?? void 0,
|
|
14
|
-
|
|
14
|
+
// Full MIME type (e.g. `video/mp4`) — the frontend binds this to `<source type>`.
|
|
15
|
+
format: mimeType
|
|
15
16
|
}
|
|
16
17
|
],
|
|
17
18
|
alt: filenameToAlt(asset.fileName)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BlogTopicBase } from "../../../shared/tokens/blog-topic.js";
|
|
2
|
+
import { blogTopicToken } from "../../const/passthroughTokens.js";
|
|
3
|
+
import { defineHygraph } from "../../middleware/defineHygraph.js";
|
|
4
|
+
export default defineHygraph.componentResolver({
|
|
5
|
+
entityType: "BlogTopic",
|
|
6
|
+
label: "Blog Topic",
|
|
7
|
+
provides: [BlogTopicBase],
|
|
8
|
+
resolve: async ({ passthrough, $entity }) => {
|
|
9
|
+
const topic = passthrough.require(blogTopicToken);
|
|
10
|
+
return {
|
|
11
|
+
entities: [
|
|
12
|
+
$entity({
|
|
13
|
+
id: topic.id,
|
|
14
|
+
base: {
|
|
15
|
+
slug: topic.slug,
|
|
16
|
+
title: topic.title
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BlogTopicBySlug, BlogTopicBySlugNotFoundError } from "../../../shared/tokens/blog-topic.js";
|
|
2
|
+
import { blogTopicToken } 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: BlogTopicBySlug,
|
|
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
|
+
throw new BlogTopicBySlugNotFoundError(input.slug);
|
|
16
|
+
}
|
|
17
|
+
passthrough.set(blogTopicToken, topic);
|
|
18
|
+
return {
|
|
19
|
+
id: topic.id
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BlogTopicBySlug } 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: BlogTopicBySlug,
|
|
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.map((topic) => ({
|
|
12
|
+
input: { slug: topic.slug },
|
|
13
|
+
label: topic.title
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BlogTopicPostsLink } from "../../../shared/tokens/blog-topic.js";
|
|
2
|
+
import { blogPostsToken } from "../../const/passthroughTokens.js";
|
|
3
|
+
import { resolveHygraphLocales } from "../../hygraph-utils/locale.js";
|
|
4
|
+
import { defineHygraph } from "../../middleware/defineHygraph.js";
|
|
5
|
+
import { BLOGS_BY_TOPIC_QUERY } from "../../queries/blog.js";
|
|
6
|
+
export default defineHygraph.linkHandler({
|
|
7
|
+
implements: BlogTopicPostsLink,
|
|
8
|
+
run: async ({ context, entityIds, pagination, passthrough, clientEnv }) => {
|
|
9
|
+
const locales = resolveHygraphLocales(clientEnv.locale);
|
|
10
|
+
const results = await Promise.all(
|
|
11
|
+
entityIds.map(
|
|
12
|
+
(id) => context.hygraph.request(BLOGS_BY_TOPIC_QUERY, {
|
|
13
|
+
skip: pagination.offset,
|
|
14
|
+
first: pagination.limit,
|
|
15
|
+
topicId: id,
|
|
16
|
+
locales
|
|
17
|
+
})
|
|
18
|
+
)
|
|
19
|
+
);
|
|
20
|
+
const allPosts = results.flatMap((r) => r.data.blogs);
|
|
21
|
+
passthrough.set(blogPostsToken, allPosts);
|
|
22
|
+
return {
|
|
23
|
+
links: entityIds.map((id, i) => {
|
|
24
|
+
const data = results.at(i)?.data;
|
|
25
|
+
return {
|
|
26
|
+
sourceId: id,
|
|
27
|
+
targetIds: data?.blogs.map((blog) => blog.id) ?? [],
|
|
28
|
+
entityTotal: data?.blogsConnection.aggregate.count ?? data?.blogs.length ?? 0
|
|
29
|
+
};
|
|
30
|
+
})
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
});
|
|
@@ -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,42 @@
|
|
|
1
|
+
import z from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* Local stand-ins for the blog-topic tokens that do not exist in
|
|
4
|
+
* `@laioutr-core/canonical-types` yet (neither `entity/blog-topic` nor the
|
|
5
|
+
* topic tokens on `/blog`). These mirror the published blog-collection
|
|
6
|
+
* equivalents one-to-one, so they can be lifted into the package unchanged
|
|
7
|
+
* once it grows a topic surface.
|
|
8
|
+
*/
|
|
9
|
+
export declare const BlogTopicBase: import("@laioutr-core/core-types/orchestr").EntityComponentToken<{
|
|
10
|
+
name: "base";
|
|
11
|
+
} & {
|
|
12
|
+
readonly entityType: "BlogTopic";
|
|
13
|
+
readonly schema: z.ZodObject<{
|
|
14
|
+
slug: z.ZodString;
|
|
15
|
+
title: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const BlogTopicBySlug: import("@laioutr-core/core-types/orchestr").QueryToken<{
|
|
19
|
+
name: "blog/topic/by-slug";
|
|
20
|
+
} & {
|
|
21
|
+
entity: string;
|
|
22
|
+
type: "single";
|
|
23
|
+
label: string;
|
|
24
|
+
input: z.ZodObject<{
|
|
25
|
+
slug: z.ZodString;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
}>;
|
|
28
|
+
export declare class BlogTopicBySlugNotFoundError extends Error {
|
|
29
|
+
static code: string;
|
|
30
|
+
readonly code: string;
|
|
31
|
+
readonly slug: string;
|
|
32
|
+
constructor(slug: string);
|
|
33
|
+
}
|
|
34
|
+
export declare const BlogTopicPostsLink: import("@laioutr-core/core-types/orchestr").LinkToken<{
|
|
35
|
+
name: "blog/topic/posts";
|
|
36
|
+
} & {
|
|
37
|
+
readonly label: "Blog topic posts";
|
|
38
|
+
readonly source: "BlogTopic";
|
|
39
|
+
readonly target: "BlogPost";
|
|
40
|
+
readonly type: "multi";
|
|
41
|
+
readonly defaultLimit: 12;
|
|
42
|
+
}>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import z from "zod/v4";
|
|
2
|
+
import { defineEntityComponentToken, defineLinkToken, defineQueryToken } from "@laioutr-core/core-types/orchestr";
|
|
3
|
+
export const BlogTopicBase = defineEntityComponentToken("base", {
|
|
4
|
+
entityType: "BlogTopic",
|
|
5
|
+
schema: z.object({
|
|
6
|
+
slug: z.string(),
|
|
7
|
+
title: z.string()
|
|
8
|
+
})
|
|
9
|
+
});
|
|
10
|
+
export const BlogTopicBySlug = defineQueryToken("blog/topic/by-slug", {
|
|
11
|
+
entity: "BlogTopic",
|
|
12
|
+
type: "single",
|
|
13
|
+
label: "Blog topic by slug",
|
|
14
|
+
input: z.object({ slug: z.string() })
|
|
15
|
+
});
|
|
16
|
+
export class BlogTopicBySlugNotFoundError extends Error {
|
|
17
|
+
static code = "BLOG_TOPIC_NOT_FOUND";
|
|
18
|
+
code = BlogTopicBySlugNotFoundError.code;
|
|
19
|
+
slug;
|
|
20
|
+
constructor(slug) {
|
|
21
|
+
super(`Blog Topic with slug ${slug} not found`);
|
|
22
|
+
this.name = "BlogTopicBySlugNotFoundError";
|
|
23
|
+
this.slug = slug;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export const BlogTopicPostsLink = defineLinkToken("blog/topic/posts", {
|
|
27
|
+
label: "Blog topic posts",
|
|
28
|
+
source: "BlogTopic",
|
|
29
|
+
target: "BlogPost",
|
|
30
|
+
type: "multi",
|
|
31
|
+
defaultLimit: 12
|
|
32
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laioutr/app-hygraph",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Laioutr Hygraph App",
|
|
5
5
|
"repository": "your-org/@laioutr/app-hygraph",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,17 +43,6 @@
|
|
|
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
|
-
},
|
|
57
46
|
"dependencies": {
|
|
58
47
|
"@nuxt/kit": "3.16.2",
|
|
59
48
|
"zod": "3.25.61"
|
|
@@ -86,10 +75,10 @@
|
|
|
86
75
|
},
|
|
87
76
|
"peerDependencies": {
|
|
88
77
|
"@graphql-codegen/cli": "^6.0.0",
|
|
89
|
-
"@laioutr-core/canonical-types": ">=0.
|
|
90
|
-
"@laioutr-core/core-types": ">=0.
|
|
91
|
-
"@laioutr-core/frontend-core": ">=0.
|
|
92
|
-
"@laioutr-core/kit": ">=0.
|
|
78
|
+
"@laioutr-core/canonical-types": ">=0.25.0",
|
|
79
|
+
"@laioutr-core/core-types": ">=0.33.1",
|
|
80
|
+
"@laioutr-core/frontend-core": ">=0.33.1",
|
|
81
|
+
"@laioutr-core/kit": ">=0.33.1",
|
|
93
82
|
"graphql": "^16.0.0"
|
|
94
83
|
},
|
|
95
84
|
"peerDependenciesMeta": {
|
|
@@ -103,5 +92,15 @@
|
|
|
103
92
|
"engines": {
|
|
104
93
|
"node": ">=22.12.0",
|
|
105
94
|
"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"
|
|
106
105
|
}
|
|
107
|
-
}
|
|
106
|
+
}
|