sea-platform-helpers 1.1.0 → 1.2.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.
Files changed (34) hide show
  1. package/dist/constants/application/index.d.ts +1 -0
  2. package/dist/constants/application/index.d.ts.map +1 -1
  3. package/dist/constants/application/index.js +7 -0
  4. package/dist/constants/permission/index.d.ts +12 -1
  5. package/dist/constants/permission/index.d.ts.map +1 -1
  6. package/dist/constants/permission/index.js +86 -0
  7. package/dist/dto/calendar/index.d.ts +12 -0
  8. package/dist/dto/calendar/index.d.ts.map +1 -0
  9. package/dist/dto/calendar/index.js +2 -0
  10. package/dist/dto/category/index.d.ts +1 -0
  11. package/dist/dto/category/index.d.ts.map +1 -0
  12. package/dist/dto/category/index.js +1 -0
  13. package/dist/dto/event/index.d.ts +53 -0
  14. package/dist/dto/event/index.d.ts.map +1 -0
  15. package/dist/dto/event/index.js +10 -0
  16. package/dist/dto/event-category/index.d.ts +7 -0
  17. package/dist/dto/event-category/index.d.ts.map +1 -0
  18. package/dist/dto/event-category/index.js +2 -0
  19. package/dist/dto/index.d.ts +3 -0
  20. package/dist/dto/index.d.ts.map +1 -1
  21. package/dist/dto/index.js +4 -1
  22. package/dist/utils/array/index.d.ts +1 -0
  23. package/dist/utils/array/index.d.ts.map +1 -1
  24. package/dist/utils/array/index.js +12 -1
  25. package/dist/utils/moment/index.d.ts +6 -0
  26. package/dist/utils/moment/index.d.ts.map +1 -1
  27. package/dist/utils/moment/index.js +49 -2
  28. package/dist/utils/numbers/index.d.ts +2 -2
  29. package/dist/utils/numbers/index.d.ts.map +1 -1
  30. package/dist/utils/numbers/index.js +8 -2
  31. package/dist/utils/string/index.d.ts +2 -0
  32. package/dist/utils/string/index.d.ts.map +1 -1
  33. package/dist/utils/string/index.js +6 -1
  34. package/package.json +36 -36
@@ -5,6 +5,7 @@ export declare enum ApplicationStatuses {
5
5
  }
6
6
  export declare enum ApplicationKeys {
7
7
  PlatformAdministrationApplication = "Platform-Administration-Application",
8
+ PublicCalendarApplication = "Public-Calendar-Application",
8
9
  StrategyApplication = "Strategy-Application"
9
10
  }
10
11
  export declare const Applications: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/application/index.ts"],"names":[],"mappings":"AAAA,oBAAY,mBAAmB;IAC7B,WAAW,gBAAgB;IAC3B,WAAW,iBAAiB;IAC5B,SAAS,cAAc;CACxB;AAED,oBAAY,eAAe;IACzB,iCAAiC,wCAAwC;IACzE,mBAAmB,yBAAyB;CAC7C;AAED,eAAO,MAAM,YAAY;;;;;GAexB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/application/index.ts"],"names":[],"mappings":"AAAA,oBAAY,mBAAmB;IAC7B,WAAW,gBAAgB;IAC3B,WAAW,iBAAiB;IAC5B,SAAS,cAAc;CACxB;AAED,oBAAY,eAAe;IACzB,iCAAiC,wCAAwC;IACzE,yBAAyB,gCAAgC;IACzD,mBAAmB,yBAAyB;CAC7C;AAED,eAAO,MAAM,YAAY;;;;;GAsBxB,CAAC"}
@@ -10,6 +10,7 @@ var ApplicationStatuses;
10
10
  var ApplicationKeys;
11
11
  (function (ApplicationKeys) {
12
12
  ApplicationKeys["PlatformAdministrationApplication"] = "Platform-Administration-Application";
13
+ ApplicationKeys["PublicCalendarApplication"] = "Public-Calendar-Application";
13
14
  ApplicationKeys["StrategyApplication"] = "Strategy-Application";
14
15
  })(ApplicationKeys || (exports.ApplicationKeys = ApplicationKeys = {}));
