@cinerino/sdk 5.9.0-alpha.3 → 5.10.0-alpha.0

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,28 @@
1
+ // tslint:disable:no-implicit-dependencies no-console no-magic-numbers
2
+ import { loadAdmin } from '../../lib/';
3
+ import * as auth from './auth/authAsAdmin';
4
+
5
+ async function main() {
6
+ const authClient = await auth.login();
7
+ await authClient.refreshAccessToken();
8
+ const loginTicket = authClient.verifyIdToken({});
9
+ console.log('username is', loginTicket.getUsername());
10
+
11
+ const meService = await (await loadAdmin({
12
+ endpoint: <string>process.env.API_ENDPOINT,
13
+ auth: authClient
14
+ })).createMeInstance();
15
+
16
+ const projects = await meService.searchProjects({
17
+ limit: 10,
18
+ page: 1
19
+ });
20
+ console.log(projects);
21
+ console.log(projects.length, 'projects found');
22
+ }
23
+
24
+ main()
25
+ .then(() => {
26
+ console.log('main processed.');
27
+ })
28
+ .catch(console.error);
@@ -77,7 +77,7 @@ async function main() {
77
77
  console.log('profile found');
78
78
 
79
79
  // 販売劇場検索
80
- const searchSellersResult = await sellerService.search({});
80
+ const searchSellersResult = await sellerService.search({ branchCode: { $eq: '001' } });
81
81
  // tslint:disable-next-line:insecure-random
82
82
  const seller = searchSellersResult.data[Math.floor(searchSellersResult.data.length * Math.random())];
83
83
  if (seller === undefined) {
@@ -325,10 +325,6 @@ async function main() {
325
325
  // console.log('取引を中止しました。');
326
326
 
327
327
  console.log('confirming transaction...');
328
- // const confirmResult = await placeOrderService.confirm({
329
- // id: transaction.id,
330
- // sendEmailMessage: true
331
- // });
332
328
  const confirmResult = await placeOrderService.confirmWithMiminalResponse({
333
329
  id: transaction.id,
334
330
  sendEmailMessage: true
@@ -0,0 +1,20 @@
1
+ import * as factory from '../factory';
2
+ import { IOptions, Service } from '../service';
3
+ export interface ISearchProjectConditions {
4
+ limit?: number;
5
+ page?: number;
6
+ id?: {
7
+ $eq?: string;
8
+ $regex?: string;
9
+ };
10
+ }
11
+ /**
12
+ * 管理者サービス
13
+ */
14
+ export declare class MeService extends Service<IOptions> {
15
+ constructor(options: Pick<IOptions, 'auth' | 'endpoint' | 'transporter'>);
16
+ /**
17
+ * マイプロジェクト検索
18
+ */
19
+ searchProjects(params: ISearchProjectConditions): Promise<Pick<factory.project.IProject, 'id' | 'logo' | 'name'>[]>;
20
+ }
@@ -62,56 +62,29 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
62
62
  }
63
63
  };
64
64
  Object.defineProperty(exports, "__esModule", { value: true });
65
- exports.ProjectService = void 0;
65
+ exports.MeService = void 0;
66
66
  var http_status_1 = require("http-status");
67
67
  var service_1 = require("../service");
68
68
  /**
69
- * プロジェクトサービス
69
+ * 管理者サービス
70
70
  */
71
- var ProjectService = /** @class */ (function (_super) {
72
- __extends(ProjectService, _super);
73
- function ProjectService(options) {
71
+ var MeService = /** @class */ (function (_super) {
72
+ __extends(MeService, _super);
73
+ function MeService(options) {
74
74
  return _super.call(this, __assign(__assign({}, options), { project: { id: '' } })) || this;
75
75
  }
76
76
  /**
77
- * プロジェクト検索
77
+ * マイプロジェクト検索
78
78
  */
79
- ProjectService.prototype.search = function (params) {
79
+ MeService.prototype.searchProjects = function (params) {
80
80
  return __awaiter(this, void 0, void 0, function () {
81
81
  var _this = this;
82
82
  return __generator(this, function (_a) {
83
83
  return [2 /*return*/, this.fetch({
84
- uri: '/projects',
84
+ uri: '/members/me/projects',
85
85
  method: 'GET',
86
86
  qs: params,
87
87
  expectedStatusCodes: [http_status_1.OK]
88
- })
89
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
90
- var _a;
91
- return __generator(this, function (_b) {
92
- switch (_b.label) {
93
- case 0:
94
- _a = {};
95
- return [4 /*yield*/, response.json()];
96
- case 1: return [2 /*return*/, (_a.data = _b.sent(),
97
- _a)];
98
- }
99
- });
100
- }); })];
101
- });
102
- });
103
- };
104
- /**
105
- * プロジェクト取得
106
- */
107
- ProjectService.prototype.findById = function (params) {
108
- return __awaiter(this, void 0, void 0, function () {
109
- var _this = this;
110
- return __generator(this, function (_a) {
111
- return [2 /*return*/, this.fetch({
112
- uri: "/projects/" + params.id,
113
- method: 'GET',
114
- expectedStatusCodes: [http_status_1.OK]
115
88
  })
116
89
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
117
90
  return [2 /*return*/, response.json()];
@@ -119,38 +92,6 @@ var ProjectService = /** @class */ (function (_super) {
119
92
  });
120
93
  });
121
94
  };
122
- /**
123
- * ヘルスチェック
124
- */
125
- ProjectService.prototype.getHealth = function (_) {
126
- return __awaiter(this, void 0, void 0, function () {
127
- var _this = this;
128
- return __generator(this, function (_a) {
129
- return [2 /*return*/, this.fetch({
130
- uri: '/health',
131
- method: 'GET',
132
- expectedStatusCodes: [http_status_1.OK]
133
- })
134
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
135
- var version;
136
- var _a;
137
- return __generator(this, function (_b) {
138
- switch (_b.label) {
139
- case 0:
140
- version = response.headers.get('X-API-Version');
141
- _a = {
142
- version: (typeof version === 'string') ? version : undefined,
143
- status: response.status
144
- };
145
- return [4 /*yield*/, response.text()];
146
- case 1: return [2 /*return*/, (_a.message = _b.sent(),
147
- _a)];
148
- }
149
- });
150
- }); })];
151
- });
152
- });
153
- };
154
- return ProjectService;
95
+ return MeService;
155
96
  }(service_1.Service));
156
- exports.ProjectService = ProjectService;
97
+ exports.MeService = MeService;
@@ -1,6 +1,7 @@
1
1
  import { IAdditionalOptions, IOptions, IUnset as IUnsetOnService } from './service';
2
2
  import type { CreativeWorkService } from './admin/creativeWork';
3
3
  import type { EventService } from './admin/event';
4
+ import type { MeService } from './admin/me';
4
5
  import type { OfferService } from './admin/offer';
5
6
  import type { OfferCatalogService } from './admin/offerCatalog';
6
7
  import type { OfferCatalogItemService } from './admin/offerCatalogItem';
@@ -21,6 +22,13 @@ export declare namespace service {
21
22
  namespace Event {
22
23
  let svc: typeof EventService | undefined;
23
24
  }
25
+ /**
26
+ * 管理者サービス
27
+ */
28
+ type Me = MeService;
29
+ namespace Me {
30
+ let svc: typeof MeService | undefined;
31
+ }
24
32
  /**
25
33
  * 単価オファーサービス
26
34
  */
@@ -58,6 +66,7 @@ export declare class Admin {
58
66
  constructor(options: Pick<IOptions, 'auth' | 'endpoint'>);
59
67
  createCreativeWorkInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<CreativeWorkService>;
60
68
  createEventInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EventService>;
69
+ createMeInstance(): Promise<MeService>;
61
70
  createOfferInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OfferService>;
62
71
  createOfferCatalogInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OfferCatalogService>;
63
72
  createOfferCatalogItemInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OfferCatalogItemService>;
@@ -56,6 +56,9 @@ var service;
56
56
  var Event;
57
57
  (function (Event) {
58
58
  })(Event = service.Event || (service.Event = {}));
59
+ var Me;
60
+ (function (Me) {
61
+ })(Me = service.Me || (service.Me = {}));
59
62
  var Offer;
60
63
  (function (Offer) {
61
64
  })(Offer = service.Offer || (service.Offer = {}));
@@ -110,6 +113,23 @@ var Admin = /** @class */ (function () {
110
113
  });
111
114
  });
112
115
  };
116
+ Admin.prototype.createMeInstance = function () {
117
+ return __awaiter(this, void 0, void 0, function () {
118
+ var _a;
119
+ return __generator(this, function (_b) {
120
+ switch (_b.label) {
121
+ case 0:
122
+ if (!(service.Me.svc === undefined)) return [3 /*break*/, 2];
123
+ _a = service.Me;
124
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./admin/me'); })];
125
+ case 1:
126
+ _a.svc = (_b.sent()).MeService;
127
+ _b.label = 2;
128
+ case 2: return [2 /*return*/, new service.Me.svc(__assign({}, this.options))];
129
+ }
130
+ });
131
+ });
132
+ };
113
133
  Admin.prototype.createOfferInstance = function (params) {
114
134
  return __awaiter(this, void 0, void 0, function () {
115
135
  var _a;
@@ -1,9 +1,9 @@
1
1
  import * as factory from '../../../factory';
2
2
  export interface IStartParams {
3
3
  /**
4
- * 購入者
4
+ * 注文者
5
5
  */
6
- agent?: {
6
+ agent?: Pick<factory.transaction.placeOrder.IAgent, 'memberOfToken'> & {
7
7
  identifier?: factory.person.IIdentifier;
8
8
  };
9
9
  object?: {
@@ -64,6 +64,7 @@ export declare type IAuthorizeProductOfferResult = Pick<factory.action.authorize
64
64
  result: Pick<factory.action.authorize.offer.product.IResult, 'price' | 'priceCurrency'>;
65
65
  };
66
66
  export interface IOptionalConfirmResult {
67
+ code?: string;
67
68
  eventId?: string;
68
69
  reservationIds?: string[];
69
70
  }
@@ -72,7 +73,7 @@ export declare type IOrderAsConfirmResult = Pick<factory.order.IOrder, 'confirma
72
73
  telephone: string;
73
74
  };
74
75
  };
75
- export declare type IConfirmResult = {
76
+ export declare type IConfirmResult4tttsPOS = {
76
77
  order: IOrderAsConfirmResult;
77
78
  } & IOptionalConfirmResult;
78
79
  export declare type IMinimalOrderAsConfirmResult = Pick<factory.order.IOrder, 'confirmationNumber' | 'orderNumber'>;
@@ -1,7 +1,7 @@
1
1
  import * as factory from '../../factory';
2
2
  import { Service } from '../../service';
3
3
  import { ISetProfileParams, TransactionService } from '../transaction';
4
- import { IConfirmResult, IMinimalConfirmResult, IStartParams, IStartPlaceOrderResult } from './placeOrder/factory';
4
+ import { IConfirmResult4tttsPOS, IMinimalConfirmResult, IStartParams, IStartPlaceOrderResult } from './placeOrder/factory';
5
5
  /**
6
6
  * 注文取引サービス
7
7
  */
@@ -54,7 +54,7 @@ export declare class PlaceOrderTransactionService extends Service implements Tra
54
54
  * @deprecated
55
55
  */
56
56
  expectsReservationIds?: boolean;
57
- }): Promise<IConfirmResult | IMinimalConfirmResult>;
57
+ }): Promise<IConfirmResult4tttsPOS | IMinimalConfirmResult>;
58
58
  /**
59
59
  * 明示的に取引を中止する
60
60
  * 既に確定済、あるいは、期限切れの取引に対して実行するとArgumentエラーが返されます。
@@ -21,7 +21,6 @@ import { PersonOwnershipInfoService } from './service/person/ownershipInfo';
21
21
  import { PlaceService } from './service/place';
22
22
  import { HasPOSService } from './service/place/hasPOS';
23
23
  import { ProductService } from './service/product';
24
- import { ProjectService } from './service/project';
25
24
  import { ReservationService } from './service/reservation';
26
25
  import { SellerService } from './service/seller';
27
26
  import { TokenService } from './service/token';
@@ -121,11 +120,6 @@ export declare namespace service {
121
120
  */
122
121
  class Product extends ProductService {
123
122
  }
124
- /**
125
- * プロジェクトサービス
126
- */
127
- class Project extends ProjectService {
128
- }
129
123
  namespace reservation {
130
124
  export import factory = ReservationServiceFactory;
131
125
  }
@@ -40,7 +40,6 @@ var ownershipInfo_1 = require("./service/person/ownershipInfo");
40
40
  var place_1 = require("./service/place");
41
41
  var hasPOS_1 = require("./service/place/hasPOS");
42
42
  var product_1 = require("./service/product");
43
- var project_1 = require("./service/project");
44
43
  var reservation_1 = require("./service/reservation");
45
44
  var seller_1 = require("./service/seller");
46
45
  var token_1 = require("./service/token");
@@ -235,17 +234,6 @@ var service;
235
234
  return Product;
236
235
  }(product_1.ProductService));
