@heliofi/common 0.0.1

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 (140) hide show
  1. package/package.json +20 -0
  2. package/src/__tests__/index.test.ts +5 -0
  3. package/src/domain/constants/index.ts +2 -0
  4. package/src/domain/index.ts +3 -0
  5. package/src/domain/model/apiKey/dtos/createApiKeyDto.ts +15 -0
  6. package/src/domain/model/apiKey/dtos/index.ts +2 -0
  7. package/src/domain/model/apiKey/dtos/updateApiKeyDto.ts +11 -0
  8. package/src/domain/model/apiKey/entities/ApiKey.ts +11 -0
  9. package/src/domain/model/apiKey/entities/index.ts +1 -0
  10. package/src/domain/model/apiKey/index.ts +2 -0
  11. package/src/domain/model/approve-transaction/dtos/approveTransactionDto.ts +62 -0
  12. package/src/domain/model/approve-transaction/dtos/index.ts +1 -0
  13. package/src/domain/model/approve-transaction/index.ts +1 -0
  14. package/src/domain/model/attachment/dtos/createAttachmentDto.ts +22 -0
  15. package/src/domain/model/attachment/dtos/index.ts +1 -0
  16. package/src/domain/model/attachment/entities/Attachment.ts +6 -0
  17. package/src/domain/model/attachment/entities/AttachmentType.enum.ts +3 -0
  18. package/src/domain/model/attachment/entities/BaseAttachment.ts +11 -0
  19. package/src/domain/model/attachment/entities/ShallowEnrichedAttachment.ts +6 -0
  20. package/src/domain/model/attachment/entities/index.ts +4 -0
  21. package/src/domain/model/attachment/index.ts +2 -0
  22. package/src/domain/model/auth/dtos/index.ts +1 -0
  23. package/src/domain/model/auth/dtos/signOnDto.ts +14 -0
  24. package/src/domain/model/auth/entities/AuthResponse.ts +9 -0
  25. package/src/domain/model/auth/entities/AuthUser.ts +13 -0
  26. package/src/domain/model/auth/entities/index.ts +2 -0
  27. package/src/domain/model/auth/index.ts +2 -0
  28. package/src/domain/model/blockchain/constants/Cluster.ts +5 -0
  29. package/src/domain/model/blockchain/constants/index.ts +1 -0
  30. package/src/domain/model/blockchain/dtos/blockchainDto.ts +11 -0
  31. package/src/domain/model/blockchain/dtos/index.ts +1 -0
  32. package/src/domain/model/blockchain/entities/Blockchain.ts +9 -0
  33. package/src/domain/model/blockchain/entities/index.ts +1 -0
  34. package/src/domain/model/blockchain/index.ts +3 -0
  35. package/src/domain/model/company/dtos/createCompanyDto.ts +29 -0
  36. package/src/domain/model/company/dtos/index.ts +2 -0
  37. package/src/domain/model/company/dtos/updateCompanyDto.ts +29 -0
  38. package/src/domain/model/company/entities/Company.ts +18 -0
  39. package/src/domain/model/company/entities/index.ts +1 -0
  40. package/src/domain/model/company/index.ts +2 -0
  41. package/src/domain/model/content/dtos/contentDto.ts +11 -0
  42. package/src/domain/model/content/dtos/index.ts +1 -0
  43. package/src/domain/model/content/entities/Content.ts +7 -0
  44. package/src/domain/model/content/entities/index.ts +1 -0
  45. package/src/domain/model/content/index.ts +2 -0
  46. package/src/domain/model/currency/dtos/createCurrency.ts +33 -0
  47. package/src/domain/model/currency/dtos/index.ts +2 -0
  48. package/src/domain/model/currency/dtos/updateCurrency.ts +39 -0
  49. package/src/domain/model/currency/entities/BaseCurrency.ts +17 -0
  50. package/src/domain/model/currency/entities/Currency.ts +6 -0
  51. package/src/domain/model/currency/entities/index.ts +2 -0
  52. package/src/domain/model/currency/index.ts +2 -0
  53. package/src/domain/model/customer-details/dtos/CustomerDetailsDto.ts +32 -0
  54. package/src/domain/model/customer-details/dtos/index.ts +1 -0
  55. package/src/domain/model/customer-details/entities/CustomerDetails.ts +17 -0
  56. package/src/domain/model/customer-details/entities/index.ts +1 -0
  57. package/src/domain/model/customer-details/index.ts +2 -0
  58. package/src/domain/model/discordDetails/dtos/createDiscordDetails.ts +21 -0
  59. package/src/domain/model/discordDetails/dtos/index.ts +2 -0
  60. package/src/domain/model/discordDetails/dtos/updateDiscordDetails.ts +19 -0
  61. package/src/domain/model/discordDetails/entities/BaseDiscordDetails.ts +11 -0
  62. package/src/domain/model/discordDetails/entities/DiscordDetails.ts +6 -0
  63. package/src/domain/model/discordDetails/entities/index.ts +2 -0
  64. package/src/domain/model/discordDetails/index.ts +2 -0
  65. package/src/domain/model/email/dtos/emailDto.ts +46 -0
  66. package/src/domain/model/email/dtos/index.ts +1 -0
  67. package/src/domain/model/email/index.ts +1 -0
  68. package/src/domain/model/entity/Entity.ts +15 -0
  69. package/src/domain/model/entity/index.ts +1 -0
  70. package/src/domain/model/index.ts +20 -0
  71. package/src/domain/model/link-features/dtos/index.ts +1 -0
  72. package/src/domain/model/link-features/dtos/linkFeaturesDto.ts +39 -0
  73. package/src/domain/model/link-features/entities/LinkFeatures.ts +7 -0
  74. package/src/domain/model/link-features/entities/index.ts +1 -0
  75. package/src/domain/model/link-features/index.ts +2 -0
  76. package/src/domain/model/paylink/dtos/createPaylinkDto.ts +81 -0
  77. package/src/domain/model/paylink/dtos/index.ts +2 -0
  78. package/src/domain/model/paylink/dtos/updatePaylinkDto.ts +80 -0
  79. package/src/domain/model/paylink/entities/BasePaylink.ts +9 -0
  80. package/src/domain/model/paylink/entities/OnlyContentPaylink.ts +6 -0
  81. package/src/domain/model/paylink/entities/Paylink.ts +9 -0
  82. package/src/domain/model/paylink/entities/ShallowEnrichedPaylink.ts +9 -0
  83. package/src/domain/model/paylink/entities/index.ts +4 -0
  84. package/src/domain/model/paylink/index.ts +2 -0
  85. package/src/domain/model/paylink-tx/dtos/createPaylinkTxDto.ts +24 -0
  86. package/src/domain/model/paylink-tx/dtos/index.ts +2 -0
  87. package/src/domain/model/paylink-tx/dtos/updatePaylinkTxDto.ts +7 -0
  88. package/src/domain/model/paylink-tx/entities/BasePaylinkTx.ts +7 -0
  89. package/src/domain/model/paylink-tx/entities/PaylinkTx.ts +9 -0
  90. package/src/domain/model/paylink-tx/entities/ShallowEnrichedPaylinkTx.ts +9 -0
  91. package/src/domain/model/paylink-tx/entities/index.ts +3 -0
  92. package/src/domain/model/paylink-tx/index.ts +2 -0
  93. package/src/domain/model/payment-request/entities/BasePaymentRequest.ts +21 -0
  94. package/src/domain/model/payment-request/entities/PaymentRequest.ts +15 -0
  95. package/src/domain/model/payment-request/entities/ShallowEnrichedPaymentRequest.ts +15 -0
  96. package/src/domain/model/payment-request/entities/index.ts +3 -0
  97. package/src/domain/model/payment-request/index.ts +1 -0
  98. package/src/domain/model/payment-request-features/entities/PaymentRequestFeatures.ts +17 -0
  99. package/src/domain/model/payment-request-features/entities/index.ts +1 -0
  100. package/src/domain/model/payment-request-features/index.ts +1 -0
  101. package/src/domain/model/role/dtos/createRoleDto.ts +20 -0
  102. package/src/domain/model/role/dtos/index.ts +2 -0
  103. package/src/domain/model/role/dtos/updateRoleDto.ts +10 -0
  104. package/src/domain/model/role/entities/BaseRole.ts +8 -0
  105. package/src/domain/model/role/entities/Role.ts +9 -0
  106. package/src/domain/model/role/entities/RoleType.ts +5 -0
  107. package/src/domain/model/role/entities/ShallowEnrichedRole.ts +9 -0
  108. package/src/domain/model/role/entities/index.ts +4 -0
  109. package/src/domain/model/role/index.ts +2 -0
  110. package/src/domain/model/slug/dtos/index.ts +1 -0
  111. package/src/domain/model/slug/dtos/slug.ts +20 -0
  112. package/src/domain/model/slug/entities/Slug.ts +15 -0
  113. package/src/domain/model/slug/entities/SlugObjectType.ts +5 -0
  114. package/src/domain/model/slug/entities/index.ts +2 -0
  115. package/src/domain/model/slug/index.ts +2 -0
  116. package/src/domain/model/transaction-meta/dtos/CreateTransactionMetaDto.ts +34 -0
  117. package/src/domain/model/transaction-meta/dtos/index.ts +1 -0
  118. package/src/domain/model/transaction-meta/entities/BaseTransactionMeta.ts +16 -0
  119. package/src/domain/model/transaction-meta/entities/ShallowEnrichedTransactionMeta.ts +6 -0
  120. package/src/domain/model/transaction-meta/entities/TransactionMeta.ts +6 -0
  121. package/src/domain/model/transaction-meta/entities/index.ts +3 -0
  122. package/src/domain/model/transaction-meta/index.ts +2 -0
  123. package/src/domain/model/user/dtos/CreateUserDto.ts +19 -0
  124. package/src/domain/model/user/dtos/UpdateUserDto.ts +24 -0
  125. package/src/domain/model/user/dtos/index.ts +2 -0
  126. package/src/domain/model/user/entities/BaseUser.ts +13 -0
  127. package/src/domain/model/user/entities/ShallowEnrichedUser.ts +9 -0
  128. package/src/domain/model/user/entities/User.ts +9 -0
  129. package/src/domain/model/user/entities/index.ts +3 -0
  130. package/src/domain/model/user/index.ts +2 -0
  131. package/src/domain/model/wallet/dtos/UpdateWalletDto.ts +8 -0
  132. package/src/domain/model/wallet/dtos/index.ts +1 -0
  133. package/src/domain/model/wallet/entities/BaseWallet.ts +7 -0
  134. package/src/domain/model/wallet/entities/Wallet.ts +6 -0
  135. package/src/domain/model/wallet/entities/index.ts +2 -0
  136. package/src/domain/model/wallet/index.ts +2 -0
  137. package/src/domain/services/EmailService.ts +6 -0
  138. package/src/domain/services/index.ts +1 -0
  139. package/src/index.ts +1 -0
  140. package/tsconfig.json +8 -0
