strapi-plugin-comments 3.0.1 → 3.0.3

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.
@@ -8380,9 +8380,9 @@ const getRelationValidator = (enabledCollections) => z.string().regex(REGEX$1.re
8380
8380
  "Invalid relation or not enabled collections"
8381
8381
  );
8382
8382
  const externalAuthorSchema = z.object({
8383
- id: z.number(),
8383
+ id: z.union([z.number(), z.string()]),
8384
8384
  name: z.string().min(1).max(100).optional(),
8385
- email: z.string().email().optional(),
8385
+ email: z.string().email(),
8386
8386
  avatar: z.string().url().optional()
8387
8387
  });
8388
8388
  z.union([z.string(), z.number(), z.boolean()]);
@@ -9730,10 +9730,10 @@ const adminServices = ({ strapi: strapi2 }) => {
9730
9730
  }
9731
9731
  return { ..._2, uid };
9732
9732
  });
9733
- const levelThreadId = entity.threadOf && typeof entity.threadOf === "object" ? entity.threadOf.documentId : null;
9733
+ const levelThreadId = entity.threadOf && typeof entity.threadOf === "object" ? entity.threadOf.id : null;
9734
9734
  const entitiesOnSameLevel = await this.getCommonService().findAllInHierarchy(
9735
9735
  {
9736
- query: {
9736
+ filters: {
9737
9737
  ...defaultWhere,
9738
9738
  ...query,
9739
9739
  threadOf: levelThreadId,
@@ -10420,23 +10420,22 @@ const commonService = ({ strapi: strapi2 }) => ({
10420
10420
  );
10421
10421
  return Promise.all(
10422
10422
  Object.entries(data).map(
10423
- async ([relatedUid, { documentIds, locale }]) => strapi2.documents(relatedUid).findMany({
10424
- filters: {
10425
- documentId: {
10426
- $in: Array.from(new Set(documentIds))
10427
- },
10428
- locale: {
10429
- $in: Array.from(new Set(locale))
10430
- }
10431
- },
10432
- // ? TBD: do we want fetch draft entities?
10433
- status: "published"
10434
- }).then(
10435
- (relatedEntities) => relatedEntities.map((_2) => ({
10436
- ..._2,
10437
- uid: relatedUid
10438
- }))
10439
- )
10423
+ async ([relatedUid, { documentIds, locale }]) => {
10424
+ return Promise.all(
10425
+ documentIds.map(
10426
+ (documentId, index2) => strapi2.documents(relatedUid).findOne({
10427
+ documentId: documentId.toString(),
10428
+ locale: !lodashExports.isNil(locale[index2]) ? locale[index2] : void 0,
10429
+ status: "published"
10430
+ })
10431
+ )
10432
+ ).then(
10433
+ (relatedEntities) => relatedEntities.filter((_2) => _2).map((_2) => ({
10434
+ ..._2,
10435
+ uid: relatedUid
10436
+ }))
10437
+ );
10438
+ }
10440
10439
  )
10441
10440
  ).then((result) => result.flat(2));
10442
10441
  },
@@ -1439,7 +1439,7 @@ declare const controllers: {
1439
1439
  locale?: string;
1440
1440
  author?: {
1441
1441
  name?: string;
1442
- id?: number;
1442
+ id?: string | number;
1443
1443
  email?: string;
1444
1444
  avatar?: string;
1445
1445
  };
@@ -1509,7 +1509,7 @@ declare const _default: {
1509
1509
  locale?: string;
1510
1510
  author?: {
1511
1511
  name?: string;
1512
- id?: number;
1512
+ id?: string | number;
1513
1513
  email?: string;
1514
1514
  avatar?: string;
1515
1515
  };
@@ -7740,7 +7740,7 @@ declare const _default: {
7740
7740
  locale?: string;
7741
7741
  author?: {
7742
7742
  name?: string;
7743
- id?: number;
7743
+ id?: string | number;
7744
7744
  email?: string;
7745
7745
  avatar?: string;
7746
7746
  };
@@ -7826,7 +7826,7 @@ declare const _default: {
7826
7826
  content?: string;
7827
7827
  author?: {
7828
7828
  name?: string;
7829
- id?: number;
7829
+ id?: string | number;
7830
7830
  email?: string;
7831
7831
  avatar?: string;
7832
7832
  };
@@ -4713,7 +4713,7 @@ declare const pluginServices: {
4713
4713
  locale?: string;
4714
4714
  author?: {
4715
4715
  name?: string;
4716
- id?: number;
4716
+ id?: string | number;
4717
4717
  email?: string;
4718
4718
  avatar?: string;
4719
4719
  };
@@ -4799,7 +4799,7 @@ declare const pluginServices: {
4799
4799
  content?: string;
4800
4800
  author?: {
4801
4801
  name?: string;
4802
- id?: number;
4802
+ id?: string | number;
4803
4803
  email?: string;
4804
4804
  avatar?: string;
4805
4805
  };
@@ -7,7 +7,7 @@ export declare const newCommentValidator: (enabledCollections: string[], relatio
7
7
  locale?: string;
8
8
  author?: {
9
9
  name?: string;
10
- id?: number;
10
+ id?: string | number;
11
11
  email?: string;
12
12
  avatar?: string;
13
13
  };
@@ -19,7 +19,7 @@ export declare const updateCommentValidator: (enabledCollections: string[], payl
19
19
  content?: string;
20
20
  author?: {
21
21
  name?: string;
22
- id?: number;
22
+ id?: string | number;
23
23
  email?: string;
24
24
  avatar?: string;
25
25
  };
@@ -757,18 +757,18 @@ export declare const queryPaginationSchema: z.ZodObject<z.objectUtil.extendShape
757
757
  export declare const validate: <I, O>(result: z.SafeParseReturnType<I, O>) => import("../utils/Either").Left<PluginError> | import("../utils/Either").Right<O>;
758
758
  export declare const getRelationValidator: (enabledCollections: string[]) => z.ZodEffects<z.ZodString, `${string}::${string}.${string}`, string>;
759
759
  export declare const externalAuthorSchema: z.ZodObject<{
760
- id: z.ZodNumber;
760
+ id: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
761
761
  name: z.ZodOptional<z.ZodString>;
762
- email: z.ZodOptional<z.ZodString>;
762
+ email: z.ZodString;
763
763
  avatar: z.ZodOptional<z.ZodString>;
764
764
  }, "strip", z.ZodTypeAny, {
765
765
  name?: string;
766
- id?: number;
766
+ id?: string | number;
767
767
  email?: string;
768
768
  avatar?: string;
769
769
  }, {
770
770
  name?: string;
771
- id?: number;
771
+ id?: string | number;
772
772
  email?: string;
773
773
  avatar?: string;
774
774
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-comments",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "Strapi - Comments plugin",
5
5
  "strapi": {
6
6
  "name": "comments",
@@ -34,7 +34,6 @@
34
34
  "publish:beta": "npm publish --tag beta",
35
35
  "build": "yarn clean && strapi-plugin build",
36
36
  "clean": "rm -rf build",
37
- "develop": "nodemon --exec \"yarn build:dev\"",
38
37
  "test:unit": "jest --verbose --coverage",
39
38
  "test:unit:watch": "jest --verbose --watch",
40
39
  "test:unit:ci": "CI=true jest --ci --runInBand --verbose --coverage",