@chevre/domain 21.33.0-alpha.13 → 21.33.0-alpha.15

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.
@@ -67,6 +67,7 @@ async function main() {
67
67
  }
68
68
  })({
69
69
  action: await chevre.repository.Action.createInstance(mongoose.connection),
70
+ actionRecipe: await chevre.repository.ActionRecipe.createInstance(mongoose.connection),
70
71
  assetTransaction: await chevre.repository.AssetTransaction.createInstance(mongoose.connection),
71
72
  paymentAccepted: await chevre.repository.SellerPaymentAccepted.createInstance(mongoose.connection),
72
73
  paymentService: await chevre.repository.PaymentService.createInstance(mongoose.connection),
@@ -0,0 +1,10 @@
1
+ import { Connection } from 'mongoose';
2
+ import * as factory from '../factory';
3
+ /**
4
+ * アクションレシピリポジトリ
5
+ */
6
+ export declare class ActionRecipeRepo {
7
+ private readonly actionRecipeModel;
8
+ constructor(connection: Connection);
9
+ saveOne(savingRecipe: factory.recipe.IRecipe): Promise<import("mongodb").InsertManyResult<any>>;
10
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ActionRecipeRepo = void 0;
13
+ const actionRecipe_1 = require("./mongoose/schemas/actionRecipe");
14
+ /**
15
+ * アクションレシピリポジトリ
16
+ */
17
+ class ActionRecipeRepo {
18
+ constructor(connection) {
19
+ this.actionRecipeModel = connection.model(actionRecipe_1.modelName, (0, actionRecipe_1.createSchema)());
20
+ }
21
+ saveOne(savingRecipe) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ return this.actionRecipeModel.insertMany(savingRecipe, { rawResult: true });
24
+ // const result = await this.actionRecipeModel.insertMany<IRecipe>(savingRecipe, { rawResult: true });
25
+ // const id = result.insertedIds?.[0]?.toHexString();
26
+ // if (typeof id !== 'string') {
27
+ // throw new factory.errors.ServiceUnavailable('recipe not saved');
28
+ // }
29
+ // return { id };
30
+ });
31
+ }
32
+ }
33
+ exports.ActionRecipeRepo = ActionRecipeRepo;
@@ -0,0 +1,5 @@
1
+ import { IndexDefinition, IndexOptions, Schema } from 'mongoose';
2
+ declare const modelName = "ActionRecipe";
3
+ declare const indexes: [d: IndexDefinition, o: IndexOptions][];
4
+ declare function createSchema(): Schema;
5
+ export { modelName, indexes, createSchema };
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSchema = exports.indexes = exports.modelName = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
7
+ const modelName = 'ActionRecipe';
8
+ exports.modelName = modelName;
9
+ const schemaDefinition = {
10
+ project: {
11
+ type: mongoose_1.SchemaTypes.Mixed,
12
+ required: true
13
+ },
14
+ typeOf: {
15
+ type: String,
16
+ required: true
17
+ },
18
+ recipeCategory: {
19
+ type: String,
20
+ required: true
21
+ },
22
+ step: {
23
+ type: [mongoose_1.SchemaTypes.Mixed],
24
+ required: true
25
+ },
26
+ recipeFor: {
27
+ type: mongoose_1.SchemaTypes.Mixed,
28
+ required: true
29
+ }
30
+ };
31
+ const schemaOptions = {
32
+ autoIndex: settings_1.MONGO_AUTO_INDEX,
33
+ autoCreate: false,
34
+ collection: 'actionRecipes',
35
+ id: true,
36
+ read: 'primary',
37
+ writeConcern: writeConcern_1.writeConcern,
38
+ strict: true,
39
+ strictQuery: false,
40
+ timestamps: false,
41
+ versionKey: false,
42
+ toJSON: {
43
+ getters: false,
44
+ virtuals: false,
45
+ minimize: false,
46
+ versionKey: false
47
+ },
48
+ toObject: {
49
+ getters: false,
50
+ virtuals: true,
51
+ minimize: false,
52
+ versionKey: false
53
+ }
54
+ };
55
+ const indexes = [
56
+ [
57
+ { 'recipeFor.id': 1 },
58
+ { name: 'searchByRecipeForId' }
59
+ ]
60
+ ];
61
+ exports.indexes = indexes;
62
+ /**
63
+ * アクションレシピスキーマ
64
+ */
65
+ let schema;
66
+ function createSchema() {
67
+ if (schema === undefined) {
68
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
69
+ }
70
+ if (settings_1.MONGO_AUTO_INDEX) {
71
+ indexes.forEach((indexParams) => {
72
+ schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
73
+ });
74
+ }
75
+ return schema;
76
+ }
77
+ exports.createSchema = createSchema;
@@ -7,6 +7,7 @@ import type { MongoRepository as AccountingReportRepo } from './repo/accountingR
7
7
  import type { MongoRepository as AccountTitleRepo } from './repo/accountTitle';
