@chevre/domain 23.2.0 → 24.0.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.
- package/lib/chevre/index.d.ts +2 -1
- package/lib/chevre/index.js +3 -1
- package/lib/chevre/repo/assetTransaction.d.ts +1 -1
- package/lib/chevre/repo/identityProvider.d.ts +4 -4
- package/lib/chevre/repo/potentialAction.d.ts +4 -4
- package/lib/chevre/repo/seller.d.ts +8 -8
- package/lib/chevre/repo/task.d.ts +25 -28
- package/lib/chevre/repo/transaction.d.ts +5 -5
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +3 -2
- package/lib/chevre/service/assetTransaction/reserve/start/factory/addOffers2seat.d.ts +14 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/addOffers2seat.js +63 -0
- package/lib/chevre/service/assetTransaction/reserve/start.js +2 -2
- package/lib/chevre/service/offer.d.ts +0 -12
- package/lib/chevre/service/offer.js +0 -37
- package/lib/chevre/service/task.d.ts +1 -1
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.d.ts +2 -1
- package/lib/chevre/service/taskHandler/onOperationFailed.d.ts +2 -1
- package/lib/chevre/service/taskHandler.d.ts +2 -20
- package/lib/chevre/settings.d.ts +1 -2
- package/lib/chevre/settings.js +1 -3
- package/lib/chevre/taskSettings.d.ts +58 -0
- package/package.json +14 -16
- package/example/src/chevre/acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts +0 -76
- package/example/src/chevre/actions/checkAcceptPayActions.ts +0 -60
- package/example/src/chevre/actions/checkAuthorizePaymentActions.ts +0 -55
- package/example/src/chevre/activateOptionalAggregationSettings.ts +0 -19
- package/example/src/chevre/adminIdentities.ts +0 -71
- package/example/src/chevre/aggreateOwnershipInfosByOrder.ts +0 -24
- package/example/src/chevre/aggregateEventPublicFields.ts +0 -47
- package/example/src/chevre/aggregateOfferCatalogItemList.ts +0 -36
- package/example/src/chevre/aggregateScreeningEventMaxVersion.ts +0 -36
- package/example/src/chevre/aggregation/aggregateOffersOnEvent.ts +0 -86
- package/example/src/chevre/aggregation/aggregateOrderOfCustomer.ts +0 -138
- package/example/src/chevre/aggregation/aggregateOrderOfCustomerGlobally.ts +0 -34
- package/example/src/chevre/aggregation/aggregateOrderOfSeatByRoyalCustomers.ts +0 -172
- package/example/src/chevre/aggregation/aggregateOrderOnSystem.ts +0 -40
- package/example/src/chevre/aggregation/aggregateReservationByProject.ts +0 -79
- package/example/src/chevre/aggregation/aggregateSystem.ts +0 -201
- package/example/src/chevre/aggregation/aggregateTasks.ts +0 -41
- package/example/src/chevre/aggregation/createAggregateEventTasks.ts +0 -71
- package/example/src/chevre/aggregation/searchAggregateReservations.ts +0 -33
- package/example/src/chevre/assetTransaction/checkPayTransactionsTicketToken.ts +0 -67
- package/example/src/chevre/assetTransaction/processReserve.ts +0 -149
- package/example/src/chevre/attendIfNotAttended.ts +0 -31
- package/example/src/chevre/authorizeEventServiceOffer.ts +0 -122
- package/example/src/chevre/categoryCode/checkUniqueness.ts +0 -69
- package/example/src/chevre/changeOrderStatus.ts +0 -29
- package/example/src/chevre/checkCustomerAttributesLength.ts +0 -109
- package/example/src/chevre/checkEventDuration.ts +0 -59
- package/example/src/chevre/checkPaymentServiceUniqueness.ts +0 -79
- package/example/src/chevre/checkProjectMembers.ts +0 -55
- package/example/src/chevre/checkReserveTransactionSizes.ts +0 -46
- package/example/src/chevre/cleanActions.ts +0 -23
- package/example/src/chevre/cleanReservations.ts +0 -69
- package/example/src/chevre/cleanTransactions.ts +0 -39
- package/example/src/chevre/concurrentLock/lockOfferRateLimit.ts +0 -64
- package/example/src/chevre/concurrentLock/lockTransactionProcess.ts +0 -44
- package/example/src/chevre/confirmationNumber/testRandomness.ts +0 -49
- package/example/src/chevre/countPotentiallyExportTasks.ts +0 -42
- package/example/src/chevre/countTransactions.ts +0 -30
- package/example/src/chevre/createProject.ts +0 -19
- package/example/src/chevre/createTaskIfNotExistByAlternateName.ts +0 -57
- package/example/src/chevre/db/stats.ts +0 -35
- package/example/src/chevre/deleteDiscontinuedPeople.ts +0 -153
- package/example/src/chevre/deleteDiscontinuedPeopleByFetch.ts +0 -38
- package/example/src/chevre/deleteOwnershipInfosByOwnedThrough.ts +0 -79
- package/example/src/chevre/deleteStartDatePassedCertainPeriod.ts +0 -27
- package/example/src/chevre/deleteTasksByName.ts +0 -30
- package/example/src/chevre/emailMessage/createEmailMessageText.ts +0 -63
- package/example/src/chevre/event/checkEventAdditionalPropertyUniqueness.ts +0 -108
- package/example/src/chevre/event/importEventSeriesFromCOAByTitle.ts +0 -83
- package/example/src/chevre/event/importEventsFromCOAByTitle.ts +0 -148
- package/example/src/chevre/event/migrateEventAdditionalProperty2identifier.ts +0 -121
- package/example/src/chevre/event/migrateEventMaximumPhysicalAttendeeCapacity.ts +0 -76
- package/example/src/chevre/event/unsetSuperEventVideoFormat.ts +0 -30
- package/example/src/chevre/event/updateSellerMakesOffersByIdentifier.ts +0 -106
- package/example/src/chevre/eventSeries/unsetVideoFormat.ts +0 -31
- package/example/src/chevre/eventSeries/upsertScreeningEventSeriesByVersion.ts +0 -106
- package/example/src/chevre/findAnyEventById.ts +0 -24
- package/example/src/chevre/findAuthorizePaymentAction.ts +0 -34
- package/example/src/chevre/findAvailableChannelMovieTicket.ts +0 -25
- package/example/src/chevre/findCheckAction.ts +0 -34
- package/example/src/chevre/findCustomerByOrderNumber.ts +0 -19
- package/example/src/chevre/findItemListElementByCatalogId.ts +0 -30
- package/example/src/chevre/findItemListElementById.ts +0 -23
- package/example/src/chevre/findJWTSetting.ts +0 -19
- package/example/src/chevre/findOneAvailableHours.ts +0 -39
- package/example/src/chevre/findReservationByCode.ts +0 -64
- package/example/src/chevre/findSchedule.ts +0 -43
- package/example/src/chevre/giveUpStartDatePassedCertainPeriod.ts +0 -56
- package/example/src/chevre/identity/getCommonClients.ts +0 -126
- package/example/src/chevre/identity/migrateClients2oauth.ts +0 -200
- package/example/src/chevre/importCategoryCodesFromCOA.ts +0 -34
- package/example/src/chevre/importEventsFromCOA.ts +0 -66
- package/example/src/chevre/investigateEvents.ts +0 -86
- package/example/src/chevre/investigateTransaction.ts +0 -66
- package/example/src/chevre/isPaymentAcceptedBySeller.ts +0 -24
- package/example/src/chevre/issuer/adminMemberProgramTiers.ts +0 -55
- package/example/src/chevre/issuer/migrateIssuerUrls.ts +0 -62
- package/example/src/chevre/issuer/renameIssuerIdentifier.ts +0 -61
- package/example/src/chevre/maintenance/checkTransactionStatuses.ts +0 -105
- package/example/src/chevre/makeExpiredManyTasks.ts +0 -27
- package/example/src/chevre/makeTransactionExpired.ts +0 -28
- package/example/src/chevre/member/migrateMemberIdentifier.ts +0 -99
- package/example/src/chevre/migrateAuthorizeEventServiceOfferChevre.ts +0 -84
- package/example/src/chevre/migrateCancelReservationObject.ts +0 -71
- package/example/src/chevre/migrateCognitoUser.ts +0 -153
- package/example/src/chevre/migrateCustomerAdditionalProperties.ts +0 -116
- package/example/src/chevre/migrateEventSellerMakesOfferAvailableAt.ts +0 -101
- package/example/src/chevre/migrateIdentities.ts +0 -69
- package/example/src/chevre/migrateProjectSettings.ts +0 -64
- package/example/src/chevre/migrateRoomAdditionalProperties.ts +0 -118
- package/example/src/chevre/migrateRoomSectionAdditionalProperties.ts +0 -121
- package/example/src/chevre/note/findNotes.ts +0 -34
- package/example/src/chevre/note/upsertNotesByIdentifier.ts +0 -63
- package/example/src/chevre/notifyAbortedTasksByEmail.ts +0 -56
- package/example/src/chevre/notifyByEmail.ts +0 -43
- package/example/src/chevre/offerCatalog/updateManyOfferCatalogsByIds.ts +0 -49
- package/example/src/chevre/offerCatalog/upsertOfferCatalogItemsByIdentifier.ts +0 -49
- package/example/src/chevre/offerCatalog/upsertOfferCatalogsByIdentifier.ts +0 -51
- package/example/src/chevre/offers/checkIncludedInCatalogCount.ts +0 -47
- package/example/src/chevre/offers/projectItemListElement.ts +0 -54
- package/example/src/chevre/offers/searchAvaialbleAppliesToMovieTicketByOfferCatalogId.ts +0 -51
- package/example/src/chevre/offers/searchByOfferCatalogIdWithSortIndex.ts +0 -44
- package/example/src/chevre/offers/searchOfferCatalogItemAvailability.ts +0 -68
- package/example/src/chevre/offers/upsertOffersByIdentifier.ts +0 -63
- package/example/src/chevre/optimizeActions.ts +0 -61
- package/example/src/chevre/orderNumber/testRandomness.ts +0 -54
- package/example/src/chevre/orders/searchOrders.ts +0 -28
- package/example/src/chevre/orders/searchWithUnwoundAcceptedOffers.ts +0 -73
- package/example/src/chevre/paymentServices/findPaymentServices.ts +0 -37
- package/example/src/chevre/pendingReservation/findEventSeatOffersBySection.ts +0 -46
- package/example/src/chevre/person/checkUserPoolClients.ts +0 -120
- package/example/src/chevre/person/cleanUpCognitoUsers.ts +0 -140
- package/example/src/chevre/person/cleanUpCognitoUsersByFetch.ts +0 -162
- package/example/src/chevre/person/cleanUpCreditCard.ts +0 -113
- package/example/src/chevre/person/updateProfile.ts +0 -56
- package/example/src/chevre/place/adminEntranceGates.ts +0 -69
- package/example/src/chevre/place/adminHasPOS.ts +0 -44
- package/example/src/chevre/place/aggregateSeatingTypes.ts +0 -29
- package/example/src/chevre/place/checkEntranceGatesCount.ts +0 -82
- package/example/src/chevre/place/checkSectionCount.ts +0 -27
- package/example/src/chevre/place/findRooms.ts +0 -24
- package/example/src/chevre/place/findSections.ts +0 -28
- package/example/src/chevre/place/findSectionsByRoom.ts +0 -50
- package/example/src/chevre/place/migrateSectionIdentifier.ts +0 -92
- package/example/src/chevre/place/seatsJson2csv.ts +0 -63
- package/example/src/chevre/place/upsertMovieTheatersByBranchCode.ts +0 -41
- package/example/src/chevre/place/upsertRoomsByBranchCode.ts +0 -40
- package/example/src/chevre/place/upsertSeatSectionsByBranchCode.ts +0 -56
- package/example/src/chevre/processAction.ts +0 -44
- package/example/src/chevre/processOrder.ts +0 -90
- package/example/src/chevre/product/findHasOfferCatalog.ts +0 -31
- package/example/src/chevre/productOffer/publishMemberTierToken.ts +0 -92
- package/example/src/chevre/project/unsetProjectSettings.ts +0 -73
- package/example/src/chevre/projectEventFieldsById.ts +0 -23
- package/example/src/chevre/projectFields.ts +0 -28
- package/example/src/chevre/projectFieldsById.ts +0 -30
- package/example/src/chevre/projectOwnershipInfoFieldsById.ts +0 -24
- package/example/src/chevre/pushIncludedInDataCatalog.ts +0 -47
- package/example/src/chevre/reExportAction.ts +0 -40
- package/example/src/chevre/reIndex.ts +0 -20
- package/example/src/chevre/recreateRefundTasks.ts +0 -187
- package/example/src/chevre/roles/addAdminAcceptedPaymentMethodReadPermissionIfNotExists.ts +0 -33
- package/example/src/chevre/roles/addAdminAcceptedPaymentMethodWritePermissionIfNotExists.ts +0 -33
- package/example/src/chevre/roles/addAdminEventSeriesReadPermissionIfNotExists.ts +0 -49
- package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +0 -49
- package/example/src/chevre/roles/addAdminNotePermissionIfNotExists.ts +0 -48
- package/example/src/chevre/roles/addAdminPaymentServiceReadPermissionIfNotExists.ts +0 -49
- package/example/src/chevre/roles/addAdminProductHasOfferCatalogReadPermissionIfNotExists.ts +0 -33
- package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +0 -34
- package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +0 -34
- package/example/src/chevre/roles/addAdminSellerEventOfferIfNotExists.ts +0 -48
- package/example/src/chevre/roles/addProjectCreatorRole.ts +0 -48
- package/example/src/chevre/roles/assignGlobalRoles.ts +0 -72
- package/example/src/chevre/roles/findPermissions.ts +0 -84
- package/example/src/chevre/roles/findRoleNames.ts +0 -117
- package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +0 -34
- package/example/src/chevre/roles/removePermissionFromAPIRoles.ts +0 -46
- package/example/src/chevre/roles/removePermissionIfExists.ts +0 -34
- package/example/src/chevre/saveOfferCatalogItem.ts +0 -40
- package/example/src/chevre/saveWebSite.ts +0 -56
- package/example/src/chevre/searchAcceptedOfferIds.ts +0 -57
- package/example/src/chevre/searchActionsByOrderNumber.ts +0 -29
- package/example/src/chevre/searchActionsByPurpose.ts +0 -38
- package/example/src/chevre/searchActionsBySameAs.ts +0 -27
- package/example/src/chevre/searchAggregateOffers.ts +0 -51
- package/example/src/chevre/searchAggregations.ts +0 -50
- package/example/src/chevre/searchAuthorizations.ts +0 -36
- package/example/src/chevre/searchCheckMovieTicketResultYkknInfo.ts +0 -56
- package/example/src/chevre/searchEventHasOfferCatalog.ts +0 -43
- package/example/src/chevre/searchEventSeats.ts +0 -45
- package/example/src/chevre/searchIdsByReservationNumber.ts +0 -16
- package/example/src/chevre/searchMembers.ts +0 -55
- package/example/src/chevre/searchOfferCatalogItemListElement.ts +0 -26
- package/example/src/chevre/searchOffers.ts +0 -68
- package/example/src/chevre/searchProducts.ts +0 -28
- package/example/src/chevre/searchProjects.ts +0 -36
- package/example/src/chevre/searchReservationsByOrder.ts +0 -42
- package/example/src/chevre/searchSellersByAggregate.ts +0 -33
- package/example/src/chevre/searchSlicedAcceptedOffersByOrderNumber.ts +0 -31
- package/example/src/chevre/seller/adminMakesOffer.ts +0 -113
- package/example/src/chevre/sendEmailMessage.ts +0 -60
- package/example/src/chevre/sendGrid/filterEmailActivity.ts +0 -31
- package/example/src/chevre/settings/addOrderNumberSetting.ts +0 -44
- package/example/src/chevre/settings/addTransactionNumberSetting.ts +0 -40
- package/example/src/chevre/stockHolder/findSeatsBySection.ts +0 -59
- package/example/src/chevre/stockHolder/getSize.ts +0 -97
- package/example/src/chevre/stockHolder/projectPendingReservation.ts +0 -43
- package/example/src/chevre/stockHolder/searchSeats.ts +0 -61
- package/example/src/chevre/task/countPotentiallyRunning.ts +0 -41
- package/example/src/chevre/task/countTasks.ts +0 -51
- package/example/src/chevre/task/deleteRunsAtPassedCertainPeriod.ts +0 -43
- package/example/src/chevre/task/deleteUnexpectedTasks.ts +0 -23
- package/example/src/chevre/task/emitRunning.ts +0 -89
- package/example/src/chevre/transaction/processPlaceOrder.ts +0 -57
- package/example/src/chevre/transaction/processReturnOrder.ts +0 -43
- package/example/src/chevre/transaction/startExportTasks.ts +0 -21
- package/example/src/chevre/transactionNumber/publishByTimestamp.ts +0 -23
- package/example/src/chevre/transactionNumber/testRandomness.ts +0 -42
- package/example/src/chevre/unsetUnnecessaryFields.ts +0 -35
- package/example/src/chevre/updateEventPartiallyById.ts +0 -22
- package/example/src/chevre/updateProjectAggregateReservation.ts +0 -21
- package/example/src/chevre/validateCheckMovieTicketActions.ts +0 -70
- package/example/src/customSearch.ts +0 -48
- package/example/src/duration.ts +0 -22
- package/example/src/fetch.ts +0 -45
- package/example/src/moment.ts +0 -22
- package/example/src/mongoConnectionList.ts +0 -81
- package/example/src/mvtkMessage.ts +0 -11
- package/example/src/objectId.ts +0 -12
- package/example/src/redisClientList.ts +0 -80
- package/example/src/redisMulti.ts +0 -63
- package/example/src/regex.ts +0 -31
- package/example/src/signPayload.ts +0 -50
- package/example/src/verifyToken.ts +0 -44
- package/lib/chevre/repo/mongoose/onIndexCreated.d.ts +0 -2
- package/lib/chevre/repo/mongoose/onIndexCreated.js +0 -10
- package/lib/chevre/settings/aggregation.d.ts +0 -35
- /package/lib/chevre/{settings/aggregation.js → taskSettings.js} +0 -0
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import type { CognitoIdentityProvider as CognitoIdentityServiceProvider } from '@aws-sdk/client-cognito-identity-provider';
|
|
3
|
-
import mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { IGlobalMember } from '../../../../lib/chevre/repo/mongoose/schemas/member/global';
|
|
6
|
-
import { chevre } from '../../../../lib/index';
|
|
7
|
-
|
|
8
|
-
const { PROJECT_CREATOR_SUB } = process.env;
|
|
9
|
-
|
|
10
|
-
let cognitoIdentityServiceProvider: CognitoIdentityServiceProvider | undefined;
|
|
11
|
-
|
|
12
|
-
async function main() {
|
|
13
|
-
if (typeof PROJECT_CREATOR_SUB !== 'string') {
|
|
14
|
-
throw new Error('PROJECT_CREATOR_SUB setting required');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
18
|
-
|
|
19
|
-
const memberRepo = await chevre.repository.Member.createInstance(mongoose.connection);
|
|
20
|
-
const settingRepo = await chevre.repository.Setting.createInstance(mongoose.connection);
|
|
21
|
-
const setting = await settingRepo.findOne({ project: { id: { $eq: '*' } } }, ['userPoolIdNew']);
|
|
22
|
-
if (typeof setting?.userPoolIdNew !== 'string') {
|
|
23
|
-
throw new chevre.factory.errors.NotFound('setting.userPoolIdNew');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
let globalMember: IGlobalMember;
|
|
27
|
-
|
|
28
|
-
if (cognitoIdentityServiceProvider === undefined) {
|
|
29
|
-
const { CognitoIdentityProvider } = await import('@aws-sdk/client-cognito-identity-provider');
|
|
30
|
-
const { fromEnv } = await import('@aws-sdk/credential-providers');
|
|
31
|
-
cognitoIdentityServiceProvider = new CognitoIdentityProvider({
|
|
32
|
-
apiVersion: 'latest',
|
|
33
|
-
region: 'ap-northeast-1',
|
|
34
|
-
credentials: fromEnv()
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
const personRepo = await chevre.repository.Person.createInstance({
|
|
38
|
-
userPoolId: setting.userPoolIdNew,
|
|
39
|
-
cognitoIdentityServiceProvider
|
|
40
|
-
});
|
|
41
|
-
const profile = await personRepo.findById({ userId: PROJECT_CREATOR_SUB });
|
|
42
|
-
const memberName = (typeof profile.givenName === 'string' && typeof profile.familyName === 'string')
|
|
43
|
-
? `${profile.givenName} ${profile.familyName}`
|
|
44
|
-
: profile.memberOf?.membershipNumber;
|
|
45
|
-
|
|
46
|
-
globalMember = {
|
|
47
|
-
typeOf: chevre.factory.role.RoleType.OrganizationRole,
|
|
48
|
-
member: {
|
|
49
|
-
typeOf: chevre.factory.personType.Person,
|
|
50
|
-
id: profile.id,
|
|
51
|
-
name: memberName,
|
|
52
|
-
username: profile.memberOf?.membershipNumber,
|
|
53
|
-
hasRole: [{
|
|
54
|
-
typeOf: chevre.factory.role.RoleType.OrganizationRole,
|
|
55
|
-
roleName: <any>'projectCreator'
|
|
56
|
-
}]
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
console.log(profile, globalMember);
|
|
60
|
-
|
|
61
|
-
const existingGlobalMemberRoles = await memberRepo.findGlobalRoleNamesByMember({ member: { id: { $eq: globalMember.member.id } } });
|
|
62
|
-
console.log('existingGlobalMemberRoles:', existingGlobalMemberRoles);
|
|
63
|
-
|
|
64
|
-
// 権限作成
|
|
65
|
-
await memberRepo.createGlobalMember([globalMember]);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
main()
|
|
69
|
-
.then(() => {
|
|
70
|
-
console.log('success!');
|
|
71
|
-
})
|
|
72
|
-
.catch(console.error);
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
// import moment from 'moment';
|
|
3
|
-
import mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../../lib/index';
|
|
6
|
-
|
|
7
|
-
const formatter = new Intl.NumberFormat('ja-JP');
|
|
8
|
-
|
|
9
|
-
const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
10
|
-
const memberId = 'b3640a78-babd-4da4-81d3-7dcf4881a4a5';
|
|
11
|
-
|
|
12
|
-
async function main() {
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
14
|
-
|
|
15
|
-
const memberRepo = await chevre.repository.Member.createInstance(mongoose.connection);
|
|
16
|
-
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
17
|
-
|
|
18
|
-
let startTime: [number, number] = process.hrtime();
|
|
19
|
-
let diff: [number, number] = process.hrtime(startTime);
|
|
20
|
-
let result: any;
|
|
21
|
-
|
|
22
|
-
startTime = process.hrtime();
|
|
23
|
-
result = await (await chevre.service.iam.createService()).findProjectPermissionsByMember({
|
|
24
|
-
project: { id: PROJECT_ID },
|
|
25
|
-
member: {
|
|
26
|
-
id: memberId,
|
|
27
|
-
memberOf: {
|
|
28
|
-
id: PROJECT_ID,
|
|
29
|
-
typeOf: chevre.factory.organizationType.Project
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
})({
|
|
33
|
-
member: memberRepo,
|
|
34
|
-
role: roleRepo
|
|
35
|
-
});
|
|
36
|
-
diff = process.hrtime(startTime);
|
|
37
|
-
console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
38
|
-
console.log(result.roleNames.length, 'roleNames found');
|
|
39
|
-
console.log(result.permissions.length, 'permissions found');
|
|
40
|
-
|
|
41
|
-
startTime = process.hrtime();
|
|
42
|
-
result = await (await chevre.service.iam.createService()).findProjectPermissionsByMember({
|
|
43
|
-
project: { id: PROJECT_ID },
|
|
44
|
-
member: {
|
|
45
|
-
id: memberId,
|
|
46
|
-
memberOf: {
|
|
47
|
-
id: PROJECT_ID,
|
|
48
|
-
typeOf: chevre.factory.organizationType.Project
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
})({
|
|
52
|
-
member: memberRepo,
|
|
53
|
-
role: roleRepo
|
|
54
|
-
});
|
|
55
|
-
diff = process.hrtime(startTime);
|
|
56
|
-
console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
57
|
-
console.log(result.roleNames.length, 'roleNames found');
|
|
58
|
-
console.log(result.permissions.length, 'permissions found');
|
|
59
|
-
|
|
60
|
-
startTime = process.hrtime();
|
|
61
|
-
result = await (await chevre.service.iam.createService()).findProjectPermissionsByMember({
|
|
62
|
-
project: { id: PROJECT_ID },
|
|
63
|
-
member: {
|
|
64
|
-
id: memberId,
|
|
65
|
-
memberOf: {
|
|
66
|
-
id: PROJECT_ID,
|
|
67
|
-
typeOf: chevre.factory.organizationType.Project
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
})({
|
|
71
|
-
member: memberRepo,
|
|
72
|
-
role: roleRepo
|
|
73
|
-
});
|
|
74
|
-
diff = process.hrtime(startTime);
|
|
75
|
-
console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
76
|
-
console.log(result.roleNames.length, 'roleNames found');
|
|
77
|
-
console.log(result.permissions.length, 'permissions found');
|
|
78
|
-
|
|
79
|
-
console.log(result);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
main()
|
|
83
|
-
.then(console.log)
|
|
84
|
-
.catch(console.error);
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
// import moment from 'moment';
|
|
3
|
-
import mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../../lib/index';
|
|
6
|
-
|
|
7
|
-
const formatter = new Intl.NumberFormat('ja-JP');
|
|
8
|
-
|
|
9
|
-
const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
10
|
-
const memberId = 'xxx';
|
|
11
|
-
|
|
12
|
-
// tslint:disable-next-line:max-func-body-length
|
|
13
|
-
async function main() {
|
|
14
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
15
|
-
|
|
16
|
-
const memberRepo = await chevre.repository.Member.createInstance(mongoose.connection);
|
|
17
|
-
|
|
18
|
-
let startTime: [number, number] = process.hrtime();
|
|
19
|
-
let diff: [number, number] = process.hrtime(startTime);
|
|
20
|
-
let result: any;
|
|
21
|
-
|
|
22
|
-
// startTime = process.hrtime();
|
|
23
|
-
// result = await memberRepo.aggregateRoleNames({
|
|
24
|
-
// project: { id: { $eq: PROJECT_ID } },
|
|
25
|
-
// member: {
|
|
26
|
-
// id: { $eq: memberId },
|
|
27
|
-
// memberOf: {
|
|
28
|
-
// id: { $eq: PROJECT_ID },
|
|
29
|
-
// typeOf: { $eq: chevre.factory.organizationType.Project }
|
|
30
|
-
// }
|
|
31
|
-
// }
|
|
32
|
-
// });
|
|
33
|
-
// diff = process.hrtime(startTime);
|
|
34
|
-
// console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
35
|
-
// console.log(result.length, 'result found');
|
|
36
|
-
|
|
37
|
-
// startTime = process.hrtime();
|
|
38
|
-
// result = await memberRepo.aggregateRoleNames({
|
|
39
|
-
// project: { id: { $eq: PROJECT_ID } },
|
|
40
|
-
// member: {
|
|
41
|
-
// id: { $eq: memberId },
|
|
42
|
-
// memberOf: {
|
|
43
|
-
// id: { $eq: PROJECT_ID },
|
|
44
|
-
// typeOf: { $eq: chevre.factory.organizationType.Project }
|
|
45
|
-
// }
|
|
46
|
-
// }
|
|
47
|
-
// });
|
|
48
|
-
// diff = process.hrtime(startTime);
|
|
49
|
-
// console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
50
|
-
// console.log(result.length, 'result found');
|
|
51
|
-
|
|
52
|
-
// startTime = process.hrtime();
|
|
53
|
-
// result = await memberRepo.aggregateRoleNames({
|
|
54
|
-
// project: { id: { $eq: PROJECT_ID } },
|
|
55
|
-
// member: {
|
|
56
|
-
// id: { $eq: memberId },
|
|
57
|
-
// memberOf: {
|
|
58
|
-
// id: { $eq: PROJECT_ID },
|
|
59
|
-
// typeOf: { $eq: chevre.factory.organizationType.Project }
|
|
60
|
-
// }
|
|
61
|
-
// }
|
|
62
|
-
// });
|
|
63
|
-
// diff = process.hrtime(startTime);
|
|
64
|
-
// console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
65
|
-
// console.log(result.length, 'result found');
|
|
66
|
-
// console.log(result);
|
|
67
|
-
|
|
68
|
-
startTime = process.hrtime();
|
|
69
|
-
result = await memberRepo.findRoleNamesByMember({
|
|
70
|
-
project: { id: { $eq: PROJECT_ID } },
|
|
71
|
-
member: {
|
|
72
|
-
id: { $eq: memberId },
|
|
73
|
-
memberOf: {
|
|
74
|
-
id: { $eq: PROJECT_ID },
|
|
75
|
-
typeOf: { $eq: chevre.factory.organizationType.Project }
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
diff = process.hrtime(startTime);
|
|
80
|
-
console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
81
|
-
console.log(result.length, 'result found');
|
|
82
|
-
|
|
83
|
-
startTime = process.hrtime();
|
|
84
|
-
result = await memberRepo.findRoleNamesByMember({
|
|
85
|
-
project: { id: { $eq: PROJECT_ID } },
|
|
86
|
-
member: {
|
|
87
|
-
id: { $eq: memberId },
|
|
88
|
-
memberOf: {
|
|
89
|
-
id: { $eq: PROJECT_ID },
|
|
90
|
-
typeOf: { $eq: chevre.factory.organizationType.Project }
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
diff = process.hrtime(startTime);
|
|
95
|
-
console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
96
|
-
console.log(result.length, 'result found');
|
|
97
|
-
|
|
98
|
-
startTime = process.hrtime();
|
|
99
|
-
result = await memberRepo.findRoleNamesByMember({
|
|
100
|
-
project: { id: { $eq: PROJECT_ID } },
|
|
101
|
-
member: {
|
|
102
|
-
id: { $eq: memberId },
|
|
103
|
-
memberOf: {
|
|
104
|
-
id: { $eq: PROJECT_ID },
|
|
105
|
-
typeOf: { $eq: chevre.factory.organizationType.Project }
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
diff = process.hrtime(startTime);
|
|
110
|
-
console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
111
|
-
console.log(result.length, 'result found');
|
|
112
|
-
console.log(result);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
main()
|
|
116
|
-
.then(console.log)
|
|
117
|
-
.catch(console.error);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
|
-
|
|
9
|
-
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
10
|
-
|
|
11
|
-
const permissions = [
|
|
12
|
-
'products.read'
|
|
13
|
-
];
|
|
14
|
-
for (const permission of permissions) {
|
|
15
|
-
const roles = await roleRepo.projectFields(
|
|
16
|
-
{
|
|
17
|
-
permissions: { $eq: permission }
|
|
18
|
-
},
|
|
19
|
-
['roleName']
|
|
20
|
-
);
|
|
21
|
-
console.log(roles, permission);
|
|
22
|
-
for (const { roleName } of roles) {
|
|
23
|
-
const result = await roleRepo.removePermissionIfExists({
|
|
24
|
-
roleName: { $eq: roleName },
|
|
25
|
-
permission
|
|
26
|
-
});
|
|
27
|
-
console.log('permission removed.', permission, result, roleName);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
main()
|
|
33
|
-
.then()
|
|
34
|
-
.catch(console.error);
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
|
-
|
|
9
|
-
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
10
|
-
|
|
11
|
-
const permissions = [
|
|
12
|
-
'categoryCodes.read',
|
|
13
|
-
'creativeWorks.read',
|
|
14
|
-
'events.read',
|
|
15
|
-
'places.read',
|
|
16
|
-
'products.read',
|
|
17
|
-
'sellers.read'
|
|
18
|
-
];
|
|
19
|
-
for (const permission of permissions) {
|
|
20
|
-
const roles = await roleRepo.projectFields(
|
|
21
|
-
{
|
|
22
|
-
permissions: { $eq: permission },
|
|
23
|
-
roleName: {
|
|
24
|
-
$in: [
|
|
25
|
-
chevre.factory.role.organizationRole.RoleName.Customer,
|
|
26
|
-
chevre.factory.role.organizationRole.RoleName.POS,
|
|
27
|
-
chevre.factory.role.organizationRole.RoleName.EventsViewer
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
['roleName']
|
|
32
|
-
);
|
|
33
|
-
console.log('roles found.', roles, permission);
|
|
34
|
-
for (const { roleName } of roles) {
|
|
35
|
-
const result = await roleRepo.removePermissionIfExists({
|
|
36
|
-
roleName: { $eq: roleName },
|
|
37
|
-
permission
|
|
38
|
-
});
|
|
39
|
-
console.log('permission removed.', permission, result, roleName);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
main()
|
|
45
|
-
.then()
|
|
46
|
-
.catch(console.error);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
|
-
|
|
9
|
-
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
10
|
-
|
|
11
|
-
const permissions = [
|
|
12
|
-
'admin.sellers.productOffers.*'
|
|
13
|
-
];
|
|
14
|
-
for (const permission of permissions) {
|
|
15
|
-
const roles = await roleRepo.projectFields(
|
|
16
|
-
{
|
|
17
|
-
permissions: { $eq: permission }
|
|
18
|
-
},
|
|
19
|
-
['roleName']
|
|
20
|
-
);
|
|
21
|
-
console.log(roles, permission);
|
|
22
|
-
for (const { roleName } of roles) {
|
|
23
|
-
const result = await roleRepo.removePermissionIfExists({
|
|
24
|
-
roleName: { $eq: roleName },
|
|
25
|
-
permission
|
|
26
|
-
});
|
|
27
|
-
console.log('permission removed.', permission, result, roleName);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
main()
|
|
33
|
-
.then()
|
|
34
|
-
.catch(console.error);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
-
|
|
11
|
-
const offerCatalogItemRepo = await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
let result = await offerCatalogItemRepo.save({
|
|
14
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
15
|
-
typeOf: 'OfferCatalog',
|
|
16
|
-
// id?: string;
|
|
17
|
-
identifier: 'sample',
|
|
18
|
-
name: { ja: 'sample', en: 'sample' },
|
|
19
|
-
description: { ja: 'sample', en: 'sample' },
|
|
20
|
-
itemListElement: [],
|
|
21
|
-
itemOffered: { typeOf: chevre.factory.product.ProductType.EventService }
|
|
22
|
-
});
|
|
23
|
-
console.log(result);
|
|
24
|
-
|
|
25
|
-
result = await offerCatalogItemRepo.save({
|
|
26
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
27
|
-
typeOf: 'OfferCatalog',
|
|
28
|
-
id: result.id,
|
|
29
|
-
identifier: 'sample',
|
|
30
|
-
name: { ja: 'sample', en: 'sample' },
|
|
31
|
-
description: { ja: 'sample', en: 'sample' },
|
|
32
|
-
itemListElement: [],
|
|
33
|
-
itemOffered: { typeOf: chevre.factory.product.ProductType.EventService }
|
|
34
|
-
});
|
|
35
|
-
console.log(result);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
main()
|
|
39
|
-
.then(console.log)
|
|
40
|
-
.catch(console.error);
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const project = { id: '*' };
|
|
7
|
-
const WEBSITE_IDENTIFIER = process.env.WEBSITE_IDENTIFIER;
|
|
8
|
-
// const excludedProject = { id: String(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 webSiteRepo = await chevre.repository.WebSite.createInstance(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
if (typeof WEBSITE_IDENTIFIER !== 'string') {
|
|
17
|
-
throw new Error('WEBSITE_IDENTIFIER undefined');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const creatingWebSites: Pick<
|
|
21
|
-
chevre.factory.creativeWork.certification.webSite.ICertification,
|
|
22
|
-
'about' | 'certificationStatus' | 'project' | 'auditDate'
|
|
23
|
-
>[] = [
|
|
24
|
-
{
|
|
25
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
26
|
-
about: {
|
|
27
|
-
identifier: WEBSITE_IDENTIFIER,
|
|
28
|
-
typeOf: chevre.factory.creativeWorkType.WebSite
|
|
29
|
-
},
|
|
30
|
-
certificationStatus: chevre.factory.CertificationStatusEnumeration.CertificationInactive
|
|
31
|
-
}
|
|
32
|
-
];
|
|
33
|
-
for (const creatingWebSite of creatingWebSites) {
|
|
34
|
-
console.log('updating...', creatingWebSite);
|
|
35
|
-
try {
|
|
36
|
-
const { id } = await webSiteRepo.save({
|
|
37
|
-
attributes: creatingWebSite
|
|
38
|
-
});
|
|
39
|
-
await webSiteRepo.save({
|
|
40
|
-
id,
|
|
41
|
-
attributes: {
|
|
42
|
-
...creatingWebSite,
|
|
43
|
-
auditDate: new Date(),
|
|
44
|
-
certificationStatus: chevre.factory.CertificationStatusEnumeration.CertificationActive
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
console.log('updated.');
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.error(error);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
main()
|
|
55
|
-
.then()
|
|
56
|
-
.catch(console.error);
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
10
|
-
|
|
11
|
-
const acceptedOfferRepo = await chevre.repository.AcceptedOffer.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
let offerIds: string[];
|
|
14
|
-
|
|
15
|
-
// const searchConditions: chevre.factory.order.ISearchConditions = {
|
|
16
|
-
// limit: 10,
|
|
17
|
-
// page: 1,
|
|
18
|
-
// project: { id: { $eq: project.id } },
|
|
19
|
-
// orderNumbers: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'],
|
|
20
|
-
// acceptedOffers: { itemOffered: { typeOf: { $in: [chevre.factory.reservationType.EventReservation] } } }
|
|
21
|
-
// };
|
|
22
|
-
// let offerIds = await acceptedOfferRepo.__searchAcceptedOfferIds(searchConditions);
|
|
23
|
-
// console.log(offerIds);
|
|
24
|
-
offerIds = await acceptedOfferRepo.distinctValues(
|
|
25
|
-
{ orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
|
|
26
|
-
'acceptedOffers.id'
|
|
27
|
-
);
|
|
28
|
-
console.log(offerIds);
|
|
29
|
-
|
|
30
|
-
const productIds = await acceptedOfferRepo.distinctValues(
|
|
31
|
-
{ orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
|
|
32
|
-
'acceptedOffers.itemOffered.issuedThrough.id'
|
|
33
|
-
);
|
|
34
|
-
console.log(productIds);
|
|
35
|
-
|
|
36
|
-
const locationBranchCodes = await acceptedOfferRepo.distinctValues(
|
|
37
|
-
{ orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
|
|
38
|
-
'acceptedOffers.itemOffered.reservationFor.superEvent.location.branchCode'
|
|
39
|
-
);
|
|
40
|
-
console.log(locationBranchCodes);
|
|
41
|
-
|
|
42
|
-
const offeredThroughIdentifiers = await acceptedOfferRepo.distinctValues(
|
|
43
|
-
{ orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
|
|
44
|
-
'acceptedOffers.offeredThrough.identifier'
|
|
45
|
-
);
|
|
46
|
-
console.log(offeredThroughIdentifiers);
|
|
47
|
-
|
|
48
|
-
const invalidValues = await acceptedOfferRepo.distinctValues(
|
|
49
|
-
{ orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
|
|
50
|
-
<any>'invalidValues'
|
|
51
|
-
);
|
|
52
|
-
console.log(invalidValues);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
main()
|
|
56
|
-
.then()
|
|
57
|
-
.catch(console.error);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-implicit-dependencies no-console
|
|
2
|
-
import { chevre } from '../../../lib/index';
|
|
3
|
-
|
|
4
|
-
import * as mongoose from 'mongoose';
|
|
5
|
-
|
|
6
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
mongoose.Model.on('index', (...args) => {
|
|
9
|
-
console.error('******** index event emitted. ********\n', args);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
async function main() {
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
-
|
|
15
|
-
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
16
|
-
const actions = await actionRepo.searchByOrderNumber(
|
|
17
|
-
{
|
|
18
|
-
orderNumber: 'CIN6-4292767-6570494',
|
|
19
|
-
sort: { startDate: chevre.factory.sortType.Descending }
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
console.log('actions:', actions);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
main()
|
|
26
|
-
.then(() => {
|
|
27
|
-
console.log('success!');
|
|
28
|
-
})
|
|
29
|
-
.catch(console.error);
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
mongoose.Model.on('index', (...args) => {
|
|
9
|
-
console.error('******** index event emitted. ********\n', args);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
async function main() {
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
-
|
|
15
|
-
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
16
|
-
|
|
17
|
-
const docs = await actionRepo.searchByPurpose(
|
|
18
|
-
{
|
|
19
|
-
purpose: { id: '66ce6fe0f254c2172e578c9a', typeOf: chevre.factory.transactionType.PlaceOrder },
|
|
20
|
-
// typeOf: chevre.factory.actionType.AuthorizeAction,
|
|
21
|
-
object: {
|
|
22
|
-
// typeOf: { $eq: 'AggregateOffer' }
|
|
23
|
-
// paymentMethodId: { $eq: '137280454658483' }
|
|
24
|
-
},
|
|
25
|
-
actionStatus: { $eq: chevre.factory.actionStatusType.CompletedActionStatus },
|
|
26
|
-
sort: { startDate: chevre.factory.sortType.Descending }
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
// tslint:disable-next-line:no-null-keyword
|
|
30
|
-
console.dir(docs, { depth: null });
|
|
31
|
-
// tslint:disable-next-line:no-null-keyword
|
|
32
|
-
console.dir(docs.map(({ typeOf, startDate }) => ({ typeOf, startDate })), { depth: null });
|
|
33
|
-
console.log(docs.length, 'docs found');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
main()
|
|
37
|
-
.then()
|
|
38
|
-
.catch(console.error);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-implicit-dependencies no-console
|
|
2
|
-
import { chevre } from '../../../lib/index';
|
|
3
|
-
|
|
4
|
-
import * as mongoose from 'mongoose';
|
|
5
|
-
|
|
6
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
mongoose.Model.on('index', (...args) => {
|
|
9
|
-
console.error('******** index event emitted. ********\n', args);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
async function main() {
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
-
|
|
15
|
-
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
16
|
-
const actions = await actionRepo.searchBySameAs({
|
|
17
|
-
sameAs: { id: { $eq: '662456a40e9f9ad3b50f1481' } },
|
|
18
|
-
typeOf: { $eq: chevre.factory.actionType.AuthorizeAction }
|
|
19
|
-
});
|
|
20
|
-
console.log('actions:', actions);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
main()
|
|
24
|
-
.then(() => {
|
|
25
|
-
console.log('success!');
|
|
26
|
-
})
|
|
27
|
-
.catch(console.error);
|