@chevre/domain
Version:
Chevre Domain Library for Node.js
104 lines (103 loc) • 3.65 kB
TypeScript
import * as factory from '../../factory';
import type { AccountRepo } from '../../repo/account';
import type { ActionRepo } from '../../repo/action';
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
import type { OfferRepo } from '../../repo/offer/unitPriceInCatalog';
import type { OfferCatalogRepo } from '../../repo/offerCatalog';
import type { OrderInTransactionRepo } from '../../repo/orderInTransaction';
import type { OrderNumberRepo } from '../../repo/orderNumber';
import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
import type { ProductRepo } from '../../repo/product';
import type { ProductOfferRepo } from '../../repo/productOffer';
import type { ProjectRepo } from '../../repo/project';
import type { ServiceOutputRepo } from '../../repo/serviceOutput';
import type { ServiceOutputIdentifierRepo } from '../../repo/serviceOutputIdentifier';
import type { TransactionRepo } from '../../repo/transaction';
import type { TransactionNumberRepo } from '../../repo/transactionNumber';
export interface IAuthorizeOperationRepos {
account: AccountRepo;
action: ActionRepo;
assetTransaction: AssetTransactionRepo;
offer: OfferRepo;
offerCatalog: OfferCatalogRepo;
orderInTransaction: OrderInTransactionRepo;
orderNumber: OrderNumberRepo;
ownershipInfo: OwnershipInfoRepo;
product: ProductRepo;
productOffer: ProductOfferRepo;
project: ProjectRepo;
serviceOutput: ServiceOutputRepo;
serviceOutputIdentifier: ServiceOutputIdentifierRepo;
transaction: TransactionRepo;
transactionNumber: TransactionNumberRepo;
}
export type IAuthorizeOperation<T> = (repos: IAuthorizeOperationRepos) => Promise<T>;
export declare const ERROR_MESSAGE_ALREADY_REGISTERED = "Already registered";
/**
* プロダクトオファーを検索する
*/
export declare function search(params: {
/**
* 指定したIDのオファーだけ取得する場合
*/
ids?: string[];
project: {
id: string;
};
itemOffered: {
id: string;
};
seller?: {
id: string;
};
availableAt?: {
id: string;
};
onlyValid: boolean;
includedInDataCatalog: {
id: string;
};
limit?: number;
page?: number;
addSortIndex: boolean;
useIncludeInDataCatalog: boolean;
}): (repos: {
offer: OfferRepo;
offerCatalog: OfferCatalogRepo;
product: ProductRepo;
productOffer: ProductOfferRepo;
}) => Promise<{
offers: factory.product.ITicketOffer[];
product: Pick<factory.product.IProduct, "id" | "productID" | "typeOf" | "name" | "project" | "serviceOutput" | "serviceType" | "description">;
}>;
export type IAuthorizeOfferAction = factory.action.authorize.offer.product.IAction;
/**
* サービス(Chevreプロダクト)オファー承認
*/
export declare function authorize(params: {
project: {
id: string;
typeOf: factory.organizationType.Project;
};
object: factory.action.authorize.offer.product.IObject;
agent: {
id: string;
typeOf: factory.personType.Person | factory.creativeWorkType.WebApplication;
};
/**
* 利用アプリケーション
*/
location?: {
id?: string;
};
transaction: {
id: string;
};
}): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id'> & {
result: IAuthorizeOfferAction['result'];
}>;
export declare function voidTransaction(params: factory.task.IData<factory.taskName.VoidRegisterServiceTransaction>): (repos: {
action: ActionRepo;
assetTransaction: AssetTransactionRepo;
transaction: TransactionRepo;
}) => Promise<void>;