@23blocks/block-content 3.1.1 → 3.3.0

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.esm.js CHANGED
@@ -428,6 +428,21 @@ function createCommentsService(transport, _config) {
428
428
  async delete (uniqueId) {
429
429
  await transport.delete(`/comments/${uniqueId}`);
430
430
  },
431
+ async reply (parentCommentUniqueId, data) {
432
+ const response = await transport.post('/comments', {
433
+ comment: {
434
+ post_unique_id: data.postUniqueId,
435
+ content: data.content,
436
+ thumbnail_url: data.thumbnailUrl,
437
+ image_url: data.imageUrl,
438
+ content_url: data.contentUrl,
439
+ media_url: data.mediaUrl,
440
+ parent_id: parentCommentUniqueId,
441
+ payload: data.payload
442
+ }
443
+ });
444
+ return decodeOne(response, commentMapper);
445
+ },
431
446
  // Engagement
432
447
  async like (uniqueId) {
433
448
  const response = await transport.post(`/comments/${uniqueId}/like`, {});
@@ -436,6 +451,22 @@ function createCommentsService(transport, _config) {
436
451
  async dislike (uniqueId) {
437
452
  const response = await transport.post(`/comments/${uniqueId}/dislike`, {});
438
453
  return decodeOne(response, commentMapper);
454
+ },
455
+ async save (uniqueId) {
456
+ const response = await transport.put(`/comments/${uniqueId}/save`, {});
457
+ return decodeOne(response, commentMapper);
458
+ },
459
+ async unsave (uniqueId) {
460
+ const response = await transport.delete(`/comments/${uniqueId}/unsave`);
461
+ return decodeOne(response, commentMapper);
462
+ },
463
+ async follow (uniqueId) {
464
+ const response = await transport.put(`/comments/${uniqueId}/follow`, {});
465
+ return decodeOne(response, commentMapper);
466
+ },
467
+ async unfollow (uniqueId) {
468
+ const response = await transport.delete(`/comments/${uniqueId}/unfollow`);
469
+ return decodeOne(response, commentMapper);
439
470
  }
440
471
  };
441
472
  }
@@ -723,13 +754,187 @@ function createContentUsersService(transport, _config) {
723
754
  };
724
755
  }
725
756
 
