@chevre/domain 24.0.0-alpha.16 → 24.0.0-alpha.17
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/lib/chevre/repo/action/acceptCOAOffer.d.ts +23 -0
- package/lib/chevre/repo/action/acceptCOAOffer.js +64 -0
- package/lib/chevre/repo/action/actionProcess.d.ts +97 -0
- package/lib/chevre/repo/action/actionProcess.js +270 -0
- package/lib/chevre/repo/action/authorizeOffer.d.ts +21 -0
- package/lib/chevre/repo/action/authorizeOffer.js +85 -0
- package/lib/chevre/repo/action.d.ts +3 -163
- package/lib/chevre/repo/action.js +308 -580
- package/lib/chevre/repo/aggregateAction.d.ts +102 -0
- package/lib/chevre/repo/aggregateAction.js +379 -0
- package/lib/chevre/repository.d.ts +17 -0
- package/lib/chevre/repository.js +38 -2
- package/lib/chevre/service/aggregation/system.d.ts +10 -10
- package/lib/chevre/service/aggregation/system.js +9 -9
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +4 -2
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +20 -12
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +16 -7
- package/package.json +1 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Connection } from 'mongoose';
|
|
2
|
+
import * as factory from '../factory';
|
|
3
|
+
interface IAggregationByStatus {
|
|
4
|
+
actionCount: number;
|
|
5
|
+
avgDuration: number;
|
|
6
|
+
maxDuration: number;
|
|
7
|
+
minDuration: number;
|
|
8
|
+
percentilesDuration: {
|
|
9
|
+
name: string;
|
|
10
|
+
value: number;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
interface IStatus {
|
|
14
|
+
status: factory.actionStatusType;
|
|
15
|
+
aggregation: IAggregationByStatus;
|
|
16
|
+
}
|
|
17
|
+
interface IAggregateAction {
|
|
18
|
+
statuses: IStatus[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* アクション集計リポジトリ
|
|
22
|
+
*/
|
|
23
|
+
export declare class AggregateActionRepo {
|
|
24
|
+
private readonly actionModel;
|
|
25
|
+
constructor(connection: Connection);
|
|
26
|
+
/**
|
|
27
|
+
* イベントと入場ゲート指定で予約使用アクションを集計する
|
|
28
|
+
* discontinue(2024-12-26~)
|
|
29
|
+
*/
|
|
30
|
+
aggregateAuthorizeEventServiceOfferAction(params: {
|
|
31
|
+
project?: {
|
|
32
|
+
id?: {
|
|
33
|
+
$ne?: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
startFrom: Date;
|
|
37
|
+
startThrough: Date;
|
|
38
|
+
typeOf: factory.actionType;
|
|
39
|
+
}): Promise<IAggregateAction>;
|
|
40
|
+
aggregateAuthorizePaymentAction(params: {
|
|
41
|
+
project?: {
|
|
42
|
+
id?: {
|
|
43
|
+
$ne?: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
startFrom: Date;
|
|
47
|
+
startThrough: Date;
|
|
48
|
+
typeOf: factory.actionType;
|
|
49
|
+
}): Promise<IAggregateAction>;
|
|
50
|
+
aggregateAuthorizeOrderAction(params: {
|
|
51
|
+
project?: {
|
|
52
|
+
id?: {
|
|
53
|
+
$ne?: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
startFrom: Date;
|
|
57
|
+
startThrough: Date;
|
|
58
|
+
typeOf: factory.actionType;
|
|
59
|
+
}): Promise<IAggregateAction>;
|
|
60
|
+
aggregateCancelReservationAction(params: {
|
|
61
|
+
project?: {
|
|
62
|
+
id?: {
|
|
63
|
+
$ne?: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
startFrom: Date;
|
|
67
|
+
startThrough: Date;
|
|
68
|
+
}): Promise<IAggregateAction>;
|
|
69
|
+
/**
|
|
70
|
+
* アクションタイプによる汎用的な集計
|
|
71
|
+
*/
|
|
72
|
+
aggregateByTypeOf(params: {
|
|
73
|
+
project?: {
|
|
74
|
+
id?: {
|
|
75
|
+
$ne?: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
startFrom: Date;
|
|
79
|
+
startThrough: Date;
|
|
80
|
+
typeOf: factory.actionType;
|
|
81
|
+
}): Promise<IAggregateAction>;
|
|
82
|
+
aggregateCheckMovieTicketAction(params: {
|
|
83
|
+
project?: {
|
|
84
|
+
id?: {
|
|
85
|
+
$ne?: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
startFrom: Date;
|
|
89
|
+
startThrough: Date;
|
|
90
|
+
}): Promise<IAggregateAction>;
|
|
91
|
+
aggregatePayMovieTicketAction(params: {
|
|
92
|
+
project?: {
|
|
93
|
+
id?: {
|
|
94
|
+
$ne?: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
startFrom: Date;
|
|
98
|
+
startThrough: Date;
|
|
99
|
+
}): Promise<IAggregateAction>;
|
|
100
|
+
private agggregateByStatus;
|
|
101
|
+
}
|
|
102
|
+
export {};
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.AggregateActionRepo = void 0;
|
|
27
|
+
const factory = __importStar(require("../factory"));
|
|
28
|
+
// import { MONGO_MAX_TIME_MS } from '../../settings';
|
|
29
|
+
const action_1 = require("./mongoose/schemas/action");
|
|
30
|
+
/**
|
|
31
|
+
* アクション集計リポジトリ
|
|
32
|
+
*/
|
|
33
|
+
class AggregateActionRepo {
|
|
34
|
+
actionModel;
|
|
35
|
+
// private readonly actionRecipeModel: IActionRecipeModel;
|
|
36
|
+
constructor(connection) {
|
|
37
|
+
this.actionModel = connection.model(action_1.modelName, (0, action_1.createSchema)());
|
|
38
|
+
// this.actionRecipeModel = connection.model(recipeModelName, createRecipeSchema());
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* イベントと入場ゲート指定で予約使用アクションを集計する
|
|
42
|
+
* discontinue(2024-12-26~)
|
|
43
|
+
*/
|
|
44
|
+
// public async countUseActionsByEntranceGate(params: {
|
|
45
|
+
// event: { id: string };
|
|
46
|
+
// entranceGateIdentifier: string;
|
|
47
|
+
// }): Promise<IUseActionCountByOffer[]> {
|
|
48
|
+
// return this.actionModel.aggregate([
|
|
49
|
+
// {
|
|
50
|
+
// $match: {
|
|
51
|
+
// actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
|
|
52
|
+
// }
|
|
53
|
+
// },
|
|
54
|
+
// {
|
|
55
|
+
// $match: {
|
|
56
|
+
// typeOf: { $eq: factory.actionType.UseAction }
|
|
57
|
+
// }
|
|
58
|
+
// },
|
|
59
|
+
// {
|
|
60
|
+
// $match: {
|
|
61
|
+
// 'object.typeOf': {
|
|
62
|
+
// $exists: true,
|
|
63
|
+
// $eq: factory.reservationType.EventReservation
|
|
64
|
+
// }
|
|
65
|
+
// }
|
|
66
|
+
// },
|
|
67
|
+
// {
|
|
68
|
+
// $match: {
|
|
69
|
+
// 'object.reservationFor.id': {
|
|
70
|
+
// $exists: true,
|
|
71
|
+
// $eq: params.event.id
|
|
72
|
+
// }
|
|
73
|
+
// }
|
|
74
|
+
// },
|
|
75
|
+
// {
|
|
76
|
+
// $match: {
|
|
77
|
+
// 'location.identifier': {
|
|
78
|
+
// $exists: true,
|
|
79
|
+
// $eq: params.entranceGateIdentifier
|
|
80
|
+
// }
|
|
81
|
+
// }
|
|
82
|
+
// },
|
|
83
|
+
// {
|
|
84
|
+
// $group: {
|
|
85
|
+
// _id: '$object.id',
|
|
86
|
+
// object: { $first: '$object' }
|
|
87
|
+
// }
|
|
88
|
+
// },
|
|
89
|
+
// {
|
|
90
|
+
// $group: {
|
|
91
|
+
// _id: '$object.reservedTicket.ticketType.id',
|
|
92
|
+
// useActionCount: {
|
|
93
|
+
// $sum: 1
|
|
94
|
+
// }
|
|
95
|
+
// }
|
|
96
|
+
// }
|
|
97
|
+
// ])
|
|
98
|
+
// .exec();
|
|
99
|
+
// }
|
|
100
|
+
async aggregateAuthorizeEventServiceOfferAction(params) {
|
|
101
|
+
const statuses = await Promise.all([
|
|
102
|
+
factory.actionStatusType.CompletedActionStatus,
|
|
103
|
+
factory.actionStatusType.CanceledActionStatus,
|
|
104
|
+
factory.actionStatusType.FailedActionStatus
|
|
105
|
+
].map(async (actionStatus) => {
|
|
106
|
+
const matchConditions = {
|
|
107
|
+
startDate: {
|
|
108
|
+
$gte: params.startFrom,
|
|
109
|
+
$lte: params.startThrough
|
|
110
|
+
},
|
|
111
|
+
typeOf: { $eq: params.typeOf },
|
|
112
|
+
actionStatus: { $eq: actionStatus },
|
|
113
|
+
'object.typeOf': {
|
|
114
|
+
$exists: true,
|
|
115
|
+
$eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation
|
|
116
|
+
},
|
|
117
|
+
...(typeof params.project?.id?.$ne === 'string')
|
|
118
|
+
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
119
|
+
: undefined
|
|
120
|
+
};
|
|
121
|
+
return this.agggregateByStatus({ matchConditions, actionStatus });
|
|
122
|
+
}));
|
|
123
|
+
return { statuses };
|
|
124
|
+
}
|
|
125
|
+
async aggregateAuthorizePaymentAction(params) {
|
|
126
|
+
const statuses = await Promise.all([
|
|
127
|
+
factory.actionStatusType.CompletedActionStatus,
|
|
128
|
+
factory.actionStatusType.CanceledActionStatus,
|
|
129
|
+
factory.actionStatusType.FailedActionStatus
|
|
130
|
+
].map(async (actionStatus) => {
|
|
131
|
+
const matchConditions = {
|
|
132
|
+
startDate: {
|
|
133
|
+
$gte: params.startFrom,
|
|
134
|
+
$lte: params.startThrough
|
|
135
|
+
},
|
|
136
|
+
typeOf: { $eq: params.typeOf },
|
|
137
|
+
actionStatus: { $eq: actionStatus },
|
|
138
|
+
'object.typeOf': {
|
|
139
|
+
$exists: true,
|
|
140
|
+
$eq: factory.action.authorize.paymentMethod.any.ResultType.Payment
|
|
141
|
+
},
|
|
142
|
+
...(typeof params.project?.id?.$ne === 'string')
|
|
143
|
+
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
144
|
+
: undefined
|
|
145
|
+
};
|
|
146
|
+
return this.agggregateByStatus({ matchConditions, actionStatus });
|
|
147
|
+
}));
|
|
148
|
+
return { statuses };
|
|
149
|
+
}
|
|
150
|
+
async aggregateAuthorizeOrderAction(params) {
|
|
151
|
+
const statuses = await Promise.all([
|
|
152
|
+
factory.actionStatusType.CompletedActionStatus,
|
|
153
|
+
factory.actionStatusType.CanceledActionStatus,
|
|
154
|
+
factory.actionStatusType.FailedActionStatus
|
|
155
|
+
].map(async (actionStatus) => {
|
|
156
|
+
const matchConditions = {
|
|
157
|
+
startDate: {
|
|
158
|
+
$gte: params.startFrom,
|
|
159
|
+
$lte: params.startThrough
|
|
160
|
+
},
|
|
161
|
+
typeOf: { $eq: params.typeOf },
|
|
162
|
+
actionStatus: { $eq: actionStatus },
|
|
163
|
+
'object.typeOf': {
|
|
164
|
+
$exists: true,
|
|
165
|
+
$eq: factory.order.OrderType.Order
|
|
166
|
+
},
|
|
167
|
+
...(typeof params.project?.id?.$ne === 'string')
|
|
168
|
+
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
169
|
+
: undefined
|
|
170
|
+
};
|
|
171
|
+
return this.agggregateByStatus({ matchConditions, actionStatus });
|
|
172
|
+
}));
|
|
173
|
+
return { statuses };
|
|
174
|
+
}
|
|
175
|
+
async aggregateCancelReservationAction(params) {
|
|
176
|
+
const statuses = await Promise.all([
|
|
177
|
+
factory.actionStatusType.CompletedActionStatus,
|
|
178
|
+
factory.actionStatusType.CanceledActionStatus,
|
|
179
|
+
factory.actionStatusType.FailedActionStatus
|
|
180
|
+
].map(async (actionStatus) => {
|
|
181
|
+
const matchConditions = {
|
|
182
|
+
startDate: {
|
|
183
|
+
$gte: params.startFrom,
|
|
184
|
+
$lte: params.startThrough
|
|
185
|
+
},
|
|
186
|
+
typeOf: { $eq: factory.actionType.CancelAction },
|
|
187
|
+
actionStatus: { $eq: actionStatus },
|
|
188
|
+
'object.typeOf': {
|
|
189
|
+
$exists: true,
|
|
190
|
+
$in: [
|
|
191
|
+
factory.reservationType.BusReservation,
|
|
192
|
+
factory.reservationType.EventReservation,
|
|
193
|
+
factory.reservationType.ReservationPackage
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
...(typeof params.project?.id?.$ne === 'string')
|
|
197
|
+
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
198
|
+
: undefined
|
|
199
|
+
};
|
|
200
|
+
return this.agggregateByStatus({ matchConditions, actionStatus });
|
|
201
|
+
}));
|
|
202
|
+
return { statuses };
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* アクションタイプによる汎用的な集計
|
|
206
|
+
*/
|
|
207
|
+
async aggregateByTypeOf(params) {
|
|
208
|
+
const statuses = await Promise.all([
|
|
209
|
+
factory.actionStatusType.CompletedActionStatus,
|
|
210
|
+
factory.actionStatusType.CanceledActionStatus,
|
|
211
|
+
factory.actionStatusType.FailedActionStatus
|
|
212
|
+
].map(async (actionStatus) => {
|
|
213
|
+
const matchConditions = {
|
|
214
|
+
startDate: {
|
|
215
|
+
$gte: params.startFrom,
|
|
216
|
+
$lte: params.startThrough
|
|
217
|
+
},
|
|
218
|
+
typeOf: { $eq: params.typeOf },
|
|
219
|
+
actionStatus: { $eq: actionStatus },
|
|
220
|
+
...(typeof params.project?.id?.$ne === 'string')
|
|
221
|
+
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
222
|
+
: undefined
|
|
223
|
+
};
|
|
224
|
+
return this.agggregateByStatus({ matchConditions, actionStatus });
|
|
225
|
+
}));
|
|
226
|
+
return { statuses };
|
|
227
|
+
}
|
|
228
|
+
async aggregateCheckMovieTicketAction(params) {
|
|
229
|
+
const statuses = await Promise.all([
|
|
230
|
+
factory.actionStatusType.CompletedActionStatus,
|
|
231
|
+
factory.actionStatusType.CanceledActionStatus,
|
|
232
|
+
factory.actionStatusType.FailedActionStatus
|
|
233
|
+
].map(async (actionStatus) => {
|
|
234
|
+
const matchConditions = {
|
|
235
|
+
startDate: {
|
|
236
|
+
$gte: params.startFrom,
|
|
237
|
+
$lte: params.startThrough
|
|
238
|
+
},
|
|
239
|
+
typeOf: { $eq: factory.actionType.CheckAction },
|
|
240
|
+
'object.typeOf': {
|
|
241
|
+
$exists: true,
|
|
242
|
+
$eq: factory.service.paymentService.PaymentServiceType.MovieTicket
|
|
243
|
+
},
|
|
244
|
+
actionStatus: { $eq: actionStatus },
|
|
245
|
+
...(typeof params.project?.id?.$ne === 'string')
|
|
246
|
+
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
247
|
+
: undefined
|
|
248
|
+
};
|
|
249
|
+
return this.agggregateByStatus({ matchConditions, actionStatus });
|
|
250
|
+
}));
|
|
251
|
+
return { statuses };
|
|
252
|
+
}
|
|
253
|
+
async aggregatePayMovieTicketAction(params) {
|
|
254
|
+
const statuses = await Promise.all([
|
|
255
|
+
factory.actionStatusType.CompletedActionStatus,
|
|
256
|
+
factory.actionStatusType.CanceledActionStatus,
|
|
257
|
+
factory.actionStatusType.FailedActionStatus
|
|
258
|
+
].map(async (actionStatus) => {
|
|
259
|
+
const matchConditions = {
|
|
260
|
+
startDate: {
|
|
261
|
+
$gte: params.startFrom,
|
|
262
|
+
$lte: params.startThrough
|
|
263
|
+
},
|
|
264
|
+
typeOf: { $eq: factory.actionType.PayAction },
|
|
265
|
+
'object.typeOf': {
|
|
266
|
+
$exists: true,
|
|
267
|
+
$eq: factory.service.paymentService.PaymentServiceType.MovieTicket
|
|
268
|
+
},
|
|
269
|
+
actionStatus: { $eq: actionStatus },
|
|
270
|
+
...(typeof params.project?.id?.$ne === 'string')
|
|
271
|
+
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
272
|
+
: undefined
|
|
273
|
+
};
|
|
274
|
+
return this.agggregateByStatus({ matchConditions, actionStatus });
|
|
275
|
+
}));
|
|
276
|
+
return { statuses };
|
|
277
|
+
}
|
|
278
|
+
async agggregateByStatus(params) {
|
|
279
|
+
const aggregations = await this.actionModel.aggregate([
|
|
280
|
+
{ $match: params.matchConditions },
|
|
281
|
+
{
|
|
282
|
+
$project: {
|
|
283
|
+
duration: { $subtract: ['$endDate', '$startDate'] },
|
|
284
|
+
actionStatus: '$actionStatus',
|
|
285
|
+
startDate: '$startDate',
|
|
286
|
+
endDate: '$endDate',
|
|
287
|
+
typeOf: '$typeOf'
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
$group: {
|
|
292
|
+
_id: '$typeOf',
|
|
293
|
+
actionCount: { $sum: 1 },
|
|
294
|
+
maxDuration: { $max: '$duration' },
|
|
295
|
+
minDuration: { $min: '$duration' },
|
|
296
|
+
avgDuration: { $avg: '$duration' }
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
$project: {
|
|
301
|
+
_id: 0,
|
|
302
|
+
actionCount: '$actionCount',
|
|
303
|
+
avgDuration: '$avgDuration',
|
|
304
|
+
maxDuration: '$maxDuration',
|
|
305
|
+
minDuration: '$minDuration'
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
])
|
|
309
|
+
.exec();
|
|
310
|
+
const percents = [50, 95, 99];
|
|
311
|
+
if (aggregations.length === 0) {
|
|
312
|
+
return {
|
|
313
|
+
status: params.actionStatus,
|
|
314
|
+
aggregation: {
|
|
315
|
+
actionCount: 0,
|
|
316
|
+
avgDuration: 0,
|
|
317
|
+
maxDuration: 0,
|
|
318
|
+
minDuration: 0,
|
|
319
|
+
percentilesDuration: percents.map((percent) => {
|
|
320
|
+
return {
|
|
321
|
+
name: String(percent),
|
|
322
|
+
value: 0
|
|
323
|
+
};
|
|
324
|
+
})
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
const ranks4percentile = percents.map((percentile) => {
|
|
329
|
+
return {
|
|
330
|
+
percentile,
|
|
331
|
+
rank: Math.floor(aggregations[0].actionCount * percentile / 100)
|
|
332
|
+
};
|
|
333
|
+
});
|
|
334
|
+
const aggregations2 = await this.actionModel.aggregate([
|
|
335
|
+
{
|
|
336
|
+
$match: params.matchConditions
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
$project: {
|
|
340
|
+
duration: { $subtract: ['$endDate', '$startDate'] },
|
|
341
|
+
actionStatus: '$actionStatus',
|
|
342
|
+
startDate: '$startDate',
|
|
343
|
+
endDate: '$endDate',
|
|
344
|
+
typeOf: '$typeOf'
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
{ $sort: { duration: 1 } },
|
|
348
|
+
{
|
|
349
|
+
$group: {
|
|
350
|
+
_id: '$typeOf',
|
|
351
|
+
durations: { $push: '$duration' }
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
$project: {
|
|
356
|
+
_id: 0,
|
|
357
|
+
avgSmallDuration: '$avgSmallDuration',
|
|
358
|
+
avgMediumDuration: '$avgMediumDuration',
|
|
359
|
+
avgLargeDuration: '$avgLargeDuration',
|
|
360
|
+
percentilesDuration: ranks4percentile.map((rank) => {
|
|
361
|
+
return {
|
|
362
|
+
name: String(rank.percentile),
|
|
363
|
+
value: { $arrayElemAt: ['$durations', rank.rank] }
|
|
364
|
+
};
|
|
365
|
+
})
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
])
|
|
369
|
+
.exec();
|
|
370
|
+
return {
|
|
371
|
+
status: params.actionStatus,
|
|
372
|
+
aggregation: {
|
|
373
|
+
...aggregations[0],
|
|
374
|
+
...aggregations2[0]
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
exports.AggregateActionRepo = AggregateActionRepo;
|
|
@@ -8,8 +8,11 @@ import type { AccountingReportRepo } from './repo/accountingReport';
|
|
|
8
8
|
import type { AccountTitleRepo } from './repo/accountTitle';
|
|
9
9
|
import type { AccountTransactionRepo } from './repo/accountTransaction';
|
|
10
10
|
import type { ActionRepo } from './repo/action';
|
|
11
|
+
import type { AcceptCOAOfferActionRepo } from './repo/action/acceptCOAOffer';
|
|
12
|
+
import type { AuthorizeOfferActionRepo } from './repo/action/authorizeOffer';
|
|
11
13
|
import type { AdditionalPropertyRepo } from './repo/additionalProperty';
|
|
12
14
|
import type { AdvanceBookingRequirementRepo } from './repo/advanceBookingRequirement';
|
|
15
|
+
import type { AggregateActionRepo } from './repo/aggregateAction';
|
|
13
16
|
import type { AggregateOfferRepo } from './repo/aggregateOffer';
|
|
14
17
|
import type { AggregateOrderRepo } from './repo/aggregateOrder';
|
|
15
18
|
import type { AggregateReservationRepo } from './repo/aggregateReservation';
|
|
@@ -123,6 +126,16 @@ export type Action = ActionRepo;
|
|
|
123
126
|
export declare namespace Action {
|
|
124
127
|
function createInstance(...params: ConstructorParameters<typeof ActionRepo>): Promise<ActionRepo>;
|
|
125
128
|
}
|
|
129
|
+
export declare namespace action {
|
|
130
|
+
type AcceptCOAOffer = AcceptCOAOfferActionRepo;
|
|
131
|
+
namespace AcceptCOAOffer {
|
|
132
|
+
function createInstance(...params: ConstructorParameters<typeof AcceptCOAOfferActionRepo>): Promise<AcceptCOAOfferActionRepo>;
|
|
133
|
+
}
|
|
134
|
+
type AuthorizeOffer = AuthorizeOfferActionRepo;
|
|
135
|
+
namespace AuthorizeOffer {
|
|
136
|
+
function createInstance(...params: ConstructorParameters<typeof AuthorizeOfferActionRepo>): Promise<AuthorizeOfferActionRepo>;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
126
139
|
export type AdditionalProperty = AdditionalPropertyRepo;
|
|
127
140
|
export declare namespace AdditionalProperty {
|
|
128
141
|
function createInstance(...params: ConstructorParameters<typeof AdditionalPropertyRepo>): Promise<AdditionalPropertyRepo>;
|
|
@@ -131,6 +144,10 @@ export type AdvanceBookingRequirement = AdvanceBookingRequirementRepo;
|
|
|
131
144
|
export declare namespace AdvanceBookingRequirement {
|
|
132
145
|
function createInstance(...params: ConstructorParameters<typeof AdvanceBookingRequirementRepo>): Promise<AdvanceBookingRequirementRepo>;
|
|
133
146
|
}
|
|
147
|
+
export type AggregateAction = AggregateActionRepo;
|
|
148
|
+
export declare namespace AggregateAction {
|
|
149
|
+
function createInstance(...params: ConstructorParameters<typeof AggregateActionRepo>): Promise<AggregateActionRepo>;
|
|
150
|
+
}
|
|
134
151
|
export type AggregateOffer = AggregateOfferRepo;
|
|
135
152
|
export declare namespace AggregateOffer {
|
|
136
153
|
function createInstance(...params: ConstructorParameters<typeof AggregateOfferRepo>): Promise<AggregateOfferRepo>;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -23,8 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Permit = exports.Person = exports.paymentMethod = void 0;
|
|
26
|
+
exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AggregateAction = exports.AdvanceBookingRequirement = exports.AdditionalProperty = exports.action = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedPaymentMethod = exports.AcceptedOffer = void 0;
|
|
27
|
+
exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Permit = exports.Person = exports.paymentMethod = exports.PendingReservation = exports.PaymentServiceProvider = void 0;
|
|
28
28
|
var AcceptedOffer;
|
|
29
29
|
(function (AcceptedOffer) {
|
|
30
30
|
let repo;
|
|
@@ -102,6 +102,31 @@ var Action;
|
|
|
102
102
|
}
|
|
103
103
|
Action.createInstance = createInstance;
|
|
104
104
|
})(Action || (exports.Action = Action = {}));
|
|
105
|
+
var action;
|
|
106
|
+
(function (action) {
|
|
107
|
+
let AcceptCOAOffer;
|
|
108
|
+
(function (AcceptCOAOffer) {
|
|
109
|
+
let repo;
|
|
110
|
+
async function createInstance(...params) {
|
|
111
|
+
if (repo === undefined) {
|
|
112
|
+
repo = (await Promise.resolve().then(() => __importStar(require('./repo/action/acceptCOAOffer')))).AcceptCOAOfferActionRepo;
|
|
113
|
+
}
|
|
114
|
+
return new repo(...params);
|
|
115
|
+
}
|
|
116
|
+
AcceptCOAOffer.createInstance = createInstance;
|
|
117
|
+
})(AcceptCOAOffer = action.AcceptCOAOffer || (action.AcceptCOAOffer = {}));
|
|
118
|
+
let AuthorizeOffer;
|
|
119
|
+
(function (AuthorizeOffer) {
|
|
120
|
+
let repo;
|
|
121
|
+
async function createInstance(...params) {
|
|
122
|
+
if (repo === undefined) {
|
|
123
|
+
repo = (await Promise.resolve().then(() => __importStar(require('./repo/action/authorizeOffer')))).AuthorizeOfferActionRepo;
|
|
124
|
+
}
|
|
125
|
+
return new repo(...params);
|
|
126
|
+
}
|
|
127
|
+
AuthorizeOffer.createInstance = createInstance;
|
|
128
|
+
})(AuthorizeOffer = action.AuthorizeOffer || (action.AuthorizeOffer = {}));
|
|
129
|
+
})(action || (exports.action = action = {}));
|
|
105
130
|
var AdditionalProperty;
|
|
106
131
|
(function (AdditionalProperty) {
|
|
107
132
|
let repo;
|
|
@@ -124,6 +149,17 @@ var AdvanceBookingRequirement;
|
|
|
124
149
|
}
|
|
125
150
|
AdvanceBookingRequirement.createInstance = createInstance;
|
|
126
151
|
})(AdvanceBookingRequirement || (exports.AdvanceBookingRequirement = AdvanceBookingRequirement = {}));
|
|
152
|
+
var AggregateAction;
|
|
153
|
+
(function (AggregateAction) {
|
|
154
|
+
let repo;
|
|
155
|
+
async function createInstance(...params) {
|
|
156
|
+
if (repo === undefined) {
|
|
157
|
+
repo = (await Promise.resolve().then(() => __importStar(require('./repo/aggregateAction')))).AggregateActionRepo;
|
|
158
|
+
}
|
|
159
|
+
return new repo(...params);
|
|
160
|
+
}
|
|
161
|
+
AggregateAction.createInstance = createInstance;
|
|
162
|
+
})(AggregateAction || (exports.AggregateAction = AggregateAction = {}));
|
|
127
163
|
var AggregateOffer;
|
|
128
164
|
(function (AggregateOffer) {
|
|
129
165
|
let repo;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AggregateActionRepo } from '../../repo/aggregateAction';
|
|
2
2
|
import { AggregationRepo } from '../../repo/aggregation';
|
|
3
3
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
4
4
|
import type { EventRepo } from '../../repo/event';
|
|
@@ -46,7 +46,7 @@ declare function aggregatePlaceOrder(params: IAggregateParams & {
|
|
|
46
46
|
*/
|
|
47
47
|
declare function aggregateAuthorizeEventServiceOfferAction(params: IAggregateParams): (repos: {
|
|
48
48
|
agregation: AggregationRepo;
|
|
49
|
-
|
|
49
|
+
aggregateAction: AggregateActionRepo;
|
|
50
50
|
}) => Promise<{
|
|
51
51
|
aggregationCount: number;
|
|
52
52
|
aggregateDuration: string;
|
|
@@ -56,14 +56,14 @@ declare function aggregateAuthorizeEventServiceOfferAction(params: IAggregatePar
|
|
|
56
56
|
*/
|
|
57
57
|
declare function aggregateAuthorizePaymentAction(params: IAggregateParams): (repos: {
|
|
58
58
|
agregation: AggregationRepo;
|
|
59
|
-
|
|
59
|
+
aggregateAction: AggregateActionRepo;
|
|
60
60
|
}) => Promise<{
|
|
61
61
|
aggregationCount: number;
|
|
62
62
|
aggregateDuration: string;
|
|
63
63
|
}>;
|
|
64
64
|
declare function aggregateAuthorizeOrderAction(params: IAggregateParams): (repos: {
|
|
65
65
|
agregation: AggregationRepo;
|
|
66
|
-
|
|
66
|
+
aggregateAction: AggregateActionRepo;
|
|
67
67
|
}) => Promise<{
|
|
68
68
|
aggregationCount: number;
|
|
69
69
|
aggregateDuration: string;
|
|
@@ -73,7 +73,7 @@ declare function aggregateAuthorizeOrderAction(params: IAggregateParams): (repos
|
|
|
73
73
|
*/
|
|
74
74
|
declare function aggregateUseAction(params: IAggregateParams): (repos: {
|
|
75
75
|
agregation: AggregationRepo;
|
|
76
|
-
|
|
76
|
+
aggregateAction: AggregateActionRepo;
|
|
77
77
|
}) => Promise<{
|
|
78
78
|
aggregationCount: number;
|
|
79
79
|
aggregateDuration: string;
|
|
@@ -83,7 +83,7 @@ declare function aggregateUseAction(params: IAggregateParams): (repos: {
|
|
|
83
83
|
*/
|
|
84
84
|
declare function aggregateReserveAction(params: IAggregateParams): (repos: {
|
|
85
85
|
agregation: AggregationRepo;
|
|
86
|
-
|
|
86
|
+
aggregateAction: AggregateActionRepo;
|
|
87
87
|
}) => Promise<{
|
|
88
88
|
aggregationCount: number;
|
|
89
89
|
aggregateDuration: string;
|
|
@@ -93,7 +93,7 @@ declare function aggregateReserveAction(params: IAggregateParams): (repos: {
|
|
|
93
93
|
*/
|
|
94
94
|
declare function aggregateOrderAction(params: IAggregateParams): (repos: {
|
|
95
95
|
agregation: AggregationRepo;
|
|
96
|
-
|
|
96
|
+
aggregateAction: AggregateActionRepo;
|
|
97
97
|
}) => Promise<{
|
|
98
98
|
aggregationCount: number;
|
|
99
99
|
aggregateDuration: string;
|
|
@@ -103,21 +103,21 @@ declare function aggregateOrderAction(params: IAggregateParams): (repos: {
|
|
|
103
103
|
*/
|
|
104
104
|
declare function aggregateCancelReservationAction(params: IAggregateParams): (repos: {
|
|
105
105
|
agregation: AggregationRepo;
|
|
106
|
-
|
|
106
|
+
aggregateAction: AggregateActionRepo;
|
|
107
107
|
}) => Promise<{
|
|
108
108
|
aggregationCount: number;
|
|
109
109
|
aggregateDuration: string;
|
|
110
110
|
}>;
|
|
111
111
|
declare function aggregateCheckMovieTicketAction(params: IAggregateParams): (repos: {
|
|
112
112
|
agregation: AggregationRepo;
|
|
113
|
-
|
|
113
|
+
aggregateAction: AggregateActionRepo;
|
|
114
114
|
}) => Promise<{
|
|
115
115
|
aggregationCount: number;
|
|
116
116
|
aggregateDuration: string;
|
|
117
117
|
}>;
|
|
118
118
|
declare function aggregatePayMovieTicketAction(params: IAggregateParams): (repos: {
|
|
119
119
|
agregation: AggregationRepo;
|
|
120
|
-
|
|
120
|
+
aggregateAction: AggregateActionRepo;
|
|
121
121
|
}) => Promise<{
|
|
122
122
|
aggregationCount: number;
|
|
123
123
|
aggregateDuration: string;
|