8
8
  import type { MongoRepository as AccountTransactionRepo } from './repo/accountTransaction';
9
9
  import type { MongoRepository as ActionRepo } from './repo/action';
10
+ import type { ActionRecipeRepo } from './repo/actionRecipe';
10
11
  import type { MongoRepository as AdditionalPropertyRepo } from './repo/additionalProperty';
11
12
  import type { MongoRepository as AggregateOfferRepo } from './repo/aggregateOffer';
12
13
  import type { MongoRepository as AggregateReservationRepo } from './repo/aggregateReservation';
@@ -89,6 +90,10 @@ export type Action = ActionRepo;
89
90
  export declare namespace Action {
90
91
  function createInstance(...params: ConstructorParameters<typeof ActionRepo>): Promise<ActionRepo>;
91
92
  }
93
+ export type ActionRecipe = ActionRecipeRepo;
94
+ export declare namespace ActionRecipe {
95
+ function createInstance(...params: ConstructorParameters<typeof ActionRecipeRepo>): Promise<ActionRecipeRepo>;
96
+ }
92
97
  export type AdditionalProperty = AdditionalPropertyRepo;
93
98
  export declare namespace AdditionalProperty {
94
99
  function createInstance(...params: ConstructorParameters<typeof AdditionalPropertyRepo>): Promise<AdditionalPropertyRepo>;
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.SellerPaymentAccepted = exports.Seller = exports.Role = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.Product = exports.PriceSpecification = exports.place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.PaymentService = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.Note = exports.Message = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOffer = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
13
- exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = void 0;
12
+ exports.ServiceOutput = exports.SellerPaymentAccepted = exports.Seller = exports.Role = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.Product = exports.PriceSpecification = exports.place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.PaymentService = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.Note = exports.Message = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOffer = exports.AdditionalProperty = exports.ActionRecipe = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
13
+ exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = void 0;
14
14
  var AcceptedOffer;
15
15
  (function (AcceptedOffer) {
16
16
  let repo;
@@ -89,6 +89,19 @@ var Action;
89
89
  }
90
90
  Action.createInstance = createInstance;
91
91
  })(Action = exports.Action || (exports.Action = {}));
92
+ var ActionRecipe;
93
+ (function (ActionRecipe) {
94
+ let repo;
95
+ function createInstance(...params) {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ if (repo === undefined) {
98
+ repo = (yield Promise.resolve().then(() => require('./repo/actionRecipe'))).ActionRecipeRepo;
99
+ }
100
+ return new repo(...params);
101
+ });
102
+ }
103
+ ActionRecipe.createInstance = createInstance;
104
+ })(ActionRecipe = exports.ActionRecipe || (exports.ActionRecipe = {}));
92
105
  var AdditionalProperty;
