@silexpert/core 2.0.119-tsdown.0 → 2.0.120

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 (97) hide show
  1. package/dist/{index-CfisHC_H.d.mts → index-BvApezAZ.d.mts} +37 -4
  2. package/dist/index-BvApezAZ.d.mts.map +1 -0
  3. package/dist/index.d.mts +2 -2
  4. package/dist/index.mjs +80 -13
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/product-BCFrBxXc.mjs +2 -0
  7. package/dist/product-BCFrBxXc.mjs.map +1 -0
  8. package/dist/server/index.d.mts +1 -1
  9. package/dist/server/index.d.mts.map +1 -1
  10. package/dist/server/index.mjs +3 -3
  11. package/dist/server/index.mjs.map +1 -1
  12. package/package.json +1 -1
  13. package/ts/api/resources/Authenticate.ts +6 -0
  14. package/ts/api/resources/Follow.ts +9 -0
  15. package/ts/types/Enum/AIPrompt.ts +74 -7
  16. package/ts/types/Enum/EInvoicingReasonType.ts +3 -2
  17. package/ts/types/Enum/Kyc.ts +2 -0
  18. package/ts/types/Enum/PrestationType.ts +1 -1
  19. package/ts/types/Form/FormConnector.ts +2 -0
  20. package/ts/types/Interface/api/SocietyApproval.ts +2 -0
  21. package/ts/types/Interface/api/acceptance/CreateAcceptance.ts +2 -0
  22. package/ts/types/Interface/api/accountingTransaction/QueryTransaction.ts +2 -0
  23. package/ts/types/Interface/api/acd/ExportRefreshFailures.ts +15 -0
  24. package/ts/types/Interface/api/adjustment/Create.ts +2 -0
  25. package/ts/types/Interface/api/appointment/Appointment.ts +2 -0
  26. package/ts/types/Interface/api/authentification/ExchangeExternalAuthenticationLink.ts +9 -5
  27. package/ts/types/Interface/api/balanceSheet/UpdateBalanceSheet.ts +2 -0
  28. package/ts/types/Interface/api/bankAccount/Create.ts +2 -0
  29. package/ts/types/Interface/api/bankAccount/Query.ts +3 -0
  30. package/ts/types/Interface/api/calendarEvent/createCalendarEventForUsers.ts +2 -0
  31. package/ts/types/Interface/api/card/UpdateCard.ts +4 -0
  32. package/ts/types/Interface/api/cashAndExpense/Create.ts +3 -0
  33. package/ts/types/Interface/api/checklist/Query.ts +2 -0
  34. package/ts/types/Interface/api/checklist/Update.ts +3 -0
  35. package/ts/types/Interface/api/collaboraterDetail/CreateCollaboraterDetail.ts +4 -0
  36. package/ts/types/Interface/api/commercialManagement/Create.ts +5 -0
  37. package/ts/types/Interface/api/commercialManagement/Query.ts +4 -0
  38. package/ts/types/Interface/api/companyCreationForm/CreateCompanyCreationForm.ts +14 -0
  39. package/ts/types/Interface/api/connector/CreateConnector.ts +2 -0
  40. package/ts/types/Interface/api/connector/QueryConnector.ts +2 -0
  41. package/ts/types/Interface/api/customerProviderOperation/CreateCustomerProviderOperation.ts +2 -0
  42. package/ts/types/Interface/api/dashboard/QueryTopProviders.ts +2 -0
  43. package/ts/types/Interface/api/docoon/Create.ts +5 -1
  44. package/ts/types/Interface/api/documentRequest/Create.ts +2 -0
  45. package/ts/types/Interface/api/documentRequest/Query.ts +3 -0
  46. package/ts/types/Interface/api/documentRequest/Update.ts +2 -0
  47. package/ts/types/Interface/api/exercice/Create.ts +2 -0
  48. package/ts/types/Interface/api/exercice/UpdateExercice.ts +2 -0
  49. package/ts/types/Interface/api/generalLedger/QueryGeneralLedgerAuxiliary.ts +2 -0
  50. package/ts/types/Interface/api/humanResourceLibrary/CreateHumanResourceLibrary.ts +2 -0
  51. package/ts/types/Interface/api/humanResourceLibrary/QueryPaginatedHumanResourceLibrary.ts +2 -0
  52. package/ts/types/Interface/api/immobilization/CreateImmobilization.ts +2 -0
  53. package/ts/types/Interface/api/informationRequest/Create.ts +2 -0
  54. package/ts/types/Interface/api/informationRequest/Update.ts +3 -0
  55. package/ts/types/Interface/api/library/QueryLibrary.ts +4 -0
  56. package/ts/types/Interface/api/notification/CreateNotification.ts +2 -0
  57. package/ts/types/Interface/api/notificationSetting/CreateNotificationSetting.ts +2 -0
  58. package/ts/types/Interface/api/notificationSetting/UpdateNotificationSetting.ts +2 -0
  59. package/ts/types/Interface/api/partner/CreatePartner.ts +2 -0
  60. package/ts/types/Interface/api/partner/UpdatePartner.ts +2 -0
  61. package/ts/types/Interface/api/paymentExpectation/CreatePaymentExpecation.ts +2 -0
  62. package/ts/types/Interface/api/previsionalForm/CreatePrevisionalForm.ts +4 -0
  63. package/ts/types/Interface/api/registration/CreateRegistration.ts +3 -0
  64. package/ts/types/Interface/api/registration/DeclareRegistration.ts +2 -0
  65. package/ts/types/Interface/api/registration/QueryRegistration.ts +2 -0
  66. package/ts/types/Interface/api/regulation/Create.ts +2 -0
  67. package/ts/types/Interface/api/revenue/revenueMovement.ts +3 -0
  68. package/ts/types/Interface/api/revisionGuide/CreateRevisionGuide.ts +3 -0
  69. package/ts/types/Interface/api/society/CreateTestSociety.ts +9 -0
  70. package/ts/types/Interface/api/societyConfigBalanceSheet/QueryGetAllSocietyConfigBalanceSheet.ts +2 -0
  71. package/ts/types/Interface/api/statutsGeneration/CreateBusinessPartnersAndUsersParams.ts +2 -0
  72. package/ts/types/Interface/api/survey/QuerySurveys.ts +2 -0
  73. package/ts/types/Interface/api/tax/CreateTax.ts +4 -0
  74. package/ts/types/Interface/api/taxDeadline/QueryTaxDeadline.ts +3 -0
  75. package/ts/types/Interface/api/textMessage/Create.ts +2 -0
  76. package/ts/types/Interface/api/thirdParty/CreateThirdPartyForm.ts +3 -0
  77. package/ts/types/Interface/api/thirdParty/UpdateThirdPartyForm.ts +2 -0
  78. package/ts/types/Interface/api/timeTracking/Create.ts +2 -0
  79. package/ts/types/Interface/api/user/Query.ts +2 -0
  80. package/ts/types/Interface/api/user/RegisterProspect.ts +7 -0
  81. package/ts/types/Interface/api/user/UpdateCoworker.ts +2 -0
  82. package/ts/types/Interface/api/usersHistory/Create.ts +2 -0
  83. package/ts/types/Interface/api/usersHistory/Update.ts +2 -0
  84. package/ts/types/Interface/api/vatDeclaration/QueryVatDeclaration.ts +3 -0
  85. package/ts/types/Interface/api/visualizedInformation/Query.ts +2 -0
  86. package/ts/types/Interface/api/visualizedInformation/Update.ts +2 -0
  87. package/ts/types/Interface/models/ISociety.ts +4 -0
  88. package/ts/types/index.ts +1 -0
  89. package/ts/utils/amount.ts +82 -55
  90. package/ts/utils/commercialManagement/document.ts +1 -0
  91. package/ts/utils/index.ts +1 -0
  92. package/ts/utils/societyApproval.ts +2 -2
  93. package/ts/utils/tests/document.spec.ts +41 -0
  94. package/ts/utils/transforms/numericEnum.transform.ts +9 -0
  95. package/dist/index-CfisHC_H.d.mts.map +0 -1
  96. package/dist/product-CG6avfN0.mjs +0 -2
  97. package/dist/product-CG6avfN0.mjs.map +0 -1
