@nanas-home/hub-common 0.46.1024 → 0.48.1054

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.
@@ -101,6 +101,7 @@ var apiRouteParam = {
101
101
  bookingAddonUuid: ":bookingAddonUuid",
102
102
  userMembershipUuid: ":userMembershipUuid",
103
103
  bugReportUuid: ":bugReportUuid",
104
+ linkTypeUuid: ":linkTypeUuid",
104
105
  linkUuid: ":linkUuid",
105
106
  linkType: ":linkType",
106
107
  // Stripe
@@ -115,6 +116,7 @@ var apiRoute = {
115
116
  devJwt: "/jwt",
116
117
  login: "/login",
117
118
  signup: "/signup",
119
+ confirmEmail: `/confirm-email/${apiRouteParam.linkTypeUuid}`,
118
120
  swagger: { name: "Auth", description: "Endpoints for login, sign up etc" },
119
121
  token: {
120
122
  prefix: "/token",
@@ -201,7 +203,7 @@ var apiRoute = {
201
203
  },
202
204
  user: {
203
205
  prefix: "/admin/user",
204
- searchHosts: "search-hosts",
206
+ searchHosts: "/search-hosts",
205
207
  swagger: { name: "Users", description: "Endpoints for Admins to manage Users" }
206
208
  },
207
209
  userMembership: {
@@ -348,19 +350,15 @@ var BookingAddonType = /* @__PURE__ */ ((BookingAddonType2) => {
348
350
 
349
351
  // src/contracts/generated/enum/bookingStatus.ts
350
352
  var BookingStatusType = /* @__PURE__ */ ((BookingStatusType2) => {
351
- BookingStatusType2[BookingStatusType2["Pending"] = 0] = "Pending";
352
- BookingStatusType2[BookingStatusType2["Cancelled"] = 1] = "Cancelled";
353
- BookingStatusType2[BookingStatusType2["IntakeCall"] = 2] = "IntakeCall";
354
- BookingStatusType2[BookingStatusType2["RequestMatchFee"] = 3] = "RequestMatchFee";
355
- BookingStatusType2[BookingStatusType2["FindPlacement"] = 4] = "FindPlacement";
356
- BookingStatusType2[BookingStatusType2["Matched"] = 5] = "Matched";
357
- BookingStatusType2[BookingStatusType2["MeetAndGreet"] = 6] = "MeetAndGreet";
358
- BookingStatusType2[BookingStatusType2["RequestPayment"] = 7] = "RequestPayment";
359
- BookingStatusType2[BookingStatusType2["PaymentRequested"] = 8] = "PaymentRequested";
360
- BookingStatusType2[BookingStatusType2["Paid"] = 9] = "Paid";
361
- BookingStatusType2[BookingStatusType2["WaitList"] = 10] = "WaitList";
362
- BookingStatusType2[BookingStatusType2["Complete"] = 11] = "Complete";
363
- BookingStatusType2[BookingStatusType2["CompleteWithHostFeedback"] = 12] = "CompleteWithHostFeedback";
353
+ BookingStatusType2[BookingStatusType2["Cancelled"] = 0] = "Cancelled";
354
+ BookingStatusType2[BookingStatusType2["IntakeCall"] = 1] = "IntakeCall";
355
+ BookingStatusType2[BookingStatusType2["RequestMatchFee"] = 2] = "RequestMatchFee";
356
+ BookingStatusType2[BookingStatusType2["FindPlacement"] = 3] = "FindPlacement";
357
+ BookingStatusType2[BookingStatusType2["Matched"] = 4] = "Matched";
358
+ BookingStatusType2[BookingStatusType2["MeetAndGreet"] = 5] = "MeetAndGreet";
359
+ BookingStatusType2[BookingStatusType2["RequestPayment"] = 6] = "RequestPayment";
360
+ BookingStatusType2[BookingStatusType2["PaymentRequested"] = 7] = "PaymentRequested";
361
+ BookingStatusType2[BookingStatusType2["Paid"] = 8] = "Paid";
364
362
  return BookingStatusType2;
365
363
  })(BookingStatusType || {});
366
364
 
@@ -452,6 +450,7 @@ var PermissionType = /* @__PURE__ */ ((PermissionType2) => {
452
450
  PermissionType2[PermissionType2["UserDelete"] = 22] = "UserDelete";
453
451
  PermissionType2[PermissionType2["ActivitiesView"] = 30] = "ActivitiesView";
454
452
  PermissionType2[PermissionType2["StripeView"] = 31] = "StripeView";
453
+ PermissionType2[PermissionType2["UserFlagManage"] = 32] = "UserFlagManage";
455
454
  PermissionType2[PermissionType2["UserPermissionView"] = 40] = "UserPermissionView";
456
455
  PermissionType2[PermissionType2["UserPermissionManage"] = 41] = "UserPermissionManage";
457
456
  PermissionType2[PermissionType2["UserPermissionDelete"] = 42] = "UserPermissionDelete";
@@ -580,6 +579,8 @@ var uploadsThatNeedEncryption = [];
580
579
  var UserAccountFlagType = /* @__PURE__ */ ((UserAccountFlagType2) => {
581
580
  UserAccountFlagType2[UserAccountFlagType2["Unknown"] = 0] = "Unknown";
582
581
  UserAccountFlagType2[UserAccountFlagType2["ChangePassword"] = 1] = "ChangePassword";
582
+ UserAccountFlagType2[UserAccountFlagType2["EmailNotVerified"] = 2] = "EmailNotVerified";
583
+ UserAccountFlagType2[UserAccountFlagType2["AccountDisabled"] = 3] = "AccountDisabled";
583
584
  return UserAccountFlagType2;
584
585
  })(UserAccountFlagType || {});
585
586
 
@@ -709,7 +710,7 @@ var BookingAddonRestriction = {
709
710
  var BugReportRestriction = {
710
711
  comment: { maxLength: 1e3 },
711
712
  metadata: { maxLength: 1e3 },
712
- logs: { maxLength: 5e3 }
713
+ logs: { maxLength: 5e4 }
713
714
  };
714
715
 
715
716
  // src/contracts/generated/restrictions/commentRestriction.ts
@@ -805,13 +806,13 @@ var UserRestriction = {
805
806
  // src/contracts/generated/searchColumns.ts
806
807
  var searchColumns = {
807
808
  membership: [{ "property": "monthlyFee", "type": 2 }, { "property": "perNightStay", "type": 2 }, { "property": "additionalPetPerNightStay", "type": 2 }, { "property": "transportFee", "type": 2 }, { "property": "perKm", "type": 2 }, { "property": "matchFee", "type": 2 }, { "property": "freeCancellationWithinDays", "type": 2 }, { "property": "bookingAdvanceDays", "type": 2 }, { "property": "bookingCalenderMonthsOpenInAdvance", "type": 2 }, { "property": "seasonalDiscounts", "type": 2 }],
808
- address: [{ "property": "name", "type": 2 }, { "property": "street", "type": 2 }, { "property": "city", "type": 2 }, { "property": "postalCode", "type": 2 }, { "property": "country", "type": 2 }],
809
- pet: [{ "property": "type", "type": 1 }, { "property": "sex", "type": 2 }, { "property": "breed", "type": 2 }, { "property": "neutered", "type": 2 }, { "property": "name", "type": 2 }, { "property": "notes", "type": 2 }, { "property": "dateOfBirth", "type": 5 }],
809
+ address: [{ "property": "name", "type": 2 }, { "property": "street", "type": 2 }, { "property": "city", "type": 2 }, { "property": "postalCode", "type": 2 }],
810
+ pet: [{ "property": "type", "type": 1 }, { "property": "sex", "type": 2 }, { "property": "breed", "type": 2 }, { "property": "name", "type": 2 }, { "property": "notes", "type": 2 }, { "property": "dateOfBirth", "type": 5 }],
810
811
  invoice: [{ "property": "userUuid", "type": 2 }, { "property": "bookingUuid", "type": 2 }, { "property": "bookingAddonUuid", "type": 2 }, { "property": "status", "type": 2 }, { "property": "stripeInvoiceId", "type": 2 }, { "property": "dueDate", "type": 5 }, { "property": "notes", "type": 2 }],
811
812
  userMembership: [{ "property": "status", "type": 1, "subType": "MembershipStatus" }, { "property": "billingCycle", "type": 1, "subType": "MembershipBillingCycleType" }, { "property": "stripeSubscriptionId", "type": 2 }, { "property": "startDate", "type": 5 }, { "property": "endDate", "type": 5 }],
812
813
  user: [{ "property": "types", "type": 1 }, { "property": "firstName", "type": 2 }, { "property": "lastName", "type": 2 }, { "property": "email", "type": 2 }, { "property": "hubspotId", "type": 2 }, { "property": "flags", "type": 1 }, { "property": "dateCreated", "type": 5 }],
813
814
  upload: [{ "property": "linkUuid", "type": 2 }, { "property": "linkType", "type": 2 }, { "property": "type", "type": 2 }, { "property": "fileName", "type": 2 }, { "property": "blobType", "type": 2 }, { "property": "sizeInKb", "type": 2 }, { "property": "dateCreated", "type": 5 }],
814
- booking: [{ "property": "startDate", "type": 5 }, { "property": "endDate", "type": 5 }, { "property": "status", "type": 2 }, { "property": "notes", "type": 2 }],
815
+ booking: [{ "property": "startDate", "type": 5 }, { "property": "endDate", "type": 5 }, { "property": "status", "type": 2 }, { "property": "notes", "type": 2 }, { "property": "dateCreated", "type": 5 }],
815
816
  bugReport: [{ "property": "status", "type": 0 }, { "property": "comment", "type": 2 }, { "property": "metadata", "type": 2 }, { "property": "logs", "type": 2 }],
816
817
  question: [{ "property": "forTypes", "type": 1 }, { "property": "transKey", "type": 2 }, { "property": "fallback", "type": 2 }, { "property": "category", "type": 2 }, { "property": "type", "type": 0 }, { "property": "sortOrder", "type": 3 }, { "property": "visible", "type": 4 }, { "property": "notes", "type": 2 }]
817
818
  };
@@ -1710,6 +1711,33 @@ var maxDate = (maxDate2) => (value) => {
1710
1711
  };
1711
1712
  };
1712
1713
 
1714
+ // src/validation/emailValidation.ts
1715
+ var emailValid = (value) => {
1716
+ if (value.includes("@") == false) {
1717
+ return {
1718
+ isValid: false,
1719
+ errorMessageTransKey: "email_at_sign_validator",
1720
+ errorMessage: `Email should have an @ sign`
1721
+ };
1722
+ }
1723
+ const segments = value.split("@");
1724
+ if (segments.length > 2) {
1725
+ return {
1726
+ isValid: false,
1727
+ errorMessageTransKey: "email_too_many_at_signs_validator",
1728
+ errorMessage: `Email contains too many @ signs`
1729
+ };
1730
+ }
1731
+ if ((segments[1] ?? "").includes(".") == false) {
1732
+ return {
1733
+ isValid: false,
1734
+ errorMessageTransKey: "email_should_have_a_period_after_at_sign_validator",
1735
+ errorMessage: `Email is not valid`
1736
+ };
1737
+ }
1738
+ return { isValid: true };
1739
+ };
1740
+
1713
1741
  // src/validation/numberValidation.ts
1714
1742
  var isNumber = (value) => {
1715
1743
  if (value != null) {
@@ -1746,6 +1774,26 @@ var maxValue = (max) => (value) => {
1746
1774
  };
1747
1775
  };
1748
1776
 
1777
+ // src/validation/passwordValidation.ts
1778
+ var specialChars = "<>@!#$%^&*()_+[]{}?:;|'\"\\,./~`-=";
1779
+ var capitalizeAlphabet2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
1780
+ var errorMessage = `Password should be minimum of 8 characters, with an uppercase letter, at least 1 number and 1 special character`;
1781
+ var passwordValid = (value) => {
1782
+ const passwordCharArr = value.split("");
1783
+ const defaultValidation = { isValid: false, errorMessage };
1784
+ if (value.length < UserRestriction.password.minLength)
1785
+ return { ...defaultValidation, errorMessageTransKey: "password_too_short_validator" };
1786
+ const hasNumber = passwordCharArr.filter((c) => isNaN(Number(c)) == false).length > 0;
1787
+ if (hasNumber == false) return { ...defaultValidation, errorMessageTransKey: "password_missing_number_validator" };
1788
+ const hasSpecialChar = arrayContains(passwordCharArr, specialChars.split(""), "OR");
1789
+ if (hasSpecialChar == false)
1790
+ return { ...defaultValidation, errorMessageTransKey: "password_missing_special_char_validator" };
1791
+ const hasUppercase = arrayContains(passwordCharArr, capitalizeAlphabet2.split(""), "OR");
1792
+ if (hasUppercase == false)
1793
+ return { ...defaultValidation, errorMessageTransKey: "password_missing_uppercase_validator" };
1794
+ return { isValid: true };
1795
+ };
1796
+
1749
1797
  // src/validation/textValidation.ts
1750
1798
  var minLength = (minLengthVal) => (value) => {
1751
1799
  if ((value?.length ?? 0) >= minLengthVal) {
@@ -1803,4 +1851,4 @@ var shouldBeYoutubeUrl = (value) => {
1803
1851
  };
1804
1852
  };
1805
1853
 
1806
- export { APP_TYPE_TOKEN, ActivityRestriction, ActivityType, AddressLinkType, AddressRestriction, AnswerLinkType, AnswerRestriction, AppType, BOT_PATH_TOKEN, BookingAddonRestriction, BookingAddonType, BookingRestriction, BookingStatusType, BugReportRestriction, BugReportStatusType, CommentLinkType, CommentRestriction, CommonConfigService, DependencyInjectionContainer, DrivingRouteRestriction, InvoiceRestriction, InvoiceStatusType, LogService, MembershipBillingCycleType, MembershipRestriction, MembershipStatus, MembershipType, MouseButton, NetworkState, OrderDirectionType, PermissionRestriction, PermissionType, PetRestriction, PetSexType, PetStatusType, PetType, QuestionForType, QuestionRestriction, QuestionType, SITE_CONFIG_TOKEN, SearchableColumnType, StripeRestriction, TempLinkType, TranslationService, UnavailabilityRestriction, UploadLinkType, UploadRestriction, UploadType, UserAccountFlagType, UserRestriction, UserType, addDays, addMinutes, addMonths, addSeconds, addSpacesForEnum, addToParallelTasks, anyObject, apiRoute, apiRouteParam, arrayContains, arrayOfNLength, capitalizeFirstLetter, changeMonth, colourPalette, convertToDate, convertToFullDateSelection, createToken, cyrb53, dateDiffInDays, debounceLeading, defaultSiteColour, fakePromise, formatDate, formatFileSize, formatForBookingDate, formatForDateDropdown, formatForDateLocal, formatForDateLocalDetailed, formatForDateOfBirth, formatForDateWithTime, getActiveUserMembership, getAgeInYears, getAllPetQuestionForType, getAppType, getArrFromEnum, getBotPath, getCalendarDropdownDisplayValue, getCalendarDropdownForDateOfBirthDisplayValue, getCommonConfig, getDayClassObject, getDayElements, getDayHeadingElements, getImageParams, getLog, getMimeTypeFromExtension, getPayloadFromJwt, getPerformanceTimer, getPetAvatarUrl, getSiteColour, getSiteConfig, getUserAvatarUrl, getUsersName, getWeekNumber, hasRequiredPermissions, hubspotQuestionsExport, isBefore, isDateAfterStart, isDateBeforeEnd, isDateDisabledByDisabledDays, isDateEnabledByEnabledDays, isNumber, isSameDay, isWebApp, lowercaseFirstLetter, makeArrayOrDefault, maxDate, maxItems, maxLength, maxValue, mimeTypeLookup, minDate, minItems, minLength, minUrlLength, minValue, monthTranslationKeyOrder, multiValidation, nameof, nanasFonts, noValidation, notNull, onlyUnique, portalGlyphLength, promiseFromValue, randomIntFromRange, randomItemFromArray, rootContainer, rootDependencyInjectionSetup, searchColumns, selectedItemsExist, selectedOptionIsInEnum, separateValidation, setContainerToken, setContainerTokenLazy, setSiteConfig, shouldBeUrl, shouldBeYoutubeUrl, showSecondCalendar, socialLinks, timeout, tryParseNumber, uploadsThatNeedEncryption, urlRef, uuidv4, validUuidChars, validateForEach, webAppTypes, weekdayTranslationKeyOrder };
1854
+ export { APP_TYPE_TOKEN, ActivityRestriction, ActivityType, AddressLinkType, AddressRestriction, AnswerLinkType, AnswerRestriction, AppType, BOT_PATH_TOKEN, BookingAddonRestriction, BookingAddonType, BookingRestriction, BookingStatusType, BugReportRestriction, BugReportStatusType, CommentLinkType, CommentRestriction, CommonConfigService, DependencyInjectionContainer, DrivingRouteRestriction, InvoiceRestriction, InvoiceStatusType, LogService, MembershipBillingCycleType, MembershipRestriction, MembershipStatus, MembershipType, MouseButton, NetworkState, OrderDirectionType, PermissionRestriction, PermissionType, PetRestriction, PetSexType, PetStatusType, PetType, QuestionForType, QuestionRestriction, QuestionType, SITE_CONFIG_TOKEN, SearchableColumnType, StripeRestriction, TempLinkType, TranslationService, UnavailabilityRestriction, UploadLinkType, UploadRestriction, UploadType, UserAccountFlagType, UserRestriction, UserType, addDays, addMinutes, addMonths, addSeconds, addSpacesForEnum, addToParallelTasks, anyObject, apiRoute, apiRouteParam, arrayContains, arrayOfNLength, capitalizeFirstLetter, changeMonth, colourPalette, convertToDate, convertToFullDateSelection, createToken, cyrb53, dateDiffInDays, debounceLeading, defaultSiteColour, emailValid, fakePromise, formatDate, formatFileSize, formatForBookingDate, formatForDateDropdown, formatForDateLocal, formatForDateLocalDetailed, formatForDateOfBirth, formatForDateWithTime, getActiveUserMembership, getAgeInYears, getAllPetQuestionForType, getAppType, getArrFromEnum, getBotPath, getCalendarDropdownDisplayValue, getCalendarDropdownForDateOfBirthDisplayValue, getCommonConfig, getDayClassObject, getDayElements, getDayHeadingElements, getImageParams, getLog, getMimeTypeFromExtension, getPayloadFromJwt, getPerformanceTimer, getPetAvatarUrl, getSiteColour, getSiteConfig, getUserAvatarUrl, getUsersName, getWeekNumber, hasRequiredPermissions, hubspotQuestionsExport, isBefore, isDateAfterStart, isDateBeforeEnd, isDateDisabledByDisabledDays, isDateEnabledByEnabledDays, isNumber, isSameDay, isWebApp, lowercaseFirstLetter, makeArrayOrDefault, maxDate, maxItems, maxLength, maxValue, mimeTypeLookup, minDate, minItems, minLength, minUrlLength, minValue, monthTranslationKeyOrder, multiValidation, nameof, nanasFonts, noValidation, notNull, onlyUnique, passwordValid, portalGlyphLength, promiseFromValue, randomIntFromRange, randomItemFromArray, rootContainer, rootDependencyInjectionSetup, searchColumns, selectedItemsExist, selectedOptionIsInEnum, separateValidation, setContainerToken, setContainerTokenLazy, setSiteConfig, shouldBeUrl, shouldBeYoutubeUrl, showSecondCalendar, socialLinks, timeout, tryParseNumber, uploadsThatNeedEncryption, urlRef, uuidv4, validUuidChars, validateForEach, webAppTypes, weekdayTranslationKeyOrder };
@@ -1,9 +1,11 @@
1
1
  import requireDebugMarker from './rules/require-debug-marker.js';
2
2
  import requireDraggableAttr from './rules/require-draggable-attr.js';
3
+ import preventParentImports from './rules/prevent-parent-imports.js';
3
4
 
4
5
  export default {
5
6
  rules: {
6
7
  'require-debug-marker': requireDebugMarker,
7
8
  'require-draggable-attr': requireDraggableAttr,
9
+ 'prevent-parent-imports': preventParentImports,
8
10
  },
9
11
  };
@@ -0,0 +1,43 @@
1
+ export default {
2
+ meta: {
3
+ type: 'problem',
4
+ docs: {
5
+ description: 'Disallow parent-directory imports (../)',
6
+ },
7
+ messages: {
8
+ noParent: "Parent directory imports ('../') are not allowed.",
9
+ },
10
+ schema: [],
11
+ },
12
+
13
+ create(context) {
14
+ return {
15
+ ImportDeclaration(node) {
16
+ const value = node.source.value;
17
+
18
+ if (typeof value === 'string') {
19
+ if (value.startsWith('./') || value.startsWith('../')) {
20
+ context.report({
21
+ node,
22
+ messageId: 'noParent',
23
+ });
24
+ }
25
+ }
26
+ },
27
+
28
+ CallExpression(node) {
29
+ // Handle require("../something")
30
+ if (node.callee.name === 'require' && node.arguments.length && node.arguments[0].type === 'Literal') {
31
+ const value = node.arguments[0].value;
32
+
33
+ if (typeof value === 'string' && value.startsWith('../')) {
34
+ context.report({
35
+ node,
36
+ messageId: 'noParent',
37
+ });
38
+ }
39
+ }
40
+ },
41
+ };
42
+ },
43
+ };