@rxdrag/website-lib-core 0.0.127 → 0.0.128

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.
Files changed (138) hide show
  1. package/README.md +1 -1
  2. package/index.ts +1 -1
  3. package/package.json +4 -4
  4. package/src/astro/animation.ts +146 -146
  5. package/src/astro/background.ts +82 -86
  6. package/src/astro/base.ts +7 -0
  7. package/src/astro/business.ts +13 -0
  8. package/src/astro/grid/consts.ts +80 -80
  9. package/src/astro/grid/index.ts +2 -2
  10. package/src/astro/grid/types.ts +35 -35
  11. package/src/astro/image.ts +239 -239
  12. package/src/astro/index.ts +12 -10
  13. package/src/astro/link.ts +20 -21
  14. package/src/astro/media.ts +123 -123
  15. package/src/astro/nav.ts +13 -13
  16. package/src/astro/section/index.ts +7 -12
  17. package/src/component-logic/index.ts +1 -1
  18. package/src/component-logic/link-client.ts +32 -32
  19. package/src/component-logic/link.ts +61 -61
  20. package/src/design-tokens.ts +160 -160
  21. package/src/entify/Entify.ts +533 -530
  22. package/src/entify/IEntify.ts +151 -177
  23. package/src/entify/index.ts +4 -4
  24. package/src/entify/lib/collectCategoryIds.ts +20 -20
  25. package/src/entify/lib/fulltextSearch.ts +63 -62
  26. package/src/entify/lib/langFields.ts +14 -14
  27. package/src/entify/lib/listToTree.ts +23 -23
  28. package/src/entify/lib/newAvatarQueryOptions.ts +4 -4
  29. package/src/entify/lib/newOgImageQueryOptions.ts +5 -5
  30. package/src/entify/lib/newQueryPostOptions.ts +42 -45
  31. package/src/entify/lib/newQueryProductOptions.ts +96 -98
  32. package/src/entify/lib/newQueryProductsMediaOptions.ts +28 -28
  33. package/src/entify/lib/queryAllProducts.ts +40 -40
  34. package/src/entify/lib/queryBulletin.ts +28 -16
  35. package/src/entify/lib/queryEntityList.ts +41 -41
  36. package/src/entify/lib/queryFeaturedProducts.ts +69 -68
  37. package/src/entify/lib/queryLangs.ts +36 -60
  38. package/src/entify/lib/queryLatestPosts.ts +92 -91
  39. package/src/entify/lib/queryOneEntity.ts +63 -63
  40. package/src/entify/lib/queryOneMedia.ts +27 -27
  41. package/src/entify/lib/queryOnePostById.ts +21 -21
  42. package/src/entify/lib/queryOnePostBySlug.ts +40 -39
  43. package/src/entify/lib/queryOnePostCategoryBySlug.ts +35 -35
  44. package/src/entify/lib/queryOneProductById.ts +20 -20
  45. package/src/entify/lib/queryOneProductBySlug.ts +53 -52
  46. package/src/entify/lib/queryOneProductCategoryBySlug.ts +50 -49
  47. package/src/entify/lib/queryOneTheme.ts +54 -72
  48. package/src/entify/lib/queryOneUser.ts +38 -38
  49. package/src/entify/lib/queryPostCategories.ts +67 -67
  50. package/src/entify/lib/queryPostSlugs.ts +37 -37
  51. package/src/entify/lib/queryPosts.ts +175 -174
  52. package/src/entify/lib/queryProductCategories.ts +59 -59
  53. package/src/entify/lib/queryProducts.ts +145 -144
  54. package/src/entify/lib/queryProductsInMenu.ts +45 -45
  55. package/src/entify/lib/queryTagCategories.ts +58 -58
  56. package/src/entify/lib/queryTags.ts +57 -57
  57. package/src/entify/lib/queryUserIds.ts +24 -24
  58. package/src/entify/lib/queryUserPosts.ts +80 -79
  59. package/src/entify/lib/queryWebSiteSettings.ts +28 -28
  60. package/src/entify/lib/queryWebsite.ts +43 -43
  61. package/src/entify/lib/sendEmail.ts +7 -7
  62. package/src/entify/lib/toQueryOptions.ts +19 -19
  63. package/src/entify/lib/upsertEntity.ts +8 -8
  64. package/src/entify/types/index.ts +1 -1
  65. package/src/entify/types/utils.ts +11 -6
  66. package/src/entify/types/variables.ts +5 -6
  67. package/src/entify/view-model/funcs.ts +230 -230
  68. package/src/entify/view-model/index.ts +1 -1
  69. package/src/entify/view-model/models.ts +135 -135
  70. package/src/global.d.ts +7 -7
  71. package/src/index.ts +8 -8
  72. package/src/lib/formatDate.ts +15 -15
  73. package/src/lib/index.ts +3 -3
  74. package/src/lib/pagination.ts +114 -114
  75. package/src/lib/utils.ts +135 -135
  76. package/src/react/components/Analytics/eventHandlers.ts +173 -173
  77. package/src/react/components/Analytics/index.tsx +21 -21
  78. package/src/react/components/Analytics/singleton.ts +214 -214
  79. package/src/react/components/Analytics/tracking.ts +221 -221
  80. package/src/react/components/Analytics/types.ts +60 -60
  81. package/src/react/components/Analytics/utils.ts +95 -95
  82. package/src/react/components/AttachmentIcon/index.tsx +53 -53
  83. package/src/react/components/BackgroundHlsVideoPlayer.tsx +97 -97
  84. package/src/react/components/BackgroundVideoPlayer.tsx +32 -32
  85. package/src/react/components/Bulletin.tsx +30 -30
  86. package/src/react/components/ContactForm/ContactForm.tsx +289 -289
  87. package/src/react/components/ContactForm/Input.tsx +48 -48
  88. package/src/react/components/ContactForm/Input2.tsx +59 -59
  89. package/src/react/components/ContactForm/Submit.tsx +48 -48
  90. package/src/react/components/ContactForm/TelInput.tsx +215 -215
  91. package/src/react/components/ContactForm/Textarea.tsx +48 -48
  92. package/src/react/components/ContactForm/Textarea2.tsx +89 -89
  93. package/src/react/components/ContactForm/funcs.ts +64 -64
  94. package/src/react/components/ContactForm/index.ts +7 -7
  95. package/src/react/components/ContactForm/types.ts +68 -68
  96. package/src/react/components/GoogleConsent/CookieItemPanel.tsx +80 -80
  97. package/src/react/components/GoogleConsent/CumtomizedModal.tsx +148 -148
  98. package/src/react/components/GoogleConsent/GoogleConsent.tsx +100 -100
  99. package/src/react/components/GoogleConsent/gtags.ts +67 -67
  100. package/src/react/components/GoogleConsent/index.ts +2 -2
  101. package/src/react/components/GoogleConsent/types.ts +18 -18
  102. package/src/react/components/GoogleConsent//345/217/202/350/200/203.md +4 -4
  103. package/src/react/components/Icon/index.tsx +19 -19
  104. package/src/react/components/Medias/MainMedia.tsx +257 -257
  105. package/src/react/components/Medias/Thumbnail.tsx +62 -62
  106. package/src/react/components/Medias/VideoPlayer.tsx +114 -114
  107. package/src/react/components/Medias/index.tsx +271 -271
  108. package/src/react/components/ProductCard/ProductCard.tsx +24 -24
  109. package/src/react/components/ProductCard/ProductCta/index.tsx +28 -28
  110. package/src/react/components/ProductCard/ProductCta/style.css +3 -3
  111. package/src/react/components/ProductCard/ProductDescription/index.tsx +12 -12
  112. package/src/react/components/ProductCard/ProductDescription/style.css +5 -5
  113. package/src/react/components/ProductCard/ProductMedia/index.tsx +35 -35
  114. package/src/react/components/ProductCard/ProductMedia/style.css +5 -5
  115. package/src/react/components/ProductCard/ProductTitle/index.tsx +7 -7
  116. package/src/react/components/ProductCard/ProductTitle/style.css +3 -3
  117. package/src/react/components/ProductCard/ProductView.tsx +36 -36
  118. package/src/react/components/ProductCard/index.ts +4 -4
  119. package/src/react/components/ProductCard/useQueryProduct.ts +32 -32
  120. package/src/react/components/ReactModalTrigger.tsx +28 -28
  121. package/src/react/components/ReactVideoPlayer.tsx +29 -52
  122. package/src/react/components/RichTextOutline/index.tsx +75 -75
  123. package/src/react/components/RichTextOutline/useAnchorScroll.ts +23 -23
  124. package/src/react/components/Scroller.tsx +39 -39
  125. package/src/react/components/SearchInput.tsx +21 -21
  126. package/src/react/components/Share/index.tsx +86 -86
  127. package/src/react/components/Share/socials.tsx +79 -77
  128. package/src/react/components/Share//350/265/204/346/226/231.md +7 -7
  129. package/src/react/components/ToTop.tsx +72 -72
  130. package/src/react/components/VideoPlayIcon.tsx +43 -0
  131. package/src/react/components/all.ts +38 -38
  132. package/src/react/components/index.ts +16 -16
  133. package/src/robots.ts +4 -4
  134. package/src/entify/lib/newPageMetaOptions.ts +0 -18
  135. package/src/entify/lib/newQueryPageOptions.ts +0 -14
  136. package/src/entify/lib/queryOneIcon.ts +0 -27
  137. package/src/entify/lib/queryPageBySlug.ts +0 -43
  138. package/src/entify/lib/queryPageByType.ts +0 -44
