@cinerino/sdk 11.1.0 → 11.2.0-alpha.1
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 +931 -456
- package/example/src/cloud/search/findPaymentServices.ts +29 -0
- package/example/src/cloud/search/findProducts.ts +30 -0
- package/lib/abstract/chevre/paymentService.d.ts +29 -0
- package/lib/abstract/chevre/paymentService.js +88 -0
- package/lib/abstract/chevre.d.ts +9 -0
- package/lib/abstract/chevre.js +20 -0
- package/lib/abstract/cloud/search/paymentService.d.ts +11 -0
- package/lib/abstract/cloud/search/paymentService.js +91 -0
- package/lib/abstract/cloud/search/product.d.ts +38 -0
- package/lib/abstract/cloud/search/product.js +127 -0
- package/lib/abstract/cloud/search.d.ts +37 -0
- package/lib/abstract/cloud/search.js +115 -0
- package/lib/abstract/index.d.ts +6 -1
- package/lib/abstract/index.js +27 -1
- package/lib/bundle.js +1088 -608
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -1
- package/package.json +2 -2
- package/example/src/searchProductModels.ts +0 -32
- package/example/src/searchProducts.ts +0 -28
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import { factory, loadCloudSearch } from '../../../../lib/';
|
|
3
|
+
import { auth } from '../../auth/clientCredentials';
|
|
4
|
+
|
|
5
|
+
const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
const paymentProductService = await (await loadCloudSearch({
|
|
9
|
+
endpoint: <string>process.env.API_ENDPOINT,
|
|
10
|
+
auth: await auth()
|
|
11
|
+
})).createPaymentProductInstance({
|
|
12
|
+
project: { id: PROJECT_ID },
|
|
13
|
+
seller: { id: '' }
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const result = await paymentProductService.findPaymentServices({
|
|
17
|
+
limit: 10,
|
|
18
|
+
page: 1,
|
|
19
|
+
typeOf: factory.service.paymentService.PaymentServiceType.CreditCard
|
|
20
|
+
});
|
|
21
|
+
console.log(result);
|
|
22
|
+
console.log(result.length, 'data found');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
main()
|
|
26
|
+
.then(() => {
|
|
27
|
+
console.log('success!');
|
|
28
|
+
})
|
|
29
|
+
.catch(console.error);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import { factory, loadCloudSearch } from '../../../../lib/';
|
|
3
|
+
import { auth } from '../../auth/clientCredentials';
|
|
4
|
+
|
|
5
|
+
const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
const productService = await (await loadCloudSearch({
|
|
9
|
+
endpoint: <string>process.env.API_ENDPOINT,
|
|
10
|
+
auth: await auth()
|
|
11
|
+
// defaultPath: '/secondary'
|
|
12
|
+
})).createProductInstance({
|
|
13
|
+
project: { id: PROJECT_ID },
|
|
14
|
+
seller: { id: '' }
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const result = await productService.search({
|
|
18
|
+
limit: 10,
|
|
19
|
+
page: 1,
|
|
20
|
+
typeOf: { $eq: factory.product.ProductType.EventService }
|
|
21
|
+
});
|
|
22
|
+
console.log(result);
|
|
23
|
+
console.log(result.length, 'data found');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
main()
|
|
27
|
+
.then(() => {
|
|
28
|
+
console.log('success!');
|
|
29
|
+
})
|
|
30
|
+
.catch(console.error);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as factory from '../factory';
|
|
2
|
+
import { Service } from '../service';
|
|
3
|
+
/**
|
|
4
|
+
* 決済サービス検索結果
|
|
5
|
+
*/
|
|
6
|
+
export declare type IPaymentServiceAsFindResult = Pick<factory.service.paymentService.IService, 'typeOf' | 'additionalProperty' | 'description' | 'name' | 'productID' | 'serviceOutput' | 'serviceType'> & {
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 決済サービス検索条件
|
|
11
|
+
*/
|
|
12
|
+
export interface IFindParams {
|
|
13
|
+
/**
|
|
14
|
+
* min: 1
|
|
15
|
+
* max: 20
|
|
16
|
+
*/
|
|
17
|
+
limit: number;
|
|
18
|
+
page: number;
|
|
19
|
+
typeOf: factory.service.paymentService.PaymentServiceType.CreditCard;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 決済商品サービス
|
|
23
|
+
*/
|
|
24
|
+
export declare class PaymentProductService extends Service {
|
|
25
|
+
/**
|
|
26
|
+
* 決済サービスを検索する
|
|
27
|
+
*/
|
|
28
|
+
findPaymentServices(params: IFindParams): Promise<IPaymentServiceAsFindResult[]>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.PaymentProductService = void 0;
|
|
55
|
+
var http_status_1 = require("http-status");
|
|
56
|
+
var service_1 = require("../service");
|
|
57
|
+
/**
|
|
58
|
+
* 決済商品サービス
|
|
59
|
+
*/
|
|
60
|
+
var PaymentProductService = /** @class */ (function (_super) {
|
|
61
|
+
__extends(PaymentProductService, _super);
|
|
62
|
+
function PaymentProductService() {
|
|
63
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 決済サービスを検索する
|
|
67
|
+
*/
|
|
68
|
+
PaymentProductService.prototype.findPaymentServices = function (params) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
+
var limit, page, typeOf;
|
|
71
|
+
var _this = this;
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
limit = params.limit, page = params.page, typeOf = params.typeOf;
|
|
74
|
+
return [2 /*return*/, this.fetch({
|
|
75
|
+
uri: '/paymentServices',
|
|
76
|
+
method: 'GET',
|
|
77
|
+
qs: { limit: limit, page: page, typeOf: typeOf },
|
|
78
|
+
expectedStatusCodes: [http_status_1.OK]
|
|
79
|
+
})
|
|
80
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
81
|
+
return [2 /*return*/, response.json()];
|
|
82
|
+
}); }); })];
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
return PaymentProductService;
|
|
87
|
+
}(service_1.Service));
|
|
88
|
+
exports.PaymentProductService = PaymentProductService;
|
package/lib/abstract/chevre.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { CreativeWorkService } from './chevre/creativeWork';
|
|
|
4
4
|
import type { EmailMessageService } from './chevre/emailMessage';
|
|
5
5
|
import type { EventService } from './chevre/event';
|
|
6
6
|
import type { EventSeriesService } from './chevre/eventSeries';
|
|
7
|
+
import type { PaymentProductService } from './chevre/paymentService';
|
|
7
8
|
import type { PlaceService } from './chevre/place';
|
|
8
9
|
import type { HasPOSService } from './chevre/place/hasPOS';
|
|
9
10
|
import type { ProductService } from './chevre/product';
|
|
@@ -46,6 +47,13 @@ export declare namespace service {
|
|
|
46
47
|
namespace EventSeries {
|
|
47
48
|
let svc: typeof EventSeriesService | undefined;
|
|
48
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* 決済商品サービス
|
|
52
|
+
*/
|
|
53
|
+
type PaymentProduct = PaymentProductService;
|
|
54
|
+
namespace PaymentProduct {
|
|
55
|
+
let svc: typeof PaymentProductService | undefined;
|
|
56
|
+
}
|
|
49
57
|
/**
|
|
50
58
|
* 施設サービス
|
|
51
59
|
*/
|
|
@@ -95,6 +103,7 @@ export declare class Chevre {
|
|
|
95
103
|
createEmailMessageInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EmailMessageService>;
|
|
96
104
|
createEventInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EventService>;
|
|
97
105
|
createEventSeriesInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EventSeriesService>;
|
|
106
|
+
createPaymentProductInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<PaymentProductService>;
|
|
98
107
|
createPlaceInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<PlaceService>;
|
|
99
108
|
createHasPOSInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<HasPOSService>;
|
|
100
109
|
createProductInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ProductService>;
|
package/lib/abstract/chevre.js
CHANGED
|
@@ -65,6 +65,9 @@ var service;
|
|
|
65
65
|
var EventSeries;
|
|
66
66
|
(function (EventSeries) {
|
|
67
67
|
})(EventSeries = service.EventSeries || (service.EventSeries = {}));
|
|
68
|
+
var PaymentProduct;
|
|
69
|
+
(function (PaymentProduct) {
|
|
70
|
+
})(PaymentProduct = service.PaymentProduct || (service.PaymentProduct = {}));
|
|
68
71
|
var Place;
|
|
69
72
|
(function (Place) {
|
|
70
73
|
})(Place = service.Place || (service.Place = {}));
|
|
@@ -176,6 +179,23 @@ var Chevre = /** @class */ (function () {
|
|
|
176
179
|
});
|
|
177
180
|
});
|
|
178
181
|
};
|
|
182
|
+
Chevre.prototype.createPaymentProductInstance = function (params) {
|
|
183
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
184
|
+
var _a;
|
|
185
|
+
return __generator(this, function (_b) {
|
|
186
|
+
switch (_b.label) {
|
|
187
|
+
case 0:
|
|
188
|
+
if (!(service.PaymentProduct.svc === undefined)) return [3 /*break*/, 2];
|
|
189
|
+
_a = service.PaymentProduct;
|
|
190
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevre/paymentService'); })];
|
|
191
|
+
case 1:
|
|
192
|
+
_a.svc = (_b.sent()).PaymentProductService;
|
|
193
|
+
_b.label = 2;
|
|
194
|
+
case 2: return [2 /*return*/, new service.PaymentProduct.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: [] }))];
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
};
|
|
179
199
|
Chevre.prototype.createPlaceInstance = function (params) {
|
|
180
200
|
return __awaiter(this, void 0, void 0, function () {
|
|
181
201
|
var _a;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IFindParams, IPaymentServiceAsFindResult } from '../../chevre/paymentService';
|
|
2
|
+
import { Service } from '../../service';
|
|
3
|
+
/**
|
|
4
|
+
* 決済商品サービス
|
|
5
|
+
*/
|
|
6
|
+
export declare class PaymentProductService extends Service {
|
|
7
|
+
/**
|
|
8
|
+
* 決済サービスを検索する
|
|
9
|
+
*/
|
|
10
|
+
findPaymentServices(params: IFindParams): Promise<IPaymentServiceAsFindResult[]>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.PaymentProductService = void 0;
|
|
55
|
+
var http_status_1 = require("http-status");
|
|
56
|
+
var service_1 = require("../../service");
|
|
57
|
+
/**
|
|
58
|
+
* 決済商品サービス
|
|
59
|
+
*/
|
|
60
|
+
var PaymentProductService = /** @class */ (function (_super) {
|
|
61
|
+
__extends(PaymentProductService, _super);
|
|
62
|
+
function PaymentProductService() {
|
|
63
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
|
+
}
|
|
65
|
+
// constructor(options: IAdditionalOptions & Pick<IOptions, 'auth' | 'endpoint' | 'transporter' | 'project' | 'defaultPath'>) {
|
|
66
|
+
// super({ ...options, retryableStatusCodes: [BAD_GATEWAY, FORBIDDEN, UNAUTHORIZED] });
|
|
67
|
+
// }
|
|
68
|
+
/**
|
|
69
|
+
* 決済サービスを検索する
|
|
70
|
+
*/
|
|
71
|
+
PaymentProductService.prototype.findPaymentServices = function (params) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
+
var limit, page, typeOf;
|
|
74
|
+
var _this = this;
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
limit = params.limit, page = params.page, typeOf = params.typeOf;
|
|
77
|
+
return [2 /*return*/, this.fetch({
|
|
78
|
+
uri: '/paymentServices',
|
|
79
|
+
method: 'GET',
|
|
80
|
+
qs: { limit: limit, page: page, typeOf: typeOf },
|
|
81
|
+
expectedStatusCodes: [http_status_1.OK]
|
|
82
|
+
})
|
|
83
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
84
|
+
return [2 /*return*/, response.json()];
|
|
85
|
+
}); }); })];
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
return PaymentProductService;
|
|
90
|
+
}(service_1.Service));
|
|
91
|
+
exports.PaymentProductService = PaymentProductService;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IPaymentServiceWithoutCredentials, IProductModel, IProductWithoutCredentials, ISearchProductModelConditions } from '../../chevre/product';
|
|
2
|
+
import * as factory from '../../factory';
|
|
3
|
+
import { Service } from '../../service';
|
|
4
|
+
declare type ISearchProductsResult = IProductWithoutCredentials | IPaymentServiceWithoutCredentials;
|
|
5
|
+
/**
|
|
6
|
+
* プロダクトサービス
|
|
7
|
+
*/
|
|
8
|
+
export declare class ProductService extends Service {
|
|
9
|
+
/**
|
|
10
|
+
* プロダクトタイプ指定で検索する
|
|
11
|
+
*/
|
|
12
|
+
search(params: Omit<factory.product.ISearchConditions, 'project' | 'typeOf'> & {
|
|
13
|
+
typeOf: {
|
|
14
|
+
/**
|
|
15
|
+
* プロダクトタイプ
|
|
16
|
+
*/
|
|
17
|
+
$eq: factory.product.ProductType.EventService | factory.product.ProductType.Product | factory.product.ProductType.MembershipService | factory.product.ProductType.PaymentCard;
|
|
18
|
+
};
|
|
19
|
+
}): Promise<ISearchProductsResult[]>;
|
|
20
|
+
/**
|
|
21
|
+
* プロダクトオファー検索
|
|
22
|
+
*/
|
|
23
|
+
searchOffers(params: {
|
|
24
|
+
limit?: number;
|
|
25
|
+
page?: number;
|
|
26
|
+
itemOffered: {
|
|
27
|
+
id: string;
|
|
28
|
+
};
|
|
29
|
+
seller?: {
|
|
30
|
+
id: string;
|
|
31
|
+
};
|
|
32
|
+
}): Promise<Omit<factory.product.ITicketOffer, 'availableAtOrFrom'>[]>;
|
|
33
|
+
/**
|
|
34
|
+
* 座席モデル検索
|
|
35
|
+
*/
|
|
36
|
+
searchProductModels(params: ISearchProductModelConditions): Promise<IProductModel[]>;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.ProductService = void 0;
|
|
55
|
+
var http_status_1 = require("http-status");
|
|
56
|
+
var service_1 = require("../../service");
|
|
57
|
+
/**
|
|
58
|
+
* プロダクトサービス
|
|
59
|
+
*/
|
|
60
|
+
var ProductService = /** @class */ (function (_super) {
|
|
61
|
+
__extends(ProductService, _super);
|
|
62
|
+
function ProductService() {
|
|
63
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
|
+
}
|
|
65
|
+
// constructor(options: IAdditionalOptions & Pick<IOptions, 'auth' | 'endpoint' | 'transporter' | 'project' | 'defaultPath'>) {
|
|
66
|
+
// super({ ...options, retryableStatusCodes: [BAD_GATEWAY, FORBIDDEN, UNAUTHORIZED] });
|
|
67
|
+
// }
|
|
68
|
+
/**
|
|
69
|
+
* プロダクトタイプ指定で検索する
|
|
70
|
+
*/
|
|
71
|
+
ProductService.prototype.search = function (params) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
+
var _this = this;
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
return [2 /*return*/, this.fetch({
|
|
76
|
+
uri: '/products',
|
|
77
|
+
method: 'GET',
|
|
78
|
+
qs: params,
|
|
79
|
+
expectedStatusCodes: [http_status_1.OK]
|
|
80
|
+
})
|
|
81
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
82
|
+
return [2 /*return*/, response.json()];
|
|
83
|
+
}); }); })];
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* プロダクトオファー検索
|
|
89
|
+
*/
|
|
90
|
+
ProductService.prototype.searchOffers = function (params) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var _this = this;
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
return [2 /*return*/, this.fetch({
|
|
95
|
+
uri: "/products/" + params.itemOffered.id + "/offers",
|
|
96
|
+
method: 'GET',
|
|
97
|
+
expectedStatusCodes: [http_status_1.OK],
|
|
98
|
+
qs: params
|
|
99
|
+
})
|
|
100
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
101
|
+
return [2 /*return*/, response.json()];
|
|
102
|
+
}); }); })];
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* 座席モデル検索
|
|
108
|
+
*/
|
|
109
|
+
ProductService.prototype.searchProductModels = function (params) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
111
|
+
var _this = this;
|
|
112
|
+
return __generator(this, function (_a) {
|
|
113
|
+
return [2 /*return*/, this.fetch({
|
|
114
|
+
uri: '/productModels',
|
|
115
|
+
method: 'GET',
|
|
116
|
+
qs: params,
|
|
117
|
+
expectedStatusCodes: [http_status_1.OK]
|
|
118
|
+
})
|
|
119
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
120
|
+
return [2 /*return*/, response.json()];
|
|
121
|
+
}); }); })];
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
return ProductService;
|
|
126
|
+
}(service_1.Service));
|
|
127
|
+
exports.ProductService = ProductService;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IAdditionalOptions, IOptions } from '../service';
|
|
2
|
+
import type { PaymentProductService } from './search/paymentService';
|
|
3
|
+
import type { ProductService } from './search/product';
|
|
4
|
+
/**
|
|
5
|
+
* publicリソース検索サービス群
|
|
6
|
+
*/
|
|
7
|
+
export declare namespace service {
|
|
8
|
+
/**
|
|
9
|
+
* 決済商品サービス
|
|
10
|
+
*/
|
|
11
|
+
type PaymentProduct = PaymentProductService;
|
|
12
|
+
namespace PaymentProduct {
|
|
13
|
+
let svc: typeof PaymentProductService | undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* プロダクトサービス
|
|
17
|
+
*/
|
|
18
|
+
type Product = ProductService;
|
|
19
|
+
namespace Product {
|
|
20
|
+
let svc: typeof ProductService | undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* publicリソース検索サービス
|
|
25
|
+
*/
|
|
26
|
+
export declare class CloudSearch {
|
|
27
|
+
options: Pick<IOptions, 'auth' | 'endpoint' | 'disableAutoRetry' | 'defaultPath'>;
|
|
28
|
+
constructor(options: Pick<IOptions, 'auth' | 'endpoint' | 'disableAutoRetry' | 'defaultPath'>);
|
|
29
|
+
/**
|
|
30
|
+
* 決済商品サービスインスタンス生成
|
|
31
|
+
*/
|
|
32
|
+
createPaymentProductInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<PaymentProductService>;
|
|
33
|
+
/**
|
|
34
|
+
* プロダクトサービスインスタンス生成
|
|
35
|
+
*/
|
|
36
|
+
createProductInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ProductService>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.CloudSearch = exports.service = void 0;
|
|
51
|
+
// tslint:disable:max-classes-per-file
|
|
52
|
+
var http_status_1 = require("http-status");
|
|
53
|
+
/**
|
|
54
|
+
* publicリソース検索サービス群
|
|
55
|
+
*/
|
|
56
|
+
var service;
|
|
57
|
+
(function (service) {
|
|
58
|
+
var PaymentProduct;
|
|
59
|
+
(function (PaymentProduct) {
|
|
60
|
+
})(PaymentProduct = service.PaymentProduct || (service.PaymentProduct = {}));
|
|
61
|
+
var Product;
|
|
62
|
+
(function (Product) {
|
|
63
|
+
})(Product = service.Product || (service.Product = {}));
|
|
64
|
+
})(service = exports.service || (exports.service = {}));
|
|
65
|
+
var defaultRetryableStatusCodes = [http_status_1.BAD_GATEWAY, http_status_1.FORBIDDEN, http_status_1.UNAUTHORIZED];
|
|
66
|
+
/**
|
|
67
|
+
* publicリソース検索サービス
|
|
68
|
+
*/
|
|
69
|
+
var CloudSearch = /** @class */ (function () {
|
|
70
|
+
function CloudSearch(options) {
|
|
71
|
+
this.options = options;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 決済商品サービスインスタンス生成
|
|
75
|
+
*/
|
|
76
|
+
CloudSearch.prototype.createPaymentProductInstance = function (params) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
var _a;
|
|
79
|
+
return __generator(this, function (_b) {
|
|
80
|
+
switch (_b.label) {
|
|
81
|
+
case 0:
|
|
82
|
+
if (!(service.PaymentProduct.svc === undefined)) return [3 /*break*/, 2];
|
|
83
|
+
_a = service.PaymentProduct;
|
|
84
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return require('./search/paymentService'); })];
|
|
85
|
+
case 1:
|
|
86
|
+
_a.svc = (_b.sent()).PaymentProductService;
|
|
87
|
+
_b.label = 2;
|
|
88
|
+
case 2: return [2 /*return*/, new service.PaymentProduct.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: defaultRetryableStatusCodes }))];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* プロダクトサービスインスタンス生成
|
|
95
|
+
*/
|
|
96
|
+
CloudSearch.prototype.createProductInstance = function (params) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
+
var _a;
|
|
99
|
+
return __generator(this, function (_b) {
|
|
100
|
+
switch (_b.label) {
|
|
101
|
+
case 0:
|
|
102
|
+
if (!(service.Product.svc === undefined)) return [3 /*break*/, 2];
|
|
103
|
+
_a = service.Product;
|
|
104
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return require('./search/product'); })];
|
|
105
|
+
case 1:
|
|
106
|
+
_a.svc = (_b.sent()).ProductService;
|
|
107
|
+
_b.label = 2;
|
|
108
|
+
case 2: return [2 /*return*/, new service.Product.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: defaultRetryableStatusCodes }))];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
return CloudSearch;
|
|
114
|
+
}());
|
|
115
|
+
exports.CloudSearch = CloudSearch;
|