@passly-nl/data 1.0.5 → 1.1.0

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 (131) hide show
  1. package/dist/index.d.mts +1116 -171
  2. package/dist/index.d.mts.map +1 -1
  3. package/dist/index.mjs +5 -5
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +15 -10
  6. package/src/adapter/AiChatAdapter.ts +37 -0
  7. package/src/adapter/AiUsageAdapter.ts +42 -0
  8. package/src/adapter/CashFlowAdapter.ts +70 -0
  9. package/src/adapter/ContentCalendarAdapter.ts +34 -0
  10. package/src/adapter/DiscountCodeAdapter.ts +33 -0
  11. package/src/adapter/EventAdapter.ts +8 -71
  12. package/src/adapter/EventStatisticsBuyersAdapter.ts +27 -0
  13. package/src/adapter/EventStatisticsOperationsAdapter.ts +41 -0
  14. package/src/adapter/EventStatisticsOverviewAdapter.ts +39 -0
  15. package/src/adapter/EventStatisticsSalesAdapter.ts +21 -0
  16. package/src/adapter/MarketingAttributionAdapter.ts +18 -0
  17. package/src/adapter/MerchantAdapter.ts +3 -1
  18. package/src/adapter/OrderAdapter.ts +6 -2
  19. package/src/adapter/ProductAdapter.ts +3 -0
  20. package/src/adapter/PublicShopAdapter.ts +1 -2
  21. package/src/adapter/RefundAdapter.ts +34 -0
  22. package/src/adapter/ReservationAdapter.ts +3 -2
  23. package/src/adapter/StatisticsEventsAdapter.ts +6 -2
  24. package/src/adapter/StatisticsGrowthAdapter.ts +38 -0
  25. package/src/adapter/StatisticsInsightsAdapter.ts +39 -0
  26. package/src/adapter/StatisticsOperationsAdapter.ts +47 -0
  27. package/src/adapter/SubscriptionAdapter.ts +32 -0
  28. package/src/adapter/TicketAdapter.ts +1 -0
  29. package/src/adapter/index.ts +16 -1
  30. package/src/dto/aiChat/AiChatConversationDto.ts +49 -0
  31. package/src/dto/aiChat/AiChatMessageDto.ts +73 -0
  32. package/src/dto/aiChat/AiChatToolCallDto.ts +58 -0
  33. package/src/dto/aiChat/index.ts +3 -0
  34. package/src/dto/aiUsage/AiUsageDto.ts +110 -0
  35. package/src/dto/aiUsage/AiUsageFeatureStatusDto.ts +39 -0
  36. package/src/dto/aiUsage/AiUsagePeriodDto.ts +80 -0
  37. package/src/dto/aiUsage/index.ts +3 -0
  38. package/src/dto/cashFlow/CashFlowDiscountDto.ts +40 -0
  39. package/src/dto/cashFlow/CashFlowDto.ts +99 -0
  40. package/src/dto/cashFlow/CashFlowPaymentDto.ts +50 -0
  41. package/src/dto/cashFlow/CashFlowPlatformCostDto.ts +29 -0
  42. package/src/dto/cashFlow/CashFlowRefundDto.ts +101 -0
  43. package/src/dto/cashFlow/CashFlowTimelineEventDto.ts +71 -0
  44. package/src/dto/cashFlow/index.ts +6 -0
  45. package/src/dto/contentCalendar/ContentCalendarItemCreatorDto.ts +69 -0
  46. package/src/dto/contentCalendar/ContentCalendarItemDto.ts +133 -0
  47. package/src/dto/contentCalendar/index.ts +2 -0
  48. package/src/dto/discountCode/DiscountCodeDto.ts +141 -0
  49. package/src/dto/discountCode/index.ts +1 -0
  50. package/src/dto/event/TimeSlotDto.ts +59 -0
  51. package/src/dto/event/index.ts +1 -9
  52. package/src/dto/eventStatistics/EventStatisticsAppTeamDto.ts +58 -0
  53. package/src/dto/{event/EventStatisticsBuyerTotalsDto.ts → eventStatistics/EventStatisticsBuyersOverviewDto.ts} +18 -18
  54. package/src/dto/{event → eventStatistics}/EventStatisticsFinancialDto.ts +11 -1
  55. package/src/dto/eventStatistics/EventStatisticsKpisDto.ts +119 -0
  56. package/src/dto/eventStatistics/EventStatisticsOperationsOverviewDto.ts +58 -0
  57. package/src/dto/eventStatistics/EventStatisticsSalesFlowChartDto.ts +66 -0
  58. package/src/dto/{event/EventStatisticsOrderTotalsDto.ts → eventStatistics/EventStatisticsStatusDto.ts} +1 -1
  59. package/src/dto/{event/EventStatisticsSwapTotalsDto.ts → eventStatistics/EventStatisticsSwapsDto.ts} +1 -1
  60. package/src/dto/eventStatistics/index.ts +9 -0
  61. package/src/dto/index.ts +10 -0
  62. package/src/dto/marketingAttribution/MarketingAttributionDto.ts +88 -0
  63. package/src/dto/marketingAttribution/index.ts +1 -0
  64. package/src/dto/merchant/MerchantDto.ts +39 -2
  65. package/src/dto/order/OrderDto.ts +42 -2
  66. package/src/dto/product/ProductDto.ts +32 -2
  67. package/src/dto/publicShop/PublicShopCartProductDto.ts +1 -11
  68. package/src/dto/publicShop/PublicShopTimeSlotDto.ts +1 -11
  69. package/src/dto/realtime/AiChatMessageCompletedMessageDto.ts +9 -0
  70. package/src/dto/realtime/ContentCalendarGenerationCompletedMessageDto.ts +8 -0
  71. package/src/dto/realtime/InsightCardCompletedMessageDto.ts +9 -0
  72. package/src/dto/realtime/index.ts +3 -0
  73. package/src/dto/refund/RefundDto.ts +91 -0
  74. package/src/dto/{event/EventStatisticsScansPerAppTeamDto.ts → refund/RefundInitiatorDto.ts} +2 -12
  75. package/src/dto/refund/RefundTicketRefDto.ts +28 -0
  76. package/src/dto/refund/index.ts +3 -0
  77. package/src/dto/reservation/ReservationDto.ts +12 -2
  78. package/src/dto/statistics/InsightDto.ts +130 -0
  79. package/src/dto/statistics/InsightSignalDto.ts +29 -0
  80. package/src/dto/statistics/InsightsResponseDto.ts +50 -0
  81. package/src/dto/statistics/MilestoneDto.ts +80 -0
  82. package/src/dto/statistics/StatisticsGrowthOverviewDto.ts +59 -0
  83. package/src/dto/statistics/StatisticsOperationsAppTeamDto.ts +78 -0
  84. package/src/dto/statistics/StatisticsOperationsOverviewDto.ts +58 -0
  85. package/src/dto/statistics/StatisticsOperationsTaskAssigneeDto.ts +48 -0
  86. package/src/dto/statistics/StatisticsOperationsTasksOverviewDto.ts +69 -0
  87. package/src/dto/statistics/index.ts +9 -0
  88. package/src/dto/subscription/MerchantSubscriptionDto.ts +91 -0
  89. package/src/dto/subscription/SubscriptionPlanDto.ts +80 -0
  90. package/src/dto/subscription/index.ts +2 -0
  91. package/src/dto/ticket/TicketDto.ts +11 -1
  92. package/src/service/AdminMerchantSubscriptionService.ts +34 -0
  93. package/src/service/MerchantAiChatService.ts +51 -0
  94. package/src/service/MerchantAiSettingsService.ts +14 -0
  95. package/src/service/MerchantAiUsageService.ts +32 -0
  96. package/src/service/MerchantDiscountCodeService.ts +42 -0
  97. package/src/service/MerchantDiscountCodesService.ts +45 -0
  98. package/src/service/MerchantEventContentCalendarService.ts +122 -0
  99. package/src/service/MerchantEventProductService.ts +34 -8
  100. package/src/service/MerchantEventProductsService.ts +3 -2
  101. package/src/service/MerchantEventStatisticsBuyersService.ts +86 -0
  102. package/src/service/MerchantEventStatisticsOperationsService.ts +56 -0
  103. package/src/service/MerchantEventStatisticsOverviewService.ts +35 -0
  104. package/src/service/MerchantEventStatisticsSalesService.ts +76 -0
  105. package/src/service/MerchantEventTimeSlotService.ts +51 -0
  106. package/src/service/MerchantEventTimeSlotsService.ts +33 -0
  107. package/src/service/MerchantOrderService.ts +28 -2
  108. package/src/service/MerchantStatisticsEventsService.ts +43 -1
  109. package/src/service/MerchantStatisticsGrowthService.ts +37 -0
  110. package/src/service/MerchantStatisticsInsightsService.ts +15 -0
  111. package/src/service/MerchantStatisticsOperationsService.ts +57 -0
  112. package/src/service/PublicOrderService.ts +30 -0
  113. package/src/service/PublicShopService.ts +25 -7
  114. package/src/service/index.ts +17 -2
  115. package/src/types/aiUsage.ts +5 -0
  116. package/src/types/auth.ts +2 -0
  117. package/src/types/cashFlow.ts +10 -0
  118. package/src/types/contentCalendar.ts +3 -0
  119. package/src/types/discountCode.ts +8 -0
  120. package/src/types/feature.ts +14 -0
  121. package/src/types/general.ts +11 -0
  122. package/src/types/index.ts +9 -0
  123. package/src/types/insights.ts +24 -0
  124. package/src/types/milestone.ts +7 -0
  125. package/src/types/refund.ts +12 -0
  126. package/src/types/subscription.ts +1 -0
  127. package/src/dto/event/EventStatisticsOrdersDto.ts +0 -30
  128. package/src/dto/event/EventStatisticsScanTotalsDto.ts +0 -38
  129. package/src/dto/event/EventStatisticsScansDto.ts +0 -40
  130. package/src/service/MerchantEventStatisticsService.ts +0 -65
  131. /package/src/dto/{event → eventStatistics}/EventStatisticsAttendanceDto.ts +0 -0
