@chevre/domain 22.9.0-alpha.21 → 22.9.0-alpha.22

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.
@@ -342,7 +342,7 @@ export declare class ActionRepo {
342
342
  project: Pick<factory.project.IProject, "id" | "typeOf">;
343
343
  typeOf: factory.actionType;
344
344
  result?: any;
345
- recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
345
+ recipient?: import("@chevre/factory/lib/action").IRecipient | undefined;
346
346
  agent: import("@chevre/factory/lib/action").IParticipant;
347
347
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
348
348
  targetCollection?: any;
@@ -367,7 +367,7 @@ export declare class ActionRepo {
367
367
  project: Pick<factory.project.IProject, "id" | "typeOf">;
368
368
  typeOf: factory.actionType;
369
369
  result?: any;
370
- recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
370
+ recipient?: import("@chevre/factory/lib/action").IRecipient | undefined;
371
371
  agent: import("@chevre/factory/lib/action").IParticipant;
372
372
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
373
373
  targetCollection?: any;
@@ -394,7 +394,7 @@ export declare class ActionRepo {
394
394
  project: Pick<factory.project.IProject, "id" | "typeOf">;
395
395
  typeOf: factory.actionType;
396
396
  result?: any;
397
- recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
397
+ recipient?: import("@chevre/factory/lib/action").IRecipient | undefined;
398
398
  agent: import("@chevre/factory/lib/action").IParticipant;
399
399
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
400
400
  targetCollection?: any;
@@ -419,7 +419,7 @@ export declare class ActionRepo {
419
419
  project: Pick<factory.project.IProject, "id" | "typeOf">;
420
420
  typeOf: factory.actionType;
421
421
  result?: any;
422
- recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
422
+ recipient?: import("@chevre/factory/lib/action").IRecipient | undefined;
423
423
  agent: import("@chevre/factory/lib/action").IParticipant;
424
424
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
425
425
  targetCollection?: any;
@@ -26,11 +26,13 @@ export declare class PotentialActionRepo {
26
26
  getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, {
27
27
  project: Pick<factory.project.IProject, "id" | "typeOf">;
28
28
  typeOf: factory.actionType.InformAction;
29
+ recipient?: factory.potentialAction.IInformRecipient | undefined;
29
30
  identifier: string;
30
31
  target: factory.entryPoint.IEntryPoint;
31
32
  }> & {
32
33
  project: Pick<factory.project.IProject, "id" | "typeOf">;
33
34
  typeOf: factory.actionType.InformAction;
35
+ recipient?: factory.potentialAction.IInformRecipient | undefined;
34
36
  identifier: string;
35
37
  target: factory.entryPoint.IEntryPoint;
36
38
  } & {
@@ -38,11 +40,13 @@ export declare class PotentialActionRepo {
38
40
  }, QueryOptions<import("mongoose").Document<unknown, {}, {
39
41
  project: Pick<factory.project.IProject, "id" | "typeOf">;
40
42
  typeOf: factory.actionType.InformAction;
43
+ recipient?: factory.potentialAction.IInformRecipient | undefined;
41
44
  identifier: string;
42
45
  target: factory.entryPoint.IEntryPoint;
43
46
  }> & {
44
47
  project: Pick<factory.project.IProject, "id" | "typeOf">;
45
48
  typeOf: factory.actionType.InformAction;
49
+ recipient?: factory.potentialAction.IInformRecipient | undefined;
46
50
  identifier: string;
47
51
  target: factory.entryPoint.IEntryPoint;
48
52
  } & {
@@ -28,7 +28,8 @@ const AVAILABLE_PROJECT_FIELDS = [
28
28
  'project',
29
29
  'typeOf',
30
30
  'target',
31
- 'identifier'
31
+ 'identifier',
32
+ 'recipient'
32
33
  ];
33
34
  /**
34
35
  * 潜在アクションリポジトリ
@@ -239,8 +239,27 @@ function sleep(waitTime) {
239
239
  }
240
240
  function createInformActionAttributes(params) {
241
241
  return (repos) => __awaiter(this, void 0, void 0, function* () {
242
- var _a;
242
+ var _a, _b;
243
243
  const { about, object, purpose, recipient, project, id, typeOf } = params;
244
+ // redefine recipient(2025-02-15~)
245
+ let informRecipient;
246
+ // let informRecipient: factory.action.interact.inform.IRecipient | factory.action.interact.inform.IRecipientDeprecated = {
247
+ // ...recipient
248
+ // // url: target.urlTemplate // discontinue(2025-02-15~)
249
+ // };
250
+ if ((recipient === null || recipient === void 0 ? void 0 : recipient.typeOf) === factory.organizationType.Corporation && typeof recipient.id === 'string') {
251
+ informRecipient = {
252
+ id: recipient.id,
253
+ name: recipient.name,
254
+ typeOf: recipient.typeOf
255
+ };
256
+ }
257
+ else if ((recipient === null || recipient === void 0 ? void 0 : recipient.typeOf) === factory.creativeWorkType.WebApplication) {
258
+ informRecipient = {
259
+ name: recipient.name,
260
+ typeOf: recipient.typeOf
261
+ };
262
+ }
244
263
  let target;
245
264
  if (typeOf === factory.actionType.InformAction && typeof id === 'string' && id !== '') {
246
265
  // find target from potentialAction(2025-02-06~)
@@ -249,22 +268,26 @@ function createInformActionAttributes(params) {
249
268
  page: 1,
250
269
  id: { $eq: id },
251
270
  typeOf: { $eq: typeOf }
252
- }, ['target'])).shift();
271
+ }, ['target', 'recipient'])).shift();
253
272
  if (potentialInformAction === undefined) {
254
273
  throw new factory.errors.NotFound(factory.actionType.InformAction);
255
274
  }
275
+ if (typeof ((_a = potentialInformAction.recipient) === null || _a === void 0 ? void 0 : _a.name) === 'string') {
276
+ informRecipient = { name: potentialInformAction.recipient.name, typeOf: potentialInformAction.recipient.typeOf };
277
+ }
256
278
  target = potentialInformAction.target;
257
279
  }
258
280
  else {
259
- if (((_a = params.target) === null || _a === void 0 ? void 0 : _a.typeOf) === 'EntryPoint') {
281
+ if (((_b = params.target) === null || _b === void 0 ? void 0 : _b.typeOf) === 'EntryPoint') {
260
282
  target = params.target;
261
283
  }
262
284
  }
263
- // target required(2025-02-09~)
285
+ if (informRecipient === undefined) {
286
+ throw new factory.errors.ArgumentNull('recipient');
287
+ }
264
288
  if (target === undefined) {
265
289
  throw new factory.errors.ArgumentNull('target');
266
290
  }
267
- const informRecipient = Object.assign(Object.assign({}, recipient), { url: target.urlTemplate });
268
291
  return Object.assign(Object.assign(Object.assign({ agent: { id: project.id, typeOf: factory.organizationType.Project }, object, project: { id: project.id, typeOf: factory.organizationType.Project }, recipient: informRecipient, typeOf: factory.actionType.InformAction }, (typeof (purpose === null || purpose === void 0 ? void 0 : purpose.typeOf) === 'string') ? { purpose } : undefined), (typeof (about === null || about === void 0 ? void 0 : about.typeOf) === 'string') ? { about } : undefined), (typeof (target === null || target === void 0 ? void 0 : target.typeOf) === 'string') ? { target } : undefined // add(2025-02-06~)
269
292
  );
270
293
  });
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.393.0-alpha.15",
15
- "@cinerino/sdk": "10.21.0-alpha.14",
14
+ "@chevre/factory": "4.393.0-alpha.16",
15
+ "@cinerino/sdk": "10.21.0-alpha.15",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.3.0",
18
18
  "@sendgrid/mail": "6.4.0",
@@ -112,5 +112,5 @@
112
112
  "postversion": "git push origin --tags",
113
113
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
114
114
  },
115
- "version": "22.9.0-alpha.21"
115
+ "version": "22.9.0-alpha.22"
116
116
  }