@cinerino/sdk 5.1.0-alpha.1 → 5.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.
@@ -4,11 +4,13 @@ import type * as ChevreTxn from './chevreTxn';
4
4
  import type { service as Service } from './default';
5
5
  import * as factory from './factory';
6
6
  import type * as Pecorino from './pecorino';
7
+ import type * as WaiterAdmin from './waiterAdmin';
7
8
  import * as transporters from './transporters';
8
9
  export declare function loadChevre(...params: ConstructorParameters<typeof Chevre.Chevre>): Promise<Chevre.Chevre>;
9
10
  export declare function loadChevreAdmin(...params: ConstructorParameters<typeof ChevreAdmin.ChevreAdmin>): Promise<ChevreAdmin.ChevreAdmin>;
10
11
  export declare function loadChevreTxn(...params: ConstructorParameters<typeof ChevreTxn.ChevreTxn>): Promise<ChevreTxn.ChevreTxn>;
11
12
  export declare function loadPecorino(): Promise<typeof Pecorino>;
12
13
  export declare function loadService(): Promise<typeof Service>;
13
- export { factory, Chevre as chevre, ChevreAdmin as chevreAdmin, ChevreTxn as chevreTxn, Pecorino as pecorino, Service as service };
14
+ export declare function loadWaiterAdmin(...params: ConstructorParameters<typeof ChevreAdmin.ChevreAdmin>): Promise<WaiterAdmin.WaiterAdmin>;
15
+ export { factory, Chevre as chevre, ChevreAdmin as chevreAdmin, ChevreTxn as chevreTxn, Pecorino as pecorino, Service as service, WaiterAdmin as waiterAdmin };
14
16
  export { transporters };
@@ -41,7 +41,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
41
41
  return to;
42
42
  };
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.transporters = exports.factory = exports.loadService = exports.loadPecorino = exports.loadChevreTxn = exports.loadChevreAdmin = exports.loadChevre = void 0;
44
+ exports.transporters = exports.factory = exports.loadWaiterAdmin = exports.loadService = exports.loadPecorino = exports.loadChevreTxn = exports.loadChevreAdmin = exports.loadChevre = void 0;
45
45
  var factory = require("./factory");
46
46
  exports.factory = factory;
47
47
  var transporters = require("./transporters");
@@ -153,6 +153,29 @@ function loadService() {
153
153
  });
154
154
  }
155
155
  exports.loadService = loadService;
156
+ var waiterAdmin;
157
+ // tslint:disable-next-line:no-single-line-block-comment
158
+ /* istanbul ignore next */
159
+ function loadWaiterAdmin() {
160
+ var params = [];
161
+ for (var _i = 0; _i < arguments.length; _i++) {
162
+ params[_i] = arguments[_i];
163
+ }
164
+ return __awaiter(this, void 0, void 0, function () {
165
+ return __generator(this, function (_a) {
166
+ switch (_a.label) {
167
+ case 0:
168
+ if (!(waiterAdmin === undefined)) return [3 /*break*/, 2];
169
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./waiterAdmin'); })];
170
+ case 1:
171
+ waiterAdmin = (_a.sent()).WaiterAdmin;
172
+ _a.label = 2;
173
+ case 2: return [2 /*return*/, new (waiterAdmin.bind.apply(waiterAdmin, __spreadArray([void 0], params)))()];
174
+ }
175
+ });
176
+ });
177
+ }
178
+ exports.loadWaiterAdmin = loadWaiterAdmin;
156
179
  // export namespace auth {
157
180
  // /**
158
181
  // * 抽象認証クライアント
