@chevre/domain 25.2.0-alpha.41 → 25.2.0-alpha.42

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.
@@ -129,6 +129,6 @@ declare abstract class OfferInCatalogReadOnlyRepo {
129
129
  id: string;
130
130
  }[]>;
131
131
  abstract count(params: Omit<factory.unitPriceOffer.ISearchConditions, 'limit' | 'page' | 'sort'>): Promise<number>;
132
- abstract search(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection): Promise<IOfferInCatalog[]>;
132
+ abstract findUnitPriceOffers(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection): Promise<IOfferInCatalog[]>;
133
133
  }
134
134
  export { KeyOfOffer, IProjection, IOfferInCatalog, IPriceSpecificationConditionsOnSearchWithSortIndex, OfferInCatalogReadOnlyRepo };
@@ -138,10 +138,6 @@ export declare class OfferRepo implements OfferInCatalogReadOnlyRepo {
138
138
  unacceptedPaymentMethod: string[];
139
139
  }): Promise<boolean>;
140
140
  count(params: Omit<factory.unitPriceOffer.ISearchConditions, 'limit' | 'page' | 'sort'>): Promise<number>;
141
- /**
142
- * @deprecated use findUnitPriceOffers
143
- */
144
- search(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection): Promise<IOfferInCatalog[]>;
145
141
  findUnitPriceOffers(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection): Promise<IOfferInCatalog[]>;
