@chevre/domain 21.13.0-alpha.9 → 21.14.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.
Files changed (71) hide show
  1. package/example/src/chevre/aggregateAllEvents.ts +2 -2
  2. package/example/src/chevre/aggregateAllEvents2.ts +1 -1
  3. package/example/src/chevre/aggregateEventReservation.ts +11 -11
  4. package/example/src/chevre/aggregateSellerPaymentAccepted.ts +1 -1
  5. package/example/src/chevre/aggregation/aggregateSystem.ts +20 -20
  6. package/example/src/chevre/attendIfNotAttended.ts +1 -1
  7. package/example/src/chevre/checkEventDuration.ts +59 -0
  8. package/example/src/chevre/cleanAccountingReports.ts +1 -1
  9. package/example/src/chevre/cleanActions.ts +1 -1
  10. package/example/src/chevre/deleteRunsAtPassedCertainPeriod.ts +1 -1
  11. package/example/src/chevre/deleteTasksByName.ts +1 -1
  12. package/example/src/chevre/findItemListElementByCatalogId.ts +1 -1
  13. package/example/src/chevre/giveUpStartDatePassedCertainPeriod.ts +1 -1
  14. package/example/src/chevre/importCategoryCodesFromCOA.ts +5 -4
  15. package/example/src/chevre/importEventsFromCOA.ts +11 -8
  16. package/example/src/chevre/importOffersFromCOA.ts +7 -6
  17. package/example/src/chevre/lockStockHolder.ts +1 -1
  18. package/example/src/chevre/migrateCategoryCodeAdditionalProperties.ts +2 -2
  19. package/example/src/chevre/migrateCognitoUser.ts +3 -3
  20. package/example/src/chevre/migrateIAMMemberMemberOf.ts +1 -1
  21. package/example/src/chevre/migrateMovieAvailabilityStarts.ts +1 -1
  22. package/example/src/chevre/migrateOrderPaymentMethodIdentifier.ts +3 -3
  23. package/example/src/chevre/migrateOwnershipInfos2newUserPool.ts +2 -2
  24. package/example/src/chevre/migratePayTransactionPaymentMethodId.ts +1 -1
  25. package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +1 -1
  26. package/example/src/chevre/optimizeCatalogs.ts +1 -1
  27. package/example/src/chevre/ownershipInfosCsv2peopleJson.ts +3 -3
  28. package/example/src/chevre/person/globalSignOutAndDisable.ts +1 -1
  29. package/example/src/chevre/person/search.ts +3 -11
  30. package/example/src/chevre/person/updateProfile.ts +2 -2
  31. package/example/src/chevre/place/adminHasPOS.ts +1 -1
  32. package/example/src/chevre/pullAddOnsFromOffer.ts +1 -1
  33. package/example/src/chevre/pushIncludedInDataCatalog.ts +1 -1
  34. package/example/src/chevre/searchActions.ts +1 -1
  35. package/example/src/chevre/searchAggregateOffers.ts +1 -1
  36. package/example/src/chevre/searchAvaialbleAppliesToMovieTicketByOfferCatalogId.ts +5 -5
  37. package/example/src/chevre/searchEventIds.ts +1 -1
  38. package/example/src/chevre/searchEventSeats.ts +1 -1
  39. package/example/src/chevre/searchOfferCatalogItemAvailability.ts +5 -5
  40. package/example/src/chevre/searchOfferCatalogItems.ts +5 -5
  41. package/example/src/chevre/searchOffers.ts +2 -2
  42. package/example/src/chevre/searchPermissions.ts +3 -3
  43. package/example/src/chevre/searchProductOffers.ts +1 -1
  44. package/example/src/chevre/searchSellers.ts +2 -2
  45. package/lib/chevre/repo/creativeWork.js +17 -17
  46. package/lib/chevre/repo/event.d.ts +24 -7
  47. package/lib/chevre/repo/person.d.ts +6 -6
  48. package/lib/chevre/repo/person.js +12 -15
  49. package/lib/chevre/repo/place/hasPOS.d.ts +2 -2
  50. package/lib/chevre/repo/place.d.ts +11 -9
  51. package/lib/chevre/repo/place.js +44 -33
  52. package/lib/chevre/repo/priceSpecification.d.ts +0 -5
  53. package/lib/chevre/repo/priceSpecification.js +0 -9
  54. package/lib/chevre/repo/stockHolder.d.ts +0 -11
  55. package/lib/chevre/repo/stockHolder.js +11 -284
  56. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +0 -7
  57. package/lib/chevre/service/assetTransaction/reserve.js +1 -1
  58. package/lib/chevre/service/event.js +2 -0
  59. package/lib/chevre/service/offer.d.ts +2 -4
  60. package/lib/chevre/service/offer.js +1 -1
  61. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +2 -0
  62. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +8 -3
  63. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -0
  64. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +2 -0
  65. package/lib/chevre/service/task/onResourceUpdated.js +3 -1
  66. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +4 -11
  67. package/package.json +7 -5
  68. package/example/src/chevre/csv2json.ts +0 -57
  69. package/example/src/chevre/deleteMovieTicketCategoryChargePriceSpecs.ts +0 -21
  70. package/example/src/chevre/person/createInformTask.ts +0 -77
  71. package/example/src/chevre/place/migrateHasPOS.ts +0 -76
