@cinerino/sdk 16.3.0 → 16.4.0-alpha.1

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.
@@ -1,8 +1,7 @@
1
1
  import { factory } from '../factory';
2
2
  import { Service } from '../service';
3
- export interface IProjection {
4
- $projection?: Record<string, 1>;
5
- }
3
+ export type IFindParams = Pick<factory.customer.ISearchConditions, 'additionalProperty' | 'branchCode' | 'id' | 'limit' | 'name' | 'page' | 'sort'>;
4
+ export type ICustomerAsFindResult = Pick<factory.customer.ICustomer, 'additionalProperty' | 'branchCode' | 'id' | 'name' | 'typeOf' | 'url'>;
6
5
  /**
7
6
  * 顧客サービス
8
7
  */
@@ -10,5 +9,5 @@ export declare class CustomerService extends Service {
10
9
  /**
11
10
  * 顧客検索
12
11
  */
13
- search(params: Omit<factory.customer.ISearchConditions, 'project'> & IProjection): Promise<factory.customer.ICustomer[]>;
12
+ findCustomers(params: IFindParams): Promise<ICustomerAsFindResult[]>;
14
13
  }
@@ -10,7 +10,7 @@ class CustomerService extends service_1.Service {
10
10
  /**
11
11
  * 顧客検索
12
12
  */
13
- async search(params) {
13
+ async findCustomers(params) {
14
14
  return this.fetch({
15
15
  uri: '/customers',
16
16
  method: 'GET',
@@ -1,8 +1,6 @@
1
1
  import { factory } from '../factory';
2
2
  import { IUnset, Service } from '../service';
3
- export interface IProjection {
4
- $projection?: Record<string, 1>;
5
- }
3
+ type IAddParams = Pick<factory.customer.ICustomer, 'additionalProperty' | 'branchCode' | 'name' | 'url'>;
6
4
  /**
7
5
  * 顧客サービス
8
6
  */
@@ -10,20 +8,21 @@ export declare class CustomerService extends Service {
10
8
  /**
11
9
  * 顧客作成
12
10
  */
13
- create(params: factory.customer.ICustomer): Promise<{
11
+ addCustomer(params: IAddParams): Promise<{
14
12
  id: string;
15
13
  }>;
16
14
  /**
17
15
  * 顧客編集
18
16
  */
19
- update(params: {
17
+ updateCustomerById(params: {
20
18
  id: string;
21
- attributes: factory.customer.ICustomer & IUnset;
19
+ attributes: IAddParams & IUnset;
22
20
  }): Promise<void>;
23
21
  /**
24
22
  * 顧客削除
25
23
  */
26
- deleteById(params: {
24
+ deleteCustomerById(params: {
27
25
  id: string;
28
26
  }): Promise<void>;
29
27
  }
28
+ export {};
@@ -10,7 +10,7 @@ class CustomerService extends service_1.Service {
10
10
  /**
11
11
  * 顧客作成
12
12
  */
13
- async create(params) {
13
+ async addCustomer(params) {
14
14
  return this.fetch({
15
15
  uri: '/customers',
16
16
  method: 'POST',
@@ -22,7 +22,7 @@ class CustomerService extends service_1.Service {
22
22
  /**
23
23
  * 顧客編集
24
24
  */
25
- async update(params) {
25
+ async updateCustomerById(params) {
26
26
  await this.fetch({
27
27
  uri: `/customers/${params.id}`,
28
28
  method: 'PUT',
@@ -33,7 +33,7 @@ class CustomerService extends service_1.Service {
33
33
  /**
34
34
  * 顧客削除
35
35
  */
36
- async deleteById(params) {
36
+ async deleteCustomerById(params) {
37
37
  await this.fetch({
38
38
  uri: `/customers/${params.id}`,
39
39
  method: 'DELETE',
@@ -8,7 +8,6 @@ import type { AggregateReservationService } from './chevreConsole/aggregateReser
8
8
  import type { AggregationService } from './chevreConsole/aggregation';
9
9
  import type { AssetTransactionService } from './chevreConsole/assetTransaction';
10
10
  import type { PayAssetTransactionService } from './chevreConsole/assetTransaction/pay';
11
- import type { ReserveAssetTransactionService } from './chevreConsole/assetTransaction/reserve';
12
11
  import type { AuthorizationService } from './chevreConsole/authorization';
13
12
  import type { CategoryCodeService } from './chevreConsole/categoryCode';
14
13
  import type { CreativeWorkService } from './chevreConsole/creativeWork';
@@ -419,13 +418,6 @@ export declare namespace service {
419
418
  namespace Pay {
420
419
  let svc: typeof PayAssetTransactionService | undefined;
421
420
  }
422
- /**
423
- * 予約取引サービス
424
- */
425
- type Reserve = ReserveAssetTransactionService;
426
- namespace Reserve {
427
- let svc: typeof ReserveAssetTransactionService | undefined;
428
- }
429
421
  }
430
422
  /**
431
423
  * トークンサービス
@@ -532,7 +524,6 @@ export declare class ChevreConsole {
532
524
  createTicketInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<TicketService>;
533
525
  createAssetTransactionInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<AssetTransactionService>;
534
526
  createPayAssetTransactionInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<PayAssetTransactionService>;
535
- createReserveAssetTransactionInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ReserveAssetTransactionService>;
536
527
  createTokenInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<TokenService>;
537
528
  createPlaceOrderTransactionInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<PlaceOrderTransactionService>;
538
529
  createReturnOrderTransactionInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ReturnOrderTransactionService>;
@@ -194,9 +194,6 @@ var service;
194
194
  let Pay;
195
195
  (function (Pay) {
196
196
  })(Pay = assetTransaction.Pay || (assetTransaction.Pay = {}));
197
- let Reserve;
198
- (function (Reserve) {
199
- })(Reserve = assetTransaction.Reserve || (assetTransaction.Reserve = {}));
200
197
  })(assetTransaction = service.assetTransaction || (service.assetTransaction = {}));
201
198
  let Token;
202
199
  (function (Token) {
@@ -537,12 +534,6 @@ class ChevreConsole {
537
534
  }
538
535
  return new service.assetTransaction.Pay.svc({ ...this.options, ...params, retryableStatusCodes: [] });
539
536
  }
540
- async createReserveAssetTransactionInstance(params) {
541
- if (service.assetTransaction.Reserve.svc === undefined) {
542
- service.assetTransaction.Reserve.svc = (await Promise.resolve().then(() => __importStar(require('./chevreConsole/assetTransaction/reserve.js')))).ReserveAssetTransactionService;
543
- }
544
- return new service.assetTransaction.Reserve.svc({ ...this.options, ...params, retryableStatusCodes: [] });
545
- }
546
537
  async createTokenInstance(params) {
547
538
  if (service.Token.svc === undefined) {
548
539
  service.Token.svc = (await Promise.resolve().then(() => __importStar(require('./chevreConsole/token.js')))).TokenService;
@@ -35,6 +35,8 @@ export declare class OfferService extends Service {
35
35
  */
36
36
  id?: string;
37
37
  };
38
+ }, options?: {
39
+ useAsyncAction: '1' | '0';
38
40
  }): Promise<{
39
41
  /**
40
42
  * task id
@@ -8,8 +8,9 @@ const service_1 = require("../service");
8
8
  * COAオファーサービス
9
9
  */
10
10
  class OfferService extends service_1.Service {
11
- async acceptOffer(params) {
11
+ async acceptOffer(params, options) {
12
12
  const { object, purpose, potentialActions } = params;
13
+ const useAsyncAction = options?.useAsyncAction;
13
14
  return this.fetch({
14
15
  uri: `/offers/${factory_1.factory.product.ProductType.EventService}ByCOA/accept`,
15
16
  method: 'POST',
@@ -20,7 +21,8 @@ class OfferService extends service_1.Service {
20
21
  ...(typeof potentialActions?.id === 'string') ? { potentialActions } : undefined
21
22
  },
22
23
  qs: {
23
- purpose: { id: purpose.id }
24
+ purpose: { id: purpose.id },
25
+ ...((typeof useAsyncAction === 'string') && { useAsyncAction })
24
26
  }
25
27
  })
26
28
  .then(async (response) => response.json());
@@ -1,5 +1,5 @@
1
- import { factory } from '../../factory';
2
1
  import { Service } from '../../service';
2
+ import type { IFindParams, ICustomerAsFindResult } from '../../chevreAdmin/customer';
3
3
  /**
4
4
  * 顧客サービス
5
5
  */
@@ -7,5 +7,5 @@ export declare class CustomerService extends Service {
7
7
  /**
8
8
  * 顧客検索
9
9
  */
10
- search(params: Omit<factory.customer.ISearchConditions, 'project'>): Promise<factory.customer.ICustomer[]>;
10
+ search(params: IFindParams): Promise<ICustomerAsFindResult[]>;
11
11
  }
@@ -7,41 +7,17 @@ const service_1 = require("../../service");
7
7
  * 顧客サービス
8
8
  */
9
9
  class CustomerService extends service_1.Service {
10
- // public async findById(params: {
11
- // id: string;
12
- // }): Promise<factory.customer.ICustomer> {
13
- // // return this.fetch({
14
- // // uri: `/customers/${params.id}`,
15
- // // method: 'GET',
16
- // // expectedStatusCodes: [status.OK]
17
- // // })
18
- // // .then(async (response) => response.json());
19
- // const { auth, endpoint, project, seller } = this.options;
20
- // const chevreAdmin = await loadChevreAdmin({ auth, endpoint });
21
- // const customerService = await chevreAdmin.createCustomerInstance({
22
- // project,
23
- // seller: { id: (typeof seller?.id === 'string') ? seller.id : '' }
24
- // });
25
- // return customerService.findById({ id: params.id });
26
- // }
27
10
  /**
28
11
  * 顧客検索
29
12
  */
30
13
  async search(params) {
31
- // return this.fetch({
32
- // uri: '/customers',
33
- // method: 'GET',
34
- // qs: params,
35
- // expectedStatusCodes: [status.OK]
36
- // })
37
- // .then(async (response) => response.json());
38
14
  const { auth, endpoint, project, seller } = this.options;
39
15
  const chevreAdmin = await (0, index_1.loadChevreAdmin)({ auth, endpoint });
40
16
  const customerService = await chevreAdmin.createCustomerInstance({
41
17
  project,
42
18
  seller: { id: (typeof seller?.id === 'string') ? seller.id : '' }
43
19
  });
44
- return customerService.search(params);
20
+ return customerService.findCustomers(params);
45
21
  }
46
22
  }
47
23
  exports.CustomerService = CustomerService;
@@ -41,6 +41,8 @@ declare function authorizeOfferAsync(params: {
41
41
  */
42
42
  id?: string;
43
43
  };
44
+ }, options?: {
45
+ useAsyncAction: '1' | '0';
44
46
  }): (repos: {
45
47
  offerService: service.Offer;
46
48
  }) => Promise<IAuthorizeOfferAsyncResult>;
@@ -43,7 +43,7 @@ function authorizeActionError2responseError(authorizeActionError) {
43
43
  }
44
44
  return error;
45
45
  }
46
- function authorizeOfferAsync(params) {
46
+ function authorizeOfferAsync(params, options) {
47
47
  return async (repos) => {
48
48
  const acceptTask = await repos.offerService.acceptOffer({
49
49
  object: {
@@ -55,7 +55,7 @@ function authorizeOfferAsync(params) {
55
55
  ...(typeof params.potentialActions?.id === 'string')
56
56
  ? { potentialActions: { id: params.potentialActions.id } }
57
57
  : undefined
58
- });
58
+ }, options);
59
59
  let alreadyGivenUp = false;
60
60
  setTimeout(() => { alreadyGivenUp = true; }, ASYNC_ACTION_GIVEUP_MS);
61
61
  let result;
@@ -38,6 +38,8 @@ export declare class PlaceOrderCOAService extends Service {
38
38
  appliesToSurfrock?: IAppliesToSurfrock;
39
39
  };
40
40
  purpose: factory.action.authorize.offer.eventService.IPurpose;
41
+ }, options?: {
42
+ useAsyncAction: '1' | '0';
41
43
  }): Promise<IAuthorizeCOAEventServiceResult>;
42
44
  /**
43
45
  * COA興行オファー承認取消
@@ -75,6 +77,8 @@ export declare class PlaceOrderCOAService extends Service {
75
77
  appliesToSurfrock?: IAppliesToSurfrock;
76
78
  };
77
79
  purpose: factory.action.authorize.offer.eventService.IPurpose;
80
+ }, options?: {
81
+ useAsyncAction: '1' | '0';
78
82
  }): Promise<IAuthorizeCOAEventServiceResult>;
79
83
  }
80
84
  export {};
@@ -12,20 +12,7 @@ class PlaceOrderCOAService extends service_1.Service {
12
12
  /**
13
13
  * COA興行オファー承認
14
14
  */
15
- async createSeatReservationAuthorization(params) {
16
- // return this.fetch({
17
- // uri: `/transactions/${this.typeOf}/${params.purpose.id}/actions/authorize/seatReservation`,
18
- // method: 'POST',
19
- // expectedStatusCodes: [status.CREATED],
20
- // body: {
21
- // eventIdentifier: params.object.event.id,
22
- // offers: params.object.acceptedOffer,
23
- // ...(typeof params.object.appliesToSurfrock?.serviceOutput?.typeOf === 'string')
24
- // ? { appliesToSurfrock: params.object.appliesToSurfrock }
25
- // : undefined
26
- // }
27
- // })
28
- // .then(async (response) => response.json());
15
+ async createSeatReservationAuthorization(params, options) {
29
16
  const { object, purpose } = params;
30
17
  const { event, acceptedOffer, appliesToSurfrock } = object;
31
18
  const appliesToSurfrockIdentifier = (typeof appliesToSurfrock?.identifier === 'string' && appliesToSurfrock.identifier.length > 0)
@@ -56,7 +43,7 @@ class PlaceOrderCOAService extends service_1.Service {
56
43
  // potentialActions?: {
57
44
  // id?: string;
58
45
  // };
59
- })({
46
+ }, options)({
60
47
  offerService
61
48
  });
62
49
  if (typeof action.result?.price !== 'number') {
@@ -103,20 +90,7 @@ class PlaceOrderCOAService extends service_1.Service {
103
90
  * COA興行オファー承認変更
104
91
  * 完了ステータスの承認アクションに対して券種変更する際に使用
105
92
  */
106
- async changeSeatReservationOffers(params) {
107
- // return this.fetch({
108
- // uri: `/transactions/${this.typeOf}/${params.purpose.id}/actions/authorize/seatReservation/${params.id}`,
109
- // method: 'PATCH',
110
- // expectedStatusCodes: [status.OK],
111
- // body: {
112
- // eventIdentifier: params.object.event.id,
113
- // offers: params.object.acceptedOffer,
114
- // ...(typeof params.object.appliesToSurfrock?.serviceOutput?.typeOf === 'string')
115
- // ? { appliesToSurfrock: params.object.appliesToSurfrock }
116
- // : undefined
117
- // }
118
- // })
119
- // .then(async (response) => response.json());
93
+ async changeSeatReservationOffers(params, options) {
120
94
  const { id, object, purpose } = params;
121
95
  const { event, acceptedOffer, appliesToSurfrock } = object;
122
96
  const appliesToSurfrockIdentifier = (typeof appliesToSurfrock?.identifier === 'string' && appliesToSurfrock.identifier.length > 0)
@@ -145,7 +119,7 @@ class PlaceOrderCOAService extends service_1.Service {
145
119
  serviceOutput: { typeOf: appliesToSurfrockServiceOutputTypeOf }
146
120
  },
147
121
  potentialActions: { id }
148
- })({
122
+ }, options)({
149
123
  offerService
150
124
  });
151
125
  if (typeof action.result?.price !== 'number') {