15
16
  exports.Applications = [
@@ -19,6 +20,12 @@ exports.Applications = [
19
20
  status: ApplicationStatuses.Available,
20
21
  description: "The main application for managing the platform, including user accounts, roles, and permissions.",
21
22
  },
23
+ {
24
+ name: "Public Calendar Application",
25
+ key: ApplicationKeys.PublicCalendarApplication,
26
+ status: ApplicationStatuses.Unavailable,
27
+ description: "An application for managing the public calendar within the platform.",
28
+ },
22
29
  {
23
30
  name: "Strategy Application",
24
31
  key: ApplicationKeys.StrategyApplication,
@@ -54,7 +54,18 @@ export declare enum PermissionKeys {
54
54
  ManageProjectsDelete = "manage-projects-delete",
55
55
  ManageProjectMembers = "manage-project-members",
56
56
  ManageProjectMilestones = "manage-project-milestones",
57
- ManageProjectSections = "manage-project-sections"
57
+ ManageProjectSections = "manage-project-sections",
58
+ PublicCalendarApp = "public-calendar-app",
59
+ PublicCalendarManagement = "public-calendar-management",
60
+ ManageCalendar = "manage-calendar",
61
+ ManageCalendarCreate = "manage-calendar-create",
62
+ ManageCalendarRead = "manage-calendar-read",
63
+ ManageCalendarUpdateDetails = "manage-calendar-update-details",
64
+ ManageCalendarDelete = "manage-calendar-delete",
65
+ ManageEvent = "manage-event",
66
+ ManageEventRead = "manage-event-read",
67
+ ManageEventUpdateDetails = "manage-event-update-details",
68
+ ViewPublicCalendar = "view-public-calendar"
58
69
  }
59
70
  export declare const PERMISSIONS: IPermission[];
60
71
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/permission/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAExD,oBAAY,cAAc;IAExB,sBAAsB,4BAA4B;IAClD,cAAc,oBAAoB;IAClC,kBAAkB,yBAAyB;IAC3C,oBAAoB,2BAA2B;IAC/C,4BAA4B,oCAAoC;IAChE,2BAA2B,mCAAmC;IAC9D,oBAAoB,2BAA2B;IAC/C,wBAAwB,gCAAgC;IACxD,yBAAyB,iCAAiC;IAC1D,qBAAqB,4BAA4B;IACjD,WAAW,iBAAiB;IAC5B,eAAe,sBAAsB;IACrC,iBAAiB,wBAAwB;IACzC,wBAAwB,gCAAgC;IACxD,iBAAiB,wBAAwB;IACzC,iBAAiB,wBAAwB;IACzC,qBAAqB,6BAA6B;I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yB;IAC3C,2BAA2B,mCAAmC;IAC9D,oBAAoB,2BAA2B;IAC/C,WAAW,iBAAiB;IAC5B,eAAe,sBAAsB;IACrC,wBAAwB,gCAAgC;IACxD,kBAAkB,yBAAyB;CAC5C;AAED,eAAO,MAAM,WAAW,EAAE,WAAW,EA+apC,CAAC"}
@@ -60,6 +60,18 @@ var PermissionKeys;
60
60
  PermissionKeys["ManageProjectMembers"] = "manage-project-members";
61
61
  PermissionKeys["ManageProjectMilestones"] = "manage-project-milestones";
62
62
  PermissionKeys["ManageProjectSections"] = "manage-project-sections";
63
+ // Public Calendar
64
+ PermissionKeys["PublicCalendarApp"] = "public-calendar-app";
65
+ PermissionKeys["PublicCalendarManagement"] = "public-calendar-management";
66
+ PermissionKeys["ManageCalendar"] = "manage-calendar";
67
+ PermissionKeys["ManageCalendarCreate"] = "manage-calendar-create";
68
+ PermissionKeys["ManageCalendarRead"] = "manage-calendar-read";
69
+ PermissionKeys["ManageCalendarUpdateDetails"] = "manage-calendar-update-details";
70
+ PermissionKeys["ManageCalendarDelete"] = "manage-calendar-delete";
71
+ PermissionKeys["ManageEvent"] = "manage-event";
72
+ PermissionKeys["ManageEventRead"] = "manage-event-read";
73
+ PermissionKeys["ManageEventUpdateDetails"] = "manage-event-update-details";
74
+ PermissionKeys["ViewPublicCalendar"] = "view-public-calendar";
63
75
  })(PermissionKeys || (exports.PermissionKeys = PermissionKeys = {}));
