@explorins/pers-shared 2.1.84 → 2.1.86
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.
- package/dist/cjs/shared-lib/dto/analytics/business-ranking-analytics.dto.d.ts +57 -0
- package/dist/cjs/shared-lib/dto/analytics/business-ranking-analytics.dto.d.ts.map +1 -0
- package/dist/cjs/shared-lib/dto/analytics/business-ranking-analytics.dto.js +226 -0
- package/dist/cjs/shared-lib/dto/analytics/business-ranking-analytics.dto.js.map +1 -0
- package/dist/cjs/shared-lib/dto/analytics/index.d.ts +2 -0
- package/dist/cjs/shared-lib/dto/analytics/index.d.ts.map +1 -1
- package/dist/cjs/shared-lib/dto/analytics/index.js +2 -0
- package/dist/cjs/shared-lib/dto/analytics/index.js.map +1 -1
- package/dist/cjs/shared-lib/dto/analytics/retention-analytics.dto.d.ts +65 -0
- package/dist/cjs/shared-lib/dto/analytics/retention-analytics.dto.d.ts.map +1 -0
- package/dist/cjs/shared-lib/dto/analytics/retention-analytics.dto.js +213 -0
- package/dist/cjs/shared-lib/dto/analytics/retention-analytics.dto.js.map +1 -0
- package/dist/esm/shared-lib/dto/analytics/business-ranking-analytics.dto.d.ts +57 -0
- package/dist/esm/shared-lib/dto/analytics/business-ranking-analytics.dto.d.ts.map +1 -0
- package/dist/esm/shared-lib/dto/analytics/business-ranking-analytics.dto.js +198 -0
- package/dist/esm/shared-lib/dto/analytics/business-ranking-analytics.dto.js.map +1 -0
- package/dist/esm/shared-lib/dto/analytics/index.d.ts +2 -0
- package/dist/esm/shared-lib/dto/analytics/index.d.ts.map +1 -1
- package/dist/esm/shared-lib/dto/analytics/index.js +2 -0
- package/dist/esm/shared-lib/dto/analytics/index.js.map +1 -1
- package/dist/esm/shared-lib/dto/analytics/retention-analytics.dto.d.ts +65 -0
- package/dist/esm/shared-lib/dto/analytics/retention-analytics.dto.d.ts.map +1 -0
- package/dist/esm/shared-lib/dto/analytics/retention-analytics.dto.js +186 -0
- package/dist/esm/shared-lib/dto/analytics/retention-analytics.dto.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SortOrder } from '../../..';
|
|
2
|
+
import type { NativeTokenType } from '../../types/native-token.type';
|
|
3
|
+
import { BaseAnalyticsMetadata } from './base-analytics.dto';
|
|
4
|
+
/**
|
|
5
|
+
* BUSINESS RANKING ANALYTICS DTOs
|
|
6
|
+
*
|
|
7
|
+
* Domain: Analytics (Cross-Domain Query)
|
|
8
|
+
* Purpose: Server-side aggregation of business transaction rankings
|
|
9
|
+
*
|
|
10
|
+
* Replaces:
|
|
11
|
+
* - Dual queries (modern + legacy business transactions)
|
|
12
|
+
* - Client-side merging logic in business-balances.component.ts
|
|
13
|
+
*
|
|
14
|
+
* Performance Impact:
|
|
15
|
+
* - 2 API calls → 1 API call (50% reduction)
|
|
16
|
+
* - ~60 lines removed from frontend
|
|
17
|
+
* - Server-side JOIN optimization
|
|
18
|
+
*/
|
|
19
|
+
export declare class BusinessRankingFiltersDTO {
|
|
20
|
+
businessId?: string;
|
|
21
|
+
tokenType?: NativeTokenType;
|
|
22
|
+
}
|
|
23
|
+
export declare class BusinessRankingAnalyticsRequestDTO {
|
|
24
|
+
filters?: BusinessRankingFiltersDTO;
|
|
25
|
+
sortBy?: 'totalTransactions' | 'tokenReceived' | 'businessId' | 'businessName';
|
|
26
|
+
sortOrder?: SortOrder;
|
|
27
|
+
limit?: number;
|
|
28
|
+
startDate?: Date;
|
|
29
|
+
endDate?: Date;
|
|
30
|
+
}
|
|
31
|
+
export declare class BusinessRankingResultItemDTO {
|
|
32
|
+
businessId: string | null;
|
|
33
|
+
businessName: string | null;
|
|
34
|
+
displayName: string | null;
|
|
35
|
+
accountAddress: string | null;
|
|
36
|
+
totalTransactions: number;
|
|
37
|
+
tokenReceived: number;
|
|
38
|
+
hasLegacyTransactions?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare class BusinessRankingAnalyticsResponseDTO {
|
|
41
|
+
results: BusinessRankingResultItemDTO[];
|
|
42
|
+
totalBusinesses: number;
|
|
43
|
+
metadata: BaseAnalyticsMetadata & {
|
|
44
|
+
/**
|
|
45
|
+
* Token type used for filtering (if provided in request)
|
|
46
|
+
*/
|
|
47
|
+
tokenType?: NativeTokenType;
|
|
48
|
+
/**
|
|
49
|
+
* Sort configuration applied
|
|
50
|
+
*/
|
|
51
|
+
sorting?: {
|
|
52
|
+
sortBy: string;
|
|
53
|
+
sortOrder: SortOrder;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=business-ranking-analytics.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"business-ranking-analytics.dto.d.ts","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/business-ranking-analytics.dto.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;;;;;;;;;;;GAcG;AAIH,qBAAa,yBAAyB;IASpC,UAAU,CAAC,EAAE,MAAM,CAAC;IASpB,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAID,qBAAa,kCAAkC;IAQ7C,OAAO,CAAC,EAAE,yBAAyB,CAAC;IAUpC,MAAM,CAAC,EAAE,mBAAmB,GAAG,eAAe,GAAG,YAAY,GAAG,cAAc,CAAC;IAU/E,SAAS,CAAC,EAAE,SAAS,CAAC;IAatB,KAAK,CAAC,EAAE,MAAM,CAAC;IAQf,SAAS,CAAC,EAAE,IAAI,CAAC;IAQjB,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB;AAID,qBAAa,4BAA4B;IAMvC,UAAU,EAAG,MAAM,GAAG,IAAI,CAAC;IAO3B,YAAY,EAAG,MAAM,GAAG,IAAI,CAAC;IAO7B,WAAW,EAAG,MAAM,GAAG,IAAI,CAAC;IAO5B,cAAc,EAAG,MAAM,GAAG,IAAI,CAAC;IAM/B,iBAAiB,EAAG,MAAM,CAAC;IAM3B,aAAa,EAAG,MAAM,CAAC;IAMvB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAID,qBAAa,mCAAmC;IAK9C,OAAO,EAAG,4BAA4B,EAAE,CAAC;IAMzC,eAAe,EAAG,MAAM,CAAC;IAMzB,QAAQ,EAAG,qBAAqB,GAAG;QACjC;;WAEG;QACH,SAAS,CAAC,EAAE,eAAe,CAAC;QAE5B;;WAEG;QACH,OAAO,CAAC,EAAE;YACR,MAAM,EAAE,MAAM,CAAC;YACf,SAAS,EAAE,SAAS,CAAC;SACtB,CAAC;KACH,CAAC;CACH"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BusinessRankingAnalyticsResponseDTO = exports.BusinessRankingResultItemDTO = exports.BusinessRankingAnalyticsRequestDTO = exports.BusinessRankingFiltersDTO = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
16
|
+
const __1 = require("../../..");
|
|
17
|
+
const native_token_type_1 = require("../../types/native-token.type");
|
|
18
|
+
/**
|
|
19
|
+
* BUSINESS RANKING ANALYTICS DTOs
|
|
20
|
+
*
|
|
21
|
+
* Domain: Analytics (Cross-Domain Query)
|
|
22
|
+
* Purpose: Server-side aggregation of business transaction rankings
|
|
23
|
+
*
|
|
24
|
+
* Replaces:
|
|
25
|
+
* - Dual queries (modern + legacy business transactions)
|
|
26
|
+
* - Client-side merging logic in business-balances.component.ts
|
|
27
|
+
*
|
|
28
|
+
* Performance Impact:
|
|
29
|
+
* - 2 API calls → 1 API call (50% reduction)
|
|
30
|
+
* - ~60 lines removed from frontend
|
|
31
|
+
* - Server-side JOIN optimization
|
|
32
|
+
*/
|
|
33
|
+
// ========== FILTERS ==========
|
|
34
|
+
class BusinessRankingFiltersDTO {
|
|
35
|
+
businessId;
|
|
36
|
+
tokenType;
|
|
37
|
+
}
|
|
38
|
+
exports.BusinessRankingFiltersDTO = BusinessRankingFiltersDTO;
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
41
|
+
description: 'Filter to specific business by ID',
|
|
42
|
+
type: String,
|
|
43
|
+
format: 'uuid',
|
|
44
|
+
example: 'biz-uuid-123'
|
|
45
|
+
}),
|
|
46
|
+
(0, class_validator_1.IsOptional)(),
|
|
47
|
+
(0, class_validator_1.IsString)(),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], BusinessRankingFiltersDTO.prototype, "businessId", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
52
|
+
description: 'Filter by specific token type',
|
|
53
|
+
enum: native_token_type_1.NativeTokenTypes,
|
|
54
|
+
example: native_token_type_1.NativeTokenTypes.ERC721
|
|
55
|
+
}),
|
|
56
|
+
(0, class_validator_1.IsOptional)(),
|
|
57
|
+
(0, class_validator_1.IsEnum)(native_token_type_1.NativeTokenTypes),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], BusinessRankingFiltersDTO.prototype, "tokenType", void 0);
|
|
60
|
+
// ========== REQUEST ==========
|
|
61
|
+
class BusinessRankingAnalyticsRequestDTO {
|
|
62
|
+
filters;
|
|
63
|
+
sortBy;
|
|
64
|
+
sortOrder;
|
|
65
|
+
limit;
|
|
66
|
+
startDate;
|
|
67
|
+
endDate;
|
|
68
|
+
}
|
|
69
|
+
exports.BusinessRankingAnalyticsRequestDTO = BusinessRankingAnalyticsRequestDTO;
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
72
|
+
description: 'Filters for business ranking query',
|
|
73
|
+
type: BusinessRankingFiltersDTO
|
|
74
|
+
}),
|
|
75
|
+
(0, class_validator_1.IsOptional)(),
|
|
76
|
+
(0, class_validator_1.ValidateNested)(),
|
|
77
|
+
(0, class_transformer_1.Type)(() => BusinessRankingFiltersDTO),
|
|
78
|
+
__metadata("design:type", BusinessRankingFiltersDTO)
|
|
79
|
+
], BusinessRankingAnalyticsRequestDTO.prototype, "filters", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
82
|
+
description: 'Field to sort results by',
|
|
83
|
+
enum: ['totalTransactions', 'tokenReceived', 'businessId', 'businessName'],
|
|
84
|
+
default: 'totalTransactions',
|
|
85
|
+
example: 'totalTransactions'
|
|
86
|
+
}),
|
|
87
|
+
(0, class_validator_1.IsOptional)(),
|
|
88
|
+
(0, class_validator_1.IsString)(),
|
|
89
|
+
__metadata("design:type", String)
|
|
90
|
+
], BusinessRankingAnalyticsRequestDTO.prototype, "sortBy", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
93
|
+
description: 'Sort order (ASC or DESC)',
|
|
94
|
+
enum: __1.SortOrder,
|
|
95
|
+
default: __1.SortOrder.DESC,
|
|
96
|
+
example: __1.SortOrder.DESC
|
|
97
|
+
}),
|
|
98
|
+
(0, class_validator_1.IsOptional)(),
|
|
99
|
+
(0, class_validator_1.IsEnum)(__1.SortOrder),
|
|
100
|
+
__metadata("design:type", String)
|
|
101
|
+
], BusinessRankingAnalyticsRequestDTO.prototype, "sortOrder", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
104
|
+
description: 'Maximum number of results to return',
|
|
105
|
+
minimum: 1,
|
|
106
|
+
maximum: 1000,
|
|
107
|
+
default: 50,
|
|
108
|
+
example: 50
|
|
109
|
+
}),
|
|
110
|
+
(0, class_validator_1.IsOptional)(),
|
|
111
|
+
(0, class_validator_1.IsInt)(),
|
|
112
|
+
(0, class_validator_1.Min)(1),
|
|
113
|
+
(0, class_validator_1.Max)(1000),
|
|
114
|
+
__metadata("design:type", Number)
|
|
115
|
+
], BusinessRankingAnalyticsRequestDTO.prototype, "limit", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
118
|
+
description: 'Start date for filtering transactions (ISO 8601)',
|
|
119
|
+
example: '2026-01-01T00:00:00Z'
|
|
120
|
+
}),
|
|
121
|
+
(0, class_validator_1.IsOptional)(),
|
|
122
|
+
(0, class_validator_1.IsDateString)(),
|
|
123
|
+
__metadata("design:type", Date)
|
|
124
|
+
], BusinessRankingAnalyticsRequestDTO.prototype, "startDate", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
127
|
+
description: 'End date for filtering transactions (ISO 8601)',
|
|
128
|
+
example: '2026-02-01T00:00:00Z'
|
|
129
|
+
}),
|
|
130
|
+
(0, class_validator_1.IsOptional)(),
|
|
131
|
+
(0, class_validator_1.IsDateString)(),
|
|
132
|
+
__metadata("design:type", Date)
|
|
133
|
+
], BusinessRankingAnalyticsRequestDTO.prototype, "endDate", void 0);
|
|
134
|
+
// ========== RESULT ITEM ==========
|
|
135
|
+
class BusinessRankingResultItemDTO {
|
|
136
|
+
businessId;
|
|
137
|
+
businessName;
|
|
138
|
+
displayName;
|
|
139
|
+
accountAddress;
|
|
140
|
+
totalTransactions;
|
|
141
|
+
tokenReceived;
|
|
142
|
+
hasLegacyTransactions;
|
|
143
|
+
}
|
|
144
|
+
exports.BusinessRankingResultItemDTO = BusinessRankingResultItemDTO;
|
|
145
|
+
__decorate([
|
|
146
|
+
(0, swagger_1.ApiProperty)({
|
|
147
|
+
description: 'Business UUID (null for unidentified businesses)',
|
|
148
|
+
nullable: true,
|
|
149
|
+
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
150
|
+
}),
|
|
151
|
+
__metadata("design:type", Object)
|
|
152
|
+
], BusinessRankingResultItemDTO.prototype, "businessId", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
(0, swagger_1.ApiProperty)({
|
|
155
|
+
description: 'Business name',
|
|
156
|
+
nullable: true,
|
|
157
|
+
example: 'Acme Coffee Shop'
|
|
158
|
+
}),
|
|
159
|
+
__metadata("design:type", Object)
|
|
160
|
+
], BusinessRankingResultItemDTO.prototype, "businessName", void 0);
|
|
161
|
+
__decorate([
|
|
162
|
+
(0, swagger_1.ApiProperty)({
|
|
163
|
+
description: 'Business display name',
|
|
164
|
+
nullable: true,
|
|
165
|
+
example: 'Acme Coffee'
|
|
166
|
+
}),
|
|
167
|
+
__metadata("design:type", Object)
|
|
168
|
+
], BusinessRankingResultItemDTO.prototype, "displayName", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
(0, swagger_1.ApiProperty)({
|
|
171
|
+
description: 'Business blockchain account address',
|
|
172
|
+
nullable: true,
|
|
173
|
+
example: '0x1234567890abcdef...'
|
|
174
|
+
}),
|
|
175
|
+
__metadata("design:type", Object)
|
|
176
|
+
], BusinessRankingResultItemDTO.prototype, "accountAddress", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
(0, swagger_1.ApiProperty)({
|
|
179
|
+
description: 'Total number of successful transactions received',
|
|
180
|
+
example: 150
|
|
181
|
+
}),
|
|
182
|
+
__metadata("design:type", Number)
|
|
183
|
+
], BusinessRankingResultItemDTO.prototype, "totalTransactions", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
(0, swagger_1.ApiProperty)({
|
|
186
|
+
description: 'Total token amount received',
|
|
187
|
+
example: 1500.50
|
|
188
|
+
}),
|
|
189
|
+
__metadata("design:type", Number)
|
|
190
|
+
], BusinessRankingResultItemDTO.prototype, "tokenReceived", void 0);
|
|
191
|
+
__decorate([
|
|
192
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
193
|
+
description: 'Whether this business has legacy transactions (address-based)',
|
|
194
|
+
example: false
|
|
195
|
+
}),
|
|
196
|
+
__metadata("design:type", Boolean)
|
|
197
|
+
], BusinessRankingResultItemDTO.prototype, "hasLegacyTransactions", void 0);
|
|
198
|
+
// ========== RESPONSE ==========
|
|
199
|
+
class BusinessRankingAnalyticsResponseDTO {
|
|
200
|
+
results;
|
|
201
|
+
totalBusinesses;
|
|
202
|
+
metadata;
|
|
203
|
+
}
|
|
204
|
+
exports.BusinessRankingAnalyticsResponseDTO = BusinessRankingAnalyticsResponseDTO;
|
|
205
|
+
__decorate([
|
|
206
|
+
(0, swagger_1.ApiProperty)({
|
|
207
|
+
description: 'Array of business ranking results',
|
|
208
|
+
type: [BusinessRankingResultItemDTO]
|
|
209
|
+
}),
|
|
210
|
+
__metadata("design:type", Array)
|
|
211
|
+
], BusinessRankingAnalyticsResponseDTO.prototype, "results", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
(0, swagger_1.ApiProperty)({
|
|
214
|
+
description: 'Total number of businesses in results',
|
|
215
|
+
example: 25
|
|
216
|
+
}),
|
|
217
|
+
__metadata("design:type", Number)
|
|
218
|
+
], BusinessRankingAnalyticsResponseDTO.prototype, "totalBusinesses", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
(0, swagger_1.ApiProperty)({
|
|
221
|
+
description: 'Query metadata',
|
|
222
|
+
type: 'object'
|
|
223
|
+
}),
|
|
224
|
+
__metadata("design:type", Object)
|
|
225
|
+
], BusinessRankingAnalyticsResponseDTO.prototype, "metadata", void 0);
|
|
226
|
+
//# sourceMappingURL=business-ranking-analytics.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"business-ranking-analytics.dto.js","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/business-ranking-analytics.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA8G;AAC9G,yDAAyC;AACzC,6CAAmE;AACnE,gCAAqC;AAErC,qEAAiE;AAGjE;;;;;;;;;;;;;;GAcG;AAEH,gCAAgC;AAEhC,MAAa,yBAAyB;IASpC,UAAU,CAAU;IASpB,SAAS,CAAmB;CAC7B;AAnBD,8DAmBC;AAVC;IARC,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,mCAAmC;QAChD,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,cAAc;KACxB,CAAC;IACD,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;6DACS;AASpB;IAPC,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,+BAA+B;QAC5C,IAAI,EAAE,oCAAgB;QACtB,OAAO,EAAE,oCAAgB,CAAC,MAAM;KACjC,CAAC;IACD,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,EAAC,oCAAgB,CAAC;;4DACG;AAG9B,gCAAgC;AAEhC,MAAa,kCAAkC;IAQ7C,OAAO,CAA6B;IAUpC,MAAM,CAAyE;IAU/E,SAAS,CAAa;IAatB,KAAK,CAAU;IAQf,SAAS,CAAQ;IAQjB,OAAO,CAAQ;CAChB;AA1DD,gFA0DC;AAlDC;IAPC,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,oCAAoC;QACjD,IAAI,EAAE,yBAAyB;KAChC,CAAC;IACD,IAAA,4BAA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4BAA4B,CAAC;KACrC,CAAC;;oEACuC;AAMzC;IAJC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,uCAAuC;QACpD,OAAO,EAAE,EAAE;KACZ,CAAC;;4EACuB;AAMzB;IAJC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,gBAAgB;QAC7B,IAAI,EAAE,QAAQ;KACf,CAAC;;qEAcA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './base-analytics.dto';
|
|
2
|
+
export * from './business-ranking-analytics.dto';
|
|
2
3
|
export * from './group-by-expression.dto';
|
|
4
|
+
export * from './retention-analytics.dto';
|
|
3
5
|
export * from './usage-analytics.dto';
|
|
4
6
|
export * from './user-ranking-analytics.dto';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/index.ts"],"names":[],"mappings":"AAEA,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/index.ts"],"names":[],"mappings":"AAEA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC"}
|
|
@@ -15,7 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./base-analytics.dto"), exports);
|
|
18
|
+
__exportStar(require("./business-ranking-analytics.dto"), exports);
|
|
18
19
|
__exportStar(require("./group-by-expression.dto"), exports);
|
|
20
|
+
__exportStar(require("./retention-analytics.dto"), exports);
|
|
19
21
|
__exportStar(require("./usage-analytics.dto"), exports);
|
|
20
22
|
__exportStar(require("./user-ranking-analytics.dto"), exports);
|
|
21
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,uDAAqC;AACrC,4DAA0C;AAC1C,wDAAsC;AACtC,+DAA6C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,uDAAqC;AACrC,mEAAiD;AACjD,4DAA0C;AAC1C,4DAA0C;AAC1C,wDAAsC;AACtC,+DAA6C"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { NativeTokenType } from '../../types/native-token.type';
|
|
2
|
+
import { BaseAnalyticsMetadata } from './base-analytics.dto';
|
|
3
|
+
/**
|
|
4
|
+
* RETENTION ANALYTICS DTOs
|
|
5
|
+
*
|
|
6
|
+
* Domain: Analytics (Cross-Domain Query)
|
|
7
|
+
* Purpose: Server-side monthly retention calculations
|
|
8
|
+
*
|
|
9
|
+
* Replaces:
|
|
10
|
+
* - 13 separate API calls (one per month)
|
|
11
|
+
* - Client-side forkJoin aggregation
|
|
12
|
+
* - Manual month generation logic
|
|
13
|
+
*
|
|
14
|
+
* Performance Impact:
|
|
15
|
+
* - 13 API calls → 1 API call (92% reduction)
|
|
16
|
+
* - ~1350ms → ~105ms load time (92% faster)
|
|
17
|
+
* - ~260KB → ~40KB payload (85% smaller)
|
|
18
|
+
*/
|
|
19
|
+
export declare class RetentionAnalyticsFiltersDTO {
|
|
20
|
+
tokenType?: NativeTokenType;
|
|
21
|
+
triggerProcessType?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare class RetentionAnalyticsRequestDTO {
|
|
24
|
+
startMonth?: Date;
|
|
25
|
+
monthsBack?: number;
|
|
26
|
+
filters?: RetentionAnalyticsFiltersDTO;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Retention data for a month offset within a cohort
|
|
30
|
+
* Tracks how many users from the original cohort are still active
|
|
31
|
+
*/
|
|
32
|
+
export declare class CohortRetentionMonthDTO {
|
|
33
|
+
retainedUsers: number;
|
|
34
|
+
retentionRate: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Cohort retention result for a single month
|
|
38
|
+
* Contains the cohort (new users in month) and their retention over subsequent months
|
|
39
|
+
*/
|
|
40
|
+
export declare class RetentionMonthResultDTO {
|
|
41
|
+
monthKey: string;
|
|
42
|
+
startDate: Date;
|
|
43
|
+
endDate: Date;
|
|
44
|
+
cohortSize: number;
|
|
45
|
+
monthlyRetention: {
|
|
46
|
+
[monthOffset: string]: CohortRetentionMonthDTO;
|
|
47
|
+
};
|
|
48
|
+
byTriggerType?: {
|
|
49
|
+
[key: string]: {
|
|
50
|
+
count: number;
|
|
51
|
+
uniqueUsers: number;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export declare class RetentionAnalyticsResponseDTO {
|
|
56
|
+
results: RetentionMonthResultDTO[];
|
|
57
|
+
totalMonths: number;
|
|
58
|
+
metadata: BaseAnalyticsMetadata & {
|
|
59
|
+
/**
|
|
60
|
+
* Calculation method used for retention analysis
|
|
61
|
+
*/
|
|
62
|
+
calculationMethod: 'monthly-cohort';
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=retention-analytics.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retention-analytics.dto.d.ts","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/retention-analytics.dto.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AAIH,qBAAa,4BAA4B;IAQvC,SAAS,CAAC,EAAE,eAAe,CAAC;IAQ5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAID,qBAAa,4BAA4B;IAOvC,UAAU,CAAC,EAAE,IAAI,CAAC;IAalB,UAAU,CAAC,EAAE,MAAM,CAAC;IASpB,OAAO,CAAC,EAAE,4BAA4B,CAAC;CACxC;AAID;;;GAGG;AACH,qBAAa,uBAAuB;IAKlC,aAAa,EAAG,MAAM,CAAC;IAMvB,aAAa,EAAG,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,qBAAa,uBAAuB;IAKlC,QAAQ,EAAG,MAAM,CAAC;IAMlB,SAAS,EAAG,IAAI,CAAC;IAMjB,OAAO,EAAG,IAAI,CAAC;IAMf,UAAU,EAAG,MAAM,CAAC;IAWpB,gBAAgB,EAAG;QACjB,CAAC,WAAW,EAAE,MAAM,GAAG,uBAAuB,CAAC;KAChD,CAAC;IASF,aAAa,CAAC,EAAE;QACd,CAAC,GAAG,EAAE,MAAM,GAAG;YACb,KAAK,EAAE,MAAM,CAAC;YACd,WAAW,EAAE,MAAM,CAAC;SACrB,CAAC;KACH,CAAC;CACH;AAID,qBAAa,6BAA6B;IAKxC,OAAO,EAAG,uBAAuB,EAAE,CAAC;IAMpC,WAAW,EAAG,MAAM,CAAC;IAMrB,QAAQ,EAAG,qBAAqB,GAAG;QACjC;;WAEG;QACH,iBAAiB,EAAE,gBAAgB,CAAC;KACrC,CAAC;CACH"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RetentionAnalyticsResponseDTO = exports.RetentionMonthResultDTO = exports.CohortRetentionMonthDTO = exports.RetentionAnalyticsRequestDTO = exports.RetentionAnalyticsFiltersDTO = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
16
|
+
const native_token_type_1 = require("../../types/native-token.type");
|
|
17
|
+
/**
|
|
18
|
+
* RETENTION ANALYTICS DTOs
|
|
19
|
+
*
|
|
20
|
+
* Domain: Analytics (Cross-Domain Query)
|
|
21
|
+
* Purpose: Server-side monthly retention calculations
|
|
22
|
+
*
|
|
23
|
+
* Replaces:
|
|
24
|
+
* - 13 separate API calls (one per month)
|
|
25
|
+
* - Client-side forkJoin aggregation
|
|
26
|
+
* - Manual month generation logic
|
|
27
|
+
*
|
|
28
|
+
* Performance Impact:
|
|
29
|
+
* - 13 API calls → 1 API call (92% reduction)
|
|
30
|
+
* - ~1350ms → ~105ms load time (92% faster)
|
|
31
|
+
* - ~260KB → ~40KB payload (85% smaller)
|
|
32
|
+
*/
|
|
33
|
+
// ========== REQUEST FILTERS ==========
|
|
34
|
+
class RetentionAnalyticsFiltersDTO {
|
|
35
|
+
tokenType;
|
|
36
|
+
triggerProcessType;
|
|
37
|
+
}
|
|
38
|
+
exports.RetentionAnalyticsFiltersDTO = RetentionAnalyticsFiltersDTO;
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
41
|
+
description: 'Filter by specific token type',
|
|
42
|
+
enum: native_token_type_1.NativeTokenTypes,
|
|
43
|
+
example: native_token_type_1.NativeTokenTypes.ERC721
|
|
44
|
+
}),
|
|
45
|
+
(0, class_validator_1.IsOptional)(),
|
|
46
|
+
(0, class_validator_1.IsEnum)(native_token_type_1.NativeTokenTypes),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], RetentionAnalyticsFiltersDTO.prototype, "tokenType", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
51
|
+
description: 'Filter by trigger process type',
|
|
52
|
+
example: 'PURCHASE'
|
|
53
|
+
}),
|
|
54
|
+
(0, class_validator_1.IsOptional)(),
|
|
55
|
+
(0, class_validator_1.IsString)(),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], RetentionAnalyticsFiltersDTO.prototype, "triggerProcessType", void 0);
|
|
58
|
+
// ========== REQUEST ==========
|
|
59
|
+
class RetentionAnalyticsRequestDTO {
|
|
60
|
+
startMonth;
|
|
61
|
+
monthsBack;
|
|
62
|
+
filters;
|
|
63
|
+
}
|
|
64
|
+
exports.RetentionAnalyticsRequestDTO = RetentionAnalyticsRequestDTO;
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
67
|
+
description: 'Starting month for retention analysis (defaults to current month)',
|
|
68
|
+
example: '2026-02-01T00:00:00Z'
|
|
69
|
+
}),
|
|
70
|
+
(0, class_validator_1.IsOptional)(),
|
|
71
|
+
(0, class_validator_1.IsDateString)(),
|
|
72
|
+
__metadata("design:type", Date)
|
|
73
|
+
], RetentionAnalyticsRequestDTO.prototype, "startMonth", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
76
|
+
description: 'Number of months to analyze (looking backwards)',
|
|
77
|
+
minimum: 1,
|
|
78
|
+
maximum: 24,
|
|
79
|
+
default: 13,
|
|
80
|
+
example: 13
|
|
81
|
+
}),
|
|
82
|
+
(0, class_validator_1.IsOptional)(),
|
|
83
|
+
(0, class_validator_1.IsInt)(),
|
|
84
|
+
(0, class_validator_1.Min)(1),
|
|
85
|
+
(0, class_validator_1.Max)(24),
|
|
86
|
+
__metadata("design:type", Number)
|
|
87
|
+
], RetentionAnalyticsRequestDTO.prototype, "monthsBack", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
90
|
+
description: 'Optional filters for retention query',
|
|
91
|
+
type: RetentionAnalyticsFiltersDTO
|
|
92
|
+
}),
|
|
93
|
+
(0, class_validator_1.IsOptional)(),
|
|
94
|
+
(0, class_validator_1.ValidateNested)(),
|
|
95
|
+
(0, class_transformer_1.Type)(() => RetentionAnalyticsFiltersDTO),
|
|
96
|
+
__metadata("design:type", RetentionAnalyticsFiltersDTO)
|
|
97
|
+
], RetentionAnalyticsRequestDTO.prototype, "filters", void 0);
|
|
98
|
+
// ========== MONTH RESULT ==========
|
|
99
|
+
/**
|
|
100
|
+
* Retention data for a month offset within a cohort
|
|
101
|
+
* Tracks how many users from the original cohort are still active
|
|
102
|
+
*/
|
|
103
|
+
class CohortRetentionMonthDTO {
|
|
104
|
+
retainedUsers;
|
|
105
|
+
retentionRate;
|
|
106
|
+
}
|
|
107
|
+
exports.CohortRetentionMonthDTO = CohortRetentionMonthDTO;
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, swagger_1.ApiProperty)({
|
|
110
|
+
description: 'Number of users from original cohort still active in this month offset',
|
|
111
|
+
example: 85
|
|
112
|
+
}),
|
|
113
|
+
__metadata("design:type", Number)
|
|
114
|
+
], CohortRetentionMonthDTO.prototype, "retainedUsers", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
(0, swagger_1.ApiProperty)({
|
|
117
|
+
description: 'Retention rate: (retainedUsers / cohortSize) * 100',
|
|
118
|
+
example: 70.8
|
|
119
|
+
}),
|
|
120
|
+
__metadata("design:type", Number)
|
|
121
|
+
], CohortRetentionMonthDTO.prototype, "retentionRate", void 0);
|
|
122
|
+
/**
|
|
123
|
+
* Cohort retention result for a single month
|
|
124
|
+
* Contains the cohort (new users in month) and their retention over subsequent months
|
|
125
|
+
*/
|
|
126
|
+
class RetentionMonthResultDTO {
|
|
127
|
+
monthKey;
|
|
128
|
+
startDate;
|
|
129
|
+
endDate;
|
|
130
|
+
cohortSize;
|
|
131
|
+
monthlyRetention;
|
|
132
|
+
byTriggerType;
|
|
133
|
+
}
|
|
134
|
+
exports.RetentionMonthResultDTO = RetentionMonthResultDTO;
|
|
135
|
+
__decorate([
|
|
136
|
+
(0, swagger_1.ApiProperty)({
|
|
137
|
+
description: 'Month identifier in YYYY-MM format',
|
|
138
|
+
example: '2026-02'
|
|
139
|
+
}),
|
|
140
|
+
__metadata("design:type", String)
|
|
141
|
+
], RetentionMonthResultDTO.prototype, "monthKey", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, swagger_1.ApiProperty)({
|
|
144
|
+
description: 'Start date of the month',
|
|
145
|
+
example: '2026-02-01T00:00:00Z'
|
|
146
|
+
}),
|
|
147
|
+
__metadata("design:type", Date)
|
|
148
|
+
], RetentionMonthResultDTO.prototype, "startDate", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
(0, swagger_1.ApiProperty)({
|
|
151
|
+
description: 'End date of the month',
|
|
152
|
+
example: '2026-03-01T00:00:00Z'
|
|
153
|
+
}),
|
|
154
|
+
__metadata("design:type", Date)
|
|
155
|
+
], RetentionMonthResultDTO.prototype, "endDate", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
(0, swagger_1.ApiProperty)({
|
|
158
|
+
description: 'Number of users who made their first transaction in this month (cohort size)',
|
|
159
|
+
example: 120
|
|
160
|
+
}),
|
|
161
|
+
__metadata("design:type", Number)
|
|
162
|
+
], RetentionMonthResultDTO.prototype, "cohortSize", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
(0, swagger_1.ApiProperty)({
|
|
165
|
+
description: 'Retention data for this cohort over subsequent months. Key is month offset (0=same month, 1=next month, 2=2 months later, etc.)',
|
|
166
|
+
type: 'object',
|
|
167
|
+
example: {
|
|
168
|
+
'0': { retainedUsers: 120, retentionRate: 100 },
|
|
169
|
+
'1': { retainedUsers: 85, retentionRate: 70.8 },
|
|
170
|
+
'2': { retainedUsers: 65, retentionRate: 54.2 }
|
|
171
|
+
}
|
|
172
|
+
}),
|
|
173
|
+
__metadata("design:type", Object)
|
|
174
|
+
], RetentionMonthResultDTO.prototype, "monthlyRetention", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
177
|
+
description: 'Breakdown of transactions by trigger type',
|
|
178
|
+
example: {
|
|
179
|
+
PURCHASE: { count: 800, uniqueUsers: 300 },
|
|
180
|
+
REWARD: { count: 450, uniqueUsers: 200 }
|
|
181
|
+
}
|
|
182
|
+
}),
|
|
183
|
+
__metadata("design:type", Object)
|
|
184
|
+
], RetentionMonthResultDTO.prototype, "byTriggerType", void 0);
|
|
185
|
+
// ========== RESPONSE ==========
|
|
186
|
+
class RetentionAnalyticsResponseDTO {
|
|
187
|
+
results;
|
|
188
|
+
totalMonths;
|
|
189
|
+
metadata;
|
|
190
|
+
}
|
|
191
|
+
exports.RetentionAnalyticsResponseDTO = RetentionAnalyticsResponseDTO;
|
|
192
|
+
__decorate([
|
|
193
|
+
(0, swagger_1.ApiProperty)({
|
|
194
|
+
description: 'Array of monthly retention results (ordered chronologically)',
|
|
195
|
+
type: [RetentionMonthResultDTO]
|
|
196
|
+
}),
|
|
197
|
+
__metadata("design:type", Array)
|
|
198
|
+
], RetentionAnalyticsResponseDTO.prototype, "results", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
(0, swagger_1.ApiProperty)({
|
|
201
|
+
description: 'Total number of months analyzed',
|
|
202
|
+
example: 13
|
|
203
|
+
}),
|
|
204
|
+
__metadata("design:type", Number)
|
|
205
|
+
], RetentionAnalyticsResponseDTO.prototype, "totalMonths", void 0);
|
|
206
|
+
__decorate([
|
|
207
|
+
(0, swagger_1.ApiProperty)({
|
|
208
|
+
description: 'Query metadata',
|
|
209
|
+
type: 'object'
|
|
210
|
+
}),
|
|
211
|
+
__metadata("design:type", Object)
|
|
212
|
+
], RetentionAnalyticsResponseDTO.prototype, "metadata", void 0);
|
|
213
|
+
//# sourceMappingURL=retention-analytics.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retention-analytics.dto.js","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/retention-analytics.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA8G;AAC9G,yDAAyC;AACzC,6CAAmE;AAEnE,qEAAiE;AAGjE;;;;;;;;;;;;;;;GAeG;AAEH,wCAAwC;AAExC,MAAa,4BAA4B;IAQvC,SAAS,CAAmB;IAQ5B,kBAAkB,CAAU;CAC7B;AAjBD,oEAiBC;AATC;IAPC,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,+BAA+B;QAC5C,IAAI,EAAE,oCAAgB;QACtB,OAAO,EAAE,oCAAgB,CAAC,MAAM;KACjC,CAAC;IACD,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,EAAC,oCAAgB,CAAC;;+DACG;AAQ5B;IANC,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,gCAAgC;QAC7C,OAAO,EAAE,UAAU;KACpB,CAAC;IACD,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;wEACiB;AAG9B,gCAAgC;AAEhC,MAAa,4BAA4B;IAOvC,UAAU,CAAQ;IAalB,UAAU,CAAU;IASpB,OAAO,CAAgC;CACxC;AA9BD,oEA8BC;AAvBC;IANC,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,mEAAmE;QAChF,OAAO,EAAE,sBAAsB;KAChC,CAAC;IACD,IAAA,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WAAW,EAAE,gBAAgB;QAC7B,IAAI,EAAE,QAAQ;KACf,CAAC;;+DAMA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SortOrder } from '../../..';
|
|
2
|
+
import type { NativeTokenType } from '../../types/native-token.type';
|
|
3
|
+
import { BaseAnalyticsMetadata } from './base-analytics.dto';
|
|
4
|
+
/**
|
|
5
|
+
* BUSINESS RANKING ANALYTICS DTOs
|
|
6
|
+
*
|
|
7
|
+
* Domain: Analytics (Cross-Domain Query)
|
|
8
|
+
* Purpose: Server-side aggregation of business transaction rankings
|
|
9
|
+
*
|
|
10
|
+
* Replaces:
|
|
11
|
+
* - Dual queries (modern + legacy business transactions)
|
|
12
|
+
* - Client-side merging logic in business-balances.component.ts
|
|
13
|
+
*
|
|
14
|
+
* Performance Impact:
|
|
15
|
+
* - 2 API calls → 1 API call (50% reduction)
|
|
16
|
+
* - ~60 lines removed from frontend
|
|
17
|
+
* - Server-side JOIN optimization
|
|
18
|
+
*/
|
|
19
|
+
export declare class BusinessRankingFiltersDTO {
|
|
20
|
+
businessId?: string;
|
|
21
|
+
tokenType?: NativeTokenType;
|
|
22
|
+
}
|
|
23
|
+
export declare class BusinessRankingAnalyticsRequestDTO {
|
|
24
|
+
filters?: BusinessRankingFiltersDTO;
|
|
25
|
+
sortBy?: 'totalTransactions' | 'tokenReceived' | 'businessId' | 'businessName';
|
|
26
|
+
sortOrder?: SortOrder;
|
|
27
|
+
limit?: number;
|
|
28
|
+
startDate?: Date;
|
|
29
|
+
endDate?: Date;
|
|
30
|
+
}
|
|
31
|
+
export declare class BusinessRankingResultItemDTO {
|
|
32
|
+
businessId: string | null;
|
|
33
|
+
businessName: string | null;
|
|
34
|
+
displayName: string | null;
|
|
35
|
+
accountAddress: string | null;
|
|
36
|
+
totalTransactions: number;
|
|
37
|
+
tokenReceived: number;
|
|
38
|
+
hasLegacyTransactions?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare class BusinessRankingAnalyticsResponseDTO {
|
|
41
|
+
results: BusinessRankingResultItemDTO[];
|
|
42
|
+
totalBusinesses: number;
|
|
43
|
+
metadata: BaseAnalyticsMetadata & {
|
|
44
|
+
/**
|
|
45
|
+
* Token type used for filtering (if provided in request)
|
|
46
|
+
*/
|
|
47
|
+
tokenType?: NativeTokenType;
|
|
48
|
+
/**
|
|
49
|
+
* Sort configuration applied
|
|
50
|
+
*/
|
|
51
|
+
sorting?: {
|
|
52
|
+
sortBy: string;
|
|
53
|
+
sortOrder: SortOrder;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=business-ranking-analytics.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"business-ranking-analytics.dto.d.ts","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/business-ranking-analytics.dto.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;;;;;;;;;;;GAcG;AAIH,qBAAa,yBAAyB;IASpC,UAAU,CAAC,EAAE,MAAM,CAAC;IASpB,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAID,qBAAa,kCAAkC;IAQ7C,OAAO,CAAC,EAAE,yBAAyB,CAAC;IAUpC,MAAM,CAAC,EAAE,mBAAmB,GAAG,eAAe,GAAG,YAAY,GAAG,cAAc,CAAC;IAU/E,SAAS,CAAC,EAAE,SAAS,CAAC;IAatB,KAAK,CAAC,EAAE,MAAM,CAAC;IAQf,SAAS,CAAC,EAAE,IAAI,CAAC;IAQjB,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB;AAID,qBAAa,4BAA4B;IAMvC,UAAU,EAAG,MAAM,GAAG,IAAI,CAAC;IAO3B,YAAY,EAAG,MAAM,GAAG,IAAI,CAAC;IAO7B,WAAW,EAAG,MAAM,GAAG,IAAI,CAAC;IAO5B,cAAc,EAAG,MAAM,GAAG,IAAI,CAAC;IAM/B,iBAAiB,EAAG,MAAM,CAAC;IAM3B,aAAa,EAAG,MAAM,CAAC;IAMvB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAID,qBAAa,mCAAmC;IAK9C,OAAO,EAAG,4BAA4B,EAAE,CAAC;IAMzC,eAAe,EAAG,MAAM,CAAC;IAMzB,QAAQ,EAAG,qBAAqB,GAAG;QACjC;;WAEG;QACH,SAAS,CAAC,EAAE,eAAe,CAAC;QAE5B;;WAEG;QACH,OAAO,CAAC,EAAE;YACR,MAAM,EAAE,MAAM,CAAC;YACf,SAAS,EAAE,SAAS,CAAC;SACtB,CAAC;KACH,CAAC;CACH"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { IsOptional, IsEnum, IsInt, Min, Max, IsDateString, ValidateNested, IsString } from 'class-validator';
|
|
8
|
+
import { Type } from 'class-transformer';
|
|
9
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
10
|
+
import { SortOrder } from '../../../index.js';
|
|
11
|
+
import { NativeTokenTypes } from '../../types/native-token.type.js';
|
|
12
|
+
/**
|
|
13
|
+
* BUSINESS RANKING ANALYTICS DTOs
|
|
14
|
+
*
|
|
15
|
+
* Domain: Analytics (Cross-Domain Query)
|
|
16
|
+
* Purpose: Server-side aggregation of business transaction rankings
|
|
17
|
+
*
|
|
18
|
+
* Replaces:
|
|
19
|
+
* - Dual queries (modern + legacy business transactions)
|
|
20
|
+
* - Client-side merging logic in business-balances.component.ts
|
|
21
|
+
*
|
|
22
|
+
* Performance Impact:
|
|
23
|
+
* - 2 API calls → 1 API call (50% reduction)
|
|
24
|
+
* - ~60 lines removed from frontend
|
|
25
|
+
* - Server-side JOIN optimization
|
|
26
|
+
*/
|
|
27
|
+
// ========== FILTERS ==========
|
|
28
|
+
export class BusinessRankingFiltersDTO {
|
|
29
|
+
businessId;
|
|
30
|
+
tokenType;
|
|
31
|
+
}
|
|
32
|
+
__decorate([
|
|
33
|
+
ApiPropertyOptional({
|
|
34
|
+
description: 'Filter to specific business by ID',
|
|
35
|
+
type: String,
|
|
36
|
+
format: 'uuid',
|
|
37
|
+
example: 'biz-uuid-123'
|
|
38
|
+
}),
|
|
39
|
+
IsOptional(),
|
|
40
|
+
IsString()
|
|
41
|
+
], BusinessRankingFiltersDTO.prototype, "businessId", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
ApiPropertyOptional({
|
|
44
|
+
description: 'Filter by specific token type',
|
|
45
|
+
enum: NativeTokenTypes,
|
|
46
|
+
example: NativeTokenTypes.ERC721
|
|
47
|
+
}),
|
|
48
|
+
IsOptional(),
|
|
49
|
+
IsEnum(NativeTokenTypes)
|
|
50
|
+
], BusinessRankingFiltersDTO.prototype, "tokenType", void 0);
|
|
51
|
+
// ========== REQUEST ==========
|
|
52
|
+
export class BusinessRankingAnalyticsRequestDTO {
|
|
53
|
+
filters;
|
|
54
|
+
sortBy;
|
|
55
|
+
sortOrder;
|
|
56
|
+
limit;
|
|
57
|
+
startDate;
|
|
58
|
+
endDate;
|
|
59
|
+
}
|
|
60
|
+
__decorate([
|
|
61
|
+
ApiPropertyOptional({
|
|
62
|
+
description: 'Filters for business ranking query',
|
|
63
|
+
type: BusinessRankingFiltersDTO
|
|
64
|
+
}),
|
|
65
|
+
IsOptional(),
|
|
66
|
+
ValidateNested(),
|
|
67
|
+
Type(() => BusinessRankingFiltersDTO)
|
|
68
|
+
], BusinessRankingAnalyticsRequestDTO.prototype, "filters", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
ApiPropertyOptional({
|
|
71
|
+
description: 'Field to sort results by',
|
|
72
|
+
enum: ['totalTransactions', 'tokenReceived', 'businessId', 'businessName'],
|
|
73
|
+
default: 'totalTransactions',
|
|
74
|
+
example: 'totalTransactions'
|
|
75
|
+
}),
|
|
76
|
+
IsOptional(),
|
|
77
|
+
IsString()
|
|
78
|
+
], BusinessRankingAnalyticsRequestDTO.prototype, "sortBy", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
ApiPropertyOptional({
|
|
81
|
+
description: 'Sort order (ASC or DESC)',
|
|
82
|
+
enum: SortOrder,
|
|
83
|
+
default: SortOrder.DESC,
|
|
84
|
+
example: SortOrder.DESC
|
|
85
|
+
}),
|
|
86
|
+
IsOptional(),
|
|
87
|
+
IsEnum(SortOrder)
|
|
88
|
+
], BusinessRankingAnalyticsRequestDTO.prototype, "sortOrder", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
ApiPropertyOptional({
|
|
91
|
+
description: 'Maximum number of results to return',
|
|
92
|
+
minimum: 1,
|
|
93
|
+
maximum: 1000,
|
|
94
|
+
default: 50,
|
|
95
|
+
example: 50
|
|
96
|
+
}),
|
|
97
|
+
IsOptional(),
|
|
98
|
+
IsInt(),
|
|
99
|
+
Min(1),
|
|
100
|
+
Max(1000)
|
|
101
|
+
], BusinessRankingAnalyticsRequestDTO.prototype, "limit", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
ApiPropertyOptional({
|
|
104
|
+
description: 'Start date for filtering transactions (ISO 8601)',
|
|
105
|
+
example: '2026-01-01T00:00:00Z'
|
|
106
|
+
}),
|
|
107
|
+
IsOptional(),
|
|
108
|
+
IsDateString()
|
|
109
|
+
], BusinessRankingAnalyticsRequestDTO.prototype, "startDate", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
ApiPropertyOptional({
|
|
112
|
+
description: 'End date for filtering transactions (ISO 8601)',
|
|
113
|
+
example: '2026-02-01T00:00:00Z'
|
|
114
|
+
}),
|
|
115
|
+
IsOptional(),
|
|
116
|
+
IsDateString()
|
|
117
|
+
], BusinessRankingAnalyticsRequestDTO.prototype, "endDate", void 0);
|
|
118
|
+
// ========== RESULT ITEM ==========
|
|
119
|
+
export class BusinessRankingResultItemDTO {
|
|
120
|
+
businessId;
|
|
121
|
+
businessName;
|
|
122
|
+
displayName;
|
|
123
|
+
accountAddress;
|
|
124
|
+
totalTransactions;
|
|
125
|
+
tokenReceived;
|
|
126
|
+
hasLegacyTransactions;
|
|
127
|
+
}
|
|
128
|
+
__decorate([
|
|
129
|
+
ApiProperty({
|
|
130
|
+
description: 'Business UUID (null for unidentified businesses)',
|
|
131
|
+
nullable: true,
|
|
132
|
+
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
133
|
+
})
|
|
134
|
+
], BusinessRankingResultItemDTO.prototype, "businessId", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
ApiProperty({
|
|
137
|
+
description: 'Business name',
|
|
138
|
+
nullable: true,
|
|
139
|
+
example: 'Acme Coffee Shop'
|
|
140
|
+
})
|
|
141
|
+
], BusinessRankingResultItemDTO.prototype, "businessName", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
ApiProperty({
|
|
144
|
+
description: 'Business display name',
|
|
145
|
+
nullable: true,
|
|
146
|
+
example: 'Acme Coffee'
|
|
147
|
+
})
|
|
148
|
+
], BusinessRankingResultItemDTO.prototype, "displayName", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
ApiProperty({
|
|
151
|
+
description: 'Business blockchain account address',
|
|
152
|
+
nullable: true,
|
|
153
|
+
example: '0x1234567890abcdef...'
|
|
154
|
+
})
|
|
155
|
+
], BusinessRankingResultItemDTO.prototype, "accountAddress", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
ApiProperty({
|
|
158
|
+
description: 'Total number of successful transactions received',
|
|
159
|
+
example: 150
|
|
160
|
+
})
|
|
161
|
+
], BusinessRankingResultItemDTO.prototype, "totalTransactions", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
ApiProperty({
|
|
164
|
+
description: 'Total token amount received',
|
|
165
|
+
example: 1500.50
|
|
166
|
+
})
|
|
167
|
+
], BusinessRankingResultItemDTO.prototype, "tokenReceived", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
ApiPropertyOptional({
|
|
170
|
+
description: 'Whether this business has legacy transactions (address-based)',
|
|
171
|
+
example: false
|
|
172
|
+
})
|
|
173
|
+
], BusinessRankingResultItemDTO.prototype, "hasLegacyTransactions", void 0);
|
|
174
|
+
// ========== RESPONSE ==========
|
|
175
|
+
export class BusinessRankingAnalyticsResponseDTO {
|
|
176
|
+
results;
|
|
177
|
+
totalBusinesses;
|
|
178
|
+
metadata;
|
|
179
|
+
}
|
|
180
|
+
__decorate([
|
|
181
|
+
ApiProperty({
|
|
182
|
+
description: 'Array of business ranking results',
|
|
183
|
+
type: [BusinessRankingResultItemDTO]
|
|
184
|
+
})
|
|
185
|
+
], BusinessRankingAnalyticsResponseDTO.prototype, "results", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
ApiProperty({
|
|
188
|
+
description: 'Total number of businesses in results',
|
|
189
|
+
example: 25
|
|
190
|
+
})
|
|
191
|
+
], BusinessRankingAnalyticsResponseDTO.prototype, "totalBusinesses", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
ApiProperty({
|
|
194
|
+
description: 'Query metadata',
|
|
195
|
+
type: 'object'
|
|
196
|
+
})
|
|
197
|
+
], BusinessRankingAnalyticsResponseDTO.prototype, "metadata", void 0);
|
|
198
|
+
//# sourceMappingURL=business-ranking-analytics.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"business-ranking-analytics.dto.js","sourceRoot":"","sources":["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'./group-by-expression.dto';
|
|
4
|
+
export * from './retention-analytics.dto';
|
|
3
5
|
export * from './usage-analytics.dto';
|
|
4
6
|
export * from './user-ranking-analytics.dto';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/index.ts"],"names":[],"mappings":"AAEA,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/index.ts"],"names":[],"mappings":"AAEA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './base-analytics.dto.js';
|
|
2
|
+
export * from './business-ranking-analytics.dto.js';
|
|
2
3
|
export * from './group-by-expression.dto.js';
|
|
4
|
+
export * from './retention-analytics.dto.js';
|
|
3
5
|
export * from './usage-analytics.dto.js';
|
|
4
6
|
export * from './user-ranking-analytics.dto.js';
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/index.ts"],"names":[],"mappings":"AAEA,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/index.ts"],"names":[],"mappings":"AAEA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { NativeTokenType } from '../../types/native-token.type';
|
|
2
|
+
import { BaseAnalyticsMetadata } from './base-analytics.dto';
|
|
3
|
+
/**
|
|
4
|
+
* RETENTION ANALYTICS DTOs
|
|
5
|
+
*
|
|
6
|
+
* Domain: Analytics (Cross-Domain Query)
|
|
7
|
+
* Purpose: Server-side monthly retention calculations
|
|
8
|
+
*
|
|
9
|
+
* Replaces:
|
|
10
|
+
* - 13 separate API calls (one per month)
|
|
11
|
+
* - Client-side forkJoin aggregation
|
|
12
|
+
* - Manual month generation logic
|
|
13
|
+
*
|
|
14
|
+
* Performance Impact:
|
|
15
|
+
* - 13 API calls → 1 API call (92% reduction)
|
|
16
|
+
* - ~1350ms → ~105ms load time (92% faster)
|
|
17
|
+
* - ~260KB → ~40KB payload (85% smaller)
|
|
18
|
+
*/
|
|
19
|
+
export declare class RetentionAnalyticsFiltersDTO {
|
|
20
|
+
tokenType?: NativeTokenType;
|
|
21
|
+
triggerProcessType?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare class RetentionAnalyticsRequestDTO {
|
|
24
|
+
startMonth?: Date;
|
|
25
|
+
monthsBack?: number;
|
|
26
|
+
filters?: RetentionAnalyticsFiltersDTO;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Retention data for a month offset within a cohort
|
|
30
|
+
* Tracks how many users from the original cohort are still active
|
|
31
|
+
*/
|
|
32
|
+
export declare class CohortRetentionMonthDTO {
|
|
33
|
+
retainedUsers: number;
|
|
34
|
+
retentionRate: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Cohort retention result for a single month
|
|
38
|
+
* Contains the cohort (new users in month) and their retention over subsequent months
|
|
39
|
+
*/
|
|
40
|
+
export declare class RetentionMonthResultDTO {
|
|
41
|
+
monthKey: string;
|
|
42
|
+
startDate: Date;
|
|
43
|
+
endDate: Date;
|
|
44
|
+
cohortSize: number;
|
|
45
|
+
monthlyRetention: {
|
|
46
|
+
[monthOffset: string]: CohortRetentionMonthDTO;
|
|
47
|
+
};
|
|
48
|
+
byTriggerType?: {
|
|
49
|
+
[key: string]: {
|
|
50
|
+
count: number;
|
|
51
|
+
uniqueUsers: number;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export declare class RetentionAnalyticsResponseDTO {
|
|
56
|
+
results: RetentionMonthResultDTO[];
|
|
57
|
+
totalMonths: number;
|
|
58
|
+
metadata: BaseAnalyticsMetadata & {
|
|
59
|
+
/**
|
|
60
|
+
* Calculation method used for retention analysis
|
|
61
|
+
*/
|
|
62
|
+
calculationMethod: 'monthly-cohort';
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=retention-analytics.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retention-analytics.dto.d.ts","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/retention-analytics.dto.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AAIH,qBAAa,4BAA4B;IAQvC,SAAS,CAAC,EAAE,eAAe,CAAC;IAQ5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAID,qBAAa,4BAA4B;IAOvC,UAAU,CAAC,EAAE,IAAI,CAAC;IAalB,UAAU,CAAC,EAAE,MAAM,CAAC;IASpB,OAAO,CAAC,EAAE,4BAA4B,CAAC;CACxC;AAID;;;GAGG;AACH,qBAAa,uBAAuB;IAKlC,aAAa,EAAG,MAAM,CAAC;IAMvB,aAAa,EAAG,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,qBAAa,uBAAuB;IAKlC,QAAQ,EAAG,MAAM,CAAC;IAMlB,SAAS,EAAG,IAAI,CAAC;IAMjB,OAAO,EAAG,IAAI,CAAC;IAMf,UAAU,EAAG,MAAM,CAAC;IAWpB,gBAAgB,EAAG;QACjB,CAAC,WAAW,EAAE,MAAM,GAAG,uBAAuB,CAAC;KAChD,CAAC;IASF,aAAa,CAAC,EAAE;QACd,CAAC,GAAG,EAAE,MAAM,GAAG;YACb,KAAK,EAAE,MAAM,CAAC;YACd,WAAW,EAAE,MAAM,CAAC;SACrB,CAAC;KACH,CAAC;CACH;AAID,qBAAa,6BAA6B;IAKxC,OAAO,EAAG,uBAAuB,EAAE,CAAC;IAMpC,WAAW,EAAG,MAAM,CAAC;IAMrB,QAAQ,EAAG,qBAAqB,GAAG;QACjC;;WAEG;QACH,iBAAiB,EAAE,gBAAgB,CAAC;KACrC,CAAC;CACH"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { IsOptional, IsEnum, IsInt, Min, Max, IsDateString, ValidateNested, IsString } from 'class-validator';
|
|
8
|
+
import { Type } from 'class-transformer';
|
|
9
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
10
|
+
import { NativeTokenTypes } from '../../types/native-token.type.js';
|
|
11
|
+
/**
|
|
12
|
+
* RETENTION ANALYTICS DTOs
|
|
13
|
+
*
|
|
14
|
+
* Domain: Analytics (Cross-Domain Query)
|
|
15
|
+
* Purpose: Server-side monthly retention calculations
|
|
16
|
+
*
|
|
17
|
+
* Replaces:
|
|
18
|
+
* - 13 separate API calls (one per month)
|
|
19
|
+
* - Client-side forkJoin aggregation
|
|
20
|
+
* - Manual month generation logic
|
|
21
|
+
*
|
|
22
|
+
* Performance Impact:
|
|
23
|
+
* - 13 API calls → 1 API call (92% reduction)
|
|
24
|
+
* - ~1350ms → ~105ms load time (92% faster)
|
|
25
|
+
* - ~260KB → ~40KB payload (85% smaller)
|
|
26
|
+
*/
|
|
27
|
+
// ========== REQUEST FILTERS ==========
|
|
28
|
+
export class RetentionAnalyticsFiltersDTO {
|
|
29
|
+
tokenType;
|
|
30
|
+
triggerProcessType;
|
|
31
|
+
}
|
|
32
|
+
__decorate([
|
|
33
|
+
ApiPropertyOptional({
|
|
34
|
+
description: 'Filter by specific token type',
|
|
35
|
+
enum: NativeTokenTypes,
|
|
36
|
+
example: NativeTokenTypes.ERC721
|
|
37
|
+
}),
|
|
38
|
+
IsOptional(),
|
|
39
|
+
IsEnum(NativeTokenTypes)
|
|
40
|
+
], RetentionAnalyticsFiltersDTO.prototype, "tokenType", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
ApiPropertyOptional({
|
|
43
|
+
description: 'Filter by trigger process type',
|
|
44
|
+
example: 'PURCHASE'
|
|
45
|
+
}),
|
|
46
|
+
IsOptional(),
|
|
47
|
+
IsString()
|
|
48
|
+
], RetentionAnalyticsFiltersDTO.prototype, "triggerProcessType", void 0);
|
|
49
|
+
// ========== REQUEST ==========
|
|
50
|
+
export class RetentionAnalyticsRequestDTO {
|
|
51
|
+
startMonth;
|
|
52
|
+
monthsBack;
|
|
53
|
+
filters;
|
|
54
|
+
}
|
|
55
|
+
__decorate([
|
|
56
|
+
ApiPropertyOptional({
|
|
57
|
+
description: 'Starting month for retention analysis (defaults to current month)',
|
|
58
|
+
example: '2026-02-01T00:00:00Z'
|
|
59
|
+
}),
|
|
60
|
+
IsOptional(),
|
|
61
|
+
IsDateString()
|
|
62
|
+
], RetentionAnalyticsRequestDTO.prototype, "startMonth", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
ApiPropertyOptional({
|
|
65
|
+
description: 'Number of months to analyze (looking backwards)',
|
|
66
|
+
minimum: 1,
|
|
67
|
+
maximum: 24,
|
|
68
|
+
default: 13,
|
|
69
|
+
example: 13
|
|
70
|
+
}),
|
|
71
|
+
IsOptional(),
|
|
72
|
+
IsInt(),
|
|
73
|
+
Min(1),
|
|
74
|
+
Max(24)
|
|
75
|
+
], RetentionAnalyticsRequestDTO.prototype, "monthsBack", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
ApiPropertyOptional({
|
|
78
|
+
description: 'Optional filters for retention query',
|
|
79
|
+
type: RetentionAnalyticsFiltersDTO
|
|
80
|
+
}),
|
|
81
|
+
IsOptional(),
|
|
82
|
+
ValidateNested(),
|
|
83
|
+
Type(() => RetentionAnalyticsFiltersDTO)
|
|
84
|
+
], RetentionAnalyticsRequestDTO.prototype, "filters", void 0);
|
|
85
|
+
// ========== MONTH RESULT ==========
|
|
86
|
+
/**
|
|
87
|
+
* Retention data for a month offset within a cohort
|
|
88
|
+
* Tracks how many users from the original cohort are still active
|
|
89
|
+
*/
|
|
90
|
+
export class CohortRetentionMonthDTO {
|
|
91
|
+
retainedUsers;
|
|
92
|
+
retentionRate;
|
|
93
|
+
}
|
|
94
|
+
__decorate([
|
|
95
|
+
ApiProperty({
|
|
96
|
+
description: 'Number of users from original cohort still active in this month offset',
|
|
97
|
+
example: 85
|
|
98
|
+
})
|
|
99
|
+
], CohortRetentionMonthDTO.prototype, "retainedUsers", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
ApiProperty({
|
|
102
|
+
description: 'Retention rate: (retainedUsers / cohortSize) * 100',
|
|
103
|
+
example: 70.8
|
|
104
|
+
})
|
|
105
|
+
], CohortRetentionMonthDTO.prototype, "retentionRate", void 0);
|
|
106
|
+
/**
|
|
107
|
+
* Cohort retention result for a single month
|
|
108
|
+
* Contains the cohort (new users in month) and their retention over subsequent months
|
|
109
|
+
*/
|
|
110
|
+
export class RetentionMonthResultDTO {
|
|
111
|
+
monthKey;
|
|
112
|
+
startDate;
|
|
113
|
+
endDate;
|
|
114
|
+
cohortSize;
|
|
115
|
+
monthlyRetention;
|
|
116
|
+
byTriggerType;
|
|
117
|
+
}
|
|
118
|
+
__decorate([
|
|
119
|
+
ApiProperty({
|
|
120
|
+
description: 'Month identifier in YYYY-MM format',
|
|
121
|
+
example: '2026-02'
|
|
122
|
+
})
|
|
123
|
+
], RetentionMonthResultDTO.prototype, "monthKey", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
ApiProperty({
|
|
126
|
+
description: 'Start date of the month',
|
|
127
|
+
example: '2026-02-01T00:00:00Z'
|
|
128
|
+
})
|
|
129
|
+
], RetentionMonthResultDTO.prototype, "startDate", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
ApiProperty({
|
|
132
|
+
description: 'End date of the month',
|
|
133
|
+
example: '2026-03-01T00:00:00Z'
|
|
134
|
+
})
|
|
135
|
+
], RetentionMonthResultDTO.prototype, "endDate", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
ApiProperty({
|
|
138
|
+
description: 'Number of users who made their first transaction in this month (cohort size)',
|
|
139
|
+
example: 120
|
|
140
|
+
})
|
|
141
|
+
], RetentionMonthResultDTO.prototype, "cohortSize", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
ApiProperty({
|
|
144
|
+
description: 'Retention data for this cohort over subsequent months. Key is month offset (0=same month, 1=next month, 2=2 months later, etc.)',
|
|
145
|
+
type: 'object',
|
|
146
|
+
example: {
|
|
147
|
+
'0': { retainedUsers: 120, retentionRate: 100 },
|
|
148
|
+
'1': { retainedUsers: 85, retentionRate: 70.8 },
|
|
149
|
+
'2': { retainedUsers: 65, retentionRate: 54.2 }
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
], RetentionMonthResultDTO.prototype, "monthlyRetention", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
ApiPropertyOptional({
|
|
155
|
+
description: 'Breakdown of transactions by trigger type',
|
|
156
|
+
example: {
|
|
157
|
+
PURCHASE: { count: 800, uniqueUsers: 300 },
|
|
158
|
+
REWARD: { count: 450, uniqueUsers: 200 }
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
], RetentionMonthResultDTO.prototype, "byTriggerType", void 0);
|
|
162
|
+
// ========== RESPONSE ==========
|
|
163
|
+
export class RetentionAnalyticsResponseDTO {
|
|
164
|
+
results;
|
|
165
|
+
totalMonths;
|
|
166
|
+
metadata;
|
|
167
|
+
}
|
|
168
|
+
__decorate([
|
|
169
|
+
ApiProperty({
|
|
170
|
+
description: 'Array of monthly retention results (ordered chronologically)',
|
|
171
|
+
type: [RetentionMonthResultDTO]
|
|
172
|
+
})
|
|
173
|
+
], RetentionAnalyticsResponseDTO.prototype, "results", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
ApiProperty({
|
|
176
|
+
description: 'Total number of months analyzed',
|
|
177
|
+
example: 13
|
|
178
|
+
})
|
|
179
|
+
], RetentionAnalyticsResponseDTO.prototype, "totalMonths", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
ApiProperty({
|
|
182
|
+
description: 'Query metadata',
|
|
183
|
+
type: 'object'
|
|
184
|
+
})
|
|
185
|
+
], RetentionAnalyticsResponseDTO.prototype, "metadata", void 0);
|
|
186
|
+
//# sourceMappingURL=retention-analytics.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retention-analytics.dto.js","sourceRoot":"","sources":["../../../../../src/shared-lib/dto/analytics/retention-analytics.dto.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MAA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