@chevre/domain 22.2.0-alpha.23 → 22.2.0-alpha.24

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.
@@ -12,19 +12,29 @@ mongoose.Model.on('index', (...args) => {
12
12
  async function main() {
13
13
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
14
14
 
15
- const transactionrRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
15
+ const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
16
16
 
17
- const docs = await transactionrRepo.projectFields(
17
+ const docs = await actionRepo.search(
18
18
  {
19
19
  limit: 1,
20
20
  page: 1,
21
- typeOf: chevre.factory.transactionType.PlaceOrder,
22
- inclusion: ['startDate']
23
- }
21
+ typeOf: { $eq: chevre.factory.actionType.AuthorizeAction }
22
+ },
23
+ ['id', 'typeOf', 'actionStatus'],
24
+ ['result', 'cancelAction', 'instrument', 'object']
24
25
  );
25
26
  // tslint:disable-next-line:no-null-keyword
26
27
  console.dir(docs, { depth: null });
27
28
  console.log(docs.length, 'docs found');
29
+
30
+ const actions = await actionRepo.searchByOrderNumber(
31
+ {
32
+ orderNumber: 'CIN9-4893721-9248784'
33
+ }
34
+ );
35
+ // tslint:disable-next-line:no-null-keyword
36
+ console.dir(actions, { depth: null });
37
+ console.log(actions.length, 'actions found');
28
38
  }
29
39
 
30
40
  main()
@@ -11,18 +11,18 @@ console.log(`importing chevre took ${diff[0]} seconds and ${diff[1]} nanoseconds
11
11
  async function main() {
12
12
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
13
 
14
- const transactionrRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
14
+ const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
15
15
 
16
- const transaction = await transactionrRepo.projectFieldsById(
16
+ const doc = await actionRepo.findById(
17
17
  {
18
- // id: '120162210202407171202250'
19
- id: '66c6a1bb261e960547f8e138',
20
- typeOf: chevre.factory.transactionType.PlaceOrder
18
+ id: '66cc6030fe3d4df76011aa75',
19
+ typeOf: chevre.factory.actionType.DeleteAction
21
20
  },
22
- ['startDate']
21
+ ['id', 'actionStatus'],
22
+ []
23
23
  );
24
24
  // tslint:disable-next-line:no-null-keyword
25
- console.dir(transaction, { depth: null });
25
+ console.dir(doc, { depth: null });
26
26
  }
27
27
 
28
28
  main()
@@ -25,13 +25,16 @@
25
25
  import { factory as surfrockFactory } from '@surfrock/sdk';
26
26
  import { Connection, Document, FilterQuery, QueryOptions, UpdateQuery } from 'mongoose';
27
27
  import * as factory from '../factory';
28
- export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : 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>>;
28
+ export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> & {
29
+ cancelAction?: any;
30
+ } : 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>> & {
31
+ targetCollection?: any;
32
+ } : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
29
33
  export type IPayAction = factory.action.trade.pay.IAction;
30
34
  export interface IUseActionCountByOffer {
31
35
  _id: string[];
32
36
  useActionCount?: number;
33
37
  }
34
- type KeyOfAction = keyof factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>> | '_id';
35
38
  interface IAggregationByStatus {
36
39
  actionCount: number;
37
40
  avgDuration: number;
@@ -72,6 +75,7 @@ export type IRecipeAsActionAttributes = Pick<factory.recipe.IRecipe, 'project' |
72
75
  export type IMinimizedPurchaseNumberAuthResult = Pick<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult, 'mkknmiNumSum' | 'resultInfo' | 'ykknmiNumSum'> & {
73
76
  knyknrNoInfoOut: Omit<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberInfo, 'ykknInfo' | 'mkknInfo'>[] | null;
74
77
  };
78
+ type IKeyOfProjection = keyof IAction<factory.actionType> | keyof IAction<factory.actionType.AuthorizeAction> | keyof IAction<factory.actionType.MoneyTransfer> | keyof IAction<factory.actionType.ReplaceAction>;
75
79
  /**
76
80
  * アクションリポジトリ
77
81
  */
@@ -83,7 +87,7 @@ export declare class ActionRepo {
83
87
  /**
84
88
  * アクション検索
85
89
  */
86
- search<T extends factory.actionType>(params: factory.action.ISearchConditions, inclusion: KeyOfAction[], exclusion: KeyOfAction[]): Promise<IAction<T>[]>;
90
+ search<T extends factory.actionType>(params: factory.action.ISearchConditions, inclusion: IKeyOfProjection[], exclusion: IKeyOfProjection[]): Promise<IAction<T>[]>;
87
91
  /**
88
92
  * アクション開始
89
93
  */
@@ -153,7 +157,7 @@ export declare class ActionRepo {
153
157
  findById<T extends factory.actionType>(params: {
154
158
  typeOf: T;
155
159
  id: string;
156
- }, inclusion?: KeyOfAction[], exclusion?: KeyOfAction[]): Promise<IAction<T>>;
160
+ }, inclusion?: IKeyOfProjection[], exclusion?: IKeyOfProjection[]): Promise<IAction<T>>;
157
161
  findPayAction(params: {
158
162
  project: {
159
163
  id: string;
@@ -25,6 +25,30 @@ const factory = require("../factory");
25
25
  const settings_1 = require("../settings");
26
26
  const action_1 = require("./mongoose/schemas/action");
27
27
  const actionRecipe_1 = require("./mongoose/schemas/actionRecipe");
28
+ const AVAILABLE_PROJECT_FIELDS = [
29
+ 'project',
30
+ 'actionStatus',
31
+ 'typeOf',
32
+ 'description',
33
+ 'agent',
34
+ 'recipient',
35
+ 'result',
36
+ 'error',
37
+ 'object',
38
+ 'startDate',
39
+ 'endDate',
40
+ 'purpose',
41
+ 'potentialActions',
42
+ 'amount',
43
+ 'fromLocation',
44
+ 'toLocation',
45
+ 'instrument',
46
+ 'location',
47
+ 'replacer',
48
+ 'targetCollection',
49
+ 'sameAs',
50
+ 'cancelAction'
51
+ ];
28
52
  /**
29
53
  * アクションリポジトリ
30
54
  */
@@ -432,24 +456,33 @@ class ActionRepo {
432
456
  var _a;
433
457
  return __awaiter(this, void 0, void 0, function* () {
434
458
  const conditions = ActionRepo.CREATE_MONGO_CONDITIONS(params);
435
- let projection = {};
459
+ let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
436
460
  if (Array.isArray(inclusion) && inclusion.length > 0) {
437
- inclusion.forEach((field) => {
438
- projection[field] = 1;
439
- });
461
+ positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
440
462
  }
441
463
  else {
442
- projection = {
443
- __v: 0,
444
- createdAt: 0,
445
- updatedAt: 0
446
- };
447
464
  if (Array.isArray(exclusion) && exclusion.length > 0) {
448
- exclusion.forEach((field) => {
449
- projection[field] = 0;
450
- });
465
+ positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
451
466
  }
452
467
  }
468
+ const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
469
+ // let projection: { [key: string]: number } = {};
470
+ // if (Array.isArray(inclusion) && inclusion.length > 0) {
471
+ // inclusion.forEach((field) => {
472
+ // projection[field] = 1;
473
+ // });
474
+ // } else {
475
+ // projection = {
476
+ // __v: 0,
477
+ // createdAt: 0,
478
+ // updatedAt: 0
479
+ // };
480
+ // if (Array.isArray(exclusion) && exclusion.length > 0) {
481
+ // exclusion.forEach((field) => {
482
+ // projection[field] = 0;
483
+ // });
484
+ // }
485
+ // }
453
486
  const query = this.actionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
454
487
  if (typeof params.limit === 'number' && params.limit > 0) {
455
488
  const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
@@ -464,8 +497,8 @@ class ActionRepo {
464
497
  // const explainResult = await (<any>query).explain();
465
498
  // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
466
499
  return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
467
- .exec()
468
- .then((docs) => docs.map((doc) => doc.toObject()));
500
+ .lean() // 2024-08-26~
501
+ .exec();
469
502
  });
470
503
  }
471
504
  /**
@@ -664,33 +697,43 @@ class ActionRepo {
664
697
  }
665
698
  findById(params, inclusion, exclusion) {
666
699
  return __awaiter(this, void 0, void 0, function* () {
667
- let projection = {};
700
+ let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
668
701
  if (Array.isArray(inclusion) && inclusion.length > 0) {
669
- inclusion.forEach((field) => {
670
- projection[field] = 1;
671
- });
702
+ positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
672
703
  }
673
704
  else {
674
- projection = {
675
- __v: 0,
676
- createdAt: 0,
677
- updatedAt: 0
678
- };
679
705
  if (Array.isArray(exclusion) && exclusion.length > 0) {
680
- exclusion.forEach((field) => {
681
- projection[field] = 0;
682
- });
706
+ positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
683
707
  }
684
708
  }
709
+ const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
710
+ // let projection: { [key: string]: number } = {};
711
+ // if (Array.isArray(inclusion) && inclusion.length > 0) {
712
+ // inclusion.forEach((field) => {
713
+ // projection[field] = 1;
714
+ // });
715
+ // } else {
716
+ // projection = {
717
+ // __v: 0,
718
+ // createdAt: 0,
719
+ // updatedAt: 0
720
+ // };
721
+ // if (Array.isArray(exclusion) && exclusion.length > 0) {
722
+ // exclusion.forEach((field) => {
723
+ // projection[field] = 0;
724
+ // });
725
+ // }
726
+ // }
685
727
  const doc = yield this.actionModel.findOne({
686
728
  typeOf: { $eq: params.typeOf },
687
729
  _id: { $eq: params.id }
688
730
  }, projection)
731
+ .lean() // 2024-08-26~
689
732
  .exec();
690
733
  if (doc === null) {
691
734
  throw new factory.errors.NotFound(this.actionModel.modelName);
692
735
  }
693
- return doc.toObject();
736
+ return doc;
694
737
  });
695
738
  }
696
739
  findPayAction(params) {
@@ -731,33 +774,43 @@ class ActionRepo {
731
774
  searchByOrderNumber(params) {
732
775
  var _a;
733
776
  return __awaiter(this, void 0, void 0, function* () {
734
- const conditions = {
777
+ const filter = {
735
778
  $or: [
736
- { 'object.orderNumber': params.orderNumber },
737
- { 'purpose.orderNumber': params.orderNumber }
779
+ { 'object.orderNumber': { $eq: params.orderNumber } },
780
+ { 'purpose.orderNumber': { $eq: params.orderNumber } }
738
781
  ]
739
782
  };
740
- const query = this.actionModel.find(conditions)
741
- .select({ __v: 0, createdAt: 0, updatedAt: 0 });
783
+ const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(AVAILABLE_PROJECT_FIELDS.map((key) => ([key, 1]))));
784
+ const query = this.actionModel.find(filter, projection);
785
+ // .select({ __v: 0, createdAt: 0, updatedAt: 0 });
742
786
  // tslint:disable-next-line:no-single-line-block-comment
743
787
  /* istanbul ignore else */
744
788
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.startDate) !== undefined) {
745
789
  query.sort({ startDate: params.sort.startDate });
746
790
  }
747
- return query.exec()
748
- .then((docs) => docs.map((doc) => doc.toObject()));
791
+ return query
792
+ .lean() // 2024-08-26~
793
+ .exec();
749
794
  });
750
795
  }
751
796
  searchBySameAs(params) {
752
797
  var _a;
753
798
  return __awaiter(this, void 0, void 0, function* () {
799
+ const projection = {
800
+ _id: 0,
801
+ id: { $toString: '$_id' },
802
+ actionStatus: 1,
803
+ error: 1,
804
+ purpose: 1
805
+ };
754
806
  const query = this.actionModel.find(Object.assign({ typeOf: { $eq: params.typeOf.$eq }, 'sameAs.id': { $exists: true, $eq: params.sameAs.id.$eq } }, (typeof ((_a = params.purpose) === null || _a === void 0 ? void 0 : _a.id.$eq) === 'string')
755
807
  ? { 'purpose.id': { $exists: true, $eq: params.purpose.id.$eq } }
756
- : undefined))
757
- .select({ _id: 1, actionStatus: 1, error: 1, purpose: 1 })
808
+ : undefined), projection)
809
+ // .select({ _id: 1, actionStatus: 1, error: 1, purpose: 1 })
758
810
  .limit(1);
759
- return query.exec()
760
- .then((docs) => docs.map((doc) => doc.toObject()));
811
+ return query
812
+ .lean() // 2024-08-26~
813
+ .exec();
761
814
  });
762
815
  }
763
816
  deleteByProject(params) {
@@ -35,8 +35,11 @@ function createAcceptedOffersWithoutDetails(params) {
35
35
  });
36
36
  }
37
37
  exports.createAcceptedOffersWithoutDetails = createAcceptedOffersWithoutDetails;
38
+ /**
39
+ * 受入オファーをCOA販売チケットへ変換する
40
+ */
38
41
  function offer2availableSalesTicket(params) {
39
- // tslint:disable-next-line:max-func-body-length
42
+ // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
40
43
  return (repos) => __awaiter(this, void 0, void 0, function* () {
41
44
  let availableSalesTicket;
42
45
  const offers = params.offers;
@@ -45,6 +48,7 @@ function offer2availableSalesTicket(params) {
45
48
  const availableSalesTickets = params.availableSalesTickets;
46
49
  const coaInfo = params.coaInfo;
47
50
  const isMvtkOrMG = typeof offer.ticketInfo.mvtkNum === 'string' && offer.ticketInfo.mvtkNum.length > 0;
51
+ const couponCode = offer.ticketInfo.couponCode; // 2024-08-27~
48
52
  // ポイント消費鑑賞券の場合
49
53
  if (typeof offer.ticketInfo.usePoint === 'number' && offer.ticketInfo.usePoint > 0) {
50
54
  // COA側のマスタ構成で、
@@ -107,7 +111,36 @@ function offer2availableSalesTicket(params) {
107
111
  }
108
112
  }
109
113
  else {
110
- availableSalesTicket = availableSalesTickets.find((t) => t.ticketCode === offer.ticketInfo.ticketCode);
114
+ if (typeof couponCode === 'string') {
115
+ // クーポンコード指定の場合クーポンチケット検索結果から販売チケットをfix(2024-08-27~)
116
+ try {
117
+ const couponTicketResult = yield repos.reserveService.couponTicket({
118
+ theaterCode: coaInfo.theaterCode,
119
+ couponCode,
120
+ titleCode: coaInfo.titleCode,
121
+ titleBranchNum: coaInfo.titleBranchNum,
122
+ dateJouei: coaInfo.dateJouei,
123
+ timeBegin: coaInfo.timeBegin,
124
+ flgMember: (params.isMember) ? COA.factory.reserve.FlgMember.Member : COA.factory.reserve.FlgMember.NonMember
125
+ });
126
+ availableSalesTicket = couponTicketResult.listTicket.find((t) => t.ticketCode === offer.ticketInfo.ticketCode);
127
+ }
128
+ catch (error) {
129
+ // COAサービスエラーの場合ハンドリング
130
+ if (error.name === 'COAServiceError') {
131
+ // COAはクライアントエラーかサーバーエラーかに関わらずステータスコード200 or 500を返却する。
132
+ // 500未満であればクライアントエラーとみなす
133
+ if (typeof error.code === 'number'
134
+ && error.code < http_status_1.INTERNAL_SERVER_ERROR) {
135
+ throw new factory.errors.NotFound(`offers.${offerIndex}`, `couponTicket ${offer.ticketInfo.ticketCode} not found. ${error.message}`);
136
+ }
137
+ }
138
+ throw error;
139
+ }
140
+ }
141
+ else {
142
+ availableSalesTicket = availableSalesTickets.find((t) => t.ticketCode === offer.ticketInfo.ticketCode);
143
+ }
111
144
  // 利用可能な券種が見つからなければエラー
112
145
  if (availableSalesTicket === undefined) {
113
146
  throw new factory.errors.NotFound(`offers.${offerIndex}`, `ticketCode ${offer.ticketInfo.ticketCode} not found.`);
@@ -243,8 +276,12 @@ flgMember) {
243
276
  offer: offer,
244
277
  offerIndex: offerIndex,
245
278
  availableSalesTickets: availableSalesTickets,
246
- coaInfo: coaInfo
247
- })({ masterService: repos.masterService });
279
+ coaInfo: coaInfo,
280
+ isMember: (flgMember === COA.factory.reserve.FlgMember.Member)
281
+ })({
282
+ masterService: repos.masterService,
283
+ reserveService: repos.reserveService
284
+ });
248
285
  return availableSalesTicket2offerWithDetails({
249
286
  availableSalesTicket,
250
287
  offer,
@@ -127,7 +127,7 @@ function reAcceptOffer(params) {
127
127
  }, ['project', 'agent', 'typeOf']);
128
128
  const coaInfo = yield findCOAInfo({ id: params.object.event.id, project: { id: transaction.project.id } })(repos);
129
129
  // 承認アクション存在検証
130
- yield repos.action.findById({ id: params.potentialActions.id, typeOf: factory.actionType.AuthorizeAction }, ['_id'], []);
130
+ yield repos.action.findById({ id: params.potentialActions.id, typeOf: factory.actionType.AuthorizeAction }, ['id'], []);
131
131
  const actionAttributes = {
132
132
  project: transaction.project,
133
133
  typeOf: factory.actionType.AcceptAction,
@@ -70,7 +70,7 @@ function placeOrder(params) {
70
70
  id: { $in: [orderActionPurpose.id] },
71
71
  typeOf: { $in: [orderActionPurpose.typeOf] }
72
72
  }
73
- }, ['_id'], []);
73
+ }, ['id'], []);
74
74
  if (completedActions.length === 0) {
75
75
  const action = yield repos.action.start(orderActionAttributes);
76
76
  try {
@@ -49,7 +49,7 @@ function voidTransaction(params) {
49
49
  typeOf: { $eq: factory.actionType.AuthorizeAction },
50
50
  object: { paymentMethodId: { $eq: paymentMethodId } },
51
51
  sameAs: { id: { $eq: transaction.id } }
52
- }, ['_id', 'typeOf', 'project'], [])).shift();
52
+ }, ['id', 'typeOf', 'project'], [])).shift();
53
53
  if (authorizeInvoiceAction !== undefined) {
54
54
  const cancelAction = {
55
55
  startTime: new Date(),
@@ -150,7 +150,7 @@ function checkByIdentifierIfNotYet(params) {
150
150
  reservationFor: { id: { $eq: params.screeningEvent.id } } // 指定のイベントにおいて
151
151
  }
152
152
  }
153
- } }, (typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined), ['_id'], [])).shift();
153
+ } }, (typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined), ['id'], [])).shift();
154
154
  debug('alreadyCheckedAction:', JSON.stringify(alreadyCheckedAction), 'placeOrderId:', placeOrderId);
155
155
  if (alreadyCheckedAction !== undefined) {
156
156
  const recipe = yield repos.action.findRecipeByAction({
@@ -61,7 +61,7 @@ function cancelPengindIfNotYet(params) {
61
61
  id: { $in: [params.purpose.id] },
62
62
  typeOf: { $in: [params.purpose.typeOf] }
63
63
  }
64
- }, ['_id'], []);
64
+ }, ['id'], []);
65
65
  if (completedActions.length === 0) {
66
66
  const actionAttributes = (0, factory_1.createCancelPendingReservationAction)({ transaction: reserveTransaction });
67
67
  if (actionAttributes !== undefined) {
@@ -133,7 +133,7 @@ params, options) {
133
133
  id: { $in: [actionAttributes.purpose.id] },
134
134
  typeOf: { $in: [actionAttributes.purpose.typeOf] }
135
135
  }
136
- }, ['_id'], []);
136
+ }, ['id'], []);
137
137
  debug(completedActions.length, 'completed reserveAction found. byTask:', options === null || options === void 0 ? void 0 : options.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
138
138
  if (completedActions.length === 0) {
139
139
  const action = yield repos.action.start(actionAttributes);
package/package.json CHANGED
@@ -9,9 +9,9 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.381.0",
13
- "@cinerino/sdk": "10.7.0",
14
- "@motionpicture/coa-service": "9.4.0",
12
+ "@chevre/factory": "4.382.0-alpha.0",
13
+ "@cinerino/sdk": "10.8.0-alpha.0",
14
+ "@motionpicture/coa-service": "9.5.0-alpha.0",
15
15
  "@motionpicture/gmo-service": "5.3.0",
16
16
  "@sendgrid/mail": "6.4.0",
17
17
  "@surfrock/sdk": "1.3.0",
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "22.2.0-alpha.23"
113
+ "version": "22.2.0-alpha.24"
114
114
  }
@@ -1,40 +0,0 @@
1
- // tslint:disable:no-implicit-dependencies no-console
2
- import { chevre } from '../../../lib/index';
3
-
4
- import * as mongoose from 'mongoose';
5
-
6
- // const project = { id: String(process.env.PROJECT_ID) };
7
-
8
- mongoose.Model.on('index', (...args) => {
9
- console.error('******** index event emitted. ********\n', args);
10
- });
11
-
12
- async function main() {
13
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
14
-
15
- const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
16
- const actions = await actionRepo.search(
17
- {
18
- limit: 1,
19
- // typeOf: { $eq: chevre.factory.actionType.CheckAction },
20
- // project: { id: { $eq: project.id } },
21
- // object: {
22
- // movieTickets: {
23
- // identifier: { $eq: '0947524082' },
24
- // serviceOutput: { reservationFor: { id: { $eq: 'clhvvbpyn' } } }
25
- // }
26
- // }
27
- // instrument: { transactionNumber: { $eq: 'x' } },
28
- sameAs: { id: { $eq: '66275034ae5d4c3e8997808c' } }
29
- },
30
- ['_id'],
31
- []
32
- );
33
- console.log('actions:', actions);
34
- }
35
-
36
- main()
37
- .then(() => {
38
- console.log('success!');
39
- })
40
- .catch(console.error);