@chevre/domain 28.2.0-alpha.2 → 28.2.0-alpha.4

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.
Files changed (88) hide show
  1. package/lib/chevre/repo/action/inform.d.ts +2 -1
  2. package/lib/chevre/repo/action/update.d.ts +2 -1
  3. package/lib/chevre/repo/action/use.d.ts +2 -1
  4. package/lib/chevre/repo/additionalProperty.d.ts +4 -2
  5. package/lib/chevre/repo/additionalProperty.js +6 -7
  6. package/lib/chevre/repo/adminAction.d.ts +3 -2
  7. package/lib/chevre/repo/adminAssetTransaction.d.ts +3 -2
  8. package/lib/chevre/repo/adminAsyncAction.d.ts +3 -2
  9. package/lib/chevre/repo/adminCheckMovieTicketAction.d.ts +2 -1
  10. package/lib/chevre/repo/adminEvent.d.ts +13 -11
  11. package/lib/chevre/repo/adminEvent.js +1 -2
  12. package/lib/chevre/repo/adminEventSeries.d.ts +5 -3
  13. package/lib/chevre/repo/adminEventSeries.js +1 -1
  14. package/lib/chevre/repo/adminPaymentServiceChannel.d.ts +2 -1
  15. package/lib/chevre/repo/adminPendingReservation.d.ts +4 -3
  16. package/lib/chevre/repo/adminScheduledTask.d.ts +3 -2
  17. package/lib/chevre/repo/adminTask.d.ts +5 -4
  18. package/lib/chevre/repo/aggregateOffer.d.ts +8 -7
  19. package/lib/chevre/repo/aggregateOffer.js +6 -8
  20. package/lib/chevre/repo/assetTransaction.d.ts +10 -8
  21. package/lib/chevre/repo/assetTransaction.js +3 -1
  22. package/lib/chevre/repo/authorization.d.ts +5 -3
  23. package/lib/chevre/repo/categoryCode.d.ts +5 -4
  24. package/lib/chevre/repo/categoryCode.js +0 -1
  25. package/lib/chevre/repo/creativeWork.d.ts +7 -6
  26. package/lib/chevre/repo/creativeWork.js +8 -9
  27. package/lib/chevre/repo/customer.d.ts +3 -2
  28. package/lib/chevre/repo/customerType.d.ts +5 -4
  29. package/lib/chevre/repo/emailMessage.d.ts +5 -2
  30. package/lib/chevre/repo/emailMessage.js +10 -8
  31. package/lib/chevre/repo/event.d.ts +4 -2
  32. package/lib/chevre/repo/eventOffer.d.ts +6 -5
  33. package/lib/chevre/repo/eventSellerMakesOffer.d.ts +3 -2
  34. package/lib/chevre/repo/eventSeries.d.ts +4 -2
  35. package/lib/chevre/repo/factory/action/createMongoConditions.d.ts +1 -1
  36. package/lib/chevre/repo/factory/reservation/createMongoConditions.d.ts +3 -2
  37. package/lib/chevre/repo/identity.d.ts +3 -2
  38. package/lib/chevre/repo/identityProvider.d.ts +3 -2
  39. package/lib/chevre/repo/issuer.d.ts +3 -2
  40. package/lib/chevre/repo/issuer.js +6 -7
  41. package/lib/chevre/repo/member.d.ts +6 -5
  42. package/lib/chevre/repo/merchantReturnPolicy.d.ts +6 -4
  43. package/lib/chevre/repo/merchantReturnPolicy.js +12 -10
  44. package/lib/chevre/repo/message.d.ts +4 -3
  45. package/lib/chevre/repo/message.js +1 -2
  46. package/lib/chevre/repo/mongoose/schemas/order.d.ts +5 -1
  47. package/lib/chevre/repo/mongoose/types.d.ts +2 -0
  48. package/lib/chevre/repo/mongoose/types.js +2 -0
  49. package/lib/chevre/repo/movieTicketType.d.ts +2 -1
  50. package/lib/chevre/repo/movieTicketType.js +0 -4
  51. package/lib/chevre/repo/note.d.ts +6 -4
  52. package/lib/chevre/repo/note.js +4 -1
  53. package/lib/chevre/repo/noteAboutOrder.d.ts +6 -4
  54. package/lib/chevre/repo/noteAboutOrder.js +1 -1
  55. package/lib/chevre/repo/offerCatalog.d.ts +5 -4
  56. package/lib/chevre/repo/offerCatalog.js +8 -6
  57. package/lib/chevre/repo/offerCatalogItem.d.ts +4 -3
  58. package/lib/chevre/repo/offerCatalogItem.js +9 -7
  59. package/lib/chevre/repo/offerItemCondition.d.ts +1 -1
  60. package/lib/chevre/repo/offerItemCondition.js +7 -8
  61. package/lib/chevre/repo/order.d.ts +27 -6
  62. package/lib/chevre/repo/paymentService.d.ts +4 -3
  63. package/lib/chevre/repo/paymentServiceProvider.d.ts +4 -2
  64. package/lib/chevre/repo/paymentServiceProvider.js +3 -3
  65. package/lib/chevre/repo/place/entranceGate.d.ts +5 -4
  66. package/lib/chevre/repo/place/movieTheater.d.ts +7 -6
  67. package/lib/chevre/repo/place/movieTheater.js +6 -7
  68. package/lib/chevre/repo/place/screeningRoom.d.ts +7 -6
  69. package/lib/chevre/repo/place/seat.d.ts +5 -4
  70. package/lib/chevre/repo/place/section.d.ts +4 -3
  71. package/lib/chevre/repo/place/section.js +1 -1
  72. package/lib/chevre/repo/potentialAction.d.ts +3 -2
  73. package/lib/chevre/repo/priceSpecification.d.ts +2 -2
  74. package/lib/chevre/repo/priceSpecification.js +1 -1
  75. package/lib/chevre/repo/product.d.ts +7 -6
  76. package/lib/chevre/repo/project.d.ts +4 -3
  77. package/lib/chevre/repo/reservation.d.ts +3 -3
  78. package/lib/chevre/repo/role.d.ts +3 -2
  79. package/lib/chevre/repo/seller.d.ts +4 -3
  80. package/lib/chevre/repo/sellerMakesOffer.d.ts +4 -3
  81. package/lib/chevre/repo/sellerReturnPolicy.d.ts +4 -2
  82. package/lib/chevre/repo/setting.d.ts +4 -3
  83. package/lib/chevre/repo/ticket.d.ts +4 -3
  84. package/lib/chevre/repo/transaction/placeOrder.d.ts +16 -2
  85. package/lib/chevre/repo/transactionNumberCounter.js +1 -1
  86. package/lib/chevre/repo/webSite.d.ts +5 -3
  87. package/lib/chevre/repo/webSite.js +1 -1
  88. package/package.json +2 -2
