@aepstore-dev/contracts 1.41.0 → 1.42.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.
- package/dist/gen/activity.d.ts +170 -0
- package/dist/gen/activity.js +62 -0
- package/dist/gen/auth.d.ts +220 -0
- package/dist/gen/auth.js +49 -0
- package/dist/gen/mail.d.ts +70 -0
- package/dist/gen/mail.js +34 -0
- package/dist/gen/payments.d.ts +603 -0
- package/dist/gen/payments.js +57 -0
- package/dist/gen/products.d.ts +401 -0
- package/dist/gen/products.js +80 -0
- package/dist/gen/support.d.ts +139 -0
- package/dist/gen/support.js +38 -0
- package/dist/gen/taxonomy.d.ts +109 -0
- package/dist/gen/taxonomy.js +36 -0
- package/dist/gen/upload.d.ts +193 -0
- package/dist/gen/upload.js +54 -0
- package/dist/gen/users.d.ts +639 -0
- package/dist/gen/users.js +84 -0
- package/package.json +14 -5
- package/gen/activity.ts +0 -270
- package/gen/auth.ts +0 -317
- package/gen/mail.ts +0 -121
- package/gen/payments.ts +0 -828
- package/gen/products.ts +0 -579
- package/gen/support.ts +0 -220
- package/gen/taxonomy.ts +0 -185
- package/gen/upload.ts +0 -287
- package/gen/users.ts +0 -929
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{proto → src/proto}/index.d.ts +0 -0
- /package/dist/{proto → src/proto}/index.js +0 -0
- /package/dist/{proto → src/proto}/paths.d.ts +0 -0
- /package/dist/{proto → src/proto}/paths.js +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.10.1
|
|
5
|
+
// protoc v7.35.0
|
|
6
|
+
// source: users.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.USERS_SERVICE_NAME = exports.USERS_V1_PACKAGE_NAME = exports.PremiumPeriod = exports.UserFieldsType = exports.protobufPackage = void 0;
|
|
9
|
+
exports.UsersServiceControllerMethods = UsersServiceControllerMethods;
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
12
|
+
exports.protobufPackage = "users.v1";
|
|
13
|
+
var UserFieldsType;
|
|
14
|
+
(function (UserFieldsType) {
|
|
15
|
+
UserFieldsType[UserFieldsType["USER_FIELDS_TYPE_UNSPECIFIED"] = 0] = "USER_FIELDS_TYPE_UNSPECIFIED";
|
|
16
|
+
UserFieldsType[UserFieldsType["USER_FIELDS_TYPE_VIDEOS"] = 1] = "USER_FIELDS_TYPE_VIDEOS";
|
|
17
|
+
UserFieldsType[UserFieldsType["USER_FIELDS_TYPE_PRODUCTS"] = 2] = "USER_FIELDS_TYPE_PRODUCTS";
|
|
18
|
+
UserFieldsType[UserFieldsType["USER_FIELDS_TYPE_SUBSCRIPTIONS"] = 3] = "USER_FIELDS_TYPE_SUBSCRIPTIONS";
|
|
19
|
+
UserFieldsType[UserFieldsType["USER_FIELDS_TYPE_SUBSCRIBERS"] = 4] = "USER_FIELDS_TYPE_SUBSCRIBERS";
|
|
20
|
+
UserFieldsType[UserFieldsType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
21
|
+
})(UserFieldsType || (exports.UserFieldsType = UserFieldsType = {}));
|
|
22
|
+
/** Periods mirror PremiumPeriod enum in schema.prisma. */
|
|
23
|
+
var PremiumPeriod;
|
|
24
|
+
(function (PremiumPeriod) {
|
|
25
|
+
PremiumPeriod[PremiumPeriod["PREMIUM_PERIOD_UNSPECIFIED"] = 0] = "PREMIUM_PERIOD_UNSPECIFIED";
|
|
26
|
+
PremiumPeriod[PremiumPeriod["PREMIUM_PERIOD_MONTH_1"] = 1] = "PREMIUM_PERIOD_MONTH_1";
|
|
27
|
+
PremiumPeriod[PremiumPeriod["PREMIUM_PERIOD_MONTH_3"] = 2] = "PREMIUM_PERIOD_MONTH_3";
|
|
28
|
+
PremiumPeriod[PremiumPeriod["PREMIUM_PERIOD_MONTH_6"] = 3] = "PREMIUM_PERIOD_MONTH_6";
|
|
29
|
+
PremiumPeriod[PremiumPeriod["PREMIUM_PERIOD_MONTH_12"] = 4] = "PREMIUM_PERIOD_MONTH_12";
|
|
30
|
+
PremiumPeriod[PremiumPeriod["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
31
|
+
})(PremiumPeriod || (exports.PremiumPeriod = PremiumPeriod = {}));
|
|
32
|
+
exports.USERS_V1_PACKAGE_NAME = "users.v1";
|
|
33
|
+
function UsersServiceControllerMethods() {
|
|
34
|
+
return function (constructor) {
|
|
35
|
+
const grpcMethods = [
|
|
36
|
+
"getPublicProfile",
|
|
37
|
+
"updateProfile",
|
|
38
|
+
"updateUser",
|
|
39
|
+
"updateUserRole",
|
|
40
|
+
"getUsers",
|
|
41
|
+
"getActiveDevices",
|
|
42
|
+
"manageDevices",
|
|
43
|
+
"getUserFields",
|
|
44
|
+
"createSubscription",
|
|
45
|
+
"deleteSubscription",
|
|
46
|
+
"banUser",
|
|
47
|
+
"unbanUser",
|
|
48
|
+
"getMyPremium",
|
|
49
|
+
"setPremiumAutoRenew",
|
|
50
|
+
"activatePremium",
|
|
51
|
+
"isPremiumActive",
|
|
52
|
+
"listAvatarBorders",
|
|
53
|
+
"upsertAvatarBorder",
|
|
54
|
+
"deleteAvatarBorder",
|
|
55
|
+
"updatePrivacy",
|
|
56
|
+
"updateEmailPrefs",
|
|
57
|
+
"updateLocale",
|
|
58
|
+
"softDeleteAccount",
|
|
59
|
+
"restoreAccount",
|
|
60
|
+
"hardDeletePending",
|
|
61
|
+
"blockUser",
|
|
62
|
+
"unblockUser",
|
|
63
|
+
"listBlockedUsers",
|
|
64
|
+
"isBlocked",
|
|
65
|
+
"requestDataExport",
|
|
66
|
+
"listDataExports",
|
|
67
|
+
"pickPendingDataExport",
|
|
68
|
+
"completeDataExport",
|
|
69
|
+
"collectUserExportData",
|
|
70
|
+
"getAccountSettings",
|
|
71
|
+
"changePassword",
|
|
72
|
+
];
|
|
73
|
+
for (const method of grpcMethods) {
|
|
74
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
75
|
+
(0, microservices_1.GrpcMethod)("UsersService", method)(constructor.prototype[method], method, descriptor);
|
|
76
|
+
}
|
|
77
|
+
const grpcStreamMethods = [];
|
|
78
|
+
for (const method of grpcStreamMethods) {
|
|
79
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
80
|
+
(0, microservices_1.GrpcStreamMethod)("UsersService", method)(constructor.prototype[method], method, descriptor);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
exports.USERS_SERVICE_NAME = "UsersService";
|
package/package.json
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aepstore-dev/contracts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.0",
|
|
4
4
|
"description": "Protobuf definitions for aepstore microservices",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
5
|
+
"main": "./dist/src/index.js",
|
|
6
|
+
"types": "./dist/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/src/index.d.ts",
|
|
10
|
+
"default": "./dist/src/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./gen/*": {
|
|
13
|
+
"types": "./dist/gen/*.d.ts",
|
|
14
|
+
"default": "./dist/gen/*.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
7
17
|
"scripts": {
|
|
8
18
|
"generate": "node scripts/generate.cjs",
|
|
9
19
|
"build": "tsc -p tsconfig.build.json"
|
|
10
20
|
},
|
|
11
21
|
"files": [
|
|
12
22
|
"dist",
|
|
13
|
-
"proto"
|
|
14
|
-
"gen"
|
|
23
|
+
"proto"
|
|
15
24
|
],
|
|
16
25
|
"publishConfig": {
|
|
17
26
|
"access": "public"
|
package/gen/activity.ts
DELETED
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
-
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.10.1
|
|
4
|
-
// protoc v7.35.0
|
|
5
|
-
// source: activity.proto
|
|
6
|
-
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
-
import { Observable } from "rxjs";
|
|
10
|
-
|
|
11
|
-
export const protobufPackage = "activity.v1";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Member names match the DB enum string values exactly (enums: String on the
|
|
15
|
-
* wire), so DB values pass straight through with no mapping. UNSPECIFIED=0
|
|
16
|
-
* represents "no value / not provided" (e.g. an optional list filter).
|
|
17
|
-
*/
|
|
18
|
-
export enum ReportType {
|
|
19
|
-
REPORT_TYPE_UNSPECIFIED = 0,
|
|
20
|
-
PRODUCT = 1,
|
|
21
|
-
PROFILE = 2,
|
|
22
|
-
REVIEW = 3,
|
|
23
|
-
UNRECOGNIZED = -1,
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export enum ReportStatus {
|
|
27
|
-
REPORT_STATUS_UNSPECIFIED = 0,
|
|
28
|
-
PENDING = 1,
|
|
29
|
-
IN_PROGRESS = 2,
|
|
30
|
-
RESOLVED = 3,
|
|
31
|
-
DISMISSED = 4,
|
|
32
|
-
UNRECOGNIZED = -1,
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface Report {
|
|
36
|
-
id: string;
|
|
37
|
-
type: ReportType;
|
|
38
|
-
objectId: string;
|
|
39
|
-
userId: string;
|
|
40
|
-
productId: string;
|
|
41
|
-
categories: ReportCategory[];
|
|
42
|
-
message: string;
|
|
43
|
-
status: ReportStatus;
|
|
44
|
-
createdAt: string;
|
|
45
|
-
updatedAt: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface ReportResponse {
|
|
49
|
-
report: Report | undefined;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface CreateReportRequest {
|
|
53
|
-
userId: string;
|
|
54
|
-
type: ReportType;
|
|
55
|
-
objectId: string;
|
|
56
|
-
/** names */
|
|
57
|
-
categories: string[];
|
|
58
|
-
message: string;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface ListReportsRequest {
|
|
62
|
-
type: ReportType;
|
|
63
|
-
status: ReportStatus;
|
|
64
|
-
userId: string;
|
|
65
|
-
objectId: string;
|
|
66
|
-
page: number;
|
|
67
|
-
limit: number;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface ReportsListResponse {
|
|
71
|
-
items: Report[];
|
|
72
|
-
total: number;
|
|
73
|
-
page: number;
|
|
74
|
-
limit: number;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface ReportIdRequest {
|
|
78
|
-
id: string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface ModerateReportRequest {
|
|
82
|
-
id: string;
|
|
83
|
-
/** 'accept' | 'reject' */
|
|
84
|
-
action: string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export interface ReportCategory {
|
|
88
|
-
id: string;
|
|
89
|
-
name: string;
|
|
90
|
-
type: ReportType;
|
|
91
|
-
icon: string;
|
|
92
|
-
description: string;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export interface ReportCategoryResponse {
|
|
96
|
-
category: ReportCategory | undefined;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface CreateReportCategoryRequest {
|
|
100
|
-
name: string;
|
|
101
|
-
type: ReportType;
|
|
102
|
-
icon: string;
|
|
103
|
-
description: string;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export interface UpdateReportCategoryRequest {
|
|
107
|
-
id: string;
|
|
108
|
-
name: string;
|
|
109
|
-
icon: string;
|
|
110
|
-
description: string;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface ListReportCategoriesRequest {
|
|
114
|
-
type: ReportType;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export interface ReportCategoriesListResponse {
|
|
118
|
-
items: ReportCategory[];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface ReportCategoryIdRequest {
|
|
122
|
-
id: string;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface ReviewUser {
|
|
126
|
-
id: string;
|
|
127
|
-
username: string;
|
|
128
|
-
avatarUrl: string;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export interface Review {
|
|
132
|
-
id: string;
|
|
133
|
-
rating: number;
|
|
134
|
-
text: string;
|
|
135
|
-
productId: string;
|
|
136
|
-
createdAt: string;
|
|
137
|
-
updatedAt: string;
|
|
138
|
-
user: ReviewUser | undefined;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export interface ReviewResponse {
|
|
142
|
-
review: Review | undefined;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export interface CreateReviewRequest {
|
|
146
|
-
userId: string;
|
|
147
|
-
productId: string;
|
|
148
|
-
rating: number;
|
|
149
|
-
text: string;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface GetProductReviewsRequest {
|
|
153
|
-
productId: string;
|
|
154
|
-
page: number;
|
|
155
|
-
limit: number;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface ReviewsListResponse {
|
|
159
|
-
items: Review[];
|
|
160
|
-
total: number;
|
|
161
|
-
page: number;
|
|
162
|
-
limit: number;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export interface Ok {
|
|
166
|
-
ok: boolean;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export const ACTIVITY_V1_PACKAGE_NAME = "activity.v1";
|
|
170
|
-
|
|
171
|
-
export interface ActivityServiceClient {
|
|
172
|
-
/** Reports */
|
|
173
|
-
|
|
174
|
-
reportCreate(request: CreateReportRequest): Observable<ReportResponse>;
|
|
175
|
-
|
|
176
|
-
reportList(request: ListReportsRequest): Observable<ReportsListResponse>;
|
|
177
|
-
|
|
178
|
-
reportGet(request: ReportIdRequest): Observable<ReportResponse>;
|
|
179
|
-
|
|
180
|
-
reportModerate(request: ModerateReportRequest): Observable<ReportResponse>;
|
|
181
|
-
|
|
182
|
-
/** Report categories */
|
|
183
|
-
|
|
184
|
-
reportCategoryCreate(request: CreateReportCategoryRequest): Observable<ReportCategoryResponse>;
|
|
185
|
-
|
|
186
|
-
reportCategoryList(request: ListReportCategoriesRequest): Observable<ReportCategoriesListResponse>;
|
|
187
|
-
|
|
188
|
-
reportCategoryGet(request: ReportCategoryIdRequest): Observable<ReportCategoryResponse>;
|
|
189
|
-
|
|
190
|
-
reportCategoryUpdate(request: UpdateReportCategoryRequest): Observable<ReportCategoryResponse>;
|
|
191
|
-
|
|
192
|
-
reportCategoryDelete(request: ReportCategoryIdRequest): Observable<Ok>;
|
|
193
|
-
|
|
194
|
-
/** Reviews */
|
|
195
|
-
|
|
196
|
-
reviewCreate(request: CreateReviewRequest): Observable<ReviewResponse>;
|
|
197
|
-
|
|
198
|
-
getProductReviews(request: GetProductReviewsRequest): Observable<ReviewsListResponse>;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export interface ActivityServiceController {
|
|
202
|
-
/** Reports */
|
|
203
|
-
|
|
204
|
-
reportCreate(request: CreateReportRequest): Promise<ReportResponse> | Observable<ReportResponse> | ReportResponse;
|
|
205
|
-
|
|
206
|
-
reportList(
|
|
207
|
-
request: ListReportsRequest,
|
|
208
|
-
): Promise<ReportsListResponse> | Observable<ReportsListResponse> | ReportsListResponse;
|
|
209
|
-
|
|
210
|
-
reportGet(request: ReportIdRequest): Promise<ReportResponse> | Observable<ReportResponse> | ReportResponse;
|
|
211
|
-
|
|
212
|
-
reportModerate(request: ModerateReportRequest): Promise<ReportResponse> | Observable<ReportResponse> | ReportResponse;
|
|
213
|
-
|
|
214
|
-
/** Report categories */
|
|
215
|
-
|
|
216
|
-
reportCategoryCreate(
|
|
217
|
-
request: CreateReportCategoryRequest,
|
|
218
|
-
): Promise<ReportCategoryResponse> | Observable<ReportCategoryResponse> | ReportCategoryResponse;
|
|
219
|
-
|
|
220
|
-
reportCategoryList(
|
|
221
|
-
request: ListReportCategoriesRequest,
|
|
222
|
-
): Promise<ReportCategoriesListResponse> | Observable<ReportCategoriesListResponse> | ReportCategoriesListResponse;
|
|
223
|
-
|
|
224
|
-
reportCategoryGet(
|
|
225
|
-
request: ReportCategoryIdRequest,
|
|
226
|
-
): Promise<ReportCategoryResponse> | Observable<ReportCategoryResponse> | ReportCategoryResponse;
|
|
227
|
-
|
|
228
|
-
reportCategoryUpdate(
|
|
229
|
-
request: UpdateReportCategoryRequest,
|
|
230
|
-
): Promise<ReportCategoryResponse> | Observable<ReportCategoryResponse> | ReportCategoryResponse;
|
|
231
|
-
|
|
232
|
-
reportCategoryDelete(request: ReportCategoryIdRequest): Promise<Ok> | Observable<Ok> | Ok;
|
|
233
|
-
|
|
234
|
-
/** Reviews */
|
|
235
|
-
|
|
236
|
-
reviewCreate(request: CreateReviewRequest): Promise<ReviewResponse> | Observable<ReviewResponse> | ReviewResponse;
|
|
237
|
-
|
|
238
|
-
getProductReviews(
|
|
239
|
-
request: GetProductReviewsRequest,
|
|
240
|
-
): Promise<ReviewsListResponse> | Observable<ReviewsListResponse> | ReviewsListResponse;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export function ActivityServiceControllerMethods() {
|
|
244
|
-
return function (constructor: Function) {
|
|
245
|
-
const grpcMethods: string[] = [
|
|
246
|
-
"reportCreate",
|
|
247
|
-
"reportList",
|
|
248
|
-
"reportGet",
|
|
249
|
-
"reportModerate",
|
|
250
|
-
"reportCategoryCreate",
|
|
251
|
-
"reportCategoryList",
|
|
252
|
-
"reportCategoryGet",
|
|
253
|
-
"reportCategoryUpdate",
|
|
254
|
-
"reportCategoryDelete",
|
|
255
|
-
"reviewCreate",
|
|
256
|
-
"getProductReviews",
|
|
257
|
-
];
|
|
258
|
-
for (const method of grpcMethods) {
|
|
259
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
260
|
-
GrpcMethod("ActivityService", method)(constructor.prototype[method], method, descriptor);
|
|
261
|
-
}
|
|
262
|
-
const grpcStreamMethods: string[] = [];
|
|
263
|
-
for (const method of grpcStreamMethods) {
|
|
264
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
265
|
-
GrpcStreamMethod("ActivityService", method)(constructor.prototype[method], method, descriptor);
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export const ACTIVITY_SERVICE_NAME = "ActivityService";
|
package/gen/auth.ts
DELETED
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
-
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.10.1
|
|
4
|
-
// protoc v7.35.0
|
|
5
|
-
// source: auth.proto
|
|
6
|
-
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
-
import { Observable } from "rxjs";
|
|
10
|
-
|
|
11
|
-
export const protobufPackage = "auth.v1";
|
|
12
|
-
|
|
13
|
-
export enum TwoFactorType {
|
|
14
|
-
NONE = 0,
|
|
15
|
-
APP = 1,
|
|
16
|
-
EMAIL = 2,
|
|
17
|
-
UNRECOGNIZED = -1,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** Login by username OR email (one of the two must be set). */
|
|
21
|
-
export interface LoginRequest {
|
|
22
|
-
password: string;
|
|
23
|
-
/** username OR email — resolved by the service */
|
|
24
|
-
credentials: string;
|
|
25
|
-
/**
|
|
26
|
-
* Gateway-supplied audit context. LoginEvent rows for LOGIN /
|
|
27
|
-
* PASSWORD_FAIL get the same ip/user-agent that REFRESH and RESTORE
|
|
28
|
-
* already carry; the gRPC layer has no transport-level access to
|
|
29
|
-
* either, so the gateway extracts them from the HTTP request.
|
|
30
|
-
*/
|
|
31
|
-
userAgent: string;
|
|
32
|
-
ip: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface RegisterRequest {
|
|
36
|
-
email: string;
|
|
37
|
-
username: string;
|
|
38
|
-
password: string;
|
|
39
|
-
/** optional, attached by gateway from req */
|
|
40
|
-
ip: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** type ∈ { twofa, reset, totp_generate, totp_activate, confirm } (legacy strings) */
|
|
44
|
-
export interface CreateCodeRequest {
|
|
45
|
-
email: string;
|
|
46
|
-
type: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* type ∈ { twofa, twofa_deactivate, reset, totp, totp_deactivate, backup, confirm }
|
|
51
|
-
* new_password is only used by the 'reset' flow.
|
|
52
|
-
*/
|
|
53
|
-
export interface VerifyCodeRequest {
|
|
54
|
-
email: string;
|
|
55
|
-
code: string;
|
|
56
|
-
type: string;
|
|
57
|
-
/** optional */
|
|
58
|
-
newPassword: string;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface CheckTokenRequest {
|
|
62
|
-
token: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface RefreshTokenRequest {
|
|
66
|
-
refreshToken: string;
|
|
67
|
-
/** optional */
|
|
68
|
-
userAgent: string;
|
|
69
|
-
/** optional */
|
|
70
|
-
ip: string;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export interface Get2faStatusRequest {
|
|
74
|
-
username: string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface GetProfileRequest {
|
|
78
|
-
userId: string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface AuthUser {
|
|
82
|
-
id: string;
|
|
83
|
-
username: string;
|
|
84
|
-
email: string;
|
|
85
|
-
avatarUrl: string;
|
|
86
|
-
bannerUrl: string;
|
|
87
|
-
roles: string[];
|
|
88
|
-
/** primary role (roles[0]) */
|
|
89
|
-
role: string;
|
|
90
|
-
isVerified: boolean;
|
|
91
|
-
twoFactorType: TwoFactorType;
|
|
92
|
-
twoFactorEnabled: boolean;
|
|
93
|
-
/** Decimal as string (D7) */
|
|
94
|
-
balance: string;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Unified result for login/register/createCode/verifyCode/refresh. Which fields
|
|
99
|
-
* are populated depends on the flow:
|
|
100
|
-
* - fully authenticated → access_token + refresh_token + expires_in + user
|
|
101
|
-
* - 2FA required / pending confirm → message + requires_2fa + two_factor_type + user (no tokens)
|
|
102
|
-
* - totp_generate → secret + otpauth + qr (+ user)
|
|
103
|
-
* - totp_activate → backup_codes (+ tokens/user)
|
|
104
|
-
*/
|
|
105
|
-
export interface AuthResult {
|
|
106
|
-
accessToken: string;
|
|
107
|
-
refreshToken: string;
|
|
108
|
-
expiresIn: number;
|
|
109
|
-
user: AuthUser | undefined;
|
|
110
|
-
message: string;
|
|
111
|
-
requires2fa: boolean;
|
|
112
|
-
twoFactorType: TwoFactorType;
|
|
113
|
-
/** TOTP setup extras */
|
|
114
|
-
secret: string;
|
|
115
|
-
otpauth: string;
|
|
116
|
-
/** data URL (PNG) */
|
|
117
|
-
qr: string;
|
|
118
|
-
backupCodes: string[];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface TwoFactorStatusResponse {
|
|
122
|
-
twoFactorType: TwoFactorType;
|
|
123
|
-
has2fa: boolean;
|
|
124
|
-
isVerified: boolean;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export interface Empty {
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export interface LogoutCurrentRequest {
|
|
131
|
-
refreshToken: string;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export interface LogoutAllRequest {
|
|
135
|
-
userId: string;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export interface LogoutResponse {
|
|
139
|
-
ok: boolean;
|
|
140
|
-
/** number of refresh-token rows deleted */
|
|
141
|
-
removed: number;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export interface RestoreLoginRequest {
|
|
145
|
-
/** email or username */
|
|
146
|
-
credentials: string;
|
|
147
|
-
password: string;
|
|
148
|
-
userAgent: string;
|
|
149
|
-
ip: string;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface ListLoginHistoryRequest {
|
|
153
|
-
userId: string;
|
|
154
|
-
page: number;
|
|
155
|
-
limit: number;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface LoginEventRow {
|
|
159
|
-
id: string;
|
|
160
|
-
/** LOGIN | LOGOUT | REFRESH | TWO_FA_FAIL | PASSWORD_FAIL | BLOCKED | RESTORE */
|
|
161
|
-
type: string;
|
|
162
|
-
success: boolean;
|
|
163
|
-
reason: string;
|
|
164
|
-
ip: string;
|
|
165
|
-
userAgent: string;
|
|
166
|
-
createdAt: string;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export interface ListLoginHistoryResponse {
|
|
170
|
-
items: LoginEventRow[];
|
|
171
|
-
total: number;
|
|
172
|
-
page: number;
|
|
173
|
-
limit: number;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Ported from legacy auth-service (@MessagePattern → @GrpcMethod).
|
|
180
|
-
* Tokens are HMAC primitives from @aepstore-dev/passport:
|
|
181
|
-
* - access token: short TTL, carries userId; the gateway validates it
|
|
182
|
-
* locally via PassportAuthGuard (no round-trip here).
|
|
183
|
-
* - refresh token: long TTL HMAC + a RefreshToken DB row (device list +
|
|
184
|
-
* revocation). Refresh verifies the HMAC AND that the row still exists.
|
|
185
|
-
*/
|
|
186
|
-
|
|
187
|
-
export interface AuthServiceClient {
|
|
188
|
-
login(request: LoginRequest): Observable<AuthResult>;
|
|
189
|
-
|
|
190
|
-
register(request: RegisterRequest): Observable<AuthResult>;
|
|
191
|
-
|
|
192
|
-
createCode(request: CreateCodeRequest): Observable<AuthResult>;
|
|
193
|
-
|
|
194
|
-
verifyCode(request: VerifyCodeRequest): Observable<AuthResult>;
|
|
195
|
-
|
|
196
|
-
checkToken(request: CheckTokenRequest): Observable<AuthUser>;
|
|
197
|
-
|
|
198
|
-
refreshToken(request: RefreshTokenRequest): Observable<AuthResult>;
|
|
199
|
-
|
|
200
|
-
get2FaStatus(request: Get2faStatusRequest): Observable<TwoFactorStatusResponse>;
|
|
201
|
-
|
|
202
|
-
getProfile(request: GetProfileRequest): Observable<AuthUser>;
|
|
203
|
-
|
|
204
|
-
cleanupExpiredTotpSetups(request: Empty): Observable<Empty>;
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Logout — kill refresh tokens. LogoutCurrent kills only the one whose
|
|
208
|
-
* HMAC matches; LogoutAll wipes every row for the user.
|
|
209
|
-
*/
|
|
210
|
-
|
|
211
|
-
logoutCurrent(request: LogoutCurrentRequest): Observable<LogoutResponse>;
|
|
212
|
-
|
|
213
|
-
logoutAll(request: LogoutAllRequest): Observable<LogoutResponse>;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Self-service restore. Verifies credentials + password against a
|
|
217
|
-
* soft-deleted user, clears deletedAt/scheduledForHardDelete, and issues
|
|
218
|
-
* fresh tokens — the one auth path that DOES read deletedAt accounts.
|
|
219
|
-
*/
|
|
220
|
-
|
|
221
|
-
restoreLogin(request: RestoreLoginRequest): Observable<AuthResult>;
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Login history. Read-only audit feed for the settings page; rows come
|
|
225
|
-
* from LoginEvent. Internal alternative: tasks-service GC.
|
|
226
|
-
*/
|
|
227
|
-
|
|
228
|
-
listLoginHistory(request: ListLoginHistoryRequest): Observable<ListLoginHistoryResponse>;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Ported from legacy auth-service (@MessagePattern → @GrpcMethod).
|
|
233
|
-
* Tokens are HMAC primitives from @aepstore-dev/passport:
|
|
234
|
-
* - access token: short TTL, carries userId; the gateway validates it
|
|
235
|
-
* locally via PassportAuthGuard (no round-trip here).
|
|
236
|
-
* - refresh token: long TTL HMAC + a RefreshToken DB row (device list +
|
|
237
|
-
* revocation). Refresh verifies the HMAC AND that the row still exists.
|
|
238
|
-
*/
|
|
239
|
-
|
|
240
|
-
export interface AuthServiceController {
|
|
241
|
-
login(request: LoginRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
242
|
-
|
|
243
|
-
register(request: RegisterRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
244
|
-
|
|
245
|
-
createCode(request: CreateCodeRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
246
|
-
|
|
247
|
-
verifyCode(request: VerifyCodeRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
248
|
-
|
|
249
|
-
checkToken(request: CheckTokenRequest): Promise<AuthUser> | Observable<AuthUser> | AuthUser;
|
|
250
|
-
|
|
251
|
-
refreshToken(request: RefreshTokenRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
252
|
-
|
|
253
|
-
get2FaStatus(
|
|
254
|
-
request: Get2faStatusRequest,
|
|
255
|
-
): Promise<TwoFactorStatusResponse> | Observable<TwoFactorStatusResponse> | TwoFactorStatusResponse;
|
|
256
|
-
|
|
257
|
-
getProfile(request: GetProfileRequest): Promise<AuthUser> | Observable<AuthUser> | AuthUser;
|
|
258
|
-
|
|
259
|
-
cleanupExpiredTotpSetups(request: Empty): Promise<Empty> | Observable<Empty> | Empty;
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Logout — kill refresh tokens. LogoutCurrent kills only the one whose
|
|
263
|
-
* HMAC matches; LogoutAll wipes every row for the user.
|
|
264
|
-
*/
|
|
265
|
-
|
|
266
|
-
logoutCurrent(request: LogoutCurrentRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
|
|
267
|
-
|
|
268
|
-
logoutAll(request: LogoutAllRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Self-service restore. Verifies credentials + password against a
|
|
272
|
-
* soft-deleted user, clears deletedAt/scheduledForHardDelete, and issues
|
|
273
|
-
* fresh tokens — the one auth path that DOES read deletedAt accounts.
|
|
274
|
-
*/
|
|
275
|
-
|
|
276
|
-
restoreLogin(request: RestoreLoginRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Login history. Read-only audit feed for the settings page; rows come
|
|
280
|
-
* from LoginEvent. Internal alternative: tasks-service GC.
|
|
281
|
-
*/
|
|
282
|
-
|
|
283
|
-
listLoginHistory(
|
|
284
|
-
request: ListLoginHistoryRequest,
|
|
285
|
-
): Promise<ListLoginHistoryResponse> | Observable<ListLoginHistoryResponse> | ListLoginHistoryResponse;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
export function AuthServiceControllerMethods() {
|
|
289
|
-
return function (constructor: Function) {
|
|
290
|
-
const grpcMethods: string[] = [
|
|
291
|
-
"login",
|
|
292
|
-
"register",
|
|
293
|
-
"createCode",
|
|
294
|
-
"verifyCode",
|
|
295
|
-
"checkToken",
|
|
296
|
-
"refreshToken",
|
|
297
|
-
"get2FaStatus",
|
|
298
|
-
"getProfile",
|
|
299
|
-
"cleanupExpiredTotpSetups",
|
|
300
|
-
"logoutCurrent",
|
|
301
|
-
"logoutAll",
|
|
302
|
-
"restoreLogin",
|
|
303
|
-
"listLoginHistory",
|
|
304
|
-
];
|
|
305
|
-
for (const method of grpcMethods) {
|
|
306
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
307
|
-
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
308
|
-
}
|
|
309
|
-
const grpcStreamMethods: string[] = [];
|
|
310
|
-
for (const method of grpcStreamMethods) {
|
|
311
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
312
|
-
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
export const AUTH_SERVICE_NAME = "AuthService";
|