@cinerino/sdk 16.4.0-alpha.0 → 16.4.0-alpha.2

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.
@@ -0,0 +1,13 @@
1
+ import { factory } from '../factory';
2
+ import { IOptions, Service } from '../service';
3
+ type IFindParams = Pick<factory.task.ISearchConditions, 'id' | 'name' | 'runsFrom' | 'runsThrough' | 'status' | 'limit' | 'page' | 'sort'>;
4
+ type IKeyOfProjection = keyof factory.task.ITask<factory.taskName>;
5
+ /**
6
+ * 非同期アクションサービス
7
+ */
8
+ export declare class AsyncActionService extends Service<IOptions> {
9
+ findAsyncActions(params: IFindParams & {
10
+ $projection?: Partial<Record<IKeyOfProjection, 1>>;
11
+ }): Promise<factory.task.ITask<factory.taskName>[]>;
12
+ }
13
+ export {};
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsyncActionService = void 0;
4
+ const http_status_1 = require("http-status");
5
+ const service_1 = require("../service");
6
+ /**
7
+ * 非同期アクションサービス
8
+ */
9
+ class AsyncActionService extends service_1.Service {
10
+ async findAsyncActions(params) {
11
+ return this.fetch({
12
+ uri: '/asyncActions',
13
+ method: 'GET',
14
+ qs: params,
15
+ expectedStatusCodes: [http_status_1.status.OK]
16
+ })
17
+ .then(async (response) => response.json());
18
+ }
19
+ }
20
+ exports.AsyncActionService = AsyncActionService;
@@ -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';
@@ -49,6 +48,7 @@ import type { ReservationService } from './chevreConsole/reservation';
49
48
  import type { SellerService } from './chevreConsole/seller';
50
49
  import type { SellerMakesOfferService } from './chevreConsole/sellerMakesOffer';
51
50
  import type { SellerReturnPolicyService } from './chevreConsole/sellerReturnPolicy';
51
+ import type { AsyncActionService } from './chevreConsole/asyncAction';
52
52
  import type { TaskService } from './chevreConsole/task';
53
53
  import type { TicketService } from './chevreConsole/ticket';
54
54
  import type { TokenService } from './chevreConsole/token';
@@ -390,6 +390,13 @@ export declare namespace service {
390
390
  namespace SellerReturnPolicy {
391
391
  let svc: typeof SellerReturnPolicyService | undefined;
392
392
  }
393
+ /**
394
+ * 非同期アクションサービス
395
+ */
396
+ type AsyncAction = AsyncActionService;
397
+ namespace AsyncAction {
398
+ let svc: typeof AsyncActionService | undefined;
399
+ }
393
400
  /**
394
401
  * タスクサービス
395
402
  */
@@ -419,13 +426,6 @@ export declare namespace service {
419
426
  namespace Pay {
420
427
  let svc: typeof PayAssetTransactionService | undefined;
421
428
  }
422
- /**
423
- * 予約取引サービス
424
- */
425
- type Reserve = ReserveAssetTransactionService;
426
- namespace Reserve {
427
- let svc: typeof ReserveAssetTransactionService | undefined;
428
- }
429
429
  }
430
430
  /**
431
431
  * トークンサービス
@@ -528,11 +528,11 @@ export declare class ChevreConsole {
528
528
  createSellerInstance(params: Pick<IOptions, 'project'>): Promise<SellerService>;
529
529
  createSellerMakesOfferInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<SellerMakesOfferService>;
530
530
  createSellerReturnPolicyInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<SellerReturnPolicyService>;
531
+ createAsyncActionInstance(params: Pick<IOptions, 'project'>): Promise<AsyncActionService>;
531
532
  createTaskInstance(params: Pick<IOptions, 'project'>): Promise<TaskService>;
532
533
  createTicketInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<TicketService>;
533
534
  createAssetTransactionInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<AssetTransactionService>;
534
535
  createPayAssetTransactionInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<PayAssetTransactionService>;
535
- createReserveAssetTransactionInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ReserveAssetTransactionService>;
536
536
  createTokenInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<TokenService>;
537
537
  createPlaceOrderTransactionInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<PlaceOrderTransactionService>;
538
538
  createReturnOrderTransactionInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ReturnOrderTransactionService>;
@@ -180,6 +180,9 @@ var service;
180
180
  let SellerReturnPolicy;
181
181
  (function (SellerReturnPolicy) {
182
182
  })(SellerReturnPolicy = service.SellerReturnPolicy || (service.SellerReturnPolicy = {}));
183
+ let AsyncAction;
184
+ (function (AsyncAction) {
185
+ })(AsyncAction = service.AsyncAction || (service.AsyncAction = {}));
183
186
  let Task;
184
187
  (function (Task) {
185
188
  })(Task = service.Task || (service.Task = {}));
@@ -194,9 +197,6 @@ var service;
194
197
  let Pay;
195
198
  (function (Pay) {
196
199
  })(Pay = assetTransaction.Pay || (assetTransaction.Pay = {}));
197
- let Reserve;
198
- (function (Reserve) {
199
- })(Reserve = assetTransaction.Reserve || (assetTransaction.Reserve = {}));
200
200
  })(assetTransaction = service.assetTransaction || (service.assetTransaction = {}));
201
201
  let Token;
202
202
  (function (Token) {
@@ -513,6 +513,12 @@ class ChevreConsole {
513
513
  }
514
514
  return new service.SellerReturnPolicy.svc({ ...this.options, ...params, retryableStatusCodes: [] });
515
515
  }
516
+ async createAsyncActionInstance(params) {
517
+ if (service.AsyncAction.svc === undefined) {
518
+ service.AsyncAction.svc = (await Promise.resolve().then(() => __importStar(require('./chevreConsole/asyncAction')))).AsyncActionService;
519
+ }
520
+ return new service.AsyncAction.svc({ ...this.options, ...params, retryableStatusCodes: [] });
521
+ }
516
522
  async createTaskInstance(params) {
517
523
  if (service.Task.svc === undefined) {
518
524
  service.Task.svc = (await Promise.resolve().then(() => __importStar(require('./chevreConsole/task.js')))).TaskService;
@@ -537,12 +543,6 @@ class ChevreConsole {
537
543
  }
538
544
  return new service.assetTransaction.Pay.svc({ ...this.options, ...params, retryableStatusCodes: [] });
539
545
  }
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
546
  async createTokenInstance(params) {
547
547
  if (service.Token.svc === undefined) {
548
548
  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());
@@ -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') {