@@ -1,6 +1,7 @@
1
- import { Connection, FilterQuery, Types, mongo } from 'mongoose';
1
+ import { Connection, Types } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
2
3
  import { factory } from '../factory';
3
- import { IDocType } from './mongoose/schemas/creativeWork';
4
+ import { IModel, IDocType } from './mongoose/schemas/creativeWork';
4
5
  type IKeyOfProjection = keyof factory.creativeWork.movie.ICreativeWork;
5
6
  /**
6
7
  * コンテンツリポジトリ
@@ -8,7 +9,7 @@ type IKeyOfProjection = keyof factory.creativeWork.movie.ICreativeWork;
8
9
  export declare class CreativeWorkRepo {
9
10
  private readonly creativeWorkModel;
10
11
  constructor(connection: Connection);
11
- static CREATE_MONGO_CONDITIONS(params: factory.creativeWork.movie.ISearchConditions): FilterQuery<import("@chevre/factory/lib/chevre/creativeWork/movie").ICreativeWork>[];
12
+ static CREATE_MONGO_CONDITIONS(params: factory.creativeWork.movie.ISearchConditions): FilterQuery<IDocType>[];
12
13
  /**
13
14
  * コンテンツを保管する
14
15
  */
@@ -31,7 +32,7 @@ export declare class CreativeWorkRepo {
31
32
  [key in keyof factory.creativeWork.movie.ICreativeWork]?: 1;
32
33
  };
33
34
  }[]): Promise<{
34
- bulkWriteResult?: mongo.BulkWriteResult;
35
+ bulkWriteResult?: Awaited<ReturnType<IModel['bulkWrite']>>;
35
36
  }>;
36
37
  /**
37
38
  * コンテンツを検索する
@@ -48,7 +49,7 @@ export declare class CreativeWorkRepo {
48
49
  id: string;
49
50
  };
50
51
  }): Promise<void>;
51
- getCursor(conditions: FilterQuery<factory.creativeWork.movie.ICreativeWork>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/creativeWork/movie").ICreativeWork, "id"> & {
52
+ getCursor(conditions: FilterQuery<IDocType>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/creativeWork/movie").ICreativeWork, "id"> & {
52
53
  description?: string;
53
54
  } & {
54
55
  _id: Types.ObjectId;
@@ -62,7 +63,7 @@ export declare class CreativeWorkRepo {
62
63
  __v: number;
63
64
  }) | null>;
64
65
  unsetUnnecessaryFields(params: {
65
- filter: FilterQuery<factory.creativeWork.movie.ICreativeWork>;
66
+ filter: FilterQuery<IDocType>;
66
67
  $unset: any;
67
68
  }): Promise<import("mongoose").UpdateWriteOpResult>;
68
69
  }
@@ -116,25 +116,24 @@ class CreativeWorkRepo {
116
116
  */
117
117
  async saveMovie(params) {
118
118
  let savedId;
119
- let doc;
120
119
  if (typeof params.id !== 'string' || params.id === '') {
121
120
  const { $unset, id, ...createParams } = params; // eslint-disable-line @typescript-eslint/no-unused-vars
122
- doc = await this.creativeWorkModel.create(createParams);
123
- savedId = doc.id;
121
+ const createdDoc = await this.creativeWorkModel.create(createParams);
122
+ savedId = createdDoc.id;
124
123
  }
125
124
  else {
126
125
  // 上書き禁止属性を除外
127
126
  const { id, identifier, project, typeOf, $unset, ...setFields } = params; // eslint-disable-line @typescript-eslint/no-unused-vars
128
- doc = await this.creativeWorkModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
127
+ const doc = await this.creativeWorkModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
129
128
  $set: setFields,
130
129
  ...($unset !== undefined) ? { $unset } : undefined
131
130
  }, { upsert: false, new: true, projection: { _id: 1 } })