@@ -0,0 +1,2 @@
1
+ export * from './entities';
2
+ export * from './dtos';
@@ -0,0 +1 @@
1
+ export * from './slug';
@@ -0,0 +1,20 @@
1
+ import { IsEnum, IsNotEmpty, IsString } from 'class-validator';
2
+ import { ApiProperty } from '@nestjs/swagger';
3
+ import { SlugObjectType } from '../entities';
4
+
5
+ export class SlugDto {
6
+ @ApiProperty()
7
+ @IsString()
8
+ @IsNotEmpty()
9
+ slug: string;
10
+
11
+ @ApiProperty()
12
+ @IsEnum(SlugObjectType)
13
+ @IsNotEmpty()
14
+ objectType: SlugObjectType;
15
+
16
+ @ApiProperty()
17
+ @IsString()
18
+ @IsNotEmpty()
19
+ objectId: string;
20
+ }
@@ -0,0 +1,15 @@
1
+ import { Entity } from '../../entity';
2
+
3
+ export class Slug extends Entity {
4
+ id: string;
5
+
6
+ slug: string;
7
+
8
+ objectType: string;
9
+
10
+ objectId: string;
11
+
12
+ active?: boolean;
13
+
14
+ inactiveDate?: number;
15
+ }
@@ -0,0 +1,5 @@
1
+ export enum SlugObjectType {
2
+ PAYLINK = 'PAYLINK',
3
+ PAYSTREAM = 'PAYSTREAM',
4
+ USER = 'USER',
5
+ }
@@ -0,0 +1,2 @@
1
+ export * from './Slug';
2
+ export * from './SlugObjectType';
@@ -0,0 +1,2 @@
1
+ export * from './dtos';
2
+ export * from './entities';
@@ -0,0 +1,34 @@
1
+ import { Type } from 'class-transformer';
2
+ import {
3
+ IsNotEmpty,
4
+ IsNotEmptyObject,
5
+ IsString,
6
+ ValidateNested,
7
+ } from 'class-validator';
8
+ import { CustomerDetailsDto } from '../../customer-details';
9
+
10
+ export class CreateTransactionMetaDto {
11
+ @IsString()
12
+ @IsNotEmpty()
13
+ transactionSignature: string;
14
+
15
+ @IsNotEmpty()
16
+ amount: bigint;
17
+
18
+ @IsString()
19
+ @IsNotEmpty()
20
+ currency: string;
21
+
22
+ @IsString()
23
+ @IsNotEmpty()
24
+ recipientPK: string;
25
+
26
+ @IsString()
27
+ @IsNotEmpty()
28
+ senderPK: string;
29
+
30
+ @IsNotEmptyObject()
31
+ @Type(() => CustomerDetailsDto)
32
+ @ValidateNested()
33
+ customerDetails: CustomerDetailsDto;
34
+ }
@@ -0,0 +1 @@
1
+ export * from './CreateTransactionMetaDto';
@@ -0,0 +1,16 @@
1
+ import { CustomerDetails } from '../../customer-details';
2
+ import { Entity } from '../../entity';
3
+
4
+ export class BaseTransactionMeta extends Entity {
5
+ id: string;
6
+
7
+ transactionSignature: string;
8
+
9
+ amount: bigint;
10
+
11
+ recipientPK: string;
12
+
13
+ senderPK: string;
14
+
15
+ customerDetails: CustomerDetails;
16
+ }
@@ -0,0 +1,6 @@
1
+ import { BaseTransactionMeta } from './BaseTransactionMeta';
2
+ import type { BaseCurrency } from '../../currency';
3
+
4
+ export class ShallowEnrichedTransactionMeta extends BaseTransactionMeta {
5
+ currency: BaseCurrency;
6
+ }
@@ -0,0 +1,6 @@
1
+ import type { Currency } from '../../currency';
2
+ import { BaseTransactionMeta } from './BaseTransactionMeta';
3
+
4
+ export class TransactionMeta extends BaseTransactionMeta {
5
+ currency: Currency;
6
+ }
@@ -0,0 +1,3 @@
1
+ export * from './TransactionMeta';
2
+ export * from './BaseTransactionMeta';
3
+ export * from './ShallowEnrichedTransactionMeta';
@@ -0,0 +1,2 @@
1
+ export * from './entities';
2
+ export * from './dtos';
@@ -0,0 +1,19 @@
1
+ import { IsEmail, IsOptional, IsString } from 'class-validator';
2
+
3
+ export class CreateUserDto {
4
+ @IsEmail()
5
+ @IsOptional()
6
+ email?: string;
7
+
8
+ @IsString()
9
+ @IsOptional()
10
+ name?: string;
11
+
12
+ @IsString()
13
+ @IsOptional()
14
+ discordUsername?: string;
15
+
16
+ @IsString()
17
+ @IsOptional()
18
+ twitterUsername?: string;
19
+ }
@@ -0,0 +1,24 @@
1
+ import { IsEmail, IsOptional, IsString } from 'class-validator';
2
+ import { ApiProperty } from '@nestjs/swagger';
3
+
4
+ export class UpdateUserDto {
5
+ @ApiProperty()
6
+ @IsEmail()
7
+ @IsOptional()
8
+ email?: string;
9
+
10
+ @ApiProperty()
11
+ @IsString()
12
+ @IsOptional()
13
+ name?: string;
14
+
15
+ @ApiProperty()
16
+ @IsString()
17
+ @IsOptional()
18
+ discordUsername?: string;
19
+
20
+ @ApiProperty()
21
+ @IsString()
22
+ @IsOptional()
23
+ twitterUsername?: string;
24
+ }
@@ -0,0 +1,2 @@
1
+ export * from './UpdateUserDto';
2
+ export * from './CreateUserDto';
@@ -0,0 +1,13 @@
1
+ import { Entity } from '../../entity';
2
+
3
+ export class BaseUser extends Entity {
4
+ id: string;
5
+
6
+ name?: string;
7
+
8
+ email?: string;
9
+
10
+ discordUsername?: string;
11
+
12
+ twitterUsername?: string;
13
+ }
@@ -0,0 +1,9 @@
1
+ import { BaseUser } from './BaseUser';
2
+ import type { BaseRole } from '../../role';
3
+ import type { BaseWallet } from '../../wallet';
4
+
5
+ export class ShallowEnrichedUser extends BaseUser {
6
+ roles: BaseRole[];
7
+
8
+ wallets: BaseWallet[];
9
+ }
@@ -0,0 +1,9 @@
1
+ import type { Role } from '../../role';
2
+ import type { Wallet } from '../../wallet';
3
+ import { BaseUser } from './BaseUser';
4
+
5
+ export class User extends BaseUser {
6
+ roles: Role[];
7
+
8
+ wallets: Wallet[];
9
+ }
@@ -0,0 +1,3 @@
1
+ export * from './User';
2
+ export * from './BaseUser';
3
+ export * from './ShallowEnrichedUser';
@@ -0,0 +1,2 @@
1
+ export * from './dtos';
2
+ export * from './entities';
@@ -0,0 +1,8 @@
1
+ import { IsString } from 'class-validator';
2
+ import { ApiProperty } from '@nestjs/swagger';
3
+
4
+ export class UpdateWalletDto {
5
+ @ApiProperty()
6
+ @IsString()
7
+ name: string;
8
+ }
@@ -0,0 +1 @@
1
+ export * from './UpdateWalletDto';
@@ -0,0 +1,7 @@
1
+ import { Entity } from '../../entity';
2
+
3
+ export class BaseWallet extends Entity {
4
+ id: string;
5
+
6
+ publicKey: string;
7
+ }
@@ -0,0 +1,6 @@
1
+ import type { Blockchain } from '../../blockchain';
2
+ import { BaseWallet } from './BaseWallet';
3
+
4
+ export class Wallet extends BaseWallet {
5
+ blockchain: Blockchain;
6
+ }
@@ -0,0 +1,2 @@
1
+ export * from './Wallet';
2
+ export * from './BaseWallet';
@@ -0,0 +1,2 @@
1
+ export * from './dtos';
2
+ export * from './entities';
@@ -0,0 +1,6 @@
1
+ export class CurrencyService {
2
+ static fromMinimalUnits(decimals: number, amount: number): number {
3
+ const decimalsValue = Number.isNaN(decimals) ? 0 : decimals;
4
+ return Math.round(amount / 10 ** decimalsValue);
5
+ }
6
+ }
@@ -0,0 +1 @@
1
+ export * from './EmailService';
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './domain';
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "baseUrl": "./",
5
+ "rootDir": "src",
6
+ "outDir": "dist"
7
+ }
8
+ }