@yimingliao/cms 0.0.67 → 0.0.69

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.
@@ -338,23 +338,4 @@ type AdminCard = AdminSafe & {
338
338
  translations: AdminTranslation[];
339
339
  };
340
340
 
341
- interface SuccessResult<D = unknown> {
342
- success: true;
343
- message?: string;
344
- data?: D;
345
- meta?: Record<string, unknown>;
346
- }
347
- interface ErrorResult {
348
- success: false;
349
- message?: string;
350
- errors?: ErrorDetail[];
351
- code?: string;
352
- }
353
- interface ErrorDetail {
354
- field?: string;
355
- message?: string;
356
- code?: string;
357
- }
358
- type Result<D = unknown> = SuccessResult<D> | ErrorResult;
359
-
360
- export { ADMIN_ROLES as A, type BaseTranslation as B, type DeviceInfo as D, type ErrorDetail as E, type FolderFull as F, type MultiItems as M, type PostFull as P, type Result as R, type SuccessResult as S, type TocItem as T, type Folder as a, type FileFull as b, type FileCard as c, type ErrorResult as d, type Admin as e, type AdminCard as f, type AdminFull as g, type AdminRefreshToken as h, type AdminRole as i, type AdminSafe as j, type AdminTranslation as k, type Alternate as l, type ExternalLink as m, FILE_TYPES as n, type Faq as o, type File as p, type FileTranslation as q, type FileType as r, POST_TYPES as s, type Post as t, type PostListCard as u, type PostTranslation as v, type PostType as w, type SeoMetadata as x, type SingleItem as y, type Translation as z };
341
+ export { ADMIN_ROLES as A, type BaseTranslation as B, type DeviceInfo as D, type ExternalLink as E, type FolderFull as F, type MultiItems as M, type PostFull as P, type SeoMetadata as S, type TocItem as T, type Folder as a, type FileFull as b, type FileCard as c, type Admin as d, type AdminCard as e, type AdminFull as f, type AdminRefreshToken as g, type AdminRole as h, type AdminSafe as i, type AdminTranslation as j, type Alternate as k, FILE_TYPES as l, type Faq as m, type File as n, type FileTranslation as o, type FileType as p, POST_TYPES as q, type Post as r, type PostListCard as s, type PostTranslation as t, type PostType as u, type SingleItem as v, type Translation as w };
@@ -1,3 +1,4 @@
1
+ import { R as Result } from '../types-DHlRoJwv.js';
1
2
  import { Logger } from 'logry';
2
3
 
3
4
  interface FetchContext {
@@ -16,7 +17,7 @@ declare function createSmartFetch({ requestInterceptor, responseInterceptor, log
16
17
  requestInterceptor: RequestInterceptor;
17
18
  responseInterceptor: ResponseInterceptor;
18
19
  logger: Logger;
19
- }): <T>(input: string, init?: RequestInit) => Promise<T>;
20
+ }): <T>(input: string, init?: RequestInit) => Promise<Result<T>>;
20
21
 
