@chevre/domain 20.13.0 → 20.14.0-alpha.0

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.
@@ -3,15 +3,15 @@ import { chevre } from '../../../../lib/index';
3
3
 
4
4
  async function main() {
5
5
  const personRepo = new chevre.repository.Person({
6
- userPoolId: <string>process.env.COGNITO_USER_POOL_ID
6
+ userPoolId: <string>process.env.USERPOOL_ID_NEW
7
7
  });
8
8
 
9
- const username = 'xx';
9
+ const userId = 'xxx';
10
10
 
11
- const profile = await personRepo.getUserAttributes({
12
- username: username
11
+ await personRepo.globalSignOutAndDisable({
12
+ userId
13
13
  });
14
- console.log('profile:', profile);
14
+ console.log('signed out.');
15
15
  }
16
16
 
17
17
  main()
@@ -20,5 +20,4 @@ main()
20
20
  })
21
21
  .catch((error) => {
22
22
  console.error(error);
23
- console.log(error.code);
24
23
  });
@@ -62,6 +62,12 @@ export declare class CognitoRepository {
62
62
  disable(params: {
63
63
  userId: string;
64
64
  }): Promise<void>;
65
+ /**
66
+ * グローバルサインアウトかつ無効化
67
+ */
68
+ globalSignOutAndDisable(params: {
69
+ userId: string;
70
+ }): Promise<void>;
65
71
  /**
66
72
  * 検索
67
73
  */
@@ -380,6 +380,53 @@ class CognitoRepository {
380
380
  });
381
381
  });
382
382
  }
383
+ /**
384
+ * グローバルサインアウトかつ無効化
385
+ */
386
+ globalSignOutAndDisable(params) {
387
+ return __awaiter(this, void 0, void 0, function* () {
388
+ return new Promise((resolve, reject) => {
389
+ this.cognitoIdentityServiceProvider.listUsers({
390
+ UserPoolId: this.userPoolId,
391
+ Filter: `sub="${params.userId}"`
392
+ }, (listUsersErr, data) => {
393
+ var _a, _b;
394
+ if (listUsersErr instanceof Error) {
395
+ reject(listUsersErr);
396
+ }
397
+ else {
398
+ const username = (_b = (_a = data.Users) === null || _a === void 0 ? void 0 : _a.shift()) === null || _b === void 0 ? void 0 : _b.Username;
399
+ if (typeof username !== 'string') {
400
+ reject(new factory.errors.NotFound('User'));
401
+ }
402
+ else {
403
+ this.cognitoIdentityServiceProvider.adminUserGlobalSignOut({
404
+ UserPoolId: this.userPoolId,
405
+ Username: username
406
+ }, (adminUserGlobalSignOutErr) => {
407
+ if (adminUserGlobalSignOutErr instanceof Error) {
408
+ reject(adminUserGlobalSignOutErr);
409
+ }
410
+ else {
411
+ this.cognitoIdentityServiceProvider.adminDisableUser({
412
+ UserPoolId: this.userPoolId,
413
+ Username: username
414
+ }, (adminDisableUserErr) => {
415
+ if (adminDisableUserErr instanceof Error) {
416
+ reject(adminDisableUserErr);
417
+ }
418
+ else {
419
+ resolve();
420
+ }
421
+ });
422
+ }
423
+ });
424
+ }
425
+ }
426
+ });
427
+ });
428
+ });
429
+ }
383
430
  /**
384
431
  * 検索
385
432
  */
@@ -140,6 +140,47 @@ function createPayObjectServiceOutput(params) {
140
140
  }
141
141
  return paymentServiceOutput;
142
142
  }