132
131
  .exec();
132
+ if (doc === null) {
133
+ throw new factory_1.factory.errors.NotFound(this.creativeWorkModel.modelName);
134
+ }
133
135
  savedId = params.id;
134
136
  }
135
- if (doc === null) {
136
- throw new factory_1.factory.errors.NotFound(this.creativeWorkModel.modelName);
137
- }
138
137
  return { id: savedId };
139
138
  }
140
139
  /**
@@ -197,7 +196,7 @@ class CreativeWorkRepo {
197
196
  // project,
198
197
  // identifier
199
198
  // };
200
- // const updateFilter: UpdateFilter<factory.creativeWork.movie.ICreativeWork> = {
199
+ // const updateFilter: UpdateOneModel<IDocType>['update'] = {
201
200
  // $setOnInsert: setOnInsert,
202
201
  // // 変更可能な属性のみ上書き
203
202
  // $set: {
@@ -211,7 +210,7 @@ class CreativeWorkRepo {
211
210
  // ...(Array.isArray(additionalProperty)) ? { additionalProperty } : []
212
211
  // }
213
212
  // };
214
- // const updateOne: UpdateOneModel<factory.creativeWork.movie.ICreativeWork> = {
213
+ // const updateOne: UpdateOneModel<IDocType> = {
215
214
  // filter,
216
215
  // update: updateFilter,
217
216
  // upsert: true
@@ -1,4 +1,5 @@
1
- import type { Connection, FilterQuery } from 'mongoose';
1
+ import type { Connection } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
2
3
  import { IDocType } from './mongoose/schemas/customer';
3
4
  import { factory } from '../factory';
4
5
  type IUnset = {
@@ -11,7 +12,7 @@ type IKeyOfProjection = keyof factory.customer.ICustomer;
11
12
  export declare class CustomerRepo {
12
13
  private readonly customerModel;
13
14
  constructor(connection: Connection);
14
- static CREATE_MONGO_CONDITIONS(params: factory.customer.ISearchConditions): FilterQuery<factory.customer.ICustomer>[];
15
+ static CREATE_MONGO_CONDITIONS(params: factory.customer.ISearchConditions): FilterQuery<IDocType>[];
15
16
  save(params: {
16
17
  id?: string;
17
18
  attributes: Omit<factory.customer.ICustomer, 'id'> & {
@@ -1,5 +1,6 @@
1
- import type { Connection, FilterQuery, mongo } from 'mongoose';
2
- import { ICustomerType } from './mongoose/schemas/customerType';
1
+ import type { Connection } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
3
+ import { ICustomerType, IModel, IDocType } from './mongoose/schemas/customerType';
3
4
  import { factory } from '../factory';
4
5
  type IKeyOfProjection = keyof ICustomerType;
5
6
  /**
@@ -8,7 +9,7 @@ type IKeyOfProjection = keyof ICustomerType;
8
9
  export declare class CustomerTypeRepo {
9
10
  private readonly customerTypeModel;
10
11
  constructor(connection: Connection);
11
- static CREATE_MONGO_CONDITIONS(params: factory.categoryCode.ISearchConditions): FilterQuery<ICustomerType>[];
12
+ static CREATE_MONGO_CONDITIONS(params: factory.categoryCode.ISearchConditions): FilterQuery<IDocType>[];
12
13
  /**
13
14
  * 検索
14
15
  */
@@ -16,6 +17,6 @@ export declare class CustomerTypeRepo {
16
17
  saveManyByCodeValue(params: {
17
18
  attributes: ICustomerType;
18
19
  upsert?: boolean;
19
- }[]): Promise<mongo.BulkWriteResult | undefined>;
20
+ }[]): Promise<Awaited<ReturnType<IModel['bulkWrite']>> | undefined>;
20
21
  }
21
22
  export {};
@@ -1,4 +1,5 @@
1
- import type { Connection, FilterQuery } from 'mongoose';
1
+ import type { Connection } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
2
3
  import { IDocType } from './mongoose/schemas/emailMessages';
3
4
  import { factory } from '../factory';
