@chevre/domain 28.1.0-alpha.5 → 28.1.0-alpha.6

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.
@@ -42,7 +42,7 @@ interface IQuotaSettings {
42
42
  placeOrderExpiresInSecondsMax?: number;
43
43
  placeOrderExpiresInSecondsMin?: number;
44
44
  }
45
- interface ITriggerWebhookSettings {
45
+ export interface ITriggerWebhookSettings {
46
46
  /**
47
47
  * リクエストタイムアウト
48
48
  */
@@ -109,16 +109,6 @@ export interface ITransactionNumberSetting {
109
109
  */
110
110
  version: string;
111
111
  }
112
- export interface IServiceOutputIdentifierSetting {
113
- /**
114
- * fpe暗号鍵
115
- */
116
- fpeSecret: string;
117
- /**
118
- * "1"
119
- */
120
- version: string;
121
- }
122
112
  interface ICOAIntegrationSettings {
123
113
  timeoutReserve: number;
124
114
  timeoutMaster: number;
@@ -222,6 +212,10 @@ export interface IIntegrationSettings {
222
212
  * 2026-11-02~
223
213
  */
224
214
  agg?: IAggSettings;
215
+ /**
216
+ * 通知設定
217
+ */
218
+ triggerWebhook?: ITriggerWebhookSettings;
225
219
  useExperimentalFeature: boolean;
226
220
  }
227
221
  /**
@@ -274,13 +268,8 @@ export interface ISetting {
274
268
  typeOf: factory.organizationType.Project;
275
269
  };
276
270
  quota?: IQuotaSettings;
277
- serviceOutputIdentifier?: IServiceOutputIdentifierSetting;
278
271
  storage?: IStorageSettings;
279
272
  transactionNumber?: ITransactionNumberSetting;
280
- /**
281
- * 通知設定
282
- */
283
- triggerWebhook?: ITriggerWebhookSettings;
284
273
  useInformResourceTypes?: string[];
285
274
  userPoolIdOld?: string;
286
275
  userPoolIdNew?: string;
@@ -17,15 +17,15 @@ const schemaDefinition = {
17
17
  onOrderStatusChanged: mongoose_1.SchemaTypes.Mixed,
18
18
  onReservationStatusChanged: mongoose_1.SchemaTypes.Mixed,
19
19
  onTaskStatusChanged: mongoose_1.SchemaTypes.Mixed,
20
+ triggerWebhook: mongoose_1.SchemaTypes.Mixed,
20
21
  },
21
22
  // onResourceUpdated: SchemaTypes.Mixed, // discontinue(2026-11-02~)
22
23
  // onTransactionStatusChanged: SchemaTypes.Mixed, // discontinue(2026-06-29~)
23
24
  orderNumber: mongoose_1.SchemaTypes.Mixed,
24
25
  quota: mongoose_1.SchemaTypes.Mixed,
25
- serviceOutputIdentifier: mongoose_1.SchemaTypes.Mixed,
26
+ // serviceOutputIdentifier: SchemaTypes.Mixed, // discontinue(2026-11-03~)
26
27
  storage: mongoose_1.SchemaTypes.Mixed,
27
28
  transactionNumber: mongoose_1.SchemaTypes.Mixed,
28
- triggerWebhook: mongoose_1.SchemaTypes.Mixed,
29
29
  useInformResourceTypes: [String],
30
30
  userPoolIdOld: String,
31
31
  userPoolIdNew: String,
@@ -4,8 +4,7 @@ import { factory } from '../../../factory';
4
4
  declare enum DataCatalogIdentifier {
5
5
  confirmationNumber = "confirmationNumber",
6
6
  transactionNumber = "transactionNumber",
7
- orderNumber = "orderNumber",
8
- serviceOutputIdentifier = "serviceOutputIdentifier"
7
+ orderNumber = "orderNumber"
9
8
  }
10
9
  interface IDataCatalog {
11
10
  identifier: DataCatalogIdentifier;
@@ -10,7 +10,7 @@ var DataCatalogIdentifier;
10
10
  DataCatalogIdentifier["confirmationNumber"] = "confirmationNumber";
11
11
  DataCatalogIdentifier["transactionNumber"] = "transactionNumber";
12
12
  DataCatalogIdentifier["orderNumber"] = "orderNumber";
13
- DataCatalogIdentifier["serviceOutputIdentifier"] = "serviceOutputIdentifier";
13
+ // serviceOutputIdentifier = 'serviceOutputIdentifier' // discontinue(2026-11-03~)
14
14
  })(DataCatalogIdentifier || (exports.DataCatalogIdentifier = DataCatalogIdentifier = {}));
15
15
  const modelName = 'TransactionNumber';
16
16
  exports.modelName = modelName;
@@ -25,4 +25,5 @@ export declare class IntegrationSettingRepo {
25
25
  addSendGridSettings(params: ISendGridSettings): Promise<import("mongoose").UpdateWriteOpResult>;
26
26
  addHubSettings(params: IHubSettings): Promise<import("mongoose").UpdateWriteOpResult>;
27
27
  migrateAggSettings(): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
28
+ migrateTriggerWebhookSettings(): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
28
29
  }
@@ -129,5 +129,27 @@ class IntegrationSettingRepo {
129
129
  return updateResult;
130
130
  }
131
131
  }
132
+ async migrateTriggerWebhookSettings() {
133
+ const oldSetting = await this.settingModel.findOne({ 'project.id': { $eq: '*' } }, { triggerWebhook: 1 })
134
+ .lean()
135
+ .exec();
136
+ if (oldSetting?.triggerWebhook !== undefined) {
137
+ console.dir(oldSetting.triggerWebhook, { depth: null });
138
+ const updateResult = await this.settingModel.updateOne({ 'project.id': { $eq: '*' } }, {
139
+ $set: { 'integration.triggerWebhook': oldSetting.triggerWebhook }
140
+ })
141
+ .exec();
142
+ // const unsetResult = await this.settingModel.updateOne(
143
+ // { 'project.id': { $eq: '*' } },
144
+ // {
145
+ // $unset: {
146
+ // triggerWebhook: 1,
147
+ // }
148
+ // }
149
+ // )
150
+ // .exec();
151
+ return updateResult;
152
+ }
153
+ }
132
154
  }
