@chevre/domain 22.8.0-alpha.24 → 22.8.0-alpha.26

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.
@@ -13,13 +13,11 @@ async function main() {
13
13
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
14
14
 
15
15
  const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
16
- const actions = await actionRepo.search(
16
+ const actions = await actionRepo.searchByOrderNumber(
17
17
  {
18
- limit: 3,
19
- page: 1,
18
+ orderNumber: 'CIN6-4292767-6570494',
20
19
  sort: { startDate: chevre.factory.sortType.Descending }
21
- },
22
- ['startDate']
20
+ }
23
21
  );
24
22
  console.log('actions:', actions);
25
23
  }
@@ -2,7 +2,7 @@ import { factory as surfrockFactory } from '@surfrock/sdk';
2
2
  import { Connection, FilterQuery, UpdateQuery } from 'mongoose';
3
3
  import * as factory from '../factory';
4
4
  export type IAction4transaction<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction> = T extends factory.actionType.AcceptAction ? factory.action.accept.coaOffer.IAction | factory.action.accept.pay.IAction : T extends factory.actionType.AuthorizeAction ? (factory.action.authorize.offer.eventService.IAction | factory.action.authorize.offer.moneyTransfer.IAction | factory.action.authorize.offer.product.IAction | factory.action.authorize.paymentMethod.any.IAction) : never;
5
- export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.token.IAction) : T extends factory.actionType.MoneyTransfer ? factory.action.transfer.moneyTransfer.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction<factory.action.update.replace.IAttributes<any, any>> : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
5
+ export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.token.IAction) : T extends factory.actionType.MoneyTransfer ? factory.action.transfer.moneyTransfer.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction<factory.action.update.replace.IAttributes<any, any>> : T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction<any> : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
6
6
  interface IAggregationByStatus {
7
7
  actionCount: number;
8
8
  avgDuration: number;
@@ -336,100 +336,16 @@ export declare class ActionRepo {
336
336
  startFrom: Date;
337
337
  startThrough: Date;
338
338
  }): Promise<IAggregateAction>;