64
76
  exports.PERMISSIONS = [
65
77
  // Administration Application
@@ -412,4 +424,78 @@ exports.PERMISSIONS = [
412
424
  },
413
425
  ],
414
426
  },
427
+ {
428
+ applicationKey: application_1.ApplicationKeys.PublicCalendarApplication,
429
+ key: PermissionKeys.PublicCalendarApp,
430
+ name: "Public Calendar",
431
+ isLeaf: false,
432
+ children: [
433
+ {
434
+ applicationKey: application_1.ApplicationKeys.PublicCalendarApplication,
435
+ key: PermissionKeys.PublicCalendarManagement,
436
+ name: "Management",
437
+ isLeaf: false,
438
+ children: [
439
+ {
440
+ applicationKey: application_1.ApplicationKeys.PublicCalendarApplication,
441
+ isLeaf: false,
442
+ key: PermissionKeys.ManageCalendar,
443
+ name: "Manage Calendar",
444
+ children: [
445
+ {
446
+ applicationKey: application_1.ApplicationKeys.PublicCalendarApplication,
447
+ isLeaf: true,
448
+ key: PermissionKeys.ManageCalendarCreate,
449
+ name: "Create Calendar",
450
+ },
451
+ {
452
+ applicationKey: application_1.ApplicationKeys.PublicCalendarApplication,
453
+ isLeaf: true,
454
+ key: PermissionKeys.ManageCalendarRead,
455
+ name: "Read Calendars",
456
+ },
457
+ {
458
+ applicationKey: application_1.ApplicationKeys.PublicCalendarApplication,
459
+ isLeaf: true,
460
+ key: PermissionKeys.ManageCalendarUpdateDetails,
461
+ name: "Update Calendar",
462
+ },
463
+ {
464
+ applicationKey: application_1.ApplicationKeys.PublicCalendarApplication,
465
+ isLeaf: true,
466
+ key: PermissionKeys.ManageCalendarDelete,
467
+ name: "Delete Calendar",
468
+ },
469
+ ],
470
+ },
471
+ {
472
+ applicationKey: application_1.ApplicationKeys.PublicCalendarApplication,
473
+ isLeaf: false,
474
+ key: PermissionKeys.ManageEvent,
475
+ name: "Manage Event",
476
+ children: [
477
+ {
478
+ applicationKey: application_1.ApplicationKeys.PublicCalendarApplication,
479
+ isLeaf: true,
480
+ key: PermissionKeys.ManageEventRead,
481
+ name: "Read Events",
482
+ },
483
+ {
484
+ applicationKey: application_1.ApplicationKeys.PublicCalendarApplication,
485
+ isLeaf: true,
486
+ key: PermissionKeys.ManageEventUpdateDetails,
487
+ name: "Update Event",
488
+ },
489
+ ],
490
+ },
491
+ ],
492
+ },
493
+ {
494
+ applicationKey: application_1.ApplicationKeys.PublicCalendarApplication,
495
+ key: PermissionKeys.ViewPublicCalendar,
496
+ name: "View Public Calendar",
497
+ isLeaf: true,
498
+ },
499
+ ],
500
+ },
415
501
  ];
