@cinerino/sdk 11.0.0-alpha.4 → 11.0.0-alpha.5

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,47 +1,59 @@
1
1
  // tslint:disable:no-console no-implicit-dependencies no-magic-numbers
2
- import * as httpStatus from 'http-status';
3
2
  import * as moment from 'moment';
4
3
 
5
4
  import * as client from '../../../lib/index';
6
5
 
7
- // tslint:disable-next-line:max-func-body-length
8
- async function main() {
9
- const auth = await client.auth.ClientCredentials.createInstance({
10
- domain: <string>process.env.ST_AUTHORIZE_SERVER_DOMAIN,
11
- clientId: <string>process.env.ST_CLIENT_ID,
12
- clientSecret: <string>process.env.ST_CLIENT_SECRET,
13
- scopes: [],
14
- state: 'teststate'
15
- });
6
+ let auth: client.auth.ClientCredentials | undefined;
16
7
 
17
- const sellerService = new (await client.loadService()).Seller({
18
- endpoint: <string>process.env.ST_API_ENDPOINT,
19
- auth: auth,
20
- project: { id: '' }
21
- });
8
+ async function main() {
9
+ if (auth === undefined) {
10
+ auth = await client.auth.ClientCredentials.createInstance({
11
+ domain: <string>process.env.ST_AUTHORIZE_SERVER_DOMAIN,
12
+ clientId: <string>process.env.ST_CLIENT_ID,
13
+ clientSecret: <string>process.env.ST_CLIENT_SECRET,
14
+ scopes: [],
15
+ state: 'teststate'
16
+ });
17
+ }
22
18
 
23
19
  console.log('イベントを検索しています...');
24
- const searchResult = await sellerService.fetch({
25
- uri: '/events/ScreeningEvent',
20
+ const qs = new URLSearchParams({
21
+ limit: '10',
22
+ page: '1',
23
+ startFrom: moment()
24
+ .toISOString(),
25
+ startThrough: moment()
26
+ .add(1, 'days')
27
+ .toISOString()
28
+ }).toString();
29
+ const response = await fetch(
30
+ `${<string>process.env.ST_API_ENDPOINT}/events/ScreeningEvent?${qs}`, {
26
31
  method: 'GET',
27
- qs: {
28
- limit: 100,
29
- startFrom: new Date(),
30
- startThrough: moment()
31
- .add(1, 'days')
32
- .toDate()
33
- },
34
- expectedStatusCodes: [httpStatus.OK]
35
- })
36
- .then(async (response) => response.json());
37
- console.log(searchResult);
38
- console.log(searchResult.length);
39
- }
32
+ headers: {
33
+ authorization: `Bearer ${await auth.getAccessToken()}`
34
+ }
40
35
 
41
- main()
42
- .then(() => {
43
- console.log('main processed.');
44
- })
45
- .catch((err) => {
46
- console.error(err);
47
36
  });
37
+ if (!response.ok) {
38
+ console.dir(await response.json());
39
+ throw new Error('Network response was not ok');
40
+ }
41
+ const data = await response.json();
42
+ // tslint:disable-next-line:no-null-keyword
43
+ // console.dir(data, { depth: null });
44
+ console.log(data.length, 'data found.');
45
+ }
46
+
47
+ setInterval(
48
+ () => {
49
+ main()
50
+ .then(() => {
51
+ console.log('main processed.');
52
+ })
53
+ .catch((err) => {
54
+ console.error(err);
55
+ });
56
+
57
+ },
58
+ 500
59
+ );
@@ -1,20 +1,14 @@
1
1
  import * as factory from '../factory';
2
2
  import { IOptions, Service } from '../service';
3
- declare type IKeyOfProjection = keyof Omit<factory.seller.ISeller, 'makesOffer' | 'paymentAccepted'>;
4
- declare type IProjection = {
5
- [key in IKeyOfProjection]?: 0;
6
- };
7
3
  /**
8
4
  * 販売者サービス
9
5
  */
10
6
  export declare class SellerService extends Service<IOptions> {
11
7
  /**
12
- * 販売者検索
8
+ * プロジェクトの販売者を検索する
13
9
  */
14
- search(params: Omit<factory.seller.ISearchConditions, 'project' | 'id'> & {
10
+ search(params: Pick<factory.seller.ISearchConditions, 'limit' | 'page'> & {
15
11
  limit: number;
16
12
  page: number;
17
- $projection: IProjection;
18
13
  }): Promise<Pick<factory.seller.ISeller, 'additionalProperty' | 'branchCode' | 'id' | 'name' | 'project' | 'telephone' | 'typeOf' | 'url'>[]>;
19
14
  }
20
- export {};
@@ -54,6 +54,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
54
54
  exports.SellerService = void 0;
55
55
  var http_status_1 = require("http-status");
56
56
  var service_1 = require("../service");
57
+ // type IKeyOfProjection = keyof Omit<factory.seller.ISeller, 'makesOffer' | 'paymentAccepted'>;
58
+ // type IProjection = {
59
+ // [key in IKeyOfProjection]?: 0;
60
+ // };
57
61
  /**
58
62
  * 販売者サービス
59
63
  */
@@ -63,7 +67,7 @@ var SellerService = /** @class */ (function (_super) {
63
67
  return _super !== null && _super.apply(this, arguments) || this;
64
68
  }
65
69
  /**
66
- * 販売者検索
70
+ * プロジェクトの販売者を検索する
67
71
  */
68
72
  SellerService.prototype.search = function (params) {
69
73
  return __awaiter(this, void 0, void 0, function () {
@@ -4,7 +4,7 @@ import { IOptions, Service } from '../../service';
4
4
  * 販売者サービス
5
5
  */
6
6
  export declare class SellerService extends Service<IOptions> {
7
- search(params: Omit<factory.seller.ISearchConditions, 'project' | 'id'> & {
7
+ search(params: Pick<factory.seller.ISearchConditions, 'limit' | 'page'> & {
8
8
  limit: number;
9
9
  page: number;
10
10
  }): Promise<Pick<factory.seller.ISeller, 'additionalProperty' | 'branchCode' | 'id' | 'name' | 'telephone' | 'typeOf' | 'url'>[]>;
@@ -14,17 +14,6 @@ var __extends = (this && this.__extends) || (function () {
14
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
15
  };
16
16
  })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
17
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
18
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
19
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -88,7 +77,7 @@ var SellerService = /** @class */ (function (_super) {
88
77
  })];
89
78
  case 2:
90
79
  sellerService = _b.sent();
91
- return [2 /*return*/, sellerService.search(__assign(__assign({}, params), { $projection: {} }))];
80
+ return [2 /*return*/, sellerService.search(params)];
92
81
  }
93
82
  });
94
83
  });
package/lib/bundle.js CHANGED
@@ -3696,6 +3696,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3696
3696
  exports.SellerService = void 0;
3697
3697
  var http_status_1 = require("http-status");
3698
3698
  var service_1 = require("../service");
3699
+ // type IKeyOfProjection = keyof Omit<factory.seller.ISeller, 'makesOffer' | 'paymentAccepted'>;
3700
+ // type IProjection = {
3701
+ // [key in IKeyOfProjection]?: 0;
3702
+ // };
3699
3703
  /**
3700
3704
  * 販売者サービス
3701
3705
  */
@@ -3705,7 +3709,7 @@ var SellerService = /** @class */ (function (_super) {
3705
3709
  return _super !== null && _super.apply(this, arguments) || this;
3706
3710
  }
3707
3711
  /**
3708
- * 販売者検索
3712
+ * プロジェクトの販売者を検索する
3709
3713
  */
3710
3714
  SellerService.prototype.search = function (params) {
3711
3715
  return __awaiter(this, void 0, void 0, function () {
@@ -22514,17 +22518,6 @@ var __extends = (this && this.__extends) || (function () {
22514
22518
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
22515
22519
  };
22516
22520
  })();
22517
- var __assign = (this && this.__assign) || function () {
22518
- __assign = Object.assign || function(t) {
22519
- for (var s, i = 1, n = arguments.length; i < n; i++) {
22520
- s = arguments[i];
22521
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22522
- t[p] = s[p];
22523
- }
22524
- return t;
22525
- };
22526
- return __assign.apply(this, arguments);
22527
- };
22528
22521
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22529
22522
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
22530
22523
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -22588,7 +22581,7 @@ var SellerService = /** @class */ (function (_super) {
22588
22581
  })];
22589
22582
  case 2:
22590
22583
  sellerService = _b.sent();
22591
- return [2 /*return*/, sellerService.search(__assign(__assign({}, params), { $projection: {} }))];
22584
+ return [2 /*return*/, sellerService.search(params)];
22592
22585
  }
22593
22586
  });
22594
22587
  });
@@ -30511,6 +30504,10 @@ var RoleName;
30511
30504
  RoleName["SellersOwner"] = "sellers.owner";
30512
30505
  RoleName["SellersInventoryManager"] = "sellers.inventoryManager";
30513
30506
  RoleName["SellersIAMRoleAdmin"] = "sellers.iam.roleAdmin";
30507
+ /**
30508
+ * adminapisの在庫管理ロール
30509
+ */
30510
+ RoleName["AdminInventoryManager"] = "admin.inventoryManager";
30514
30511
  })(RoleName = exports.RoleName || (exports.RoleName = {}));
30515
30512
 
30516
30513
  },{}],333:[function(require,module,exports){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinerino/sdk",
3
- "version": "11.0.0-alpha.4",
3
+ "version": "11.0.0-alpha.5",
4
4
  "description": "Cinerino SDK",
5
5
  "main": "./lib/index.js",
6
6
  "browser": {
@@ -92,7 +92,7 @@
92
92
  "watchify": "^3.11.1"
93
93
  },
94
94
  "dependencies": {
95
- "@chevre/factory": "4.395.0-alpha.1",
95
+ "@chevre/factory": "4.395.0-alpha.3",
96
96
  "debug": "3.2.7",
97
97
  "http-status": "1.7.4",
98
98
  "idtoken-verifier": "2.0.3",