93
106
  (function (AdditionalProperty) {
94
107
  let repo;
@@ -6,6 +6,7 @@ import * as factory from '../../factory';
6
6
  import type { MongoRepository as AcceptedOfferRepo } from '../../repo/acceptedOffer';
7
7
  import type { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
8
8
  import type { MongoRepository as ActionRepo } from '../../repo/action';
9
+ import { ActionRecipeRepo } from '../../repo/actionRecipe';
9
10
  import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
10
11
  import type { MongoRepository as EventRepo } from '../../repo/event';
11
12
  import type { MongoRepository as OrderRepo } from '../../repo/order';
@@ -56,6 +57,7 @@ export type ICheckOperation<T> = (repos: {
56
57
  }) => Promise<T>;
57
58
  export type IPublishPaymentUrlOperation<T> = (repos: {
58
59
  action: ActionRepo;
60
+ actionRecipe: ActionRecipeRepo;
59
61
  paymentAccepted: PaymentAcceptedRepo;
60
62
  paymentService: PaymentServiceRepo;
61
63
  paymentServiceProvider: PaymentServiceProviderRepo;
@@ -19,11 +19,46 @@ const PaymentCardPayment = require("../payment/paymentCard");
19
19
  const validation_1 = require("./pay/account/validation");
20
20
  const factory_1 = require("./pay/factory");
21
21
  const debug = createDebug('chevre-domain:service:assetTransaction');
22
+ function publishPaymentUrlResult2recipe(params) {
23
+ const { project, action, result } = params;
24
+ return {
25
+ project: { id: project.id, typeOf: factory.organizationType.Project },
26
+ typeOf: 'Recipe',
27
+ recipeCategory: factory.recipe.RecipeCategory.publishPaymentUrl,
28
+ recipeFor: { id: action.id, typeOf: action.typeOf },
29
+ step: [{
30
+ typeOf: 'HowToSection',
31
+ itemListElement: [
32
+ {
33
+ typeOf: 'HowToStep',
34
+ identifier: factory.recipe.StepIdentifier.entryTran,
35
+ itemListElement: [{
36
+ typeOf: 'HowToDirection',
37
+ beforeMedia: result.entryTranArgs,
38
+ afterMedia: result.entryTranResult
39
+ // text: 'entryTran'
40
+ }]
41
+ },
42
+ {
43
+ typeOf: 'HowToStep',
44
+ identifier: factory.recipe.StepIdentifier.execTran,
45
+ itemListElement: [{
46
+ typeOf: 'HowToDirection',
47
+ beforeMedia: result.execTranArgs,
48
+ afterMedia: result.execTranResult
49
+ // text: 'execTran'
50
+ }]
51
+ }
52
+ ]
53
+ }]
54
+ };
55
+ }
22
56
  /**
23
57
  * 外部決済ロケーション発行
24
58
  */
25
59
  // tslint:disable-next-line:max-func-body-length
26
60
  function publishPaymentUrl(params, options) {
61
+ // tslint:disable-next-line:max-func-body-length
27
62
  return (repos) => __awaiter(this, void 0, void 0, function* () {
28
63
  var _a, _b, _c, _d, _e;
29
64
  const paymentServiceType = (_a = params.object) === null || _a === void 0 ? void 0 : _a.typeOf;
@@ -77,6 +112,13 @@ function publishPaymentUrl(params, options) {
77
112
  execTranArgs: authorizeResult.execTranArgs,
78
113
  execTranResult: authorizeResult.execTranResult
79
114
  };
115
+ // create recipe(2024-06-02~)
116
+ const saveRecipeResult = yield repos.actionRecipe.saveOne(publishPaymentUrlResult2recipe({
117
+ project: { id: params.project.id },
118
+ action: { id: action.id, typeOf: action.typeOf },
119
+ result
120
+ }));
121
+ debug('publishPaymentUrl: recipe saved.', saveRecipeResult);
80
122
  break;
81
123
  default:
82
124
  throw new factory.errors.NotImplemented(`Payment service '${paymentServiceType}' not implemented`);
@@ -1,6 +1,7 @@
1
1
  import * as factory from '../../factory';
2
2
  import type { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
3
3
  import type { MongoRepository as ActionRepo } from '../../repo/action';
4
+ import type { ActionRecipeRepo } from '../../repo/actionRecipe';
4
5
  import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
5
6
  import type { AuthorizationRepo } from '../../repo/code';
6
7
  import type { ConfirmationNumberRepo } from '../../repo/confirmationNumber';
@@ -72,6 +73,7 @@ interface IAuthorizeRepos {
72
73
  type IAuthorizeOperation<T> = (repos: IAuthorizeRepos) => Promise<T>;
73
74
  interface IPublishPaymentUrlRepos {
74
75
  action: ActionRepo;
76
+ actionRecipe: ActionRecipeRepo;
75
77
  assetTransaction: AssetTransactionRepo;
76
78
  paymentAccepted: PaymentAcceptedRepo;
77
79
  paymentService: PaymentServiceRepo;
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.call = void 0;
13
13
  const factory = require("../../factory");
14
14
  const action_1 = require("../../repo/action");
15
+ const actionRecipe_1 = require("../../repo/actionRecipe");
15
16
  const assetTransaction_1 = require("../../repo/assetTransaction");
16
17
  const paymentService_1 = require("../../repo/paymentService");
17
18
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
@@ -37,6 +38,7 @@ function call(params) {
37
38
  try {
38
39
  yield (0, any_1.publishPaymentUrl)(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id } }))({
39
40
  action: actionRepo,
41
+ actionRecipe: new actionRecipe_1.ActionRecipeRepo(settings.connection),
40
42
  assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
41
43
  paymentAccepted: new sellerPaymentAccepted_1.MongoRepository(settings.connection),
42
44
  paymentService: new paymentService_1.MongoRepository(settings.connection),
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.373.0",
13
+ "@chevre/factory": "4.374.0-alpha.0",
14
14
  "@cinerino/sdk": "7.0.0-alpha.12",
15
15
  "@motionpicture/coa-service": "9.4.0",
16
16
  "@motionpicture/gmo-service": "5.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": "21.33.0-alpha.13"
113
+ "version": "21.33.0-alpha.15"
114
114
  }