757
+ const contentFlagMapper = {
758
+ type: 'content_flag',
759
+ map: (resource)=>{
760
+ var _resource_attributes, _resource_attributes1, _resource_attributes2, _resource_attributes3, _resource_attributes4, _resource_attributes5, _resource_attributes6, _resource_attributes7, _resource_attributes8, _resource_attributes9;
761
+ var _parseString, _parseString1, _parseString2, _parseString3, _parseDate;
762
+ return {
763
+ uniqueId: resource.id,
764
+ contentType: (_parseString = parseString((_resource_attributes = resource.attributes) == null ? void 0 : _resource_attributes['content_type'])) != null ? _parseString : 'post',
765
+ contentUniqueId: (_parseString1 = parseString((_resource_attributes1 = resource.attributes) == null ? void 0 : _resource_attributes1['content_unique_id'])) != null ? _parseString1 : '',
766
+ reporterUniqueId: (_parseString2 = parseString((_resource_attributes2 = resource.attributes) == null ? void 0 : _resource_attributes2['reporter_unique_id'])) != null ? _parseString2 : '',
767
+ reason: (_parseString3 = parseString((_resource_attributes3 = resource.attributes) == null ? void 0 : _resource_attributes3['reason'])) != null ? _parseString3 : '',
768
+ category: parseString((_resource_attributes4 = resource.attributes) == null ? void 0 : _resource_attributes4['category']),
769
+ status: parseStatus((_resource_attributes5 = resource.attributes) == null ? void 0 : _resource_attributes5['status']),
770
+ createdAt: (_parseDate = parseDate((_resource_attributes6 = resource.attributes) == null ? void 0 : _resource_attributes6['created_at'])) != null ? _parseDate : new Date(),
771
+ resolvedAt: parseDate((_resource_attributes7 = resource.attributes) == null ? void 0 : _resource_attributes7['resolved_at']),
772
+ resolvedBy: parseString((_resource_attributes8 = resource.attributes) == null ? void 0 : _resource_attributes8['resolved_by']),
773
+ resolution: parseString((_resource_attributes9 = resource.attributes) == null ? void 0 : _resource_attributes9['resolution'])
774
+ };
775
+ }
776
+ };
777
+
778
+ /**
779
+ * Create the Moderation service
780
+ */ function createModerationService(transport, _config) {
781
+ return {
782
+ async moderatePost (postUniqueId, request) {
783
+ const response = await transport.post(`/posts/${postUniqueId}/moderate`, {
784
+ moderation: {
785
+ action: request.action,
786
+ reason: request.reason
787
+ }
788
+ });
789
+ return {
790
+ success: response.success,
791
+ action: response.action,
792
+ moderatedAt: new Date(response.moderated_at),
793
+ moderatedBy: response.moderated_by,
794
+ reason: response.reason
795
+ };
796
+ },
797
+ async moderateComment (postUniqueId, commentUniqueId, request) {
798
+ const response = await transport.delete(`/posts/${postUniqueId}/comments/${commentUniqueId}/moderate`);
799
+ var _response_success, _response_action;
800
+ return {
801
+ success: (_response_success = response.success) != null ? _response_success : true,
802
+ action: (_response_action = response.action) != null ? _response_action : request.action,
803
+ moderatedAt: response.moderated_at ? new Date(response.moderated_at) : new Date(),
804
+ moderatedBy: response.moderated_by,
805
+ reason: response.reason
806
+ };
807
+ },
808
+ async listFlags (params) {
809
+ const queryParams = {};
810
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
811
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
812
+ if (params == null ? void 0 : params.contentType) queryParams['content_type'] = params.contentType;
813
+ if (params == null ? void 0 : params.category) queryParams['category'] = params.category;
814
+ if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
815
+ if (params == null ? void 0 : params.sortBy) queryParams['sort_by'] = params.sortBy;
816
+ if (params == null ? void 0 : params.sortOrder) queryParams['sort_order'] = params.sortOrder;
817
+ const response = await transport.get('/content_flags', {
818
+ params: queryParams
819
+ });
820
+ return decodePageResult(response, contentFlagMapper);
821
+ },
822
+ async getFlag (flagUniqueId) {
823
+ const response = await transport.get(`/content_flags/${flagUniqueId}`);
824
+ return decodeOne(response, contentFlagMapper);
825
+ },
826
+ async createFlag (request) {
827
+ const response = await transport.post('/content_flags', {
828
+ content_flag: {
829
+ content_type: request.contentType,
830
+ content_unique_id: request.contentUniqueId,
831
+ reason: request.reason,
832
+ category: request.category
833
+ }
834
+ });
835
+ return decodeOne(response, contentFlagMapper);
836
+ },
837
+ async resolveFlag (flagUniqueId, resolution) {
838
+ const response = await transport.put(`/content_flags/${flagUniqueId}/resolve`, {
839
+ content_flag: {
840
+ resolution
841
+ }
842
+ });
843
+ return decodeOne(response, contentFlagMapper);
844
+ },
845
+ async dismissFlag (flagUniqueId, reason) {
846
+ await transport.put(`/content_flags/${flagUniqueId}/dismiss`, {
847
+ content_flag: {
848
+ reason
849
+ }
850
+ });
851
+ }
852
+ };
853
+ }
854
+
855
+ const activityMapper = {
856
+ type: 'activity',
857
+ map: (resource)=>{
858
+ var _resource_attributes, _resource_attributes1, _resource_attributes2, _resource_attributes3, _resource_attributes4, _resource_attributes5, _resource_attributes6, _resource_attributes7, _resource_attributes8, _resource_attributes9, _resource_attributes10, _resource_attributes11, _resource_attributes12, _resource_attributes13, _resource_attributes14;
859
+ var _parseDate, _parseDate1, _parseString, _parseString1, _parseString2, _parseString3;
860
+ return {
861
+ uniqueId: resource.id,
862
+ createdAt: (_parseDate = parseDate((_resource_attributes = resource.attributes) == null ? void 0 : _resource_attributes['created_at'])) != null ? _parseDate : new Date(),
863
+ updatedAt: (_parseDate1 = parseDate((_resource_attributes1 = resource.attributes) == null ? void 0 : _resource_attributes1['updated_at'])) != null ? _parseDate1 : new Date(),
864
+ activityType: (_parseString = parseString((_resource_attributes2 = resource.attributes) == null ? void 0 : _resource_attributes2['activity_type'])) != null ? _parseString : 'post_created',
865
+ actorUniqueId: (_parseString1 = parseString((_resource_attributes3 = resource.attributes) == null ? void 0 : _resource_attributes3['actor_unique_id'])) != null ? _parseString1 : '',
866
+ actorName: parseString((_resource_attributes4 = resource.attributes) == null ? void 0 : _resource_attributes4['actor_name']),
867
+ actorAvatarUrl: parseString((_resource_attributes5 = resource.attributes) == null ? void 0 : _resource_attributes5['actor_avatar_url']),
868
+ targetType: (_parseString2 = parseString((_resource_attributes6 = resource.attributes) == null ? void 0 : _resource_attributes6['target_type'])) != null ? _parseString2 : 'post',
869
+ targetUniqueId: (_parseString3 = parseString((_resource_attributes7 = resource.attributes) == null ? void 0 : _resource_attributes7['target_unique_id'])) != null ? _parseString3 : '',
870
+ targetTitle: parseString((_resource_attributes8 = resource.attributes) == null ? void 0 : _resource_attributes8['target_title']),
871
+ targetPreview: parseString((_resource_attributes9 = resource.attributes) == null ? void 0 : _resource_attributes9['target_preview']),
872
+ relatedUniqueId: parseString((_resource_attributes10 = resource.attributes) == null ? void 0 : _resource_attributes10['related_unique_id']),
873
+ relatedType: parseString((_resource_attributes11 = resource.attributes) == null ? void 0 : _resource_attributes11['related_type']),
874
+ metadata: (_resource_attributes12 = resource.attributes) == null ? void 0 : _resource_attributes12['metadata'],
875
+ status: parseStatus((_resource_attributes13 = resource.attributes) == null ? void 0 : _resource_attributes13['status']),
876
+ enabled: parseBoolean((_resource_attributes14 = resource.attributes) == null ? void 0 : _resource_attributes14['enabled'])
877
+ };
878
+ }
879
+ };
880
+
881
+ /**
882
+ * Create the Activity service
883
+ */ function createActivityService(transport, _config) {
884
+ return {
885
+ async getActivities (identityUniqueId, params) {
886
+ const queryParams = {};
887
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
888
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
889
+ if (params == null ? void 0 : params.activityType) queryParams['activity_type'] = params.activityType;
890
+ if (params == null ? void 0 : params.targetType) queryParams['target_type'] = params.targetType;
891
+ if (params == null ? void 0 : params.dateFrom) queryParams['date_from'] = params.dateFrom;
892
+ if (params == null ? void 0 : params.dateTo) queryParams['date_to'] = params.dateTo;
893
+ if (params == null ? void 0 : params.sortBy) queryParams['sort_by'] = params.sortBy;
894
+ if (params == null ? void 0 : params.sortOrder) queryParams['sort_order'] = params.sortOrder;
895
+ const response = await transport.get(`/identities/${identityUniqueId}/activities`, {
896
+ params: queryParams
897
+ });
898
+ return decodePageResult(response, activityMapper);
899
+ },
900
+ async getComments (identityUniqueId, params) {
901
+ const queryParams = {};
902
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
903
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
904
+ if (params == null ? void 0 : params.postUniqueId) queryParams['post_unique_id'] = params.postUniqueId;
905
+ if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
906
+ const response = await transport.get(`/identities/${identityUniqueId}/comments`, {
907
+ params: queryParams
908
+ });
909
+ return decodePageResult(response, commentMapper);
910
+ },
911
+ async getFeed (params) {
912
+ const queryParams = {};
913
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
914
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
915
+ if (params == null ? void 0 : params.activityType) queryParams['activity_type'] = params.activityType;
916
+ if (params == null ? void 0 : params.targetType) queryParams['target_type'] = params.targetType;
917
+ if (params == null ? void 0 : params.dateFrom) queryParams['date_from'] = params.dateFrom;
918
+ if (params == null ? void 0 : params.dateTo) queryParams['date_to'] = params.dateTo;
919
+ if (params == null ? void 0 : params.sortBy) queryParams['sort_by'] = params.sortBy;
920
+ if (params == null ? void 0 : params.sortOrder) queryParams['sort_order'] = params.sortOrder;
921
+ const response = await transport.get('/activities/feed', {
922
+ params: queryParams
923
+ });
924
+ return decodePageResult(response, activityMapper);
925
+ }
926
+ };
927
+ }
928
+
726
929
  function createContentBlock(transport, config) {
727
930
  return {
728
931
  posts: createPostsService(transport),
729
932
  comments: createCommentsService(transport),
730
933
  categories: createCategoriesService(transport),
731
934
  tags: createTagsService(transport),
732
- users: createContentUsersService(transport)
935
+ users: createContentUsersService(transport),
936
+ moderation: createModerationService(transport),
937
+ activity: createActivityService(transport)
733
938
  };
734
939
  }
