@chevre/domain 20.1.0-alpha.49 → 20.1.0-alpha.50

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.
@@ -22,10 +22,6 @@ async function main() {
22
22
  typeOf: chevre.factory.personType.Person,
23
23
  id: 'b2bc2b6d-aea2-41fc-9f6e-e4ec89c11d2e',
24
24
  identifier: [
25
- {
26
- name: 'tokenIssuer',
27
- value: String(process.env.ISS)
28
- },
29
25
  {
30
26
  name: 'iss',
31
27
  value: String(process.env.ISS)
@@ -43,10 +43,6 @@ async function main() {
43
43
  typeOf: chevre.factory.personType.Person,
44
44
  id: 'b2bc2b6d-aea2-41fc-9f6e-e4ec89c11d2e',
45
45
  identifier: [
46
- {
47
- name: 'tokenIssuer',
48
- value: String(process.env.ISS)
49
- },
50
46
  {
51
47
  name: 'iss',
52
48
  value: String(process.env.ISS)
@@ -76,7 +76,10 @@ class CognitoRepository {
76
76
  const profile = CognitoRepository.ATTRIBUTE2PROFILE(params);
77
77
  const identifier = [];
78
78
  if (typeof params.userPoolId === 'string') {
79
- identifier.push({ name: 'tokenIssuer', value: `${TOKEN_ISSUER_ENDPOINT}/${params.userPoolId}` }, { name: 'iss', value: `${TOKEN_ISSUER_ENDPOINT}/${params.userPoolId}` });
79
+ identifier.push(
80
+ // 廃止(2022-12-28~)
81
+ // { name: 'tokenIssuer', value: `${TOKEN_ISSUER_ENDPOINT}/${params.userPoolId}` },
82
+ { name: 'iss', value: `${TOKEN_ISSUER_ENDPOINT}/${params.userPoolId}` });
80
83
  }
81
84
  const person = Object.assign(Object.assign({}, profile), { typeOf: factory.personType.Person, id: '', identifier: identifier, memberOf: {
82
85
  membershipNumber: params.username,
@@ -31,34 +31,20 @@ exports.ISS_PREFIX = 'https://cognito-idp.ap-northeast-1.amazonaws.com/';
31
31
  */
32
32
  function orderProgramMembership(params, paymentMethodType) {
33
33
  return (repos) => __awaiter(this, void 0, void 0, function* () {
34
- // let iss = '';
35
- // if (Array.isArray(params.agent.identifier)) {
36
- // const issByAgent = params.agent.identifier?.find((p) => p.name === 'iss')?.value;
37
- // if (typeof issByAgent === 'string' && issByAgent.length > 0) {
38
- // iss = issByAgent.replace(ISS_PREFIX, '');
39
- // }
40
- // }
41
- var _a, _b, _c, _d, _e;
34
+ var _a, _b, _c;
42
35
  // ユーザー存在確認(管理者がマニュアルでユーザーを削除する可能性があるので)
43
36
  const customer = yield repos.person.findById({ userId: String(params.agent.id) });
44
- // issは必ずissからセットし直す
45
- let issByCustomer;
46
- if (Array.isArray(customer.identifier)) {
47
- issByCustomer = (_b = (_a = customer.identifier) === null || _a === void 0 ? void 0 : _a.find((p) => p.name === 'iss')) === null || _b === void 0 ? void 0 : _b.value;
48
- }
49
- if (typeof issByCustomer === 'string' && issByCustomer.length > 0) {
50
- // iss = issByCustomer.replace(ISS_PREFIX, '');
51
- }
52
- else {
37
+ // issに依存するので存在確認
38
+ const issByCustomer = (_b = (_a = customer.identifier) === null || _a === void 0 ? void 0 : _a.find((p) => p.name === 'iss')) === null || _b === void 0 ? void 0 : _b.value;
39
+ if (typeof issByCustomer !== 'string' || issByCustomer.length === 0) {
53
40
  throw new factory.errors.NotFound(`iss of customer ${customer.id}`);
54
41
  }
55
42
  const acceptedOffer = params.object;
56
- // hostingOrganizationへの依存排除 -> acceptedOffer.seller.idへ依存
57
- let sellerId = (_c = acceptedOffer.seller) === null || _c === void 0 ? void 0 : _c.id;
58
- if (typeof sellerId !== 'string') {
59
- // 互換性維持対応として↓
60
- sellerId = (_e = (_d = acceptedOffer.itemOffered) === null || _d === void 0 ? void 0 : _d.hostingOrganization) === null || _e === void 0 ? void 0 : _e.id;
61
- }
43
+ const sellerId = (_c = acceptedOffer.seller) === null || _c === void 0 ? void 0 : _c.id;
44
+ // if (typeof sellerId !== 'string') {
45
+ // // 互換性維持対応として↓
46
+ // sellerId = (<any>acceptedOffer.itemOffered)?.hostingOrganization?.id;
47
+ // }
62
48
  if (typeof sellerId !== 'string') {
63
49
  throw new factory.errors.NotFound('acceptedOffer seller ID undefined');
64
50
  }
package/package.json CHANGED
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "20.1.0-alpha.49"
123
+ "version": "20.1.0-alpha.50"
124
124
  }