@@ -0,0 +1,38 @@
1
+ import { adapter, type ForeignData } from '@basmilius/http-client';
2
+ import { DateTimeAdapter, PaymentAdapter, StatisticsAdapter } from '#data/adapter';
3
+ import { MilestoneDto, StatisticsGrowthOverviewDto } from '#data/dto';
4
+
5
+ @adapter
6
+ export class StatisticsGrowthAdapter {
7
+ static parseOverview(data: ForeignData): StatisticsGrowthOverviewDto {
8
+ return new StatisticsGrowthOverviewDto(
9
+ StatisticsAdapter.parseTrend(data.revenue, PaymentAdapter.parseCost),
10
+ StatisticsAdapter.parseTrend(data.tickets, Number),
11
+ StatisticsAdapter.parseTrend(data.buyers, Number),
12
+ StatisticsAdapter.parseTrend(data.events, Number),
13
+ StatisticsAdapter.parseTrend(data.average_event_size, Number)
14
+ );
15
+ }
16
+
17
+ static parseMilestone(data: ForeignData): MilestoneDto {
18
+ return new MilestoneDto(
19
+ data.id,
20
+ data.type,
21
+ StatisticsGrowthAdapter.parseFiniteNumber(data.threshold),
22
+ StatisticsGrowthAdapter.parseFiniteNumber(data.value),
23
+ data.reference_class ?? null,
24
+ data.reference_id ?? null,
25
+ DateTimeAdapter.parseDateTime(data.achieved_on)
26
+ );
27
+ }
28
+
29
+ private static parseFiniteNumber(value: unknown): number | null {
30
+ if (value === null || value === undefined) {
31
+ return null;
32
+ }
33
+
34
+ const parsed = Number(value);
35
+
36
+ return Number.isFinite(parsed) ? parsed : null;
37
+ }
38
+ }
@@ -0,0 +1,39 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { InsightDto, InsightSignalDto, InsightsResponseDto } from '#data/dto';
3
+ import { optionalArray } from '#data/util';
4
+
5
+ @adapter
6
+ export class StatisticsInsightsAdapter {
7
+ static parseInsight(data: ForeignData): InsightDto {
8
+ return new InsightDto(
9
+ data.id,
10
+ data.card_type,
11
+ data.language,
12
+ data.period_from,
13
+ data.period_to,
14
+ data.status,
15
+ data.title ?? null,
16
+ data.body_md ?? null,
17
+ optionalArray(data.signals, StatisticsInsightsAdapter.parseSignal),
18
+ data.payload ?? null,
19
+ data.generated_on ?? null,
20
+ !!data.is_stale
21
+ );
22
+ }
23
+
24
+ static parseInsightsResponse(data: ForeignData): InsightsResponseDto {
25
+ return new InsightsResponseDto(
26
+ !!data.enabled,
27
+ data.language,
28
+ optionalArray(data.cards, StatisticsInsightsAdapter.parseInsight),
29
+ data.last_generated_on ?? null
30
+ );
31
+ }
32
+
33
+ static parseSignal(data: ForeignData): InsightSignalDto {
34
+ return new InsightSignalDto(
35
+ data.kind,
36
+ data.text
37
+ );
38
+ }
39
+ }
@@ -0,0 +1,47 @@
1
+ import { adapter, type ForeignData } from '@basmilius/http-client';
2
+ import { StatisticsOperationsAppTeamDto, StatisticsOperationsOverviewDto, StatisticsOperationsTaskAssigneeDto, StatisticsOperationsTasksOverviewDto } from '#data/dto';
3
+
4
+ @adapter
5
+ export class StatisticsOperationsAdapter {
6
+ static parseOverview(data: ForeignData): StatisticsOperationsOverviewDto {
7
+ return new StatisticsOperationsOverviewDto(
8
+ data.total_scans,
9
+ data.checkins,
10
+ data.checkouts,
11
+ data.attendance_rate,
12
+ data.live_events
13
+ );
14
+ }
15
+
16
+ static parseAppTeam(data: ForeignData): StatisticsOperationsAppTeamDto {
17
+ return new StatisticsOperationsAppTeamDto(
18
+ data.id,
19
+ data.name,
20
+ data.event_id,
21
+ data.event_name,
22
+ data.scans,
23
+ data.checkins,
24
+ data.checkouts
25
+ );
26
+ }
27
+
28
+ static parseTasksOverview(data: ForeignData): StatisticsOperationsTasksOverviewDto {
29
+ return new StatisticsOperationsTasksOverviewDto(
30
+ data.open,
31
+ data.in_progress,
32
+ data.resolved,
33
+ data.canceled,
34
+ data.average_resolve_time_seconds,
35
+ data.top_assignees.map(StatisticsOperationsAdapter.parseTaskAssignee)
36
+ );
37
+ }
38
+
39
+ static parseTaskAssignee(data: ForeignData): StatisticsOperationsTaskAssigneeDto {
40
+ return new StatisticsOperationsTaskAssigneeDto(
41
+ data.user.id,
42
+ data.user.full_name,
43
+ data.user.initials,
44
+ data.resolved_count
45
+ );
46
+ }
47
+ }
@@ -0,0 +1,32 @@
1
+ import { adapter, ForeignData } from '@basmilius/http-client';
2
+ import { DateTimeAdapter, PaymentAdapter } from '#data/adapter';
3
+ import { MerchantSubscriptionDto, SubscriptionPlanDto } from '#data/dto';
4
+ import { optional } from '#data/util';
5
+
6
+ @adapter
7
+ export class SubscriptionAdapter {
8
+ static parseMerchantSubscription(data: ForeignData): MerchantSubscriptionDto {
9
+ return new MerchantSubscriptionDto(
10
+ data.id,
11
+ data.type,
12
+ data.plan_key,
13
+ PaymentAdapter.parseCost(data.price_monthly),
14
+ DateTimeAdapter.parseDateTime(data.starts_on),
15
+ optional(data.ends_on, DateTimeAdapter.parseDateTime),
16
+ optional(data.cancelled_on, DateTimeAdapter.parseDateTime),
17
+ data.note ?? null
18
+ );
19
+ }
20
+
21
+ static parseSubscriptionPlan(data: ForeignData): SubscriptionPlanDto {
22
+ return new SubscriptionPlanDto(
23
+ data.key,
24
+ data.type,
25
+ data.label,
26
+ data.features ?? [],
27
+ data.token_limit ?? null,
28
+ PaymentAdapter.parseCost(data.price_monthly),
29
+ data.enabled !== false
30
+ );
31
+ }
32
+ }
@@ -12,6 +12,7 @@ export class TicketAdapter {
12
12
  data.code,
13
13
  data.status,
14
14
  data.validity,
15
+ data.is_refundable ?? false,
15
16
  optional(data.buyer, BuyerAdapter.parseBuyer)!,
16
17
  optional(data.event, EventAdapter.parseEvent)!,
17
18
  optional(data.holder, BuyerAdapter.parseBuyer)!,
@@ -1,13 +1,23 @@
1
1
  export * from './AddressAdapter';
2
+ export * from './AiChatAdapter';
3
+ export * from './ContentCalendarAdapter';
4
+ export * from './AiUsageAdapter';
2
5
  export * from './AuthAdapter';
3
- export * from './EmailTemplateAdapter';
4
6
  export * from './BuyerAdapter';
7
+ export * from './CashFlowAdapter';
5
8
  export * from './CommonAdapter';
6
9
  export * from './DateTimeAdapter';
10
+ export * from './DiscountCodeAdapter';
11
+ export * from './EmailTemplateAdapter';
7
12
  export * from './EventAdapter';
13
+ export * from './EventStatisticsBuyersAdapter';
14
+ export * from './EventStatisticsOperationsAdapter';
15
+ export * from './EventStatisticsOverviewAdapter';
16
+ export * from './EventStatisticsSalesAdapter';
8
17
  export * from './FileSystemAdapter';
9
18
  export * from './FinanceAdapter';
10
19
  export * from './FluxAdapter';
20
+ export * from './MarketingAttributionAdapter';
11
21
  export * from './MerchantAdapter';
12
22
  export * from './MerchantDashboardAdapter';
13
23
  export * from './OrderAdapter';
@@ -15,12 +25,17 @@ export * from './PaymentAdapter';
15
25
  export * from './ProductAdapter';
16
26
  export * from './PublicPayAdapter';
17
27
  export * from './PublicShopAdapter';
28
+ export * from './RefundAdapter';
18
29
  export * from './ReservationAdapter';
19
30
  export * from './ServiceAdapter';
20
31
  export * from './ShortlinkAdapter';
21
32
  export * from './StatisticsAdapter';
22
33
  export * from './StatisticsBuyersAdapter';
23
34
  export * from './StatisticsEventsAdapter';
35
+ export * from './StatisticsGrowthAdapter';
36
+ export * from './StatisticsInsightsAdapter';
37
+ export * from './StatisticsOperationsAdapter';
24
38
  export * from './StatisticsOverviewAdapter';
25
39
  export * from './StatisticsSalesAdapter';
40
+ export * from './SubscriptionAdapter';
26
41
  export * from './TicketAdapter';
@@ -0,0 +1,49 @@
1
+ import { dto } from '@basmilius/http-client';
2
+ import type { DateTime } from 'luxon';
3
+
4
+ @dto
5
+ export class AiChatConversationDto {
6
+ get id(): string {
7
+ return this.#id;
8
+ }
9
+
10
+ set id(value: string) {
11
+ this.#id = value;
12
+ }
13
+
14
+ get title(): string | null {
15
+ return this.#title;
16
+ }
17
+
18
+ set title(value: string | null) {
19
+ this.#title = value;
20
+ }
21
+
22
+ get createdOn(): DateTime {
23
+ return this.#createdOn;
24
+ }
25
+
26
+ set createdOn(value: DateTime) {
27
+ this.#createdOn = value;
28
+ }
29
+
30
+ get updatedOn(): DateTime {
31
+ return this.#updatedOn;
32
+ }
33
+
34
+ set updatedOn(value: DateTime) {
35
+ this.#updatedOn = value;
36
+ }
37
+
38
+ #id: string;
39
+ #title: string | null;
40
+ #createdOn: DateTime;
41
+ #updatedOn: DateTime;
42
+
43
+ constructor(id: string, title: string | null, createdOn: DateTime, updatedOn: DateTime) {
44
+ this.#id = id;
45
+ this.#title = title;
46
+ this.#createdOn = createdOn;
47
+ this.#updatedOn = updatedOn;
48
+ }
49
+ }
@@ -0,0 +1,73 @@
1
+ import { dto } from '@basmilius/http-client';
2
+ import type { DateTime } from 'luxon';
3
+ import type { UserDto } from '#data/dto';
4
+ import type { AiChatToolCallDto } from './AiChatToolCallDto';
5
+
6
+ export type AiChatMessageRole = 'user' | 'assistant' | 'system' | 'tool';
7
+
8
+ @dto
9
+ export class AiChatMessageDto {
10
+ get id(): string {
11
+ return this.#id;
12
+ }
13
+
14
+ set id(value: string) {
15
+ this.#id = value;
16
+ }
17
+
18
+ get role(): AiChatMessageRole {
19
+ return this.#role;
20
+ }
21
+
22
+ set role(value: AiChatMessageRole) {
23
+ this.#role = value;
24
+ }
25
+
26
+ get content(): string | null {
27
+ return this.#content;
28
+ }
29
+
30
+ set content(value: string | null) {
31
+ this.#content = value;
32
+ }
33
+
34
+ get toolCalls(): AiChatToolCallDto[] | null {
35
+ return this.#toolCalls;
36
+ }
37
+
38
+ set toolCalls(value: AiChatToolCallDto[] | null) {
39
+ this.#toolCalls = value;
40
+ }
41
+
42
+ get creator(): UserDto | null {
43
+ return this.#creator;
44
+ }
45
+
46
+ set creator(value: UserDto | null) {
47
+ this.#creator = value;
48
+ }
49
+
50
+ get generatedOn(): DateTime {
51
+ return this.#generatedOn;
52
+ }
53
+
54
+ set generatedOn(value: DateTime) {
55
+ this.#generatedOn = value;
56
+ }
57
+
58
+ #id: string;
59
+ #role: AiChatMessageRole;
60
+ #content: string | null;
61
+ #toolCalls: AiChatToolCallDto[] | null;
62
+ #creator: UserDto | null;
63
+ #generatedOn: DateTime;
64
+
65
+ constructor(id: string, role: AiChatMessageRole, content: string | null, toolCalls: AiChatToolCallDto[] | null, creator: UserDto | null, generatedOn: DateTime) {
66
+ this.#id = id;
67
+ this.#role = role;
68
+ this.#content = content;
69
+ this.#toolCalls = toolCalls;
70
+ this.#creator = creator;
71
+ this.#generatedOn = generatedOn;
72
+ }
73
+ }
@@ -0,0 +1,58 @@
1
+ import { dto } from '@basmilius/http-client';
2
+
3
+ @dto
4
+ export class AiChatToolCallDto {
5
+ get id(): string {
6
+ return this.#id;
7
+ }
8
+
9
+ set id(value: string) {
10
+ this.#id = value;
11
+ }
12
+
13
+ get name(): string {
14
+ return this.#name;
15
+ }
16
+
17
+ set name(value: string) {
18
+ this.#name = value;
19
+ }
20
+
21
+ get input(): Record<string, unknown> {
22
+ return this.#input;
23
+ }
24
+
25
+ set input(value: Record<string, unknown>) {
26
+ this.#input = value;
27
+ }
28
+
29
+ get output(): unknown {
30
+ return this.#output;
31
+ }
32
+
33
+ set output(value: unknown) {
34
+ this.#output = value;
35
+ }
36
+
37
+ get isError(): boolean {
38
+ return this.#isError;
39
+ }
40
+
41
+ set isError(value: boolean) {
42
+ this.#isError = value;
43
+ }
44
+
45
+ #id: string;
46
+ #name: string;
47
+ #input: Record<string, unknown>;
48
+ #output: unknown;
49
+ #isError: boolean;
50
+
51
+ constructor(id: string, name: string, input: Record<string, unknown>, output: unknown, isError: boolean) {
52
+ this.#id = id;
53
+ this.#name = name;
54
+ this.#input = input;
55
+ this.#output = output;
56
+ this.#isError = isError;
57
+ }
58
+ }
@@ -0,0 +1,3 @@
1
+ export * from './AiChatConversationDto';
2
+ export * from './AiChatMessageDto';
3
+ export * from './AiChatToolCallDto';
@@ -0,0 +1,110 @@
1
+ import { dto } from '@basmilius/http-client';
2
+ import type { DateTime } from 'luxon';
3
+ import type { Feature } from '#data/types';
4
+
5
+ @dto
6
+ export class AiUsageDto {
7
+ get id(): string {
8
+ return this.#id;
9
+ }
10
+
11
+ set id(value: string) {
12
+ this.#id = value;
13
+ }
14
+
15
+ get feature(): Feature {
16
+ return this.#feature;
17
+ }
18
+
19
+ set feature(value: Feature) {
20
+ this.#feature = value;
21
+ }
22
+
23
+ get operation(): string {
24
+ return this.#operation;
25
+ }
26
+
27
+ set operation(value: string) {
28
+ this.#operation = value;
29
+ }
30
+
31
+ get model(): string {
32
+ return this.#model;
33
+ }
34
+
35
+ set model(value: string) {
36
+ this.#model = value;
37
+ }
38
+
39
+ get promptTokens(): number {
40
+ return this.#promptTokens;
41
+ }
42
+
43
+ set promptTokens(value: number) {
44
+ this.#promptTokens = value;
45
+ }
46
+
47
+ get cachedTokens(): number {
48
+ return this.#cachedTokens;
49
+ }
50
+
51
+ set cachedTokens(value: number) {
52
+ this.#cachedTokens = value;
53
+ }
54
+
55
+ get outputTokens(): number {
56
+ return this.#outputTokens;
57
+ }
58
+
59
+ set outputTokens(value: number) {
60
+ this.#outputTokens = value;
61
+ }
62
+
63
+ get referenceClass(): string | null {
64
+ return this.#referenceClass;
65
+ }
66
+
67
+ set referenceClass(value: string | null) {
68
+ this.#referenceClass = value;
69
+ }
70
+
71
+ get referenceId(): string | null {
72
+ return this.#referenceId;
73
+ }
74
+
75
+ set referenceId(value: string | null) {
76
+ this.#referenceId = value;
77
+ }
78
+
79
+ get createdOn(): DateTime {
80
+ return this.#createdOn;
81
+ }
82
+
83
+ set createdOn(value: DateTime) {
84
+ this.#createdOn = value;
85
+ }
86
+
87
+ #id: string;
88
+ #feature: Feature;
89
+ #operation: string;
90
+ #model: string;
91
+ #promptTokens: number;
92
+ #cachedTokens: number;
93
+ #outputTokens: number;
94
+ #referenceClass: string | null;
95
+ #referenceId: string | null;
96
+ #createdOn: DateTime;
97
+
98
+ constructor(id: string, feature: Feature, operation: string, model: string, promptTokens: number, cachedTokens: number, outputTokens: number, referenceClass: string | null, referenceId: string | null, createdOn: DateTime) {
99
+ this.#id = id;
100
+ this.#feature = feature;
101
+ this.#operation = operation;
102
+ this.#model = model;
103
+ this.#promptTokens = promptTokens;
104
+ this.#cachedTokens = cachedTokens;
105
+ this.#outputTokens = outputTokens;
106
+ this.#referenceClass = referenceClass;
107
+ this.#referenceId = referenceId;
108
+ this.#createdOn = createdOn;
109
+ }
110
+ }
@@ -0,0 +1,39 @@
1
+ import { dto } from '@basmilius/http-client';
2
+ import type { Feature } from '#data/types';
3
+
4
+ @dto
5
+ export class AiUsageFeatureStatusDto {
6
+ get feature(): Feature {
7
+ return this.#feature;
8
+ }
9
+
10
+ set feature(value: Feature) {
11
+ this.#feature = value;
12
+ }
13
+
14
+ get enabled(): boolean {
15
+ return this.#enabled;
16
+ }
17
+
18
+ set enabled(value: boolean) {
19
+ this.#enabled = value;
20
+ }
21
+
22
+ get tokensUsed(): number {
23
+ return this.#tokensUsed;
24
+ }
25
+
26
+ set tokensUsed(value: number) {
27
+ this.#tokensUsed = value;
28
+ }
29
+
30
+ #feature: Feature;
31
+ #enabled: boolean;
32
+ #tokensUsed: number;
33
+
34
+ constructor(feature: Feature, enabled: boolean, tokensUsed: number) {
35
+ this.#feature = feature;
36
+ this.#enabled = enabled;
37
+ this.#tokensUsed = tokensUsed;
38
+ }
39
+ }
@@ -0,0 +1,80 @@
1
+ import { dto } from '@basmilius/http-client';
2
+ import type { DateTime } from 'luxon';
3
+ import type { AiUsageFeatureStatusDto } from './AiUsageFeatureStatusDto';
4
+
5
+ @dto
6
+ export class AiUsagePeriodDto {
7
+ get periodStart(): DateTime | null {
8
+ return this.#periodStart;
9
+ }
10
+
11
+ set periodStart(value: DateTime | null) {
12
+ this.#periodStart = value;
13
+ }
14
+
15
+ get periodEnd(): DateTime | null {
16
+ return this.#periodEnd;
17
+ }
18
+
19
+ set periodEnd(value: DateTime | null) {
20
+ this.#periodEnd = value;
21
+ }
22
+
23
+ get tokensUsed(): number {
24
+ return this.#tokensUsed;
25
+ }
26
+
27
+ set tokensUsed(value: number) {
28
+ this.#tokensUsed = value;
29
+ }
30
+
31
+ get limitTokens(): number | null {
32
+ return this.#limitTokens;
33
+ }
34
+
35
+ set limitTokens(value: number | null) {
36
+ this.#limitTokens = value;
37
+ }
38
+
39
+ get percentage(): number {
40
+ return this.#percentage;
41
+ }
42
+
43
+ set percentage(value: number) {
44
+ this.#percentage = value;
45
+ }
46
+
47
+ get lastEventOn(): DateTime | null {
48
+ return this.#lastEventOn;
49
+ }
50
+
51
+ set lastEventOn(value: DateTime | null) {
52
+ this.#lastEventOn = value;
53
+ }
54
+
55
+ get features(): AiUsageFeatureStatusDto[] {
56
+ return this.#features;
57
+ }
58
+
59
+ set features(value: AiUsageFeatureStatusDto[]) {
60
+ this.#features = value;
61
+ }
62
+
63
+ #periodStart: DateTime | null;
64
+ #periodEnd: DateTime | null;
65
+ #tokensUsed: number;
66
+ #limitTokens: number | null;
67
+ #percentage: number;
68
+ #lastEventOn: DateTime | null;
69
+ #features: AiUsageFeatureStatusDto[];
70
+
71
+ constructor(periodStart: DateTime | null, periodEnd: DateTime | null, tokensUsed: number, limitTokens: number | null, percentage: number, lastEventOn: DateTime | null, features: AiUsageFeatureStatusDto[]) {
72
+ this.#periodStart = periodStart;
73
+ this.#periodEnd = periodEnd;
74
+ this.#tokensUsed = tokensUsed;
75
+ this.#limitTokens = limitTokens;
76
+ this.#percentage = percentage;
77
+ this.#lastEventOn = lastEventOn;
78
+ this.#features = features;
79
+ }
80
+ }
@@ -0,0 +1,3 @@
1
+ export * from './AiUsageDto';
2
+ export * from './AiUsageFeatureStatusDto';
3
+ export * from './AiUsagePeriodDto';
@@ -0,0 +1,40 @@
1
+ import { dto } from '@basmilius/http-client';
2
+ import type { CostDto } from '#data/dto';
3
+ import type { DiscountCodeType } from '#data/types';
4
+
5
+ @dto
6
+ export class CashFlowDiscountDto {
7
+ get code(): string {
8
+ return this.#code;
9
+ }
10
+
11
+ set code(value: string) {
12
+ this.#code = value;
13
+ }
14
+
15
+ get amount(): CostDto {
16
+ return this.#amount;
17
+ }
18
+
19
+ set amount(value: CostDto) {
20
+ this.#amount = value;
21
+ }
22
+
23
+ get type(): DiscountCodeType {
24
+ return this.#type;
25
+ }
26
+
27
+ set type(value: DiscountCodeType) {
28
+ this.#type = value;
29
+ }
30
+
31
+ #code: string;
32
+ #amount: CostDto;
33
+ #type: DiscountCodeType;
34
+
35
+ constructor(code: string, amount: CostDto, type: DiscountCodeType) {
36
+ this.#code = code;
37
+ this.#amount = amount;
38
+ this.#type = type;
39
+ }
40
+ }