@@ -1,57 +1,57 @@
1
- import {
2
- Tag,
3
- TagBoolExp,
4
- TagOrderBy,
5
- TagDistinctExp,
6
- TagFields,
7
- TagQueryOptions,
8
- TagAssciations,
9
- } from "@rxdrag/rxcms-models";
10
- import { queryEntityList } from "./queryEntityList";
11
- import { ListResult } from "@rxdrag/entify-lib";
12
- import { EnvVariables } from "../types";
13
- import { TTag } from "../view-model";
14
-
15
- export async function queryTags(envVariables: EnvVariables, categoryId?: string) {
16
- const whereCondition: TagBoolExp = {
17
- lang: {
18
- abbr: {
19
- _eq: envVariables.language,
20
- },
21
- },
22
- };
23
-
24
- if (categoryId) {
25
- whereCondition[TagAssciations.category] = {
26
- id: { _eq: categoryId },
27
- };
28
- }
29
-
30
- const result = await queryEntityList<
31
- Tag,
32
- TagBoolExp,
33
- TagOrderBy,
34
- TagDistinctExp
35
- >(
36
- new TagQueryOptions(
37
- [
38
- TagFields.id,
39
- TagFields.name,
40
- TagFields.color,
41
- ],
42
- {
43
- where: whereCondition,
44
- orderBy: [{ [TagFields.name]: "asc" }],
45
- }
46
- ).category(),
47
- envVariables
48
- );
49
-
50
- const typedResult = result as ListResult<TTag> | undefined;
51
-
52
- if (!typedResult) {
53
- return undefined;
54
- }
55
-
56
- return typedResult.items;
57
- }
1
+ import {
2
+ Tag,
3
+ TagBoolExp,
4
+ TagOrderBy,
5
+ TagDistinctExp,
6
+ TagFields,
7
+ TagQueryOptions,
8
+ TagAssciations,
9
+ } from "@rxdrag/rxcms-models";
10
+ import { queryEntityList } from "./queryEntityList";
11
+ import { ListResult } from "@rxdrag/entify-lib";
12
+ import { EnvVariables } from "../types";
13
+ import { TTag } from "../view-model";
14
+
15
+ export async function queryTags(envVariables: EnvVariables, categoryId: string | undefined, langAbbr: string) {
16
+ const whereCondition: TagBoolExp = {
17
+ lang: {
18
+ abbr: {
19
+ _eq: langAbbr,
20
+ },
21
+ },
22
+ };
23
+
24
+ if (categoryId) {
25
+ whereCondition[TagAssciations.category] = {
26
+ id: { _eq: categoryId },
27
+ };
28
+ }
29
+
30
+ const result = await queryEntityList<
31
+ Tag,
32
+ TagBoolExp,
33
+ TagOrderBy,
34
+ TagDistinctExp
35
+ >(
36
+ new TagQueryOptions(
37
+ [
38
+ TagFields.id,
39
+ TagFields.name,
40
+ TagFields.color,
41
+ ],
42
+ {
43
+ where: whereCondition,
44
+ orderBy: [{ [TagFields.name]: "asc" }],
45
+ }
46
+ ).category(),
47
+ envVariables
48
+ );
49
+
50
+ const typedResult = result as ListResult<TTag> | undefined;
51
+
52
+ if (!typedResult) {
53
+ return undefined;
54
+ }
55
+
56
+ return typedResult.items;
57
+ }
@@ -1,24 +1,24 @@
1
- import { ListResult } from "@rxdrag/entify-lib";
2
- import {
3
- User,
4
- UserBoolExp,
5
- UserDistinctExp,
6
- UserFields,
7
- UserOrderBy,
8
- UserQueryOptions,
9
- } from "@rxdrag/rxcms-models";
10
- import { EnvVariables } from "../types";
11
- import { TUser } from "../view-model";
12
- import { queryEntityList } from "./queryEntityList";
13
-
14
- export async function queryUserIds(envVariables: EnvVariables) {
15
- const queryOptions = new UserQueryOptions([UserFields.id]);
16
-
17
- const result = await queryEntityList<
18
- User,
19
- UserBoolExp,
20
- UserOrderBy,
21
- UserDistinctExp
22
- >(queryOptions, envVariables);
23
- return result as ListResult<TUser> | undefined;
24
- }
1
+ import { ListResult } from "@rxdrag/entify-lib";
2
+ import {
3
+ User,
4
+ UserBoolExp,
5
+ UserDistinctExp,
6
+ UserFields,
7
+ UserOrderBy,
8
+ UserQueryOptions,
9
+ } from "@rxdrag/rxcms-models";
10
+ import { EnvVariables } from "../types";
11
+ import { TUser } from "../view-model";
12
+ import { queryEntityList } from "./queryEntityList";
13
+
14
+ export async function queryUserIds(envVariables: EnvVariables) {
15
+ const queryOptions = new UserQueryOptions([UserFields.id]);
16
+
17
+ const result = await queryEntityList<
18
+ User,
19
+ UserBoolExp,
20
+ UserOrderBy,
21
+ UserDistinctExp
22
+ >(queryOptions, envVariables);
23
+ return result as ListResult<TUser> | undefined;
24
+ }
@@ -1,79 +1,80 @@
1
- import { ListResult } from "@rxdrag/entify-lib";
2
- import {
3
- PostBoolExp,
4
- PostOrderBy,
5
- PostDistinctExp,
6
- PostFields,
7
- Post,
8
- PostQueryOptions,
9
- MediaQueryOptions,
10
- PublishableStatus,
11
- PostAssciations,
12
- } from "@rxdrag/rxcms-models";
13
- import { queryEntityList } from "./queryEntityList";
14
- import { EnvVariables } from "../types";
15
- import { TPost } from "../view-model";
16
-
17
- export type UserPostsCondition = {
18
- userId: string;
19
- page?: number;
20
- pageSize?: number;
21
- };
22
-
23
- export async function queryUserPosts(
24
- pagination: UserPostsCondition,
25
- envVariables: EnvVariables
26
- ) {
27
- const { userId, page = 1, pageSize = 1000 } = pagination;
28
- const result = await queryEntityList<
29
- Post,
30
- PostBoolExp,
31
- PostOrderBy,
32
- PostDistinctExp
33
- >(
34
- new PostQueryOptions(
35
- [
36
- PostFields.id,
37
- PostFields.slug,
38
- PostFields.title,
39
- PostFields.description,
40
- PostFields.createdAt,
41
- PostFields.updatedAt,
42
- ],
43
- {
44
- offset: (page - 1) * pageSize,
45
- limit: pageSize,
46
- orderBy: [
47
- {
48
- //暂时按照更新时间排序
49
- updatedAt: "desc",
50
- },
51
- ],
52
- where: {
53
- [PostFields.status]: {
54
- _eq: PublishableStatus.published,
55
- },
56
- lang: {
57
- abbr: {
58
- _eq: envVariables.language,
59
- },
60
- },
61
- [PostAssciations.author]: {
62
- id: {
63
- _eq: userId,
64
- },
65
- },
66
- },
67
- }
68
- )
69
- .cover(
70
- new MediaQueryOptions().file([
71
- "thumbnail",
72
- "resize(width:480, height:180)",
73
- ])
74
- )
75
- .setNoQuery(!userId),
76
- envVariables
77
- );
78
- return result as ListResult<TPost> | undefined;
79
- }
1
+ import { ListResult } from "@rxdrag/entify-lib";
2
+ import {
3
+ PostBoolExp,
4
+ PostOrderBy,
5
+ PostDistinctExp,
6
+ PostFields,
7
+ Post,
8
+ PostQueryOptions,
9
+ MediaQueryOptions,
10
+ PublishableStatus,
11
+ PostAssciations,
12
+ } from "@rxdrag/rxcms-models";
13
+ import { queryEntityList } from "./queryEntityList";
14
+ import { EnvVariables } from "../types";
15
+ import { TPost } from "../view-model";
16
+
17
+ export type UserPostsCondition = {
18
+ userId: string;
19
+ page?: number;
20
+ pageSize?: number;
21
+ };
22
+
23
+ export async function queryUserPosts(
24
+ conditions: UserPostsCondition,
25
+ envVariables: EnvVariables,
26
+ langAbbr: string
27
+ ) {
28
+ const { userId, page = 1, pageSize = 1000 } = conditions;
29
+ const result = await queryEntityList<
30
+ Post,
31
+ PostBoolExp,
32
+ PostOrderBy,
33
+ PostDistinctExp
34
+ >(
35
+ new PostQueryOptions(
36
+ [
37
+ PostFields.id,
38
+ PostFields.slug,
39
+ PostFields.title,
40
+ PostFields.description,
41
+ PostFields.createdAt,
42
+ PostFields.updatedAt,
43
+ ],
44
+ {
45
+ offset: (page - 1) * pageSize,
46
+ limit: pageSize,
47
+ orderBy: [
48
+ {
49
+ //暂时按照更新时间排序
50
+ updatedAt: "desc",
51
+ },
52
+ ],
53
+ where: {
54
+ [PostFields.status]: {
55
+ _eq: PublishableStatus.published,
56
+ },
57
+ lang: {
58
+ abbr: {
59
+ _eq: langAbbr,
60
+ },
61
+ },
62
+ [PostAssciations.author]: {
63
+ id: {
64
+ _eq: userId,
65
+ },
66
+ },
67
+ },
68
+ }
69
+ )
70
+ .cover(
71
+ new MediaQueryOptions().file([
72
+ "thumbnail",
73
+ "resize(width:480, height:180)",
74
+ ])
75
+ )
76
+ .setNoQuery(!userId),
77
+ envVariables
78
+ );
79
+ return result as ListResult<TPost> | undefined;
80
+ }
@@ -1,28 +1,28 @@
1
- import {
2
- WebsiteSettings,
3
- WebsiteSettingsBoolExp,
4
- WebsiteSettingsOrderBy,
5
- WebsiteSettingsDistinctExp,
6
- WebsiteSettingsFields,
7
- WebsiteSettingsQueryOptions,
8
- } from "@rxdrag/rxcms-models";
9
- import { queryOneEntity } from "./queryOneEntity";
10
- import { EnvVariables } from "../types";
11
-
12
- export async function queryWebSiteSettings(envVariables: EnvVariables) {
13
- const result = await queryOneEntity<
14
- WebsiteSettings,
15
- WebsiteSettingsBoolExp,
16
- WebsiteSettingsOrderBy,
17
- WebsiteSettingsDistinctExp
18
- >(
19
- new WebsiteSettingsQueryOptions([
20
- WebsiteSettingsFields.noticeEmail,
21
- WebsiteSettingsFields.smtpConfig,
22
- WebsiteSettingsFields.replyToEmail,
23
- WebsiteSettingsFields.useCustomizedSmtp,
24
- ]),
25
- envVariables
26
- );
27
- return result;
28
- }
1
+ import {
2
+ WebsiteSettings,
3
+ WebsiteSettingsBoolExp,
4
+ WebsiteSettingsOrderBy,
5
+ WebsiteSettingsDistinctExp,
6
+ WebsiteSettingsFields,
7
+ WebsiteSettingsQueryOptions,
8
+ } from "@rxdrag/rxcms-models";
9
+ import { queryOneEntity } from "./queryOneEntity";
10
+ import { EnvVariables } from "../types";
11
+
12
+ export async function queryWebSiteSettings(envVariables: EnvVariables) {
13
+ const result = await queryOneEntity<
14
+ WebsiteSettings,
15
+ WebsiteSettingsBoolExp,
16
+ WebsiteSettingsOrderBy,
17
+ WebsiteSettingsDistinctExp
18
+ >(
19
+ new WebsiteSettingsQueryOptions([
20
+ WebsiteSettingsFields.noticeEmail,
21
+ WebsiteSettingsFields.smtpConfig,
22
+ WebsiteSettingsFields.replyToEmail,
23
+ WebsiteSettingsFields.useCustomizedSmtp,
24
+ ]),
25
+ envVariables
26
+ );
27
+ return result;
28
+ }
@@ -1,43 +1,43 @@
1
- import {
2
- Website,
3
- WebsiteBoolExp,
4
- WebsiteOrderBy,
5
- WebsiteDistinctExp,
6
- WebsiteQueryOptions,
7
- WebsiteFields,
8
- LangFields,
9
- } from "@rxdrag/rxcms-models";
10
- import { queryOneEntity } from "./queryOneEntity";
11
- import { EnvVariables } from "../types";
12
-
13
- export async function queryWebsite(envVariables: EnvVariables) {
14
- const website = await queryOneEntity<
15
- Website,
16
- WebsiteBoolExp,
17
- WebsiteOrderBy,
18
- WebsiteDistinctExp
19
- >(
20
- new WebsiteQueryOptions(
21
- [WebsiteFields.id, WebsiteFields.name, WebsiteFields.title],
22
- {
23
- where: {
24
- id: {
25
- _eq: envVariables.websiteId,
26
- },
27
- },
28
- }
29
- )
30
- .baseLang([
31
- LangFields.id,
32
- LangFields.abbr,
33
- LangFields.localName,
34
- LangFields.cnName,
35
- LangFields.urlFragment,
36
- LangFields.htmlLang,
37
- ])
38
- .setNoQuery(!envVariables.websiteId),
39
- { ...envVariables, websiteId: undefined }
40
- );
41
-
42
- return website as Website | undefined;
43
- }
1
+ import {
2
+ Website,
3
+ WebsiteBoolExp,
4
+ WebsiteOrderBy,
5
+ WebsiteDistinctExp,
6
+ WebsiteQueryOptions,
7
+ WebsiteFields,
8
+ LangFields,
9
+ } from "@rxdrag/rxcms-models";
10
+ import { queryOneEntity } from "./queryOneEntity";
11
+ import { EnvVariables } from "../types";
12
+
13
+ export async function queryWebsite(envVariables: EnvVariables) {
14
+ const website = await queryOneEntity<
15
+ Website,
16
+ WebsiteBoolExp,
17
+ WebsiteOrderBy,
18
+ WebsiteDistinctExp
19
+ >(
20
+ new WebsiteQueryOptions(
21
+ [WebsiteFields.id, WebsiteFields.name, WebsiteFields.title],
22
+ {
23
+ where: {
24
+ id: {
25
+ _eq: envVariables.websiteId,
26
+ },
27
+ },
28
+ }
29
+ )
30
+ .baseLang([
31
+ LangFields.id,
32
+ LangFields.abbr,
33
+ LangFields.localName,
34
+ LangFields.cnName,
35
+ LangFields.urlFragment,
36
+ LangFields.htmlLang,
37
+ ])
38
+ .setNoQuery(!envVariables.websiteId),
39
+ { ...envVariables, websiteId: undefined }
40
+ );
41
+
42
+ return website as Website | undefined;
43
+ }
@@ -1,8 +1,8 @@
1
- import { IEmail } from "@rxdrag/entify-lib";
2
- import { createEntifyClient } from "./createEntifyClient";
3
- import { EnvVariables } from "../types";
4
-
5
- export async function sendEmail(email: IEmail, envVariables: EnvVariables) {
6
- const client = createEntifyClient(envVariables);
7
- return await client.sendEmail(email);
1
+ import { IEmail } from "@rxdrag/entify-lib";
2
+ import { createEntifyClient } from "./createEntifyClient";
3
+ import { EnvVariables } from "../types";
4
+
5
+ export async function sendEmail(email: IEmail, envVariables: EnvVariables) {
6
+ const client = createEntifyClient(envVariables);
7
+ return await client.sendEmail(email);
8
8
  }
@@ -1,20 +1,20 @@
1
- import { IEntity, IQueryOptions } from "@rxdrag/entify-lib";
2
- import { ICustomizedDataSource } from "../types";
3
- import { QueryOptions } from "@rxdrag/rxcms-models";
4
-
5
- export function toQueryOptions(dataSource: ICustomizedDataSource): IQueryOptions<IEntity> {
6
- const { entity, pageSize, where, orderBy, fields } = dataSource;
7
- if (!entity) {
8
- throw new Error("entity is required in dataSource");
9
- }
10
- const queryOptions = new QueryOptions(
11
- entity,
12
- fields ? ["id", fields] : ["id"],
13
- {
14
- where,
15
- orderBy,
16
- limit: pageSize,
17
- }
18
- );
19
- return queryOptions as unknown as IQueryOptions<IEntity>;
1
+ import { IEntity, IQueryOptions } from "@rxdrag/entify-lib";
2
+ import { ICustomizedDataSource } from "../types";
3
+ import { QueryOptions } from "@rxdrag/rxcms-models";
4
+
5
+ export function toQueryOptions(dataSource: ICustomizedDataSource): IQueryOptions<IEntity> {
6
+ const { entity, pageSize, where, orderBy, fields } = dataSource;
7
+ if (!entity) {
8
+ throw new Error("entity is required in dataSource");
9
+ }
10
+ const queryOptions = new QueryOptions(
11
+ entity,
12
+ fields ? ["id", fields] : ["id"],
13
+ {
14
+ where,
15
+ orderBy,
16
+ limit: pageSize,
17
+ }
18
+ );
19
+ return queryOptions as unknown as IQueryOptions<IEntity>;
20
20
  }
@@ -1,9 +1,9 @@
1
- import { EnvVariables } from "../types";
2
- import { createEntifyClient } from "./createEntifyClient";
3
-
4
- export async function upsertEntity<Input = object>(entityName: string, object: Input, envVariables: EnvVariables) {
5
- const client = createEntifyClient(envVariables);
6
-
7
-
8
- return await client.upsertEntity(entityName, object);
1
+ import { EnvVariables } from "../types";
2
+ import { createEntifyClient } from "./createEntifyClient";
3
+
4
+ export async function upsertEntity<Input = object>(entityName: string, object: Input, envVariables: EnvVariables) {
5
+ const client = createEntifyClient(envVariables);
6
+
7
+
8
+ return await client.upsertEntity(entityName, object);
9
9
  }
@@ -1,2 +1,2 @@
1
- export * from "./utils";
1
+ export * from "./utils";
2
2
  export * from "./variables";
@@ -1,7 +1,12 @@
1
- import { ImageSizes } from "@rxdrag/rxcms-models";
2
- import { EnvVariables } from "./variables";
3
- //astro传递上下文用
4
- export type Locals = {
5
- env: EnvVariables;
6
- imageSizes: ImageSizes;
1
+ import { ImageSizes, Lang, Website } from "@rxdrag/rxcms-models";
2
+ import { EnvVariables } from "./variables";
3
+ //astro传递上下文用
4
+ export type Locals = {
5
+ env: EnvVariables;
6
+ imageSizes: ImageSizes;
7
+ // 语言相关信息(由中间件下发)
8
+ currentLangAbbr?: string;
9
+ currentHtmlLang?: string;
10
+ langs?: Lang[];
11
+ website?: Website;
7
12
  };
@@ -1,6 +1,5 @@
1
- export type EnvVariables = {
2
- websiteId?: string;
3
- entifyServerUrl?: string;
4
- entifyGuestToken?: string;
5
- language?: string;
6
- };
1
+ export type EnvVariables = {
2
+ websiteId?: string;
3
+ entifyServerUrl?: string;
4
+ entifyGuestToken?: string;
5
+ };