@cinerino/sdk 5.18.0-alpha.1 → 5.18.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.
@@ -0,0 +1,53 @@
1
+ import * as factory from '../factory';
2
+ import { Service } from '../service';
3
+ declare type ICategory = Pick<factory.categoryCode.ICategoryCode, 'codeValue' | 'inCodeSet'>;
4
+ interface IProductModel {
5
+ id?: string;
6
+ project: {
7
+ id: string;
8
+ typeOf: factory.organizationType.Project;
9
+ };
10
+ typeOf: 'ProductModel';
11
+ category: ICategory;
12
+ name: factory.multilingualString;
13
+ offers: {
14
+ typeOf: factory.offerType.Offer;
15
+ eligibleCustomerType?: {
16
+ codeValue: string;
17
+ }[];
18
+ }[];
19
+ }
20
+ declare type IKeyOfProjection = keyof IProductModel | '_id';
21
+ declare type IProjection = {
22
+ [key in IKeyOfProjection]?: 0 | 1;
23
+ };
24
+ declare type ISearchConditions = Pick<factory.product.ISearchConditions, 'id' | 'limit' | 'page' | 'project'> & {
25
+ category?: {
26
+ codeValue?: {
27
+ $in?: string[];
28
+ };
29
+ inCodeSet?: {
30
+ identifier?: {
31
+ $eq?: string;
32
+ };
33
+ };
34
+ };
35
+ };
36
+ /**
37
+ * プロダクトモデルサービス
38
+ */
39
+ export declare class ProductModelService extends Service {
40
+ create(params: IProductModel): Promise<{
41
+ id: string;
42
+ }>;
43
+ search(params: Omit<ISearchConditions, 'project'> & {
44
+ $projection?: IProjection;
45
+ }): Promise<IProductModel[]>;
46
+ updateById(params: IProductModel & {
47
+ id: string;
48
+ }): Promise<void>;
49
+ deleteById(params: {
50
+ id: string;
51
+ }): Promise<void>;
52
+ }
53
+ export {};
@@ -0,0 +1,132 @@
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.ProductModelService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ /**
58
+ * プロダクトモデルサービス
59
+ */
60
+ var ProductModelService = /** @class */ (function (_super) {
61
+ __extends(ProductModelService, _super);
62
+ function ProductModelService() {
63
+ return _super !== null && _super.apply(this, arguments) || this;
64
+ }
65
+ ProductModelService.prototype.create = function (params) {
66
+ return __awaiter(this, void 0, void 0, function () {
67
+ var _this = this;
68
+ return __generator(this, function (_a) {
69
+ return [2 /*return*/, this.fetch({
70
+ uri: '/productModels',
71
+ method: 'POST',
72
+ body: params,
73
+ expectedStatusCodes: [http_status_1.CREATED]
74
+ })
75
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
76
+ return [2 /*return*/, response.json()];
77
+ }); }); })];
78
+ });
79
+ });
80
+ };
81
+ ProductModelService.prototype.search = function (params) {
82
+ return __awaiter(this, void 0, void 0, function () {
83
+ var _this = this;
84
+ return __generator(this, function (_a) {
85
+ return [2 /*return*/, this.fetch({
86
+ uri: '/productModels',
87
+ method: 'GET',
88
+ qs: params,
89
+ expectedStatusCodes: [http_status_1.OK]
90
+ })
91
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
92
+ return [2 /*return*/, response.json()];
93
+ }); }); })];
94
+ });
95
+ });
96
+ };
97
+ ProductModelService.prototype.updateById = function (params) {
98
+ return __awaiter(this, void 0, void 0, function () {
99
+ return __generator(this, function (_a) {
100
+ switch (_a.label) {
101
+ case 0: return [4 /*yield*/, this.fetch({
102
+ uri: "/productModels/" + encodeURIComponent(String(params.id)),
103
+ method: 'PUT',
104
+ body: params,
105
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
106
+ })];
107
+ case 1:
108
+ _a.sent();
109
+ return [2 /*return*/];
110
+ }
111
+ });
112
+ });
113
+ };
114
+ ProductModelService.prototype.deleteById = function (params) {
115
+ return __awaiter(this, void 0, void 0, function () {
116
+ return __generator(this, function (_a) {
117
+ switch (_a.label) {
118
+ case 0: return [4 /*yield*/, this.fetch({
119
+ uri: "/productModels/" + encodeURIComponent(String(params.id)),
120
+ method: 'DELETE',
121
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
122
+ })];
123
+ case 1:
124
+ _a.sent();
125
+ return [2 /*return*/];
126
+ }
127
+ });
128
+ });
129
+ };
130
+ return ProductModelService;
131
+ }(service_1.Service));
132
+ exports.ProductModelService = ProductModelService;
@@ -42,6 +42,7 @@ import type { PlaceService } from './chevreAdmin/place';
42
42
  import type { HasPOSService } from './chevreAdmin/place/hasPOS';
