@chevre/domain 24.0.0-alpha.79 → 24.0.0-alpha.80
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/acceptedOffer.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +1 -1
- package/lib/chevre/repo/order.d.ts +3 -3
- package/lib/chevre/repo/orderInTransaction.d.ts +2 -2
- package/lib/chevre/repository.d.ts +0 -5
- package/lib/chevre/repository.js +1 -12
- package/lib/chevre/service/assetTransaction/cancelReservation/start.d.ts +1 -1
- package/lib/chevre/service/delivery/factory.d.ts +1 -1
- package/lib/chevre/service/delivery/reservation/factory.d.ts +3 -1
- package/lib/chevre/service/offer/any.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +3 -1
- package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/factory/orderedItem.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/factory.d.ts +1 -1
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +2 -2
- package/lib/chevre/service/transaction/returnOrder/preStart/factory.d.ts +1 -1
- package/package.json +2 -2
- package/lib/chevre/repo/mongoose/schemas/trip.d.ts +0 -11
- package/lib/chevre/repo/mongoose/schemas/trip.js +0 -57
- package/lib/chevre/repo/trip.d.ts +0 -50
- package/lib/chevre/repo/trip.js +0 -214
|
@@ -6,7 +6,7 @@ type IProjection4searchWithUnwoundAcceptedOffers = {
|
|
|
6
6
|
_id?: 0 | 1;
|
|
7
7
|
};
|
|
8
8
|
type IDistinctField = 'acceptedOffers.id' | 'acceptedOffers.itemOffered.reservationNumber' | 'acceptedOffers.itemOffered.reservationFor.id' | 'acceptedOffers.itemOffered.issuedThrough.id' | 'acceptedOffers.itemOffered.typeOf' | 'acceptedOffers.serialNumber' | 'acceptedOffers.offeredThrough.identifier' | 'acceptedOffers.itemOffered.reservationFor.superEvent.location.branchCode' | 'acceptedOffers.itemOffered.object.pendingTransaction.transactionNumber';
|
|
9
|
-
type IAcceptedOffer = factory.order.IAcceptedOffer
|
|
9
|
+
type IAcceptedOffer = factory.order.IAcceptedOffer;
|
|
10
10
|
interface ISearchSlicedAcceptedOffersResult {
|
|
11
11
|
acceptedOffers: IAcceptedOffer[];
|
|
12
12
|
numAcceptedOffers: number;
|
|
@@ -2,7 +2,7 @@ import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from '
|
|
|
2
2
|
import { IVirtuals } from '../virtuals';
|
|
3
3
|
import { factory } from '../../../factory';
|
|
4
4
|
type IDocType = Omit<factory.order.IOrder, 'id'> & {
|
|
5
|
-
acceptedOffers?: factory.order.IAcceptedOffer
|
|
5
|
+
acceptedOffers?: factory.order.IAcceptedOffer[];
|
|
6
6
|
};
|
|
7
7
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
8
8
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
@@ -43,7 +43,7 @@ export declare class OrderRepo {
|
|
|
43
43
|
* なければ作成する
|
|
44
44
|
*/
|
|
45
45
|
createIfNotExist(order: IOrderWithoutAcceptedOffers & {
|
|
46
|
-
acceptedOffers: factory.order.IAcceptedOffer
|
|
46
|
+
acceptedOffers: factory.order.IAcceptedOffer[];
|
|
47
47
|
}): Promise<void>;
|
|
48
48
|
/**
|
|
49
49
|
* 注文ステータスを変更する
|
|
@@ -144,13 +144,13 @@ export declare class OrderRepo {
|
|
|
144
144
|
id: string;
|
|
145
145
|
})[]>;
|
|
146
146
|
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.order.IOrder, "id"> & {
|
|
147
|
-
acceptedOffers?: factory.order.IAcceptedOffer
|
|
147
|
+
acceptedOffers?: factory.order.IAcceptedOffer[];
|
|
148
148
|
} & {
|
|
149
149
|
_id: import("mongoose").Types.ObjectId;
|
|
150
150
|
} & {
|
|
151
151
|
__v: number;
|
|
152
152
|
}, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.order.IOrder, "id"> & {
|
|
153
|
-
acceptedOffers?: factory.order.IAcceptedOffer
|
|
153
|
+
acceptedOffers?: factory.order.IAcceptedOffer[];
|
|
154
154
|
} & {
|
|
155
155
|
_id: import("mongoose").Types.ObjectId;
|
|
156
156
|
} & {
|
|
@@ -3,7 +3,7 @@ import { factory } from '../factory';
|
|
|
3
3
|
type IOrderInTransaction = Pick<factory.order.IOrder, 'orderNumber' | 'project'> & {
|
|
4
4
|
typeOf: factory.transactionType.PlaceOrder;
|
|
5
5
|
orderDate: Date;
|
|
6
|
-
acceptedOffers: factory.order.IAcceptedOffer
|
|
6
|
+
acceptedOffers: factory.order.IAcceptedOffer[];
|
|
7
7
|
customer?: factory.order.ICustomer;
|
|
8
8
|
};
|
|
9
9
|
export type IPlacingOrder = Pick<factory.order.IOrder, 'broker' | 'confirmationNumber' | 'identifier' | 'isGift' | 'name' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'price' | 'priceCurrency' | 'seller' | 'typeOf' | 'url'> & {
|
|
@@ -23,7 +23,7 @@ export declare class OrderInTransactionRepo {
|
|
|
23
23
|
orderNumber: {
|
|
24
24
|
$eq: string;
|
|
25
25
|
};
|
|
26
|
-
}): Promise<factory.order.IAcceptedOffer
|
|
26
|
+
}): Promise<factory.order.IAcceptedOffer[]>;
|
|
27
27
|
/**
|
|
28
28
|
* 注文を受注する
|
|
29
29
|
*/
|
|
@@ -98,7 +98,6 @@ import type { PlaceOrderRepo } from './repo/transaction/placeOrder';
|
|
|
98
98
|
import type { ReturnOrderRepo } from './repo/transaction/returnOrder';
|
|
99
99
|
import type { TransactionNumberRepo } from './repo/transactionNumber';
|
|
100
100
|
import type { TransactionProcessRepo } from './repo/transactionProcess';
|
|
101
|
-
import type { TripRepo } from './repo/trip';
|
|
102
101
|
import type { WebSiteRepo } from './repo/webSite';
|
|
103
102
|
import type { ConfirmationNumberRepo } from './repo/confirmationNumber';
|
|
104
103
|
import type { OrderNumberRepo } from './repo/orderNumber';
|
|
@@ -530,10 +529,6 @@ export type TransactionProcess = TransactionProcessRepo;
|
|
|
530
529
|
export declare namespace TransactionProcess {
|
|
531
530
|
function createInstance(...params: ConstructorParameters<typeof TransactionProcessRepo>): Promise<TransactionProcessRepo>;
|
|
532
531
|
}
|
|
533
|
-
export type Trip = TripRepo;
|
|
534
|
-
export declare namespace Trip {
|
|
535
|
-
function createInstance(...params: ConstructorParameters<typeof TripRepo>): Promise<TripRepo>;
|
|
536
|
-
}
|
|
537
532
|
export declare namespace rateLimit {
|
|
538
533
|
type Offer = OfferRateLimitRepo;
|
|
539
534
|
namespace Offer {
|
package/lib/chevre/repository.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
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.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.AcceptedOffer = void 0;
|
|
4
|
-
exports.WebSite = exports.rateLimit = exports.
|
|
4
|
+
exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = 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.PendingReservation = exports.PaymentServiceProvider = void 0;
|
|
5
5
|
var AcceptedOffer;
|
|
6
6
|
(function (AcceptedOffer) {
|
|
7
7
|
let repo;
|
|
@@ -1127,17 +1127,6 @@ var TransactionProcess;
|
|
|
1127
1127
|
}
|
|
1128
1128
|
TransactionProcess.createInstance = createInstance;
|
|
1129
1129
|
})(TransactionProcess || (exports.TransactionProcess = TransactionProcess = {}));
|
|
1130
|
-
var Trip;
|
|
1131
|
-
(function (Trip) {
|
|
1132
|
-
let repo;
|
|
1133
|
-
async function createInstance(...params) {
|
|
1134
|
-
if (repo === undefined) {
|
|
1135
|
-
repo = (await import('./repo/trip.js')).TripRepo;
|
|
1136
|
-
}
|
|
1137
|
-
return new repo(...params);
|
|
1138
|
-
}
|
|
1139
|
-
Trip.createInstance = createInstance;
|
|
1140
|
-
})(Trip || (exports.Trip = Trip = {}));
|
|
1141
1130
|
var rateLimit;
|
|
1142
1131
|
(function (rateLimit) {
|
|
1143
1132
|
let Offer;
|
|
@@ -18,7 +18,7 @@ export declare function validateStartParams(params: IStartParams): (repos: {
|
|
|
18
18
|
assetTransaction: AssetTransactionRepo;
|
|
19
19
|
}) => Promise<{
|
|
20
20
|
reserveTransaction: import("@chevre/factory/lib/chevre/assetTransaction/reserve").ITransaction | undefined;
|
|
21
|
-
reservations: (Pick<import("@chevre/factory/lib/chevre/reservation/event").IReservation, "id" | "typeOf" | "
|
|
21
|
+
reservations: (Pick<import("@chevre/factory/lib/chevre/reservation/event").IReservation, "id" | "typeOf" | "issuedThrough" | "reservationNumber"> & {
|
|
22
22
|
reservationFor: Pick<factory.reservation.eventReservation.IReservationForMinimized, "id" | "typeOf">;
|
|
23
23
|
})[] | undefined;
|
|
24
24
|
}>;
|
|
@@ -5,7 +5,7 @@ export type IOwnershipInfo = factory.ownershipInfo.IOwnershipInfo<factory.owners
|
|
|
5
5
|
*/
|
|
6
6
|
export declare function createOwnershipInfosFromOrder(params: {
|
|
7
7
|
order: Pick<factory.order.IOrder, 'orderDate' | 'project' | 'customer' | 'orderNumber' | 'seller'> & {
|
|
8
|
-
acceptedOffers: factory.order.IAcceptedOffer
|
|
8
|
+
acceptedOffers: factory.order.IAcceptedOffer[];
|
|
9
9
|
};
|
|
10
10
|
offerIndexBase: number;
|
|
11
11
|
}): IOwnershipInfo[];
|
|
@@ -6,7 +6,9 @@ export declare function createReservationOwnershipInfo(params: {
|
|
|
6
6
|
id: string;
|
|
7
7
|
};
|
|
8
8
|
ownedBy: factory.ownershipInfo.IOwner[];
|
|
9
|
-
acceptedOffer: factory.order.IAcceptedOffer
|
|
9
|
+
acceptedOffer: factory.order.IAcceptedOffer & {
|
|
10
|
+
itemOffered: factory.order.IReservation;
|
|
11
|
+
};
|
|
10
12
|
ownedFrom: Date;
|
|
11
13
|
identifier: string;
|
|
12
14
|
acquiredFrom: factory.ownershipInfo.IAcquiredFrom;
|
|
@@ -10,7 +10,7 @@ export declare function acceptOffer(params: {
|
|
|
10
10
|
project: {
|
|
11
11
|
id: string;
|
|
12
12
|
};
|
|
13
|
-
acceptedOffers: factory.order.IAcceptedOffer
|
|
13
|
+
acceptedOffers: factory.order.IAcceptedOffer[];
|
|
14
14
|
}): IAcceptOfferOperation<void>;
|
|
15
15
|
export declare function voidAcceptedOffer(params: {
|
|
16
16
|
/**
|
|
@@ -32,7 +32,9 @@ declare function acceptedOffers2authorizeResult(params: {
|
|
|
32
32
|
ticketOffers: factory.product.ITicketOffer[];
|
|
33
33
|
}): factory.action.authorize.offer.eventService.IResult;
|
|
34
34
|
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
35
|
-
export type IResultAcceptedOffer = factory.order.IAcceptedOffer
|
|
35
|
+
export type IResultAcceptedOffer = factory.order.IAcceptedOffer & {
|
|
36
|
+
itemOffered: factory.order.IReservation;
|
|
37
|
+
};
|
|
36
38
|
declare function responseBody2acceptedOffers4result(params: {
|
|
37
39
|
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
38
40
|
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
@@ -22,7 +22,9 @@ export declare function offers2resultPrice(offers: IAcceptedOffer4COA[]): {
|
|
|
22
22
|
price: number;
|
|
23
23
|
eligibleMonetaryAmount: never[];
|
|
24
24
|
};
|
|
25
|
-
type IResultAcceptedOffer = factory.order.IAcceptedOffer
|
|
25
|
+
type IResultAcceptedOffer = Omit<factory.order.IAcceptedOffer, 'itemOffered'> & {
|
|
26
|
+
itemOffered: factory.order.ICOAEventReservation;
|
|
27
|
+
};
|
|
26
28
|
/**
|
|
27
29
|
* COA仮予約結果から注文アイテムを生成する
|
|
28
30
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AccountingReportRepo } from '../../repo/accountingReport';
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
3
|
export declare function createAccountingReportIfNotExist(params: Pick<factory.order.IOrder, 'id' | 'orderNumber' | 'project' | 'customer' | 'confirmationNumber' | 'paymentMethods' | 'orderedItem' | 'price' | 'priceCurrency' | 'seller' | 'broker' | 'typeOf' | 'orderDate'> & {
|
|
4
|
-
acceptedOffers: factory.order.IAcceptedOffer
|
|
4
|
+
acceptedOffers: factory.order.IAcceptedOffer[];
|
|
5
5
|
}): (repos: {
|
|
6
6
|
accountingReport: AccountingReportRepo;
|
|
7
7
|
}) => Promise<void>;
|
package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ type IInTransitOrder = Pick<factory.order.IOrder, 'confirmationNumber' | 'projec
|
|
|
5
5
|
limit: number;
|
|
6
6
|
page: number;
|
|
7
7
|
};
|
|
8
|
-
deliveredAcceptedOffers: factory.order.IAcceptedOffer
|
|
8
|
+
deliveredAcceptedOffers: factory.order.IAcceptedOffer[];
|
|
9
9
|
orderStatus: factory.orderStatus.OrderInTransit;
|
|
10
10
|
};
|
|
11
11
|
declare function createInformTasks(params: {
|
|
@@ -3,6 +3,6 @@ import { factory } from '../../../../factory';
|
|
|
3
3
|
* 受入オファーを注文アイテムに変換する
|
|
4
4
|
*/
|
|
5
5
|
declare function acceptedOffers2orderedItem(params: {
|
|
6
|
-
eventReservationAcceptedOffers: factory.order.IAcceptedOffer
|
|
6
|
+
eventReservationAcceptedOffers: factory.order.IAcceptedOffer[];
|
|
7
7
|
}): factory.order.IOrderedItem[];
|
|
8
8
|
export { acceptedOffers2orderedItem };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IPlacingOrder } from '../../../repo/orderInTransaction';
|
|
2
2
|
import { factory } from '../../../factory';
|
|
3
3
|
type IPlaceOrderTransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'project' | 'typeOf' | 'result' | 'object' | 'seller'>;
|
|
4
|
-
type IOrderAcceptedOffer = factory.order.IAcceptedOffer
|
|
4
|
+
type IOrderAcceptedOffer = factory.order.IAcceptedOffer;
|
|
5
5
|
declare function createPaymentMethods(params: {
|
|
6
6
|
authorizePaymentActions: Pick<factory.action.authorize.paymentMethod.any.IAction, 'result'>[];
|
|
7
7
|
}): {
|
|
@@ -12,5 +12,5 @@ declare function createPayObjectServiceOutput(params: {
|
|
|
12
12
|
purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
|
|
13
13
|
};
|
|
14
14
|
}): factory.invoice.IPaymentServiceOutput | undefined;
|
|
15
|
-
type IAcceptedOfferMovieTicketUsed = Pick<factory.order.IAcceptedOffer
|
|
15
|
+
type IAcceptedOfferMovieTicketUsed = Pick<factory.order.IAcceptedOffer, 'itemOffered' | 'priceSpecification'>;
|
|
16
16
|
export { createPayObjectServiceOutput, IAcceptedOfferMovieTicketUsed };
|
|
@@ -4,5 +4,5 @@ declare function validateInvoiceReferencesOrder(authorizePaymentActions: IAuthor
|
|
|
4
4
|
/**
|
|
5
5
|
* 受け入れられた興行オファー
|
|
6
6
|
*/
|
|
7
|
-
eventReservationAcceptedOffers: factory.order.IAcceptedOffer
|
|
7
|
+
eventReservationAcceptedOffers: factory.order.IAcceptedOffer[]): void;
|
|
8
8
|
export { validateInvoiceReferencesOrder };
|
|
@@ -5,7 +5,7 @@ export { IAcceptPayAction, IAuthorizeEventServiceOffer, IAuthorizePaymentAction,
|
|
|
5
5
|
/**
|
|
6
6
|
* 取引が確定可能な状態かどうかをチェックする
|
|
7
7
|
*/
|
|
8
|
-
export declare function validateTransaction(transaction: Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'object'>, acceptPayActions: IAcceptPayAction[], authorizePaymentActions: IAuthorizePaymentAction[], authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[], eventReservationAcceptedOffers: factory.order.IAcceptedOffer
|
|
8
|
+
export declare function validateTransaction(transaction: Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'object'>, acceptPayActions: IAcceptPayAction[], authorizePaymentActions: IAuthorizePaymentAction[], authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[], eventReservationAcceptedOffers: factory.order.IAcceptedOffer[], payTransactions: IPayTransaction[], customer: factory.order.ICustomer): void;
|
|
9
9
|
export type IOrderURLGenerator = (order: factory.order.IOrder) => string;
|
|
10
10
|
/**
|
|
11
11
|
* 注文オファー数検証
|
|
@@ -14,7 +14,7 @@ export declare function validateAcceptedOffers(params: {
|
|
|
14
14
|
result: {
|
|
15
15
|
order: PlaceOrderFactory.IResultOrderParams;
|
|
16
16
|
};
|
|
17
|
-
acceptedOffers: factory.order.IAcceptedOffer
|
|
17
|
+
acceptedOffers: factory.order.IAcceptedOffer[];
|
|
18
18
|
}): void;
|
|
19
19
|
export declare function validateOrderedItem(params: {
|
|
20
20
|
order: Pick<factory.order.IOrder, 'orderedItem'>;
|
|
@@ -15,6 +15,6 @@ type ICustomSellerReturnPolicy = Pick<factory.sellerReturnPolicy.ISellerReturnPo
|
|
|
15
15
|
applicablePaymentMethod?: never;
|
|
16
16
|
merchantReturnDays?: never;
|
|
17
17
|
};
|
|
18
|
-
type IFixedAcceptedOffer = Pick<factory.order.IAcceptedOffer
|
|
18
|
+
type IFixedAcceptedOffer = Pick<factory.order.IAcceptedOffer, 'id' | 'priceSpecification' | 'itemOffered'>;
|
|
19
19
|
type IFixedOrder = Pick<factory.order.IOrder, 'confirmationNumber' | 'dateReturned' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'paymentMethods' | 'price' | 'project' | 'seller' | 'typeOf'>;
|
|
20
20
|
export { IAvailableSellerReturnPolicy, ICustomSellerReturnPolicy, IFixedAcceptedOffer, IFixedOrder };
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "8.0.0-alpha.
|
|
14
|
+
"@chevre/factory": "8.0.0-alpha.2",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.0.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"postversion": "git push origin --tags",
|
|
92
92
|
"prepublishOnly": "npm run clean && npm run build"
|
|
93
93
|
},
|
|
94
|
-
"version": "24.0.0-alpha.
|
|
94
|
+
"version": "24.0.0-alpha.80"
|
|
95
95
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
|
-
import { IVirtuals } from '../virtuals';
|
|
3
|
-
import { factory } from '../../../factory';
|
|
4
|
-
type IDocType = Omit<factory.trip.ITrip<factory.tripType>, 'id'>;
|
|
5
|
-
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
6
|
-
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
7
|
-
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
8
|
-
declare const modelName = "Trip";
|
|
9
|
-
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
10
|
-
declare function createSchema(): ISchema;
|
|
11
|
-
export { createSchema, IDocType, IModel, indexes, modelName };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.modelName = exports.indexes = void 0;
|
|
4
|
-
exports.createSchema = createSchema;
|
|
5
|
-
const mongoose_1 = require("mongoose");
|
|
6
|
-
const writeConcern_1 = require("../writeConcern");
|
|
7
|
-
const settings_1 = require("../../../settings");
|
|
8
|
-
const modelName = 'Trip';
|
|
9
|
-
exports.modelName = modelName;
|
|
10
|
-
const schemaDefinition = {
|
|
11
|
-
project: mongoose_1.SchemaTypes.Mixed,
|
|
12
|
-
typeOf: {
|
|
13
|
-
type: String,
|
|
14
|
-
required: true
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const schemaOptions = {
|
|
18
|
-
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
19
|
-
autoCreate: false,
|
|
20
|
-
collection: 'trips',
|
|
21
|
-
id: true,
|
|
22
|
-
read: settings_1.MONGO_READ_PREFERENCE,
|
|
23
|
-
writeConcern: writeConcern_1.writeConcern,
|
|
24
|
-
strict: false,
|
|
25
|
-
strictQuery: false,
|
|
26
|
-
timestamps: false, // 2024-09-03~
|
|
27
|
-
versionKey: false, // 2024-09-03~
|
|
28
|
-
toJSON: {
|
|
29
|
-
getters: false,
|
|
30
|
-
virtuals: false,
|
|
31
|
-
minimize: false,
|
|
32
|
-
versionKey: false
|
|
33
|
-
},
|
|
34
|
-
toObject: {
|
|
35
|
-
getters: false,
|
|
36
|
-
virtuals: true,
|
|
37
|
-
minimize: false,
|
|
38
|
-
versionKey: false
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const indexes = [];
|
|
42
|
-
exports.indexes = indexes;
|
|
43
|
-
/**
|
|
44
|
-
* トリップスキーマ
|
|
45
|
-
*/
|
|
46
|
-
let schema;
|
|
47
|
-
function createSchema() {
|
|
48
|
-
if (schema === undefined) {
|
|
49
|
-
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
50
|
-
if (settings_1.MONGO_AUTO_INDEX) {
|
|
51
|
-
indexes.forEach((indexParams) => {
|
|
52
|
-
schema?.index(...indexParams);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return schema;
|
|
57
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { Connection } from 'mongoose';
|
|
2
|
-
import { factory } from '../factory';
|
|
3
|
-
export type ISearchConditions<T extends factory.tripType> = factory.trip.ISearchConditions<T>;
|
|
4
|
-
export interface IAttributes4patchUpdate<T extends factory.tripType> {
|
|
5
|
-
typeOf: T;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* トリップリポジトリ
|
|
9
|
-
*/
|
|
10
|
-
export declare class TripRepo {
|
|
11
|
-
private readonly tripModel;
|
|
12
|
-
constructor(connection: Connection);
|
|
13
|
-
static CREATE_MONGO_CONDITIONS<T extends factory.tripType>(conditions: ISearchConditions<T>): any[];
|
|
14
|
-
createMany<T extends factory.tripType>(params: factory.trip.ITrip<T>[]): Promise<factory.trip.ITrip<T>[]>;
|
|
15
|
-
updatePartiallyById<T extends factory.tripType>(params: {
|
|
16
|
-
id: string;
|
|
17
|
-
attributes: IAttributes4patchUpdate<T>;
|
|
18
|
-
}): Promise<factory.trip.ITrip<T>>;
|
|
19
|
-
/**
|
|
20
|
-
* イベントを保管する
|
|
21
|
-
*/
|
|
22
|
-
save<T extends factory.tripType>(params: {
|
|
23
|
-
id?: string;
|
|
24
|
-
attributes: factory.trip.ITrip<T>;
|
|
25
|
-
$unset?: Record<string, number>;
|
|
26
|
-
upsert?: boolean;
|
|
27
|
-
}): Promise<factory.trip.ITrip<T>>;
|
|
28
|
-
saveMany<T extends factory.tripType>(params: {
|
|
29
|
-
id?: string;
|
|
30
|
-
attributes: factory.trip.ITrip<T>;
|
|
31
|
-
$unset?: Record<string, number>;
|
|
32
|
-
upsert?: boolean;
|
|
33
|
-
}[]): Promise<void>;
|
|
34
|
-
search<T extends factory.tripType>(params: ISearchConditions<T>, projection?: Record<string, number>): Promise<factory.trip.ITrip<T>[]>;
|
|
35
|
-
findById<T extends factory.tripType>(params: {
|
|
36
|
-
id: string;
|
|
37
|
-
}, projection?: Record<string, number>): Promise<factory.trip.ITrip<T>>;
|
|
38
|
-
deleteById(params: {
|
|
39
|
-
id: string;
|
|
40
|
-
}): Promise<void>;
|
|
41
|
-
deleteByProject(params: {
|
|
42
|
-
project: {
|
|
43
|
-
id: string;
|
|
44
|
-
};
|
|
45
|
-
}): Promise<void>;
|
|
46
|
-
unsetUnnecessaryFields(params: {
|
|
47
|
-
filter: any;
|
|
48
|
-
$unset: any;
|
|
49
|
-
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
50
|
-
}
|
package/lib/chevre/repo/trip.js
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TripRepo = void 0;
|
|
4
|
-
const factory_1 = require("../factory");
|
|
5
|
-
const trip_1 = require("./mongoose/schemas/trip");
|
|
6
|
-
const settings_1 = require("../settings");
|
|
7
|
-
/**
|
|
8
|
-
* トリップリポジトリ
|
|
9
|
-
*/
|
|
10
|
-
class TripRepo {
|
|
11
|
-
tripModel;
|
|
12
|
-
constructor(connection) {
|
|
13
|
-
this.tripModel = connection.model(trip_1.modelName, (0, trip_1.createSchema)());
|
|
14
|
-
}
|
|
15
|
-
static CREATE_MONGO_CONDITIONS(conditions) {
|
|
16
|
-
const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
|
|
17
|
-
const projectIdEq = conditions.project?.id?.$eq;
|
|
18
|
-
if (typeof projectIdEq === 'string') {
|
|
19
|
-
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
20
|
-
}
|
|
21
|
-
const idIn = conditions.id?.$in;
|
|
22
|
-
if (Array.isArray(idIn)) {
|
|
23
|
-
andConditions.push({ _id: { $in: idIn } });
|
|
24
|
-
}
|
|
25
|
-
const identifierEq = conditions.identifier?.$eq;
|
|
26
|
-
if (typeof identifierEq === 'string') {
|
|
27
|
-
andConditions.push({ identifier: { $eq: identifierEq } });
|
|
28
|
-
}
|
|
29
|
-
const nameRegex = conditions.name?.$regex;
|
|
30
|
-
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
31
|
-
andConditions.push({
|
|
32
|
-
$or: [
|
|
33
|
-
{
|
|
34
|
-
'name.ja': {
|
|
35
|
-
$exists: true,
|
|
36
|
-
$regex: new RegExp(nameRegex)
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
'name.en': {
|
|
41
|
-
$exists: true,
|
|
42
|
-
$regex: new RegExp(nameRegex)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
const additionalPropertyElemMatch = conditions.additionalProperty?.$elemMatch;
|
|
49
|
-
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
50
|
-
andConditions.push({
|
|
51
|
-
additionalProperty: {
|
|
52
|
-
$exists: true,
|
|
53
|
-
$elemMatch: additionalPropertyElemMatch
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
return andConditions;
|
|
58
|
-
}
|
|
59
|
-
async createMany(params) {
|
|
60
|
-
const docs = await this.tripModel.insertMany(params.map((p) => {
|
|
61
|
-
return {
|
|
62
|
-
...p
|
|
63
|
-
};
|
|
64
|
-
}));
|
|
65
|
-
return docs.map((doc) => doc.toObject());
|
|
66
|
-
}
|
|
67
|
-
async updatePartiallyById(params) {
|
|
68
|
-
const { typeOf, ...updateFields } = params.attributes; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
69
|
-
const doc = await this.tripModel.findOneAndUpdate({
|
|
70
|
-
_id: params.id,
|
|
71
|
-
typeOf: params.attributes.typeOf
|
|
72
|
-
}, {
|
|
73
|
-
$set: updateFields
|
|
74
|
-
}, { upsert: false, new: true })
|
|
75
|
-
.exec();
|
|
76
|
-
if (doc === null) {
|
|
77
|
-
throw new factory_1.factory.errors.NotFound(this.tripModel.modelName);
|
|
78
|
-
}
|
|
79
|
-
return doc.toObject();
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* イベントを保管する
|
|
83
|
-
*/
|
|
84
|
-
async save(params) {
|
|
85
|
-
let doc;
|
|
86
|
-
if (typeof params.id !== 'string') {
|
|
87
|
-
doc = await this.tripModel.create({ ...params.attributes });
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
const upsert = params.upsert === true;
|
|
91
|
-
// 上書き禁止属性を除外
|
|
92
|
-
const { identifier, project, typeOf, ...updateFields } = params.attributes; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
93
|
-
doc = await this.tripModel.findOneAndUpdate({
|
|
94
|
-
_id: params.id,
|
|
95
|
-
typeOf: params.attributes.typeOf
|
|
96
|
-
}, {
|
|
97
|
-
$setOnInsert: {
|
|
98
|
-
typeOf: params.attributes.typeOf,
|
|
99
|
-
project: params.attributes.project,
|
|
100
|
-
identifier: params.attributes.identifier
|
|
101
|
-
},
|
|
102
|
-
$set: updateFields,
|
|
103
|
-
...(params.$unset !== undefined) ? { $unset: params.$unset } : undefined
|
|
104
|
-
}, { upsert, new: true })
|
|
105
|
-
.exec();
|
|
106
|
-
}
|
|
107
|
-
if (doc === null) {
|
|
108
|
-
throw new factory_1.factory.errors.NotFound(this.tripModel.modelName);
|
|
109
|
-
}
|
|
110
|
-
return doc.toObject();
|
|
111
|
-
}
|
|
112
|
-
async saveMany(params) {
|
|
113
|
-
const bulkWriteOps = [];
|
|
114
|
-
if (Array.isArray(params)) {
|
|
115
|
-
params.forEach((p) => {
|
|
116
|
-
if (typeof p.id !== 'string') {
|
|
117
|
-
bulkWriteOps.push({
|
|
118
|
-
insertOne: {
|
|
119
|
-
document: { ...p.attributes }
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
const upsert = p.upsert === true;
|
|
125
|
-
if (p.attributes.typeOf === factory_1.factory.tripType.BusTrip) {
|
|
126
|
-
// 上書き禁止属性を除外
|
|
127
|
-
const { identifier, project, typeOf, ...updateFields } = p.attributes; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
128
|
-
bulkWriteOps.push({
|
|
129
|
-
updateOne: {
|
|
130
|
-
filter: {
|
|
131
|
-
_id: p.id,
|
|
132
|
-
typeOf: p.attributes.typeOf
|
|
133
|
-
},
|
|
134
|
-
// upsertの場合、createがありうるので属性を除外しない
|
|
135
|
-
update: {
|
|
136
|
-
$setOnInsert: {
|
|
137
|
-
typeOf: p.attributes.typeOf,
|
|
138
|
-
project: p.attributes.project,
|
|
139
|
-
identifier: p.attributes.identifier
|
|
140
|
-
},
|
|
141
|
-
$set: updateFields,
|
|
142
|
-
...(p.$unset !== undefined) ? { $unset: p.$unset } : undefined
|
|
143
|
-
},
|
|
144
|
-
upsert
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
if (bulkWriteOps.length > 0) {
|
|
152
|
-
await this.tripModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
async search(params, projection) {
|
|
156
|
-
const conditions = TripRepo.CREATE_MONGO_CONDITIONS(params);
|
|
157
|
-
const query = this.tripModel.find({ $and: conditions }, {
|
|
158
|
-
__v: 0,
|
|
159
|
-
createdAt: 0,
|
|
160
|
-
updatedAt: 0,
|
|
161
|
-
...projection
|
|
162
|
-
});
|
|
163
|
-
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
164
|
-
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
165
|
-
query.limit(params.limit)
|
|
166
|
-
.skip(params.limit * (page - 1));
|
|
167
|
-
}
|
|
168
|
-
/* istanbul ignore else */
|
|
169
|
-
if (params.sort !== undefined) {
|
|
170
|
-
query.sort(params.sort);
|
|
171
|
-
}
|
|
172
|
-
// const explainResult = await query.explain()
|
|
173
|
-
// .exec();
|
|
174
|
-
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
175
|
-
// console.log(explainResult[0].executionStats.allPlansExecution);
|
|
176
|
-
// console.log(explainResult[0].queryPlanner?.winningPlan);
|
|
177
|
-
// console.log(explainResult[0].queryPlanner?.winningPlan?.inputStage?.inputStage?.inputStage);
|
|
178
|
-
// console.log(explainResult);
|
|
179
|
-
// return [];
|
|
180
|
-
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
181
|
-
.exec()
|
|
182
|
-
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
183
|
-
}
|
|
184
|
-
async findById(params, projection) {
|
|
185
|
-
const doc = await this.tripModel.findOne({
|
|
186
|
-
_id: params.id
|
|
187
|
-
}, {
|
|
188
|
-
__v: 0,
|
|
189
|
-
createdAt: 0,
|
|
190
|
-
updatedAt: 0,
|
|
191
|
-
...projection
|
|
192
|
-
})
|
|
193
|
-
.exec();
|
|
194
|
-
if (doc === null) {
|
|
195
|
-
throw new factory_1.factory.errors.NotFound(this.tripModel.modelName);
|
|
196
|
-
}
|
|
197
|
-
return doc.toObject();
|
|
198
|
-
}
|
|
199
|
-
async deleteById(params) {
|
|
200
|
-
await this.tripModel.findOneAndDelete({ _id: params.id })
|
|
201
|
-
.exec();
|
|
202
|
-
}
|
|
203
|
-
async deleteByProject(params) {
|
|
204
|
-
await this.tripModel.deleteMany({
|
|
205
|
-
'project.id': { $eq: params.project.id }
|
|
206
|
-
})
|
|
207
|
-
.exec();
|
|
208
|
-
}
|
|
209
|
-
async unsetUnnecessaryFields(params) {
|
|
210
|
-
return this.tripModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
211
|
-
.exec();
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
exports.TripRepo = TripRepo;
|