@laboratory-one/api-components 0.0.10 → 0.0.12

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 (91) hide show
  1. package/dist/cjs/auth/auth.service.d.ts.map +1 -1
  2. package/dist/cjs/auth/auth.service.js +13 -2
  3. package/dist/cjs/auth/auth.service.js.map +1 -1
  4. package/dist/cjs/utils/datetime.util.d.ts +8 -0
  5. package/dist/cjs/utils/datetime.util.d.ts.map +1 -0
  6. package/dist/cjs/utils/datetime.util.js +46 -0
  7. package/dist/cjs/utils/datetime.util.js.map +1 -0
  8. package/dist/cjs/utils/{error.d.ts → error.util.d.ts} +1 -1
  9. package/dist/cjs/utils/error.util.d.ts.map +1 -0
  10. package/dist/cjs/utils/{error.js → error.util.js} +1 -1
  11. package/dist/cjs/utils/error.util.js.map +1 -0
  12. package/dist/cjs/utils/index.d.ts +4 -4
  13. package/dist/cjs/utils/index.d.ts.map +1 -1
  14. package/dist/cjs/utils/index.js +4 -4
  15. package/dist/cjs/utils/index.js.map +1 -1
  16. package/dist/cjs/utils/{input.d.ts → input.util.d.ts} +1 -1
  17. package/dist/cjs/utils/input.util.d.ts.map +1 -0
  18. package/dist/cjs/utils/{input.js → input.util.js} +1 -1
  19. package/dist/cjs/utils/input.util.js.map +1 -0
  20. package/dist/cjs/utils/noop.util.d.ts +2 -0
  21. package/dist/cjs/utils/noop.util.d.ts.map +1 -0
  22. package/dist/cjs/utils/noop.util.js +6 -0
  23. package/dist/cjs/utils/noop.util.js.map +1 -0
  24. package/dist/cjs/utils/{string.d.ts → string.util.d.ts} +1 -1
  25. package/dist/cjs/utils/string.util.d.ts.map +1 -0
  26. package/dist/cjs/utils/{string.js → string.util.js} +1 -1
  27. package/dist/cjs/utils/string.util.js.map +1 -0
  28. package/dist/esm/auth/auth.service.d.ts.map +1 -1
  29. package/dist/esm/auth/auth.service.js +13 -2
  30. package/dist/esm/auth/auth.service.js.map +1 -1
  31. package/dist/esm/utils/datetime.util.d.ts +8 -0
  32. package/dist/esm/utils/datetime.util.d.ts.map +1 -0
  33. package/dist/esm/utils/{datetime.js → datetime.util.js} +13 -3
  34. package/dist/esm/utils/datetime.util.js.map +1 -0
  35. package/dist/esm/utils/{error.d.ts → error.util.d.ts} +1 -1
  36. package/dist/esm/utils/error.util.d.ts.map +1 -0
  37. package/dist/esm/utils/{error.js → error.util.js} +1 -1
  38. package/dist/esm/utils/error.util.js.map +1 -0
  39. package/dist/esm/utils/index.d.ts +4 -4
  40. package/dist/esm/utils/index.d.ts.map +1 -1
  41. package/dist/esm/utils/index.js +4 -4
  42. package/dist/esm/utils/index.js.map +1 -1
  43. package/dist/esm/utils/{input.d.ts → input.util.d.ts} +1 -1
  44. package/dist/esm/utils/input.util.d.ts.map +1 -0
  45. package/dist/esm/utils/{input.js → input.util.js} +1 -1
  46. package/dist/esm/utils/input.util.js.map +1 -0
  47. package/dist/esm/utils/noop.util.d.ts +2 -0
  48. package/dist/esm/utils/noop.util.d.ts.map +1 -0
  49. package/dist/esm/utils/noop.util.js +2 -0
  50. package/dist/esm/utils/noop.util.js.map +1 -0
  51. package/dist/esm/utils/{string.d.ts → string.util.d.ts} +1 -1
  52. package/dist/esm/utils/string.util.d.ts.map +1 -0
  53. package/dist/esm/utils/{string.js → string.util.js} +1 -1
  54. package/dist/esm/utils/string.util.js.map +1 -0
  55. package/dist/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +1 -1
  57. package/src/auth/auth.service.ts +13 -3
  58. package/src/utils/{datetime.ts → datetime.util.ts} +15 -2
  59. package/src/utils/index.ts +4 -4
  60. package/src/utils/noop.util.ts +1 -0
  61. package/dist/cjs/utils/datetime.d.ts +0 -6
  62. package/dist/cjs/utils/datetime.d.ts.map +0 -1
  63. package/dist/cjs/utils/datetime.js +0 -33
  64. package/dist/cjs/utils/datetime.js.map +0 -1
  65. package/dist/cjs/utils/error.d.ts.map +0 -1
  66. package/dist/cjs/utils/error.js.map +0 -1
  67. package/dist/cjs/utils/input.d.ts.map +0 -1
  68. package/dist/cjs/utils/input.js.map +0 -1
  69. package/dist/cjs/utils/noop.d.ts +0 -2
  70. package/dist/cjs/utils/noop.d.ts.map +0 -1
  71. package/dist/cjs/utils/noop.js +0 -6
  72. package/dist/cjs/utils/noop.js.map +0 -1
  73. package/dist/cjs/utils/string.d.ts.map +0 -1
  74. package/dist/cjs/utils/string.js.map +0 -1
  75. package/dist/esm/utils/datetime.d.ts +0 -6
  76. package/dist/esm/utils/datetime.d.ts.map +0 -1
  77. package/dist/esm/utils/datetime.js.map +0 -1
  78. package/dist/esm/utils/error.d.ts.map +0 -1
  79. package/dist/esm/utils/error.js.map +0 -1
  80. package/dist/esm/utils/input.d.ts.map +0 -1
  81. package/dist/esm/utils/input.js.map +0 -1
  82. package/dist/esm/utils/noop.d.ts +0 -2
  83. package/dist/esm/utils/noop.d.ts.map +0 -1
  84. package/dist/esm/utils/noop.js +0 -2
  85. package/dist/esm/utils/noop.js.map +0 -1
  86. package/dist/esm/utils/string.d.ts.map +0 -1
  87. package/dist/esm/utils/string.js.map +0 -1
  88. package/src/utils/noop.ts +0 -1
  89. /package/src/utils/{error.ts → error.util.ts} +0 -0
  90. /package/src/utils/{input.ts → input.util.ts} +0 -0
  91. /package/src/utils/{string.ts → string.util.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laboratory-one/api-components",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "API components for Laboratory One",
5
5
  "author": "Laboratory One",
6
6
  "private": false,
@@ -3,6 +3,7 @@ import * as stytch from 'stytch';
3
3
  import { ConfigService } from '@nestjs/config';
4
4
 
5
5
  import { RegisterRequestDto } from '../user/dtos/register.request.dto';
6
+ import { handleError } from '../utils';
6
7
 
7
8
  @Injectable()
8
9
  export class AuthService {
@@ -31,8 +32,17 @@ export class AuthService {
31
32
  async login(data: RegisterRequestDto): Promise<boolean> {
32
33
  this.logger.debug('login');
33
34
 
34
- const res = await this.authClient.passwords.authenticate(data);
35
-
36
- return res['status_code'] === 200;
35
+ try {
36
+ const res = await this.authClient.passwords.authenticate(data);
37
+ return res['status_code'] === 200;
38
+ } catch (error: any) {
39
+ if (error.error_type === 'email_not_found') {
40
+ handleError('Email or password is wrong');
41
+ }
42
+
43
+ if (error.error_type === 'unauthorized_credentials') {
44
+ handleError('Email or password is wrong');
45
+ }
46
+ }
37
47
  }
38
48
  }
@@ -1,5 +1,4 @@
1
- import { EServerDay } from '../enums/serverDay.enum';
2
- import { EHumanDay } from '../enums/humanDay.enum';
1
+ import { EServerDay, EHumanDay } from '../enums';
3
2
  import moment, { Moment } from 'moment';
4
3
 
5
4
  export const serverDayToHumanReadable = (day: EServerDay): EHumanDay => {
@@ -26,3 +25,17 @@ export const serverDayToHumanReadable = (day: EServerDay): EHumanDay => {
26
25
  export const getStartOfDateString = (date: Moment): string => {
27
26
  return moment(date).utc().startOf('day').toDate().toISOString();
28
27
  };
28
+
29
+ export const getStartOfTodayString = (): string => {
30
+ return getStartOfDateString(moment());
31
+ };
32
+
33
+ export const getCurrentHour = (): number => {
34
+ return moment().hour();
35
+ };
36
+
37
+ export const getDateWithTz = (date: string, tz: number): string => {
38
+ const dateMoment = moment(date).utcOffset(tz);
39
+ dateMoment.add(tz, 'hours');
40
+ return dateMoment.format('YYYY-MM-DD');
41
+ };
@@ -1,4 +1,4 @@
1
- export * from './datetime';
2
- export * from './error';
3
- export * from './input';
4
- export * from './string';
1
+ export * from './datetime.util';
2
+ export * from './error.util';
3
+ export * from './input.util';
4
+ export * from './string.util';
@@ -0,0 +1 @@
1
+ export const NoopUtil = () => {};
@@ -1,6 +0,0 @@
1
- import { EServerDay } from '../enums/serverDay.enum';
2
- import { EHumanDay } from '../enums/humanDay.enum';
3
- import { Moment } from 'moment';
4
- export declare const serverDayToHumanReadable: (day: EServerDay) => EHumanDay;
5
- export declare const getStartOfDateString: (date: Moment) => string;
6
- //# sourceMappingURL=datetime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"datetime.d.ts","sourceRoot":"/","sources":["utils/datetime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAe,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,eAAO,MAAM,wBAAwB,QAAS,UAAU,KAAG,SAmB1D,CAAC;AAEF,eAAO,MAAM,oBAAoB,SAAU,MAAM,KAAG,MAEnD,CAAC"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStartOfDateString = exports.serverDayToHumanReadable = void 0;
4
- const tslib_1 = require("tslib");
5
- const serverDay_enum_1 = require("../enums/serverDay.enum");
6
- const humanDay_enum_1 = require("../enums/humanDay.enum");
7
- const moment_1 = tslib_1.__importDefault(require("moment"));
8
- const serverDayToHumanReadable = (day) => {
9
- switch (day) {
10
- case serverDay_enum_1.EServerDay.SUNDAY:
11
- return humanDay_enum_1.EHumanDay.SUNDAY;
12
- case serverDay_enum_1.EServerDay.MONDAY:
13
- return humanDay_enum_1.EHumanDay.MONDAY;
14
- case serverDay_enum_1.EServerDay.TUESDAY:
15
- return humanDay_enum_1.EHumanDay.TUESDAY;
16
- case serverDay_enum_1.EServerDay.WEDNESDAY:
17
- return humanDay_enum_1.EHumanDay.WEDNESDAY;
18
- case serverDay_enum_1.EServerDay.THURSDAY:
19
- return humanDay_enum_1.EHumanDay.THURSDAY;
20
- case serverDay_enum_1.EServerDay.FRIDAY:
21
- return humanDay_enum_1.EHumanDay.FRIDAY;
22
- case serverDay_enum_1.EServerDay.SATURDAY:
23
- return humanDay_enum_1.EHumanDay.SATURDAY;
24
- default:
25
- return humanDay_enum_1.EHumanDay.SUNDAY;
26
- }
27
- };
28
- exports.serverDayToHumanReadable = serverDayToHumanReadable;
29
- const getStartOfDateString = (date) => {
30
- return (0, moment_1.default)(date).utc().startOf('day').toDate().toISOString();
31
- };
32
- exports.getStartOfDateString = getStartOfDateString;
33
- //# sourceMappingURL=datetime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"datetime.js","sourceRoot":"/","sources":["utils/datetime.ts"],"names":[],"mappings":";;;;AAAA,4DAAqD;AACrD,0DAAmD;AACnD,4DAAwC;AAEjC,MAAM,wBAAwB,GAAG,CAAC,GAAe,EAAa,EAAE;IACrE,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,2BAAU,CAAC,MAAM;YACpB,OAAO,yBAAS,CAAC,MAAM,CAAC;QAC1B,KAAK,2BAAU,CAAC,MAAM;YACpB,OAAO,yBAAS,CAAC,MAAM,CAAC;QAC1B,KAAK,2BAAU,CAAC,OAAO;YACrB,OAAO,yBAAS,CAAC,OAAO,CAAC;QAC3B,KAAK,2BAAU,CAAC,SAAS;YACvB,OAAO,yBAAS,CAAC,SAAS,CAAC;QAC7B,KAAK,2BAAU,CAAC,QAAQ;YACtB,OAAO,yBAAS,CAAC,QAAQ,CAAC;QAC5B,KAAK,2BAAU,CAAC,MAAM;YACpB,OAAO,yBAAS,CAAC,MAAM,CAAC;QAC1B,KAAK,2BAAU,CAAC,QAAQ;YACtB,OAAO,yBAAS,CAAC,QAAQ,CAAC;QAC5B;YACE,OAAO,yBAAS,CAAC,MAAM,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC;AAnBW,QAAA,wBAAwB,4BAmBnC;AAEK,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAU,EAAE;IAC3D,OAAO,IAAA,gBAAM,EAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;AAClE,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B","sourcesContent":["import { EServerDay } from '../enums/serverDay.enum';\nimport { EHumanDay } from '../enums/humanDay.enum';\nimport moment, { Moment } from 'moment';\n\nexport const serverDayToHumanReadable = (day: EServerDay): EHumanDay => {\n switch (day) {\n case EServerDay.SUNDAY:\n return EHumanDay.SUNDAY;\n case EServerDay.MONDAY:\n return EHumanDay.MONDAY;\n case EServerDay.TUESDAY:\n return EHumanDay.TUESDAY;\n case EServerDay.WEDNESDAY:\n return EHumanDay.WEDNESDAY;\n case EServerDay.THURSDAY:\n return EHumanDay.THURSDAY;\n case EServerDay.FRIDAY:\n return EHumanDay.FRIDAY;\n case EServerDay.SATURDAY:\n return EHumanDay.SATURDAY;\n default:\n return EHumanDay.SUNDAY;\n }\n};\n\nexport const getStartOfDateString = (date: Moment): string => {\n return moment(date).utc().startOf('day').toDate().toISOString();\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"/","sources":["utils/error.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,UAAW,GAAG,UAQrC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.js","sourceRoot":"/","sources":["utils/error.ts"],"names":[],"mappings":";;;AAAA,2CAA2D;AAEpD,MAAM,WAAW,GAAG,CAAC,KAAU,EAAE,EAAE;IACxC,IAAI,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,sBAAa,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,mBAAU,CAAC,WAAW,CAAC,CAAC;IAC1E,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,MAAM,IAAI,sBAAa,CAAC,KAAK,CAAC,OAAO,EAAE,mBAAU,CAAC,WAAW,CAAC,CAAC;IACjE,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,sBAAa,CAAC,KAAK,EAAE,mBAAU,CAAC,WAAW,CAAC,CAAC;IACzD,CAAC;AACH,CAAC,CAAC;AARW,QAAA,WAAW,eAQtB","sourcesContent":["import { HttpException, HttpStatus } from '@nestjs/common';\n\nexport const handleError = (error: any) => {\n if (error['error_message']) {\n throw new HttpException(error['error_message'], HttpStatus.BAD_REQUEST);\n } else if (error.message) {\n throw new HttpException(error.message, HttpStatus.BAD_REQUEST);\n } else {\n throw new HttpException(error, HttpStatus.BAD_REQUEST);\n }\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"/","sources":["utils/input.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MAEzC,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAS,MAAM,KAAG,MAGrD,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAS,MAAM,KAAG,MAY9C,CAAC;AAEF,eAAO,MAAM,gBAAgB,cAAe,MAAM,KAAG,MAQpD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.js","sourceRoot":"/","sources":["utils/input.ts"],"names":[],"mappings":";;;AAAO,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE;IACjD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAEK,MAAM,uBAAuB,GAAG,CAAC,GAAW,EAAU,EAAE;IAC7D,MAAM,OAAO,GAAW,IAAA,mBAAW,EAAC,GAAG,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;AAC/B,CAAC,CAAC;AAHW,QAAA,uBAAuB,2BAGlC;AAEK,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAU,EAAE;IACtD,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAE3B,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,OAAO,EAAE,CAAC;IACvB,CAAC;IAED,OAAO,KAAK,OAAO,EAAE,CAAC;AACxB,CAAC,CAAC;AAZW,QAAA,gBAAgB,oBAY3B;AAEK,MAAM,gBAAgB,GAAG,CAAC,SAAiB,EAAU,EAAE;IAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC;IAEzC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,OAAO,EAAE,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC,CAAC;AARW,QAAA,gBAAgB,oBAQ3B","sourcesContent":["export const cleanString = (str: string): string => {\n return str.trim();\n};\n\nexport const cleanStringAndLowercase = (str: string): string => {\n const trimmed: string = cleanString(str);\n return trimmed.toLowerCase();\n};\n\nexport const cleanPhoneNumber = (str: string): string => {\n const trimmed = str.trim();\n\n if (trimmed.startsWith('+')) {\n return trimmed;\n }\n\n if (trimmed.startsWith('1')) {\n return `+${trimmed}`;\n }\n\n return `+1${trimmed}`;\n};\n\nexport const utcOffsetToHours = (utcOffset: number): number => {\n const hours = Math.floor(utcOffset / 60);\n\n if (hours > 0) {\n return 24 - hours;\n }\n\n return Math.abs(hours);\n};\n"]}
@@ -1,2 +0,0 @@
1
- export declare const NOOP: () => void;
2
- //# sourceMappingURL=noop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noop.d.ts","sourceRoot":"/","sources":["utils/noop.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,YAAW,CAAC"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NOOP = void 0;
4
- const NOOP = () => { };
5
- exports.NOOP = NOOP;
6
- //# sourceMappingURL=noop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noop.js","sourceRoot":"/","sources":["utils/noop.ts"],"names":[],"mappings":";;;AAAO,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAAhB,QAAA,IAAI,QAAY","sourcesContent":["export const NOOP = () => {};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"/","sources":["utils/string.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,SAAU,MAAM,KAAG,MAEzC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.js","sourceRoot":"/","sources":["utils/string.ts"],"names":[],"mappings":";;;AAAO,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE;IACjD,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB","sourcesContent":["export const getInitial = (name: string): string => {\n return name[0];\n};\n"]}
@@ -1,6 +0,0 @@
1
- import { EServerDay } from '../enums/serverDay.enum';
2
- import { EHumanDay } from '../enums/humanDay.enum';
3
- import { Moment } from 'moment';
4
- export declare const serverDayToHumanReadable: (day: EServerDay) => EHumanDay;
5
- export declare const getStartOfDateString: (date: Moment) => string;
6
- //# sourceMappingURL=datetime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"datetime.d.ts","sourceRoot":"/","sources":["utils/datetime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAe,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,eAAO,MAAM,wBAAwB,QAAS,UAAU,KAAG,SAmB1D,CAAC;AAEF,eAAO,MAAM,oBAAoB,SAAU,MAAM,KAAG,MAEnD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"datetime.js","sourceRoot":"/","sources":["utils/datetime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,MAAkB,MAAM,QAAQ,CAAC;AAExC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAe,EAAa,EAAE;IACrE,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,UAAU,CAAC,MAAM;YACpB,OAAO,SAAS,CAAC,MAAM,CAAC;QAC1B,KAAK,UAAU,CAAC,MAAM;YACpB,OAAO,SAAS,CAAC,MAAM,CAAC;QAC1B,KAAK,UAAU,CAAC,OAAO;YACrB,OAAO,SAAS,CAAC,OAAO,CAAC;QAC3B,KAAK,UAAU,CAAC,SAAS;YACvB,OAAO,SAAS,CAAC,SAAS,CAAC;QAC7B,KAAK,UAAU,CAAC,QAAQ;YACtB,OAAO,SAAS,CAAC,QAAQ,CAAC;QAC5B,KAAK,UAAU,CAAC,MAAM;YACpB,OAAO,SAAS,CAAC,MAAM,CAAC;QAC1B,KAAK,UAAU,CAAC,QAAQ;YACtB,OAAO,SAAS,CAAC,QAAQ,CAAC;QAC5B;YACE,OAAO,SAAS,CAAC,MAAM,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAU,EAAE;IAC3D,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;AAClE,CAAC,CAAC","sourcesContent":["import { EServerDay } from '../enums/serverDay.enum';\nimport { EHumanDay } from '../enums/humanDay.enum';\nimport moment, { Moment } from 'moment';\n\nexport const serverDayToHumanReadable = (day: EServerDay): EHumanDay => {\n switch (day) {\n case EServerDay.SUNDAY:\n return EHumanDay.SUNDAY;\n case EServerDay.MONDAY:\n return EHumanDay.MONDAY;\n case EServerDay.TUESDAY:\n return EHumanDay.TUESDAY;\n case EServerDay.WEDNESDAY:\n return EHumanDay.WEDNESDAY;\n case EServerDay.THURSDAY:\n return EHumanDay.THURSDAY;\n case EServerDay.FRIDAY:\n return EHumanDay.FRIDAY;\n case EServerDay.SATURDAY:\n return EHumanDay.SATURDAY;\n default:\n return EHumanDay.SUNDAY;\n }\n};\n\nexport const getStartOfDateString = (date: Moment): string => {\n return moment(date).utc().startOf('day').toDate().toISOString();\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"/","sources":["utils/error.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,UAAW,GAAG,UAQrC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.js","sourceRoot":"/","sources":["utils/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAU,EAAE,EAAE;IACxC,IAAI,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,aAAa,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAC1E,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,MAAM,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACjE,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACzD,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { HttpException, HttpStatus } from '@nestjs/common';\n\nexport const handleError = (error: any) => {\n if (error['error_message']) {\n throw new HttpException(error['error_message'], HttpStatus.BAD_REQUEST);\n } else if (error.message) {\n throw new HttpException(error.message, HttpStatus.BAD_REQUEST);\n } else {\n throw new HttpException(error, HttpStatus.BAD_REQUEST);\n }\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"/","sources":["utils/input.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MAEzC,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAS,MAAM,KAAG,MAGrD,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAS,MAAM,KAAG,MAY9C,CAAC;AAEF,eAAO,MAAM,gBAAgB,cAAe,MAAM,KAAG,MAQpD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.js","sourceRoot":"/","sources":["utils/input.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE;IACjD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAW,EAAU,EAAE;IAC7D,MAAM,OAAO,GAAW,WAAW,CAAC,GAAG,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;AAC/B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAU,EAAE;IACtD,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAE3B,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,OAAO,EAAE,CAAC;IACvB,CAAC;IAED,OAAO,KAAK,OAAO,EAAE,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,SAAiB,EAAU,EAAE;IAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC;IAEzC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,OAAO,EAAE,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC,CAAC","sourcesContent":["export const cleanString = (str: string): string => {\n return str.trim();\n};\n\nexport const cleanStringAndLowercase = (str: string): string => {\n const trimmed: string = cleanString(str);\n return trimmed.toLowerCase();\n};\n\nexport const cleanPhoneNumber = (str: string): string => {\n const trimmed = str.trim();\n\n if (trimmed.startsWith('+')) {\n return trimmed;\n }\n\n if (trimmed.startsWith('1')) {\n return `+${trimmed}`;\n }\n\n return `+1${trimmed}`;\n};\n\nexport const utcOffsetToHours = (utcOffset: number): number => {\n const hours = Math.floor(utcOffset / 60);\n\n if (hours > 0) {\n return 24 - hours;\n }\n\n return Math.abs(hours);\n};\n"]}
@@ -1,2 +0,0 @@
1
- export declare const NOOP: () => void;
2
- //# sourceMappingURL=noop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noop.d.ts","sourceRoot":"/","sources":["utils/noop.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,YAAW,CAAC"}
@@ -1,2 +0,0 @@
1
- export const NOOP = () => { };
2
- //# sourceMappingURL=noop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noop.js","sourceRoot":"/","sources":["utils/noop.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC","sourcesContent":["export const NOOP = () => {};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"/","sources":["utils/string.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,SAAU,MAAM,KAAG,MAEzC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.js","sourceRoot":"/","sources":["utils/string.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE;IACjD,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC","sourcesContent":["export const getInitial = (name: string): string => {\n return name[0];\n};\n"]}
package/src/utils/noop.ts DELETED
@@ -1 +0,0 @@
1
- export const NOOP = () => {};
File without changes
File without changes
File without changes