735
940
  const contentBlockMetadata = {
@@ -741,8 +946,10 @@ const contentBlockMetadata = {
741
946
  'Comment',
742
947
  'Category',
743
948
  'Tag',
744
- 'ContentUser'
949
+ 'ContentUser',
950
+ 'ContentFlag',
951
+ 'Activity'
745
952
  ]
746
953
  };
747
954
 
748
- export { categoryMapper, commentMapper, contentBlockMetadata, contentUserMapper, createCategoriesService, createCommentsService, createContentBlock, createContentUsersService, createPostsService, createTagsService, postMapper, tagMapper };
955
+ export { activityMapper, categoryMapper, commentMapper, contentBlockMetadata, contentFlagMapper, contentUserMapper, createActivityService, createCategoriesService, createCommentsService, createContentBlock, createContentUsersService, createModerationService, createPostsService, createTagsService, postMapper, tagMapper };
@@ -1,5 +1,5 @@
1
1
  import type { Transport, BlockConfig, BlockMetadata } from '@23blocks/contracts';
2
- import { type PostsService, type CommentsService, type CategoriesService, type TagsService, type ContentUsersService } from './services';
2
+ import { type PostsService, type CommentsService, type CategoriesService, type TagsService, type ContentUsersService, type ModerationService, type ActivityService } from './services';
3
3
  export interface ContentBlockConfig extends BlockConfig {
4
4
  appId: string;
5
5
  tenantId?: string;
@@ -10,6 +10,8 @@ export interface ContentBlock {
10
10
  categories: CategoriesService;
11
11
  tags: TagsService;
12
12
  users: ContentUsersService;
13
+ moderation: ModerationService;
14
+ activity: ActivityService;
13
15
  }
14
16
  export declare function createContentBlock(transport: Transport, config: ContentBlockConfig): ContentBlock;
15
17
  export declare const contentBlockMetadata: BlockMetadata;
@@ -1 +1 @@
1
- {"version":3,"file":"content.block.d.ts","sourceRoot":"","sources":["../../../src/lib/content.block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACzB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;IAC1B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,mBAAmB,CAAC;CAC5B;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,kBAAkB,GACzB,YAAY,CAQd;AAED,eAAO,MAAM,oBAAoB,EAAE,aAWlC,CAAC"}
1
+ {"version":3,"file":"content.block.d.ts","sourceRoot":"","sources":["../../../src/lib/content.block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;IAC1B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,kBAAkB,GACzB,YAAY,CAUd;AAED,eAAO,MAAM,oBAAoB,EAAE,aAalC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ResourceMapper } from '@23blocks/jsonapi-codec';
2
+ import type { Activity } from '../types/activity';
3
+ export declare const activityMapper: ResourceMapper<Activity>;
4
+ //# sourceMappingURL=activity.mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/activity.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,mBAAmB,CAAC;AAGhE,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,QAAQ,CAoBnD,CAAC"}
@@ -3,4 +3,6 @@ export * from './comment.mapper';
3
3
  export * from './category.mapper';
4
4
  export * from './tag.mapper';
5
5
  export * from './user.mapper';
6
+ export * from './moderation.mapper';
7
+ export * from './activity.mapper';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ResourceMapper } from '@23blocks/jsonapi-codec';
2
+ import type { ContentFlag } from '../types/moderation';
3
+ export declare const contentFlagMapper: ResourceMapper<ContentFlag>;
4
+ //# sourceMappingURL=moderation.mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moderation.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/moderation.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,WAAW,CAezD,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { Transport, PageResult } from '@23blocks/contracts';
2
+ import type { Activity, ListActivitiesParams } from '../types/activity';
3
+ import type { Comment, ListCommentsParams } from '../types/comment';
4
+ /**
5
+ * Activity Service Interface - User activity feed operations
6
+ */
7
+ export interface ActivityService {
8
+ /**
9
+ * Get activities for an identity (user)
10
+ */
11
+ getActivities(identityUniqueId: string, params?: ListActivitiesParams): Promise<PageResult<Activity>>;
12
+ /**
13
+ * Get comments by an identity (user)
14
+ */
15
+ getComments(identityUniqueId: string, params?: ListCommentsParams): Promise<PageResult<Comment>>;
16
+ /**
17
+ * Get the user's activity feed (activities from followed users)
18
+ */
19
+ getFeed(params?: ListActivitiesParams): Promise<PageResult<Activity>>;
20
+ }
21
+ /**
22
+ * Create the Activity service
23
+ */
24
+ export declare function createActivityService(transport: Transport, _config: {
25
+ appId: string;
26
+ }): ActivityService;
27
+ //# sourceMappingURL=activity.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/activity.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAIpE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,aAAa,CAAC,gBAAgB,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEtG;;OAEG;IACH,WAAW,CAAC,gBAAgB,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IAEjG;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;CACvE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACzB,eAAe,CAqDjB"}
@@ -6,8 +6,13 @@ export interface CommentsService {
6
6
  create(data: CreateCommentRequest): Promise<Comment>;
7
7
  update(uniqueId: string, data: UpdateCommentRequest): Promise<Comment>;
8
8
  delete(uniqueId: string): Promise<void>;
9
+ reply(parentCommentUniqueId: string, data: Omit<CreateCommentRequest, 'parentId'>): Promise<Comment>;
9
10
  like(uniqueId: string): Promise<Comment>;
10
11
  dislike(uniqueId: string): Promise<Comment>;
12
+ save(uniqueId: string): Promise<Comment>;
13
+ unsave(uniqueId: string): Promise<Comment>;
14
+ follow(uniqueId: string): Promise<Comment>;
15
+ unfollow(uniqueId: string): Promise<Comment>;
11
16
  }
12
17
  export declare function createCommentsService(transport: Transport, _config: {
13
18
  appId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"comments.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/comments.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IAChE,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrD,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvE,MAAM,CA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,CAAC;IACzC,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9C;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,eAAe,CAuGvG"}
@@ -3,4 +3,6 @@ export * from './comments.service';
3
3
  export * from './categories.service';
4
4
  export * from './tags.service';
5
5
  export * from './users.service';
6
+ export * from './moderation.service';
7
+ export * from './activity.service';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { Transport, PageResult } from '@23blocks/contracts';
2
+ import type { ModerationResult, ModerateContentRequest, ContentFlag, CreateContentFlagRequest, ListContentFlagsParams } from '../types/moderation';
3
+ /**
4
+ * Moderation Service Interface - Content moderation operations
5
+ */
6
+ export interface ModerationService {
7
+ /**
8
+ * Moderate a post
9
+ */
10
+ moderatePost(postUniqueId: string, request: ModerateContentRequest): Promise<ModerationResult>;
11
+ /**
12
+ * Moderate a comment
13
+ */
14
+ moderateComment(postUniqueId: string, commentUniqueId: string, request: ModerateContentRequest): Promise<ModerationResult>;
15
+ /**
16
+ * List content flags
17
+ */
18
+ listFlags(params?: ListContentFlagsParams): Promise<PageResult<ContentFlag>>;
19
+ /**
20
+ * Get a specific flag
21
+ */
22
+ getFlag(flagUniqueId: string): Promise<ContentFlag>;
23
+ /**
24
+ * Create a content flag (report content)
25
+ */
26
+ createFlag(request: CreateContentFlagRequest): Promise<ContentFlag>;
27
+ /**
28
+ * Resolve a content flag
29
+ */
30
+ resolveFlag(flagUniqueId: string, resolution: string): Promise<ContentFlag>;
31
+ /**
32
+ * Dismiss a content flag
33
+ */
34
+ dismissFlag(flagUniqueId: string, reason?: string): Promise<void>;
35
+ }
36
+ /**
37
+ * Create the Moderation service
38
+ */
39
+ export declare function createModerationService(transport: Transport, _config: {
40
+ appId: string;
41
+ }): ModerationService;
42
+ //# sourceMappingURL=moderation.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moderation.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/moderation.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,WAAW,EACX,wBAAwB,EACxB,sBAAsB,EAEvB,MAAM,qBAAqB,CAAC;AAG7B;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE/F;;OAEG;IACH,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE3H;;OAEG;IACH,SAAS,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;IAE7E;;OAEG;IACH,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEpD;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEpE;;OAEG;IACH,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAE5E;;OAEG;IACH,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACzB,iBAAiB,CA+FnB"}
@@ -0,0 +1,38 @@
1
+ import type { IdentityCore, EntityStatus } from '@23blocks/contracts';
2
+ /**
3
+ * Content activity types
4
+ */
5
+ export type ActivityType = 'post_created' | 'post_updated' | 'post_liked' | 'post_shared' | 'comment_created' | 'comment_liked' | 'comment_reply' | 'followed' | 'unfollowed' | 'saved' | 'unsaved';
6
+ /**
7
+ * Activity feed item
8
+ */
9
+ export interface Activity extends IdentityCore {
10
+ activityType: ActivityType;
11
+ actorUniqueId: string;
12
+ actorName?: string;
13
+ actorAvatarUrl?: string;
14
+ targetType: 'post' | 'comment' | 'user';
15
+ targetUniqueId: string;
16
+ targetTitle?: string;
17
+ targetPreview?: string;
18
+ relatedUniqueId?: string;
19
+ relatedType?: string;
20
+ metadata?: Record<string, unknown>;
21
+ status: EntityStatus;
22
+ enabled: boolean;
23
+ }
24
+ /**
25
+ * List activities params
26
+ */
27
+ export interface ListActivitiesParams {
28
+ page?: number;
29
+ perPage?: number;
30
+ identityUniqueId?: string;
31
+ activityType?: ActivityType;
32
+ targetType?: 'post' | 'comment' | 'user';
33
+ dateFrom?: string;
34
+ dateTo?: string;
35
+ sortBy?: string;
36
+ sortOrder?: 'asc' | 'desc';
37
+ }
38
+ //# sourceMappingURL=activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,cAAc,GACd,cAAc,GACd,YAAY,GACZ,aAAa,GACb,iBAAiB,GACjB,eAAe,GACf,eAAe,GACf,UAAU,GACV,YAAY,GACZ,OAAO,GACP,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,QAAS,SAAQ,YAAY;IAC5C,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B"}
@@ -3,4 +3,6 @@ export * from './comment';
3
3
  export * from './category';
4
4
  export * from './tag';
5
5
  export * from './user';
6
+ export * from './moderation';
7
+ export * from './activity';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,60 @@
1
+ import type { EntityStatus } from '@23blocks/contracts';
2
+ /**
3
+ * Moderation action types
4
+ */
5
+ export type ModerationAction = 'hide' | 'delete' | 'flag' | 'unflag' | 'approve' | 'reject';
6
+ /**
7
+ * Moderation result
8
+ */
9
+ export interface ModerationResult {
10
+ success: boolean;
11
+ action: ModerationAction;
12
+ moderatedAt: Date;
13
+ moderatedBy?: string;
14
+ reason?: string;
15
+ }
16
+ /**
17
+ * Moderation request
18
+ */
19
+ export interface ModerateContentRequest {
20
+ action: ModerationAction;
21
+ reason?: string;
22
+ }
23
+ /**
24
+ * Content flag
25
+ */
26
+ export interface ContentFlag {
27
+ uniqueId: string;
28
+ contentType: 'post' | 'comment';
29
+ contentUniqueId: string;
30
+ reporterUniqueId: string;
31
+ reason: string;
32
+ category?: 'spam' | 'harassment' | 'inappropriate' | 'copyright' | 'other';
33
+ status: EntityStatus;
34
+ createdAt: Date;
35
+ resolvedAt?: Date;
36
+ resolvedBy?: string;
37
+ resolution?: string;
38
+ }
39
+ /**
40
+ * Create content flag request
41
+ */
42
+ export interface CreateContentFlagRequest {
43
+ contentType: 'post' | 'comment';
44
+ contentUniqueId: string;
45
+ reason: string;
46
+ category?: 'spam' | 'harassment' | 'inappropriate' | 'copyright' | 'other';
47
+ }
48
+ /**
49
+ * List content flags params
50
+ */
51
+ export interface ListContentFlagsParams {
52
+ page?: number;
53
+ perPage?: number;
54
+ contentType?: 'post' | 'comment';
55
+ category?: string;
56
+ status?: EntityStatus;
57
+ sortBy?: string;
58
+ sortOrder?: 'asc' | 'desc';
59
+ }
60
+ //# sourceMappingURL=moderation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moderation.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/moderation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE5F;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;IACzB,WAAW,EAAE,IAAI,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,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3.1.1",
3
+ "version": "3.3.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",