@@ -11,6 +11,7 @@ import { SubscriptionType } from '../../../Enum/SubscriptionType.js';
11
11
  import { IPermission } from '../../models/IPermission.js';
12
12
  import { ISociety } from '../../models/ISociety.js';
13
13
  import { IUser } from '../../models/IUser.js';
14
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
14
15
 
15
16
  export class CreateTestSocietyPrestation {
16
17
  @ApiPropertyOptional()
@@ -46,15 +47,19 @@ export class CreateTestSociety {
46
47
  isTrialPeriod?: boolean;
47
48
 
48
49
  @ApiPropertyOptional({ enum: ComptaType })
50
+ @ToNumericEnum()
49
51
  idComptaType?: ComptaType;
50
52
 
51
53
  @ApiPropertyOptional({ enum: VatRegime })
54
+ @ToNumericEnum()
52
55
  idVatRegime?: VatRegime;
53
56
 
54
57
  @ApiPropertyOptional({ enum: LegalFormTypeEnum })
58
+ @ToNumericEnum()
55
59
  idLegalForm?: LegalFormTypeEnum;
56
60
 
57
61
  @ApiPropertyOptional({ enum: SubscriptionType })
62
+ @ToNumericEnum()
58
63
  idSubscriptionType?: SubscriptionType;
59
64
 
60
65
  @ApiPropertyOptional({
@@ -64,15 +69,19 @@ export class CreateTestSociety {
64
69
  idGlobalRegime?: number;
65
70
 
66
71
  @ApiPropertyOptional({ enum: Activity })
72
+ @ToNumericEnum()
67
73
  idActivity?: Activity;
68
74
 
69
75
  @ApiPropertyOptional({ enum: TaxSystem })
76
+ @ToNumericEnum()
70
77
  idTaxSystem?: TaxSystem;
71
78
 
72
79
  @ApiPropertyOptional({ enum: ProfitsType })
80
+ @ToNumericEnum()
73
81
  profitsType?: ProfitsType;
74
82
 
75
83
  @ApiPropertyOptional({ enum: FiscalRegime })
84
+ @ToNumericEnum()
76
85
  idFiscalRegime?: FiscalRegime;
77
86
 
78
87
  @ApiPropertyOptional({ type: [CreateTestSocietyExercice] })
@@ -1,6 +1,7 @@
1
1
  import { IsOptional, IsString, IsIn, IsInt, IsEnum } from 'class-validator';
2
2
  import { ApiPropertyOptional } from '@nestjs/swagger';
3
3
  import { DocumentConfigurationType } from '../../../Enum/DepositDocumentType.js';
4
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
4
5
 
5
6
  export class QueryGetAllSocietyConfigBalanceSheet {
6
7
  @ApiPropertyOptional()
@@ -24,6 +25,7 @@ export class QueryGetAllSocietyConfigBalanceSheet {
24
25
  include?: string[];
25
26
 
26
27
  @ApiPropertyOptional()
28
+ @ToNumericEnum()
27
29
  @IsEnum(DocumentConfigurationType)
28
30
  @IsOptional()
29
31
  configurationType?: DocumentConfigurationType;
@@ -2,6 +2,7 @@ import { IsBoolean, IsDate, IsEnum, IsInt, IsOptional, IsString } from 'class-va
2
2
  import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
3
3
  import { CountryId } from '../../../Enum/Country.js';
4
4
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform.js';
5
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
5
6
  import { ContributionType } from '../../../Enum/Contribution.js';
6
7
 
7
8
  export class CreateBusinessPartnersAndUsersParamsSociety {
@@ -63,6 +64,7 @@ export class CreateBusinessPartnersAndUsersParamsUser {
63
64
  cityOfBirth?: string;
64
65
 
65
66
  @ApiPropertyOptional()
67
+ @ToNumericEnum()
66
68
  @IsOptional()
67
69
  @IsEnum(CountryId)
68
70
  idCountryBirth?: CountryId;
@@ -1,8 +1,10 @@
1
1
  import { ApiPropertyOptional } from '@nestjs/swagger';
2
2
  import { SurveyType } from '../../../Enum/SurveyType.js';
3
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
3
4
 
4
5
  export class QuerySurveys {
5
6
  @ApiPropertyOptional()
7
+ @ToNumericEnum()
6
8
  idSurveyType?: SurveyType;
7
9
 
8
10
  @ApiPropertyOptional()
@@ -2,6 +2,7 @@ import { IsBoolean, IsNumber, IsOptional } from 'class-validator';
2
2
  import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
3
3
  import { TaxType, TaxState, TaxCredit } from '../../../Enum/Tax.js';
4
4
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform.js';
5
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
5
6
 
6
7
  export class CreateTax {
7
8
  @ApiProperty({ description: "Montant de l'impôt" })
@@ -11,9 +12,11 @@ export class CreateTax {
11
12
  dateIs: string;
12
13
 
13
14
  @ApiProperty({ description: "Type d'impôt", enum: TaxType })
15
+ @ToNumericEnum()
14
16
  type: TaxType;
15
17
 
16
18
  @ApiProperty({ description: 'État', enum: TaxState })
19
+ @ToNumericEnum()
17
20
  state: TaxState;
18
21
 
19
22
  @ApiProperty({ description: "Défini l'acompte comme un solde" })
@@ -25,6 +28,7 @@ export class CreateTax {
25
28
  balance: number | null;
26
29
 
27
30
  @ApiProperty({ description: "État du crédit d'impôt", enum: TaxCredit })
31
+ @ToNumericEnum()
28
32
  creditRefunded: TaxCredit;
29
33
 
30
34
  @ApiPropertyOptional({ description: "Défini l'acompte en tant qu'orphelin" })
@@ -6,6 +6,7 @@ import { TaxSystem } from '../../../Enum/TaxSystem.js';
6
6
  import { Supervision } from '../../../Enum/Supervision.js';
7
7
  import { BalanceSheetState } from '../../../Enum/BalanceSheet.js';
8
8
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform.js';
9
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
9
10
 
10
11
  export class QueryTaxDeadline {
11
12
  @ApiProperty({ description: 'Identifiant du collaborateur' })
@@ -56,6 +57,7 @@ export class QueryTaxDeadline {
56
57
  maximalEndDate?: string;
57
58
 
58
59
  @ApiPropertyOptional({ description: 'État de la supervision', enum: Supervision })
60
+ @ToNumericEnum()
59
61
  idSupervisionState?: Supervision;
60
62
 
61
63
  @ApiPropertyOptional({ description: 'État de l encaissement', enum: BankCollectingState })
@@ -146,6 +148,7 @@ export class QueryCompanyTaxesByCollaborater {
146
148
  search?: string;
147
149
 
148
150
  @ApiPropertyOptional()
151
+ @ToNumericEnum()
149
152
  @IsNumber()
150
153
  @IsOptional()
151
154
  idState?: TaxState;
@@ -1,6 +1,7 @@
1
1
  import { IsEnum, IsNumber, IsString } from 'class-validator';
2
2
  import { ApiProperty } from '@nestjs/swagger';
3
3
  import { TextMessageType } from '../../../Enum/TextMessageType.js';
4
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
4
5
 
5
6
  export class SendTextMessage {
6
7
  @ApiProperty()
@@ -20,6 +21,7 @@ export class SendTextMessage {
20
21
  idSociety: number;
21
22
 
22
23
  @ApiProperty()
24
+ @ToNumericEnum()
23
25
  @IsEnum(TextMessageType)
24
26
  idTextMessageType: TextMessageType;
25
27
  }
@@ -1,6 +1,7 @@
1
1
  import { IsEnum, IsOptional } from 'class-validator';
2
2
  import { type TFile, TermOfPayment, ThirdPartyType } from '../../../index.js';
3
3
  import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
4
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
4
5
 
5
6
  export class CreateThirdPartyForm {
6
7
  @ApiPropertyOptional()
@@ -73,6 +74,7 @@ export class CreateThirdPartyForm {
73
74
  idCountry?: number | null;
74
75
 
75
76
  @ApiProperty()
77
+ @ToNumericEnum()
76
78
  @IsEnum(ThirdPartyType)
77
79
  idThirdPartyType: ThirdPartyType;
78
80
 
@@ -103,6 +105,7 @@ export class CreateThirdPartyForm {
103
105
 
104
106
  export class ImportThirdParty {
105
107
  @ApiProperty()
108
+ @ToNumericEnum()
106
109
  idThirdPartyType: ThirdPartyType;
107
110
 
108
111
  @ApiProperty()
@@ -1,6 +1,7 @@
1
1
  import { IsEnum, IsOptional } from 'class-validator';
2
2
  import { TermOfPayment, ThirdPartyType } from '../../../index.js';
3
3
  import { ApiPropertyOptional } from '@nestjs/swagger';
4
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
4
5
 
5
6
  export class UpdateThirdPartyForm {
6
7
  @ApiPropertyOptional()
@@ -95,6 +96,7 @@ export class UpdateThirdPartyForm {
95
96
  idCountry?: number | null;
96
97
 
97
98
  @ApiPropertyOptional()
99
+ @ToNumericEnum()
98
100
  @IsOptional()
99
101
  @IsEnum(ThirdPartyType)
100
102
  idThirdPartyType?: ThirdPartyType;
@@ -1,6 +1,7 @@
1
1
  import { IsBoolean, IsNumber } from 'class-validator';
2
2
  import { ApiProperty } from '@nestjs/swagger';
3
3
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform.js';
4
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
4
5
  import { TimeTrackingSource } from '../../../Enum/TimeTrackingSource.js';
5
6
 
6
7
  export class CreateOrUpdateTimeTracking {
@@ -18,6 +19,7 @@ export class CreateOrUpdateTimeTracking {
18
19
  idUser: number;
19
20
 
20
21
  @ApiProperty()
22
+ @ToNumericEnum()
21
23
  @IsNumber()
22
24
  idTimeTrackingSource: TimeTrackingSource;
23
25
  }
@@ -1,6 +1,7 @@
1
1
  import { IsArray, IsBoolean, IsIn, IsInt, IsNumber, IsOptional, IsString } from 'class-validator';
2
2
  import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
3
3
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform.js';
4
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
4
5
  import { SubscriptionType } from '../../../Enum/SubscriptionType.js';
5
6
  import { type WhereOptions } from 'sequelize';
6
7
  import { ISociety } from '../../models/ISociety.js';
@@ -114,6 +115,7 @@ export class QueryResendConfirmationLink {
114
115
 
115
116
  export class GetSocietyFromUser {
116
117
  @ApiPropertyOptional()
118
+ @ToNumericEnum()
117
119
  @IsOptional()
118
120
  @IsNumber()
119
121
  idSubscriptionType?: SubscriptionType;
@@ -18,11 +18,14 @@ import { LegalFormTypeEnum } from '../../../Enum/LegalForm.js';
18
18
  import { UpdateOrCreateVisualizedInformation } from '../visualizedInformation/Update.js';
19
19
  import { IPermission } from '../../models/IPermission.js';
20
20
  import { CountryId, FiscalRegime, ProfitsType, SubscriptionType, TaxSystem } from '../../../../index.js';
21
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
21
22
 
22
23
  /**
23
24
  * Response of the register prospect endpoint
24
25
  */
25
26
  export interface RegisterProspectResponse {
27
+ /** @deprecated Temporary, until internal apps are migrated to authSecret */
28
+ externalId?: string;
26
29
  authSecret?: string;
27
30
  token?: string;
28
31
  idUser?: number;
@@ -86,6 +89,7 @@ export interface RegisterProspect {
86
89
 
87
90
  class ProspectInfoBody implements ProspectInfo {
88
91
  @ApiPropertyOptional()
92
+ @ToNumericEnum()
89
93
  @IsOptional()
90
94
  @IsEnum(Civility)
91
95
  idCivility?: Civility;
@@ -137,11 +141,13 @@ class ProspectSocietyInfoBody implements ProspectSocietyInfo {
137
141
  name?: string;
138
142
 
139
143
  @ApiPropertyOptional()
144
+ @ToNumericEnum()
140
145
  @IsOptional()
141
146
  @IsEnum(Activity)
142
147
  idActivity?: Activity;
143
148
 
144
149
  @ApiPropertyOptional()
150
+ @ToNumericEnum()
145
151
  @IsOptional()
146
152
  @IsEnum(LegalFormTypeEnum)
147
153
  idLegalForm?: LegalFormTypeEnum;
@@ -285,6 +291,7 @@ export class RegisterProspectBody implements RegisterProspect {
285
291
  ebookTag?: string;
286
292
 
287
293
  @ApiPropertyOptional()
294
+ @ToNumericEnum()
288
295
  @IsOptional()
289
296
  @IsEnum(UrgencyLevel)
290
297
  urgencyLevel?: UrgencyLevel;
@@ -2,6 +2,7 @@ import { IsOptional, IsString, IsPhoneNumber, IsNumber, IsBoolean, IsDate, IsArr
2
2
  import { EntityType, IUser, type TFile } from '../../../index.js';
3
3
  import { ApiPropertyOptional } from '@nestjs/swagger';
4
4
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform.js';
5
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
5
6
 
6
7
  export class UpdateCorworker implements IUser {
7
8
  @ApiPropertyOptional()
@@ -89,6 +90,7 @@ export class UpdateCorworker implements IUser {
89
90
  idOffice?: number;
90
91
 
91
92
  @ApiPropertyOptional()
93
+ @ToNumericEnum()
92
94
  @IsOptional()
93
95
  @IsEnum(EntityType)
94
96
  entity?: EntityType;
@@ -2,6 +2,7 @@ import { IsEnum, IsInt, IsOptional, IsString } from 'class-validator';
2
2
  import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
3
3
  import { TypeUserHistory } from '../../../Enum/UsersHistory.js';
4
4
  import { IUsersHistory, type IMetadata } from '../../models/IUsersHistory.js';
5
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
5
6
 
6
7
  export class CreateUsersHistory implements Omit<IUsersHistory, 'id' | 'createdAt' | 'updatedAt' | 'idAuthor'> {
7
8
  @ApiProperty()
@@ -14,6 +15,7 @@ export class CreateUsersHistory implements Omit<IUsersHistory, 'id' | 'createdAt
14
15
  comment?: string;
15
16
 
16
17
  @ApiProperty()
18
+ @ToNumericEnum()
17
19
  @IsEnum(TypeUserHistory)
18
20
  actionType: TypeUserHistory;
19
21
 
@@ -2,6 +2,7 @@ import { IsEnum, IsOptional, IsString } from 'class-validator';
2
2
  import { ApiPropertyOptional } from '@nestjs/swagger';
3
3
  import { TypeUserHistory } from '../../../Enum/UsersHistory.js';
4
4
  import { IUsersHistory, type IMetadata } from '../../models/IUsersHistory.js';
5
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
5
6
 
6
7
  export class UpdateUsersHistory implements Partial<Omit<IUsersHistory, 'id' | 'idUser' | 'idAuthor'>> {
7
8
  @ApiPropertyOptional()
@@ -10,6 +11,7 @@ export class UpdateUsersHistory implements Partial<Omit<IUsersHistory, 'id' | 'i
10
11
  comment?: string;
11
12
 
12
13
  @ApiPropertyOptional()
14
+ @ToNumericEnum()
13
15
  @IsOptional()
14
16
  @IsEnum(TypeUserHistory)
15
17
  actionType?: TypeUserHistory;
@@ -1,6 +1,7 @@
1
1
  import { IsDate, IsDateString, IsEnum, IsNumber, IsOptional, IsString } from 'class-validator';
2
2
  import { CerfaType } from '../../../Enum/CerfaType.js';
3
3
  import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
4
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
4
5
 
5
6
  export class QueryPreviousVatDeclaration {
6
7
  @ApiProperty()
@@ -35,6 +36,7 @@ export class QueryVatDeclaration {
35
36
  declarationDate?: Date;
36
37
 
37
38
  @ApiProperty()
39
+ @ToNumericEnum()
38
40
  @IsEnum(CerfaType)
39
41
  idCerfaType: CerfaType;
40
42
  }
@@ -55,6 +57,7 @@ export class QueryVatEntry {
55
57
 
56
58
  // TODO: Passer le paramètre en requis une fois le front mis à jour
57
59
  @ApiPropertyOptional()
60
+ @ToNumericEnum()
58
61
  // @IsIn(Object.values(CerfaType))
59
62
  @IsOptional()
60
63
  idCerfaType?: CerfaType;
@@ -1,6 +1,7 @@
1
1
  import { IsNumber, IsOptional, IsString } from 'class-validator';
2
2
  import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
3
3
  import { VisualizedInformationState } from '../../../Enum/VisualizedInformation.js';
4
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
4
5
 
5
6
  export class QuerySocietyVisualizedInformation {
6
7
  @ApiProperty()
@@ -8,6 +9,7 @@ export class QuerySocietyVisualizedInformation {
8
9
  key: string;
9
10
 
10
11
  @ApiPropertyOptional()
12
+ @ToNumericEnum()
11
13
  @IsNumber()
12
14
  @IsOptional()
13
15
  state: VisualizedInformationState;
@@ -1,6 +1,7 @@
1
1
  import { IsNumber, IsString } from 'class-validator';
2
2
  import { ApiProperty } from '@nestjs/swagger';
3
3
  import { VisualizedInformationState } from '../../../Enum/VisualizedInformation.js';
4
+ import { ToNumericEnum } from '../../../../utils/transforms/numericEnum.transform.js';
4
5
 
5
6
  export class UpdateOrCreateVisualizedInformation {
6
7
  @ApiProperty()
@@ -8,6 +9,7 @@ export class UpdateOrCreateVisualizedInformation {
8
9
  key: string;
9
10
 
10
11
  @ApiProperty()
12
+ @ToNumericEnum()
11
13
  @IsNumber()
12
14
  state: VisualizedInformationState;
13
15
  }
@@ -62,6 +62,8 @@ import {
62
62
  IGeneralConditionOfSale,
63
63
  IConstitutionHistory,
64
64
  IEInvoicingKycAndMandate,
65
+ IAppNotification,
66
+ IEstimateInvoice,
65
67
  } from '../../index.js';
66
68
  import { IBrandType } from './IBrandType.js';
67
69
  import { IFile } from './IFile.js';
@@ -211,4 +213,6 @@ export class ISociety {
211
213
  calendarEvents?: ICalendarEvent[];
212
214
  constitutionHistories?: IConstitutionHistory[];
213
215
  kycMandate?: IEInvoicingKycAndMandate[];
216
+ appNotifications?: IAppNotification[];
217
+ estimatesInvoices?: IEstimateInvoice[];
214
218
  }
package/ts/types/index.ts CHANGED
@@ -548,6 +548,7 @@ export * from './Interface/api/accountingTransaction/Create.js';
548
548
  export * from './Interface/api/acd/Vat.js';
549
549
  export * from './Interface/api/acd/Create.js';
550
550
  export * from './Interface/api/acd/DeduplicateAccounts.js';
551
+ export * from './Interface/api/acd/ExportRefreshFailures.js';
551
552
  export * from './Interface/api/acd/Status.js';
552
553
  export * from './Interface/api/authentification/AuthenticationResponse.js';
553
554
  export * from './Interface/api/exercice/ReadExercice.js';
@@ -49,17 +49,14 @@ export function integerToFormattedAmountObject(
49
49
  centValue: `${cents < 10 ? '0' : ''}${cents}`,
50
50
  };
51
51
 
52
+ const signPrefix = result.sign !== MathematicalSign.EQUAL ? `${result.sign} ` : '';
53
+
52
54
  return {
53
55
  ...result,
54
- formattedValue: `${result.sign !== MathematicalSign.EQUAL ? `${result.sign} ` : ''}${result.integerValue},${result.centValue}`,
56
+ formattedValue: `${signPrefix}${result.integerValue},${result.centValue}`,
55
57
  };
56
58
  }
57
59
 
58
- /**
59
- * Convertit les nombres à virgule de 0 à 100 000 000 (100 millions) *
60
- * @param nombre
61
- * @returns {string}
62
- */
63
60
  const unites: string[] = [
64
61
  '',
65
62
  'un',
@@ -98,81 +95,111 @@ const dizaines: string[] = [
98
95
 
99
96
  const groupes: string[] = ['', 'mille', 'million'];
100
97
 
101
- function convertirGroupeEnLettres(groupe: number): string {
102
- let groupeEnLettres = '';
98
+ const THOUSAND_GROUP_INDEX = 1;
99
+ const MILLION_GROUP_INDEX = 2;
100
+ const GROUP_SIZE = 1000;
101
+ const CENTS_PER_UNIT = 100;
102
+ const MAX_TEEN = 19;
103
+ const TEEN_OFFSET = 10;
104
+ const SINGLE_DIGIT_CENTS_LIMIT = 10;
105
+ const EIGHTY_TENS_INDEX = 8;
106
+ const FIRST_DAY_OF_MONTH = 1;
107
+ // Seventy and ninety are built on sixty and eighty followed by a teen ("soixante-douze", "quatre-vingt-dix-neuf")
108
+ const TENS_INDEXES_COMBINED_WITH_TEENS: number[] = [7, 9];
109
+ // "et" only links a final one to the tens from twenty to seventy
110
+ // ("trente-et-un", "soixante-et-onze", but "quatre-vingt-un")
111
+ const TENS_INDEXES_LINKED_WITH_ET: number[] = [2, 3, 4, 5, 6, 7];
112
+
113
+ function convertirDizainesEtUnitesEnLettres(dizainesEtUnites: number, isPluralAllowed: boolean): string {
114
+ if (dizainesEtUnites <= MAX_TEEN) {
115
+ return unites[dizainesEtUnites];
116
+ }
117
+
118
+ const dizaine = Math.floor(dizainesEtUnites / 10);
119
+ const unite = dizainesEtUnites % 10;
120
+ const uniteTexte = unites[TENS_INDEXES_COMBINED_WITH_TEENS.includes(dizaine) ? TEEN_OFFSET + unite : unite];
121
+
122
+ if (!uniteTexte) {
123
+ return `${dizaines[dizaine]}${dizaine === EIGHTY_TENS_INDEX && isPluralAllowed ? 's' : ''}`;
124
+ }
103
125
 
126
+ const separateur = unite === 1 && TENS_INDEXES_LINKED_WITH_ET.includes(dizaine) ? '-et-' : '-';
127
+ return `${dizaines[dizaine]}${separateur}${uniteTexte}`;
128
+ }
129
+
130
+ // "vingt" and "cent" take an "s" when multiplied and ending the number, but stay invariable before "mille"
131
+ function convertirGroupeEnLettres(groupe: number, isPluralAllowed: boolean): string {
104
132
  const centaines = Math.floor(groupe / 100);
105
133
  const dizainesEtUnites = groupe % 100;
134
+ const mots: string[] = [];
135
+
136
+ if (centaines === 1) {
137
+ mots.push('cent');
138
+ }
106
139
 
107
- if (centaines > 0) {
108
- groupeEnLettres += `${unites[centaines] === 'un' ? '' : unites[centaines]} cent `;
140
+ if (centaines > 1) {
141
+ mots.push(`${unites[centaines]} cent${dizainesEtUnites === 0 && isPluralAllowed ? 's' : ''}`);
109
142
  }
110
143
 
111
144
  if (dizainesEtUnites > 0) {
112
- if (dizainesEtUnites <= 19) {
113
- groupeEnLettres += unites[dizainesEtUnites];
114
- } else {
115
- const unite = dizainesEtUnites % 10;
116
- const dizaine = Math.floor(dizainesEtUnites / 10);
117
- groupeEnLettres += dizaines[dizaine];
118
-
119
- if (unite > 0) {
120
- if (dizaine === 7 || dizaine === 9) {
121
- /* const dizaineTexte = */ dizaines[dizaine].slice(0, -1);
122
- const uniteTexte = unites[unite];
123
- groupeEnLettres += `-${uniteTexte}`;
124
- } else {
125
- const uniteTexte = unites[unite];
126
- groupeEnLettres += `-${uniteTexte}`;
127
- }
128
- }
129
- }
145
+ mots.push(convertirDizainesEtUnitesEnLettres(dizainesEtUnites, isPluralAllowed));
130
146
  }
131
147
 
132
- return groupeEnLettres.trim();
148
+ return mots.join(' ');
133
149
  }
134
- function convertirNombreEntierEnLettres(ent: number): string {
135
- let entier = ent;
136
- if (entier === 0) {
150
+
151
+ function convertirNombreEntierEnLettres(nombreEntier: number): string {
152
+ if (nombreEntier === 0) {
137
153
  return 'zéro';
138
154
  }
139
155
 
140
- let resultat = '';
141
-
156
+ const mots: string[] = [];
157
+ let entier = nombreEntier;
142
158
  let groupeIndex = 0;
159
+
143
160
  while (entier > 0) {
144
- const groupe = entier % 1000;
145
- const groupeEnLettres = convertirGroupeEnLettres(groupe);
161
+ const groupeEnLettres = convertirGroupeEnLettres(entier % GROUP_SIZE, groupeIndex !== THOUSAND_GROUP_INDEX);
146
162
 
147
163
  if (groupeEnLettres !== '') {
148
- resultat = `${groupeEnLettres === 'un' && ['mille', 'cent'].includes(groupes[groupeIndex]) ? '' : groupeEnLettres} ${groupes[groupeIndex]}${groupeIndex === 2 && groupeEnLettres !== 'un' ? 's' : ''} ${resultat}`;
164
+ // "mille" is never preceded by "un", whereas "million" is a noun that takes an "s" when plural
165
+ const isMilleAlone = groupeEnLettres === 'un' && groupeIndex === THOUSAND_GROUP_INDEX;
166
+ const pluriel = groupeIndex === MILLION_GROUP_INDEX && groupeEnLettres !== 'un' ? 's' : '';
167
+ mots.unshift([isMilleAlone ? '' : groupeEnLettres, `${groupes[groupeIndex]}${pluriel}`].join(' ').trim());
149
168
  }
150
169
 
151
- entier = Math.floor(entier / 1000);
170
+ entier = Math.floor(entier / GROUP_SIZE);
152
171
  groupeIndex += 1;
153
172
  }
154
173
 
155
- return resultat.trim();
156
- }
157
- function convertirNombreDecimalEnLettres(decimal: number): string {
158
- const decimalArrondi = Math.round(decimal * 100);
159
- return `virgule ${convertirNombreEntierEnLettres(decimalArrondi)}`;
174
+ return mots.join(' ');
160
175
  }
161
- export function convertNumberToLetter(nombre: number): string {
162
- const partieEntiere = Math.floor(nombre);
163
- const partieDecimale = nombre - partieEntiere;
164
-
165
- let resultat = '';
166
176
 
167
- if (partieEntiere === 0) {
168
- resultat = 'zéro';
169
- } else {
170
- resultat = convertirNombreEntierEnLettres(partieEntiere);
177
+ /**
178
+ * Converts a number from 0 to 100 000 000 into French words, rounded to two decimals
179
+ * (e.g. 1.07 gives "un virgule zéro sept")
180
+ */
181
+ export function convertNumberToLetter(nombre: number): string {
182
+ // Work on integer cents to avoid floating-point errors on the decimal part
183
+ const totalCentimes = Math.round(nombre * CENTS_PER_UNIT);
184
+ const partieEntiere = Math.floor(totalCentimes / CENTS_PER_UNIT);
185
+ const centimes = totalCentimes % CENTS_PER_UNIT;
186
+ const entierEnLettres = convertirNombreEntierEnLettres(partieEntiere);
187
+
188
+ if (centimes === 0) {
189
+ return entierEnLettres;
171
190
  }
172
191
 
173
- if (partieDecimale > 0) {
174
- resultat += ` ${convertirNombreDecimalEnLettres(partieDecimale)}`;
192
+ const zeroInitial = centimes < SINGLE_DIGIT_CENTS_LIMIT ? 'zéro ' : '';
193
+ return `${entierEnLettres} virgule ${zeroInitial}${convertirNombreEntierEnLettres(centimes)}`;
194
+ }
195
+
196
+ /**
197
+ * Converts a day of the month into French words, the first day being written "premier"
198
+ */
199
+ export function convertDayOfMonthToLetter(day: number): string {
200
+ if (day === FIRST_DAY_OF_MONTH) {
201
+ return 'premier';
175
202
  }
176
203
 
177
- return resultat;
204
+ return convertNumberToLetter(day);
178
205
  }
@@ -89,6 +89,7 @@ export function generateCommercialDocument(
89
89
  paymentLink: payload.paymentLink ?? '#',
90
90
  idEstimateInvoiceType,
91
91
  title: payload.title ?? null,
92
+ cgv: payload.cgv ?? null,
92
93
  // EJS `with` blocks throw a ReferenceError when a variable key is entirely absent from the data object, so seller
93
94
  // identity/address fields must always be defined even when the payload omits them.
94
95
  name: payload.name ?? null,
package/ts/utils/index.ts CHANGED
@@ -23,3 +23,4 @@ export * from './commercialManagement/saleEmail.js';
23
23
  export * from './acdVat.js';
24
24
  export * from './transforms/boolean.transform.js';
25
25
  export * from './transforms/number.transform.js';
26
+ export * from './transforms/numericEnum.transform.js';
@@ -9,7 +9,7 @@ import {
9
9
  import { ISocietyApproval } from '../types/Interface/models/ISocietyApproval.js';
10
10
  import { QualityList } from '../types/Enum/Quality.js';
11
11
  import { getBrand } from './brands.js';
12
- import { convertNumberToLetter } from './amount.js';
12
+ import { convertDayOfMonthToLetter, convertNumberToLetter } from './amount.js';
13
13
  import dayjs from 'dayjs';
14
14
  import { CityOfGreffeDetail } from '../types/Enum/CityOfGreffe.js';
15
15
  import { siretToSiren } from './siretValidation.js';
@@ -81,7 +81,7 @@ export function buildApprovalTemplateData(existingApproval: ISocietyApproval, st
81
81
  const yearInText = convertNumberToLetter(
82
82
  +dayjs(existingApproval?.generatingDatas?.approvalDate || null).format('YYYY'),
83
83
  ).toLowerCase();
84
- const dayAndMonthInText = `${convertNumberToLetter(+dayjs(existingApproval?.generatingDatas?.approvalDate || null).format('D'))} ${dayjs(
84
+ const dayAndMonthInText = `${convertDayOfMonthToLetter(+dayjs(existingApproval?.generatingDatas?.approvalDate || null).format('D'))} ${dayjs(
85
85
  existingApproval?.generatingDatas?.approvalDate || null,
86
86
  )
87
87
  .locale('fr')