@cinerino/sdk 12.5.0-alpha.10 → 12.5.0-alpha.12
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/src/chevre/admin/findProductHasOfferCatalog.ts +35 -0
- package/lib/abstract/chevreAdmin/product.d.ts +42 -2
- package/lib/abstract/chevreAdmin/product.js +20 -0
- package/lib/abstract/chevreConsole/offerCatalog.d.ts +6 -3
- package/lib/abstract/chevreConsole/offerCatalog.js +13 -8
- package/lib/bundle.js +33 -8
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// tslint:disable:no-implicit-dependencies no-console no-magic-numbers
|
|
2
|
+
import * as client from '../../../../lib/';
|
|
3
|
+
import * as auth from '../../auth/authAsAdmin';
|
|
4
|
+
|
|
5
|
+
const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
const authClient = await auth.login();
|
|
9
|
+
await authClient.refreshAccessToken();
|
|
10
|
+
const loginTicket = authClient.verifyIdToken({});
|
|
11
|
+
console.log('username is', loginTicket.getUsername());
|
|
12
|
+
|
|
13
|
+
const productService = await (await client.loadChevreAdmin({
|
|
14
|
+
endpoint: <string>process.env.CHEVRE_ENDPOINT,
|
|
15
|
+
auth: authClient
|
|
16
|
+
})).createProductInstance({
|
|
17
|
+
project: { id: PROJECT_ID },
|
|
18
|
+
seller: { id: '' }
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const data = await productService.findProductHasOfferCatalog({
|
|
22
|
+
limit: 10,
|
|
23
|
+
page: 1,
|
|
24
|
+
itemOfferedIds: ['656038908b1cd5ce629f5992']
|
|
25
|
+
});
|
|
26
|
+
// tslint:disable-next-line:no-null-keyword
|
|
27
|
+
console.dir(data, { depth: null });
|
|
28
|
+
console.log(data.length);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
main()
|
|
32
|
+
.then(() => {
|
|
33
|
+
console.log('main processed.');
|
|
34
|
+
})
|
|
35
|
+
.catch(console.error);
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import * as factory from '../factory';
|
|
2
2
|
import { Service } from '../service';
|
|
3
|
-
declare type
|
|
4
|
-
|
|
3
|
+
declare type IProductAsFindResult = Pick<factory.product.IProduct, 'description' | 'id' | 'name' | 'productID' | 'serviceOutput' | 'serviceType' | 'typeOf'> & {
|
|
4
|
+
/**
|
|
5
|
+
* プロダクトID
|
|
6
|
+
*/
|
|
5
7
|
id: string;
|
|
6
8
|
project?: never;
|
|
9
|
+
hasOfferCatalog?: never;
|
|
10
|
+
additionalProperty?: never;
|
|
7
11
|
};
|
|
8
12
|
export interface IFindParams {
|
|
9
13
|
/**
|
|
@@ -45,6 +49,38 @@ export interface IFindParams {
|
|
|
45
49
|
serviceOutputAmountCurrency?: string;
|
|
46
50
|
additionalPropertyName?: string;
|
|
47
51
|
}
|
|
52
|
+
interface IFindProductHasOfferCatalogParams {
|
|
53
|
+
/**
|
|
54
|
+
* max: 20
|
|
55
|
+
*/
|
|
56
|
+
limit: number;
|
|
57
|
+
/**
|
|
58
|
+
* min: 1
|
|
59
|
+
*/
|
|
60
|
+
page: number;
|
|
61
|
+
/**
|
|
62
|
+
* プロダクトIDリスト
|
|
63
|
+
*/
|
|
64
|
+
itemOfferedIds?: string[];
|
|
65
|
+
}
|
|
66
|
+
interface IOfferCatalogAsFindResult {
|
|
67
|
+
/**
|
|
68
|
+
* カタログID
|
|
69
|
+
*/
|
|
70
|
+
id: string;
|
|
71
|
+
/**
|
|
72
|
+
* 対象オファー
|
|
73
|
+
*/
|
|
74
|
+
aggregateElement: {
|
|
75
|
+
itemOffered: {
|
|
76
|
+
/**
|
|
77
|
+
* プロダクトID
|
|
78
|
+
*/
|
|
79
|
+
id: string;
|
|
80
|
+
typeOf: factory.product.ProductType;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}
|
|
48
84
|
/**
|
|
49
85
|
* プロダクトサービス
|
|
50
86
|
*/
|
|
@@ -61,5 +97,9 @@ export declare class ProductService extends Service {
|
|
|
61
97
|
* 2025-10-14~
|
|
62
98
|
*/
|
|
63
99
|
findProducts(params: IFindParams): Promise<IProductAsFindResult[]>;
|
|
100
|
+
/**
|
|
101
|
+
* プロダクトオファーカタログ検索
|
|
102
|
+
*/
|
|
103
|
+
findProductHasOfferCatalog(params: IFindProductHasOfferCatalogParams): Promise<IOfferCatalogAsFindResult[]>;
|
|
64
104
|
}
|
|
65
105
|
export {};
|
|
@@ -55,6 +55,7 @@ exports.ProductService = void 0;
|
|
|
55
55
|
var http_status_1 = require("http-status");
|
|
56
56
|
var service_1 = require("../service");
|
|
57
57
|
var BASE_URI = '/products';
|
|
58
|
+
var BASE_URI_HAS_OFFER_CATALOG = '/productHasOfferCatalog';
|
|
58
59
|
/**
|
|
59
60
|
* プロダクトサービス
|
|
60
61
|
*/
|
|
@@ -106,6 +107,25 @@ var ProductService = /** @class */ (function (_super) {
|
|
|
106
107
|
});
|
|
107
108
|
});
|
|
108
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* プロダクトオファーカタログ検索
|
|
112
|
+
*/
|
|
113
|
+
ProductService.prototype.findProductHasOfferCatalog = function (params) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
115
|
+
var _this = this;
|
|
116
|
+
return __generator(this, function (_a) {
|
|
117
|
+
return [2 /*return*/, this.fetch({
|
|
118
|
+
uri: BASE_URI_HAS_OFFER_CATALOG,
|
|
119
|
+
method: 'GET',
|
|
120
|
+
qs: params,
|
|
121
|
+
expectedStatusCodes: [http_status_1.OK]
|
|
122
|
+
})
|
|
123
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
124
|
+
return [2 /*return*/, response.json()];
|
|
125
|
+
}); }); })];
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
};
|
|
109
129
|
return ProductService;
|
|
110
130
|
}(service_1.Service));
|
|
111
131
|
exports.ProductService = ProductService;
|
|
@@ -39,15 +39,16 @@ export declare class OfferCatalogService extends Service {
|
|
|
39
39
|
id: string;
|
|
40
40
|
}): Promise<void>;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* IDリストでカタログ複数編集
|
|
43
|
+
* 要素のpush,pullを同時指定した場合400
|
|
43
44
|
*/
|
|
44
|
-
|
|
45
|
+
updateManyOfferCatalogsByIds(params: {
|
|
45
46
|
id: {
|
|
46
47
|
$in: string[];
|
|
47
48
|
};
|
|
48
49
|
$push: {
|
|
49
50
|
itemListElement: {
|
|
50
|
-
$each: factory.offerCatalog.
|
|
51
|
+
$each: factory.offerCatalog.IItemListElementAsAggregateOffer[];
|
|
51
52
|
};
|
|
52
53
|
};
|
|
53
54
|
$pull: {
|
|
@@ -59,6 +60,8 @@ export declare class OfferCatalogService extends Service {
|
|
|
59
60
|
};
|
|
60
61
|
};
|
|
61
62
|
};
|
|
63
|
+
}, options: {
|
|
64
|
+
itemOfferedTypeOf: factory.product.ProductType;
|
|
62
65
|
}): Promise<void>;
|
|
63
66
|
/**
|
|
64
67
|
* カタログ削除
|
|
@@ -132,18 +132,23 @@ var OfferCatalogService = /** @class */ (function (_super) {
|
|
|
132
132
|
});
|
|
133
133
|
};
|
|
134
134
|
/**
|
|
135
|
-
*
|
|
135
|
+
* IDリストでカタログ複数編集
|
|
136
|
+
* 要素のpush,pullを同時指定した場合400
|
|
136
137
|
*/
|
|
137
|
-
OfferCatalogService.prototype.
|
|
138
|
+
OfferCatalogService.prototype.updateManyOfferCatalogsByIds = function (params, options) {
|
|
138
139
|
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
+
var itemOfferedTypeOf;
|
|
139
141
|
return __generator(this, function (_a) {
|
|
140
142
|
switch (_a.label) {
|
|
141
|
-
case 0:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
case 0:
|
|
144
|
+
itemOfferedTypeOf = options.itemOfferedTypeOf;
|
|
145
|
+
return [4 /*yield*/, this.fetch({
|
|
146
|
+
uri: "/offerCatalogs",
|
|
147
|
+
method: 'PATCH',
|
|
148
|
+
body: params,
|
|
149
|
+
qs: { itemOfferedTypeOf: itemOfferedTypeOf },
|
|
150
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
151
|
+
})];
|
|
147
152
|
case 1:
|
|
148
153
|
_a.sent();
|
|
149
154
|
return [2 /*return*/];
|
package/lib/bundle.js
CHANGED
|
@@ -4036,6 +4036,7 @@ exports.ProductService = void 0;
|
|
|
4036
4036
|
var http_status_1 = require("http-status");
|
|
4037
4037
|
var service_1 = require("../service");
|
|
4038
4038
|
var BASE_URI = '/products';
|
|
4039
|
+
var BASE_URI_HAS_OFFER_CATALOG = '/productHasOfferCatalog';
|
|
4039
4040
|
/**
|
|
4040
4041
|
* プロダクトサービス
|
|
4041
4042
|
*/
|
|
@@ -4087,6 +4088,25 @@ var ProductService = /** @class */ (function (_super) {
|
|
|
4087
4088
|
});
|
|
4088
4089
|
});
|
|
4089
4090
|
};
|
|
4091
|
+
/**
|
|
4092
|
+
* プロダクトオファーカタログ検索
|
|
4093
|
+
*/
|
|
4094
|
+
ProductService.prototype.findProductHasOfferCatalog = function (params) {
|
|
4095
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4096
|
+
var _this = this;
|
|
4097
|
+
return __generator(this, function (_a) {
|
|
4098
|
+
return [2 /*return*/, this.fetch({
|
|
4099
|
+
uri: BASE_URI_HAS_OFFER_CATALOG,
|
|
4100
|
+
method: 'GET',
|
|
4101
|
+
qs: params,
|
|
4102
|
+
expectedStatusCodes: [http_status_1.OK]
|
|
4103
|
+
})
|
|
4104
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
4105
|
+
return [2 /*return*/, response.json()];
|
|
4106
|
+
}); }); })];
|
|
4107
|
+
});
|
|
4108
|
+
});
|
|
4109
|
+
};
|
|
4090
4110
|
return ProductService;
|
|
4091
4111
|
}(service_1.Service));
|
|
4092
4112
|
exports.ProductService = ProductService;
|
|
@@ -12318,18 +12338,23 @@ var OfferCatalogService = /** @class */ (function (_super) {
|
|
|
12318
12338
|
});
|
|
12319
12339
|
};
|
|
12320
12340
|
/**
|
|
12321
|
-
*
|
|
12341
|
+
* IDリストでカタログ複数編集
|
|
12342
|
+
* 要素のpush,pullを同時指定した場合400
|
|
12322
12343
|
*/
|
|
12323
|
-
OfferCatalogService.prototype.
|
|
12344
|
+
OfferCatalogService.prototype.updateManyOfferCatalogsByIds = function (params, options) {
|
|
12324
12345
|
return __awaiter(this, void 0, void 0, function () {
|
|
12346
|
+
var itemOfferedTypeOf;
|
|
12325
12347
|
return __generator(this, function (_a) {
|
|
12326
12348
|
switch (_a.label) {
|
|
12327
|
-
case 0:
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12349
|
+
case 0:
|
|
12350
|
+
itemOfferedTypeOf = options.itemOfferedTypeOf;
|
|
12351
|
+
return [4 /*yield*/, this.fetch({
|
|
12352
|
+
uri: "/offerCatalogs",
|
|
12353
|
+
method: 'PATCH',
|
|
12354
|
+
body: params,
|
|
12355
|
+
qs: { itemOfferedTypeOf: itemOfferedTypeOf },
|
|
12356
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
12357
|
+
})];
|
|
12333
12358
|
case 1:
|
|
12334
12359
|
_a.sent();
|
|
12335
12360
|
return [2 /*return*/];
|