@chevre/domain 22.11.0-alpha.3 → 22.11.0-alpha.31
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/example/src/chevre/aggregation/aggregateTasks.ts +41 -0
- package/example/src/chevre/assetTransaction/processReserve.ts +0 -1
- package/example/src/chevre/notifyAbortedTasksByEmail.ts +1 -1
- package/example/src/chevre/reIndex.ts +1 -1
- package/example/src/chevre/roles/addAdminPermissionIfNotExists.ts +132 -0
- package/example/src/chevre/roles/addDefaultPermissionIfNotExists.ts +37 -0
- package/example/src/chevre/roles/addEventOfferPermissionIfNotExists.ts +27 -0
- package/example/src/chevre/roles/addPermissionIfNotExists.ts +39 -6
- package/example/src/chevre/roles/addProjectCreatorRole.ts +48 -0
- package/example/src/chevre/roles/assignGlobalRoles.ts +72 -0
- package/example/src/chevre/roles/findPermissions.ts +84 -0
- package/example/src/chevre/roles/findRoleNames.ts +117 -0
- package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +38 -0
- package/example/src/chevre/roles/removePermissionFromAPIRoles.ts +46 -0
- package/example/src/chevre/roles/removePermissionIfExists.ts +39 -0
- package/example/src/chevre/settings/addSettings.ts +31 -17
- package/example/src/chevre/stockHolder/checkRedisKeyCount.ts +11 -20
- package/example/src/chevre/task/countPotentiallyRunning.ts +41 -0
- package/example/src/chevre/task/countTasks.ts +51 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +8 -5
- package/example/src/idaas/auth0/adminApplications.ts +183 -0
- package/example/src/idaas/auth0/getToken.ts +55 -0
- package/example/src/idaas/auth0/getTokenByPrivateKeyJWT.ts +84 -0
- package/example/src/regex.ts +31 -0
- package/lib/chevre/eventEmitter/task.d.ts +29 -6
- package/lib/chevre/index.d.ts +0 -2
- package/lib/chevre/index.js +0 -10
- package/lib/chevre/repo/confirmationNumber.d.ts +0 -11
- package/lib/chevre/repo/confirmationNumber.js +15 -54
- package/lib/chevre/repo/identity.d.ts +11 -33
- package/lib/chevre/repo/identity.js +10 -15
- package/lib/chevre/repo/member.d.ts +22 -4
- package/lib/chevre/repo/member.js +81 -27
- package/lib/chevre/repo/mongoose/schemas/identity.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/member/global.d.ts +14 -0
- package/lib/chevre/repo/mongoose/schemas/member/global.js +82 -0
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +15 -0
- package/lib/chevre/repo/mongoose/schemas/setting.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +9 -0
- package/lib/chevre/repo/orderNumber.d.ts +0 -11
- package/lib/chevre/repo/orderNumber.js +13 -51
- package/lib/chevre/repo/role.d.ts +16 -4
- package/lib/chevre/repo/role.js +71 -32
- package/lib/chevre/repo/serviceOutputIdentifier.d.ts +0 -4
- package/lib/chevre/repo/serviceOutputIdentifier.js +13 -38
- package/lib/chevre/repo/setting.d.ts +5 -10
- package/lib/chevre/repo/setting.js +4 -7
- package/lib/chevre/repo/stockHolder.js +0 -11
- package/lib/chevre/repo/task.d.ts +47 -34
- package/lib/chevre/repo/task.js +114 -292
- package/lib/chevre/repo/transaction.js +10 -10
- package/lib/chevre/repo/transactionNumber.d.ts +0 -11
- package/lib/chevre/repo/transactionNumber.js +13 -51
- package/lib/chevre/repo/transactionNumberCounter.d.ts +0 -10
- package/lib/chevre/repo/transactionNumberCounter.js +34 -29
- package/lib/chevre/service/assetTransaction/cancelReservation/start.d.ts +1 -1
- package/lib/chevre/service/code.d.ts +5 -28
- package/lib/chevre/service/code.js +3 -79
- package/lib/chevre/service/iam.d.ts +17 -7
- package/lib/chevre/service/iam.js +26 -6
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +15 -0
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +38 -0
- package/lib/chevre/service/notification.d.ts +2 -1
- package/lib/chevre/service/notification.js +3 -1
- package/lib/chevre/service/task/acceptCOAOffer.d.ts +1 -1
- package/lib/chevre/service/task/acceptCOAOffer.js +6 -5
- package/lib/chevre/service/task/aggregateOffers.d.ts +1 -1
- package/lib/chevre/service/task/aggregateOnSystem.d.ts +4 -2
- package/lib/chevre/service/task/aggregateScreeningEvent.d.ts +1 -1
- package/lib/chevre/service/task/authorizePayment.d.ts +1 -1
- package/lib/chevre/service/task/authorizePayment.js +7 -6
- package/lib/chevre/service/task/cancelMoneyTransfer.d.ts +1 -1
- package/lib/chevre/service/task/cancelPendingReservation.d.ts +1 -1
- package/lib/chevre/service/task/cancelReservation.d.ts +1 -1
- package/lib/chevre/service/task/checkMovieTicket.d.ts +1 -1
- package/lib/chevre/service/task/checkMovieTicket.js +4 -3
- package/lib/chevre/service/task/checkResource.d.ts +1 -1
- package/lib/chevre/service/task/confirmMoneyTransfer.d.ts +1 -1
- package/lib/chevre/service/task/confirmPayTransaction.d.ts +1 -1
- package/lib/chevre/service/task/confirmRegisterService.d.ts +1 -1
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.d.ts +1 -1
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/task/createAccountingReport.d.ts +1 -1
- package/lib/chevre/service/task/createEvent.d.ts +1 -1
- package/lib/chevre/service/task/deletePerson.d.ts +1 -1
- package/lib/chevre/service/task/deleteTransaction.d.ts +1 -1
- package/lib/chevre/service/task/givePointAward.d.ts +1 -1
- package/lib/chevre/service/task/givePointAward.js +1 -1
- package/lib/chevre/service/task/handleNotification.d.ts +4 -2
- package/lib/chevre/service/task/importEventCapacitiesFromCOA.d.ts +1 -1
- package/lib/chevre/service/task/importEventsFromCOA.d.ts +1 -1
- package/lib/chevre/service/task/importOffersFromCOA.d.ts +1 -1
- package/lib/chevre/service/task/invalidatePaymentUrl.d.ts +1 -1
- package/lib/chevre/service/task/moneyTransfer.d.ts +1 -1
- package/lib/chevre/service/task/moneyTransfer.js +1 -1
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +1 -1
- package/lib/chevre/service/task/onAuthorizationCreated.d.ts +1 -1
- package/lib/chevre/service/task/onEventChanged.d.ts +1 -1
- package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +1 -1
- package/lib/chevre/service/task/onResourceUpdated.d.ts +1 -1
- package/lib/chevre/service/task/pay.d.ts +1 -1
- package/lib/chevre/service/task/placeOrder.d.ts +1 -1
- package/lib/chevre/service/task/publishPaymentUrl.d.ts +1 -1
- package/lib/chevre/service/task/publishPaymentUrl.js +6 -7
- package/lib/chevre/service/task/refund.d.ts +1 -1
- package/lib/chevre/service/task/refund.js +1 -1
- package/lib/chevre/service/task/registerService.d.ts +1 -1
- package/lib/chevre/service/task/reserve.d.ts +1 -1
- package/lib/chevre/service/task/returnMoneyTransfer.d.ts +1 -1
- package/lib/chevre/service/task/returnMoneyTransfer.js +1 -1
- package/lib/chevre/service/task/returnOrder.d.ts +1 -1
- package/lib/chevre/service/task/returnPayTransaction.d.ts +1 -1
- package/lib/chevre/service/task/returnPayTransaction.js +1 -1
- package/lib/chevre/service/task/returnPointAward.d.ts +1 -1
- package/lib/chevre/service/task/returnPointAward.js +1 -1
- package/lib/chevre/service/task/returnReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/task/returnReserveTransaction.js +1 -1
- package/lib/chevre/service/task/sendEmailMessage.d.ts +1 -1
- package/lib/chevre/service/task/sendOrder.d.ts +1 -1
- package/lib/chevre/service/task/triggerWebhook.d.ts +1 -1
- package/lib/chevre/service/task/useReservation.d.ts +1 -1
- package/lib/chevre/service/task/voidMoneyTransferTransaction.d.ts +1 -1
- package/lib/chevre/service/task/voidPayTransaction.d.ts +1 -1
- package/lib/chevre/service/task/voidPayment.d.ts +1 -1
- package/lib/chevre/service/task/voidRegisterServiceTransaction.d.ts +1 -1
- package/lib/chevre/service/task/voidReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/task/voidReserveTransaction.js +4 -3
- package/lib/chevre/service/task.d.ts +7 -29
- package/lib/chevre/service/task.js +9 -114
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.d.ts +11 -0
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +105 -0
- package/lib/chevre/service/taskHandler/onOperationFailed.d.ts +17 -0
- package/lib/chevre/service/taskHandler/onOperationFailed.js +70 -0
- package/lib/chevre/service/taskHandler.d.ts +26 -0
- package/lib/chevre/service/taskHandler.js +96 -0
- package/lib/chevre/service/validation/validateOrder.js +55 -37
- package/lib/chevre/service.d.ts +0 -4
- package/lib/chevre/service.js +10 -14
- package/lib/chevre/settings/aggregation.d.ts +6 -1
- package/lib/chevre/settings/aggregation.js +2 -1
- package/package.json +5 -3
- package/example/src/chevre/adminAuth/adminIdentity.ts +0 -38
- package/example/src/chevre/executeOneTask.ts +0 -41
- package/example/src/chevre/executeTaskIfExists.ts +0 -80
- package/example/src/chevre/findExecutableTask.ts +0 -50
- package/example/src/chevre/findSetting.ts +0 -79
- package/example/src/chevre/roles/addRoleMembers.ts +0 -75
- package/example/src/chevre/searchPermissions.ts +0 -46
- package/example/src/chevre/transactionNumber/publishConfimationNumber.ts +0 -37
- package/example/src/chevre/transactionNumber/publishOrderNumber.ts +0 -40
- package/example/src/chevre/transactionNumber/setUseMongo4confirmationNumberFrom.ts +0 -45
- package/example/src/chevre/transactionNumber/setUseMongo4orderNumberFrom.ts +0 -41
- package/example/src/chevre/transactionNumber/setUseMongo4transactionNumberFrom.ts +0 -41
- package/lib/chevre/adminAuth.d.ts +0 -2
- package/lib/chevre/adminAuth.js +0 -6
|
@@ -12,35 +12,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.validateOrder = validateOrder;
|
|
13
13
|
// import * as createDebug from 'debug';
|
|
14
14
|
const moment = require("moment");
|
|
15
|
-
const util = require("util");
|
|
16
15
|
const factory = require("../../factory");
|
|
17
16
|
const factory_1 = require("../offer/event/authorize/factory");
|
|
18
17
|
const factory_2 = require("../offer/product/factory");
|
|
19
18
|
const validateMovieTicket_1 = require("../transaction/placeOrder/confirm/validation/validateMovieTicket");
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
19
|
+
// const debug = createDebug('chevre-domain:service:validation');
|
|
20
|
+
// type ICreatingCheckEventTask = Pick<
|
|
21
|
+
// factory.task.checkResource.IAttributes,
|
|
22
|
+
// 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status' | 'description'
|
|
23
|
+
// > & {
|
|
24
|
+
// description: string;
|
|
25
|
+
// };
|
|
26
|
+
// function createCheckEventTasks(params: {
|
|
27
|
+
// order: Pick<factory.order.IOrder, 'orderNumber' | 'typeOf'>;
|
|
28
|
+
// project: { id: string };
|
|
29
|
+
// reservationForIds: string[];
|
|
30
|
+
// }): ICreatingCheckEventTask[] {
|
|
31
|
+
// const { order, project, reservationForIds } = params;
|
|
32
|
+
// const runsAt = new Date();
|
|
33
|
+
// return reservationForIds.map((reservationForId) => {
|
|
34
|
+
// const object: factory.task.checkResource.IResourceAsEvent = { id: reservationForId, typeOf: factory.eventType.ScreeningEvent };
|
|
35
|
+
// const data: factory.task.checkResource.IData = {
|
|
36
|
+
// object,
|
|
37
|
+
// project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
38
|
+
// typeOf: factory.actionType.CheckAction
|
|
39
|
+
// };
|
|
40
|
+
// const description: string = util.format(
|
|
41
|
+
// '%s:%s:%s:%s',
|
|
42
|
+
// order.typeOf,
|
|
43
|
+
// order.orderNumber,
|
|
44
|
+
// factory.eventType.ScreeningEvent,
|
|
45
|
+
// reservationForId
|
|
46
|
+
// );
|
|
47
|
+
// return {
|
|
48
|
+
// description,
|
|
49
|
+
// project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
50
|
+
// name: factory.taskName.CheckResource,
|
|
51
|
+
// status: factory.taskStatus.Ready,
|
|
52
|
+
// runsAt,
|
|
53
|
+
// remainingNumberOfTries: 3,
|
|
54
|
+
// numberOfTried: 0,
|
|
55
|
+
// executionResults: [],
|
|
56
|
+
// data
|
|
57
|
+
// };
|
|
58
|
+
// });
|
|
59
|
+
// }
|
|
44
60
|
function validateOrder(params) {
|
|
45
61
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
46
62
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -216,18 +232,20 @@ function validateOrder(params) {
|
|
|
216
232
|
throw new Error(`invalid ticketIdentifiers.length:${reservationReservedTicketIdentifiers.length} [expected:${acceptedOffers.length}]`);
|
|
217
233
|
}
|
|
218
234
|
}
|
|
235
|
+
// useMongoAsStockHolderProjectsの場合のイベント検証タスク作成を廃止(もう十分検証したので)(2025-07-11~)
|
|
219
236
|
// add check event task(2025-05-01~)
|
|
220
|
-
const setting =
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
237
|
+
// const setting = <Pick<ISetting, 'useMongoAsStockHolderProjects'> | null>
|
|
238
|
+
// await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['useMongoAsStockHolderProjects']);
|
|
239
|
+
// const useMongoAsStockHolderProjects = setting?.useMongoAsStockHolderProjects;
|
|
240
|
+
// if (Array.isArray(useMongoAsStockHolderProjects) && useMongoAsStockHolderProjects.includes(params.project.id)) {
|
|
241
|
+
// const creatingCheckResourceTask = createCheckEventTasks({
|
|
242
|
+
// order: { orderNumber: order.orderNumber, typeOf: factory.order.OrderType.Order },
|
|
243
|
+
// project: { id: params.project.id },
|
|
244
|
+
// reservationForIds
|
|
245
|
+
// });
|
|
246
|
+
// if (creatingCheckResourceTask.length > 0) {
|
|
247
|
+
// await repos.task.saveMany(creatingCheckResourceTask, { emitImmediately: true });
|
|
248
|
+
// }
|
|
249
|
+
// }
|
|
232
250
|
});
|
|
233
251
|
}
|
package/lib/chevre/service.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ import type * as AccountService from './service/account';
|
|
|
11
11
|
import type * as AccountTransactionService from './service/accountTransaction';
|
|
12
12
|
import type * as AggregationService from './service/aggregation';
|
|
13
13
|
import type * as AssetTransactionService from './service/assetTransaction';
|
|
14
|
-
import type * as CodeService from './service/code';
|
|
15
14
|
import type * as DeliveryService from './service/delivery';
|
|
16
15
|
import type * as EventService from './service/event';
|
|
17
16
|
import type * as IAMService from './service/iam';
|
|
@@ -37,9 +36,6 @@ export declare namespace aggregation {
|
|
|
37
36
|
export declare namespace assetTransaction {
|
|
38
37
|
function createService(): Promise<typeof AssetTransactionService>;
|
|
39
38
|
}
|
|
40
|
-
export declare namespace code {
|
|
41
|
-
function createService(): Promise<typeof CodeService>;
|
|
42
|
-
}
|
|
43
39
|
export declare namespace delivery {
|
|
44
40
|
function createService(): Promise<typeof DeliveryService>;
|
|
45
41
|
}
|
package/lib/chevre/service.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.factory = exports.transaction = exports.task = exports.reserve = exports.report = exports.project = exports.permit = exports.payment = exports.order = exports.offer = exports.notification = exports.iam = exports.event = exports.delivery = exports.
|
|
12
|
+
exports.factory = exports.transaction = exports.task = exports.reserve = exports.report = exports.project = exports.permit = exports.payment = exports.order = exports.offer = exports.notification = exports.iam = exports.event = exports.delivery = exports.assetTransaction = exports.aggregation = exports.accountTransaction = exports.account = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* service module
|
|
15
15
|
*/
|
|
@@ -72,19 +72,15 @@ var assetTransaction;
|
|
|
72
72
|
}
|
|
73
73
|
assetTransaction.createService = createService;
|
|
74
74
|
})(assetTransaction || (exports.assetTransaction = assetTransaction = {}));
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
code.createService = createService;
|
|
87
|
-
})(code || (exports.code = code = {}));
|
|
75
|
+
// export namespace code {
|
|
76
|
+
// let service: typeof CodeService | undefined;
|
|
77
|
+
// export async function createService() {
|
|
78
|
+
// if (service === undefined) {
|
|
79
|
+
// service = await import('./service/code');
|
|
80
|
+
// }
|
|
81
|
+
// return service;
|
|
82
|
+
// }
|
|
83
|
+
// }
|
|
88
84
|
var delivery;
|
|
89
85
|
(function (delivery) {
|
|
90
86
|
let service;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import * as factory from '../factory';
|
|
2
|
-
import type { ICallableTaskOperation, ICallResult, IOperationExecute } from '../service/
|
|
2
|
+
import type { ICallableTaskOperation, ICallResult, IOperationExecute } from '../service/taskHandler';
|
|
3
3
|
interface IOnOrderStatusChanged {
|
|
4
4
|
informOrder2hub?: factory.project.IInformParams[];
|
|
5
5
|
}
|
|
6
6
|
interface IOnReservationStatusChanged {
|
|
7
7
|
informReservation2hub?: factory.project.IInformParams[];
|
|
8
8
|
}
|
|
9
|
+
interface IOnTaskStatusChanged {
|
|
10
|
+
informTask2hub?: factory.project.IInformParams[];
|
|
11
|
+
}
|
|
9
12
|
interface ICallableTask {
|
|
10
13
|
aggregateOnSystem?: ICallableTaskOperation;
|
|
11
14
|
handleNotification?: ICallableTaskOperation;
|
|
@@ -17,6 +20,7 @@ interface IOptions {
|
|
|
17
20
|
callableTask?: ICallableTask;
|
|
18
21
|
onOrderStatusChanged: IOnOrderStatusChanged;
|
|
19
22
|
onReservationStatusChanged: IOnReservationStatusChanged;
|
|
23
|
+
onTaskStatusChanged: IOnTaskStatusChanged;
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
26
|
* aggregation domain settings
|
|
@@ -25,6 +29,7 @@ declare class AggregationSettings {
|
|
|
25
29
|
readonly callableTask?: ICallableTask;
|
|
26
30
|
readonly onOrderStatusChanged: IOnOrderStatusChanged;
|
|
27
31
|
readonly onReservationStatusChanged: IOnReservationStatusChanged;
|
|
32
|
+
readonly onTaskStatusChanged: IOnTaskStatusChanged;
|
|
28
33
|
constructor(options: IOptions);
|
|
29
34
|
}
|
|
30
35
|
export { ICallableTaskOperation, ICallResult, IOperationExecute, AggregationSettings };
|
|
@@ -6,9 +6,10 @@ exports.AggregationSettings = void 0;
|
|
|
6
6
|
*/
|
|
7
7
|
class AggregationSettings {
|
|
8
8
|
constructor(options) {
|
|
9
|
-
const { callableTask, onOrderStatusChanged, onReservationStatusChanged } = options;
|
|
9
|
+
const { callableTask, onOrderStatusChanged, onReservationStatusChanged, onTaskStatusChanged } = options;
|
|
10
10
|
this.onOrderStatusChanged = onOrderStatusChanged;
|
|
11
11
|
this.onReservationStatusChanged = onReservationStatusChanged;
|
|
12
|
+
this.onTaskStatusChanged = onTaskStatusChanged;
|
|
12
13
|
if (callableTask !== undefined) {
|
|
13
14
|
this.callableTask = callableTask;
|
|
14
15
|
}
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
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.
|
|
15
|
-
"@cinerino/sdk": "11.
|
|
14
|
+
"@chevre/factory": "4.396.0-alpha.4",
|
|
15
|
+
"@cinerino/sdk": "11.1.0",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.3.0",
|
|
18
18
|
"@sendgrid/client": "8.1.4",
|
|
@@ -49,10 +49,12 @@
|
|
|
49
49
|
"@types/sinon-mongoose": "^1.3.11",
|
|
50
50
|
"@types/uniqid": "^4.1.3",
|
|
51
51
|
"@types/uuid": "^3.4.10",
|
|
52
|
+
"auth0": "4.27.0",
|
|
52
53
|
"coveralls": "^3.1.0",
|
|
53
54
|
"csvtojson": "^2.0.10",
|
|
54
55
|
"eslint": "9.16.0",
|
|
55
56
|
"googleapis": "^85.0.0",
|
|
57
|
+
"jose": "6.0.12",
|
|
56
58
|
"json2csv": "4.5.4",
|
|
57
59
|
"mocha": "10.6.0",
|
|
58
60
|
"mongoose": "8.0.4",
|
|
@@ -113,5 +115,5 @@
|
|
|
113
115
|
"postversion": "git push origin --tags",
|
|
114
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
115
117
|
},
|
|
116
|
-
"version": "22.11.0-alpha.
|
|
118
|
+
"version": "22.11.0-alpha.31"
|
|
117
119
|
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const ADMIN_AUTH_ENDPOINT = process.env.ADMIN_AUTH_ENDPOINT;
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
if (typeof ADMIN_AUTH_ENDPOINT !== 'string') {
|
|
10
|
-
throw new Error('ADMIN_AUTH_ENDPOINT undfined');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
-
|
|
15
|
-
const adminIdentityService = await (await (await chevre.loadAdminAuth()).loadChevreAuth({
|
|
16
|
-
endpoint: ADMIN_AUTH_ENDPOINT
|
|
17
|
-
})).createIdentityInstance();
|
|
18
|
-
|
|
19
|
-
const identities = await adminIdentityService.projectIdentityFields(
|
|
20
|
-
{
|
|
21
|
-
about: { id: { $eq: '36jneiog293vb2c7u9e5p4rn7r' } }
|
|
22
|
-
// identifier: { $eq: IDENTIFIER }
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
console.log('docs:', identities);
|
|
26
|
-
console.log(identities.length, 'docs found');
|
|
27
|
-
|
|
28
|
-
const { id } = await adminIdentityService.createIdentity({
|
|
29
|
-
clientId: 'xxx',
|
|
30
|
-
clientSecret: 'xxx',
|
|
31
|
-
iss: ['xxx']
|
|
32
|
-
});
|
|
33
|
-
console.log('saved.', id);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
main()
|
|
37
|
-
.then()
|
|
38
|
-
.catch(console.error);
|
|
@@ -1,41 +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
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
11
|
-
|
|
12
|
-
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
|
|
13
|
-
const task = await taskRepo.executeOneIfExists({
|
|
14
|
-
name: {
|
|
15
|
-
$nin: [
|
|
16
|
-
chevre.factory.taskName.DeleteTransaction,
|
|
17
|
-
chevre.factory.taskName.ImportEventCapacitiesFromCOA,
|
|
18
|
-
chevre.factory.taskName.ImportEventsFromCOA,
|
|
19
|
-
chevre.factory.taskName.AcceptCOAOffer,
|
|
20
|
-
chevre.factory.taskName.CheckMovieTicket,
|
|
21
|
-
chevre.factory.taskName.AuthorizePayment,
|
|
22
|
-
chevre.factory.taskName.PublishPaymentUrl
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
executor: { name: 'sample' },
|
|
26
|
-
runsAt: {
|
|
27
|
-
$lt: moment()
|
|
28
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
29
|
-
.add(-2, 'years')
|
|
30
|
-
// .add(-60, 'seconds')
|
|
31
|
-
.toDate()
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// tslint:disable-next-line:no-null-keyword
|
|
36
|
-
console.dir(task, { depth: null });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
main()
|
|
40
|
-
.then()
|
|
41
|
-
.catch(console.error);
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import { chevre } from '../../../lib/index';
|
|
3
|
-
|
|
4
|
-
import * as mongoose from 'mongoose';
|
|
5
|
-
import * as redis from 'redis';
|
|
6
|
-
|
|
7
|
-
export async function executeTaskIfExists() {
|
|
8
|
-
const redisClient = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
|
|
9
|
-
socket: {
|
|
10
|
-
port: Number(<string>process.env.REDIS_PORT),
|
|
11
|
-
host: <string>process.env.REDIS_HOST
|
|
12
|
-
},
|
|
13
|
-
password: <string>process.env.REDIS_KEY
|
|
14
|
-
});
|
|
15
|
-
await redisClient.connect();
|
|
16
|
-
|
|
17
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
18
|
-
|
|
19
|
-
let count = 0;
|
|
20
|
-
|
|
21
|
-
const MAX_NUBMER_OF_PARALLEL_TASKS = 1;
|
|
22
|
-
const INTERVAL_MILLISECONDS = 1000;
|
|
23
|
-
|
|
24
|
-
setInterval(
|
|
25
|
-
async () => {
|
|
26
|
-
if (count > MAX_NUBMER_OF_PARALLEL_TASKS) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
count += 1;
|
|
31
|
-
|
|
32
|
-
try {
|
|
33
|
-
console.log('executing...', count);
|
|
34
|
-
await (await chevre.service.task.createService()).executeOneIfExists({
|
|
35
|
-
// name: chevre.factory.taskName.AggregateScreeningEvent,
|
|
36
|
-
executor: { name: 'sample' },
|
|
37
|
-
runsAt: { $lt: new Date() },
|
|
38
|
-
name: {
|
|
39
|
-
$nin: [
|
|
40
|
-
chevre.factory.taskName.DeleteTransaction,
|
|
41
|
-
chevre.factory.taskName.ImportEventCapacitiesFromCOA,
|
|
42
|
-
chevre.factory.taskName.ImportEventsFromCOA,
|
|
43
|
-
chevre.factory.taskName.AcceptCOAOffer,
|
|
44
|
-
chevre.factory.taskName.CheckMovieTicket,
|
|
45
|
-
chevre.factory.taskName.AuthorizePayment,
|
|
46
|
-
chevre.factory.taskName.PublishPaymentUrl
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
})({
|
|
50
|
-
connection: mongoose.connection,
|
|
51
|
-
redisClient,
|
|
52
|
-
credentials: {
|
|
53
|
-
sendGrid: await chevre.credentials.SendGrid.createInstance({ apiKey: 'xxx' })
|
|
54
|
-
},
|
|
55
|
-
settings: new chevre.settings.Settings({
|
|
56
|
-
deliverOrderLimit: 1,
|
|
57
|
-
abortedTasksWithoutReport: [],
|
|
58
|
-
coa: { timeout: 1000 },
|
|
59
|
-
gmo: { timeout: 1000, timeoutBackground: 1000, useFetch: true },
|
|
60
|
-
movieticketReserve: { timeout: 1000, timeoutCheck: 1000, minIntervalBetweenPayAndRefund: 0 },
|
|
61
|
-
numTryConfirmReserveTransaction: 10,
|
|
62
|
-
useExperimentalFeature: false
|
|
63
|
-
})
|
|
64
|
-
});
|
|
65
|
-
console.log('executed', count);
|
|
66
|
-
} catch (error) {
|
|
67
|
-
console.error(error);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
count -= 1;
|
|
71
|
-
},
|
|
72
|
-
INTERVAL_MILLISECONDS
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
executeTaskIfExists()
|
|
77
|
-
.then(() => {
|
|
78
|
-
console.log('success!');
|
|
79
|
-
})
|
|
80
|
-
.catch(console.error);
|
|
@@ -1,50 +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
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
11
|
-
|
|
12
|
-
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
setInterval(
|
|
15
|
-
async () => {
|
|
16
|
-
const startTime = process.hrtime();
|
|
17
|
-
const task = await taskRepo.findExecutableOne({
|
|
18
|
-
name: {
|
|
19
|
-
$eq: chevre.factory.taskName.VoidReserveTransaction
|
|
20
|
-
// $nin: [
|
|
21
|
-
// chevre.factory.taskName.DeleteTransaction,
|
|
22
|
-
// chevre.factory.taskName.ImportEventCapacitiesFromCOA,
|
|
23
|
-
// chevre.factory.taskName.ImportEventsFromCOA,
|
|
24
|
-
// chevre.factory.taskName.AcceptCOAOffer,
|
|
25
|
-
// chevre.factory.taskName.CheckMovieTicket,
|
|
26
|
-
// chevre.factory.taskName.AuthorizePayment,
|
|
27
|
-
// chevre.factory.taskName.PublishPaymentUrl
|
|
28
|
-
// ]
|
|
29
|
-
},
|
|
30
|
-
runsAt: {
|
|
31
|
-
$lt: moment()
|
|
32
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
33
|
-
.add(-60, 'seconds')
|
|
34
|
-
.toDate()
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const diff = process.hrtime(startTime);
|
|
38
|
-
console.log(`took ${diff[0]} seconds and ${diff[1]} nanoseconds.`);
|
|
39
|
-
|
|
40
|
-
// tslint:disable-next-line:no-null-keyword
|
|
41
|
-
console.dir(task?.id, { depth: null });
|
|
42
|
-
},
|
|
43
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
44
|
-
1000
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
main()
|
|
49
|
-
.then()
|
|
50
|
-
.catch(console.error);
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const informOrderUrls = (typeof process.env.INFORM_ORDER_URL === 'string')
|
|
7
|
-
? process.env.INFORM_ORDER_URL.split(' ')
|
|
8
|
-
: [];
|
|
9
|
-
// const informReservationUrls = (typeof process.env.INFORM_RESERVATION_URL === 'string')
|
|
10
|
-
// ? process.env.INFORM_RESERVATION_URL.split(' ')
|
|
11
|
-
// : [];
|
|
12
|
-
// const informResourceUrls = (typeof process.env.INFORM_RESOURCE_URL === 'string')
|
|
13
|
-
// ? process.env.INFORM_RESOURCE_URL.split(',')
|
|
14
|
-
// : [];
|
|
15
|
-
// const informEvent2aggUrls = (typeof process.env.INFORM_EVENT_AGG_URL === 'string')
|
|
16
|
-
// ? process.env.INFORM_EVENT_AGG_URL.split(' ')
|
|
17
|
-
// : [];
|
|
18
|
-
// const userPoolIdOld = process.env.USERPOOL_ID_OLD;
|
|
19
|
-
// const userPoolIdNew = process.env.USERPOOL_ID_NEW;
|
|
20
|
-
// const defaultSenderEmail = process.env.DEFAULT_SENDER_EMAIL;
|
|
21
|
-
|
|
22
|
-
// tslint:disable-next-line:max-func-body-length
|
|
23
|
-
async function main() {
|
|
24
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
25
|
-
|
|
26
|
-
const settingRepo = await chevre.repository.Setting.createInstance(mongoose.connection);
|
|
27
|
-
|
|
28
|
-
const result = await settingRepo.findOne({}, ['triggerWebhook', 'waiter']);
|
|
29
|
-
// tslint:disable-next-line:no-null-keyword
|
|
30
|
-
console.dir(result, { depth: null });
|
|
31
|
-
|
|
32
|
-
if (result === null) {
|
|
33
|
-
if (informOrderUrls.length > 0) {
|
|
34
|
-
await settingRepo.saveOne({
|
|
35
|
-
project: { id: '*', typeOf: chevre.factory.organizationType.Project },
|
|
36
|
-
onOrderStatusChanged: {
|
|
37
|
-
informOrder: informOrderUrls
|
|
38
|
-
.filter((url) => url.length > 0)
|
|
39
|
-
.map((url) => {
|
|
40
|
-
return {
|
|
41
|
-
recipient: {
|
|
42
|
-
typeOf: chevre.factory.creativeWorkType.WebApplication,
|
|
43
|
-
name: 'Aggregation Service',
|
|
44
|
-
url
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
console.log('saved');
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
const updateResult = await settingRepo.updateByProject(
|
|
54
|
-
{ project: { id: { $eq: '*' } } },
|
|
55
|
-
{
|
|
56
|
-
triggerWebhook: {
|
|
57
|
-
timeout: 15000,
|
|
58
|
-
useFetchAPI: true,
|
|
59
|
-
secretKey: String(process.env.TRIGGER_WEBHOOK_SECRET_KEY),
|
|
60
|
-
headerIdentifier: String(process.env.TRIGGER_WEBHOOK_HEADER_IDENTIFIER),
|
|
61
|
-
retryCountMax: 2,
|
|
62
|
-
retryIntervalInMS: 1000
|
|
63
|
-
},
|
|
64
|
-
waiter: {
|
|
65
|
-
disabled: process.env.WAITER_DISABLED === '1',
|
|
66
|
-
passportUnavailable: process.env.WAITER_PASSPORT_UNAVAILABLE === '1',
|
|
67
|
-
passportIssuers: String(process.env.WAITER_PASSPORT_ISSUER)
|
|
68
|
-
.split(' '),
|
|
69
|
-
secret: String(process.env.WAITER_SECRET)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
console.log('updated', updateResult);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
main()
|
|
78
|
-
.then(console.log)
|
|
79
|
-
.catch(console.error);
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as 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
|
-
let roleNames = [
|
|
12
|
-
chevre.factory.role.organizationRole.RoleName.Customer,
|
|
13
|
-
chevre.factory.role.organizationRole.RoleName.EventsViewer,
|
|
14
|
-
chevre.factory.role.organizationRole.RoleName.POS
|
|
15
|
-
];
|
|
16
|
-
for (const roleName of roleNames) {
|
|
17
|
-
const result = await roleRepo.addMember({
|
|
18
|
-
roleName,
|
|
19
|
-
member: { typeOf: chevre.factory.creativeWorkType.WebApplication },
|
|
20
|
-
memberOf: { typeOf: chevre.factory.organizationType.Project }
|
|
21
|
-
});
|
|
22
|
-
console.log(result, roleName);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
roleNames = [
|
|
26
|
-
chevre.factory.role.organizationRole.RoleName.Server
|
|
27
|
-
];
|
|
28
|
-
for (const roleName of roleNames) {
|
|
29
|
-
const result = await roleRepo.addMember({
|
|
30
|
-
roleName,
|
|
31
|
-
member: { typeOf: chevre.factory.creativeWorkType.SoftwareApplication },
|
|
32
|
-
memberOf: { typeOf: chevre.factory.organizationType.Project }
|
|
33
|
-
});
|
|
34
|
-
console.log(result, roleName);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
roleNames = [
|
|
38
|
-
chevre.factory.role.organizationRole.RoleName.Accountant,
|
|
39
|
-
chevre.factory.role.organizationRole.RoleName.IAMRoleAdmin,
|
|
40
|
-
chevre.factory.role.organizationRole.RoleName.InventoryManager,
|
|
41
|
-
chevre.factory.role.organizationRole.RoleName.MemberAdmin,
|
|
42
|
-
chevre.factory.role.organizationRole.RoleName.Owner,
|
|
43
|
-
chevre.factory.role.organizationRole.RoleName.PaymentServiceAdmin,
|
|
44
|
-
chevre.factory.role.organizationRole.RoleName.SellerAdmin,
|
|
45
|
-
chevre.factory.role.organizationRole.RoleName.TicketClerk,
|
|
46
|
-
chevre.factory.role.organizationRole.RoleName.TicketCollector,
|
|
47
|
-
chevre.factory.role.organizationRole.RoleName.User
|
|
48
|
-
];
|
|
49
|
-
for (const roleName of roleNames) {
|
|
50
|
-
const result = await roleRepo.addMember({
|
|
51
|
-
roleName,
|
|
52
|
-
member: { typeOf: chevre.factory.personType.Person },
|
|
53
|
-
memberOf: { typeOf: chevre.factory.organizationType.Project }
|
|
54
|
-
});
|
|
55
|
-
console.log(result, roleName);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
roleNames = [
|
|
59
|
-
chevre.factory.role.organizationRole.RoleName.SellersIAMRoleAdmin,
|
|
60
|
-
chevre.factory.role.organizationRole.RoleName.SellersInventoryManager,
|
|
61
|
-
chevre.factory.role.organizationRole.RoleName.SellersOwner
|
|
62
|
-
];
|
|
63
|
-
for (const roleName of roleNames) {
|
|
64
|
-
const result = await roleRepo.addMember({
|
|
65
|
-
roleName,
|
|
66
|
-
member: { typeOf: chevre.factory.personType.Person },
|
|
67
|
-
memberOf: { typeOf: chevre.factory.organizationType.Corporation }
|
|
68
|
-
});
|
|
69
|
-
console.log(result, roleName);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
main()
|
|
74
|
-
.then()
|
|
75
|
-
.catch(console.error);
|
|
@@ -1,46 +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 memberId = 'xxx';
|
|
9
|
-
|
|
10
|
-
async function main() {
|
|
11
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
12
|
-
|
|
13
|
-
const memberRepo = await chevre.repository.Member.createInstance(mongoose.connection);
|
|
14
|
-
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
let now: Date;
|
|
17
|
-
|
|
18
|
-
now = new Date();
|
|
19
|
-
const searchPermissionsResult = await (await chevre.service.iam.createService()).searchPermissions({
|
|
20
|
-
project: { id: PROJECT_ID },
|
|
21
|
-
member: {
|
|
22
|
-
id: memberId,
|
|
23
|
-
memberOf: {
|
|
24
|
-
id: PROJECT_ID,
|
|
25
|
-
typeOf: chevre.factory.organizationType.Project
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
})({
|
|
29
|
-
member: memberRepo,
|
|
30
|
-
role: roleRepo
|
|
31
|
-
});
|
|
32
|
-
console.log('time cost:', moment()
|
|
33
|
-
.diff(now));
|
|
34
|
-
|
|
35
|
-
console.log(searchPermissionsResult);
|
|
36
|
-
console.log(searchPermissionsResult.permissions.length);
|
|
37
|
-
|
|
38
|
-
// console.log(aggregateRoleNamesResult);
|
|
39
|
-
// console.log(aggregateRoleNamesResult.length);
|
|
40
|
-
// console.log(aggregatePermissionsResult);
|
|
41
|
-
// console.log(aggregatePermissionsResult.length);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
main()
|
|
45
|
-
.then(console.log)
|
|
46
|
-
.catch(console.error);
|