@cinerino/sdk 6.1.0-alpha.0 → 6.1.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.
@@ -1,5 +1,5 @@
1
1
  import * as factory from '../factory';
2
- import { IProjectionSearchConditions, ISearchResult, IUnset, Service } from '../service';
2
+ import { IProjectionSearchConditions, IUnset, Service } from '../service';
3
3
  /**
4
4
  * 顧客サービス
5
5
  */
@@ -17,7 +17,7 @@ export declare class CustomerService extends Service {
17
17
  /**
18
18
  * 顧客検索
19
19
  */
20
- search(params: Omit<factory.customer.ISearchConditions, 'project'> & IProjectionSearchConditions): Promise<ISearchResult<factory.customer.ICustomer[]>>;
20
+ search(params: Omit<factory.customer.ISearchConditions, 'project'> & IProjectionSearchConditions): Promise<factory.customer.ICustomer[]>;
21
21
  /**
22
22
  * 顧客編集
23
23
  */
@@ -126,18 +126,9 @@ var CustomerService = /** @class */ (function (_super) {
126
126
  qs: params,
127
127
  expectedStatusCodes: [http_status_1.OK]
128
128
  })
129
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
130
- var _a;
131
- return __generator(this, function (_b) {
132
- switch (_b.label) {
133
- case 0:
134
- _a = {};
135
- return [4 /*yield*/, response.json()];
136
- case 1: return [2 /*return*/, (_a.data = _b.sent(),
137
- _a)];
138
- }
139
- });
140
- }); })];
129
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
130
+ return [2 /*return*/, response.json()];
131
+ }); }); })];
141
132
  });
142
133
  });
143
134
  };
@@ -13,6 +13,7 @@ export declare class TokenService extends Service<IOptions> {
13
13
  * トークンを取得する
14
14
  */
15
15
  getToken(params: {
16
+ grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer';
16
17
  assertion: string;
17
18
  code: string;
18
19
  }): Promise<ICredentials>;
@@ -70,16 +70,19 @@ var TokenService = /** @class */ (function (_super) {
70
70
  */
71
71
  TokenService.prototype.getToken = function (params) {
72
72
  return __awaiter(this, void 0, void 0, function () {
73
- var assertion, code;
73
+ var assertion, code, grant_type;
74
74
  var _this = this;
75
75
  return __generator(this, function (_a) {
76
- assertion = params.assertion, code = params.code;
76
+ assertion = params.assertion, code = params.code, grant_type = params.grant_type;
77
77
  return [2 /*return*/, this.fetch({
78
78
  uri: '/token',
79
79
  method: 'POST',
80
- body: { assertion: assertion },
80
+ form: new URLSearchParams({ assertion: assertion, grant_type: grant_type }),
81
81
  qs: { code: code },
82
- expectedStatusCodes: [http_status_1.OK]
82
+ expectedStatusCodes: [http_status_1.OK],
83
+ headers: {
84
+ 'Content-Type': 'application/x-www-form-urlencoded'
85
+ }
83
86
  })
84
87
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
85
88
  return [2 /*return*/, response.json()];
@@ -84,7 +84,7 @@ var CustomerService = /** @class */ (function (_super) {
84
84
  */
85
85
  CustomerService.prototype.search = function (params) {
86
86
  return __awaiter(this, void 0, void 0, function () {
87
- var _a, auth, endpoint, project, seller, chevreAdmin, customerService, data;
87
+ var _a, auth, endpoint, project, seller, chevreAdmin, customerService;
88
88
  return __generator(this, function (_b) {
89
89
  switch (_b.label) {
90
90
  case 0:
@@ -98,10 +98,7 @@ var CustomerService = /** @class */ (function (_super) {
98
98
  })];
99
99
  case 2:
100
100
  customerService = _b.sent();
101
- return [4 /*yield*/, customerService.search(params)];
102
- case 3:
103
- data = (_b.sent()).data;
104
- return [2 /*return*/, data];
101
+ return [2 /*return*/, customerService.search(params)];
105
102
  }
106
103
  });
107
104
  });
@@ -44,7 +44,7 @@ export interface IAdditionalOptions {
44
44
  }
45
45
  export interface IFetchOptions {
46
46
  uri: string;
47
- form?: any;
47
+ form?: URLSearchParams;
48
48
  qs?: any;
49
49
  method: string;
50
50
  headers?: {
@@ -102,11 +102,8 @@ var Service = /** @class */ (function () {
102
102
  Accept: 'application/json',
103
103
  'Content-Type': 'application/json'
104
104
  }, defaultOptions.headers);
105
- fetchOptions = {
106
- method: defaultOptions.method,
107
- headers: headers,
108
- body: JSON.stringify(defaultOptions.body)
109
- };
105
+ fetchOptions = __assign({ method: defaultOptions.method, headers: headers, body: JSON.stringify(defaultOptions.body) }, (defaultOptions.form instanceof URLSearchParams) ? { body: defaultOptions.form } : undefined // form対応(2024-05-14~)
106
+ );
110
107
  retryableStatusCodes = (this.options.disableAutoRetry === true)
111
108
  ? []
112
109
  : __spreadArray(__spreadArray([], (Array.isArray(this.options.retryableStatusCodes)) ? this.options.retryableStatusCodes : []), (Array.isArray(defaultOptions.retryableStatusCodes)) ? defaultOptions.retryableStatusCodes : []);
package/lib/bundle.js CHANGED
@@ -6928,18 +6928,9 @@ var CustomerService = /** @class */ (function (_super) {
6928
6928
  qs: params,
6929
6929
  expectedStatusCodes: [http_status_1.OK]
6930
6930
  })
6931
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
6932
- var _a;
6933
- return __generator(this, function (_b) {
6934
- switch (_b.label) {
6935
- case 0:
6936
- _a = {};
6937
- return [4 /*yield*/, response.json()];
6938
- case 1: return [2 /*return*/, (_a.data = _b.sent(),
6939
- _a)];
6940
- }
6941
- });
6942
- }); })];
6931
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
6932
+ return [2 /*return*/, response.json()];
6933
+ }); }); })];
6943
6934
  });