133
155
  exports.IntegrationSettingRepo = IntegrationSettingRepo;
@@ -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' | 'orderNumber' | 'quota' | 'serviceOutputIdentifier' | 'storage' | 'transactionNumber' | 'triggerWebhook' | 'useInformResourceTypes' | 'useMongo4confirmationNumberFrom' | 'useMongo4orderNumberFrom' | 'useMongo4transactionNumberFrom' | 'useMongoAsStockHolder' | 'useMongoAsStockHolderProjects' | 'userPoolIdNew' | 'userPoolIdOld'>;
4
+ type IGlobalSetting = Pick<ISetting, 'defaultSenderEmail' | 'orderNumber' | 'quota' | 'storage' | 'transactionNumber' | 'useInformResourceTypes' | 'useMongo4confirmationNumberFrom' | 'useMongo4orderNumberFrom' | 'useMongo4transactionNumberFrom' | 'useMongoAsStockHolder' | 'useMongoAsStockHolderProjects' | 'userPoolIdNew' | 'userPoolIdOld'>;
5
5
  export { IGlobalSetting as ISetting };
6
6
  /**
7
7
  * 設定リポジトリ
@@ -1,21 +1,19 @@
1
1
  import { factory } from '../../../factory';
2
2
  import type { InformActionRepo } from '../../../repo/action/inform';
3
3
  import type { PotentialActionRepo } from '../../../repo/potentialAction';
4
- import type { ISetting, SettingRepo } from '../../../repo/setting';
5
4
  import type { IIntegrationSettings, IntegrationSettingRepo } from '../../../repo/setting/integration';
6
5
  interface ITriggerWebhookRepos {
7
6
  actions: {
8
7
  inform: InformActionRepo;
9
8
  };
10
9
  potentialAction: PotentialActionRepo;
11
- setting: SettingRepo;
12
10
  integrationSetting: IntegrationSettingRepo;
13
11
  }
14
12
  declare function processInformAction(params: (factory.task.triggerWebhook.IData | factory.task.informHub.IData) & {
15
13
  project: {
16
14
  id: string;
17
15
  };
18
- }, settings: Pick<ISetting, 'triggerWebhook'>, options: {
16
+ }, settings: IIntegrationSettings['triggerWebhook'], options: {
19
17
  integrationSettings?: IIntegrationSettings['hub'];
20
18
  useIAP: boolean;
21
19
  }): (repos: {
@@ -100,8 +100,8 @@ function signRequest(params) {
100
100
  async function makeRequestHeaders(params, options) {
101
101
  const { action, settings, integrationSettings, requestBody } = params;
102
102
  const { useIAP } = options;
103
- const secretKey = settings?.triggerWebhook?.secretKey;
104
- const headerIdentifier = settings?.triggerWebhook?.headerIdentifier;
103
+ const secretKey = settings?.secretKey;
104
+ const headerIdentifier = settings?.headerIdentifier;
105
105
  const googleTargetAudience = integrationSettings?.googleTargetAudience;
106
106
  const timestamp = action.startDate.valueOf();
107
107
  // sign request(2024-10-28~)
@@ -134,7 +134,7 @@ async function makeRequestHeaders(params, options) {
134
134
  }
135
135
  function processInformAction(params, settings, options) {
136
136
  return async (repos) => {
137
- const timeout = settings?.triggerWebhook?.timeout;
137
+ const timeout = settings?.timeout;
138
138
  const { identifier } = params;
139
139
  const informActionAttributes = await createInformActionAttributes(params)(repos);
140
140
  const action = await repos.actions.inform.startInformAction(informActionAttributes);
@@ -6,12 +6,12 @@ const factory_1 = require("../../factory");
6
6
  const processInformAction_1 = require("./triggerWebhook/processInformAction");
7
7
  function findSettings() {
8
8
  return async (repos) => {
9
- const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['triggerWebhook']);
10
- if (setting === null) {
9
+ const setting = await repos.integrationSetting.getByKey('triggerWebhook');
10
+ if (setting === undefined) {
11
11
  throw new factory_1.factory.errors.NotFound('settings.triggerWebhook');
12
12
  }
13
- const retryCountMax = setting?.triggerWebhook?.retryCountMax;
14
- const retryIntervalInMS = setting?.triggerWebhook?.retryIntervalInMS;
13
+ const retryCountMax = setting?.retryCountMax;
14
+ const retryIntervalInMS = setting?.retryIntervalInMS;
15
15
  if (typeof retryCountMax !== 'number') {
16
16
  throw new factory_1.factory.errors.NotFound('setting.triggerWebhook.retryCountMax');
17
17
  }
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.call = call;
4
4
  const inform_1 = require("../../repo/action/inform");
5
5
  const potentialAction_1 = require("../../repo/potentialAction");
6
- const setting_1 = require("../../repo/setting");
7
6
  const integration_1 = require("../../repo/setting/integration");
8
7
  const notification_1 = require("../notification");
9
8
  /**
@@ -19,7 +18,6 @@ function call(params) {
19
18
  inform: new inform_1.InformActionRepo(connection)
20
19
  },
21
20
  potentialAction: new potentialAction_1.PotentialActionRepo(connection),
22
- setting: new setting_1.SettingRepo(connection),
23
21
  integrationSetting: new integration_1.IntegrationSettingRepo({ connection })
24
22
  });
25
23
  };
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.call = call;
4
4
  const inform_1 = require("../../repo/action/inform");
5
5
  const potentialAction_1 = require("../../repo/potentialAction");
6
- const setting_1 = require("../../repo/setting");
7
6
  const integration_1 = require("../../repo/setting/integration");
8
7
  const notification_1 = require("../notification");
9
8
  /**
@@ -19,7 +18,6 @@ function call(params) {
19
18
  inform: new inform_1.InformActionRepo(connection)
20
19
  },
21
20
  potentialAction: new potentialAction_1.PotentialActionRepo(connection),
22
- setting: new setting_1.SettingRepo(connection),
23
21
  integrationSetting: new integration_1.IntegrationSettingRepo({ connection })
24
22
  });
25
23
  };
package/package.json CHANGED
@@ -89,5 +89,5 @@
89
89
  "postversion": "git push origin --tags",
90
90
  "prepublishOnly": "npm run clean && npm run build"
91
91
  },
92
- "version": "28.1.0-alpha.5"
92
+ "version": "28.1.0-alpha.6"
93
93
  }