@cinerino/sdk 11.0.0 → 11.1.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.
- package/example/playground/public/lib/bundle.js +154 -51
- package/example/src/auth/authAsAdmin.ts +6 -3
- package/example/src/chevre/admin/findMySellers.ts +33 -0
- package/example/src/chevre/{searchEvents.ts → default/searchEvents.ts} +1 -1
- package/example/src/cloud/{adminSearchMyProjects.ts → admin/findMyProjects.ts} +2 -3
- package/example/src/cloud/admin/findMySellers.ts +31 -0
- package/example/src/cloud/transaction/processPlaceOrderByCreditCard3DS.ts +3 -1
- package/lib/abstract/chevreAdmin/me.d.ts +13 -2
- package/lib/abstract/chevreAdmin/me.js +21 -0
- package/lib/abstract/chevrePay/payment.js +57 -36
- package/lib/abstract/cloud/admin/me.d.ts +12 -11
- package/lib/abstract/cloud/admin/me.js +22 -1
- package/lib/auth/clientCredentialsClient.d.ts +1 -1
- package/lib/auth/credentials.d.ts +1 -1
- package/lib/auth/oAuth2client.d.ts +12 -1
- package/lib/auth/oAuth2client.js +54 -14
- package/lib/bundle.js +154 -51
- package/package.json +1 -1
package/lib/bundle.js
CHANGED
|
@@ -2693,6 +2693,27 @@ var MeService = /** @class */ (function (_super) {
|
|
|
2693
2693
|
});
|
|
2694
2694
|
});
|
|
2695
2695
|
};
|
|
2696
|
+
/**
|
|
2697
|
+
* マイ販売者検索
|
|
2698
|
+
*/
|
|
2699
|
+
MeService.prototype.findMySellers = function (params) {
|
|
2700
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2701
|
+
var project, conditions;
|
|
2702
|
+
var _this = this;
|
|
2703
|
+
return __generator(this, function (_a) {
|
|
2704
|
+
project = params.project, conditions = params.conditions;
|
|
2705
|
+
return [2 /*return*/, this.fetch({
|
|
2706
|
+
uri: "/members/me/projects/" + String(project === null || project === void 0 ? void 0 : project.id) + "/sellers",
|
|
2707
|
+
method: 'GET',
|
|
2708
|
+
qs: conditions,
|
|
2709
|
+
expectedStatusCodes: [http_status_1.OK]
|
|
2710
|
+
})
|
|
2711
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
2712
|
+
return [2 /*return*/, response.json()];
|
|
2713
|
+
}); }); })];
|
|
2714
|
+
});
|
|
2715
|
+
});
|
|
2716
|
+
};
|
|
2696
2717
|
return MeService;
|
|
2697
2718
|
}(service_1.Service));
|
|
2698
2719
|
exports.MeService = MeService;
|
|
@@ -17033,17 +17054,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
17033
17054
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
17034
17055
|
}
|
|
17035
17056
|
};
|
|
17036
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
17037
|
-
var t = {};
|
|
17038
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
17039
|
-
t[p] = s[p];
|
|
17040
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17041
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17042
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17043
|
-
t[p[i]] = s[p[i]];
|
|
17044
|
-
}
|
|
17045
|
-
return t;
|
|
17046
|
-
};
|
|
17047
17057
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17048
17058
|
exports.PaymentService = void 0;
|
|
17049
17059
|
var http_status_1 = require("http-status");
|
|
@@ -17062,15 +17072,17 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
17062
17072
|
*/
|
|
17063
17073
|
PaymentService.prototype.checkMovieTicket = function (params) {
|
|
17064
17074
|
return __awaiter(this, void 0, void 0, function () {
|
|
17075
|
+
var object, purpose;
|
|
17065
17076
|
var _this = this;
|
|
17066
17077
|
return __generator(this, function (_a) {
|
|
17078
|
+
object = params.object, purpose = params.purpose;
|
|
17067
17079
|
return [2 /*return*/, this.fetch({
|
|
17068
17080
|
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.MovieTicket + "/check",
|
|
17069
17081
|
method: 'POST',
|
|
17070
17082
|
expectedStatusCodes: [http_status_1.CREATED],
|
|
17071
|
-
body:
|
|
17083
|
+
body: { object: object, purpose: purpose },
|
|
17072
17084
|
qs: {
|
|
17073
|
-
purpose: { id:
|
|
17085
|
+
purpose: { id: purpose.id } // 追加(2024-04-01~)
|
|
17074
17086
|
}
|
|
17075
17087
|
})
|
|
17076
17088
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
@@ -17084,16 +17096,18 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
17084
17096
|
*/
|
|
17085
17097
|
PaymentService.prototype.checkMovieTicketAsync = function (params) {
|
|
17086
17098
|
return __awaiter(this, void 0, void 0, function () {
|
|
17099
|
+
var object, purpose;
|
|
17087
17100
|
var _this = this;
|
|
17088
17101
|
return __generator(this, function (_a) {
|
|
17102
|
+
object = params.object, purpose = params.purpose;
|
|
17089
17103
|
return [2 /*return*/, this.fetch({
|
|
17090
17104
|
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.MovieTicket + "/check",
|
|
17091
17105
|
method: 'POST',
|
|
17092
17106
|
expectedStatusCodes: [http_status_1.ACCEPTED],
|
|
17093
|
-
body:
|
|
17107
|
+
body: { object: object, purpose: purpose },
|
|
17094
17108
|
qs: {
|
|
17095
17109
|
async: true,
|
|
17096
|
-
purpose: { id:
|
|
17110
|
+
purpose: { id: purpose.id } // 追加(2024-04-01~)
|
|
17097
17111
|
}
|
|
17098
17112
|
})
|
|
17099
17113
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
@@ -17107,15 +17121,21 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
17107
17121
|
*/
|
|
17108
17122
|
PaymentService.prototype.authorizeAnyPayment = function (params) {
|
|
17109
17123
|
return __awaiter(this, void 0, void 0, function () {
|
|
17124
|
+
var object, purpose, amount, issuedThrough, paymentMethod, name, additionalProperty, ticketToken;
|
|
17110
17125
|
var _this = this;
|
|
17111
17126
|
return __generator(this, function (_a) {
|
|
17127
|
+
object = params.object, purpose = params.purpose;
|
|
17128
|
+
amount = object.amount, issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, name = object.name, additionalProperty = object.additionalProperty, ticketToken = object.ticketToken;
|
|
17112
17129
|
return [2 /*return*/, this.fetch({
|
|
17113
17130
|
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.FaceToFace + "/authorize",
|
|
17114
17131
|
method: 'POST',
|
|
17115
17132
|
expectedStatusCodes: [http_status_1.CREATED],
|
|
17116
|
-
body:
|
|
17133
|
+
body: {
|
|
17134
|
+
object: __assign(__assign(__assign({ amount: amount, issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (typeof name === 'string') ? { name: name } : undefined), (typeof ticketToken === 'string') ? { ticketToken: ticketToken } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty: additionalProperty } : undefined),
|
|
17135
|
+
purpose: purpose
|
|
17136
|
+
},
|
|
17117
17137
|
qs: {
|
|
17118
|
-
purpose: { id:
|
|
17138
|
+
purpose: { id: purpose.id } // 追加(2024-04-01~)
|
|
17119
17139
|
}
|
|
17120
17140
|
})
|
|
17121
17141
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
@@ -17129,14 +17149,20 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
17129
17149
|
*/
|
|
17130
17150
|
PaymentService.prototype.authorizeCreditCard = function (params, options) {
|
|
17131
17151
|
return __awaiter(this, void 0, void 0, function () {
|
|
17152
|
+
var object, purpose, amount, issuedThrough, paymentMethod, creditCard, method, paymentMethodId, name, additionalProperty, ticketToken;
|
|
17132
17153
|
var _this = this;
|
|
17133
17154
|
return __generator(this, function (_a) {
|
|
17155
|
+
object = params.object, purpose = params.purpose;
|
|
17156
|
+
amount = object.amount, issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, creditCard = object.creditCard, method = object.method, paymentMethodId = object.paymentMethodId, name = object.name, additionalProperty = object.additionalProperty, ticketToken = object.ticketToken;
|
|
17134
17157
|
return [2 /*return*/, this.fetch({
|
|
17135
17158
|
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.CreditCard + "/authorize",
|
|
17136
17159
|
method: 'POST',
|
|
17137
17160
|
expectedStatusCodes: [http_status_1.ACCEPTED, http_status_1.CREATED],
|
|
17138
|
-
body:
|
|
17139
|
-
|
|
17161
|
+
body: {
|
|
17162
|
+
object: __assign(__assign(__assign(__assign(__assign(__assign({ amount: amount, issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (creditCard !== undefined && creditCard !== null) ? { creditCard: creditCard } : undefined), (typeof name === 'string') ? { name: name } : undefined), (typeof method === 'string') ? { method: method } : undefined), (typeof paymentMethodId === 'string') ? { paymentMethodId: paymentMethodId } : undefined), (typeof ticketToken === 'string') ? { ticketToken: ticketToken } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty: additionalProperty } : undefined),
|
|
17163
|
+
purpose: purpose
|
|
17164
|
+
},
|
|
17165
|
+
qs: __assign(__assign({}, options), { purpose: { id: purpose.id } // 追加(2024-04-01~)
|
|
17140
17166
|
})
|
|
17141
17167
|
})
|
|
17142
17168
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
@@ -17150,14 +17176,20 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
17150
17176
|
*/
|
|
17151
17177
|
PaymentService.prototype.authorizeMovieTicket = function (params, options) {
|
|
17152
17178
|
return __awaiter(this, void 0, void 0, function () {
|
|
17179
|
+
var object, purpose, issuedThrough, paymentMethod, movieTickets, name, additionalProperty, ticketToken;
|
|
17153
17180
|
var _this = this;
|
|
17154
17181
|
return __generator(this, function (_a) {
|
|
17182
|
+
object = params.object, purpose = params.purpose;
|
|
17183
|
+
issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, movieTickets = object.movieTickets, name = object.name, additionalProperty = object.additionalProperty, ticketToken = object.ticketToken;
|
|
17155
17184
|
return [2 /*return*/, this.fetch({
|
|
17156
17185
|
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.MovieTicket + "/authorize",
|
|
17157
17186
|
method: 'POST',
|
|
17158
17187
|
expectedStatusCodes: [http_status_1.ACCEPTED, http_status_1.CREATED],
|
|
17159
|
-
body:
|
|
17160
|
-
|
|
17188
|
+
body: {
|
|
17189
|
+
object: __assign(__assign(__assign(__assign({ issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (Array.isArray(movieTickets)) ? { movieTickets: movieTickets } : undefined), (typeof name === 'string') ? { name: name } : undefined), (typeof ticketToken === 'string') ? { ticketToken: ticketToken } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty: additionalProperty } : undefined),
|
|
17190
|
+
purpose: purpose
|
|
17191
|
+
},
|
|
17192
|
+
qs: __assign(__assign({}, options), { purpose: { id: purpose.id } // 追加(2024-04-01~)
|
|
17161
17193
|
})
|
|
17162
17194
|
})
|
|
17163
17195
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
@@ -17171,15 +17203,21 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
17171
17203
|
*/
|
|
17172
17204
|
PaymentService.prototype.authorizePaymentCard = function (params) {
|
|
17173
17205
|
return __awaiter(this, void 0, void 0, function () {
|
|
17206
|
+
var object, purpose, amount, issuedThrough, paymentMethod, name, additionalProperty, fromLocation, description;
|
|
17174
17207
|
var _this = this;
|
|
17175
17208
|
return __generator(this, function (_a) {
|
|
17209
|
+
object = params.object, purpose = params.purpose;
|
|
17210
|
+
amount = object.amount, issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, name = object.name, additionalProperty = object.additionalProperty, fromLocation = object.fromLocation, description = object.description;
|
|
17176
17211
|
return [2 /*return*/, this.fetch({
|
|
17177
17212
|
uri: "/payment/" + factory.product.ProductType.PaymentCard + "/authorize",
|
|
17178
17213
|
method: 'POST',
|
|
17179
17214
|
expectedStatusCodes: [http_status_1.CREATED],
|
|
17180
|
-
body:
|
|
17215
|
+
body: {
|
|
17216
|
+
object: __assign(__assign(__assign(__assign({ amount: amount, issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (typeof fromLocation === 'string') ? { fromLocation: fromLocation } : undefined), (typeof name === 'string') ? { name: name } : undefined), (typeof description === 'string') ? { description: description } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty: additionalProperty } : undefined),
|
|
17217
|
+
purpose: purpose
|
|
17218
|
+
},
|
|
17181
17219
|
qs: {
|
|
17182
|
-
purpose: { id:
|
|
17220
|
+
purpose: { id: purpose.id } // 追加(2024-04-01~)
|
|
17183
17221
|
}
|
|
17184
17222
|
})
|
|
17185
17223
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
@@ -17193,15 +17231,19 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
17193
17231
|
*/
|
|
17194
17232
|
PaymentService.prototype.publishCreditCardPaymentUrlAsync = function (params) {
|
|
17195
17233
|
return __awaiter(this, void 0, void 0, function () {
|
|
17196
|
-
var object, purpose;
|
|
17234
|
+
var object, purpose, amount, creditCard, issuedThrough, paymentMethod, method, ticketToken;
|
|
17197
17235
|
var _this = this;
|
|
17198
17236
|
return __generator(this, function (_a) {
|
|
17199
17237
|
object = params.object, purpose = params.purpose;
|
|
17238
|
+
amount = object.amount, creditCard = object.creditCard, issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, method = object.method, ticketToken = object.ticketToken;
|
|
17200
17239
|
return [2 /*return*/, this.fetch({
|
|
17201
17240
|
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.CreditCard + "/publishPaymentUrl",
|
|
17202
17241
|
method: 'POST',
|
|
17203
17242
|
expectedStatusCodes: [http_status_1.ACCEPTED],
|
|
17204
|
-
body: {
|
|
17243
|
+
body: {
|
|
17244
|
+
object: __assign(__assign(__assign({ amount: amount, issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (creditCard !== undefined && creditCard !== null) ? { creditCard: creditCard } : undefined), (typeof method === 'string') ? { method: method } : undefined), (typeof ticketToken === 'string') ? { ticketToken: ticketToken } : undefined),
|
|
17245
|
+
purpose: purpose
|
|
17246
|
+
},
|
|
17205
17247
|
qs: {
|
|
17206
17248
|
async: true,
|
|
17207
17249
|
purpose: { id: purpose.id } // 追加(2024-04-01~)
|
|
@@ -17218,18 +17260,18 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
17218
17260
|
*/
|
|
17219
17261
|
PaymentService.prototype.voidAnyPayment = function (params) {
|
|
17220
17262
|
return __awaiter(this, void 0, void 0, function () {
|
|
17221
|
-
var id,
|
|
17263
|
+
var id, purpose;
|
|
17222
17264
|
return __generator(this, function (_a) {
|
|
17223
17265
|
switch (_a.label) {
|
|
17224
17266
|
case 0:
|
|
17225
|
-
id = params.id,
|
|
17267
|
+
id = params.id, purpose = params.purpose;
|
|
17226
17268
|
return [4 /*yield*/, this.fetch({
|
|
17227
17269
|
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.FaceToFace + "/authorize/" + id + "/void",
|
|
17228
17270
|
method: 'PUT',
|
|
17229
17271
|
expectedStatusCodes: [http_status_1.NO_CONTENT],
|
|
17230
|
-
body:
|
|
17272
|
+
body: { purpose: purpose },
|
|
17231
17273
|
qs: {
|
|
17232
|
-
purpose: { id:
|
|
17274
|
+
purpose: { id: purpose.id } // 追加(2024-04-01~)
|
|
17233
17275
|
}
|
|
17234
17276
|
})];
|
|
17235
17277
|
case 1:
|
|
@@ -17244,18 +17286,18 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
17244
17286
|
*/
|
|
17245
17287
|
PaymentService.prototype.voidTransaction = function (params) {
|
|
17246
17288
|
return __awaiter(this, void 0, void 0, function () {
|
|
17247
|
-
var id, object,
|
|
17289
|
+
var id, object, purpose;
|
|
17248
17290
|
return __generator(this, function (_a) {
|
|
17249
17291
|
switch (_a.label) {
|
|
17250
17292
|
case 0:
|
|
17251
|
-
id = params.id, object = params.object,
|
|
17293
|
+
id = params.id, object = params.object, purpose = params.purpose;
|
|
17252
17294
|
return [4 /*yield*/, this.fetch({
|
|
17253
17295
|
uri: "/payment/" + object.typeOf + "/authorize/" + id + "/void",
|
|
17254
17296
|
method: 'PUT',
|
|
17255
17297
|
expectedStatusCodes: [http_status_1.NO_CONTENT],
|
|
17256
|
-
body:
|
|
17298
|
+
body: { purpose: purpose },
|
|
17257
17299
|
qs: {
|
|
17258
|
-
purpose: { id:
|
|
17300
|
+
purpose: { id: purpose.id } // 追加(2024-04-01~)
|
|
17259
17301
|
}
|
|
17260
17302
|
})];
|
|
17261
17303
|
case 1:
|
|
@@ -17385,7 +17427,7 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
17385
17427
|
expectedStatusCodes: [http_status_1.CREATED],
|
|
17386
17428
|
body: { purpose: purpose },
|
|
17387
17429
|
qs: {
|
|
17388
|
-
purpose: { id:
|
|
17430
|
+
purpose: { id: purpose.id }
|
|
17389
17431
|
}
|
|
17390
17432
|
})
|
|
17391
17433
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
@@ -17406,7 +17448,7 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
17406
17448
|
expectedStatusCodes: [http_status_1.CREATED],
|
|
17407
17449
|
body: { purpose: purpose, ticketedPermit: ticketedPermit },
|
|
17408
17450
|
qs: {
|
|
17409
|
-
purpose: { id:
|
|
17451
|
+
purpose: { id: purpose.id }
|
|
17410
17452
|
}
|
|
17411
17453
|
})
|
|
17412
17454
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
@@ -17427,7 +17469,7 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
17427
17469
|
expectedStatusCodes: [http_status_1.CREATED],
|
|
17428
17470
|
body: { purpose: purpose, ticketedInvoice: ticketedInvoice },
|
|
17429
17471
|
qs: {
|
|
17430
|
-
purpose: { id:
|
|
17472
|
+
purpose: { id: purpose.id }
|
|
17431
17473
|
}
|
|
17432
17474
|
})
|
|
17433
17475
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
@@ -20842,7 +20884,7 @@ exports.MeService = void 0;
|
|
|
20842
20884
|
var index_1 = require("../../index");
|
|
20843
20885
|
var service_1 = require("../../service");
|
|
20844
20886
|
/**
|
|
20845
|
-
*
|
|
20887
|
+
* 管理者(自分自身)サービス
|
|
20846
20888
|
*/
|
|
20847
20889
|
var MeService = /** @class */ (function (_super) {
|
|
20848
20890
|
__extends(MeService, _super);
|
|
@@ -20870,6 +20912,27 @@ var MeService = /** @class */ (function (_super) {
|
|
|
20870
20912
|
});
|
|
20871
20913
|
});
|
|
20872
20914
|
};
|
|
20915
|
+
/**
|
|
20916
|
+
* マイ販売者検索
|
|
20917
|
+
*/
|
|
20918
|
+
MeService.prototype.findMySellers = function (params) {
|
|
20919
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
20920
|
+
var _a, auth, endpoint, chevreAdmin, meService;
|
|
20921
|
+
return __generator(this, function (_b) {
|
|
20922
|
+
switch (_b.label) {
|
|
20923
|
+
case 0:
|
|
20924
|
+
_a = this.options, auth = _a.auth, endpoint = _a.endpoint;
|
|
20925
|
+
return [4 /*yield*/, index_1.loadChevreAdmin({ auth: auth, endpoint: endpoint })];
|
|
20926
|
+
case 1:
|
|
20927
|
+
chevreAdmin = _b.sent();
|
|
20928
|
+
return [4 /*yield*/, chevreAdmin.createMeInstance()];
|
|
20929
|
+
case 2:
|
|
20930
|
+
meService = _b.sent();
|
|
20931
|
+
return [2 /*return*/, meService.findMySellers(params)];
|
|
20932
|
+
}
|
|
20933
|
+
});
|
|
20934
|
+
});
|
|
20935
|
+
};
|
|
20873
20936
|
return MeService;
|
|
20874
20937
|
}(service_1.Service));
|
|
20875
20938
|
exports.MeService = MeService;
|
|
@@ -27226,6 +27289,17 @@ exports.LoginTicket = LoginTicket;
|
|
|
27226
27289
|
},{}],173:[function(require,module,exports){
|
|
27227
27290
|
(function (Buffer){
|
|
27228
27291
|
"use strict";
|
|
27292
|
+
var __assign = (this && this.__assign) || function () {
|
|
27293
|
+
__assign = Object.assign || function(t) {
|
|
27294
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
27295
|
+
s = arguments[i];
|
|
27296
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
27297
|
+
t[p] = s[p];
|
|
27298
|
+
}
|
|
27299
|
+
return t;
|
|
27300
|
+
};
|
|
27301
|
+
return __assign.apply(this, arguments);
|
|
27302
|
+
};
|
|
27229
27303
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27230
27304
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27231
27305
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -27297,6 +27371,7 @@ var OAuth2client = /** @class */ (function () {
|
|
|
27297
27371
|
// TODO add minimum validation
|
|
27298
27372
|
this.options = options;
|
|
27299
27373
|
this.credentials = {};
|
|
27374
|
+
this.events = {};
|
|
27300
27375
|
}
|
|
27301
27376
|
OAuth2client.BASE64URLENCODE = function (str) {
|
|
27302
27377
|
return str.toString('base64')
|
|
@@ -27415,12 +27490,22 @@ var OAuth2client = /** @class */ (function () {
|
|
|
27415
27490
|
throw new Error('No refresh token is set.');
|
|
27416
27491
|
}
|
|
27417
27492
|
return [2 /*return*/, this.refreshToken(this.credentials.refresh_token)
|
|
27418
|
-
.then(function (
|
|
27419
|
-
|
|
27420
|
-
|
|
27421
|
-
|
|
27422
|
-
|
|
27423
|
-
|
|
27493
|
+
.then(function (refreshTokenResult) { return __awaiter(_this, void 0, void 0, function () {
|
|
27494
|
+
return __generator(this, function (_a) {
|
|
27495
|
+
switch (_a.label) {
|
|
27496
|
+
case 0:
|
|
27497
|
+
// tokens.refresh_token = this.credentials.refresh_token;
|
|
27498
|
+
debug('setting credentials...', refreshTokenResult);
|
|
27499
|
+
this.credentials = __assign(__assign({}, refreshTokenResult), { refresh_token: this.credentials.refresh_token });
|
|
27500
|
+
if (!(typeof this.events.onTokenRefreshed === 'function')) return [3 /*break*/, 2];
|
|
27501
|
+
return [4 /*yield*/, this.events.onTokenRefreshed(this.credentials)];
|
|
27502
|
+
case 1:
|
|
27503
|
+
_a.sent();
|
|
27504
|
+
_a.label = 2;
|
|
27505
|
+
case 2: return [2 /*return*/, this.credentials];
|
|
27506
|
+
}
|
|
27507
|
+
});
|
|
27508
|
+
}); })];
|
|
27424
27509
|
});
|
|
27425
27510
|
});
|
|
27426
27511
|
};
|
|
@@ -27566,6 +27651,12 @@ var OAuth2client = /** @class */ (function () {
|
|
|
27566
27651
|
// return this.verifySignedJwt(options.idToken, options.audience, OAuth2Client.ISSUERS_);
|
|
27567
27652
|
return this.verifySignedJwt(this.credentials.id_token, options.audience);
|
|
27568
27653
|
};
|
|
27654
|
+
/**
|
|
27655
|
+
* トークン更新イベントハンドラを登録する
|
|
27656
|
+
*/
|
|
27657
|
+
OAuth2client.prototype.onTokenRefreshed = function (params) {
|
|
27658
|
+
this.events.onTokenRefreshed = params;
|
|
27659
|
+
};
|
|
27569
27660
|
/**
|
|
27570
27661
|
* Provides a request implementation with OAuth 2.0 flow.
|
|
27571
27662
|
* If credentials have a refresh_token, in cases of HTTP
|
|
@@ -27631,7 +27722,7 @@ var OAuth2client = /** @class */ (function () {
|
|
|
27631
27722
|
debug('fetching...', options);
|
|
27632
27723
|
return [2 /*return*/, fetch("https://" + this.options.domain + OAuth2client.OAUTH2_TOKEN_URI, options)
|
|
27633
27724
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () {
|
|
27634
|
-
var body, body,
|
|
27725
|
+
var body, body, result, refreshTokenResponse, access_token, id_token, expires_in, token_type;
|
|
27635
27726
|
return __generator(this, function (_a) {
|
|
27636
27727
|
switch (_a.label) {
|
|
27637
27728
|
case 0:
|
|
@@ -27647,17 +27738,29 @@ var OAuth2client = /** @class */ (function () {
|
|
|
27647
27738
|
body = _a.sent();
|
|
27648
27739
|
throw new Error(body);
|
|
27649
27740
|
case 4: return [3 /*break*/, 7];
|
|
27650
|
-
case 5:
|
|
27741
|
+
case 5:
|
|
27742
|
+
result = void 0;
|
|
27743
|
+
return [4 /*yield*/, response.json()];
|
|
27651
27744
|
case 6:
|
|
27652
|
-
|
|
27745
|
+
refreshTokenResponse = _a.sent();
|
|
27653
27746
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
27654
27747
|
/* istanbul ignore else */
|
|
27655
|
-
if (
|
|
27656
|
-
|
|
27657
|
-
|
|
27658
|
-
|
|
27748
|
+
if (refreshTokenResponse !== undefined && typeof refreshTokenResponse.expires_in === 'number') {
|
|
27749
|
+
access_token = refreshTokenResponse.access_token, id_token = refreshTokenResponse.id_token, expires_in = refreshTokenResponse.expires_in, token_type = refreshTokenResponse.token_type;
|
|
27750
|
+
result = {
|
|
27751
|
+
access_token: access_token, id_token: id_token, token_type: token_type,
|
|
27752
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
27753
|
+
expiry_date: ((new Date()).getTime() + (expires_in * 1000))
|
|
27754
|
+
};
|
|
27755
|
+
// delete tokens.expires_in;
|
|
27659
27756
|
}
|
|
27660
|
-
|
|
27757
|
+
else {
|
|
27758
|
+
// 想定していないリフレッシュトークンレスポンスはログ出力
|
|
27759
|
+
// tslint:disable-next-line:no-console
|
|
27760
|
+
console.error('unexpected refreshToken response:', refreshTokenResponse);
|
|
27761
|
+
throw new Error('unexpected refreshToken response.');
|
|
27762
|
+
}
|
|
27763
|
+
return [2 /*return*/, result];
|
|
27661
27764
|
case 7: return [2 /*return*/];
|
|
27662
27765
|
}
|
|
27663
27766
|
});
|