@@ -0,0 +1,11 @@
1
+ import * as factory from '../factory';
2
+ import { IOptions, Service } from '../service';
3
+ /**
4
+ * 規則サービス
5
+ */
6
+ export declare class RuleService extends Service<IOptions> {
7
+ /**
8
+ * 検索
9
+ */
10
+ search(params: Omit<factory.waiter.rule.ISearchConditions, 'project'>): Promise<factory.waiter.rule.IRule[]>;
11
+ }
@@ -0,0 +1,86 @@
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.RuleService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ /**
58
+ * 規則サービス
59
+ */
60
+ var RuleService = /** @class */ (function (_super) {
61
+ __extends(RuleService, _super);
62
+ function RuleService() {
63
+ return _super !== null && _super.apply(this, arguments) || this;
64
+ }
65
+ /**
66
+ * 検索
67
+ */
68
+ RuleService.prototype.search = function (params) {
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var _this = this;
71
+ return __generator(this, function (_a) {
72
+ return [2 /*return*/, this.fetch({
73
+ uri: '/rules',
74
+ method: 'GET',
75
+ qs: params,
76
+ expectedStatusCodes: [http_status_1.OK]
77
+ })
78
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
79
+ return [2 /*return*/, response.json()];
80
+ }); }); })];
81
+ });
82
+ });
83
+ };
84
+ return RuleService;
85
+ }(service_1.Service));
86
+ exports.RuleService = RuleService;
@@ -0,0 +1,15 @@
1
+ import * as factory from '../factory';
2
+ import { IOptions, Service } from '../service';
3
+ /**
4
+ * 規則分類サービス
5
+ */
6
+ export declare class RuleSetService extends Service<IOptions> {
7
+ /**
8
+ * 検索
9
+ */
10
+ search(params: Omit<factory.waiter.ruleSet.ISearchConditions, 'project'>): Promise<factory.waiter.ruleSet.IRuleSet[]>;
11
+ /**
12
+ * 編集
13
+ */
14
+ updateByIdentifier(params: Pick<factory.waiter.ruleSet.IRuleSet, 'hasRule' | 'identifier'>): Promise<void>;
15
+ }
@@ -0,0 +1,106 @@
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.RuleSetService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ /**
58
+ * 規則分類サービス
59
+ */
60
+ var RuleSetService = /** @class */ (function (_super) {
61
+ __extends(RuleSetService, _super);
62
+ function RuleSetService() {
63
+ return _super !== null && _super.apply(this, arguments) || this;
64
+ }
65
+ /**
66
+ * 検索
67
+ */
68
+ RuleSetService.prototype.search = function (params) {
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var _this = this;
71
+ return __generator(this, function (_a) {
72
+ return [2 /*return*/, this.fetch({
73
+ uri: '/ruleSets',
74
+ method: 'GET',
75
+ qs: params,
76
+ expectedStatusCodes: [http_status_1.OK]
77
+ })
78
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
79
+ return [2 /*return*/, response.json()];
80
+ }); }); })];
81
+ });
82
+ });
83
+ };
84
+ /**
85
+ * 編集
86
+ */
87
+ RuleSetService.prototype.updateByIdentifier = function (params) {
88
+ return __awaiter(this, void 0, void 0, function () {
89
+ return __generator(this, function (_a) {
90
+ switch (_a.label) {
91
+ case 0: return [4 /*yield*/, this.fetch({
92
+ uri: "/ruleSets/" + params.identifier,
93
+ method: 'PUT',
94
+ body: params,
95
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
96
+ })];
97
+ case 1:
98
+ _a.sent();
99
+ return [2 /*return*/];
100
+ }
101
+ });
102
+ });
103
+ };
104
+ return RuleSetService;
105
+ }(service_1.Service));
106
+ exports.RuleSetService = RuleSetService;
@@ -0,0 +1,22 @@
1
+ import { IOptions } from './service';
2
+ import type { RuleService } from './waiterAdmin/rule';
3
+ import type { RuleSetService } from './waiterAdmin/ruleSet';
4
+ export declare namespace service {
5
+ type Rule = RuleService;
6
+ namespace Rule {
7
+ let svc: typeof RuleService | undefined;
8
+ }
9
+ type RuleSet = RuleSetService;
10
+ namespace RuleSet {
11
+ let svc: typeof RuleSetService | undefined;
12
+ }
13
+ }
14
+ /**
15
+ * 管理
16
+ */
17
+ export declare class WaiterAdmin {
18
+ options: Pick<IOptions, 'auth' | 'endpoint'>;
19
+ constructor(options: Pick<IOptions, 'auth' | 'endpoint'>);
20
+ createRuleInstance(params: Pick<IOptions, 'project'>): Promise<RuleService>;
21
+ createRuleSetInstance(params: Pick<IOptions, 'project'>): Promise<RuleSetService>;
22
+ }
@@ -0,0 +1,103 @@
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.WaiterAdmin = exports.service = void 0;
51
+ var service;
52
+ (function (service) {
53
+ var Rule;
54
+ (function (Rule) {
55
+ })(Rule = service.Rule || (service.Rule = {}));
56
+ var RuleSet;
57
+ (function (RuleSet) {
58
+ })(RuleSet = service.RuleSet || (service.RuleSet = {}));
59
+ })(service = exports.service || (exports.service = {}));
60
+ /**
61
+ * 管理
62
+ */
63
+ var WaiterAdmin = /** @class */ (function () {
64
+ function WaiterAdmin(options) {
65
+ this.options = options;
66
+ }
67
+ WaiterAdmin.prototype.createRuleInstance = function (params) {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ var _a;
70
+ return __generator(this, function (_b) {
71
+ switch (_b.label) {
72
+ case 0:
73
+ if (!(service.Rule.svc === undefined)) return [3 /*break*/, 2];
74
+ _a = service.Rule;
75
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./waiterAdmin/rule'); })];
76
+ case 1:
77
+ _a.svc = (_b.sent()).RuleService;
78
+ _b.label = 2;
79
+ case 2: return [2 /*return*/, new service.Rule.svc(__assign(__assign({}, this.options), params))];
80
+ }
81
+ });
82
+ });
83
+ };
84
+ WaiterAdmin.prototype.createRuleSetInstance = function (params) {
85
+ return __awaiter(this, void 0, void 0, function () {
86
+ var _a;
87
+ return __generator(this, function (_b) {
88
+ switch (_b.label) {
89
+ case 0:
90
+ if (!(service.RuleSet.svc === undefined)) return [3 /*break*/, 2];
91
+ _a = service.RuleSet;
92
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./waiterAdmin/ruleSet'); })];
93
+ case 1:
94
+ _a.svc = (_b.sent()).RuleSetService;
95
+ _b.label = 2;
96
+ case 2: return [2 /*return*/, new service.RuleSet.svc(__assign(__assign({}, this.options), params))];
97
+ }
98
+ });
99
+ });
100
+ };
101
+ return WaiterAdmin;
102
+ }());
103
+ exports.WaiterAdmin = WaiterAdmin;