237
236
  service.Product = Product;
238
- /**
239
- * プロジェクトサービス
240
- */
241
- var Project = /** @class */ (function (_super) {
242
- __extends(Project, _super);
243
- function Project() {
244
- return _super !== null && _super.apply(this, arguments) || this;
245
- }
246
- return Project;
247
- }(project_1.ProjectService));
248
- service.Project = Project;
249
237
  var reservation;
250
238
  (function (reservation) {
251
239
  // tslint:disable-next-line:no-shadowed-variable
@@ -1,4 +1,4 @@
1
- import { IConfirmResult, IMinimalConfirmResult, IStartParams, IStartPlaceOrderResult } from '../../chevreTxn/transaction/placeOrder/factory';
1
+ import { IConfirmResult4tttsPOS, IMinimalConfirmResult, IStartParams, IStartPlaceOrderResult } from '../../chevreTxn/transaction/placeOrder/factory';
2
2
  import * as factory from '../../factory';
3
3
  import { Service } from '../../service';
4
4
  import { ISetProfileParams, TransactionService } from '../transaction';
@@ -28,7 +28,7 @@ export declare class PlaceOrderTransactionService extends Service implements Tra
28
28
  /**
29
29
  * 取引確定(tttsPOS専用)
30
30
  */
31
- confirm4tttsPOS(params: Pick<factory.transaction.placeOrder.IConfirmParams, 'id'> & {}): Promise<IConfirmResult>;
31
+ confirm4tttsPOS(params: Pick<factory.transaction.placeOrder.IConfirmParams, 'id'>): Promise<IConfirmResult4tttsPOS>;
32
32
  /**
33
33
  * 取引確定(レスポンス最小化)
34
34
  */