43
43
  import type { PriceSpecificationService } from './chevreAdmin/priceSpecification';
44
44
  import type { ProductService } from './chevreAdmin/product';
45
+ import type { ProductModelService } from './chevreAdmin/productModel';
45
46
  import type { ProjectService } from './chevreAdmin/project';
46
47
  import type { ProjectMakesOfferService } from './chevreAdmin/projectMakesOffer';
47
48
  import type { ReservationService } from './chevreAdmin/reservation';
@@ -284,6 +285,13 @@ export declare namespace service {
284
285
  namespace Product {
285
286
  let svc: typeof ProductService | undefined;
286
287
  }
288
+ /**
289
+ * プロダクトモデルサービス
290
+ */
291
+ type ProductModel = ProductModelService;
292
+ namespace ProductModel {
293
+ let svc: typeof ProductModelService | undefined;
294
+ }
287
295
  /**
288
296
  * プロジェクトサービス
289
297
  */
@@ -491,6 +499,7 @@ export declare class ChevreAdmin {
491
499
  createHasPOSInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<HasPOSService>;
492
500
  createPriceSpecificationInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<PriceSpecificationService>;
493
501
  createProductInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ProductService>;
502
+ createProductModelInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ProductModelService>;
494
503
  createProjectInstance(): Promise<ProjectService>;
495
504
  createProjectMakesOfferInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ProjectMakesOfferService>;
496
505
  createReservationInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ReservationService>;
@@ -153,6 +153,9 @@ var service;
153
153
  var Product;
154
154
  (function (Product) {
155
155
  })(Product = service.Product || (service.Product = {}));
156
+ var ProductModel;
157
+ (function (ProductModel) {
158
+ })(ProductModel = service.ProductModel || (service.ProductModel = {}));
156
159
  var Project;
157
160
  (function (Project) {
158
161
  })(Project = service.Project || (service.Project = {}));
@@ -783,6 +786,23 @@ var ChevreAdmin = /** @class */ (function () {
783
786
  });
784
787
  });
785
788
  };
789
+ ChevreAdmin.prototype.createProductModelInstance = function (params) {
790
+ return __awaiter(this, void 0, void 0, function () {
791
+ var _a;
792
+ return __generator(this, function (_b) {
793
+ switch (_b.label) {
794
+ case 0:
795
+ if (!(service.ProductModel.svc === undefined)) return [3 /*break*/, 2];
796
+ _a = service.ProductModel;
797
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevreAdmin/productModel'); })];
798
+ case 1:
799
+ _a.svc = (_b.sent()).ProductModelService;
800
+ _b.label = 2;
801
+ case 2: return [2 /*return*/, new service.ProductModel.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: [] }))];
802
+ }
803
+ });
804
+ });
805
+ };
786
806
  ChevreAdmin.prototype.createProjectInstance = function () {
787
807
  return __awaiter(this, void 0, void 0, function () {
788
808
  var _a;