@@ -23,6 +23,7 @@ const offerCatalog_1 = require("../../repo/offerCatalog");
23
23
  const offerCatalogItem_1 = require("../../repo/offerCatalogItem");
24
24
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
25
25
  const place_1 = require("../../repo/place");
26
+ const hasPOS_1 = require("../../repo/place/hasPOS");
26
27
  const product_1 = require("../../repo/product");
27
28
  const productOffer_1 = require("../../repo/productOffer");
28
29
  const task_1 = require("../../repo/task");
@@ -43,6 +44,7 @@ function call(data) {
43
44
  categoryCode: new categoryCode_1.MongoRepository(connectionSettings.connection),
44
45
  creativeWork: new creativeWork_1.MongoRepository(connectionSettings.connection),
45
46
  event: new event_1.MongoRepository(connectionSettings.connection),
47
+ hasPOS: new hasPOS_1.MongoRepository(connectionSettings.connection, { id: '' }),
46
48
  member: new member_1.MongoRepository(connectionSettings.connection),
47
49
  offer: new offer_1.MongoRepository(connectionSettings.connection),
48
50
  offerCatalog: new offerCatalog_1.MongoRepository(connectionSettings.connection),
@@ -290,7 +292,7 @@ function createInformMovieTheaterTasks(params) {
290
292
  'additionalProperty',
291
293
  'branchCode',
292
294
  'hasEntranceGate',
293
- 'hasPOS',
295
+ // 'hasPOS',
294
296
  'kanaName',
295
297
  'name',
296
298
  'parentOrganization',
@@ -87,19 +87,12 @@ function createPaymentMethods(params) {
87
87
  const paymentMethodOfInvoice = Object.assign({ identifier: paymentMethodType }, (typeof paymentMethodAmountCurrencyByAuthorizeAction === 'string') ?
88
88
  { amount: { currency: paymentMethodAmountCurrencyByAuthorizeAction } }
89
89
  : undefined);
90
- paymentMethods.push({
91
- accountId: resultAsInvoice.accountId,
92
- additionalProperty: (Array.isArray(resultAsInvoice.additionalProperty)) ? resultAsInvoice.additionalProperty : [],
93
- issuedThrough: resultAsInvoice.issuedThrough,
94
- name: resultAsInvoice.name,
95
- paymentMethodId: resultAsInvoice.paymentMethodId,
96
- paymentStatus: resultAsInvoice.paymentStatus,
97
- totalPaymentDue: resultAsInvoice.totalPaymentDue,
98
- typeOf: paymentMethodType,
90
+ paymentMethods.push(Object.assign({ accountId: resultAsInvoice.accountId, additionalProperty: (Array.isArray(resultAsInvoice.additionalProperty)) ? resultAsInvoice.additionalProperty : [], issuedThrough: resultAsInvoice.issuedThrough, name: resultAsInvoice.name, paymentMethodId: resultAsInvoice.paymentMethodId, paymentStatus: resultAsInvoice.paymentStatus, totalPaymentDue: resultAsInvoice.totalPaymentDue,
99
91
  // CreditCardIFのカード通貨区分を追加(2023-08-15~)
100
92
  // 決済方法区分を保証(2023-08-28~)
101
- paymentMethod: paymentMethodOfInvoice
102
- });
93
+ paymentMethod: paymentMethodOfInvoice }, {
94
+ typeOf: paymentMethodType // IFとして廃止だが、互換性維持対応として(2023-10-30~)
95
+ }));
103
96
  });
104
97
  // 決済方法から注文金額の計算
105
98
  price += authorizePaymentActions
package/package.json CHANGED
@@ -9,8 +9,9 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.335.0",
13
- "@cinerino/sdk": "4.0.0-alpha.1",
12
+ "@aws-sdk/credential-providers": "3.433.0",
13
+ "@chevre/factory": "4.337.0",
14
+ "@cinerino/sdk": "5.0.0-alpha.3",
14
15
  "@motionpicture/coa-service": "9.2.0",
15
16
  "@motionpicture/gmo-service": "5.2.0",
16
17
  "@sendgrid/mail": "6.4.0",
@@ -33,6 +34,7 @@
33
34
  },