@@ -0,0 +1,12 @@
1
+ import { IArrayDataResponse } from "../global";
2
+ export interface ICalendar {
3
+ id: string;
4
+ name: string;
5
+ calendarEmail: string;
6
+ color: string;
7
+ enabled: boolean;
8
+ }
9
+ export interface ICalendarArrayDataResponse extends IArrayDataResponse<ICalendar> {
10
+ data: ICalendar[];
11
+ }
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dto/calendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,0BACf,SAAQ,kBAAkB,CAAC,SAAS,CAAC;IACrC,IAAI,EAAE,SAAS,EAAE,CAAC;CACnB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dto/category/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,53 @@
1
+ import { IEventCategory } from "../event-category";
2
+ import { IFile } from "../file";
3
+ import { IArrayDataResponse } from "../global";
4
+ export declare enum ShownStatuses {
5
+ All = "All",
6
+ Pending = "Pending",
7
+ Shown = "Shown",
8
+ Hidden = "Hidden"
9
+ }
10
+ export interface IEventBody {
11
+ contentType: string;
12
+ content: string;
13
+ bodyPreview: string;
14
+ }
15
+ export interface IEventLocation {
16
+ displayName: string;
17
+ locationType: string;
18
+ }
19
+ export interface IEventAttendee {
20
+ name: string;
21
+ email: string;
22
+ responseStatus: string;
23
+ responseAt: string;
24
+ }
25
+ export interface IEventOrganizer {
26
+ name: string;
27
+ email: string;
28
+ }
29
+ export interface IEvent {
30
+ azureEventId: string;
31
+ subject: string;
32
+ body?: IEventBody;
33
+ location: IEventLocation;
34
+ start: string;
35
+ end: string;
36
+ webLink: string;
37
+ joinLink: string;
38
+ importance: string;
39
+ isCancelled: boolean;
40
+ isOnlineMeeting: boolean;
41
+ isAllDay: boolean;
42
+ attendees: IEventAttendee[];
43
+ organizer: IEventOrganizer;
44
+ category?: IEventCategory;
45
+ isShown?: boolean;
46
+ color: string;
47
+ description?: string;
48
+ attachmentFiles: IFile[];
49
+ }
50
+ export interface IEventArrayDataResponse extends IArrayDataResponse<IEvent> {
51
+ data: IEvent[];
52
+ }
53
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dto/event/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AACD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,WAAW,MAAM;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,SAAS,EAAE,eAAe,CAAC;IAC3B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,KAAK,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB,CAAC,MAAM,CAAC;IACzE,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShownStatuses = void 0;
4
+ var ShownStatuses;
5
+ (function (ShownStatuses) {
6
+ ShownStatuses["All"] = "All";
7
+ ShownStatuses["Pending"] = "Pending";
8
+ ShownStatuses["Shown"] = "Shown";
9
+ ShownStatuses["Hidden"] = "Hidden";
10
+ })(ShownStatuses || (exports.ShownStatuses = ShownStatuses = {}));
@@ -0,0 +1,7 @@
1
+ export interface IEventCategory {
2
+ id: string;
3
+ title: string;
4
+ icon: string;
5
+ color: string;
6
+ }
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dto/event-category/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -6,4 +6,7 @@ export * as Request from "./request";
6
6
  export * as Role from "./role";
7
7
  export * as Organization from "./organization";
8
8
  export * as Department from "./department";
9
+ export * as Calendar from "./calendar";
10
+ export * as EventCategory from "./event-category";
11
+ export * as Event from "./event";
9
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dto/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dto/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC"}
package/dist/dto/index.js CHANGED
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.Department = exports.Organization = exports.Role = exports.Request = exports.Permission = exports.File = exports.Application = exports.Account = void 0;
36
+ exports.Event = exports.EventCategory = exports.Calendar = exports.Department = exports.Organization = exports.Role = exports.Request = exports.Permission = exports.File = exports.Application = exports.Account = void 0;
37
37
  exports.Account = __importStar(require("./account"));
38
38
  exports.Application = __importStar(require("./application"));
39
39
  exports.File = __importStar(require("./file"));
@@ -42,3 +42,6 @@ exports.Request = __importStar(require("./request"));
42
42
  exports.Role = __importStar(require("./role"));
43
43
  exports.Organization = __importStar(require("./organization"));
44
44
  exports.Department = __importStar(require("./department"));
45
+ exports.Calendar = __importStar(require("./calendar"));
46
+ exports.EventCategory = __importStar(require("./event-category"));
47
+ exports.Event = __importStar(require("./event"));
@@ -1,4 +1,5 @@
1
1
  export declare const removeDuplicates: <T>(array: T[]) => T[];
2
2
  export declare const pushIfNotFound: <T>(array: T[], item: T, comparer?: (a: T, b: T) => boolean) => void;
3
3
  export declare const concatWithoutDuplicates: <T>(array1: T[], array2: T[], comparer: (a: T, b: T) => boolean) => T[];