6944
6935
  });
6945
6936
  };
@@ -13550,16 +13541,19 @@ var TokenService = /** @class */ (function (_super) {
13550
13541
  */
13551
13542
  TokenService.prototype.getToken = function (params) {
13552
13543
  return __awaiter(this, void 0, void 0, function () {
13553
- var assertion, code;
13544
+ var assertion, code, grant_type;
13554
13545
  var _this = this;
13555
13546
  return __generator(this, function (_a) {
13556
- assertion = params.assertion, code = params.code;
13547
+ assertion = params.assertion, code = params.code, grant_type = params.grant_type;
13557
13548
  return [2 /*return*/, this.fetch({
13558
13549
  uri: '/token',
13559
13550
  method: 'POST',
13560
- body: { assertion: assertion },
13551
+ form: new URLSearchParams({ assertion: assertion, grant_type: grant_type }),
13561
13552
  qs: { code: code },
13562
- expectedStatusCodes: [http_status_1.OK]
13553
+ expectedStatusCodes: [http_status_1.OK],
13554
+ headers: {
13555
+ 'Content-Type': 'application/x-www-form-urlencoded'
13556
+ }
13563
13557
  })
13564
13558
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
13565
13559
  return [2 /*return*/, response.json()];
@@ -19512,7 +19506,7 @@ var CustomerService = /** @class */ (function (_super) {
19512
19506
  */
19513
19507
  CustomerService.prototype.search = function (params) {
19514
19508
  return __awaiter(this, void 0, void 0, function () {
19515
- var _a, auth, endpoint, project, seller, chevreAdmin, customerService, data;
19509
+ var _a, auth, endpoint, project, seller, chevreAdmin, customerService;
19516
19510
  return __generator(this, function (_b) {
19517
19511
  switch (_b.label) {
19518
19512
  case 0:
@@ -19526,10 +19520,7 @@ var CustomerService = /** @class */ (function (_super) {
19526
19520
  })];
19527
19521
  case 2:
19528
19522
  customerService = _b.sent();
19529
- return [4 /*yield*/, customerService.search(params)];
19530
- case 3:
19531
- data = (_b.sent()).data;
19532
- return [2 /*return*/, data];
19523
+ return [2 /*return*/, customerService.search(params)];
19533
19524
  }
19534
19525
  });
19535
19526
  });
@@ -21839,11 +21830,8 @@ var Service = /** @class */ (function () {
21839
21830
  Accept: 'application/json',
21840
21831
  'Content-Type': 'application/json'
21841
21832
  }, defaultOptions.headers);
21842
- fetchOptions = {
21843
- method: defaultOptions.method,
21844
- headers: headers,
21845
- body: JSON.stringify(defaultOptions.body)
21846
- };
21833
+ fetchOptions = __assign({ method: defaultOptions.method, headers: headers, body: JSON.stringify(defaultOptions.body) }, (defaultOptions.form instanceof URLSearchParams) ? { body: defaultOptions.form } : undefined // form対応(2024-05-14~)
21834
+ );
21847
21835
  retryableStatusCodes = (this.options.disableAutoRetry === true)
21848
21836
  ? []
21849
21837
  : __spreadArray(__spreadArray([], (Array.isArray(this.options.retryableStatusCodes)) ? this.options.retryableStatusCodes : []), (Array.isArray(defaultOptions.retryableStatusCodes)) ? defaultOptions.retryableStatusCodes : []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinerino/sdk",
3
- "version": "6.1.0-alpha.0",
3
+ "version": "6.1.0-alpha.2",
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.369.0-alpha.11",
95
+ "@chevre/factory": "4.369.1",
96
96
  "debug": "^3.2.6",
97
97
  "http-status": "^1.4.2",
98
98
  "idtoken-verifier": "^2.0.3",