@yimingliao/cms 0.0.2 → 0.0.4

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/index.d.ts CHANGED
@@ -838,4 +838,41 @@ declare function createPostQueryRepository(prisma: any): {
838
838
  }) | null>;
839
839
  };
840
840
 
841
- export { createAdminCommandRepository, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenQueryRepository, createArgon2Service, createCookieService, createCryptoService, createFileCommandRepository, createFileQueryRepository, createFolderCommandRepository, createFolderQueryRepository, createJwtService, createPostCommandRepository, createPostQueryRepository };
841
+ interface UpsertParams {
842
+ postId: string;
843
+ translations: (BaseTranslation & {
844
+ title: string | null;
845
+ description: string | null;
846
+ author: string | null;
847
+ canonical: string | null;
848
+ alternate: Alternate[];
849
+ robots: string | null;
850
+ ogTitle: string | null;
851
+ ogDescription: string | null;
852
+ ogUrl: string | null;
853
+ ogType: string | null;
854
+ ogSiteName: string | null;
855
+ ogImage: string | null;
856
+ ogImageAlt: string | null;
857
+ ogImageType: string | null;
858
+ ogImageWidth: number | null;
859
+ ogImageHeight: number | null;
860
+ ogLocale: string | null;
861
+ ogLocaleAlternate: string[];
862
+ ogArticlePublishedTime: string | null;
863
+ ogArticleModifiedTime: string | null;
864
+ ogArticleAuthor: string | null;
865
+ ogArticleSection: string | null;
866
+ ogArticleTag: string[];
867
+ twitterCard: string | null;
868
+ twitterSite: string | null;
869
+ twitterCreator: string | null;
870
+ jsonLd: object[];
871
+ })[];
872
+ }
873
+
874
+ declare function createSeoMetadataCommandRepository(prisma: any): {
875
+ upsert: ({ postId, translations, }: UpsertParams) => Promise<void>;
876
+ };
877
+
878
+ export { ADMIN_ROLES, type Admin, type AdminCard, type AdminFull, type AdminRefreshToken, type AdminRole, type AdminSafe, type AdminTranslation, type Alternate, type BaseTranslation, type DeviceInfo, type ExternalLink, FILE_TYPES, type Faq, type File$1 as File, type FileCard, type FileFull, type FileTranslation, type FileType, type Folder, type FolderFull, type MultiItems, POST_TYPES, type Post, type PostFull, type PostListCard, type PostTranslation, type PostType, type SeoMetadata, type SingleItem, type TocItem, type Translation, createAdminCommandRepository, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenQueryRepository, createArgon2Service, createCookieService, createCryptoService, createFileCommandRepository, createFileQueryRepository, createFolderCommandRepository, createFolderQueryRepository, createJwtService, createPostCommandRepository, createPostQueryRepository, createSeoMetadataCommandRepository };
package/dist/index.js CHANGED
@@ -308,7 +308,10 @@ var POST_ORDER_BY = [
308
308
 
309
309
  // src/domain/admin/props.ts
310
310
  var ADMIN_ROLES = {
311
- SUPER_ADMIN: "SUPER_ADMIN"};
311
+ SUPER_ADMIN: "SUPER_ADMIN",
312
+ ADMIN: "ADMIN",
313
+ EDITOR: "EDITOR"
314
+ };
312
315
 
313
316
  // src/database/admin/include.ts
314
317
  var ADMIN_FULL_INCLUDE = {
@@ -1261,4 +1264,44 @@ function createPostQueryRepository(prisma) {
1261
1264
  };
1262
1265
  }
1263
1266
 
1264
- export { createAdminCommandRepository, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenQueryRepository, createArgon2Service, createCookieService, createCryptoService, createFileCommandRepository, createFileQueryRepository, createFolderCommandRepository, createFolderQueryRepository, createJwtService, createPostCommandRepository, createPostQueryRepository };
1267
+ // src/database/seo-metadata/command/create-seo-metadata-command-repository.ts
1268
+ function createSeoMetadataCommandRepository(prisma) {
1269
+ async function upsert({
1270
+ // ------------------------------------
1271
+ // relations
1272
+ // ------------------------------------
1273
+ // Post
1274
+ postId,
1275
+ // ------------------------------------
1276
+ // translation
1277
+ // ------------------------------------
1278
+ translations
1279
+ }) {
1280
+ await prisma.post.update({
1281
+ where: { id: postId },
1282
+ data: {
1283
+ seoMetadatas: {
1284
+ upsert: translations.map((t) => ({
1285
+ where: { postId_locale: { postId, locale: t.locale } },
1286
+ update: t,
1287
+ create: t
1288
+ }))
1289
+ }
1290
+ }
1291
+ });
1292
+ }
1293
+ return {
1294
+ upsert
1295
+ };
1296
+ }
1297
+
1298
+ // src/domain/post/props.ts
1299
+ var POST_TYPES = {
1300
+ TOPIC: "TOPIC",
1301
+ CATEGORY: "CATEGORY",
1302
+ POST: "POST",
1303
+ TAG: "TAG",
1304
+ PAGE: "PAGE"
1305
+ };
1306
+
1307
+ export { ADMIN_ROLES, FILE_TYPES, POST_TYPES, createAdminCommandRepository, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenQueryRepository, createArgon2Service, createCookieService, createCryptoService, createFileCommandRepository, createFileQueryRepository, createFolderCommandRepository, createFolderQueryRepository, createJwtService, createPostCommandRepository, createPostQueryRepository, createSeoMetadataCommandRepository };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yimingliao/cms",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "author": "Yiming Liao",
5
5
  "license": "MIT",
6
6
  "type": "module",