4
5
  export type IEmailMessage = IDocType & {
@@ -39,7 +40,9 @@ export declare class EmailMessageRepo {
39
40
  private readonly emailMessageModel;
40
41
  constructor(connection: Connection);
41
42
  static CREATE_MONGO_CONDITIONS(params: ISearchConditions): FilterQuery<IDocType>[];
42
- save(params: IEmailMessage): Promise<any>;
43
+ saveEmailMessage(params: IEmailMessage): Promise<{
44
+ id: string;
45
+ }>;
43
46
  findEmailMessages(params: ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IEmailMessage[]>;
44
47
  deleteById(params: {
45
48
  id: string;
@@ -43,21 +43,23 @@ class EmailMessageRepo {
43
43
  }
44
44
  return andConditions;
45
45
  }
46
- async save(params) {
47
- let doc;
46
+ async saveEmailMessage(params) {
47
+ let savedId;
48
48
  if (typeof params.id !== 'string') {
49
- doc = await this.emailMessageModel.create(params);
49
+ const createdDoc = await this.emailMessageModel.create(params);
50
+ savedId = createdDoc.id;
50
51
  }
51
52
  else {
52
53
  // 上書き禁止属性を除外(2022-08-24~)
53
54
  const { id: _id, identifier: _identifier, project: _project, typeOf: _typeOf, ...updateFields } = params;
54
- doc = await this.emailMessageModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
55
+ const doc = await this.emailMessageModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
55
56
  .exec();
57
+ if (doc === null) {
58
+ throw new factory_1.factory.errors.NotFound(this.emailMessageModel.modelName);
59
+ }
60
+ savedId = params.id;
56
61
  }
57
- if (doc === null) {
58
- throw new factory_1.factory.errors.NotFound(this.emailMessageModel.modelName);
59
- }
60
- return doc.toObject();
62
+ return { id: savedId };
61
63
  }
62
64
  async findEmailMessages(params, inclusion) {
63
65
  const conditions = EmailMessageRepo.CREATE_MONGO_CONDITIONS(params);
@@ -1,6 +1,8 @@
1
- import { Connection, FilterQuery } from 'mongoose';
1
+ import { Connection } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
2
3
  import { factory } from '../factory';
3
4
  import * as EventFactory from '../factory/event';
5
+ import { IDocType } from './mongoose/schemas/event';
4
6
  export type ISearchConditions = Pick<factory.event.screeningEvent.ISearchConditions, 'additionalProperty' | 'endFrom' | 'endThrough' | 'eventStatuses' | 'id' | 'identifiers' | 'inSessionFrom' | 'inSessionThrough' | 'limit' | 'location' | 'offers' | 'organizer' | 'page' | 'project' | 'sort' | 'startFrom' | 'startThrough' | 'superEvent'> & {};
5
7
  export import IMinimizedIndividualEvent = EventFactory.IMinimizedIndividualEvent;
6
8
  type IKeyOfProjection = Exclude<keyof factory.event.screeningEvent.IEvent, 'id'> | 'aggregateOffer' | 'superEvent.location.id' | 'offers.itemOffered' | 'offers.itemOffered.id' | 'offers.typeOf';
@@ -16,7 +18,7 @@ type IKeyOfProjection4minimizedEvent = Exclude<keyof IMinimizedIndividualEvent,
16
18
  export declare class EventRepo {
17
19
  private readonly eventModel;
18
20
  constructor(connection: Connection);
19
- static CREATE_MONGO_CONDITIONS(conditions: ISearchConditions): FilterQuery<factory.event.screeningEvent.IEvent>[];
21
+ static CREATE_MONGO_CONDITIONS(conditions: ISearchConditions): FilterQuery<IDocType>[];
20
22
  /**
21
23
  * イベントを検索する(inclusion projection)
22
24
  */
@@ -1,6 +1,7 @@
1
- import type { Connection, FilterQuery, mongo } from 'mongoose';
1
+ import type { Connection } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
2
3
  import { factory } from '../factory';
3
- import { IDocType } from './mongoose/schemas/eventOffer';
4
+ import { IDocType, IModel } from './mongoose/schemas/eventOffer';
4
5
  type IUnset = {
5
6
  [key in keyof IDocType]?: 1;
6
7
  };
@@ -31,7 +32,7 @@ export declare class EventOfferRepo {
31
32
  */
32
33
  update: boolean;
33
34
  }): Promise<{
34
- bulkWriteResult?: mongo.BulkWriteResult;
35
+ bulkWriteResult?: Awaited<ReturnType<IModel['bulkWrite']>>;
35
36
  modifiedProductOffers?: {
36
37
  id: string;
37
38
  }[];
@@ -46,7 +47,7 @@ export declare class EventOfferRepo {
46
47
  seller: {
47
48
  id: string;
48
49
  };
49
- }): Promise<mongo.DeleteResult>;
50
+ }): Promise<Awaited<ReturnType<IModel['deleteMany']>>>;
50
51
  /**
51
52
  * 有効期間を過ぎたイベントオファーを削除する
52
53
  */
@@ -54,6 +55,6 @@ export declare class EventOfferRepo {
54
55
  validThrough: {
55
56
  $lte: Date;
56
57
  };
57
- }): Promise<mongo.DeleteResult>;
58
+ }): Promise<import("mongodb").DeleteResult>;
58
59
  }
59
60
  export {};
@@ -1,5 +1,6 @@
1
- import type { Connection, mongo } from 'mongoose';
1
+ import type { Connection } from 'mongoose';
2
2
  import { factory } from '../factory';
3
+ import { IModel } from './mongoose/schemas/event';
3
4
  /**
4
5
  * イベントのアプリケーションオファーリポジトリ
5
6
  */
@@ -30,7 +31,7 @@ export declare class EventSellerMakesOfferRepo {
30
31
  };
31
32
  };