143
+ function reservationPriceComponent2invoicePriceComponent(component) {
144
+ var _a;
145
+ const accounting = (typeof ((_a = component.accounting) === null || _a === void 0 ? void 0 : _a.accountsReceivable) === 'number')
146
+ ? { accountsReceivable: component.accounting.accountsReceivable }
147
+ : undefined;
148
+ let minimizedUnitPriceSpec;
149
+ let minimizedMovieTicketTypeChargeSpec;
150
+ let minimizedCategoryCodeChargeSpec;
151
+ if (component.typeOf === factory.priceSpecificationType.UnitPriceSpecification) {
152
+ const appliesToAddOn = (Array.isArray(component.appliesToAddOn))
153
+ ? component.appliesToAddOn.map((addOn) => {
154
+ return { typeOf: addOn.typeOf };
155
+ })
156
+ : undefined;
157
+ minimizedUnitPriceSpec = Object.assign(Object.assign({ typeOf: component.typeOf, price: component.price, referenceQuantity: component.referenceQuantity }, (Array.isArray(appliesToAddOn)) ? { appliesToAddOn } : undefined), (typeof (accounting === null || accounting === void 0 ? void 0 : accounting.accountsReceivable) === 'number') ? { accounting } : undefined);
158
+ }
159
+ else if (component.typeOf === factory.priceSpecificationType.MovieTicketTypeChargeSpecification) {
160
+ minimizedMovieTicketTypeChargeSpec = Object.assign({ typeOf: component.typeOf, price: component.price,
161
+ // 適用決済方法区分を追加(2023-03-29~)
162
+ appliesToMovieTicket: {
163
+ serviceOutput: {
164
+ typeOf: component.appliesToMovieTicket.serviceOutput.typeOf
165
+ }
166
+ } }, (typeof (accounting === null || accounting === void 0 ? void 0 : accounting.accountsReceivable) === 'number') ? { accounting } : undefined);
167
+ }
168
+ else {
169
+ minimizedCategoryCodeChargeSpec = Object.assign({ typeOf: component.typeOf, price: component.price }, (typeof (accounting === null || accounting === void 0 ? void 0 : accounting.accountsReceivable) === 'number') ? { accounting } : undefined);
170
+ }
171
+ if (minimizedUnitPriceSpec !== undefined) {
172
+ return minimizedUnitPriceSpec;
173
+ }
174
+ else if (minimizedMovieTicketTypeChargeSpec !== undefined) {
175
+ return minimizedMovieTicketTypeChargeSpec;
176
+ }
177
+ else if (minimizedCategoryCodeChargeSpec !== undefined) {
178
+ return minimizedCategoryCodeChargeSpec;
179
+ }
180
+ else {
181
+ throw new factory.errors.NotImplemented(`unexpected priceComponent: ${component.typeOf}`);
182
+ }
183
+ }
143
184
  function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType) {
144
185
  var _a, _b;
145
186
  let ticketToken;
@@ -188,23 +229,7 @@ function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType)
188
229
  reservationNumber = reservationOffer.itemOffered.reservationNumber;
189
230
  const priceComponent = (_b = reservationOffer.priceSpecification) === null || _b === void 0 ? void 0 : _b.priceComponent;
190
231
  if (Array.isArray(priceComponent)) {
191
- priceComponents4invoice = priceComponent.map((component) => {
192
- var _a;
193
- const accounting = (typeof ((_a = component.accounting) === null || _a === void 0 ? void 0 : _a.accountsReceivable) === 'number')
194
- ? { accountsReceivable: component.accounting.accountsReceivable }
195
- : undefined;
196
- if (component.typeOf === factory.priceSpecificationType.UnitPriceSpecification) {
197
- const appliesToAddOn = (Array.isArray(component.appliesToAddOn))
198
- ? component.appliesToAddOn.map((addOn) => {
199
- return { typeOf: addOn.typeOf };
200
- })
201
- : undefined;
202
- return Object.assign(Object.assign({ typeOf: component.typeOf, price: component.price, referenceQuantity: component.referenceQuantity }, (Array.isArray(appliesToAddOn)) ? { appliesToAddOn } : undefined), (typeof (accounting === null || accounting === void 0 ? void 0 : accounting.accountsReceivable) === 'number') ? { accounting } : undefined);
203
- }
204
- else {
205
- return Object.assign({ typeOf: component.typeOf, price: component.price }, (typeof (accounting === null || accounting === void 0 ? void 0 : accounting.accountsReceivable) === 'number') ? { accounting } : undefined);
206
- }
207
- });
232
+ priceComponents4invoice = priceComponent.map(reservationPriceComponent2invoicePriceComponent);
208
233
  }
209
234
  }
210
235
  return Object.assign({ priceSpecification: {
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.308.0",
12
+ "@chevre/factory": "4.309.0-alpha.0",
13
13
  "@cinerino/sdk": "3.152.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -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.13.0"
123
+ "version": "20.14.0-alpha.0"
124
124
  }