diff --git a/apps/meteor/app/cloud/server/functions/supportedVersionsToken/supportedVersionsToken.ts b/apps/meteor/app/cloud/server/functions/supportedVersionsToken/supportedVersionsToken.ts index 0b04d10e3556..dd933107d57c 100644 --- a/apps/meteor/app/cloud/server/functions/supportedVersionsToken/supportedVersionsToken.ts +++ b/apps/meteor/app/cloud/server/functions/supportedVersionsToken/supportedVersionsToken.ts @@ -12,7 +12,7 @@ import { buildVersionUpdateMessage } from '../../../../version-check/server/func import { generateWorkspaceBearerHttpHeader } from '../getWorkspaceAccessToken'; import { supportedVersionsChooseLatest } from './supportedVersionsChooseLatest'; -declare module '@rocket.chat/license' { +declare module '@rocket.chat/core-typings' { interface ILicenseV3 { supportedVersions?: SignedSupportedVersions; } diff --git a/apps/meteor/client/hooks/useShouldPreventAction.ts b/apps/meteor/client/hooks/useShouldPreventAction.ts index edcbd5abe676..99b831a7928c 100644 --- a/apps/meteor/client/hooks/useShouldPreventAction.ts +++ b/apps/meteor/client/hooks/useShouldPreventAction.ts @@ -1,4 +1,4 @@ -import type { LicenseLimitKind } from '@rocket.chat/license'; +import type { LicenseLimitKind } from '@rocket.chat/core-typings'; import { useLicense } from './useLicense'; diff --git a/apps/meteor/client/lib/utils/isOverLicenseLimits.ts b/apps/meteor/client/lib/utils/isOverLicenseLimits.ts index 20e0a2b7ca42..957500c1ac30 100644 --- a/apps/meteor/client/lib/utils/isOverLicenseLimits.ts +++ b/apps/meteor/client/lib/utils/isOverLicenseLimits.ts @@ -1,4 +1,4 @@ -import type { LicenseLimitKind } from '@rocket.chat/license'; +import type { LicenseLimitKind } from '@rocket.chat/core-typings'; type Limits = Record< LicenseLimitKind, diff --git a/apps/meteor/client/views/admin/subscription/SubscriptionCalloutLimits.tsx b/apps/meteor/client/views/admin/subscription/SubscriptionCalloutLimits.tsx index 074e349081bd..2adc3d306034 100644 --- a/apps/meteor/client/views/admin/subscription/SubscriptionCalloutLimits.tsx +++ b/apps/meteor/client/views/admin/subscription/SubscriptionCalloutLimits.tsx @@ -1,5 +1,5 @@ +import type { LicenseBehavior } from '@rocket.chat/core-typings'; import { Callout } from '@rocket.chat/fuselage'; -import type { LicenseBehavior } from '@rocket.chat/license/src/definition/LicenseBehavior'; import { validateWarnLimit } from '@rocket.chat/license/src/validation/validateLimit'; import { ExternalLink } from '@rocket.chat/ui-client'; import React from 'react'; diff --git a/apps/meteor/client/views/admin/subscription/components/cards/PlanCard.tsx b/apps/meteor/client/views/admin/subscription/components/cards/PlanCard.tsx index c9e1e06ff8cd..066a4fc1f160 100644 --- a/apps/meteor/client/views/admin/subscription/components/cards/PlanCard.tsx +++ b/apps/meteor/client/views/admin/subscription/components/cards/PlanCard.tsx @@ -1,4 +1,4 @@ -import type { ILicenseV3 } from '@rocket.chat/license'; +import type { ILicenseV3 } from '@rocket.chat/core-typings'; import type { ReactElement } from 'react'; import React from 'react'; diff --git a/apps/meteor/client/views/admin/subscription/components/cards/PlanCard/PlanCardPremium.tsx b/apps/meteor/client/views/admin/subscription/components/cards/PlanCard/PlanCardPremium.tsx index cd7227bda098..056aab081785 100644 --- a/apps/meteor/client/views/admin/subscription/components/cards/PlanCard/PlanCardPremium.tsx +++ b/apps/meteor/client/views/admin/subscription/components/cards/PlanCard/PlanCardPremium.tsx @@ -1,5 +1,5 @@ +import type { ILicenseV3 } from '@rocket.chat/core-typings'; import { Box, Icon, Skeleton } from '@rocket.chat/fuselage'; -import type { ILicenseV3 } from '@rocket.chat/license'; import { ExternalLink } from '@rocket.chat/ui-client'; import type { ReactElement } from 'react'; import React from 'react'; diff --git a/apps/meteor/client/views/admin/subscription/components/cards/PlanCard/PlanCardTrial.tsx b/apps/meteor/client/views/admin/subscription/components/cards/PlanCard/PlanCardTrial.tsx index f1d3001bd508..95ce21e67918 100644 --- a/apps/meteor/client/views/admin/subscription/components/cards/PlanCard/PlanCardTrial.tsx +++ b/apps/meteor/client/views/admin/subscription/components/cards/PlanCard/PlanCardTrial.tsx @@ -1,5 +1,5 @@ +import type { ILicenseV3 } from '@rocket.chat/core-typings'; import { Box, Tag } from '@rocket.chat/fuselage'; -import type { ILicenseV3 } from '@rocket.chat/license'; import { ExternalLink } from '@rocket.chat/ui-client'; import differenceInDays from 'date-fns/differenceInDays'; import type { ReactElement } from 'react'; diff --git a/apps/meteor/ee/app/license/server/lib/getAppCount.ts b/apps/meteor/ee/app/license/server/lib/getAppCount.ts index a05813f596bb..f408143218de 100644 --- a/apps/meteor/ee/app/license/server/lib/getAppCount.ts +++ b/apps/meteor/ee/app/license/server/lib/getAppCount.ts @@ -1,5 +1,5 @@ import { Apps } from '@rocket.chat/core-services'; -import type { LicenseAppSources } from '@rocket.chat/license'; +import type { LicenseAppSources } from '@rocket.chat/core-typings'; import { getInstallationSourceFromAppStorageItem } from '../../../../../lib/apps/getInstallationSourceFromAppStorageItem'; diff --git a/apps/meteor/ee/app/license/server/license.internalService.ts b/apps/meteor/ee/app/license/server/license.internalService.ts index 6c179bf9797e..9998378191d1 100644 --- a/apps/meteor/ee/app/license/server/license.internalService.ts +++ b/apps/meteor/ee/app/license/server/license.internalService.ts @@ -1,6 +1,7 @@ import type { ILicense } from '@rocket.chat/core-services'; import { api, ServiceClassInternal } from '@rocket.chat/core-services'; -import { License, type LicenseModule } from '@rocket.chat/license'; +import { type LicenseModule } from '@rocket.chat/core-typings'; +import { License } from '@rocket.chat/license'; import { guestPermissions } from '../../authorization/lib/guestPermissions'; import { resetEnterprisePermissions } from '../../authorization/server/resetEnterprisePermissions'; diff --git a/apps/meteor/ee/app/license/server/methods.ts b/apps/meteor/ee/app/license/server/methods.ts index 39d14326a79a..dbdfe7aea68c 100644 --- a/apps/meteor/ee/app/license/server/methods.ts +++ b/apps/meteor/ee/app/license/server/methods.ts @@ -1,4 +1,5 @@ -import { License, type ILicenseTag, type LicenseModule } from '@rocket.chat/license'; +import { type ILicenseTag, type LicenseModule } from '@rocket.chat/core-typings'; +import { License } from '@rocket.chat/license'; import type { ServerMethods } from '@rocket.chat/ui-contexts'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; diff --git a/apps/meteor/ee/app/license/server/startup.ts b/apps/meteor/ee/app/license/server/startup.ts index 1f05ae27ce9d..e483cb8d7336 100644 --- a/apps/meteor/ee/app/license/server/startup.ts +++ b/apps/meteor/ee/app/license/server/startup.ts @@ -1,5 +1,5 @@ import { api } from '@rocket.chat/core-services'; -import type { LicenseLimitKind } from '@rocket.chat/license'; +import type { LicenseLimitKind } from '@rocket.chat/core-typings'; import { License } from '@rocket.chat/license'; import { Subscriptions, Users, Settings, LivechatVisitors } from '@rocket.chat/models'; import { wrapExceptions } from '@rocket.chat/tools'; diff --git a/apps/meteor/ee/app/settings/server/settings.ts b/apps/meteor/ee/app/settings/server/settings.ts index 76ce7c15155a..d404dfa1741a 100644 --- a/apps/meteor/ee/app/settings/server/settings.ts +++ b/apps/meteor/ee/app/settings/server/settings.ts @@ -1,5 +1,5 @@ -import type { ISetting, SettingValue } from '@rocket.chat/core-typings'; -import { License, type LicenseModule } from '@rocket.chat/license'; +import type { ISetting, SettingValue, LicenseModule } from '@rocket.chat/core-typings'; +import { License } from '@rocket.chat/license'; import { Settings } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; diff --git a/apps/meteor/ee/client/hooks/useHasLicenseModule.ts b/apps/meteor/ee/client/hooks/useHasLicenseModule.ts index 4e44029c60f4..f2d75ab23746 100644 --- a/apps/meteor/ee/client/hooks/useHasLicenseModule.ts +++ b/apps/meteor/ee/client/hooks/useHasLicenseModule.ts @@ -1,4 +1,4 @@ -import type { LicenseModule } from '@rocket.chat/license'; +import type { LicenseModule } from '@rocket.chat/core-typings'; import { useLicenseBase } from '../../../client/hooks/useLicense'; diff --git a/apps/meteor/ee/client/lib/onToggledFeature.ts b/apps/meteor/ee/client/lib/onToggledFeature.ts index ae2e4ad9f4a8..3f47b35bdbe2 100644 --- a/apps/meteor/ee/client/lib/onToggledFeature.ts +++ b/apps/meteor/ee/client/lib/onToggledFeature.ts @@ -1,4 +1,4 @@ -import type { LicenseModule } from '@rocket.chat/license'; +import type { LicenseModule } from '@rocket.chat/core-typings'; import { QueryObserver } from '@tanstack/react-query'; import { queryClient } from '../../../client/lib/queryClient'; diff --git a/apps/meteor/lib/apps/getInstallationSourceFromAppStorageItem.ts b/apps/meteor/lib/apps/getInstallationSourceFromAppStorageItem.ts index 8ac29d191576..d8fd5a48f79f 100644 --- a/apps/meteor/lib/apps/getInstallationSourceFromAppStorageItem.ts +++ b/apps/meteor/lib/apps/getInstallationSourceFromAppStorageItem.ts @@ -1,5 +1,5 @@ import type { IAppStorageItem } from '@rocket.chat/apps-engine/server/storage'; -import type { LicenseAppSources } from '@rocket.chat/license'; +import type { LicenseAppSources } from '@rocket.chat/core-typings'; /** * There have been reports of apps not being correctly migrated from versions prior to 6.0 diff --git a/ee/packages/ddp-client/src/types/streams.ts b/ee/packages/ddp-client/src/types/streams.ts index 56a93e658931..d3a59a25c288 100644 --- a/ee/packages/ddp-client/src/types/streams.ts +++ b/ee/packages/ddp-client/src/types/streams.ts @@ -23,8 +23,8 @@ import type { ILivechatAgent, IImportProgress, IBanner, + LicenseLimitKind, } from '@rocket.chat/core-typings'; -import type { LicenseLimitKind } from '@rocket.chat/license'; import type * as UiKit from '@rocket.chat/ui-kit'; type ClientAction = 'inserted' | 'updated' | 'removed' | 'changed'; diff --git a/ee/packages/license/src/MockedLicenseBuilder.ts b/ee/packages/license/src/MockedLicenseBuilder.ts index da9e833e06c4..4c3cab7b660f 100644 --- a/ee/packages/license/src/MockedLicenseBuilder.ts +++ b/ee/packages/license/src/MockedLicenseBuilder.ts @@ -1,8 +1,5 @@ -import type { ILicenseTag } from './definition/ILicenseTag'; -import type { ILicenseV3 } from './definition/ILicenseV3'; -import type { LicenseLimit } from './definition/LicenseLimit'; -import type { LicenseModule } from './definition/LicenseModule'; -import type { LicensePeriod, Timestamp } from './definition/LicensePeriod'; +import type { ILicenseTag, ILicenseV3, LicenseLimit, LicenseModule, LicensePeriod, Timestamp } from '@rocket.chat/core-typings'; + import { encrypt } from './token'; export class MockedLicenseBuilder { diff --git a/ee/packages/license/src/deprecated.ts b/ee/packages/license/src/deprecated.ts index bbd137cc8123..e4d7bd22293a 100644 --- a/ee/packages/license/src/deprecated.ts +++ b/ee/packages/license/src/deprecated.ts @@ -1,4 +1,5 @@ -import type { ILicenseV3, LicenseLimitKind } from './definition/ILicenseV3'; +import type { ILicenseV3, LicenseLimitKind } from '@rocket.chat/core-typings'; + import type { LicenseManager } from './license'; import { getModules } from './modules'; import { defaultLimits } from './validation/validateDefaultLimits'; diff --git a/ee/packages/license/src/events/deprecated.ts b/ee/packages/license/src/events/deprecated.ts index 8ebfe4729292..b120815c0aae 100644 --- a/ee/packages/license/src/events/deprecated.ts +++ b/ee/packages/license/src/events/deprecated.ts @@ -1,4 +1,5 @@ -import type { LicenseModule } from '../definition/LicenseModule'; +import type { LicenseModule } from '@rocket.chat/core-typings'; + import type { LicenseManager } from '../license'; import { hasModule } from '../modules'; diff --git a/ee/packages/license/src/events/emitter.ts b/ee/packages/license/src/events/emitter.ts index dde10d68563f..b4406abaa81b 100644 --- a/ee/packages/license/src/events/emitter.ts +++ b/ee/packages/license/src/events/emitter.ts @@ -1,5 +1,5 @@ -import type { BehaviorWithContext } from '../definition/LicenseBehavior'; -import type { LicenseModule } from '../definition/LicenseModule'; +import type { BehaviorWithContext, LicenseModule } from '@rocket.chat/core-typings'; + import type { LicenseManager } from '../license'; import { logger } from '../logger'; diff --git a/ee/packages/license/src/events/listeners.ts b/ee/packages/license/src/events/listeners.ts index add2f397ba8f..7b7eaf0baed9 100644 --- a/ee/packages/license/src/events/listeners.ts +++ b/ee/packages/license/src/events/listeners.ts @@ -1,6 +1,5 @@ -import type { LicenseLimitKind } from '../definition/ILicenseV3'; -import type { BehaviorWithContext, LicenseBehavior } from '../definition/LicenseBehavior'; -import type { LicenseModule } from '../definition/LicenseModule'; +import type { LicenseLimitKind, LicenseModule, BehaviorWithContext, LicenseBehavior } from '@rocket.chat/core-typings'; + import type { LicenseManager } from '../license'; import { hasModule } from '../modules'; diff --git a/ee/packages/license/src/events/overwriteClassOnLicense.ts b/ee/packages/license/src/events/overwriteClassOnLicense.ts index 00a690d8f413..7ca686b58a50 100644 --- a/ee/packages/license/src/events/overwriteClassOnLicense.ts +++ b/ee/packages/license/src/events/overwriteClassOnLicense.ts @@ -1,4 +1,5 @@ -import type { LicenseModule } from '../definition/LicenseModule'; +import type { LicenseModule } from '@rocket.chat/core-typings'; + import type { LicenseManager } from '../license'; import { onLicense } from './deprecated'; diff --git a/ee/packages/license/src/index.ts b/ee/packages/license/src/index.ts index cf0bc0c74f4b..cb07323d4678 100644 --- a/ee/packages/license/src/index.ts +++ b/ee/packages/license/src/index.ts @@ -1,6 +1,5 @@ -import type { LicenseLimitKind } from './definition/ILicenseV3'; -import type { LicenseInfo } from './definition/LicenseInfo'; -import type { LimitContext } from './definition/LimitContext'; +import type { LicenseLimitKind, LicenseInfo, LimitContext } from '@rocket.chat/core-typings'; + import { getAppsConfig, getMaxActiveUsers, getUnmodifiedLicenseAndModules } from './deprecated'; import { onLicense } from './events/deprecated'; import { @@ -28,15 +27,6 @@ import { getCurrentValueForLicenseLimit, setLicenseLimitCounter } from './valida import { validateFormat } from './validation/validateFormat'; export { DuplicatedLicenseError } from './errors/DuplicatedLicenseError'; -export * from './definition/ILicenseTag'; -export * from './definition/ILicenseV2'; -export * from './definition/ILicenseV3'; -export * from './definition/LicenseBehavior'; -export * from './definition/LicenseInfo'; -export * from './definition/LicenseLimit'; -export * from './definition/LicenseModule'; -export * from './definition/LicensePeriod'; -export * from './definition/LimitContext'; export * from './MockedLicenseBuilder'; // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/ee/packages/license/src/isItemAllowed.ts b/ee/packages/license/src/isItemAllowed.ts index 16787cdf9c4d..3eb9651a8fc9 100644 --- a/ee/packages/license/src/isItemAllowed.ts +++ b/ee/packages/license/src/isItemAllowed.ts @@ -1,6 +1,4 @@ -import type { LicenseLimitKind } from './definition/ILicenseV3'; -import type { LicenseBehavior } from './definition/LicenseBehavior'; -import type { LicenseValidationOptions } from './definition/LicenseValidationOptions'; +import type { LicenseLimitKind, LicenseBehavior, LicenseValidationOptions } from '@rocket.chat/core-typings'; const isItemAllowed = (item: T, allowList?: T[]): boolean => { return !allowList || allowList.includes(item); diff --git a/ee/packages/license/src/license.ts b/ee/packages/license/src/license.ts index 5d4a33024f8b..a8d8f1bca510 100644 --- a/ee/packages/license/src/license.ts +++ b/ee/packages/license/src/license.ts @@ -1,14 +1,18 @@ +import type { + ILicenseTag, + LicenseEvents, + ILicenseV2, + ILicenseV3, + LicenseLimitKind, + BehaviorWithContext, + LicenseBehavior, + LicenseInfo, + LicenseModule, + LicenseValidationOptions, + LimitContext, +} from '@rocket.chat/core-typings'; import { Emitter } from '@rocket.chat/emitter'; -import { type ILicenseTag } from './definition/ILicenseTag'; -import type { ILicenseV2 } from './definition/ILicenseV2'; -import type { ILicenseV3, LicenseLimitKind } from './definition/ILicenseV3'; -import type { BehaviorWithContext, LicenseBehavior } from './definition/LicenseBehavior'; -import type { LicenseInfo } from './definition/LicenseInfo'; -import type { LicenseModule } from './definition/LicenseModule'; -import type { LicenseValidationOptions } from './definition/LicenseValidationOptions'; -import type { LimitContext } from './definition/LimitContext'; -import type { LicenseEvents } from './definition/events'; import { getLicenseLimit } from './deprecated'; import { DuplicatedLicenseError } from './errors/DuplicatedLicenseError'; import { InvalidLicenseError } from './errors/InvalidLicenseError'; diff --git a/ee/packages/license/src/modules.ts b/ee/packages/license/src/modules.ts index 6931fb7a6a5d..7a6f41c07ec1 100644 --- a/ee/packages/license/src/modules.ts +++ b/ee/packages/license/src/modules.ts @@ -1,4 +1,5 @@ -import type { LicenseModule } from './definition/LicenseModule'; +import type { LicenseModule } from '@rocket.chat/core-typings'; + import { moduleRemoved, moduleValidated } from './events/emitter'; import type { LicenseManager } from './license'; diff --git a/ee/packages/license/src/showLicense.ts b/ee/packages/license/src/showLicense.ts index 3dda60a43b76..cbf708019856 100644 --- a/ee/packages/license/src/showLicense.ts +++ b/ee/packages/license/src/showLicense.ts @@ -1,4 +1,5 @@ -import type { ILicenseV3 } from './definition/ILicenseV3'; +import type { ILicenseV3 } from '@rocket.chat/core-typings'; + import type { LicenseManager } from './license'; import { getModules } from './modules'; diff --git a/ee/packages/license/src/tags.ts b/ee/packages/license/src/tags.ts index 33434cae116d..d918c4cd0cfc 100644 --- a/ee/packages/license/src/tags.ts +++ b/ee/packages/license/src/tags.ts @@ -1,4 +1,5 @@ -import type { ILicenseTag } from './definition/ILicenseTag'; +import type { ILicenseTag } from '@rocket.chat/core-typings'; + import { type LicenseManager } from './license'; export function addTag(this: LicenseManager, tag: ILicenseTag) { diff --git a/ee/packages/license/src/token.ts b/ee/packages/license/src/token.ts index 8e34d7cf2621..09ad5a940b58 100644 --- a/ee/packages/license/src/token.ts +++ b/ee/packages/license/src/token.ts @@ -1,9 +1,8 @@ import crypto from 'crypto'; +import type { ILicenseV3 } from '@rocket.chat/core-typings'; import { verify, sign, getPairs } from '@rocket.chat/jwt'; -import type { ILicenseV3 } from './definition/ILicenseV3'; - const PUBLIC_LICENSE_KEY_V2 = 'LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQ0lqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FnOEFNSUlDQ2dLQ0FnRUFxV1Nza2Q5LzZ6Ung4a3lQY2ljcwpiMzJ3Mnd4VnV3N3lCVDk2clEvOEQreU1lQ01POXdTU3BIYS85bkZ5d293RXRpZ3B0L3dyb1BOK1ZHU3didHdQCkZYQmVxRWxCbmRHRkFsODZlNStFbGlIOEt6L2hHbkNtSk5tWHB4RUsyUkUwM1g0SXhzWVg3RERCN010eC9pcXMKY2pCL091dlNCa2ppU2xlUzdibE5JVC9kQTdLNC9DSjNvaXUwMmJMNEV4Y2xDSGVwenFOTWVQM3dVWmdweE9uZgpOT3VkOElYWUs3M3pTY3VFOEUxNTdZd3B6Q0twVmFIWDdaSmY4UXVOc09PNVcvYUlqS2wzTDYyNjkrZUlPRXJHCndPTm1hSG56Zmc5RkxwSmh6Z3BPMzhhVm43NnZENUtLakJhaldza1krNGEyZ1NRbUtOZUZxYXFPb3p5RUZNMGUKY0ZXWlZWWjNMZWg0dkVNb1lWUHlJeng5Nng4ZjIveW1QbmhJdXZRdjV3TjRmeWVwYTdFWTVVQ2NwNzF6OGtmUAo0RmNVelBBMElEV3lNaWhYUi9HNlhnUVFaNEdiL3FCQmh2cnZpSkNGemZZRGNKZ0w3RmVnRllIUDNQR0wwN1FnCnZMZXZNSytpUVpQcnhyYnh5U3FkUE9rZ3VyS2pWclhUVXI0QTlUZ2lMeUlYNVVsSnEzRS9SVjdtZk9xWm5MVGEKU0NWWEhCaHVQbG5DR1pSMDFUb1RDZktoTUcxdTBDRm5MMisxNWhDOWZxT21XdjlRa2U0M3FsSjBQZ0YzVkovWAp1eC9tVHBuazlnbmJHOUpIK21mSDM5Um9GdlROaW5Zd1NNdll6dXRWT242OXNPemR3aERsYTkwbDNBQ2g0eENWCks3Sk9YK3VIa29OdTNnMmlWeGlaVU0wQ0F3RUFBUT09Ci0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo='; diff --git a/ee/packages/license/src/v2/bundles.ts b/ee/packages/license/src/v2/bundles.ts index 0ff1cd6c41a9..1e384fff0bdd 100644 --- a/ee/packages/license/src/v2/bundles.ts +++ b/ee/packages/license/src/v2/bundles.ts @@ -1,4 +1,4 @@ -import type { LicenseModule } from '../definition/LicenseModule'; +import type { LicenseModule } from '@rocket.chat/core-typings'; interface IBundle { [key: string]: LicenseModule[]; diff --git a/ee/packages/license/src/v2/convertToV3.ts b/ee/packages/license/src/v2/convertToV3.ts index 94e94a868e54..a7b67ada2c6e 100644 --- a/ee/packages/license/src/v2/convertToV3.ts +++ b/ee/packages/license/src/v2/convertToV3.ts @@ -3,9 +3,8 @@ * Transform a License V2 into a V3 representation. */ -import type { ILicenseV2 } from '../definition/ILicenseV2'; -import type { ILicenseV3 } from '../definition/ILicenseV3'; -import type { LicenseModule } from '../definition/LicenseModule'; +import type { ILicenseV2, ILicenseV3, LicenseModule } from '@rocket.chat/core-typings'; + import { isBundle, getBundleFromModule, getBundleModules } from './bundles'; import { getTagColor } from './getTagColor'; diff --git a/ee/packages/license/src/validation/filterBehaviorsResult.ts b/ee/packages/license/src/validation/filterBehaviorsResult.ts index e51dbac20a53..e0c80f6dcb87 100644 --- a/ee/packages/license/src/validation/filterBehaviorsResult.ts +++ b/ee/packages/license/src/validation/filterBehaviorsResult.ts @@ -1,4 +1,4 @@ -import type { BehaviorWithContext, LicenseBehavior } from '../definition/LicenseBehavior'; +import type { BehaviorWithContext, LicenseBehavior } from '@rocket.chat/core-typings'; export const filterBehaviorsResult = (result: BehaviorWithContext[], expectedBehaviors: LicenseBehavior[]) => result.filter(({ behavior }) => expectedBehaviors.includes(behavior)); diff --git a/ee/packages/license/src/validation/getCurrentValueForLicenseLimit.ts b/ee/packages/license/src/validation/getCurrentValueForLicenseLimit.ts index 6dd3f143fc72..01d4b78b77f2 100644 --- a/ee/packages/license/src/validation/getCurrentValueForLicenseLimit.ts +++ b/ee/packages/license/src/validation/getCurrentValueForLicenseLimit.ts @@ -1,5 +1,5 @@ -import type { LicenseLimitKind } from '../definition/ILicenseV3'; -import type { LimitContext } from '../definition/LimitContext'; +import type { LicenseLimitKind, LimitContext } from '@rocket.chat/core-typings'; + import type { LicenseManager } from '../license'; import { logger } from '../logger'; import { applyPendingLicense, hasPendingLicense } from '../pendingLicense'; diff --git a/ee/packages/license/src/validation/getModulesToDisable.ts b/ee/packages/license/src/validation/getModulesToDisable.ts index d42426e8af26..cdab814db026 100644 --- a/ee/packages/license/src/validation/getModulesToDisable.ts +++ b/ee/packages/license/src/validation/getModulesToDisable.ts @@ -1,5 +1,4 @@ -import type { BehaviorWithContext, LicenseBehavior } from '../definition/LicenseBehavior'; -import type { LicenseModule } from '../definition/LicenseModule'; +import type { BehaviorWithContext, LicenseBehavior, LicenseModule } from '@rocket.chat/core-typings'; const filterValidationResult = (result: BehaviorWithContext[], expectedBehavior: LicenseBehavior) => result.filter(({ behavior }) => behavior === expectedBehavior) as BehaviorWithContext[]; diff --git a/ee/packages/license/src/validation/getResultingBehavior.ts b/ee/packages/license/src/validation/getResultingBehavior.ts index 22ca02bfd220..a860c0985aaa 100644 --- a/ee/packages/license/src/validation/getResultingBehavior.ts +++ b/ee/packages/license/src/validation/getResultingBehavior.ts @@ -1,7 +1,4 @@ -import type { LicenseLimitKind } from '../definition/ILicenseV3'; -import type { BehaviorWithContext } from '../definition/LicenseBehavior'; -import type { LicenseLimit } from '../definition/LicenseLimit'; -import type { LicensePeriod } from '../definition/LicensePeriod'; +import type { LicenseLimitKind, BehaviorWithContext, LicenseLimit, LicensePeriod } from '@rocket.chat/core-typings'; export const getResultingBehavior = ( data: LicenseLimit | LicensePeriod | Partial>, diff --git a/ee/packages/license/src/validation/isBehaviorsInResult.ts b/ee/packages/license/src/validation/isBehaviorsInResult.ts index 7e6ed89db8ec..18a0251cb3cc 100644 --- a/ee/packages/license/src/validation/isBehaviorsInResult.ts +++ b/ee/packages/license/src/validation/isBehaviorsInResult.ts @@ -1,4 +1,4 @@ -import type { BehaviorWithContext, LicenseBehavior } from '../definition/LicenseBehavior'; +import type { BehaviorWithContext, LicenseBehavior } from '@rocket.chat/core-typings'; export const isBehaviorsInResult = (result: BehaviorWithContext[], expectedBehaviors: LicenseBehavior[]) => result.some(({ behavior }) => expectedBehaviors.includes(behavior)); diff --git a/ee/packages/license/src/validation/logKind.ts b/ee/packages/license/src/validation/logKind.ts index 99a7c9d6d419..cd2968d9e4b7 100644 --- a/ee/packages/license/src/validation/logKind.ts +++ b/ee/packages/license/src/validation/logKind.ts @@ -1,4 +1,4 @@ -import type { LicenseBehavior } from '../definition/LicenseBehavior'; +import type { LicenseBehavior } from '@rocket.chat/core-typings'; export const logKind = (behavior: LicenseBehavior) => { switch (behavior) { diff --git a/ee/packages/license/src/validation/runValidation.ts b/ee/packages/license/src/validation/runValidation.ts index 922b4c49162e..52704b535ab3 100644 --- a/ee/packages/license/src/validation/runValidation.ts +++ b/ee/packages/license/src/validation/runValidation.ts @@ -1,6 +1,5 @@ -import type { ILicenseV3 } from '../definition/ILicenseV3'; -import type { BehaviorWithContext } from '../definition/LicenseBehavior'; -import type { LicenseValidationOptions } from '../definition/LicenseValidationOptions'; +import type { ILicenseV3, BehaviorWithContext, LicenseValidationOptions } from '@rocket.chat/core-typings'; + import type { LicenseManager } from '../license'; import { validateLicenseLimits } from './validateLicenseLimits'; import { validateLicensePeriods } from './validateLicensePeriods'; diff --git a/ee/packages/license/src/validation/validateDefaultLimits.ts b/ee/packages/license/src/validation/validateDefaultLimits.ts index d8b03f216c2f..4f48d4e7ebe4 100644 --- a/ee/packages/license/src/validation/validateDefaultLimits.ts +++ b/ee/packages/license/src/validation/validateDefaultLimits.ts @@ -1,6 +1,5 @@ -import type { BehaviorWithContext } from '../definition/LicenseBehavior'; -import type { LicenseLimit } from '../definition/LicenseLimit'; -import type { LicenseValidationOptions } from '../definition/LicenseValidationOptions'; +import type { BehaviorWithContext, LicenseLimit, LicenseValidationOptions } from '@rocket.chat/core-typings'; + import type { LicenseManager } from '../license'; import { validateLimits } from './validateLimits'; diff --git a/ee/packages/license/src/validation/validateLicenseLimits.ts b/ee/packages/license/src/validation/validateLicenseLimits.ts index bc6212e11d99..4ac916d16e69 100644 --- a/ee/packages/license/src/validation/validateLicenseLimits.ts +++ b/ee/packages/license/src/validation/validateLicenseLimits.ts @@ -1,6 +1,5 @@ -import type { ILicenseV3 } from '../definition/ILicenseV3'; -import type { BehaviorWithContext } from '../definition/LicenseBehavior'; -import type { LicenseValidationOptions } from '../definition/LicenseValidationOptions'; +import type { ILicenseV3, BehaviorWithContext, LicenseValidationOptions } from '@rocket.chat/core-typings'; + import type { LicenseManager } from '../license'; import { validateLimits } from './validateLimits'; diff --git a/ee/packages/license/src/validation/validateLicensePeriods.ts b/ee/packages/license/src/validation/validateLicensePeriods.ts index fb27f72d0a8e..4229d2435645 100644 --- a/ee/packages/license/src/validation/validateLicensePeriods.ts +++ b/ee/packages/license/src/validation/validateLicensePeriods.ts @@ -1,7 +1,5 @@ -import type { ILicenseV3 } from '../definition/ILicenseV3'; -import type { BehaviorWithContext } from '../definition/LicenseBehavior'; -import type { Timestamp } from '../definition/LicensePeriod'; -import type { LicenseValidationOptions } from '../definition/LicenseValidationOptions'; +import type { ILicenseV3, BehaviorWithContext, Timestamp, LicenseValidationOptions } from '@rocket.chat/core-typings'; + import { isBehaviorAllowed } from '../isItemAllowed'; import { logger } from '../logger'; import { getResultingBehavior } from './getResultingBehavior'; diff --git a/ee/packages/license/src/validation/validateLicenseUrl.ts b/ee/packages/license/src/validation/validateLicenseUrl.ts index 416b107511cb..aeba5634a262 100644 --- a/ee/packages/license/src/validation/validateLicenseUrl.ts +++ b/ee/packages/license/src/validation/validateLicenseUrl.ts @@ -1,8 +1,7 @@ import crypto from 'crypto'; -import type { ILicenseV3 } from '../definition/ILicenseV3'; -import type { BehaviorWithContext } from '../definition/LicenseBehavior'; -import type { LicenseValidationOptions } from '../definition/LicenseValidationOptions'; +import type { ILicenseV3, BehaviorWithContext, LicenseValidationOptions } from '@rocket.chat/core-typings'; + import { isBehaviorAllowed } from '../isItemAllowed'; import type { LicenseManager } from '../license'; import { logger } from '../logger'; diff --git a/ee/packages/license/src/validation/validateLimit.ts b/ee/packages/license/src/validation/validateLimit.ts index 21649d2e9f5b..be0e2d040005 100644 --- a/ee/packages/license/src/validation/validateLimit.ts +++ b/ee/packages/license/src/validation/validateLimit.ts @@ -1,4 +1,4 @@ -import type { LicenseBehavior } from '../definition/LicenseBehavior'; +import type { LicenseBehavior } from '@rocket.chat/core-typings'; /** * The difference between validateLimit and validateWarnLimit is that the first one diff --git a/ee/packages/license/src/validation/validateLimits.ts b/ee/packages/license/src/validation/validateLimits.ts index 1cae603716b6..b3b42a024e6f 100644 --- a/ee/packages/license/src/validation/validateLimits.ts +++ b/ee/packages/license/src/validation/validateLimits.ts @@ -1,6 +1,5 @@ -import type { ILicenseV3, LicenseLimitKind } from '../definition/ILicenseV3'; -import type { BehaviorWithContext } from '../definition/LicenseBehavior'; -import type { LicenseValidationOptions } from '../definition/LicenseValidationOptions'; +import type { ILicenseV3, LicenseLimitKind, BehaviorWithContext, LicenseValidationOptions } from '@rocket.chat/core-typings'; + import { isLimitAllowed, isBehaviorAllowed } from '../isItemAllowed'; import type { LicenseManager } from '../license'; import { logger } from '../logger'; diff --git a/packages/core-services/src/events/Events.ts b/packages/core-services/src/events/Events.ts index 3a3f1b9c3b89..5b27b421ba27 100644 --- a/packages/core-services/src/events/Events.ts +++ b/packages/core-services/src/events/Events.ts @@ -32,8 +32,8 @@ import type { ILivechatAgent, IBanner, ILivechatVisitor, + LicenseLimitKind, } from '@rocket.chat/core-typings'; -import type { LicenseLimitKind } from '@rocket.chat/license'; import type * as UiKit from '@rocket.chat/ui-kit'; import type { AutoUpdateRecord } from '../types/IMeteor'; diff --git a/packages/core-typings/src/index.ts b/packages/core-typings/src/index.ts index ee5ac21c49ec..5a7db5d952aa 100644 --- a/packages/core-typings/src/index.ts +++ b/packages/core-typings/src/index.ts @@ -33,6 +33,7 @@ export * from './IRocketChatAssets'; export * from './IPushToken'; export * from './IPushNotificationConfig'; export * from './SlashCommands'; +export * from './license'; export * from './IUserDataFile'; export * from './IUserSession'; diff --git a/ee/packages/license/src/definition/ILicenseTag.ts b/packages/core-typings/src/license/ILicenseTag.ts similarity index 100% rename from ee/packages/license/src/definition/ILicenseTag.ts rename to packages/core-typings/src/license/ILicenseTag.ts diff --git a/ee/packages/license/src/definition/ILicenseV2.ts b/packages/core-typings/src/license/ILicenseV2.ts similarity index 100% rename from ee/packages/license/src/definition/ILicenseV2.ts rename to packages/core-typings/src/license/ILicenseV2.ts diff --git a/ee/packages/license/src/definition/ILicenseV3.ts b/packages/core-typings/src/license/ILicenseV3.ts similarity index 100% rename from ee/packages/license/src/definition/ILicenseV3.ts rename to packages/core-typings/src/license/ILicenseV3.ts diff --git a/ee/packages/license/src/definition/LicenseBehavior.ts b/packages/core-typings/src/license/LicenseBehavior.ts similarity index 100% rename from ee/packages/license/src/definition/LicenseBehavior.ts rename to packages/core-typings/src/license/LicenseBehavior.ts diff --git a/ee/packages/license/src/definition/LicenseInfo.ts b/packages/core-typings/src/license/LicenseInfo.ts similarity index 100% rename from ee/packages/license/src/definition/LicenseInfo.ts rename to packages/core-typings/src/license/LicenseInfo.ts diff --git a/ee/packages/license/src/definition/LicenseLimit.ts b/packages/core-typings/src/license/LicenseLimit.ts similarity index 100% rename from ee/packages/license/src/definition/LicenseLimit.ts rename to packages/core-typings/src/license/LicenseLimit.ts diff --git a/ee/packages/license/src/definition/LicenseModule.ts b/packages/core-typings/src/license/LicenseModule.ts similarity index 100% rename from ee/packages/license/src/definition/LicenseModule.ts rename to packages/core-typings/src/license/LicenseModule.ts diff --git a/ee/packages/license/src/definition/LicensePeriod.ts b/packages/core-typings/src/license/LicensePeriod.ts similarity index 100% rename from ee/packages/license/src/definition/LicensePeriod.ts rename to packages/core-typings/src/license/LicensePeriod.ts diff --git a/ee/packages/license/src/definition/LicenseValidationOptions.ts b/packages/core-typings/src/license/LicenseValidationOptions.ts similarity index 100% rename from ee/packages/license/src/definition/LicenseValidationOptions.ts rename to packages/core-typings/src/license/LicenseValidationOptions.ts diff --git a/ee/packages/license/src/definition/LimitContext.ts b/packages/core-typings/src/license/LimitContext.ts similarity index 79% rename from ee/packages/license/src/definition/LimitContext.ts rename to packages/core-typings/src/license/LimitContext.ts index 9dfc6d36be7f..65be71d3cf22 100644 --- a/ee/packages/license/src/definition/LimitContext.ts +++ b/packages/core-typings/src/license/LimitContext.ts @@ -1,5 +1,4 @@ -import type { IUser } from '@rocket.chat/core-typings'; - +import type { IUser } from '../IUser'; import type { LicenseLimitKind } from './ILicenseV3'; export type LimitContext = { extraCount?: number } & (T extends 'roomsPerGuest' diff --git a/ee/packages/license/src/definition/events.ts b/packages/core-typings/src/license/events.ts similarity index 100% rename from ee/packages/license/src/definition/events.ts rename to packages/core-typings/src/license/events.ts diff --git a/packages/core-typings/src/license/index.ts b/packages/core-typings/src/license/index.ts new file mode 100644 index 000000000000..55c252c1fb96 --- /dev/null +++ b/packages/core-typings/src/license/index.ts @@ -0,0 +1,11 @@ +export * from './events'; +export * from './ILicenseTag'; +export * from './ILicenseV2'; +export * from './ILicenseV3'; +export * from './LicenseBehavior'; +export * from './LicenseInfo'; +export * from './LicenseLimit'; +export * from './LicenseModule'; +export * from './LicensePeriod'; +export * from './LicenseValidationOptions'; +export * from './LimitContext'; diff --git a/packages/rest-typings/package.json b/packages/rest-typings/package.json index 7cdffb11d324..5e3708da8d75 100644 --- a/packages/rest-typings/package.json +++ b/packages/rest-typings/package.json @@ -26,7 +26,6 @@ "dependencies": { "@rocket.chat/apps-engine": "1.41.0", "@rocket.chat/core-typings": "workspace:^", - "@rocket.chat/license": "workspace:^", "@rocket.chat/message-parser": "~0.31.27", "@rocket.chat/ui-kit": "workspace:~", "ajv": "^8.11.0", diff --git a/packages/rest-typings/src/v1/licenses.ts b/packages/rest-typings/src/v1/licenses.ts index 4eb1ac196840..4a18bc113a6c 100644 --- a/packages/rest-typings/src/v1/licenses.ts +++ b/packages/rest-typings/src/v1/licenses.ts @@ -1,4 +1,4 @@ -import type { ILicenseV2, ILicenseV3, LicenseInfo } from '@rocket.chat/license'; +import type { ILicenseV2, ILicenseV3, LicenseInfo } from '@rocket.chat/core-typings'; import Ajv from 'ajv'; const ajv = new Ajv({ diff --git a/yarn.lock b/yarn.lock index f7d56bd49837..82b641ce0ae6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10135,7 +10135,6 @@ __metadata: "@rocket.chat/apps-engine": 1.41.0 "@rocket.chat/core-typings": "workspace:^" "@rocket.chat/eslint-config": "workspace:^" - "@rocket.chat/license": "workspace:^" "@rocket.chat/message-parser": ~0.31.27 "@rocket.chat/ui-kit": "workspace:~" "@types/jest": ~29.5.7