@abyss-project/spotlight 1.0.16 → 1.0.18

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.
@@ -19,3 +19,4 @@ export * from './project-post.api';
19
19
  export * from './project-event.api';
20
20
  export * from './project-follower.admin.api';
21
21
  export * from './project-follower.api';
22
+ export * from './report.admin.api';
package/dist/api/index.js CHANGED
@@ -35,3 +35,4 @@ __exportStar(require("./project-post.api"), exports);
35
35
  __exportStar(require("./project-event.api"), exports);
36
36
  __exportStar(require("./project-follower.admin.api"), exports);
37
37
  __exportStar(require("./project-follower.api"), exports);
38
+ __exportStar(require("./report.admin.api"), exports);
@@ -0,0 +1,2 @@
1
+ import { GetReportBody, GetReportResponse } from '../types';
2
+ export declare const getReportAdmin: (params: GetReportBody) => Promise<GetReportResponse>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getReportAdmin = void 0;
4
+ const __1 = require("..");
5
+ const getReportAdmin = async (params) => {
6
+ return (await __1.AbyssSpotlightCore.axios.get(`abyss/admin/yearly-report`, {
7
+ params,
8
+ })).data;
9
+ };
10
+ exports.getReportAdmin = getReportAdmin;
@@ -23,6 +23,7 @@ export * from './requests/project-event.request';
23
23
  export * from './requests/project-follower.admin.request';
24
24
  export * from './requests/project-follower.request';
25
25
  export * from './requests/project-analytics.request';
26
+ export * from './requests/report.admin.request';
26
27
  export * from './responses/abyss.admin.response';
27
28
  export * from './responses/monitor.response';
28
29
  export * from './responses/storage.admin.response';
@@ -45,3 +46,4 @@ export * from './responses/project-event.response';
45
46
  export * from './responses/project-follower.admin.response';
46
47
  export * from './responses/project-follower.response';
47
48
  export * from './responses/project-analytics.response';
49
+ export * from './responses/report.admin.response';
@@ -39,6 +39,7 @@ __exportStar(require("./requests/project-event.request"), exports);
39
39
  __exportStar(require("./requests/project-follower.admin.request"), exports);
40
40
  __exportStar(require("./requests/project-follower.request"), exports);
41
41
  __exportStar(require("./requests/project-analytics.request"), exports);
42
+ __exportStar(require("./requests/report.admin.request"), exports);
42
43
  __exportStar(require("./responses/abyss.admin.response"), exports);
43
44
  __exportStar(require("./responses/monitor.response"), exports);
44
45
  __exportStar(require("./responses/storage.admin.response"), exports);
@@ -61,3 +62,4 @@ __exportStar(require("./responses/project-event.response"), exports);
61
62
  __exportStar(require("./responses/project-follower.admin.response"), exports);
62
63
  __exportStar(require("./responses/project-follower.response"), exports);
63
64
  __exportStar(require("./responses/project-analytics.response"), exports);
65
+ __exportStar(require("./responses/report.admin.response"), exports);
@@ -3,6 +3,7 @@ export interface IUpsertProjectPresentationParams {
3
3
  }
4
4
  export interface IUpsertProjectPresentationBody {
5
5
  content: string;
6
+ customCss?: string;
6
7
  }
7
8
  export interface IGetProjectPresentationParams {
8
9
  projectId: string;
@@ -0,0 +1,5 @@
1
+ export interface GetReportBody {
2
+ userId: string;
3
+ startDate: Date;
4
+ endDate: Date;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ export interface GetReportResponse {
2
+ data: {
3
+ metrics: {
4
+ totalPosts: number;
5
+ totalLikes: number;
6
+ totalComments: number;
7
+ totalShares: number;
8
+ averageLikesPerPost: number;
9
+ mostLikedPost: string;
10
+ postsByMonth: Array<{
11
+ month: number;
12
+ count: number;
13
+ }>;
14
+ engagementByMonth: Array<{
15
+ month: number;
16
+ likes: number;
17
+ comments: number;
18
+ }>;
19
+ };
20
+ };
21
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,6 +4,7 @@ export interface IProjectPresentation {
4
4
  id?: string;
5
5
  type: ProjectPresentationType;
6
6
  content: string;
7
+ customCss?: string;
7
8
  projectId: string;
8
9
  updatedAt?: Date;
9
10
  createdAt?: Date;
@@ -0,0 +1,2 @@
1
+ export declare const sanitizeCss: (css: string) => string;
2
+ export declare const isValidCss: (css: string) => boolean;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidCss = exports.sanitizeCss = void 0;
4
+ const sanitizeCss = (css) => {
5
+ if (!css) {
6
+ return '';
7
+ }
8
+ let sanitized = css;
9
+ sanitized = sanitized.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
10
+ sanitized = sanitized.replace(/<\/style>/gi, '');
11
+ sanitized = sanitized.replace(/javascript:/gi, '');
12
+ sanitized = sanitized.replace(/\bon\w+\s*=/gi, '');
13
+ sanitized = sanitized.replace(/expression\s*\(/gi, '');
14
+ sanitized = sanitized.replace(/@import\s+.*javascript:/gi, '');
15
+ sanitized = sanitized.replace(/behavior\s*:/gi, '/* behavior: */');
16
+ sanitized = sanitized.replace(/-moz-binding\s*:/gi, '/* -moz-binding: */');
17
+ return sanitized.trim();
18
+ };
19
+ exports.sanitizeCss = sanitizeCss;
20
+ const isValidCss = (css) => {
21
+ if (!css) {
22
+ return true;
23
+ }
24
+ const suspiciousPatterns = [
25
+ /<script/i,
26
+ /<\/script>/i,
27
+ /javascript:/i,
28
+ /on\w+=/i,
29
+ /expression\(/i,
30
+ ];
31
+ return !suspiciousPatterns.some((pattern) => pattern.test(css));
32
+ };
33
+ exports.isValidCss = isValidCss;
@@ -1 +1,2 @@
1
1
  export * from './error.utils';
2
+ export * from './css-sanitizer.utils';
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./error.utils"), exports);
18
+ __exportStar(require("./css-sanitizer.utils"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/spotlight",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "Core package to interact with Abyss-Spotlight",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",