@chevre/domain 22.10.0-alpha.7 → 22.10.0-alpha.8

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.
@@ -124,7 +124,7 @@ export declare class EventRepo {
124
124
  * ドキュメント作成時には無視される
125
125
  */
126
126
  $unset?: IUnset<T>;
127
- upsert?: boolean;
127
+ upsert: false;
128
128
  }): Promise<{
129
129
  id: string;
130
130
  }>;
@@ -525,14 +525,15 @@ class EventRepo {
525
525
  savedEventId = id;
526
526
  }
527
527
  else {
528
- const upsert = params.upsert === true;
528
+ // const upsert: boolean = params.upsert === true;
529
+ const upsert = false; // always false(2025-05-15~)
529
530
  doc = yield this.eventModel.findOneAndUpdate({
530
531
  _id: { $eq: params.id },
531
532
  typeOf: { $eq: typeOf }
532
533
  }, Object.assign({
533
534
  // 上書き禁止属性を除外(2022-08-24~)
534
535
  $setOnInsert: Object.assign({ typeOf,
535
- project }, (identifier !== undefined) ? { identifier } : undefined), $set: updateFields }, (params.$unset !== undefined) ? { $unset: params.$unset } : undefined), { upsert, new: true, projection: { _id: 1 } })
536
+ project }, (typeof identifier === 'string' && identifier !== '') ? { identifier } : undefined), $set: updateFields }, (params.$unset !== undefined) ? { $unset: params.$unset } : undefined), { upsert, new: true, projection: { _id: 1 } })
536
537
  .lean()
537
538
  .exec();
538
539
  savedEventId = params.id;
@@ -567,7 +568,6 @@ class EventRepo {
567
568
  _id: p.id,
568
569
  typeOf: p.attributes.typeOf
569
570
  },
570
- // upsertの場合、createがありうるので属性を除外しない
571
571
  update: Object.assign({ $setOnInsert: Object.assign(Object.assign({ typeOf: p.attributes.typeOf, project: p.attributes.project }, (typeof p.attributes.identifier === 'string')
572
572
  ? { identifier: p.attributes.identifier } : undefined), (typeof p.attributes.remainingAttendeeCapacity === 'number')
573
573
  ? { remainingAttendeeCapacity: p.attributes.remainingAttendeeCapacity }
@@ -578,29 +578,6 @@ class EventRepo {
578
578
  }
579
579
  else if (p.attributes.typeOf === factory.eventType.ScreeningEventSeries) {
580
580
  throw new factory.errors.Internal('typeOf: ScreeningEventSeries discontinued');
581
- // 上書き禁止属性を除外(2022-08-24~)
582
- // const { identifier, project, typeOf, ...updateFields } = p.attributes;
583
- // bulkWriteOps.push({
584
- // updateOne: {
585
- // filter: {
586
- // _id: p.id,
587
- // typeOf: p.attributes.typeOf
588
- // },
589
- // // upsertの場合、createがありうるので属性を除外しない
590
- // update: {
591
- // $setOnInsert: {
592
- // typeOf: p.attributes.typeOf,
593
- // project: p.attributes.project,
594
- // ...(typeof p.attributes.identifier === 'string')
595
- // ? { identifier: p.attributes.identifier } : undefined
596
- // },
597
- // $set: updateFields,
598
- // // $unsetに対応(2022-08-31~)
599
- // ...(p.$unset !== undefined) ? { $unset: p.$unset } : undefined
600
- // },
601
- // upsert
602
- // }
603
- // });
604
581
  }
605
582
  });
606
583
  }
@@ -627,7 +604,7 @@ class EventRepo {
627
604
  // upsertの場合、createがありうるので属性を除外しない
628
605
  {
629
606
  $setOnInsert: Object.assign({ _id: id, typeOf,
630
- project }, (identifier !== undefined) ? { identifier } : undefined),
607
+ project }, (typeof identifier === 'string' && identifier !== '') ? { identifier } : undefined),
631
608
  $set: updateFields
632
609
  }, { upsert: true, new: true, projection: { _id: 1 } })
633
610
  .lean()
@@ -69,7 +69,7 @@ function validateMemberTier(params) {
69
69
  var _a, _b, _c, _d, _e;
70
70
  const { acceptedDate, event, availableAt, verifiedValidForMemberTier, memberProgramIdentifierMustBe } = params;
71
71
  const tierIdentifier = (_b = (_a = verifiedValidForMemberTier.member) === null || _a === void 0 ? void 0 : _a.memberOf) === null || _b === void 0 ? void 0 : _b.identifier;
72
- const memberProgramIdentifier = (_e = (_d = (_c = verifiedValidForMemberTier.member) === null || _c === void 0 ? void 0 : _c.memberOf) === null || _d === void 0 ? void 0 : _d.isTier) === null || _e === void 0 ? void 0 : _e.identifier;
72
+ const memberProgramIdentifier = (_e = (_d = (_c = verifiedValidForMemberTier.member) === null || _c === void 0 ? void 0 : _c.memberOf) === null || _d === void 0 ? void 0 : _d.isTierOf) === null || _e === void 0 ? void 0 : _e.identifier;
73
73
  if (typeof tierIdentifier !== 'string') {
74
74
  throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', 'tier identifier must be string');
75
75
  }
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": "4.394.0-alpha.2",
14
+ "@chevre/factory": "4.394.0-alpha.3",
15
15
  "@cinerino/sdk": "10.21.0-alpha.38",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.3.0",
@@ -113,5 +113,5 @@
113
113
  "postversion": "git push origin --tags",
114
114
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
115
115
  },
116
- "version": "22.10.0-alpha.7"
116
+ "version": "22.10.0-alpha.8"
117
117
  }