339
- getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, {
340
- object: any;
341
- error?: any;
342
- project: Pick<factory.project.IProject, "id" | "typeOf">;
343
- typeOf: factory.actionType;
344
- result?: any;
345
- recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
346
- agent: import("@chevre/factory/lib/action").IParticipant;
347
- purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
348
- targetCollection?: any;
349
- potentialActions?: any;
350
- instrument?: any;
351
- location?: any;
352
- endDate?: Date | undefined;
353
- sameAs?: import("@chevre/factory/lib/action").ISameAs | undefined;
354
- startDate: Date;
355
- description?: string | undefined;
356
- amount?: any;
357
- fromLocation?: any;
358
- toLocation?: any;
359
- replacer?: any;
360
- cancelAction?: any;
361
- actionStatus: factory.actionStatusType;
362
- }> & {
363
- object: any;
364
- error?: any;
365
- project: Pick<factory.project.IProject, "id" | "typeOf">;
366
- typeOf: factory.actionType;
367
- result?: any;
368
- recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
369
- agent: import("@chevre/factory/lib/action").IParticipant;
370
- purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
371
- targetCollection?: any;
372
- potentialActions?: any;
373
- instrument?: any;
374
- location?: any;
375
- endDate?: Date | undefined;
376
- sameAs?: import("@chevre/factory/lib/action").ISameAs | undefined;
377
- startDate: Date;
378
- description?: string | undefined;
379
- amount?: any;
380
- fromLocation?: any;
381
- toLocation?: any;
382
- replacer?: any;
383
- cancelAction?: any;
384
- actionStatus: factory.actionStatusType;
339
+ getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, Omit<import("@chevre/factory/lib/action").IAction<import("@chevre/factory/lib/action").IAttributes<factory.actionType, any, any>>, "id"> & {
340
+ about?: any;
341
+ }> & Omit<import("@chevre/factory/lib/action").IAction<import("@chevre/factory/lib/action").IAttributes<factory.actionType, any, any>>, "id"> & {
342
+ about?: any;
385
343
  } & {
386
344
  _id: import("mongoose").Types.ObjectId;
387
- }, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, {
388
- object: any;
389
- error?: any;
390
- project: Pick<factory.project.IProject, "id" | "typeOf">;
391
- typeOf: factory.actionType;
392
- result?: any;
393
- recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
394
- agent: import("@chevre/factory/lib/action").IParticipant;
395
- purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
396
- targetCollection?: any;
397
- potentialActions?: any;
398
- instrument?: any;
399
- location?: any;
400
- endDate?: Date | undefined;
401
- sameAs?: import("@chevre/factory/lib/action").ISameAs | undefined;
402
- startDate: Date;
403
- description?: string | undefined;
404
- amount?: any;
405
- fromLocation?: any;
406
- toLocation?: any;
407
- replacer?: any;
408
- cancelAction?: any;
409
- actionStatus: factory.actionStatusType;
410
- }> & {
411
- object: any;
412
- error?: any;
413
- project: Pick<factory.project.IProject, "id" | "typeOf">;
414
- typeOf: factory.actionType;
415
- result?: any;
416
- recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
417
- agent: import("@chevre/factory/lib/action").IParticipant;
418
- purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
419
- targetCollection?: any;
420
- potentialActions?: any;
421
- instrument?: any;
422
- location?: any;
423
- endDate?: Date | undefined;
424
- sameAs?: import("@chevre/factory/lib/action").ISameAs | undefined;
425
- startDate: Date;
426
- description?: string | undefined;
427
- amount?: any;
428
- fromLocation?: any;
429
- toLocation?: any;
430
- replacer?: any;
431
- cancelAction?: any;
432
- actionStatus: factory.actionStatusType;
345
+ }, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, Omit<import("@chevre/factory/lib/action").IAction<import("@chevre/factory/lib/action").IAttributes<factory.actionType, any, any>>, "id"> & {
346
+ about?: any;
347
+ }> & Omit<import("@chevre/factory/lib/action").IAction<import("@chevre/factory/lib/action").IAttributes<factory.actionType, any, any>>, "id"> & {
348
+ about?: any;
433
349
  } & {
434
350
  _id: import("mongoose").Types.ObjectId;
435
351
  }>>;
@@ -48,7 +48,8 @@ const AVAILABLE_PROJECT_FIELDS = [
48
48
  'replacer',
49
49
  'targetCollection',
50
50
  'sameAs',
51
- 'cancelAction'
51
+ 'cancelAction',
52
+ 'about'
52
53
  ];
53
54
  /**
54
55
  * アクションリポジトリ
@@ -461,11 +462,6 @@ class ActionRepo {
461
462
  if (Array.isArray(inclusion) && inclusion.length > 0) {
462
463
  positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
463
464
  }
464
- else {
465
- // if (Array.isArray(exclusion) && exclusion.length > 0) {
466
- // positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
467
- // }
468
- }
469
465
  const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
470
466
  const query = this.actionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
471
467
  if (typeof params.limit === 'number' && params.limit > 0) {
@@ -765,8 +761,10 @@ class ActionRepo {
765
761
  var _a;
766
762
  const filter = {
767
763
  $or: [
768
- { 'object.orderNumber': { $eq: params.orderNumber } },
769
- { 'purpose.orderNumber': { $eq: params.orderNumber } }
764
+ { 'object.orderNumber': { $exists: true, $eq: params.orderNumber } },
765
+ { 'purpose.orderNumber': { $exists: true, $eq: params.orderNumber } },
766
+ // consider inform returnAction(2025-01-22~)
767
+ { 'about.orderNumber': { $exists: true, $eq: params.orderNumber } }
770
768
  ]
771
769
  };
772
770
  const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(AVAILABLE_PROJECT_FIELDS.map((key) => ([key, 1]))));
@@ -1,6 +1,8 @@
1
1
  import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
2
  import * as factory from '../../../factory';
3
- type IDocType = Omit<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>, 'id'>;
3
+ type IDocType = Omit<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>, 'id'> & {
4
+ about?: any;
5
+ };
4
6
  type IModel = Model<IDocType>;
5
7
  type ISchemaDefinition = SchemaDefinition<IDocType>;
6
8
  type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
@@ -29,7 +29,8 @@ const schemaDefinition = {
29
29
  replacer: mongoose_1.SchemaTypes.Mixed, // add replacer(2024-03-19~)
30
30
  targetCollection: mongoose_1.SchemaTypes.Mixed, // add targetCollection(2024-03-19~)
31
31
  sameAs: mongoose_1.SchemaTypes.Mixed, // タスク関連付けのために追加(2024-04-20~)
32
- cancelAction: mongoose_1.SchemaTypes.Mixed // add(2024-05-26~)
32
+ cancelAction: mongoose_1.SchemaTypes.Mixed, // add(2024-05-26~)
33
+ about: mongoose_1.SchemaTypes.Mixed // add(2025-01-22~)
33
34
  };
34
35
  const schemaOptions = {
35
36
  autoIndex: settings_1.MONGO_AUTO_INDEX,
@@ -227,15 +228,15 @@ const indexes = [
227
228
  }
228
229
  }
229
230
  ],
230
- // [
231
- // { 'object.acceptedOffer.itemOffered.serviceOutput.reservedTicket.ticketedSeat.seatNumber': 1, startDate: -1 },
232
- // {
233
- // name: 'searchByObjectAcceptedOfferItemOfferedServiceOutputSeatNumber',
234
- // partialFilterExpression: {
235
- // 'object.acceptedOffer.itemOffered.serviceOutput.reservedTicket.ticketedSeat.seatNumber': { $exists: true }
236
- // }
237
- // }
238
- // ], // discontinue(2024-07-02~)
231
+ [
232
+ { 'about.orderNumber': 1, startDate: -1 },
233
+ {
234
+ name: 'aboutOrderNumber',
235
+ partialFilterExpression: {
236
+ 'about.orderNumber': { $exists: true }
237
+ }
238
+ }
239
+ ],
239
240
  [
240
241
  { 'object.orderNumber': 1, startDate: -1 },
241
242
  {
@@ -18,6 +18,7 @@ setting) {
18
18
  informTasks.push(...informOrder.map((informOrderParams) => {
19
19
  var _a, _b;
20
20
  const informActionAttributes = {
21
+ about: { orderNumber: order.orderNumber, typeOf: factory.order.OrderType.Order },
21
22
  object: order4inform,
22
23
  recipient: {
23
24
  url: (_a = informOrderParams.recipient) === null || _a === void 0 ? void 0 : _a.url,
@@ -23,6 +23,7 @@ setting) {
23
23
  informTasks.push(...informOrder.map((informOrderParams) => {
24
24
  var _a, _b;
25
25
  const informActionAttributes = {
26
+ about: { orderNumber: order.orderNumber, typeOf: factory.order.OrderType.Order },
26
27
  object: order4inform,
27
28
  recipient: {
28
29
  url: (_a = informOrderParams.recipient) === null || _a === void 0 ? void 0 : _a.url,
@@ -23,6 +23,7 @@ setting) {
23
23
  informTasks.push(...informOrder.map((informOrderParams) => {
24
24
  var _a, _b;
25
25
  const informActionAttributes = {
26
+ about: { orderNumber: order.orderNumber, typeOf: factory.order.OrderType.Order },
26
27
  object: order4inform,
27
28
  recipient: {
28
29
  url: (_a = informOrderParams.recipient) === null || _a === void 0 ? void 0 : _a.url,
@@ -27,6 +27,7 @@ function createInformTasks(order, returnOrderAction, setting) {
27
27
  informTasks.push(...informOrder.map((informOrderParams) => {
28
28
  var _a, _b;
29
29
  const informActionAttributes = {
30
+ about: { orderNumber: order.orderNumber, typeOf: factory.order.OrderType.Order },
30
31
  object: informObject,
31
32
  recipient: {
32
33
  url: (_a = informOrderParams.recipient) === null || _a === void 0 ? void 0 : _a.url,
@@ -16,6 +16,7 @@ setting) {
16
16
  informTasks.push(...informOrder.map((informOrderParams) => {
17
17
  var _a, _b;
18
18
  const informActionAttributes = {
19
+ about: { orderNumber: order4inform.orderNumber, typeOf: factory.order.OrderType.Order },
19
20
  object: order4inform,
20
21
  recipient: {
21
22
  url: (_a = informOrderParams.recipient) === null || _a === void 0 ? void 0 : _a.url,
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.392.0-alpha.17",
14
+ "@chevre/factory": "4.392.0-alpha.18",
15
15
  "@cinerino/sdk": "10.20.0-alpha.10",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.3.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.8.0-alpha.24"
115
+ "version": "22.8.0-alpha.26"
116
116
  }