21
22
  declare function createRequestInterceptor({ baseUrl }: {
22
23
  baseUrl: string;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { F as FolderFull, a as Folder, b as FileFull, c as FileCard, E as ErrorDetail, S as SuccessResult, d as ErrorResult, P as PostFull, B as BaseTranslation } from './types-BGsFazJr.js';
2
- export { A as ADMIN_ROLES, e as Admin, f as AdminCard, g as AdminFull, h as AdminRefreshToken, i as AdminRole, j as AdminSafe, k as AdminTranslation, l as Alternate, D as DeviceInfo, m as ExternalLink, n as FILE_TYPES, o as Faq, p as File, q as FileTranslation, r as FileType, M as MultiItems, s as POST_TYPES, t as Post, u as PostListCard, v as PostTranslation, w as PostType, R as Result, x as SeoMetadata, y as SingleItem, T as TocItem, z as Translation } from './types-BGsFazJr.js';
1
+ import { F as FolderFull, a as Folder, b as FileFull, c as FileCard, P as PostFull, B as BaseTranslation } from './card-BG2vtuIz.js';
2
+ export { A as ADMIN_ROLES, d as Admin, e as AdminCard, f as AdminFull, g as AdminRefreshToken, h as AdminRole, i as AdminSafe, j as AdminTranslation, k as Alternate, D as DeviceInfo, E as ExternalLink, l as FILE_TYPES, m as Faq, n as File, o as FileTranslation, p as FileType, M as MultiItems, q as POST_TYPES, r as Post, s as PostListCard, t as PostTranslation, u as PostType, S as SeoMetadata, v as SingleItem, T as TocItem, w as Translation } from './card-BG2vtuIz.js';
3
3
  export { B as BlobFile } from './types-0oS1A2K5.js';
4
+ import { E as ErrorDetail, S as SuccessResult, a as ErrorResult } from './types-DHlRoJwv.js';
5
+ export { R as Result } from './types-DHlRoJwv.js';
4
6
  import { Robots } from 'next/dist/lib/metadata/types/metadata-types';
5
7
  import { Metadata } from 'next';
6
8
 
@@ -8,9 +8,10 @@ import * as zod from 'zod';
8
8
  import zod__default, { z, ZodType } from 'zod';
9
9
  import { B as BlobFile } from '../types-0oS1A2K5.js';
10
10
  import * as zod_v4_core from 'zod/v4/core';
11
- import { T as TocItem, i as AdminRole, y as SingleItem, B as BaseTranslation, e as Admin, g as AdminFull, j as AdminSafe, D as DeviceInfo, h as AdminRefreshToken, p as File$1, b as FileFull, r as FileType, a as Folder, F as FolderFull, w as PostType, M as MultiItems, m as ExternalLink, o as Faq, t as Post, u as PostListCard, v as PostTranslation, P as PostFull, l as Alternate, S as SuccessResult, R as Result, f as AdminCard, c as FileCard } from '../types-BGsFazJr.js';
11
+ import { T as TocItem, h as AdminRole, v as SingleItem, B as BaseTranslation, d as Admin, f as AdminFull, i as AdminSafe, D as DeviceInfo, g as AdminRefreshToken, n as File$1, b as FileFull, p as FileType, a as Folder, F as FolderFull, M as MultiItems, E as ExternalLink, m as Faq, r as Post, u as PostType, s as PostListCard, t as PostTranslation, P as PostFull, k as Alternate, e as AdminCard, c as FileCard } from '../card-BG2vtuIz.js';
12
12
  import * as nodemailer_lib_smtp_transport from 'nodemailer/lib/smtp-transport';
13
13
  import nodemailer, { Transporter, SentMessageInfo } from 'nodemailer';
14
+ import { S as SuccessResult, R as Result } from '../types-DHlRoJwv.js';
14
15
  import { BaseTranslator, LocaleMessages } from 'intor';
15
16
  import { NextResponse } from 'next/server';
16
17
  import { S as StorageService } from '../types-J25u1G6t.js';
@@ -442,7 +443,7 @@ declare function createFolderQueryRepository(prisma: PrismaClient): {
442
443
  };
443
444
 
444
445
  interface CreateParams {
445
- type: PostType;
446
+ type: string;
446
447
  isLocked: boolean;
447
448
  isActive: boolean;
448
449
  isIndexActive: boolean;
@@ -517,7 +518,7 @@ interface CreateParams {
517
518
  }
518
519
  interface UpdateParams {
519
520
  id: string;
520
- type: PostType;
521
+ type: string;
521
522
  isLocked: boolean;
522
523
  isActive: boolean;
523
524
  isIndexActive: boolean;
@@ -592,8 +593,8 @@ interface UpdateParams {
592
593
  }
593
594
 
594
595
  declare function createPostCommandRepository(prisma: PrismaClient): {
595
- create: ({ slug, author, topicId, parents, tags, relatedPosts, coverImage, contentImageIds, images1, images2, image1, image2, image3, image4, translations, ...params }: CreateParams) => Promise<Post>;
596
- update: ({ id, slug, author, topicId, parents, tags, relatedPosts, coverImage, contentImageIds, images1, images2, image1, image2, image3, image4, translations, ...params }: UpdateParams) => Promise<Post>;
596
+ create: ({ slug, type, author, topicId, parents, tags, relatedPosts, coverImage, contentImageIds, images1, images2, image1, image2, image3, image4, translations, ...params }: CreateParams) => Promise<Post>;
597
+ update: ({ id, slug, type, author, topicId, parents, tags, relatedPosts, coverImage, contentImageIds, images1, images2, image1, image2, image3, image4, translations, ...params }: UpdateParams) => Promise<Post>;
597
598
  delete: ({ id }: {
598
599
  id: string;
599
600
  }) => Promise<Post>;
@@ -1377,18 +1378,12 @@ declare function createFolderFindListCardsAction(ctx: ActionContext): (params: {
1377
1378
  }>>;
1378
1379
 
1379
1380
  declare const postCreateValidator: ({ type, topicId, schemas, tocItemSchema, }: {
1380
- type: PostType;
1381
+ type: string;
1381
1382
  topicId: string | null;
1382
1383
  schemas: ReturnType<typeof createSchemas>;
1383
1384
  tocItemSchema: ReturnType<typeof createTocItemSchema>;
1384
1385
  }) => zod.ZodPipe<zod.ZodObject<{
1385
- type: zod.ZodEnum<{
1386
- TOPIC: "TOPIC";
1387
- CATEGORY: "CATEGORY";
1388
- POST: "POST";
1389
- TAG: "TAG";
1390
- PAGE: "PAGE";
1391
- }>;
1386
+ type: zod.ZodString;
1392
1387
  isLocked: zod.ZodBoolean;
1393
1388
  isActive: zod.ZodBoolean;
1394
1389
  isIndexActive: zod.ZodBoolean;
@@ -1621,7 +1616,7 @@ declare const postCreateValidator: ({ type, topicId, schemas, tocItemSchema, }:
1621
1616
  data3: any[];
1622
1617
  data4: any[];
1623
1618
  }[];
1624
- type: "TOPIC" | "CATEGORY" | "POST" | "TAG" | "PAGE";
1619
+ type: string;
1625
1620
  isLocked: boolean;
1626
1621
  isActive: boolean;
1627
1622
  isIndexActive: boolean;
@@ -1688,7 +1683,7 @@ declare const postCreateValidator: ({ type, topicId, schemas, tocItemSchema, }:
1688
1683
  data3: any[];
1689
1684
  data4: any[];
1690
1685
  }, {
1691
- type: "TOPIC" | "CATEGORY" | "POST" | "TAG" | "PAGE";
1686
+ type: string;
1692
1687
  isLocked: boolean;
1693
1688
  isActive: boolean;
1694
1689
  isIndexActive: boolean;
@@ -1812,18 +1807,12 @@ declare function createPostCreateAction(ctx: ActionContext): ({ formData, }: {
1812
1807
 
1813
1808
  declare const postUpdateValidator: ({ id, type, topicId, schemas, tocItemSchema, }: {
1814
1809
  id: string;
1815
- type: PostType;
1810
+ type: string;
1816
1811
  topicId: string | null;
1817
1812
  schemas: ReturnType<typeof createSchemas>;
1818
1813
  tocItemSchema: ReturnType<typeof createTocItemSchema>;
1819
1814
  }) => zod.ZodPipe<zod.ZodObject<{
1820
- type: zod.ZodEnum<{
1821
- TOPIC: "TOPIC";
1822
- CATEGORY: "CATEGORY";
1823
- POST: "POST";
1824
- TAG: "TAG";
1825
- PAGE: "PAGE";
1826
- }>;
1815
+ type: zod.ZodString;
1827
1816
  isLocked: zod.ZodBoolean;
1828
1817
  isActive: zod.ZodBoolean;
1829
1818
  isIndexActive: zod.ZodBoolean;
@@ -2056,7 +2045,7 @@ declare const postUpdateValidator: ({ id, type, topicId, schemas, tocItemSchema,
2056
2045
  data3: any[];
2057
2046
  data4: any[];
2058
2047
  }[];
2059
- type: "TOPIC" | "CATEGORY" | "POST" | "TAG" | "PAGE";
2048
+ type: string;
2060
2049
  isLocked: boolean;
2061
2050
  isActive: boolean;
2062
2051
  isIndexActive: boolean;
@@ -2123,7 +2112,7 @@ declare const postUpdateValidator: ({ id, type, topicId, schemas, tocItemSchema,
2123
2112
  data3: any[];
2124
2113
  data4: any[];
2125
2114
  }, {
2126
- type: "TOPIC" | "CATEGORY" | "POST" | "TAG" | "PAGE";
2115
+ type: string;
2127
2116
  isLocked: boolean;
2128
2117
  isActive: boolean;
2129
2118
  isIndexActive: boolean;
@@ -1,4 +1,4 @@
1
- import { ADMIN_ROLES, isFileLocked, isFolderLocked, ROOT_FOLDER_ID, ROOT_FOLDER, POST_TYPES } from '../chunk-FUAJWL2N.js';
1
+ import { ADMIN_ROLES, isFileLocked, isFolderLocked, ROOT_FOLDER_ID, ROOT_FOLDER } from '../chunk-FUAJWL2N.js';
2
2
  import { SIZE, result, datetimeToDb, jsonArrayToDb, mimeToExtension, classifyFileType, TWITTER_CARD_ARRAY, OG_TYPE_ARRAY } from '../chunk-N2PRNBP2.js';
3
3
  import jwt from 'jsonwebtoken';
4
4
  import argon2 from 'argon2';
@@ -1433,6 +1433,7 @@ function createFolderQueryRepository(prisma) {
1433
1433
  function createPostCommandRepository(prisma) {
1434
1434
  async function create({
1435
1435
  slug,
1436
+ type,
1436
1437
  // ------------------------------------
1437
1438
  // relations
1438
1439
  // ------------------------------------
@@ -1469,6 +1470,7 @@ function createPostCommandRepository(prisma) {
1469
1470
  data: {
1470
1471
  ...params,
1471
1472
  id,
1473
+ type,
1472
1474
  // ------------------------------------------------------------------------
1473
1475
  // states
1474
1476
  // ------------------------------------------------------------------------
@@ -1516,6 +1518,7 @@ function createPostCommandRepository(prisma) {
1516
1518
  async function update({
1517
1519
  id,
1518
1520
  slug,
1521
+ type,
1519
1522
  // ------------------------------------
1520
1523
  // relations
1521
1524
  // ------------------------------------
@@ -1551,6 +1554,7 @@ function createPostCommandRepository(prisma) {
1551
1554
  where: { id },
1552
1555
  data: {
1553
1556
  ...params,
1557
+ type,
1554
1558
  // ------------------------------------------------------------------------
1555
1559
  // states
1556
1560
  // ------------------------------------------------------------------------
@@ -3502,7 +3506,7 @@ var postCreateValidator = ({
3502
3506
  schemas,
3503
3507
  tocItemSchema
3504
3508
  }) => schemas.z.object({
3505
- type: schemas.z.enum(POST_TYPES),
3509
+ type: schemas.text(),
3506
3510
  // ----------------------------------------------------------------------------
3507
3511
  // states
3508
3512
  // ----------------------------------------------------------------------------
@@ -3681,8 +3685,7 @@ var postUpdateValidator = ({
3681
3685
  schemas,
3682
3686
  tocItemSchema
3683
3687
  }) => schemas.z.object({
3684
- type: schemas.z.enum(POST_TYPES),
3685
- // depth: schemas.z.number().nullable(),
3688
+ type: schemas.text(),
3686
3689
  // ----------------------------------------------------------------------------
3687
3690
  // states
3688
3691
  // ----------------------------------------------------------------------------
@@ -0,0 +1,20 @@
1
+ interface SuccessResult<D = unknown> {
2
+ success: true;
3
+ message?: string;
4
+ data?: D;
5
+ meta?: Record<string, unknown>;
6
+ }
7
+ interface ErrorResult {
8
+ success: false;
9
+ message?: string;
10
+ errors?: ErrorDetail[];
11
+ code?: string;
12
+ }
13
+ interface ErrorDetail {
14
+ field?: string;
15
+ message?: string;
16
+ code?: string;
17
+ }
18
+ type Result<D = unknown> = SuccessResult<D> | ErrorResult;
19
+
20
+ export type { ErrorDetail as E, Result as R, SuccessResult as S, ErrorResult as a };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yimingliao/cms",
3
- "version": "0.0.67",
3
+ "version": "0.0.69",
4
4
  "author": "Yiming Liao",
5
5
  "license": "MIT",
6
6
  "type": "module",