146
142
  /**
147
143
  * サブカタログから集計オファーIDリストを検索する
@@ -109,7 +109,7 @@ class OfferRepo {
109
109
  const searchOffersConditions = {
110
110
  parentOffer: { id: { $in: sortedOfferIds } }
111
111
  };
112
- offers = await this.search(searchOffersConditions, params.projection);
112
+ offers = await this.findUnitPriceOffers(searchOffersConditions, params.projection);
113
113
  }
114
114
  return { offers };
115
115
  }
@@ -165,7 +165,7 @@ class OfferRepo {
165
165
  ? { availableAtOrFrom: { id: { $eq: params.availableAtOrFrom.id } } } // store.idでのフィルターをmongoで処理(2023-01-27~)
166
166
  : undefined
167
167
  };
168
- offers = await this.search(searchOffersConditions, params.projection);
168
+ offers = await this.findUnitPriceOffers(searchOffersConditions, params.projection);
169
169
  }
170
170
  return offers;
171
171
  }
@@ -227,7 +227,7 @@ class OfferRepo {
227
227
  ...(typeof params.limit === 'number') ? { limit: params.limit } : undefined,
228
228
  ...(typeof params.page === 'number') ? { page: params.page } : undefined
229
229
  };
230
- offers = await this.search(searchOffersConditions, params.projection);
230
+ offers = await this.findUnitPriceOffers(searchOffersConditions, params.projection);
231
231
  }
232
232
  return { offers, sortedOfferIds };
233
233
  }
@@ -384,46 +384,50 @@ class OfferRepo {
384
384
  .exec();
385
385
  return (result.length > 0) ? result[0].offerCount : 0;
386
386
  }
387
- /**
388
- * @deprecated use findUnitPriceOffers
389
- */
390
- async search(params, projection) {
391
- const matchStages = aggregateOffer_1.AggregateOfferRepo.CREATE_MATCH_STAGE(params);
392
- const projectStage = OfferRepo.CREATE_AGGREGATE_OFFERS_PROJECTION({ ...projection });
393
- const sortByPrice = params.sort?.['priceSpecification.price'];
394
- const sortByIdentifier = params.sort?.identifier;
395
- const aggregate = this.aggregateOfferModel.aggregate([
396
- {
397
- $unwind: {
398
- path: '$offers',
399
- includeArrayIndex: OFFERS_ARRAY_INDEX_NAME
400
- }
401
- },
402
- ...matchStages,
403
- ...(typeof sortByPrice === 'number' || typeof sortByIdentifier === 'number')
404
- ? [
405
- {
406
- $sort: {
407
- ...(typeof sortByPrice === 'number')
408
- ? { 'offers.priceSpecification.price': sortByPrice }
409
- : undefined,
410
- ...(typeof sortByIdentifier === 'number')
411
- ? { 'offers.identifier': sortByIdentifier }
412
- : undefined
413
- }
414
- }
415
- ]
416
- : [],
417
- { $project: projectStage }
418
- ]);
419
- /* istanbul ignore else */
420
- if (typeof params.limit === 'number' && params.limit > 0) {
421
- const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
422
- aggregate.limit(params.limit * page)
423
- .skip(params.limit * (page - 1));
424
- }
425
- return aggregate.exec();
426
- }
387
+ // findUnitPriceOffersへ移行(2026-07-23~)
388
+ // /**
389
+ // * @deprecated use findUnitPriceOffers
390
+ // */
391
+ // public async search(
392
+ // params: factory.unitPriceOffer.ISearchConditions,
393
+ // projection?: IProjection
394
+ // ): Promise<IOfferInCatalog[]> {
395
+ // const matchStages = AggregateOfferRepo.CREATE_MATCH_STAGE(params);
396
+ // const projectStage = OfferRepo.CREATE_AGGREGATE_OFFERS_PROJECTION({ ...projection });
397
+ // const sortByPrice = params.sort?.['priceSpecification.price'];
398
+ // const sortByIdentifier = params.sort?.identifier;
399
+ // const aggregate = this.aggregateOfferModel.aggregate<IOfferInCatalog>([
400
+ // {
401
+ // $unwind: {
402
+ // path: '$offers',
403
+ // includeArrayIndex: OFFERS_ARRAY_INDEX_NAME
404
+ // }
405
+ // },
406
+ // ...matchStages,
407
+ // ...(typeof sortByPrice === 'number' || typeof sortByIdentifier === 'number')
408
+ // ? [
409
+ // {
410
+ // $sort: {
411
+ // ...(typeof sortByPrice === 'number')
412
+ // ? { 'offers.priceSpecification.price': sortByPrice }
413
+ // : undefined,
414
+ // ...(typeof sortByIdentifier === 'number')
415
+ // ? { 'offers.identifier': sortByIdentifier }
416
+ // : undefined
417
+ // }
418
+ // }
419
+ // ]
420
+ // : [],
421
+ // { $project: projectStage }
422
+ // ]);
423
+ // /* istanbul ignore else */
424
+ // if (typeof params.limit === 'number' && params.limit > 0) {
425
+ // const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
426
+ // aggregate.limit(params.limit * page)
427
+ // .skip(params.limit * (page - 1));
428
+ // }
429
+ // return aggregate.exec();
430
+ // }
427
431
  async findUnitPriceOffers(params, projection) {
428
432
  const matchStages = aggregateOffer_1.AggregateOfferRepo.CREATE_MATCH_STAGE(params);
429
433
  const projectStage = OfferRepo.CREATE_AGGREGATE_OFFERS_PROJECTION({ ...projection });
@@ -456,8 +460,11 @@ class OfferRepo {
456
460
  /* istanbul ignore else */
457
461
  if (typeof params.limit === 'number' && params.limit > 0) {
458
462
  const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
459
- aggregate.limit(params.limit * page)
460
- .skip(params.limit * (page - 1));
463
+ // support skip -> limit(2026-07-23~)
464
+ // aggregate.limit(params.limit * page)
465
+ // .skip(params.limit * (page - 1));
466
+ aggregate.skip(params.limit * (page - 1))
467
+ .limit(params.limit);
461
468
  }
462
469
  return aggregate.exec();
463
470
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.1090.0",
13
13
  "@aws-sdk/credential-providers": "3.1090.0",
14
- "@chevre/factory": "10.0.0-alpha.1",
14
+ "@chevre/factory": "10.0.0",
15
15
  "@motionpicture/coa-service": "10.0.0",
16
16
  "@motionpicture/gmo-service": "6.1.0-alpha.0",
17
17
  "@sendgrid/client": "8.1.4",
@@ -88,5 +88,5 @@
88
88
  "postversion": "git push origin --tags",
89
89
  "prepublishOnly": "npm run clean && npm run build"
90
90
  },
91
- "version": "25.2.0-alpha.41"
91
+ "version": "25.2.0-alpha.42"
92
92
  }