@zyacreatives/shared 1.6.3 → 1.6.5

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.
@@ -80,17 +80,12 @@ export declare const INVESTOR_VERIFICATION_DOCUMENT_TYPES: {
80
80
  readonly BUSINESS_REGISTRATION: "BUSINESS_REGISTRATION";
81
81
  readonly OTHER_CERTIFICATE: "OTHER_CERTIFICATE";
82
82
  };
83
- export declare const LIKE_PARENT_TYPES: {
84
- readonly PROJECT: "PROJECT";
85
- readonly POST: "POST";
86
- };
87
- export declare const COMMENT_PARENT_TYPES: {
83
+ export declare const ACTIVITY_PARENT_TYPES: {
88
84
  readonly PROJECT: "PROJECT";
89
85
  readonly POST: "POST";
90
86
  };
91
87
  export type Role = (typeof ROLES)[keyof typeof ROLES];
92
- export type LikeParentType = (typeof LIKE_PARENT_TYPES)[keyof typeof LIKE_PARENT_TYPES];
93
- export type CommentParentType = (typeof COMMENT_PARENT_TYPES)[keyof typeof COMMENT_PARENT_TYPES];
88
+ export type ActivityParentType = (typeof ACTIVITY_PARENT_TYPES)[keyof typeof ACTIVITY_PARENT_TYPES];
94
89
  export type UserStatus = (typeof USER_STATUSES)[keyof typeof USER_STATUSES];
95
90
  export type ClientType = (typeof CLIENT_TYPES)[keyof typeof CLIENT_TYPES];
96
91
  export type ExperienceLevel = (typeof EXPERIENCE_LEVELS)[keyof typeof EXPERIENCE_LEVELS];
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_DISCIPLINES = exports.API_ROUTES = exports.COMMENT_PARENT_TYPES = exports.LIKE_PARENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_STATUSES = exports.GEOGRAPHIC_FOCUS = exports.INVESTMENT_SIZES = exports.INVESTOR_TYPES = exports.ONBOARDING_PAGES = exports.EXPERIENCE_LEVELS = exports.CLIENT_TYPES = exports.USER_STATUSES = exports.ROLES = void 0;
3
+ exports.DEFAULT_DISCIPLINES = exports.API_ROUTES = exports.ACTIVITY_PARENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_STATUSES = exports.GEOGRAPHIC_FOCUS = exports.INVESTMENT_SIZES = exports.INVESTOR_TYPES = exports.ONBOARDING_PAGES = exports.EXPERIENCE_LEVELS = exports.CLIENT_TYPES = exports.USER_STATUSES = exports.ROLES = void 0;
4
4
  exports.ROLES = {
5
5
  CREATIVE: "CREATIVE",
6
6
  BRAND: "BRAND",
@@ -83,11 +83,10 @@ exports.INVESTOR_VERIFICATION_DOCUMENT_TYPES = {
83
83
  BUSINESS_REGISTRATION: "BUSINESS_REGISTRATION",
84
84
  OTHER_CERTIFICATE: "OTHER_CERTIFICATE",
85
85
  };
86
- exports.LIKE_PARENT_TYPES = {
86
+ exports.ACTIVITY_PARENT_TYPES = {
87
87
  PROJECT: "PROJECT",
88
88
  POST: "POST",
89
89
  };
90
- exports.COMMENT_PARENT_TYPES = exports.LIKE_PARENT_TYPES;
91
90
  exports.API_ROUTES = {
92
91
  healthCheck: "/health",
93
92
  username: {
@@ -0,0 +1,14 @@
1
+ import z from "zod";
2
+ export declare const CommentEntitySchema: z.ZodObject<{
3
+ id: z.ZodCUID2;
4
+ userId: z.ZodCUID2;
5
+ parentId: z.ZodCUID2;
6
+ parentType: z.ZodEnum<{
7
+ readonly PROJECT: "PROJECT";
8
+ readonly POST: "POST";
9
+ }>;
10
+ content: z.ZodString;
11
+ replyToId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
12
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
13
+ updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
14
+ }, z.core.$strip>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CommentEntitySchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ const constants_1 = require("../constants");
9
+ exports.CommentEntitySchema = zod_1.default.object({
10
+ id: zod_1.default.cuid2().openapi({
11
+ description: "The unique CUID2 identifier for the comment.",
12
+ example: "tr4q2k7k0000c7625z2k8ggy",
13
+ }),
14
+ userId: zod_1.default.cuid2().openapi({
15
+ description: "The CUID2 of the user who created the comment.",
16
+ example: "clq9p8f2z0000c762s7k4g1b",
17
+ }),
18
+ parentId: zod_1.default.cuid2().openapi({
19
+ description: "The CUID2 of the parent entity (e.g., a post or project) this comment belongs to.",
20
+ example: "clq9p8f2z0000c762s7k4g1b",
21
+ }),
22
+ parentType: zod_1.default.enum(constants_1.ACTIVITY_PARENT_TYPES).openapi({
23
+ description: "The type of the parent entity this comment is attached to.",
24
+ example: "POST", // Assuming 'POST' is a value in ACTIVITY_PARENT_TYPES
25
+ }),
26
+ content: zod_1.default.string().openapi({
27
+ description: "The text content of the comment. May contain Markdown.",
28
+ example: "This is a great point! I hadn't considered that perspective.",
29
+ }),
30
+ replyToId: zod_1.default.cuid2().optional().nullable().openapi({
31
+ description: "The ID of the parent comment if this is a reply. Null for top-level comments.",
32
+ example: "tr4q2k7k0000c7625z2k8ggy", // Example of a parent comment's ID
33
+ }),
34
+ createdAt: zod_1.default.coerce.date().optional().openapi({
35
+ description: "The date and time the comment was created.",
36
+ example: "2023-10-27T10:00:00.000Z",
37
+ format: "date-time",
38
+ }),
39
+ updatedAt: zod_1.default.coerce.date().optional().openapi({
40
+ description: "The date and time the comment was last updated.",
41
+ example: "2023-10-27T10:05:00.000Z",
42
+ format: "date-time",
43
+ })
44
+ });
@@ -0,0 +1,14 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ export declare const EntityStatsSchema: z.ZodObject<{
3
+ updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
4
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
5
+ parentId: z.ZodCUID2;
6
+ parentType: z.ZodEnum<{
7
+ readonly PROJECT: "PROJECT";
8
+ readonly POST: "POST";
9
+ }>;
10
+ likesCount: z.ZodNumber;
11
+ bookmarksCount: z.ZodNumber;
12
+ viewsCount: z.ZodNumber;
13
+ commentsCount: z.ZodNumber;
14
+ }, z.core.$strip>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EntityStatsSchema = void 0;
4
+ const zod_openapi_1 = require("@hono/zod-openapi");
5
+ const constants_1 = require("../constants");
6
+ exports.EntityStatsSchema = zod_openapi_1.z
7
+ .object({
8
+ updatedAt: zod_openapi_1.z.coerce.date().optional().openapi({
9
+ description: "Timestamp of the last update to the entity statistics.",
10
+ title: "Updated At",
11
+ }),
12
+ createdAt: zod_openapi_1.z.coerce.date().optional().openapi({
13
+ description: "Timestamp of the creationn to the entity statistics.",
14
+ title: "Updated At",
15
+ }),
16
+ parentId: zod_openapi_1.z.cuid2().openapi({
17
+ description: "Unique identifier of the parent entity (e.g., project, post, etc.).",
18
+ title: "Parent ID",
19
+ }),
20
+ parentType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES).openapi({
21
+ description: "Type of the parent entity this statistic belongs to.",
22
+ title: "Parent Type",
23
+ }),
24
+ likesCount: zod_openapi_1.z.number().openapi({
25
+ description: "Total number of likes associated with the entity.",
26
+ title: "Likes Count",
27
+ }),
28
+ bookmarksCount: zod_openapi_1.z.number().openapi({
29
+ description: "Total number of bookmarks associated with the entity.",
30
+ title: "Bookmarks Count",
31
+ }),
32
+ viewsCount: zod_openapi_1.z.number().openapi({
33
+ description: "Total number of views recorded for the entity.",
34
+ title: "Views Count",
35
+ }),
36
+ commentsCount: zod_openapi_1.z.number().openapi({
37
+ description: "Total number of comments linked to the entity.",
38
+ title: "Comments Count",
39
+ }),
40
+ })
41
+ .openapi({
42
+ description: "Represents engagement statistics for a specific entity.",
43
+ title: "EntityStats",
44
+ });
@@ -0,0 +1,7 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ export declare const LikeEntitySchema: z.ZodObject<{
3
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
4
+ userId: z.ZodCUID2;
5
+ parentId: z.ZodCUID2;
6
+ parentType: z.ZodString;
7
+ }, z.core.$strip>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LikeEntitySchema = void 0;
4
+ const zod_openapi_1 = require("@hono/zod-openapi");
5
+ exports.LikeEntitySchema = zod_openapi_1.z
6
+ .object({
7
+ createdAt: zod_openapi_1.z.coerce.date().optional().openapi({
8
+ description: "Timestamp when the like was created.",
9
+ title: "Created At",
10
+ }),
11
+ userId: zod_openapi_1.z.cuid2().openapi({
12
+ description: "Identifier of the user who performed the like.",
13
+ title: "User ID",
14
+ }),
15
+ parentId: zod_openapi_1.z.cuid2().openapi({
16
+ description: "Identifier of the parent entity that was liked.",
17
+ title: "Parent ID",
18
+ }),
19
+ parentType: zod_openapi_1.z.string().openapi({
20
+ description: "Type of the parent entity (e.g., project, post, etc.).",
21
+ title: "Parent Type",
22
+ }),
23
+ })
24
+ .openapi({
25
+ description: "Represents a single like event on a parent entity.",
26
+ title: "Like",
27
+ });
@@ -0,0 +1,15 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ export declare const ViewEntitySchema: z.ZodObject<{
3
+ id: z.ZodCUID2;
4
+ userId: z.ZodNullable<z.ZodCUID2>;
5
+ ipAddress: z.ZodNullable<z.ZodString>;
6
+ userAgent: z.ZodNullable<z.ZodString>;
7
+ parentId: z.ZodCUID2;
8
+ parentType: z.ZodEnum<{
9
+ readonly PROJECT: "PROJECT";
10
+ readonly POST: "POST";
11
+ }>;
12
+ sessionId: z.ZodNullable<z.ZodString>;
13
+ viewedAt: z.ZodString;
14
+ viewDate: z.ZodString;
15
+ }, z.core.$strip>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ViewEntitySchema = void 0;
4
+ const zod_openapi_1 = require("@hono/zod-openapi");
5
+ const constants_1 = require("../constants");
6
+ exports.ViewEntitySchema = zod_openapi_1.z
7
+ .object({
8
+ id: zod_openapi_1.z.cuid2().openapi({
9
+ description: "Unique identifier of the view record.",
10
+ title: "View ID",
11
+ }),
12
+ userId: zod_openapi_1.z.cuid2().nullable().openapi({
13
+ description: "Identifier of the user who viewed the entity, if authenticated.",
14
+ title: "User ID",
15
+ }),
16
+ ipAddress: zod_openapi_1.z.string().nullable().openapi({
17
+ description: "IP address from which the entity was viewed.",
18
+ title: "IP Address",
19
+ }),
20
+ userAgent: zod_openapi_1.z.string().nullable().openapi({
21
+ description: "User agent string identifying the client device or browser.",
22
+ title: "User Agent",
23
+ }),
24
+ parentId: zod_openapi_1.z.cuid2().openapi({
25
+ description: "Identifier of the parent entity being viewed.",
26
+ title: "Parent ID",
27
+ }),
28
+ parentType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES).openapi({
29
+ description: "Type of the parent entity (e.g., project, post, etc.).",
30
+ title: "Parent Type",
31
+ }),
32
+ sessionId: zod_openapi_1.z.string().nullable().openapi({
33
+ description: "Session identifier associated with the view event, if available.",
34
+ title: "Session ID",
35
+ }),
36
+ viewedAt: zod_openapi_1.z.string().datetime().openapi({
37
+ description: "Exact timestamp when the view occurred.",
38
+ title: "Viewed At",
39
+ }),
40
+ viewDate: zod_openapi_1.z.string().date().openapi({
41
+ description: "Calendar date corresponding to the view event, used for aggregation.",
42
+ title: "View Date",
43
+ }),
44
+ })
45
+ .openapi({
46
+ description: "Represents a record of a single view event for an entity.",
47
+ title: "View",
48
+ });
@@ -0,0 +1,3 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import { CommentEntitySchema } from "../schemas/comment";
3
+ export type CommentEntity = z.infer<typeof CommentEntitySchema>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import { EntityStatsSchema } from "../schemas/entity-stats";
3
+ export type EntityStatsEntity = z.infer<typeof EntityStatsSchema>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import { LikeEntitySchema } from "../schemas/like";
3
+ export type LikeEntity = z.infer<typeof LikeEntitySchema>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/constants.ts CHANGED
@@ -90,18 +90,14 @@ export const INVESTOR_VERIFICATION_DOCUMENT_TYPES = {
90
90
  OTHER_CERTIFICATE: "OTHER_CERTIFICATE",
91
91
  } as const;
92
92
 
93
- export const LIKE_PARENT_TYPES = {
93
+ export const ACTIVITY_PARENT_TYPES = {
94
94
  PROJECT: "PROJECT",
95
95
  POST: "POST",
96
96
  } as const;
97
97
 
98
- export const COMMENT_PARENT_TYPES = LIKE_PARENT_TYPES;
99
-
100
98
  export type Role = (typeof ROLES)[keyof typeof ROLES];
101
- export type LikeParentType =
102
- (typeof LIKE_PARENT_TYPES)[keyof typeof LIKE_PARENT_TYPES];
103
- export type CommentParentType =
104
- (typeof COMMENT_PARENT_TYPES)[keyof typeof COMMENT_PARENT_TYPES];
99
+ export type ActivityParentType =
100
+ (typeof ACTIVITY_PARENT_TYPES)[keyof typeof ACTIVITY_PARENT_TYPES];
105
101
  export type UserStatus = (typeof USER_STATUSES)[keyof typeof USER_STATUSES];
106
102
  export type ClientType = (typeof CLIENT_TYPES)[keyof typeof CLIENT_TYPES];
107
103
  export type ExperienceLevel =
@@ -0,0 +1,40 @@
1
+ import z from "zod";
2
+ import { ACTIVITY_PARENT_TYPES } from "../constants";
3
+
4
+ export const CommentEntitySchema = z.object({
5
+ id: z.cuid2().openapi({
6
+ description: "The unique CUID2 identifier for the comment.",
7
+ example: "tr4q2k7k0000c7625z2k8ggy",
8
+ }),
9
+ userId: z.cuid2().openapi({
10
+ description: "The CUID2 of the user who created the comment.",
11
+ example: "clq9p8f2z0000c762s7k4g1b",
12
+ }),
13
+ parentId: z.cuid2().openapi({
14
+ description: "The CUID2 of the parent entity (e.g., a post or project) this comment belongs to.",
15
+ example: "clq9p8f2z0000c762s7k4g1b",
16
+ }),
17
+ parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
18
+ description: "The type of the parent entity this comment is attached to.",
19
+ example: "POST", // Assuming 'POST' is a value in ACTIVITY_PARENT_TYPES
20
+ }),
21
+ content: z.string().openapi({
22
+ description: "The text content of the comment. May contain Markdown.",
23
+ example: "This is a great point! I hadn't considered that perspective.",
24
+ }),
25
+
26
+ replyToId: z.cuid2().optional().nullable().openapi({
27
+ description: "The ID of the parent comment if this is a reply. Null for top-level comments.",
28
+ example: "tr4q2k7k0000c7625z2k8ggy", // Example of a parent comment's ID
29
+ }),
30
+ createdAt: z.coerce.date().optional().openapi({
31
+ description: "The date and time the comment was created.",
32
+ example: "2023-10-27T10:00:00.000Z",
33
+ format: "date-time",
34
+ }),
35
+ updatedAt: z.coerce.date().optional().openapi({
36
+ description: "The date and time the comment was last updated.",
37
+ example: "2023-10-27T10:05:00.000Z",
38
+ format: "date-time",
39
+ })
40
+ });
@@ -0,0 +1,43 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import { ACTIVITY_PARENT_TYPES } from "../constants";
3
+
4
+ export const EntityStatsSchema = z
5
+ .object({
6
+ updatedAt: z.coerce.date().optional().openapi({
7
+ description: "Timestamp of the last update to the entity statistics.",
8
+ title: "Updated At",
9
+ }),
10
+ createdAt: z.coerce.date().optional().openapi({
11
+ description: "Timestamp of the creationn to the entity statistics.",
12
+ title: "Updated At",
13
+ }),
14
+ parentId: z.cuid2().openapi({
15
+ description:
16
+ "Unique identifier of the parent entity (e.g., project, post, etc.).",
17
+ title: "Parent ID",
18
+ }),
19
+ parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
20
+ description: "Type of the parent entity this statistic belongs to.",
21
+ title: "Parent Type",
22
+ }),
23
+ likesCount: z.number().openapi({
24
+ description: "Total number of likes associated with the entity.",
25
+ title: "Likes Count",
26
+ }),
27
+ bookmarksCount: z.number().openapi({
28
+ description: "Total number of bookmarks associated with the entity.",
29
+ title: "Bookmarks Count",
30
+ }),
31
+ viewsCount: z.number().openapi({
32
+ description: "Total number of views recorded for the entity.",
33
+ title: "Views Count",
34
+ }),
35
+ commentsCount: z.number().openapi({
36
+ description: "Total number of comments linked to the entity.",
37
+ title: "Comments Count",
38
+ }),
39
+ })
40
+ .openapi({
41
+ description: "Represents engagement statistics for a specific entity.",
42
+ title: "EntityStats",
43
+ });
@@ -0,0 +1,25 @@
1
+ import { z } from "@hono/zod-openapi";
2
+
3
+ export const LikeEntitySchema = z
4
+ .object({
5
+ createdAt: z.coerce.date().optional().openapi({
6
+ description: "Timestamp when the like was created.",
7
+ title: "Created At",
8
+ }),
9
+ userId: z.cuid2().openapi({
10
+ description: "Identifier of the user who performed the like.",
11
+ title: "User ID",
12
+ }),
13
+ parentId: z.cuid2().openapi({
14
+ description: "Identifier of the parent entity that was liked.",
15
+ title: "Parent ID",
16
+ }),
17
+ parentType: z.string().openapi({
18
+ description: "Type of the parent entity (e.g., project, post, etc.).",
19
+ title: "Parent Type",
20
+ }),
21
+ })
22
+ .openapi({
23
+ description: "Represents a single like event on a parent entity.",
24
+ title: "Like",
25
+ });
@@ -0,0 +1,50 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import { ACTIVITY_PARENT_TYPES } from "../constants";
3
+
4
+ export const ViewEntitySchema = z
5
+ .object({
6
+ id: z.cuid2().openapi({
7
+ description: "Unique identifier of the view record.",
8
+ title: "View ID",
9
+ }),
10
+ userId: z.cuid2().nullable().openapi({
11
+ description:
12
+ "Identifier of the user who viewed the entity, if authenticated.",
13
+ title: "User ID",
14
+ }),
15
+ ipAddress: z.string().nullable().openapi({
16
+ description: "IP address from which the entity was viewed.",
17
+ title: "IP Address",
18
+ }),
19
+ userAgent: z.string().nullable().openapi({
20
+ description:
21
+ "User agent string identifying the client device or browser.",
22
+ title: "User Agent",
23
+ }),
24
+ parentId: z.cuid2().openapi({
25
+ description: "Identifier of the parent entity being viewed.",
26
+ title: "Parent ID",
27
+ }),
28
+ parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
29
+ description: "Type of the parent entity (e.g., project, post, etc.).",
30
+ title: "Parent Type",
31
+ }),
32
+ sessionId: z.string().nullable().openapi({
33
+ description:
34
+ "Session identifier associated with the view event, if available.",
35
+ title: "Session ID",
36
+ }),
37
+ viewedAt: z.string().datetime().openapi({
38
+ description: "Exact timestamp when the view occurred.",
39
+ title: "Viewed At",
40
+ }),
41
+ viewDate: z.string().date().openapi({
42
+ description:
43
+ "Calendar date corresponding to the view event, used for aggregation.",
44
+ title: "View Date",
45
+ }),
46
+ })
47
+ .openapi({
48
+ description: "Represents a record of a single view event for an entity.",
49
+ title: "View",
50
+ });
@@ -0,0 +1,4 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import { CommentEntitySchema } from "../schemas/comment";
3
+
4
+ export type CommentEntity = z.infer<typeof CommentEntitySchema>;
@@ -0,0 +1,4 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import { EntityStatsSchema } from "../schemas/entity-stats";
3
+
4
+ export type EntityStatsEntity = z.infer<typeof EntityStatsSchema>;
@@ -0,0 +1,4 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import { LikeEntitySchema } from "../schemas/like";
3
+
4
+ export type LikeEntity = z.infer<typeof LikeEntitySchema>