@chevre/domain 28.1.0-alpha.3 → 28.1.0-alpha.4
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/repo/mongoose/schemas/setting.d.ts +7 -7
- package/lib/chevre/repo/mongoose/schemas/setting.js +1 -1
- package/lib/chevre/repo/setting/integration.d.ts +1 -1
- package/lib/chevre/repo/setting.d.ts +1 -1
- package/lib/chevre/service/notification/triggerWebhook/processInformAction.d.ts +3 -0
- package/lib/chevre/service/notification/triggerWebhook/processInformAction.js +4 -3
- package/lib/chevre/service/notification/triggerWebhook.js +2 -1
- package/lib/chevre/service/offer/onEventChanged.d.ts +2 -0
- package/lib/chevre/service/offer/onEventChanged.js +5 -4
- package/lib/chevre/service/task/informHub.js +3 -1
- package/lib/chevre/service/task/onEventChanged.js +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.d.ts +2 -2
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +2 -1
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +2 -2
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +3 -2
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.d.ts +3 -2
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +2 -2
- package/lib/chevre/service/task/onResourceUpdated.js +30 -24
- package/lib/chevre/service/task/triggerWebhook.js +3 -1
- package/package.json +1 -1
|
@@ -69,10 +69,6 @@ interface ITriggerWebhookSettings {
|
|
|
69
69
|
headerIdentifier?: string;
|
|
70
70
|
retryCountMax?: number;
|
|
71
71
|
retryIntervalInMS?: number;
|
|
72
|
-
/**
|
|
73
|
-
* support(2026-10-30~)
|
|
74
|
-
*/
|
|
75
|
-
googleTargetAudience?: string;
|
|
76
72
|
}
|
|
77
73
|
export interface IWaiterSettings {
|
|
78
74
|
disabled?: boolean;
|
|
@@ -193,7 +189,14 @@ interface IHubOnTaskStatusChanged {
|
|
|
193
189
|
export interface IHubSettings {
|
|
194
190
|
onOrderStatusChanged: IHubOnOrderStatusChanged;
|
|
195
191
|
onReservationStatusChanged: IHubOnReservationStatusChanged;
|
|
192
|
+
/**
|
|
193
|
+
* 編集系リソースとタスクの通知設定
|
|
194
|
+
*/
|
|
196
195
|
onTaskStatusChanged: IHubOnTaskStatusChanged;
|
|
196
|
+
/**
|
|
197
|
+
* support(2026-10-30~)
|
|
198
|
+
*/
|
|
199
|
+
googleTargetAudience?: string;
|
|
197
200
|
}
|
|
198
201
|
export interface IIntegrationSettings {
|
|
199
202
|
abortedTasksWithoutReport: string[];
|
|
@@ -262,9 +265,6 @@ export interface ISetting {
|
|
|
262
265
|
onOrderStatusChanged: IOnOrderStatusChanged;
|
|
263
266
|
onReservationStatusChanged?: IOnReservationStatusChanged;
|
|
264
267
|
onTaskStatusChanged?: IOnTaskStatusChanged;
|
|
265
|
-
onResourceUpdated?: {
|
|
266
|
-
informResource?: factory.project.IInformParams[];
|
|
267
|
-
};
|
|
268
268
|
orderNumber?: IOrderNumberSetting;
|
|
269
269
|
project: {
|
|
270
270
|
id: string;
|
|
@@ -15,7 +15,7 @@ const schemaDefinition = {
|
|
|
15
15
|
onOrderStatusChanged: mongoose_1.SchemaTypes.Mixed,
|
|
16
16
|
onReservationStatusChanged: mongoose_1.SchemaTypes.Mixed,
|
|
17
17
|
onTaskStatusChanged: mongoose_1.SchemaTypes.Mixed,
|
|
18
|
-
onResourceUpdated:
|
|
18
|
+
// onResourceUpdated: SchemaTypes.Mixed, // discontinue(2026-11-02~)
|
|
19
19
|
// onTransactionStatusChanged: SchemaTypes.Mixed, // discontinue(2026-06-29~)
|
|
20
20
|
orderNumber: mongoose_1.SchemaTypes.Mixed,
|
|
21
21
|
quota: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -3,6 +3,7 @@ import { IIntegrationSettings, ISendGridSettings, IHubSettings } from '../mongoo
|
|
|
3
3
|
interface IDBOptions {
|
|
4
4
|
connection: Connection;
|
|
5
5
|
}
|
|
6
|
+
export { IIntegrationSettings };
|
|
6
7
|
/**
|
|
7
8
|
* 外部連携設定リポジトリ
|
|
8
9
|
*/
|
|
@@ -24,4 +25,3 @@ export declare class IntegrationSettingRepo {
|
|
|
24
25
|
addSendGridSettings(params: ISendGridSettings): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
25
26
|
addHubSettings(params: IHubSettings): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
26
27
|
}
|
|
27
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Connection, FilterQuery } from 'mongoose';
|
|
2
2
|
import { ISetting, IStorageSettings } from './mongoose/schemas/setting';
|
|
3
3
|
type IKeyOfProjection = Exclude<keyof ISetting, 'jwt' | 'project' | 'waiter' | 'integration'>;
|
|
4
|
-
type IGlobalSetting = Pick<ISetting, 'defaultSenderEmail' | 'onEventChanged' | 'onOrderStatusChanged' | 'onReservationStatusChanged' | '
|
|
4
|
+
type IGlobalSetting = Pick<ISetting, 'defaultSenderEmail' | 'onEventChanged' | 'onOrderStatusChanged' | 'onReservationStatusChanged' | 'onTaskStatusChanged' | 'orderNumber' | 'quota' | 'serviceOutputIdentifier' | 'storage' | 'transactionNumber' | 'triggerWebhook' | 'useInformResourceTypes' | 'useMongo4confirmationNumberFrom' | 'useMongo4orderNumberFrom' | 'useMongo4transactionNumberFrom' | 'useMongoAsStockHolder' | 'useMongoAsStockHolderProjects' | 'userPoolIdNew' | 'userPoolIdOld'>;
|
|
5
5
|
export { IGlobalSetting as ISetting };
|
|
6
6
|
/**
|
|
7
7
|
* 設定リポジトリ
|
|
@@ -2,18 +2,21 @@ import { factory } from '../../../factory';
|
|
|
2
2
|
import type { InformActionRepo } from '../../../repo/action/inform';
|
|
3
3
|
import type { PotentialActionRepo } from '../../../repo/potentialAction';
|
|
4
4
|
import type { ISetting, SettingRepo } from '../../../repo/setting';
|
|
5
|
+
import type { IIntegrationSettings, IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
5
6
|
interface ITriggerWebhookRepos {
|
|
6
7
|
actions: {
|
|
7
8
|
inform: InformActionRepo;
|
|
8
9
|
};
|
|
9
10
|
potentialAction: PotentialActionRepo;
|
|
10
11
|
setting: SettingRepo;
|
|
12
|
+
integrationSetting: IntegrationSettingRepo;
|
|
11
13
|
}
|
|
12
14
|
declare function processInformAction(params: (factory.task.triggerWebhook.IData | factory.task.informHub.IData) & {
|
|
13
15
|
project: {
|
|
14
16
|
id: string;
|
|
15
17
|
};
|
|
16
18
|
}, settings: Pick<ISetting, 'triggerWebhook'>, options: {
|
|
19
|
+
integrationSettings?: IIntegrationSettings['hub'];
|
|
17
20
|
useIAP: boolean;
|
|
18
21
|
}): (repos: {
|
|
19
22
|
actions: {
|
|
@@ -97,11 +97,12 @@ function signRequest(params) {
|
|
|
97
97
|
.update(payload)
|
|
98
98
|
.digest('hex');
|
|
99
99
|
}
|
|
100
|
-
async function makeRequestHeaders(
|
|
100
|
+
async function makeRequestHeaders(params, options) {
|
|
101
|
+
const { action, settings, integrationSettings, requestBody } = params;
|
|
101
102
|
const { useIAP } = options;
|
|
102
103
|
const secretKey = settings?.triggerWebhook?.secretKey;
|
|
103
104
|
const headerIdentifier = settings?.triggerWebhook?.headerIdentifier;
|
|
104
|
-
const googleTargetAudience =
|
|
105
|
+
const googleTargetAudience = integrationSettings?.googleTargetAudience;
|
|
105
106
|
const timestamp = action.startDate.valueOf();
|
|
106
107
|
// sign request(2024-10-28~)
|
|
107
108
|
let signature;
|
|
@@ -149,7 +150,7 @@ function processInformAction(params, settings, options) {
|
|
|
149
150
|
? { identifier }
|
|
150
151
|
: undefined
|
|
151
152
|
});
|
|
152
|
-
const headers = await makeRequestHeaders(action, settings, requestBody, options);
|
|
153
|
+
const headers = await makeRequestHeaders({ action, settings, integrationSettings: options.integrationSettings, requestBody }, options);
|
|
153
154
|
const res = await fetch(urlTemplate, {
|
|
154
155
|
method: 'POST',
|
|
155
156
|
headers,
|
|
@@ -54,6 +54,7 @@ function triggerWebhook(params) {
|
|
|
54
54
|
function informHub(params) {
|
|
55
55
|
return async (repos) => {
|
|
56
56
|
const { setting, retryCountMax, retryIntervalInMS } = await findSettings()(repos);
|
|
57
|
+
const hubSettings = await repos.integrationSetting.getByKey('hub');
|
|
57
58
|
// retryableにする(2023-05-12~)
|
|
58
59
|
let retry = true;
|
|
59
60
|
let numberOfTry = 0;
|
|
@@ -67,7 +68,7 @@ function informHub(params) {
|
|
|
67
68
|
if (numberOfTry > 1) {
|
|
68
69
|
await sleep(retryIntervalInMS * (numberOfTry - 1));
|
|
69
70
|
}
|
|
70
|
-
await (0, processInformAction_1.processInformAction)(params, setting, { useIAP: true })(repos);
|
|
71
|
+
await (0, processInformAction_1.processInformAction)(params, setting, { integrationSettings: hubSettings, useIAP: true })(repos);
|
|
71
72
|
break;
|
|
72
73
|
}
|
|
73
74
|
catch (error) {
|
|
@@ -5,6 +5,7 @@ import type { PendingReservationRepo } from '../../repo/pendingReservation';
|
|
|
5
5
|
import type { ProjectRepo } from '../../repo/project';
|
|
6
6
|
import type { SettingRepo } from '../../repo/setting';
|
|
7
7
|
import type { TaskRepo } from '../../repo/task';
|
|
8
|
+
import { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
8
9
|
import { factory } from '../../factory';
|
|
9
10
|
/**
|
|
10
11
|
* イベント変更時処理
|
|
@@ -13,6 +14,7 @@ declare function onEventChanged(params: factory.task.onEventChanged.IData): (rep
|
|
|
13
14
|
adminEvent: AdminEventRepo;
|
|
14
15
|
event: EventRepo;
|
|
15
16
|
eventSeries: EventSeriesRepo;
|
|
17
|
+
integrationSetting: IntegrationSettingRepo;
|
|
16
18
|
pendingReservation?: PendingReservationRepo;
|
|
17
19
|
project: ProjectRepo;
|
|
18
20
|
setting: SettingRepo;
|
|
@@ -14,7 +14,8 @@ const debug = (0, debug_1.default)('chevre-domain:service:offer:onEventChanged')
|
|
|
14
14
|
function onEventChanged(params) {
|
|
15
15
|
return async (repos) => {
|
|
16
16
|
if (params.id.length > 0) {
|
|
17
|
-
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['
|
|
17
|
+
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onEventChanged', 'useInformResourceTypes']);
|
|
18
|
+
const hubSettings = (await repos.integrationSetting.getByKey('hub'));
|
|
18
19
|
const useInformResourceTypes = setting?.useInformResourceTypes;
|
|
19
20
|
const useInform = params.useInform === true
|
|
20
21
|
&& Array.isArray(useInformResourceTypes) && useInformResourceTypes.includes(params.typeOf);
|
|
@@ -31,7 +32,7 @@ function onEventChanged(params) {
|
|
|
31
32
|
project: { id: params.project.id },
|
|
32
33
|
ids: params.id,
|
|
33
34
|
typeOf: params.typeOf
|
|
34
|
-
},
|
|
35
|
+
}, hubSettings)(repos);
|
|
35
36
|
}
|
|
36
37
|
if (params.useSync === true) {
|
|
37
38
|
switch (params.typeOf) {
|
|
@@ -96,8 +97,8 @@ function createInformTasks(params, setting) {
|
|
|
96
97
|
// settings: Settings
|
|
97
98
|
) => {
|
|
98
99
|
let events4inform;
|
|
99
|
-
// const informEvents =
|
|
100
|
-
const informEvents = setting?.
|
|
100
|
+
// const informEvents = setting?.onResourceUpdated?.informResource;
|
|
101
|
+
const informEvents = setting?.onTaskStatusChanged.informTask2hub;
|
|
101
102
|
if (params.typeOf === factory_1.factory.eventType.ScreeningEvent) {
|
|
102
103
|
const screeningEvents4inform = await repos.event.projectEventFields({
|
|
103
104
|
id: { $in: params.ids }
|
|
@@ -4,6 +4,7 @@ exports.call = call;
|
|
|
4
4
|
const inform_1 = require("../../repo/action/inform");
|
|
5
5
|
const potentialAction_1 = require("../../repo/potentialAction");
|
|
6
6
|
const setting_1 = require("../../repo/setting");
|
|
7
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
7
8
|
const notification_1 = require("../notification");
|
|
8
9
|
/**
|
|
9
10
|
* タスク実行関数
|
|
@@ -18,7 +19,8 @@ function call(params) {
|
|
|
18
19
|
inform: new inform_1.InformActionRepo(connection)
|
|
19
20
|
},
|
|
20
21
|
potentialAction: new potentialAction_1.PotentialActionRepo(connection),
|
|
21
|
-
setting: new setting_1.SettingRepo(connection)
|
|
22
|
+
setting: new setting_1.SettingRepo(connection),
|
|
23
|
+
integrationSetting: new integration_1.IntegrationSettingRepo({ connection })
|
|
22
24
|
});
|
|
23
25
|
};
|
|
24
26
|
}
|
|
@@ -8,6 +8,7 @@ const pendingReservation_1 = require("../../repo/pendingReservation");
|
|
|
8
8
|
const project_1 = require("../../repo/project");
|
|
9
9
|
const setting_1 = require("../../repo/setting");
|
|
10
10
|
const task_1 = require("../../repo/task");
|
|
11
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
11
12
|
const onEventChanged_1 = require("../offer/onEventChanged");
|
|
12
13
|
/**
|
|
13
14
|
* タスク実行関数
|
|
@@ -19,6 +20,7 @@ function call(params) {
|
|
|
19
20
|
adminEvent: new adminEvent_1.AdminEventRepo(connection),
|
|
20
21
|
event: new event_1.EventRepo(connection),
|
|
21
22
|
eventSeries: new eventSeries_1.EventSeriesRepo(connection),
|
|
23
|
+
integrationSetting: new integration_1.IntegrationSettingRepo({ connection }),
|
|
22
24
|
pendingReservation: new pendingReservation_1.PendingReservationRepo(connection),
|
|
23
25
|
project: new project_1.ProjectRepo(connection),
|
|
24
26
|
setting: new setting_1.SettingRepo(connection),
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
2
|
import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
|
|
3
|
-
import type { ISetting } from '../../../repo/setting';
|
|
4
3
|
import type { TaskRepo } from '../../../repo/task';
|
|
4
|
+
import type { IIntegrationSettings } from '../../../repo/setting/integration';
|
|
5
5
|
export declare function createInformOfferTasks(params: {
|
|
6
6
|
project: {
|
|
7
7
|
id: string;
|
|
8
8
|
};
|
|
9
9
|
ids: string[];
|
|
10
10
|
typeOf: factory.offerType.AggregateOffer;
|
|
11
|
-
}, setting
|
|
11
|
+
}, setting?: IIntegrationSettings['hub']): (repos: {
|
|
12
12
|
offer: OfferRepo;
|
|
13
13
|
task: TaskRepo;
|
|
14
14
|
}) => Promise<void>;
|
|
@@ -7,7 +7,8 @@ function createInformOfferTasks(params, setting) {
|
|
|
7
7
|
if (params.ids.length === 0) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
|
-
const informResources = setting?.onResourceUpdated?.informResource;
|
|
10
|
+
// const informResources = setting?.onResourceUpdated?.informResource;
|
|
11
|
+
const informResources = setting?.onTaskStatusChanged.informTask2hub;
|
|
11
12
|
const offers = await repos.offer.findUnitPriceOffers({
|
|
12
13
|
id: { $in: params.ids }
|
|
13
14
|
}, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
2
|
import type { POSRepo } from '../../../repo/place/pos';
|
|
3
3
|
import type { MovieTheaterRepo } from '../../../repo/place/movieTheater';
|
|
4
|
-
import type { SettingRepo } from '../../../repo/setting';
|
|
5
4
|
import type { TaskRepo } from '../../../repo/task';
|
|
5
|
+
import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
6
6
|
export declare function createInformHasPOSTasks(params: {
|
|
7
7
|
project: {
|
|
8
8
|
id: string;
|
|
@@ -19,6 +19,6 @@ export declare function createInformHasPOSTasks(params: {
|
|
|
19
19
|
}): (repos: {
|
|
20
20
|
pos: POSRepo;
|
|
21
21
|
movieTheater: MovieTheaterRepo;
|
|
22
|
-
setting: SettingRepo;
|
|
23
22
|
task: TaskRepo;
|
|
23
|
+
integrationSetting: IntegrationSettingRepo;
|
|
24
24
|
}) => Promise<void>;
|
|
@@ -7,8 +7,9 @@ function createInformHasPOSTasks(params) {
|
|
|
7
7
|
// if (params.ids.length !== 1) {
|
|
8
8
|
// throw new factory.errors.Argument('id', 'id.length must be 1');
|
|
9
9
|
// }
|
|
10
|
-
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onResourceUpdated']);
|
|
11
|
-
const informResources = setting?.onResourceUpdated?.informResource;
|
|
10
|
+
// const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onResourceUpdated']) as Pick<ISetting, 'onResourceUpdated'> | null;
|
|
11
|
+
// const informResources = setting?.onResourceUpdated?.informResource;
|
|
12
|
+
const informResources = (await repos.integrationSetting.getByKey('hub'))?.onTaskStatusChanged.informTask2hub;
|
|
12
13
|
const movieTheaters = await repos.movieTheater.projectFields({
|
|
13
14
|
limit: 1,
|
|
14
15
|
page: 1,
|
|
@@ -2,8 +2,9 @@ import { factory } from '../../../factory';
|
|
|
2
2
|
import type { AggregateOfferRepo } from '../../../repo/aggregateOffer';
|
|
3
3
|
import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
4
4
|
import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
5
|
-
import type {
|
|
5
|
+
import type { SettingRepo } from '../../../repo/setting';
|
|
6
6
|
import type { TaskRepo } from '../../../repo/task';
|
|
7
|
+
import type { IIntegrationSettings } from '../../../repo/setting/integration';
|
|
7
8
|
export declare function createInformOfferCatalogTasks(params: {
|
|
8
9
|
project: {
|
|
9
10
|
id: string;
|
|
@@ -11,7 +12,7 @@ export declare function createInformOfferCatalogTasks(params: {
|
|
|
11
12
|
ids: string[];
|
|
12
13
|
typeOf: factory.offerCatalog.IOfferCatalog['typeOf'];
|
|
13
14
|
isOfferCatalogItem: boolean;
|
|
14
|
-
}, setting
|
|
15
|
+
}, setting?: IIntegrationSettings['hub']): (repos: {
|
|
15
16
|
offerCatalog: OfferCatalogRepo;
|
|
16
17
|
offerCatalogItem: OfferCatalogItemRepo;
|
|
17
18
|
setting: SettingRepo;
|
|
@@ -18,8 +18,8 @@ function createInformOfferCatalogTasks(params, setting) {
|
|
|
18
18
|
else {
|
|
19
19
|
offerCatalogs = await repos.offerCatalog.projectFields({ id: { $in: params.ids } }, ['identifier', 'name', 'numberOfItems', 'project', 'typeOf']);
|
|
20
20
|
}
|
|
21
|
-
// const informResources =
|
|
22
|
-
const informResources = setting?.
|
|
21
|
+
// const informResources = setting?.onResourceUpdated?.informResource;
|
|
22
|
+
const informResources = setting?.onTaskStatusChanged.informTask2hub;
|
|
23
23
|
const offerCatalogs4inform = offerCatalogs.map(({ id, typeOf, name, identifier, project, numberOfItems }) => {
|
|
24
24
|
return { id, typeOf, name, identifier, project, numberOfItems };
|
|
25
25
|
});
|
|
@@ -21,6 +21,7 @@ const screeningRoom_1 = require("../../repo/place/screeningRoom");
|
|
|
21
21
|
const product_1 = require("../../repo/product");
|
|
22
22
|
const setting_1 = require("../../repo/setting");
|
|
23
23
|
const task_1 = require("../../repo/task");
|
|
24
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
24
25
|
const onAggregateOfferUpdated_1 = require("./onResourceUpdated/onAggregateOfferUpdated");
|
|
25
26
|
// import { onCategoryCodeUpdated } from './onResourceUpdated/onCategoryCodeUpdated';
|
|
26
27
|
const onHasPOSUpdated_1 = require("./onResourceUpdated/onHasPOSUpdated");
|
|
@@ -39,6 +40,7 @@ function call(params) {
|
|
|
39
40
|
entranceGate: new entranceGate_1.EntranceGateRepo(connection, { id: '' }), // 先の処理で明示的に指定される
|
|
40
41
|
event: new event_1.EventRepo(connection),
|
|
41
42
|
eventSeries: new eventSeries_1.EventSeriesRepo(connection),
|
|
43
|
+
integrationSetting: new integration_1.IntegrationSettingRepo({ connection }),
|
|
42
44
|
pos: new pos_1.POSRepo(connection, { id: '' }), // 先の処理で明示的に指定される
|
|
43
45
|
member: new member_1.MemberRepo(connection),
|
|
44
46
|
movieTheater: new movieTheater_1.MovieTheaterRepo(connection),
|
|
@@ -63,7 +65,8 @@ function onResourceUpdated(params) {
|
|
|
63
65
|
// await onResourceDeleted(params)(repos);
|
|
64
66
|
}
|
|
65
67
|
else {
|
|
66
|
-
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['
|
|
68
|
+
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['useInformResourceTypes']);
|
|
69
|
+
const hubSettings = (await repos.integrationSetting.getByKey('hub'));
|
|
67
70
|
const useInformResourceTypes = setting?.useInformResourceTypes;
|
|
68
71
|
const useInform = params.useInform === true
|
|
69
72
|
&& Array.isArray(useInformResourceTypes) && useInformResourceTypes.includes(params.typeOf);
|
|
@@ -75,50 +78,50 @@ function onResourceUpdated(params) {
|
|
|
75
78
|
project: { id: params.project.id },
|
|
76
79
|
ids: params.id,
|
|
77
80
|
typeOf: params.typeOf
|
|
78
|
-
},
|
|
81
|
+
}, hubSettings)(repos);
|
|
79
82
|
break;
|
|
80
83
|
case factory_1.factory.creativeWorkType.Movie:
|
|
81
84
|
await createInformMovieTasks({
|
|
82
85
|
project: { id: params.project.id },
|
|
83
86
|
ids: params.id,
|
|
84
87
|
typeOf: params.typeOf
|
|
85
|
-
},
|
|
88
|
+
}, hubSettings)(repos);
|
|
86
89
|
break;
|
|
87
90
|
case factory_1.factory.product.ProductType.EventService:
|
|
88
91
|
await createInformProductTasks({
|
|
89
92
|
project: { id: params.project.id },
|
|
90
93
|
ids: params.id,
|
|
91
94
|
typeOf: params.typeOf
|
|
92
|
-
},
|
|
95
|
+
}, hubSettings)(repos);
|
|
93
96
|
break;
|
|
94
97
|
case 'CategoryCode':
|
|
95
98
|
await createInformCategoryCodeTasks({
|
|
96
99
|
project: { id: params.project.id },
|
|
97
100
|
ids: params.id,
|
|
98
101
|
typeOf: params.typeOf
|
|
99
|
-
},
|
|
102
|
+
}, hubSettings)(repos);
|
|
100
103
|
break;
|
|
101
104
|
case factory_1.factory.placeType.MovieTheater:
|
|
102
105
|
await createInformMovieTheaterTasks({
|
|
103
106
|
project: { id: params.project.id },
|
|
104
107
|
ids: params.id,
|
|
105
108
|
typeOf: params.typeOf
|
|
106
|
-
},
|
|
109
|
+
}, hubSettings)(repos);
|
|
107
110
|
break;
|
|
108
111
|
// ルーム通知に対応(2026-01-16~)
|
|
109
112
|
case factory_1.factory.placeType.ScreeningRoom:
|
|
110
|
-
await createInformRoomTasks(params,
|
|
113
|
+
await createInformRoomTasks(params, hubSettings)(repos);
|
|
111
114
|
break;
|
|
112
115
|
// 入場ゲート通知に対応(2026-01-17~)
|
|
113
116
|
case factory_1.factory.placeType.EntranceGate:
|
|
114
|
-
await createInformEntranceGateTasks(params,
|
|
117
|
+
await createInformEntranceGateTasks(params, hubSettings)(repos);
|
|
115
118
|
break;
|
|
116
119
|
case 'AccountTitle':
|
|
117
120
|
await createInformAccountTitleTasks({
|
|
118
121
|
project: { id: params.project.id },
|
|
119
122
|
ids: params.id,
|
|
120
123
|
typeOf: params.typeOf
|
|
121
|
-
},
|
|
124
|
+
}, hubSettings)(repos);
|
|
122
125
|
break;
|
|
123
126
|
case 'POS':
|
|
124
127
|
await (0, onHasPOSUpdated_1.createInformHasPOSTasks)({
|
|
@@ -133,7 +136,7 @@ function onResourceUpdated(params) {
|
|
|
133
136
|
project: { id: params.project.id },
|
|
134
137
|
ids: params.id,
|
|
135
138
|
typeOf: params.typeOf
|
|
136
|
-
},
|
|
139
|
+
}, hubSettings)(repos);
|
|
137
140
|
break;
|
|
138
141
|
case 'OfferCatalog':
|
|
139
142
|
await (0, onOfferCatalogUpdated_1.createInformOfferCatalogTasks)({
|
|
@@ -141,7 +144,7 @@ function onResourceUpdated(params) {
|
|
|
141
144
|
ids: params.id,
|
|
142
145
|
typeOf: params.typeOf,
|
|
143
146
|
isOfferCatalogItem: params.isOfferCatalogItem === true
|
|
144
|
-
},
|
|
147
|
+
}, hubSettings)(repos);
|
|
145
148
|
break;
|
|
146
149
|
default:
|
|
147
150
|
// no op
|
|
@@ -184,8 +187,8 @@ function onResourceUpdated(params) {
|
|
|
184
187
|
function createInformNoteTasks(params, setting) {
|
|
185
188
|
return async (repos) => {
|
|
186
189
|
const notes4inform = await repos.note.findNotes({ id: { $in: params.ids } }, ['about', 'identifier', 'project', 'text', 'typeOf', 'version']);
|
|
187
|
-
// const informResources =
|
|
188
|
-
const informResources = setting?.
|
|
190
|
+
// const informResources = setting?.onResourceUpdated?.informResource;
|
|
191
|
+
const informResources = setting?.onTaskStatusChanged.informTask2hub;
|
|
189
192
|
if (notes4inform.length > 0) {
|
|
190
193
|
const taskRunsAt = new Date();
|
|
191
194
|
const informTasks = [];
|
|
@@ -234,8 +237,8 @@ function createInformMovieTasks(params, setting) {
|
|
|
234
237
|
'additionalProperty', 'datePublished', 'duration', 'identifier', 'name', 'project',
|
|
235
238
|
'typeOf', 'distributor', 'contentRating', 'headline', 'thumbnailUrl'
|
|
236
239
|
]);
|
|
237
|
-
// const informResources =
|
|
238
|
-
const informResources = setting?.
|
|
240
|
+
// const informResources = setting?.onResourceUpdated?.informResource;
|
|
241
|
+
const informResources = setting?.onTaskStatusChanged.informTask2hub;
|
|
239
242
|
if (movies4inform.length > 0) {
|
|
240
243
|
const taskRunsAt = new Date();
|
|
241
244
|
const informTasks = [];
|
|
@@ -284,8 +287,8 @@ function createInformProductTasks(params, setting) {
|
|
|
284
287
|
}, ['additionalProperty', 'description', 'name', 'productID', 'project', 'typeOf', 'serviceType']
|
|
285
288
|
// []
|
|
286
289
|
);
|
|
287
|
-
// const informResources =
|
|
288
|
-
const informResources = setting?.
|
|
290
|
+
// const informResources = setting?.onResourceUpdated?.informResource;
|
|
291
|
+
const informResources = setting?.onTaskStatusChanged.informTask2hub;
|
|
289
292
|
if (products4inform.length > 0) {
|
|
290
293
|
const taskRunsAt = new Date();
|
|
291
294
|
const informTasks = [];
|
|
@@ -333,7 +336,8 @@ function createInformCategoryCodeTasks(params, setting) {
|
|
|
333
336
|
// ひとまずDistributorTypeのみ
|
|
334
337
|
inCodeSet: { identifier: { $eq: factory_1.factory.categoryCode.CategorySetIdentifier.DistributorType } }
|
|
335
338
|
}, ['name', 'additionalProperty', 'project', 'typeOf', 'codeValue', 'inCodeSet']);
|
|
336
|
-
const informResources = setting?.onResourceUpdated?.informResource;
|
|
339
|
+
// const informResources = setting?.onResourceUpdated?.informResource;
|
|
340
|
+
const informResources = setting?.onTaskStatusChanged.informTask2hub;
|
|
337
341
|
if (categoryCodes4inform.length > 0) {
|
|
338
342
|
const taskRunsAt = new Date();
|
|
339
343
|
const informTasks = [];
|
|
@@ -381,7 +385,8 @@ function createInformMovieTheaterTasks(params, setting) {
|
|
|
381
385
|
if (params.ids.length === 0) {
|
|
382
386
|
return;
|
|
383
387
|
}
|
|
384
|
-
const informResources = setting?.onResourceUpdated?.informResource;
|
|
388
|
+
// const informResources = setting?.onResourceUpdated?.informResource;
|
|
389
|
+
const informResources = setting?.onTaskStatusChanged.informTask2hub;
|
|
385
390
|
const movieTheaters = await repos.movieTheater.projectFields({
|
|
386
391
|
// limit: 1,
|
|
387
392
|
// page: 1,
|
|
@@ -453,8 +458,8 @@ function createInformRoomTasks(params, setting) {
|
|
|
453
458
|
return async (repos
|
|
454
459
|
// settings: Settings
|
|
455
460
|
) => {
|
|
456
|
-
// const informResources =
|
|
457
|
-
const informResources = setting?.
|
|
461
|
+
// const informResources = setting?.onResourceUpdated?.informResource;
|
|
462
|
+
const informResources = setting?.onTaskStatusChanged.informTask2hub;
|
|
458
463
|
if (Array.isArray(params.branchCode) && params.branchCode.length > 0) {
|
|
459
464
|
// ルームを検索
|
|
460
465
|
const rooms = (await repos.screeningRoom.findRooms({
|
|
@@ -513,7 +518,8 @@ function createInformRoomTasks(params, setting) {
|
|
|
513
518
|
}
|
|
514
519
|
function createInformEntranceGateTasks(params, setting) {
|
|
515
520
|
return async (repos) => {
|
|
516
|
-
const informResources = setting?.onResourceUpdated?.informResource;
|
|
521
|
+
// const informResources = setting?.onResourceUpdated?.informResource;
|
|
522
|
+
const informResources = setting?.onTaskStatusChanged.informTask2hub;
|
|
517
523
|
if (Array.isArray(params.identifier) && params.identifier.length > 0) {
|
|
518
524
|
// 入場ゲートを検索
|
|
519
525
|
repos.entranceGate.setOperatorId({ id: params.containedInPlace.id });
|
|
@@ -574,8 +580,8 @@ function createInformAccountTitleTasks(params, setting) {
|
|
|
574
580
|
if (params.ids.length !== 1) {
|
|
575
581
|
throw new factory_1.factory.errors.Argument('id', 'id.length must be 1');
|
|
576
582
|
}
|
|
577
|
-
// const informResources =
|
|
578
|
-
const informResources = setting?.
|
|
583
|
+
// const informResources = setting?.onResourceUpdated?.informResource;
|
|
584
|
+
const informResources = setting?.onTaskStatusChanged.informTask2hub;
|
|
579
585
|
const accountTitle = await repos.adminAccountTitleCategory.findAccountTitleCategorAsNotification({
|
|
580
586
|
id: params.ids[0],
|
|
581
587
|
projectId: params.project.id
|
|
@@ -4,6 +4,7 @@ exports.call = call;
|
|
|
4
4
|
const inform_1 = require("../../repo/action/inform");
|
|
5
5
|
const potentialAction_1 = require("../../repo/potentialAction");
|
|
6
6
|
const setting_1 = require("../../repo/setting");
|
|
7
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
7
8
|
const notification_1 = require("../notification");
|
|
8
9
|
/**
|
|
9
10
|
* タスク実行関数
|
|
@@ -18,7 +19,8 @@ function call(params) {
|
|
|
18
19
|
inform: new inform_1.InformActionRepo(connection)
|
|
19
20
|
},
|
|
20
21
|
potentialAction: new potentialAction_1.PotentialActionRepo(connection),
|
|
21
|
-
setting: new setting_1.SettingRepo(connection)
|
|
22
|
+
setting: new setting_1.SettingRepo(connection),
|
|
23
|
+
integrationSetting: new integration_1.IntegrationSettingRepo({ connection })
|
|
22
24
|
});
|
|
23
25
|
};
|
|
24
26
|
}
|
package/package.json
CHANGED