34
35
  "description": "Chevre Domain Library for Node.js",
35
36
  "devDependencies": {
37
+ "@aws-sdk/client-cognito-identity-provider": "^3.433.0",
36
38
  "@types/debug": "0.0.30",
37
39
  "@types/google-libphonenumber": "^7.4.19",
38
40
  "@types/http-status": "^0.2.30",
@@ -51,7 +53,6 @@
51
53
  "@types/sinon-mongoose": "^1.3.11",
52
54
  "@types/uniqid": "^4.1.3",
53
55
  "@types/uuid": "^3.4.10",
54
- "aws-sdk": "2.1348.0",
55
56
  "coveralls": "^3.1.0",
56
57
  "csvtojson": "^2.0.10",
57
58
  "googleapis": "^85.0.0",
@@ -72,7 +73,7 @@
72
73
  "typescript": "5.0.3"
73
74
  },
74
75
  "peerDependencies": {
75
- "aws-sdk": "^2.0.0",
76
+ "@aws-sdk/client-cognito-identity-provider": "^3.433.0",
76
77
  "mongoose": "^7.0.5",
77
78
  "redis": "^4.6.5"
78
79
  },
@@ -81,6 +82,7 @@
81
82
  "npm": ">=6.0.0"
82
83
  },
83
84
  "keywords": [],
85
+ "license": "UNLICENSED",
84
86
  "main": "./lib/index.js",
85
87
  "types": "./lib/index.d.ts",
86
88
  "files": [
@@ -115,5 +117,5 @@
115
117
  "postversion": "git push origin --tags",
116
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
117
119
  },
118
- "version": "21.13.0-alpha.9"
120
+ "version": "21.14.0"
119
121
  }