4
+ export declare const groupBy: <T, K extends string | number | symbol>(array: T[], keyGetter: (item: T) => K) => Record<K, T[]>;
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/array/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,CAAC,EAAE,KAAG,CAAC,EAEjD,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,CAAC,SACvB,CAAC,EAAE,QACJ,CAAC,aACI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,KACjC,IAQF,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,CAAC,UAC/B,CAAC,EAAE,UACH,CAAC,EAAE,YACD,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,KAChC,CAAC,EAUH,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/array/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,CAAC,EAAE,KAAG,CAAC,EAEjD,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,CAAC,SACvB,CAAC,EAAE,QACJ,CAAC,aACI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,KACjC,IAQF,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,CAAC,UAC/B,CAAC,EAAE,UACH,CAAC,EAAE,YACD,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,KAChC,CAAC,EAUH,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,SACpD,CAAC,EAAE,aACC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KACxB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CASf,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.concatWithoutDuplicates = exports.pushIfNotFound = exports.removeDuplicates = void 0;
3
+ exports.groupBy = exports.concatWithoutDuplicates = exports.pushIfNotFound = exports.removeDuplicates = void 0;
4
4
  // Remove duplicate items from an array
5
5
  const removeDuplicates = (array) => {
6
6
  return Array.from(new Set(array));
@@ -26,3 +26,14 @@ const concatWithoutDuplicates = (array1, array2, comparer) => {
26
26
  return result;
27
27
  };
28
28
  exports.concatWithoutDuplicates = concatWithoutDuplicates;
29
+ const groupBy = (array, keyGetter) => {
30
+ return array.reduce((result, item) => {
31
+ const key = keyGetter(item);
32
+ if (!result[key]) {
33
+ result[key] = [];
34
+ }
35
+ result[key].push(item);
36
+ return result;
37
+ }, {});
38
+ };
39
+ exports.groupBy = groupBy;
@@ -1,9 +1,15 @@
1
1
  import moment from "moment";
2
+ import * as momentTZ from "moment-timezone";
3
+ export { momentTZ };
2
4
  export declare const formatDate: (data: Date | string, format?: string) => string;
3
5
  export declare const formatDateAsLabel: (date: string | Date) => string;
4
6
  export declare const getCurrentYear: () => string;
5
7
  export declare const getDaysCountBetweenTwoDays: (date1: string, date2: string) => number;
6
8
  export declare const getDaysCountTillNow: (pastDate: string) => number;
7
9
  export declare const getAge: (birthdate: string) => number;
10
+ export declare const getStartOfDay: (date?: Date | string) => Date;
11
+ export declare const getEndOfDay: (date?: Date | string) => Date;
12
+ export declare const getNextPeriod: (date: string | Date, period: "day" | "week" | "month") => Date;
13
+ export declare const getPreviousPeriod: (date: string | Date, period: "day" | "week" | "month") => Date;
8
14
  export default moment;
9
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/moment/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,eAAO,MAAM,UAAU,SAAU,IAAI,GAAG,MAAM,4BAE7C,CAAC;AAEF,eAAO,MAAM,iBAAiB,SAAU,MAAM,GAAG,IAAI,WAgBpD,CAAC;AAEF,eAAO,MAAM,cAAc,cAA2C,CAAC;AAEvE,eAAO,MAAM,0BAA0B,UAAW,MAAM,SAAS,MAAM,WAC5B,CAAC;AAE5C,eAAO,MAAM,mBAAmB,aAAc,MAAM,WACqB,CAAC;AAE1E,eAAO,MAAM,MAAM,cAAe,MAAM,WACG,CAAC;AAE5C,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/moment/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,eAAO,MAAM,UAAU,SAAU,IAAI,GAAG,MAAM,4BAE7C,CAAC;AAEF,eAAO,MAAM,iBAAiB,SAAU,MAAM,GAAG,IAAI,WAgBpD,CAAC;AAEF,eAAO,MAAM,cAAc,cAA2C,CAAC;AAEvE,eAAO,MAAM,0BAA0B,UAAW,MAAM,SAAS,MAAM,WAC5B,CAAC;AAE5C,eAAO,MAAM,mBAAmB,aAAc,MAAM,WACqB,CAAC;AAE1E,eAAO,MAAM,MAAM,cAAe,MAAM,WACG,CAAC;AAE5C,eAAO,MAAM,aAAa,UAAW,IAAI,GAAG,MAAM,KAAG,IAEpD,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,IAAI,GAAG,MAAM,KAAG,IAElD,CAAC;AAEF,eAAO,MAAM,aAAa,SAClB,MAAM,GAAG,IAAI,UACX,KAAK,GAAG,MAAM,GAAG,OAAO,SACO,CAAC;AAE1C,eAAO,MAAM,iBAAiB,SACtB,MAAM,GAAG,IAAI,UACX,KAAK,GAAG,MAAM,GAAG,OAAO,SACY,CAAC;AAE/C,eAAe,MAAM,CAAC"}
@@ -1,12 +1,47 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getAge = exports.getDaysCountTillNow = exports.getDaysCountBetweenTwoDays = exports.getCurrentYear = exports.formatDateAsLabel = exports.formatDate = void 0;
39
+ exports.getPreviousPeriod = exports.getNextPeriod = exports.getEndOfDay = exports.getStartOfDay = exports.getAge = exports.getDaysCountTillNow = exports.getDaysCountBetweenTwoDays = exports.getCurrentYear = exports.formatDateAsLabel = exports.formatDate = exports.momentTZ = void 0;
7
40
  const moment_1 = __importDefault(require("moment"));
41
+ const momentTZ = __importStar(require("moment-timezone"));
42
+ exports.momentTZ = momentTZ;
8
43
  const formatDate = (data, format = "YYYY-MM-DD") => {
9
- return moment_1.default.utc(data).format(format).toString();
44
+ return (0, moment_1.default)(data).format(format).toString();
10
45
  };
11
46
  exports.formatDate = formatDate;
12
47
  const formatDateAsLabel = (date) => {
@@ -36,4 +71,16 @@ const getDaysCountTillNow = (pastDate) => (0, exports.getDaysCountBetweenTwoDays
36
71
  exports.getDaysCountTillNow = getDaysCountTillNow;
37
72
  const getAge = (birthdate) => (0, moment_1.default)().diff((0, moment_1.default)(birthdate), "years");
38
73
  exports.getAge = getAge;
74
+ const getStartOfDay = (date) => {
75
+ return (0, moment_1.default)(date).startOf("day").toDate();
76
+ };
77
+ exports.getStartOfDay = getStartOfDay;
78
+ const getEndOfDay = (date) => {
79
+ return (0, moment_1.default)(date).endOf("day").toDate();
80
+ };
81
+ exports.getEndOfDay = getEndOfDay;
82
+ const getNextPeriod = (date, period) => (0, moment_1.default)(date).add(1, period).toDate();
83
+ exports.getNextPeriod = getNextPeriod;
84
+ const getPreviousPeriod = (date, period) => (0, moment_1.default)(date).subtract(1, period).toDate();
85
+ exports.getPreviousPeriod = getPreviousPeriod;
39
86
  exports.default = moment_1.default;
@@ -1,3 +1,3 @@
1
- declare const utils: typeof import("numeral");
2
- export default utils;
1
+ export declare const numeralUtils: typeof import("numeral");
2
+ export declare const getRandomInt: (min: number, max: number) => number;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/numbers/index.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,KAAK,0BAAkB,CAAC;AAE9B,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/numbers/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,0BAAkB,CAAC;AAE5C,eAAO,MAAM,YAAY,QAAS,MAAM,OAAO,MAAM,KAAG,MAIvD,CAAC"}
@@ -33,6 +33,12 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.getRandomInt = exports.numeralUtils = void 0;
36
37
  const numeral = __importStar(require("numeral"));
37
- const utils = numeral.default;
38
- exports.default = utils;
38
+ exports.numeralUtils = numeral.default;
39
+ const getRandomInt = (min, max) => {
40
+ const lower = Math.ceil(min);
41
+ const upper = Math.floor(max);
42
+ return Math.floor(Math.random() * (upper - lower + 1)) + lower;
43
+ };
44
+ exports.getRandomInt = getRandomInt;
@@ -2,6 +2,8 @@ export declare const normalizeString: (str: string | undefined | null) => string
2
2
  export declare const generateRandomString: (length?: number) => string;
3
3
  export declare const phoneRegExp: RegExp;
4
4
  export declare const emailRegex: RegExp;
5
+ export declare const colorRegex: RegExp;
5
6
  export declare const isPhoneNumber: (str: string) => boolean;
6
7
  export declare const isEmail: (str: string) => boolean;
8
+ export declare const isColor: (str: string) => boolean;
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/string/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,QAAS,MAAM,GAAG,SAAS,GAAG,IAAI,kBAG7D,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAY,MAAM,WASlD,CAAC;AAEF,eAAO,MAAM,WAAW,QAA8B,CAAC;AAEvD,eAAO,MAAM,UAAU,QAAoD,CAAC;AAE5E,eAAO,MAAM,aAAa,QAAS,MAAM,YAExC,CAAC;AACF,eAAO,MAAM,OAAO,QAAS,MAAM,YAElC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/string/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,QAAS,MAAM,GAAG,SAAS,GAAG,IAAI,kBAG7D,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAY,MAAM,WASlD,CAAC;AAEF,eAAO,MAAM,WAAW,QAA8B,CAAC;AAEvD,eAAO,MAAM,UAAU,QAAoD,CAAC;AAE5E,eAAO,MAAM,UAAU,QAA+B,CAAC;AAEvD,eAAO,MAAM,aAAa,QAAS,MAAM,YAExC,CAAC;AACF,eAAO,MAAM,OAAO,QAAS,MAAM,YAElC,CAAC;AAEF,eAAO,MAAM,OAAO,QAAS,MAAM,YAElC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isEmail = exports.isPhoneNumber = exports.emailRegex = exports.phoneRegExp = exports.generateRandomString = exports.normalizeString = void 0;
3
+ exports.isColor = exports.isEmail = exports.isPhoneNumber = exports.colorRegex = exports.emailRegex = exports.phoneRegExp = exports.generateRandomString = exports.normalizeString = void 0;
4
4
  const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
5
5
  const normalizeString = (str) => {
6
6
  if (str)
@@ -19,6 +19,7 @@ const generateRandomString = (length = 6) => {
19
19
  exports.generateRandomString = generateRandomString;
20
20
  exports.phoneRegExp = /^\+?[1-9]\d{1,3}\d{6,14}$/;
21
21
  exports.emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
22
+ exports.colorRegex = /^#(?:[0-9a-fA-F]{3}){1,2}$/;
22
23
  const isPhoneNumber = (str) => {
23
24
  return exports.phoneRegExp.test(str);
24
25
  };
@@ -27,3 +28,7 @@ const isEmail = (str) => {
27
28
  return exports.emailRegex.test(str);
28
29
  };
29
30
  exports.isEmail = isEmail;
31
+ const isColor = (str) => {
32
+ return exports.colorRegex.test(str);
33
+ };
34
+ exports.isColor = isColor;
package/package.json CHANGED
@@ -1,36 +1,36 @@
1
- {
2
- "name": "sea-platform-helpers",
3
- "description": "SEA platform helpers library",
4
- "version": "1.1.0",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "build": "tsc --build",
8
- "watch": "tsc --watch"
9
- },
10
- "files": [
11
- "dist/**/*"
12
- ],
13
- "exports": {
14
- ".": {
15
- "types": "./dist/index.d.ts",
16
- "default": "./dist/index.js"
17
- }
18
- },
19
- "keywords": [],
20
- "author": "",
21
- "license": "ISC",
22
- "dependencies": {
23
- "@nestjs/swagger": "^8.0.7",
24
- "bcrypt": "^5.1.1",
25
- "class-transformer": "^0.5.1",
26
- "class-validator": "^0.14.1",
27
- "moment": "^2.30.1",
28
- "moment-timezone": "^0.5.46",
29
- "numeral": "^2.0.6",
30
- "sea-platform-helpers": "file:"
31
- },
32
- "devDependencies": {
33
- "@types/bcrypt": "^5.0.2",
34
- "@types/numeral": "^2.0.5"
35
- }
36
- }
1
+ {
2
+ "name": "sea-platform-helpers",
3
+ "description": "SEA platform helpers library",
4
+ "version": "1.2.0",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "build": "tsc --build",
8
+ "watch": "tsc --watch"
9
+ },
10
+ "files": [
11
+ "dist/**/*"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ }
18
+ },
19
+ "keywords": [],
20
+ "author": "",
21
+ "license": "ISC",
22
+ "dependencies": {
23
+ "@nestjs/swagger": "^8.0.7",
24
+ "bcrypt": "^5.1.1",
25
+ "class-transformer": "^0.5.1",
26
+ "class-validator": "^0.14.1",
27
+ "moment": "^2.30.1",
28
+ "moment-timezone": "^0.5.46",
29
+ "numeral": "^2.0.6",
30
+ "sea-platform-helpers": "file:"
31
+ },
32
+ "devDependencies": {
33
+ "@types/bcrypt": "^5.0.2",
34
+ "@types/numeral": "^2.0.5"
35
+ }
36
+ }