32
33
  }[]): Promise<{
33
- bulkWriteResult?: mongo.BulkWriteResult;
34
+ bulkWriteResult?: Awaited<ReturnType<IModel['bulkWrite']>>;
34
35
  modifiedEvents?: {
35
36
  id: string;
36
37
  }[];
@@ -1,5 +1,7 @@
1
- import type { Connection, FilterQuery } from 'mongoose';
1
+ import type { Connection } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
2
3
  import { factory } from '../factory';
4
+ import { IDocType } from './mongoose/schemas/eventSeries';
3
5
  type ISearchConditions = Pick<factory.eventSeries.ISearchConditions, 'limit' | 'page' | 'sort' | 'additionalProperty' | 'endFrom' | 'endThrough' | 'id' | 'inSessionFrom' | 'inSessionThrough' | 'location' | 'name' | 'organizer' | 'project' | 'startFrom' | 'startThrough' | 'videoFormat' | 'workPerformed' | 'movieIdentifier' | 'movieVersion'>;
4
6
  type IKeyOfProjection = Exclude<keyof factory.eventSeries.IEvent, 'id' | 'videoFormat'>;
5
7
  /**
@@ -8,7 +10,7 @@ type IKeyOfProjection = Exclude<keyof factory.eventSeries.IEvent, 'id' | 'videoF
8
10
  export declare class EventSeriesRepo {
9
11
  private readonly eventSeriesModel;
10
12
  constructor(connection: Connection);
11
- static CREATE_MONGO_CONDITIONS(conditions: ISearchConditions): FilterQuery<factory.eventSeries.IEvent>[];
13
+ static CREATE_MONGO_CONDITIONS(conditions: ISearchConditions): FilterQuery<IDocType>[];
12
14
  /**
13
15
  * イベントを検索する(inclusion projection)
14
16
  */
@@ -1,4 +1,4 @@
1
- import { FilterQuery } from 'mongoose';
1
+ import type { FilterQuery } from '../../mongoose/types';
2
2
  import { factory } from '../../../factory';
3
3
  import { IDocType } from '../../mongoose/schemas/action';
4
4
  export type IFindAnyActionsParams = factory.action.ISearchConditions;
@@ -1,3 +1,4 @@
1
- import type { FilterQuery } from 'mongoose';
1
+ import type { FilterQuery } from '../../mongoose/types';
2
+ import { IDocType } from '../../mongoose/schemas/reservation';
2
3
  import { factory } from '../../../factory';
3
- export declare function createMongoConditions(params: factory.reservation.eventReservation.ISearchConditions): FilterQuery<import("@chevre/factory/lib/chevre/reservation/event").IReservation>[];
4
+ export declare function createMongoConditions(params: factory.reservation.eventReservation.ISearchConditions): FilterQuery<IDocType>[];
@@ -1,4 +1,5 @@
1
- import { Connection, FilterQuery, QueryOptions } from 'mongoose';
1
+ import { Connection, QueryOptions } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
2
3
  import { factory } from '../factory';
3
4
  import { IDocType } from './mongoose/schemas/identity';
4
5
  type ISavingSoftwareApplicationIdentity = Pick<factory.creativeWork.certification.softwareApplication.ICertification, 'about' | 'project' | 'typeOf'>;
@@ -22,7 +23,7 @@ type IKeyOfProjection = keyof factory.creativeWork.certification.webApplication.
22
23
  export declare class IdentityRepo {
23
24
  private readonly identityModel;
24
25
  constructor(connection: Connection);
25
- static CREATE_FILTER_QUERY(params: factory.creativeWork.certification.webApplication.ISearchConditions): FilterQuery<factory.creativeWork.certification.webApplication.ICertification>[];
26
+ static CREATE_FILTER_QUERY(params: factory.creativeWork.certification.webApplication.ISearchConditions): FilterQuery<IDocType>[];
26
27
  saveIdentity(params: {
27
28
  id?: string;
28
29
  attributes: ISavingIdentity & IUnset;
@@ -1,4 +1,5 @@
1
- import { Connection, FilterQuery, QueryOptions } from 'mongoose';
1
+ import { Connection, QueryOptions } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
2
3
  import { factory } from '../factory';
3
4
  import { IDocType } from './mongoose/schemas/identityProvider';
4
5
  export type ISavingIdentityProvider = Pick<factory.identityProvider.IIdentityProvider, 'identifier' | 'project' | 'typeOf'> & {
@@ -17,7 +18,7 @@ type IKeyOfProjection = keyof factory.identityProvider.IIdentityProvider;
17
18
  export declare class IdentityProviderRepo {
18
19
  private readonly identityProviderModel;
19
20
  constructor(connection: Connection);
20
- static CREATE_FILTER_QUERY(params: factory.identityProvider.ISearchConditions): FilterQuery<factory.identityProvider.IIdentityProvider>[];
21
+ static CREATE_FILTER_QUERY(params: factory.identityProvider.ISearchConditions): FilterQuery<IDocType>[];
21
22
  save(params: {
22
23
  id?: string;
23
24
  attributes: ISavingIdentityProvider & IUnset;
@@ -1,4 +1,5 @@
1
- import type { Connection, FilterQuery } from 'mongoose';
1
+ import type { Connection } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
2
3
  import { factory } from '../factory';
3
4
  import { IDocType } from './mongoose/schemas/issuer';
4
5
  type IIssuer = factory.issuer.IIssuer;
@@ -9,7 +10,7 @@ type ISearchConditions = factory.issuer.ISearchConditions;
9
10
  export declare class IssuerRepo {
10
11
  private readonly issuerModel;
11
12
  constructor(connection: Connection);
12
- static CREATE_MONGO_CONDITIONS(params: ISearchConditions): FilterQuery<factory.issuer.IIssuer>[];
13
+ static CREATE_MONGO_CONDITIONS(params: ISearchConditions): FilterQuery<IDocType>[];
13
14
  saveIssuer(params: IIssuer): Promise<{
14
15
  id: string;
15
16
  }>;
@@ -34,21 +34,20 @@ class IssuerRepo {
34
34
  }
35
35
  async saveIssuer(params) {
36
36
  let savedId;
37
- let doc;
38
37
  if (params.id === '') {
39
38
  const { id, ...creatingParams } = params; // eslint-disable-line @typescript-eslint/no-unused-vars
40
- doc = await this.issuerModel.create(creatingParams);
41
- savedId = doc.id;
39
+ const createdDoc = await this.issuerModel.create(creatingParams);
40
+ savedId = createdDoc.id;
42
41
  }
43
42
  else {
44
43
  const { id, identifier, project, ...updateFields } = params; // eslint-disable-line @typescript-eslint/no-unused-vars
45
- doc = await this.issuerModel.findOneAndUpdate({ _id: { $eq: params.id } }, { $set: updateFields }, { upsert: false, new: true, projection: { _id: 1 } })
44
+ const doc = await this.issuerModel.findOneAndUpdate({ _id: { $eq: params.id } }, { $set: updateFields }, { upsert: false, new: true, projection: { _id: 1 } })
46
45
  .exec();
46
+ if (doc === null) {
47
+ throw new factory_1.factory.errors.NotFound(this.issuerModel.modelName);
48
+ }
47
49
  savedId = params.id;
48
50
  }
49
- if (doc === null) {
50
- throw new factory_1.factory.errors.NotFound(this.issuerModel.modelName);
51
- }
52
51
  return { id: savedId };
53
52
  }
54
53
  async renameIssuerIdentifier(params) {
@@ -1,6 +1,7 @@
1
- import type { Connection, FilterQuery } from 'mongoose';
1
+ import type { Connection } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
2
3
  import { factory } from '../factory';
3
- import { IGlobalMember } from './mongoose/schemas/member/global';
4
+ import { IGlobalMember, IDocType } from './mongoose/schemas/member/global';
4
5
  type IKeyOfProjection = keyof factory.iam.IMember;
5
6
  export type ICustomerMember = Pick<factory.iam.IMemberOfRole, 'hasRole' | 'id' | 'name' | 'memberOf'> & {
6
7
  /**
@@ -16,7 +17,7 @@ export declare class MemberRepo {
16
17
  private readonly globalMemberModel;
17
18
  private readonly memberModel;
18
19
  constructor(connection: Connection);
19
- static CREATE_MONGO_CONDITIONS(params: factory.iam.ISearchConditions): FilterQuery<factory.iam.IMember>[];
20
+ static CREATE_MONGO_CONDITIONS(params: factory.iam.ISearchConditions): FilterQuery<IDocType>[];
20
21
  /**
21
22
  * プロジェクト指定で検索する
22
23
  */
@@ -74,7 +75,7 @@ export declare class MemberRepo {
74
75
  };
75
76
  };
76
77
  };
77
- }): Promise<string[]>;
78
+ }): Promise<factory.role.organizationRole.RoleName[]>;
78
79
  deleteByProject(params: {
79
80
  project: {
80
81
  id: string;
@@ -201,7 +202,7 @@ export declare class MemberRepo {
201
202
  $eq: string;
202
203
  };
203
204
  };
204
- }): Promise<string[]>;
205
+ }): Promise<factory.role.organizationRole.RoleName[]>;
205
206
  private projectFields;
206
207
  }
207
208
  export {};
@@ -1,4 +1,4 @@
1
- import type { Connection, Document } from 'mongoose';
1
+ import type { Connection } from 'mongoose';
2
2
  import { factory } from '../factory';
3
3
  /**
4
4
  * 返品ポリシーリポジトリ
@@ -7,7 +7,9 @@ export declare class MerchantReturnPolicyRepo {
7
7
  private readonly merchantReturnPolicyModel;
8
8
  constructor(connection: Connection);
9
9
  static CREATE_MONGO_CONDITIONS(params: factory.unitPriceOffer.IOfferMerchantReturnPolicySearchConditions): any[];
10
- save(params: factory.unitPriceOffer.IOfferMerchantReturnPolicy): Promise<any>;
10
+ saveMerchantReturnPolicy(params: factory.unitPriceOffer.IOfferMerchantReturnPolicy): Promise<{
11
+ id: string;
12
+ }>;
11
13
  findById(params: {
12
14
  id: string;
13
15
  }): Promise<factory.unitPriceOffer.IOfferMerchantReturnPolicy>;
@@ -20,7 +22,7 @@ export declare class MerchantReturnPolicyRepo {
20
22
  id: string;
21
23
  };
22
24
  }): Promise<void>;
23
- getCursor(conditions: any, projection: any): import("mongoose").Cursor<Document<unknown, Record<string, never>, factory.unitPriceOffer.IOfferMerchantReturnPolicy, import("./mongoose/virtuals").IVirtuals, {}> & Pick<factory.merchantReturnPolicy.IMerchantReturnPolicy, "typeOf" | "customerRemorseReturnFees" | "customerRemorseReturnFeesMovieTicket"> & {
25
+ getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, factory.unitPriceOffer.IOfferMerchantReturnPolicy, import("./mongoose/virtuals").IVirtuals, {}> & Pick<factory.merchantReturnPolicy.IMerchantReturnPolicy, "typeOf" | "customerRemorseReturnFees" | "customerRemorseReturnFeesMovieTicket"> & {
24
26
  customerRemorseReturnFees: factory.merchantReturnPolicy.ICustomerRemorseReturnFees;
25
27
  customerRemorseReturnFeesMovieTicket: factory.merchantReturnPolicy.ICustomerRemorseReturnFeesMovieTicket;
26
28
  project: Pick<factory.project.IProject, "id" | "typeOf">;
@@ -32,7 +34,7 @@ export declare class MerchantReturnPolicyRepo {
32
34
  _id: import("mongoose").Types.ObjectId;
33
35
  } & {
34
36
  __v: number;
35
- }, import("mongoose").QueryOptions<factory.unitPriceOffer.IOfferMerchantReturnPolicy>, (Document<unknown, Record<string, never>, factory.unitPriceOffer.IOfferMerchantReturnPolicy, import("./mongoose/virtuals").IVirtuals, {}> & Pick<factory.merchantReturnPolicy.IMerchantReturnPolicy, "typeOf" | "customerRemorseReturnFees" | "customerRemorseReturnFeesMovieTicket"> & {
37
+ }, import("mongoose").QueryOptions<factory.unitPriceOffer.IOfferMerchantReturnPolicy>, (import("mongoose").Document<unknown, Record<string, never>, factory.unitPriceOffer.IOfferMerchantReturnPolicy, import("./mongoose/virtuals").IVirtuals, {}> & Pick<factory.merchantReturnPolicy.IMerchantReturnPolicy, "typeOf" | "customerRemorseReturnFees" | "customerRemorseReturnFeesMovieTicket"> & {
36
38
  customerRemorseReturnFees: factory.merchantReturnPolicy.ICustomerRemorseReturnFees;
37
39
  customerRemorseReturnFeesMovieTicket: factory.merchantReturnPolicy.ICustomerRemorseReturnFeesMovieTicket;
38
40
  project: Pick<factory.project.IProject, "id" | "typeOf">;
@@ -72,22 +72,24 @@ class MerchantReturnPolicyRepo {
72
72
  }
73
73
  return andConditions;
74
74
  }
75
- async save(params) {
76
- let doc;
77
- if (params.id === '') {
78
- delete params.id;
79
- doc = await this.merchantReturnPolicyModel.create(params);
75
+ async saveMerchantReturnPolicy(params) {
76
+ let savedId;
77
+ if (typeof params.id !== 'string' || params.id === '') {
78
+ const { id: _id, ...creatingDoc } = params;
79
+ const createdDoc = await this.merchantReturnPolicyModel.create(creatingDoc);
80
+ savedId = createdDoc.id;
80
81
  }
81
82
  else {
82
83
  // 上書き禁止属性を除外(2022-08-24~)
83
84
  const { id, identifier, project, typeOf, ...updateFields } = params; // eslint-disable-line @typescript-eslint/no-unused-vars
84
- doc = await this.merchantReturnPolicyModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
85
+ const doc = await this.merchantReturnPolicyModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
85
86
  .exec();
87
+ if (doc === null) {
88
+ throw new factory_1.factory.errors.NotFound(this.merchantReturnPolicyModel.modelName);
89
+ }
90
+ savedId = params.id;
86
91
  }
87
- if (doc === null) {
88
- throw new factory_1.factory.errors.NotFound(this.merchantReturnPolicyModel.modelName);
89
- }
90
- return doc.toObject();
92
+ return { id: savedId };
91
93
  }
92
94
  async findById(params) {
93
95
  const doc = await this.merchantReturnPolicyModel.findOne({ _id: params.id }, {
@@ -1,6 +1,7 @@
1
- import type { Connection, FilterQuery } from 'mongoose';
1
+ import type { Connection } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
2
3
  import { factory } from '../factory';
3
- import { IEmailMessage } from './mongoose/schemas/message';
4
+ import { IEmailMessage, IDocType } from './mongoose/schemas/message';
4
5
  type IFindByIdentifierResult = Pick<IEmailMessage, 'about' | 'identifier' | 'name' | 'sender' | 'text' | 'toRecipient' | 'typeOf'>;
5
6
  interface ISearchConditions {
6
7
  limit?: number;
@@ -39,7 +40,7 @@ type IKeyOfProjection = keyof IEmailMessage;
39
40
  export declare class MessageRepo {
40
41
  private readonly messageModel;
41
42
  constructor(connection: Connection);
42
- static CREATE_MONGO_CONDITIONS(params: ISearchConditions): FilterQuery<IEmailMessage>[];
43
+ static CREATE_MONGO_CONDITIONS(params: ISearchConditions): FilterQuery<IDocType>[];
43
44
  /**
44
45
  * 検索
45
46
  */
@@ -120,9 +120,8 @@ class MessageRepo {
120
120
  $setOnInsert: setOnInsert,
121
121
  $set: setFields
122
122
  };
123
- const options = { upsert: true };
124
123
  try {
125
- await this.messageModel.updateOne(filter, updateFilter, options)
124
+ await this.messageModel.updateOne(filter, updateFilter, { upsert: true })
126
125
  .exec();
127
126
  }
128
127
  catch (error) {
@@ -22,7 +22,7 @@ export type IMinimizedAcceptedOffer = Pick<factory.acceptedOffer.IOptimizedAccep
22
22
  name?: never;
23
23
  };
24
24
  export type IAcceptedOfferInDoc = IMinimizedAcceptedOffer | factory.acceptedOffer.ICOAAcceptedOffer;
25
- type IDocType = Omit<factory.order.IOrder, 'id'> & {
25
+ type IDocTypeAsOrder = Omit<factory.order.IOrder, 'id'> & {
26
26
  acceptedOffers?: IAcceptedOfferInDoc[];
27
27
  /**
28
28
  * 注文取引IDとして再定義(2026-06-22~)
@@ -33,6 +33,10 @@ type IDocType = Omit<factory.order.IOrder, 'id'> & {
33
33
  */
34
34
  paymentMethodId?: string;
35
35
  };
36
+ type IDocTypeAsPlaceOrder = Omit<IDocTypeAsOrder, 'typeOf'> & {
37
+ typeOf: factory.transactionType.PlaceOrder;
38
+ };
39
+ type IDocType = IDocTypeAsOrder | IDocTypeAsPlaceOrder;
36
40
  type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
37
41
  type ISchemaDefinition = SchemaDefinition<IDocType>;
38
42
  type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
@@ -0,0 +1,2 @@
1
+ import type { FilterQuery } from 'mongoose';
2
+ export { FilterQuery };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
- import { AnyExpression, Connection, FilterQuery } from 'mongoose';
1
+ import { AnyExpression, Connection } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
2
3
  import { IDocType } from './mongoose/schemas/movieTicketTypes';
3
4
  import { factory } from '../factory';
4
5
  type IUnset = {
@@ -178,7 +178,6 @@ class MovieTicketTypeRepo {
178
178
  }
179
179
  async saveMovieTicketType(params) {
180
180
  let savedId;
181
- // let doc: HydratedDocument<{ _id: Types.ObjectId }> | null;
182
181
  if (typeof params.id !== 'string') {
183
182
  const { id, $unset, ...creatingDoc } = params.attributes; // eslint-disable-line @typescript-eslint/no-unused-vars
184
183
  const createResult = await this.categoryCodeModel.create(creatingDoc);
@@ -201,9 +200,6 @@ class MovieTicketTypeRepo {
201
200
  }
202
201
  savedId = params.id;
203
202
  }
204
- // if (doc === null) {
205
- // throw new factory.errors.NotFound(this.categoryCodeModel.modelName);
206
- // }
207
203
  return { id: savedId };
208
204
  }
209
205
  /**
@@ -1,5 +1,7 @@
1
- import type { Connection, FilterQuery, mongo } from 'mongoose';
1
+ import type { Connection } from 'mongoose';
2
+ import type { FilterQuery } from './mongoose/types';
2
3
  import { factory } from '../factory';
4
+ import { IDocType, IModel } from './mongoose/schemas/note';
3
5
  type INoteDigitalDocument = factory.creativeWork.noteDigitalDocument.INoteDigitalDocument;
4
6
  type IKeyOfProjection = keyof INoteDigitalDocument;
5
7
  /**
@@ -8,7 +10,7 @@ type IKeyOfProjection = keyof INoteDigitalDocument;
8
10
  export declare class NoteRepo {
9
11
  private readonly noteModel;
10
12
  constructor(connection: Connection);
11
- static CREATE_MONGO_CONDITIONS(params: factory.creativeWork.noteDigitalDocument.ISearchConditions): FilterQuery<import("@chevre/factory/lib/chevre/creativeWork/noteDigitalDocument").INoteDigitalDocument>[];
13
+ static CREATE_MONGO_CONDITIONS(params: factory.creativeWork.noteDigitalDocument.ISearchConditions): FilterQuery<IDocType>[];
12
14
  findNotes(params: factory.creativeWork.noteDigitalDocument.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<(INoteDigitalDocument & {
13
15
  id: string;
14
16
  })[]>;
@@ -28,7 +30,7 @@ export declare class NoteRepo {
28
30
  */
29
31
  update: boolean;
30
32
  }): Promise<{
31
- bulkWriteResult?: mongo.BulkWriteResult;
33
+ bulkWriteResult?: Awaited<ReturnType<IModel['bulkWrite']>>;
32
34
  modifiedNotes?: {
33
35
  id: string;
34
36
  }[];
@@ -41,7 +43,7 @@ export declare class NoteRepo {
41
43
  id: string;
42
44
  typeOf: factory.creativeWork.noteDigitalDocument.IAbout['typeOf'];
43
45
  };
44
- }): Promise<mongo.DeleteResult>;
46
+ }): Promise<Awaited<ReturnType<IModel['deleteMany']>>>;
45
47
  unsetUnnecessaryFields(params: {
46
48
  filter: any;
47
49
  $unset: any;
@@ -235,9 +235,12 @@ class NoteRepo {
235
235
  * 主題リソースから全メモを削除する
236
236
  */
237
237
  async deleteNotesByAbout(params) {
238
+ if (typeof params.about.typeOf !== 'string' || params.about.typeOf === '') {
239
+ throw new factory_1.factory.errors.ArgumentNull('about.typeOf');
240
+ }
238
241
  return this.noteModel.deleteMany({
239
242
  'about.id': { $eq: String(params.about.id) },
240
- 'about.typeOf': { $eq: String(params.about.typeOf) }
243
+ 'about.typeOf': { $eq: params.about.typeOf }
241
244
  })
242
245
  .exec();
243
246
  }