Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Dec 8, 2023
1 parent 2db46e9 commit 458bc07
Show file tree
Hide file tree
Showing 26 changed files with 38 additions and 57 deletions.
7 changes: 2 additions & 5 deletions ee/packages/license/src/MockedLicenseBuilder.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
1 change: 0 additions & 1 deletion ee/packages/license/src/definition/ILicenseTag.ts

This file was deleted.

1 change: 0 additions & 1 deletion ee/packages/license/src/definition/ILicenseV2.ts

This file was deleted.

1 change: 0 additions & 1 deletion ee/packages/license/src/definition/ILicenseV3.ts

This file was deleted.

1 change: 0 additions & 1 deletion ee/packages/license/src/definition/LicenseBehavior.ts

This file was deleted.

1 change: 0 additions & 1 deletion ee/packages/license/src/definition/LicenseInfo.ts

This file was deleted.

1 change: 0 additions & 1 deletion ee/packages/license/src/definition/LicenseLimit.ts

This file was deleted.

1 change: 0 additions & 1 deletion ee/packages/license/src/definition/LicenseModule.ts

This file was deleted.

1 change: 0 additions & 1 deletion ee/packages/license/src/definition/LicensePeriod.ts

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion ee/packages/license/src/definition/LimitContext.ts

This file was deleted.

1 change: 0 additions & 1 deletion ee/packages/license/src/definition/events.ts

This file was deleted.

3 changes: 2 additions & 1 deletion ee/packages/license/src/deprecated.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
3 changes: 2 additions & 1 deletion ee/packages/license/src/events/deprecated.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
4 changes: 2 additions & 2 deletions ee/packages/license/src/events/emitter.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
5 changes: 2 additions & 3 deletions ee/packages/license/src/events/listeners.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
3 changes: 2 additions & 1 deletion ee/packages/license/src/events/overwriteClassOnLicense.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
14 changes: 2 additions & 12 deletions ee/packages/license/src/index.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions ee/packages/license/src/isItemAllowed.ts
Original file line number Diff line number Diff line change
@@ -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 = <T>(item: T, allowList?: T[]): boolean => {
return !allowList || allowList.includes(item);
Expand Down
22 changes: 13 additions & 9 deletions ee/packages/license/src/license.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
3 changes: 2 additions & 1 deletion ee/packages/license/src/modules.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
3 changes: 2 additions & 1 deletion ee/packages/license/src/showLicense.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
3 changes: 2 additions & 1 deletion ee/packages/license/src/tags.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions ee/packages/license/src/token.ts
Original file line number Diff line number Diff line change
@@ -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=';

Expand Down
2 changes: 1 addition & 1 deletion ee/packages/license/src/v2/bundles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LicenseModule } from '../definition/LicenseModule';
import type { LicenseModule } from '@rocket.chat/core-typings';

interface IBundle {
[key: string]: LicenseModule[];
Expand Down
5 changes: 2 additions & 3 deletions ee/packages/license/src/v2/convertToV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down

0 comments on commit 458bc07

Please sign in to comment.