@chevre/domain 22.11.0-alpha.16 → 22.11.0-alpha.18
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/settings/addSettings.ts +6 -8
- package/lib/chevre/eventEmitter/task.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +11 -0
- package/lib/chevre/repo/seller.d.ts +4 -4
- package/lib/chevre/repo/setting.d.ts +1 -10
- package/lib/chevre/repo/setting.js +2 -11
- package/lib/chevre/repo/task.d.ts +12 -15
- package/lib/chevre/repo/task.js +36 -58
- package/lib/chevre/settings/aggregation.d.ts +5 -0
- package/lib/chevre/settings/aggregation.js +2 -1
- package/package.json +2 -2
- package/example/src/chevre/findSetting.ts +0 -79
|
@@ -8,18 +8,16 @@ async function main() {
|
|
|
8
8
|
|
|
9
9
|
const settingRepo = await chevre.repository.Setting.createInstance(mongoose.connection);
|
|
10
10
|
|
|
11
|
-
const setting = await settingRepo.findOne({ project: { id: { $eq: '*' } } }, ['
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
console.log('already
|
|
11
|
+
const setting = await settingRepo.findOne({ project: { id: { $eq: '*' } } }, ['onTaskStatusChanged']);
|
|
12
|
+
const onTaskStatusChangedExists = setting?.onTaskStatusChanged !== undefined;
|
|
13
|
+
if (onTaskStatusChangedExists) {
|
|
14
|
+
console.log('already exists');
|
|
15
15
|
} else {
|
|
16
16
|
// update
|
|
17
|
-
await settingRepo.
|
|
17
|
+
await settingRepo.updateByProject(
|
|
18
18
|
{ project: { id: { $eq: '*' } } },
|
|
19
19
|
{
|
|
20
|
-
|
|
21
|
-
'onOrderStatusChanged.useInformReturnAction': true
|
|
22
|
-
}
|
|
20
|
+
onTaskStatusChanged: {}
|
|
23
21
|
}
|
|
24
22
|
);
|
|
25
23
|
console.log('updated.');
|
|
@@ -12,8 +12,6 @@ interface IExecuteSettings {
|
|
|
12
12
|
*/
|
|
13
13
|
redisClient?: RedisClientType;
|
|
14
14
|
}
|
|
15
|
-
type IOperationExecute<T> = (settings: IExecuteSettings) => Promise<T>;
|
|
16
|
-
type INextFunction = (task: Pick<factory.task.ITask<factory.taskName>, 'id' | 'remainingNumberOfTries' | 'name' | 'status'>) => IOperationExecute<void>;
|
|
17
15
|
interface IReadyTask {
|
|
18
16
|
id: string;
|
|
19
17
|
name?: factory.taskName;
|
|
@@ -45,6 +43,8 @@ interface IExecutedTask {
|
|
|
45
43
|
expires?: never;
|
|
46
44
|
}
|
|
47
45
|
type IChangedTask = IReadyTask | IRunningTask | IExecutedTask;
|
|
46
|
+
type IOperationExecute<T> = (settings: IExecuteSettings) => Promise<T>;
|
|
47
|
+
type INextFunction = (task: IExecutedTask) => IOperationExecute<void>;
|
|
48
48
|
type IOnTaskStatusChangedListener = (task: IChangedTask, next?: INextFunction) => void;
|
|
49
49
|
/**
|
|
50
50
|
* タスクイベントエミッター
|
|
@@ -13,6 +13,16 @@ interface IOnReservationStatusChanged {
|
|
|
13
13
|
*/
|
|
14
14
|
informReservation?: factory.project.IInformParams[];
|
|
15
15
|
}
|
|
16
|
+
interface IOnTaskStatusChanged {
|
|
17
|
+
/**
|
|
18
|
+
* AggService通知先
|
|
19
|
+
*/
|
|
20
|
+
informTask?: factory.project.IInformParams[];
|
|
21
|
+
/**
|
|
22
|
+
* 分析連携するtaskNameリスト
|
|
23
|
+
*/
|
|
24
|
+
informTaskNames?: factory.taskName[];
|
|
25
|
+
}
|
|
16
26
|
interface IOnEventChanged {
|
|
17
27
|
informEvent2agg?: factory.project.IInformParams[];
|
|
18
28
|
}
|
|
@@ -102,6 +112,7 @@ export interface ISetting {
|
|
|
102
112
|
onEventChanged?: IOnEventChanged;
|
|
103
113
|
onOrderStatusChanged: IOnOrderStatusChanged;
|
|
104
114
|
onReservationStatusChanged?: IOnReservationStatusChanged;
|
|
115
|
+
onTaskStatusChanged?: IOnTaskStatusChanged;
|
|
105
116
|
onResourceUpdated?: {
|
|
106
117
|
informResource?: factory.project.IInformParams[];
|
|
107
118
|
};
|
|
@@ -77,8 +77,8 @@ export declare class SellerRepo {
|
|
|
77
77
|
}): Promise<void>;
|
|
78
78
|
getCursor(conditions: FilterQuery<factory.seller.ISeller>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, {
|
|
79
79
|
url?: string | undefined;
|
|
80
|
-
name: import("@chevre/factory/lib/multilingualString").IMultilingualString;
|
|
81
80
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
81
|
+
name: import("@chevre/factory/lib/multilingualString").IMultilingualString;
|
|
82
82
|
typeOf: factory.organizationType.Corporation;
|
|
83
83
|
location?: factory.organization.ILocation | undefined;
|
|
84
84
|
additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined;
|
|
@@ -89,8 +89,8 @@ export declare class SellerRepo {
|
|
|
89
89
|
paymentAccepted?: factory.seller.IPaymentAccepted[] | undefined;
|
|
90
90
|
}> & {
|
|
91
91
|
url?: string | undefined;
|
|
92
|
-
name: import("@chevre/factory/lib/multilingualString").IMultilingualString;
|
|
93
92
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
93
|
+
name: import("@chevre/factory/lib/multilingualString").IMultilingualString;
|
|
94
94
|
typeOf: factory.organizationType.Corporation;
|
|
95
95
|
location?: factory.organization.ILocation | undefined;
|
|
96
96
|
additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined;
|
|
@@ -103,8 +103,8 @@ export declare class SellerRepo {
|
|
|
103
103
|
_id: Types.ObjectId;
|
|
104
104
|
}, QueryOptions<import("mongoose").Document<unknown, {}, {
|
|
105
105
|
url?: string | undefined;
|
|
106
|
-
name: import("@chevre/factory/lib/multilingualString").IMultilingualString;
|
|
107
106
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
107
|
+
name: import("@chevre/factory/lib/multilingualString").IMultilingualString;
|
|
108
108
|
typeOf: factory.organizationType.Corporation;
|
|
109
109
|
location?: factory.organization.ILocation | undefined;
|
|
110
110
|
additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined;
|
|
@@ -115,8 +115,8 @@ export declare class SellerRepo {
|
|
|
115
115
|
paymentAccepted?: factory.seller.IPaymentAccepted[] | undefined;
|
|
116
116
|
}> & {
|
|
117
117
|
url?: string | undefined;
|
|
118
|
-
name: import("@chevre/factory/lib/multilingualString").IMultilingualString;
|
|
119
118
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
119
|
+
name: import("@chevre/factory/lib/multilingualString").IMultilingualString;
|
|
120
120
|
typeOf: factory.organizationType.Corporation;
|
|
121
121
|
location?: factory.organization.ILocation | undefined;
|
|
122
122
|
additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined;
|
|
@@ -22,16 +22,7 @@ export declare class SettingRepo {
|
|
|
22
22
|
$eq: string;
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
|
-
}, update: Pick<ISetting, 'onEventChanged' | 'onReservationStatusChanged' | 'onResourceUpdated' | 'defaultSenderEmail' | 'useInformResourceTypes' | 'userPoolIdNew' | 'userPoolIdOld' | 'storage' | 'quota' | 'triggerWebhook' | 'waiter'>): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
26
|
-
updateByProject4migration(filter: {
|
|
27
|
-
project: {
|
|
28
|
-
id: {
|
|
29
|
-
$eq: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
}, update: {
|
|
33
|
-
$set: any;
|
|
34
|
-
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
25
|
+
}, update: Pick<ISetting, 'onEventChanged' | 'onReservationStatusChanged' | 'onTaskStatusChanged' | 'onResourceUpdated' | 'defaultSenderEmail' | 'useInformResourceTypes' | 'userPoolIdNew' | 'userPoolIdOld' | 'storage' | 'quota' | 'triggerWebhook' | 'waiter'>): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
35
26
|
unsetUnnecessaryFields(params: {
|
|
36
27
|
filter: FilterQuery<ISetting>;
|
|
37
28
|
$unset: any;
|
|
@@ -49,18 +49,9 @@ class SettingRepo {
|
|
|
49
49
|
}
|
|
50
50
|
updateByProject(filter, update) {
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const { onEventChanged, onReservationStatusChanged, onResourceUpdated, defaultSenderEmail, useInformResourceTypes, userPoolIdNew, userPoolIdOld, storage, quota, triggerWebhook, waiter } = update;
|
|
52
|
+
const { onEventChanged, onReservationStatusChanged, onTaskStatusChanged, onResourceUpdated, defaultSenderEmail, useInformResourceTypes, userPoolIdNew, userPoolIdOld, storage, quota, triggerWebhook, waiter } = update;
|
|
53
53
|
return this.settingModel.updateOne({ 'project.id': { $eq: filter.project.id.$eq } }, {
|
|
54
|
-
$set: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (onEventChanged !== undefined) ? { onEventChanged } : undefined), (onReservationStatusChanged !== undefined) ? { onReservationStatusChanged } : undefined), (onResourceUpdated !== undefined) ? { onResourceUpdated } : undefined), (defaultSenderEmail !== undefined) ? { defaultSenderEmail } : undefined), (useInformResourceTypes !== undefined) ? { useInformResourceTypes } : undefined), (userPoolIdNew !== undefined) ? { userPoolIdNew } : undefined), (userPoolIdOld !== undefined) ? { userPoolIdOld } : undefined), (storage !== undefined) ? { storage } : undefined), (quota !== undefined) ? { quota } : undefined), (triggerWebhook !== undefined) ? { triggerWebhook } : undefined), (waiter !== undefined) ? { waiter } : undefined)
|
|
55
|
-
})
|
|
56
|
-
.exec();
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
updateByProject4migration(filter, update) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const { $set } = update;
|
|
62
|
-
return this.settingModel.updateOne({ 'project.id': { $eq: filter.project.id.$eq } }, {
|
|
63
|
-
$set
|
|
54
|
+
$set: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (onEventChanged !== undefined) ? { onEventChanged } : undefined), (onReservationStatusChanged !== undefined) ? { onReservationStatusChanged } : undefined), (onTaskStatusChanged !== undefined) ? { onTaskStatusChanged } : undefined), (onResourceUpdated !== undefined) ? { onResourceUpdated } : undefined), (defaultSenderEmail !== undefined) ? { defaultSenderEmail } : undefined), (useInformResourceTypes !== undefined) ? { useInformResourceTypes } : undefined), (userPoolIdNew !== undefined) ? { userPoolIdNew } : undefined), (userPoolIdOld !== undefined) ? { userPoolIdOld } : undefined), (storage !== undefined) ? { storage } : undefined), (quota !== undefined) ? { quota } : undefined), (triggerWebhook !== undefined) ? { triggerWebhook } : undefined), (waiter !== undefined) ? { waiter } : undefined)
|
|
64
55
|
})
|
|
65
56
|
.exec();
|
|
66
57
|
});
|
|
@@ -150,9 +150,6 @@ export declare class TaskRepo {
|
|
|
150
150
|
id: string;
|
|
151
151
|
remainingNumberOfTries: number;
|
|
152
152
|
}): Promise<UpdateWriteOpResult>;
|
|
153
|
-
abortOne(params: {
|
|
154
|
-
intervalInMinutes: number;
|
|
155
|
-
}): Promise<factory.task.ITask<factory.taskName> | null>;
|
|
156
153
|
abortMany(params: {
|
|
157
154
|
intervalInMinutes: number;
|
|
158
155
|
}): Promise<UpdateWriteOpResult>;
|
|
@@ -208,14 +205,14 @@ export declare class TaskRepo {
|
|
|
208
205
|
count: number;
|
|
209
206
|
}>;
|
|
210
207
|
getCursor(conditions: FilterQuery<factory.task.ITask<factory.taskName>>, projection: ProjectionType<factory.task.ITask<factory.taskName>>): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, {
|
|
211
|
-
remainingNumberOfTries: number;
|
|
212
|
-
name: factory.taskName;
|
|
213
|
-
status: factory.taskStatus;
|
|
214
208
|
alternateName?: string | undefined;
|
|
215
209
|
identifier?: string | undefined;
|
|
216
210
|
description?: string | undefined;
|
|
217
211
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
212
|
+
name: factory.taskName;
|
|
213
|
+
status: factory.taskStatus;
|
|
218
214
|
runsAt: Date;
|
|
215
|
+
remainingNumberOfTries: number;
|
|
219
216
|
lastTriedAt?: Date | undefined;
|
|
220
217
|
numberOfTried: number;
|
|
221
218
|
executionResults: import("@chevre/factory/lib/task").IExecutionResult[];
|
|
@@ -224,14 +221,14 @@ export declare class TaskRepo {
|
|
|
224
221
|
dateAborted?: Date | undefined;
|
|
225
222
|
expires?: Date | undefined;
|
|
226
223
|
}> & {
|
|
227
|
-
remainingNumberOfTries: number;
|
|
228
|
-
name: factory.taskName;
|
|
229
|
-
status: factory.taskStatus;
|
|
230
224
|
alternateName?: string | undefined;
|
|
231
225
|
identifier?: string | undefined;
|
|
232
226
|
description?: string | undefined;
|
|
233
227
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
228
|
+
name: factory.taskName;
|
|
229
|
+
status: factory.taskStatus;
|
|
234
230
|
runsAt: Date;
|
|
231
|
+
remainingNumberOfTries: number;
|
|
235
232
|
lastTriedAt?: Date | undefined;
|
|
236
233
|
numberOfTried: number;
|
|
237
234
|
executionResults: import("@chevre/factory/lib/task").IExecutionResult[];
|
|
@@ -242,14 +239,14 @@ export declare class TaskRepo {
|
|
|
242
239
|
} & {
|
|
243
240
|
_id: import("mongoose").Types.ObjectId;
|
|
244
241
|
}, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, {
|
|
245
|
-
remainingNumberOfTries: number;
|
|
246
|
-
name: factory.taskName;
|
|
247
|
-
status: factory.taskStatus;
|
|
248
242
|
alternateName?: string | undefined;
|
|
249
243
|
identifier?: string | undefined;
|
|
250
244
|
description?: string | undefined;
|
|
251
245
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
246
|
+
name: factory.taskName;
|
|
247
|
+
status: factory.taskStatus;
|
|
252
248
|
runsAt: Date;
|
|
249
|
+
remainingNumberOfTries: number;
|
|
253
250
|
lastTriedAt?: Date | undefined;
|
|
254
251
|
numberOfTried: number;
|
|
255
252
|
executionResults: import("@chevre/factory/lib/task").IExecutionResult[];
|
|
@@ -258,14 +255,14 @@ export declare class TaskRepo {
|
|
|
258
255
|
dateAborted?: Date | undefined;
|
|
259
256
|
expires?: Date | undefined;
|
|
260
257
|
}> & {
|
|
261
|
-
remainingNumberOfTries: number;
|
|
262
|
-
name: factory.taskName;
|
|
263
|
-
status: factory.taskStatus;
|
|
264
258
|
alternateName?: string | undefined;
|
|
265
259
|
identifier?: string | undefined;
|
|
266
260
|
description?: string | undefined;
|
|
267
261
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
262
|
+
name: factory.taskName;
|
|
263
|
+
status: factory.taskStatus;
|
|
268
264
|
runsAt: Date;
|
|
265
|
+
remainingNumberOfTries: number;
|
|
269
266
|
lastTriedAt?: Date | undefined;
|
|
270
267
|
numberOfTried: number;
|
|
271
268
|
executionResults: import("@chevre/factory/lib/task").IExecutionResult[];
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -325,36 +325,6 @@ class TaskRepo {
|
|
|
325
325
|
}
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
|
-
// public async createConfirmReserveTransactionTaskIfNotExist(
|
|
329
|
-
// params: factory.task.IAttributes<factory.taskName.ConfirmReserveTransaction>,
|
|
330
|
-
// options: IOptionOnCreate
|
|
331
|
-
// ): Promise<void> {
|
|
332
|
-
// const createdTask = await this.taskModel.findOneAndUpdate(
|
|
333
|
-
// {
|
|
334
|
-
// 'project.id': { $eq: params.project.id },
|
|
335
|
-
// name: { $eq: params.name },
|
|
336
|
-
// 'data.object.transactionNumber': {
|
|
337
|
-
// $exists: true,
|
|
338
|
-
// $eq: String(params.data.object.transactionNumber)
|
|
339
|
-
// },
|
|
340
|
-
// 'data.purpose.orderNumber': {
|
|
341
|
-
// $exists: true,
|
|
342
|
-
// $eq: String(params.data.purpose.orderNumber)
|
|
343
|
-
// }
|
|
344
|
-
// },
|
|
345
|
-
// { $setOnInsert: params },
|
|
346
|
-
// { new: true, upsert: true }
|
|
347
|
-
// )
|
|
348
|
-
// .select({ _id: 1 })
|
|
349
|
-
// .exec();
|
|
350
|
-
// if (options.emitImmediately) {
|
|
351
|
-
// taskEventEmitter.emitTaskStatusChanged({
|
|
352
|
-
// id: createdTask.id,
|
|
353
|
-
// name: params.name,
|
|
354
|
-
// status: factory.taskStatus.Ready
|
|
355
|
-
// });
|
|
356
|
-
// }
|
|
357
|
-
// }
|
|
358
328
|
createOnAssetTransactionStatusChangedTaskIfNotExist(
|
|
359
329
|
// resolve uniqueness of identifier(2025-03-27~)
|
|
360
330
|
params, options) {
|
|
@@ -687,34 +657,42 @@ class TaskRepo {
|
|
|
687
657
|
.exec();
|
|
688
658
|
});
|
|
689
659
|
}
|
|
690
|
-
abortOne(params
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
660
|
+
// public async abortOne(params: {
|
|
661
|
+
// intervalInMinutes: number;
|
|
662
|
+
// }): Promise<factory.task.ITask<factory.taskName> | null> {
|
|
663
|
+
// const lastTriedAtShoudBeLessThan = moment()
|
|
664
|
+
// .add(-params.intervalInMinutes, 'minutes')
|
|
665
|
+
// .toDate();
|
|
666
|
+
// const projection: ProjectionType<factory.task.ITask<factory.taskName>> = {
|
|
667
|
+
// _id: 0,
|
|
668
|
+
// id: { $toString: '$_id' },
|
|
669
|
+
// ...Object.fromEntries<1>(AVAILABLE_PROJECT_FIELDS.map((key) => ([key, 1])))
|
|
670
|
+
// };
|
|
671
|
+
// const doc = await this.taskModel.findOneAndUpdate(
|
|
672
|
+
// {
|
|
673
|
+
// status: { $eq: factory.taskStatus.Running },
|
|
674
|
+
// lastTriedAt: {
|
|
675
|
+
// $type: 'date',
|
|
676
|
+
// $lt: lastTriedAtShoudBeLessThan
|
|
677
|
+
// },
|
|
678
|
+
// remainingNumberOfTries: { $eq: 0 }
|
|
679
|
+
// },
|
|
680
|
+
// {
|
|
681
|
+
// $set: {
|
|
682
|
+
// status: factory.taskStatus.Aborted,
|
|
683
|
+
// dateAborted: new Date()
|
|
684
|
+
// }
|
|
685
|
+
// },
|
|
686
|
+
// { new: true, projection }
|
|
687
|
+
// )
|
|
688
|
+
// .lean<factory.task.ITask<factory.taskName>>() // lean(2024-09-26~)
|
|
689
|
+
// .exec();
|
|
690
|
+
// if (doc === null) {
|
|
691
|
+
// // tslint:disable-next-line:no-null-keyword
|
|
692
|
+
// return null;
|
|
693
|
+
// }
|
|
694
|
+
// return doc;
|
|
695
|
+
// }
|
|
718
696
|
abortMany(params) {
|
|
719
697
|
return __awaiter(this, void 0, void 0, function* () {
|
|
720
698
|
const lastTriedAtShoudBeLessThan = moment()
|
|
@@ -6,6 +6,9 @@ interface IOnOrderStatusChanged {
|
|
|
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,7 +11,7 @@
|
|
|
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.396.0-alpha.
|
|
14
|
+
"@chevre/factory": "4.396.0-alpha.3",
|
|
15
15
|
"@cinerino/sdk": "11.1.0",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.3.0",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"postversion": "git push origin --tags",
|
|
116
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
117
|
},
|
|
118
|
-
"version": "22.11.0-alpha.
|
|
118
|
+
"version": "22.11.0-alpha.18"
|
|
119
119
|
}
|
|
@@ -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);
|