@@ -1,57 +0,0 @@
1
- // tslint:disable:no-console
2
- // import * as moment from 'moment';
3
- // import * as mongoose from 'mongoose';
4
- // tslint:disable-next-line:no-implicit-dependencies
5
- import * as csv from 'csvtojson';
6
- import * as fs from 'fs';
7
- import * as json2csv from 'json2csv';
8
-
9
- import { chevre } from '../../../lib/index';
10
-
11
- const csvFilePath = `${__dirname}/transactions.csv`;
12
-
13
- async function main() {
14
-
15
- const personRepo = new chevre.repository.Person({
16
- userPoolId: ''
17
- });
18
-
19
- const transactions = await csv()
20
- .fromFile(csvFilePath);
21
- console.log(transactions);
22
-
23
- const reports = [];
24
- for (const transaction of transactions) {
25
- const people = await personRepo.search({
26
- id: transaction.personId
27
- });
28
- console.log(people.length, people[0]?.memberOf?.membershipNumber, 'people found');
29
-
30
- reports.push({
31
- id: transaction.id,
32
- transactionNumber: transaction.transactionNumber,
33
- startDate: transaction.startDate,
34
- personId: transaction.personId,
35
- username: people[0]?.memberOf?.membershipNumber
36
- });
37
- }
38
- // console.log(reports);
39
- console.log(reports.length);
40
- const fields = ['id', 'transactionNumber', 'startDate', 'personId', 'username'];
41
- const opts = { fields };
42
-
43
- try {
44
- const usernamesCsv = json2csv.parse(reports, opts);
45
- const usernameCsvPath = `${__dirname}/usernames.csv`;
46
- // tslint:disable-next-line:non-literal-fs-path
47
- fs.writeFileSync(usernameCsvPath, usernamesCsv);
48
- } catch (err) {
49
- console.error(err);
50
- }
51
- }
52
-
53
- main()
54
- .then(() => {
55
- console.log('success!');
56
- })
57
- .catch(console.error);
@@ -1,21 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as mongoose from 'mongoose';
3
-
4
- import { chevre } from '../../../lib/index';
5
-
6
- const project = { id: process.env.PROJECT_ID };
7
-
8
- async function main() {
9
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
10
-
11
- const priceSpecificationRepo = new chevre.repository.PriceSpecification(mongoose.connection);
12
-
13
- const result = await priceSpecificationRepo.deleteUnnecessaryMovieTicketTypeChargePriceSpecs({
14
- project: { id: project.id }
15
- });
16
- console.log('deleted', result);
17
- }
18
-
19
- main()
20
- .then()
21
- .catch(console.error);
@@ -1,77 +0,0 @@
1
- // tslint:disable:no-console no-magic-numbers
2
- import * as mongoose from 'mongoose';
3
-
4
- import { chevre } from '../../../../lib/index';
5
-
6
- type IPermitOwnershipInfo = chevre.factory.ownershipInfo.IOwnershipInfo<chevre.factory.ownershipInfo.IPermitAsGood>;
7
-
8
- const project = { id: <string>process.env.PROJECT_ID };
9
-
10
- async function main() {
11
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
12
-
13
- const now = new Date();
14
-
15
- const ownershipInfoRepo = new chevre.repository.OwnershipInfo(mongoose.connection);
16
- const newPersonRepo = new chevre.repository.Person({
17
- userPoolId: <string>process.env.USERPOOL_ID_NEW
18
- });
19
- const oldPersonRepo = new chevre.repository.Person({
20
- userPoolId: <string>process.env.USERPOOL_ID_OLD
21
- });
22
-
23
- const id = 'a7909268-a584-425e-8212-d7d10f344093';
24
-
25
- const profile = await newPersonRepo.findById({
26
- userId: id
27
- });
28
- console.log('profile found');
29
-
30
- let oldUser;
31
- const userIdentitiesStr = profile.additionalProperty?.find((p) => p.name === 'identities')?.value;
32
- if (typeof userIdentitiesStr === 'string' && userIdentitiesStr.length > 0) {
33
- try {
34
- const identities = JSON.parse(userIdentitiesStr);
35
- if (Array.isArray(identities) && identities.length > 0) {
36
- const userIdByIdentities = identities[0].userId;
37
- if (typeof userIdByIdentities === 'string' && userIdByIdentities.length > 0) {
38
- // oldUserは必ず存在するはず
39
- oldUser = await oldPersonRepo.findById({ userId: userIdByIdentities });
40
- }
41
- }
42
- } catch (error) {
43
- // tslint:disable-next-line:no-console
44
- console.error('person2username throwed', error);
45
- throw error;
46
- }
47
- }
48
-
49
- const paymentCardOwnershipInfos = <IPermitOwnershipInfo[]>
50
- await ownershipInfoRepo.search({
51
- sort: { ownedFrom: chevre.factory.sortType.Ascending },
52
- limit: 1,
53
- page: 1,
54
- project: { id: { $eq: project.id } },
55
- ownedFrom: now,
56
- ownedThrough: now,
57
- ownedBy: { id },
58
- typeOfGood: {
59
- issuedThrough: { typeOf: { $eq: chevre.factory.product.ProductType.PaymentCard } }
60
- }
61
- });
62
- const paymentCardOwnershipInfo = paymentCardOwnershipInfos.shift();
63
- console.log('paymentCard found');
64
-
65
- console.log({
66
- id,
67
- // ...profile,
68
- accountNumber: paymentCardOwnershipInfo?.typeOfGood.identifier,
69
- ...oldUser
70
- });
71
- }
72
-
73
- main()
74
- .then(() => {
75
- console.log('success!');
76
- })
77
- .catch(console.error);
@@ -1,76 +0,0 @@
1
- // tslint:disable:no-console
2
- // import * as moment from 'moment';
3
- import * as mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../../lib/index';
6
-
7
- // const project = { id: String(process.env.PROJECT_ID) };
8
- // const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
9
-
10
- // tslint:disable-next-line:max-func-body-length
11
- async function main() {
12
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
-
14
- const placeRepo = new chevre.repository.Place(mongoose.connection);
15
-
16
- const cursor = placeRepo.getCursor(
17
- {
18
- // 'project.id': { $eq: project.id },
19
- // 'project.id': { $ne: EXCLUDED_PROJECT_ID },
20
- typeOf: {
21
- $eq: chevre.factory.placeType.MovieTheater
22
- }
23
- // organizer: { $exists: false }
24
- },
25
- {
26
- branchCode: 1,
27
- _id: 1, name: 1, project: 1, hasPOS: 1
28
- }
29
- );
30
- console.log('places found');
31
-
32
- let i = 0;
33
- let updateCount = 0;
34
- await cursor.eachAsync(async (doc) => {
35
- i += 1;
36
- const movieTheater: Pick<chevre.factory.place.movieTheater.IPlace,
37
- 'branchCode' | 'id' | 'name' | 'project' | 'hasPOS'> = doc.toObject();
38
- console.log(movieTheater);
39
-
40
- if (!Array.isArray(movieTheater.hasPOS)) {
41
- console.log('has no pos', movieTheater.project.id, movieTheater.branchCode, movieTheater.name.ja, i);
42
- } else {
43
- const alreadyMigrated = movieTheater.hasPOS.every((pos) => pos.branchCode === pos.id);
44
- if (alreadyMigrated) {
45
- console.log('already migrated...', movieTheater.project.id, movieTheater.branchCode, movieTheater.name.ja, i);
46
- } else {
47
- if (movieTheater.hasPOS.length > 0) {
48
- const newHasPOS: chevre.factory.place.movieTheater.IPOS[] = movieTheater.hasPOS.map((pos) => {
49
- return {
50
- id: pos.id,
51
- branchCode: pos.id,
52
- name: pos.name
53
- };
54
- });
55
- console.log('updating place...', movieTheater.project.id, movieTheater.branchCode, movieTheater.name.ja, i, newHasPOS);
56
- await placeRepo.saveMovieTheater(<any>{
57
- project: movieTheater.project,
58
- branchCode: movieTheater.branchCode,
59
- id: movieTheater.id,
60
- typeOf: chevre.factory.placeType.MovieTheater,
61
- hasPOS: newHasPOS
62
- });
63
- updateCount += 1;
64
- console.log('updated.', movieTheater.project.id, movieTheater.branchCode, movieTheater.name.ja, i);
65
- }
66
- }
67
- }
68
- });
69
-
70
- console.log(i, 'places checked');
71
- console.log(updateCount, 'places updated');
72
- }
73
-
74
- main()
75
- .then()
76
- .catch(console.error);