@rxap/open-api 12.4.0 → 13.0.0-next.10
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/data-source/package.json +5 -5
- package/data-source/table/package.json +5 -5
- package/esm2020/data-source/lib/error.mjs +8 -0
- package/esm2020/data-source/lib/open-api-data-source.loader.mjs +36 -0
- package/esm2020/data-source/lib/open-api.data-source.mjs +140 -0
- package/esm2020/data-source/public_api.mjs +6 -0
- package/esm2020/data-source/rxap-open-api-data-source.mjs +5 -0
- package/esm2020/data-source/table/lib/error.mjs +8 -0
- package/esm2020/data-source/table/lib/open-api-table.data-source.mjs +127 -0
- package/esm2020/data-source/table/lib/to-open-api-table-data-source.pipe.mjs +29 -0
- package/esm2020/data-source/table/lib/tokens.mjs +3 -0
- package/esm2020/data-source/table/public_api.mjs +5 -0
- package/esm2020/data-source/table/rxap-open-api-data-source-table.mjs +5 -0
- package/esm2020/index.mjs +7 -0
- package/esm2020/lib/error.mjs +7 -0
- package/esm2020/lib/open-api-config.service.mjs +160 -0
- package/esm2020/lib/open-api.mjs +2 -0
- package/esm2020/lib/schema-validation.mixin.mjs +256 -0
- package/esm2020/lib/tokens.mjs +8 -0
- package/esm2020/lib/utilities.mjs +16 -0
- package/esm2020/remote-method/lib/error.mjs +8 -0
- package/esm2020/remote-method/lib/open-api-remote-method.loader.mjs +37 -0
- package/esm2020/remote-method/lib/open-api.remote-method.mjs +145 -0
- package/esm2020/remote-method/public_api.mjs +4 -0
- package/esm2020/remote-method/rxap-open-api-remote-method.mjs +5 -0
- package/esm2020/rxap-open-api.mjs +5 -0
- package/fesm2015/rxap-open-api-data-source-table.mjs +172 -0
- package/fesm2015/rxap-open-api-data-source-table.mjs.map +1 -0
- package/{esm2015/data-source/lib/open-api.data-source.js → fesm2015/rxap-open-api-data-source.mjs} +96 -49
- package/fesm2015/rxap-open-api-data-source.mjs.map +1 -0
- package/fesm2015/rxap-open-api-remote-method.mjs +201 -0
- package/fesm2015/rxap-open-api-remote-method.mjs.map +1 -0
- package/fesm2015/{rxap-open-api.js → rxap-open-api.mjs} +55 -20
- package/fesm2015/rxap-open-api.mjs.map +1 -0
- package/{fesm2015/rxap-open-api-data-source-table.js → fesm2020/rxap-open-api-data-source-table.mjs} +18 -20
- package/fesm2020/rxap-open-api-data-source-table.mjs.map +1 -0
- package/{fesm2015/rxap-open-api-data-source.js → fesm2020/rxap-open-api-data-source.mjs} +17 -18
- package/fesm2020/rxap-open-api-data-source.mjs.map +1 -0
- package/{fesm2015/rxap-open-api-remote-method.js → fesm2020/rxap-open-api-remote-method.mjs} +50 -46
- package/fesm2020/rxap-open-api-remote-method.mjs.map +1 -0
- package/{esm2015/lib/schema-validation.mixin.js → fesm2020/rxap-open-api.mjs} +197 -8
- package/fesm2020/rxap-open-api.mjs.map +1 -0
- package/lib/open-api-config.service.d.ts +6 -4
- package/package.json +60 -22
- package/remote-method/lib/open-api.remote-method.d.ts +16 -1
- package/remote-method/package.json +5 -5
- package/src/schematics/open-api/coerce-open-api-project.js +4 -3
- package/src/schematics/open-api/coerce-open-api-project.js.map +1 -1
- package/src/schematics/open-api/create-directive.js +6 -7
- package/src/schematics/open-api/create-directive.js.map +1 -1
- package/src/schematics/open-api/generate-data-source.js +1 -1
- package/src/schematics/open-api/generate-remote-method.js +5 -2
- package/src/schematics/open-api/generate-remote-method.js.map +1 -1
- package/src/schematics/open-api/index.js +1 -1
- package/src/schematics/open-api/schema.json +6 -0
- package/bundles/rxap-open-api-data-source-table.umd.js +0 -534
- package/bundles/rxap-open-api-data-source-table.umd.js.map +0 -1
- package/bundles/rxap-open-api-data-source.umd.js +0 -548
- package/bundles/rxap-open-api-data-source.umd.js.map +0 -1
- package/bundles/rxap-open-api-remote-method.umd.js +0 -557
- package/bundles/rxap-open-api-remote-method.umd.js.map +0 -1
- package/bundles/rxap-open-api.umd.js +0 -868
- package/bundles/rxap-open-api.umd.js.map +0 -1
- package/esm2015/data-source/lib/error.js +0 -8
- package/esm2015/data-source/lib/error.js.map +0 -1
- package/esm2015/data-source/lib/open-api-data-source.loader.js +0 -36
- package/esm2015/data-source/lib/open-api-data-source.loader.js.map +0 -1
- package/esm2015/data-source/lib/open-api.data-source.js.map +0 -1
- package/esm2015/data-source/public_api.js +0 -6
- package/esm2015/data-source/public_api.js.map +0 -1
- package/esm2015/data-source/rxap-open-api-data-source.js +0 -5
- package/esm2015/data-source/rxap-open-api-data-source.js.map +0 -1
- package/esm2015/data-source/table/lib/error.js +0 -8
- package/esm2015/data-source/table/lib/error.js.map +0 -1
- package/esm2015/data-source/table/lib/open-api-table.data-source.js +0 -129
- package/esm2015/data-source/table/lib/open-api-table.data-source.js.map +0 -1
- package/esm2015/data-source/table/lib/to-open-api-table-data-source.pipe.js +0 -29
- package/esm2015/data-source/table/lib/to-open-api-table-data-source.pipe.js.map +0 -1
- package/esm2015/data-source/table/lib/tokens.js +0 -3
- package/esm2015/data-source/table/lib/tokens.js.map +0 -1
- package/esm2015/data-source/table/public_api.js +0 -5
- package/esm2015/data-source/table/public_api.js.map +0 -1
- package/esm2015/data-source/table/rxap-open-api-data-source-table.js +0 -5
- package/esm2015/data-source/table/rxap-open-api-data-source-table.js.map +0 -1
- package/esm2015/index.js +0 -7
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/error.js +0 -7
- package/esm2015/lib/error.js.map +0 -1
- package/esm2015/lib/open-api-config.service.js +0 -127
- package/esm2015/lib/open-api-config.service.js.map +0 -1
- package/esm2015/lib/open-api.js +0 -2
- package/esm2015/lib/open-api.js.map +0 -1
- package/esm2015/lib/schema-validation.mixin.js.map +0 -1
- package/esm2015/lib/tokens.js +0 -8
- package/esm2015/lib/tokens.js.map +0 -1
- package/esm2015/lib/utilities.js +0 -16
- package/esm2015/lib/utilities.js.map +0 -1
- package/esm2015/remote-method/lib/error.js +0 -8
- package/esm2015/remote-method/lib/error.js.map +0 -1
- package/esm2015/remote-method/lib/open-api-remote-method.loader.js +0 -37
- package/esm2015/remote-method/lib/open-api-remote-method.loader.js.map +0 -1
- package/esm2015/remote-method/lib/open-api.remote-method.js +0 -141
- package/esm2015/remote-method/lib/open-api.remote-method.js.map +0 -1
- package/esm2015/remote-method/public_api.js +0 -4
- package/esm2015/remote-method/public_api.js.map +0 -1
- package/esm2015/remote-method/rxap-open-api-remote-method.js +0 -5
- package/esm2015/remote-method/rxap-open-api-remote-method.js.map +0 -1
- package/esm2015/rxap-open-api.js +0 -5
- package/esm2015/rxap-open-api.js.map +0 -1
- package/fesm2015/rxap-open-api-data-source-table.js.map +0 -1
- package/fesm2015/rxap-open-api-data-source.js.map +0 -1
- package/fesm2015/rxap-open-api-remote-method.js.map +0 -1
- package/fesm2015/rxap-open-api.js.map +0 -1
|
@@ -1,868 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@rxap/utilities'), require('ajv-oai'), require('@angular/common/http')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@rxap/open-api', ['exports', '@angular/core', '@rxap/utilities', 'ajv-oai', '@angular/common/http'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.rxap = global.rxap || {}, global.rxap["open-api"] = {}), global.ng.core, global.utilities, global.Ajv, global.ng.common.http));
|
|
5
|
-
})(this, (function (exports, i0, utilities, Ajv, http) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function _interopNamespace(e) {
|
|
8
|
-
if (e && e.__esModule) return e;
|
|
9
|
-
var n = Object.create(null);
|
|
10
|
-
if (e) {
|
|
11
|
-
Object.keys(e).forEach(function (k) {
|
|
12
|
-
if (k !== 'default') {
|
|
13
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () { return e[k]; }
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
n["default"] = e;
|
|
22
|
-
return Object.freeze(n);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
26
|
-
var Ajv__namespace = /*#__PURE__*/_interopNamespace(Ajv);
|
|
27
|
-
|
|
28
|
-
/*! *****************************************************************************
|
|
29
|
-
Copyright (c) Microsoft Corporation.
|
|
30
|
-
|
|
31
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
32
|
-
purpose with or without fee is hereby granted.
|
|
33
|
-
|
|
34
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
35
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
36
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
37
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
38
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
39
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
40
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
41
|
-
***************************************************************************** */
|
|
42
|
-
/* global Reflect, Promise */
|
|
43
|
-
var extendStatics = function (d, b) {
|
|
44
|
-
extendStatics = Object.setPrototypeOf ||
|
|
45
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
46
|
-
function (d, b) { for (var p in b)
|
|
47
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
48
|
-
d[p] = b[p]; };
|
|
49
|
-
return extendStatics(d, b);
|
|
50
|
-
};
|
|
51
|
-
function __extends(d, b) {
|
|
52
|
-
if (typeof b !== "function" && b !== null)
|
|
53
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
54
|
-
extendStatics(d, b);
|
|
55
|
-
function __() { this.constructor = d; }
|
|
56
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
57
|
-
}
|
|
58
|
-
var __assign = function () {
|
|
59
|
-
__assign = Object.assign || function __assign(t) {
|
|
60
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
61
|
-
s = arguments[i];
|
|
62
|
-
for (var p in s)
|
|
63
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
64
|
-
t[p] = s[p];
|
|
65
|
-
}
|
|
66
|
-
return t;
|
|
67
|
-
};
|
|
68
|
-
return __assign.apply(this, arguments);
|
|
69
|
-
};
|
|
70
|
-
function __rest(s, e) {
|
|
71
|
-
var t = {};
|
|
72
|
-
for (var p in s)
|
|
73
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
74
|
-
t[p] = s[p];
|
|
75
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
76
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
77
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
78
|
-
t[p[i]] = s[p[i]];
|
|
79
|
-
}
|
|
80
|
-
return t;
|
|
81
|
-
}
|
|
82
|
-
function __decorate(decorators, target, key, desc) {
|
|
83
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
84
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
85
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
86
|
-
else
|
|
87
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
88
|
-
if (d = decorators[i])
|
|
89
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
90
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
91
|
-
}
|
|
92
|
-
function __param(paramIndex, decorator) {
|
|
93
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
|
94
|
-
}
|
|
95
|
-
function __metadata(metadataKey, metadataValue) {
|
|
96
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
97
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
98
|
-
}
|
|
99
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
100
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
101
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
102
|
-
function fulfilled(value) { try {
|
|
103
|
-
step(generator.next(value));
|
|
104
|
-
}
|
|
105
|
-
catch (e) {
|
|
106
|
-
reject(e);
|
|
107
|
-
} }
|
|
108
|
-
function rejected(value) { try {
|
|
109
|
-
step(generator["throw"](value));
|
|
110
|
-
}
|
|
111
|
-
catch (e) {
|
|
112
|
-
reject(e);
|
|
113
|
-
} }
|
|
114
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
115
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
function __generator(thisArg, body) {
|
|
119
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
120
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
121
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
122
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
123
|
-
function step(op) {
|
|
124
|
-
if (f)
|
|
125
|
-
throw new TypeError("Generator is already executing.");
|
|
126
|
-
while (_)
|
|
127
|
-
try {
|
|
128
|
-
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)
|
|
129
|
-
return t;
|
|
130
|
-
if (y = 0, t)
|
|
131
|
-
op = [op[0] & 2, t.value];
|
|
132
|
-
switch (op[0]) {
|
|
133
|
-
case 0:
|
|
134
|
-
case 1:
|
|
135
|
-
t = op;
|
|
136
|
-
break;
|
|
137
|
-
case 4:
|
|
138
|
-
_.label++;
|
|
139
|
-
return { value: op[1], done: false };
|
|
140
|
-
case 5:
|
|
141
|
-
_.label++;
|
|
142
|
-
y = op[1];
|
|
143
|
-
op = [0];
|
|
144
|
-
continue;
|
|
145
|
-
case 7:
|
|
146
|
-
op = _.ops.pop();
|
|
147
|
-
_.trys.pop();
|
|
148
|
-
continue;
|
|
149
|
-
default:
|
|
150
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
151
|
-
_ = 0;
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
155
|
-
_.label = op[1];
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
159
|
-
_.label = t[1];
|
|
160
|
-
t = op;
|
|
161
|
-
break;
|
|
162
|
-
}
|
|
163
|
-
if (t && _.label < t[2]) {
|
|
164
|
-
_.label = t[2];
|
|
165
|
-
_.ops.push(op);
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
if (t[2])
|
|
169
|
-
_.ops.pop();
|
|
170
|
-
_.trys.pop();
|
|
171
|
-
continue;
|
|
172
|
-
}
|
|
173
|
-
op = body.call(thisArg, _);
|
|
174
|
-
}
|
|
175
|
-
catch (e) {
|
|
176
|
-
op = [6, e];
|
|
177
|
-
y = 0;
|
|
178
|
-
}
|
|
179
|
-
finally {
|
|
180
|
-
f = t = 0;
|
|
181
|
-
}
|
|
182
|
-
if (op[0] & 5)
|
|
183
|
-
throw op[1];
|
|
184
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
188
|
-
if (k2 === undefined)
|
|
189
|
-
k2 = k;
|
|
190
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
191
|
-
}) : (function (o, m, k, k2) {
|
|
192
|
-
if (k2 === undefined)
|
|
193
|
-
k2 = k;
|
|
194
|
-
o[k2] = m[k];
|
|
195
|
-
});
|
|
196
|
-
function __exportStar(m, o) {
|
|
197
|
-
for (var p in m)
|
|
198
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
199
|
-
__createBinding(o, m, p);
|
|
200
|
-
}
|
|
201
|
-
function __values(o) {
|
|
202
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
203
|
-
if (m)
|
|
204
|
-
return m.call(o);
|
|
205
|
-
if (o && typeof o.length === "number")
|
|
206
|
-
return {
|
|
207
|
-
next: function () {
|
|
208
|
-
if (o && i >= o.length)
|
|
209
|
-
o = void 0;
|
|
210
|
-
return { value: o && o[i++], done: !o };
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
214
|
-
}
|
|
215
|
-
function __read(o, n) {
|
|
216
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
217
|
-
if (!m)
|
|
218
|
-
return o;
|
|
219
|
-
var i = m.call(o), r, ar = [], e;
|
|
220
|
-
try {
|
|
221
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
222
|
-
ar.push(r.value);
|
|
223
|
-
}
|
|
224
|
-
catch (error) {
|
|
225
|
-
e = { error: error };
|
|
226
|
-
}
|
|
227
|
-
finally {
|
|
228
|
-
try {
|
|
229
|
-
if (r && !r.done && (m = i["return"]))
|
|
230
|
-
m.call(i);
|
|
231
|
-
}
|
|
232
|
-
finally {
|
|
233
|
-
if (e)
|
|
234
|
-
throw e.error;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
return ar;
|
|
238
|
-
}
|
|
239
|
-
/** @deprecated */
|
|
240
|
-
function __spread() {
|
|
241
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
242
|
-
ar = ar.concat(__read(arguments[i]));
|
|
243
|
-
return ar;
|
|
244
|
-
}
|
|
245
|
-
/** @deprecated */
|
|
246
|
-
function __spreadArrays() {
|
|
247
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
248
|
-
s += arguments[i].length;
|
|
249
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
250
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
251
|
-
r[k] = a[j];
|
|
252
|
-
return r;
|
|
253
|
-
}
|
|
254
|
-
function __spreadArray(to, from) {
|
|
255
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
256
|
-
to[j] = from[i];
|
|
257
|
-
return to;
|
|
258
|
-
}
|
|
259
|
-
function __await(v) {
|
|
260
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
261
|
-
}
|
|
262
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
263
|
-
if (!Symbol.asyncIterator)
|
|
264
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
265
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
266
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
267
|
-
function verb(n) { if (g[n])
|
|
268
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
269
|
-
function resume(n, v) { try {
|
|
270
|
-
step(g[n](v));
|
|
271
|
-
}
|
|
272
|
-
catch (e) {
|
|
273
|
-
settle(q[0][3], e);
|
|
274
|
-
} }
|
|
275
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
276
|
-
function fulfill(value) { resume("next", value); }
|
|
277
|
-
function reject(value) { resume("throw", value); }
|
|
278
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
279
|
-
resume(q[0][0], q[0][1]); }
|
|
280
|
-
}
|
|
281
|
-
function __asyncDelegator(o) {
|
|
282
|
-
var i, p;
|
|
283
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
284
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
285
|
-
}
|
|
286
|
-
function __asyncValues(o) {
|
|
287
|
-
if (!Symbol.asyncIterator)
|
|
288
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
289
|
-
var m = o[Symbol.asyncIterator], i;
|
|
290
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
291
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
292
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
293
|
-
}
|
|
294
|
-
function __makeTemplateObject(cooked, raw) {
|
|
295
|
-
if (Object.defineProperty) {
|
|
296
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
cooked.raw = raw;
|
|
300
|
-
}
|
|
301
|
-
return cooked;
|
|
302
|
-
}
|
|
303
|
-
;
|
|
304
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
305
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
306
|
-
}) : function (o, v) {
|
|
307
|
-
o["default"] = v;
|
|
308
|
-
};
|
|
309
|
-
function __importStar(mod) {
|
|
310
|
-
if (mod && mod.__esModule)
|
|
311
|
-
return mod;
|
|
312
|
-
var result = {};
|
|
313
|
-
if (mod != null)
|
|
314
|
-
for (var k in mod)
|
|
315
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
316
|
-
__createBinding(result, mod, k);
|
|
317
|
-
__setModuleDefault(result, mod);
|
|
318
|
-
return result;
|
|
319
|
-
}
|
|
320
|
-
function __importDefault(mod) {
|
|
321
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
322
|
-
}
|
|
323
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
324
|
-
if (kind === "a" && !f)
|
|
325
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
326
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
327
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
328
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
329
|
-
}
|
|
330
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
331
|
-
if (kind === "m")
|
|
332
|
-
throw new TypeError("Private method is not writable");
|
|
333
|
-
if (kind === "a" && !f)
|
|
334
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
335
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
336
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
337
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
var RXAP_OPEN_API_CONFIG = new i0.InjectionToken('rxap/open-api/config');
|
|
341
|
-
var RXAP_OPEN_API_STRICT_VALIDATOR = new i0.InjectionToken('rxap/open-api/strict-validator');
|
|
342
|
-
var DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA = new i0.InjectionToken('rxap/open-api/default-remote-method-meta-data');
|
|
343
|
-
var DEFAULT_OPEN_API_DATA_SOURCE_META_DATA = new i0.InjectionToken('rxap/open-api/default-data-source-meta-data');
|
|
344
|
-
var DISABLE_SCHEMA_VALIDATION = new i0.InjectionToken('rxap/open-api/disable-schema-validation');
|
|
345
|
-
var DISABLE_VALIDATION = new i0.InjectionToken('rxap/open-api/disable-validation');
|
|
346
|
-
|
|
347
|
-
var RxapOpenApiError = /** @class */ (function (_super) {
|
|
348
|
-
__extends(RxapOpenApiError, _super);
|
|
349
|
-
function RxapOpenApiError(message, code, scope) {
|
|
350
|
-
return _super.call(this, '@rxap/open-api', message, code !== null && code !== void 0 ? code : '', scope) || this;
|
|
351
|
-
}
|
|
352
|
-
return RxapOpenApiError;
|
|
353
|
-
}(utilities.RxapError));
|
|
354
|
-
|
|
355
|
-
function IsReferenceObject(obj) {
|
|
356
|
-
return !!obj && obj.hasOwnProperty('$ref');
|
|
357
|
-
}
|
|
358
|
-
function NotContainsReferenceObjects(array) {
|
|
359
|
-
return !!array && array.every(function (item) { return !IsReferenceObject(item) && !!item; });
|
|
360
|
-
}
|
|
361
|
-
function IsOpenApiV3(obj) {
|
|
362
|
-
return !!obj && obj.hasOwnProperty('openapi') && obj.openapi.match(/^3\./);
|
|
363
|
-
}
|
|
364
|
-
function AssertOpenApiV3(obj) {
|
|
365
|
-
if (!IsOpenApiV3(obj)) {
|
|
366
|
-
throw new RxapOpenApiError('Only openapi version 3.x.x is supported');
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
var OpenApiConfigService = /** @class */ (function () {
|
|
371
|
-
function OpenApiConfigService(config) {
|
|
372
|
-
if (config === void 0) { config = null; }
|
|
373
|
-
this.defaultServerIndex = OpenApiConfigService.DefaultServerIndex;
|
|
374
|
-
config = config !== null && config !== void 0 ? config : OpenApiConfigService.Config;
|
|
375
|
-
if (!config) {
|
|
376
|
-
throw new Error('Could not load open api config');
|
|
377
|
-
}
|
|
378
|
-
this.config = config;
|
|
379
|
-
this._operations = OpenApiConfigService.LoadOperations(config);
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Used to load the app open api config from a remote resource.
|
|
383
|
-
*
|
|
384
|
-
* Promise.all([ OpenApiDataSourceLoader.Load() ])
|
|
385
|
-
* .then(() => platformBrowserDynamic().bootstrapModule(AppModule))
|
|
386
|
-
* .catch(err => console.error(err))
|
|
387
|
-
*
|
|
388
|
-
*/
|
|
389
|
-
OpenApiConfigService.Load = function (openApiUrl) {
|
|
390
|
-
if (openApiUrl === void 0) { openApiUrl = 'openapi.json'; }
|
|
391
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
392
|
-
var config, response, error_1, expandedConfig;
|
|
393
|
-
return __generator(this, function (_a) {
|
|
394
|
-
switch (_a.label) {
|
|
395
|
-
case 0:
|
|
396
|
-
if (!openApiUrl) {
|
|
397
|
-
throw new Error('The open api url is not defined!');
|
|
398
|
-
}
|
|
399
|
-
config = null;
|
|
400
|
-
_a.label = 1;
|
|
401
|
-
case 1:
|
|
402
|
-
_a.trys.push([1, 4, , 5]);
|
|
403
|
-
return [4 /*yield*/, fetch(openApiUrl)];
|
|
404
|
-
case 2:
|
|
405
|
-
response = _a.sent();
|
|
406
|
-
return [4 /*yield*/, response.json()];
|
|
407
|
-
case 3:
|
|
408
|
-
config = _a.sent();
|
|
409
|
-
return [3 /*break*/, 5];
|
|
410
|
-
case 4:
|
|
411
|
-
error_1 = _a.sent();
|
|
412
|
-
console.debug("Could not load the open api config from '" + openApiUrl + "'!", error_1);
|
|
413
|
-
console.error("Could not load the open api config from '" + openApiUrl + "'!", error_1.message);
|
|
414
|
-
return [3 /*break*/, 5];
|
|
415
|
-
case 5:
|
|
416
|
-
if (!config) return [3 /*break*/, 7];
|
|
417
|
-
return [4 /*yield*/, this.ExpandOpenApi(config)];
|
|
418
|
-
case 6:
|
|
419
|
-
expandedConfig = _a.sent();
|
|
420
|
-
AssertOpenApiV3(expandedConfig);
|
|
421
|
-
this.Config = expandedConfig;
|
|
422
|
-
return [3 /*break*/, 8];
|
|
423
|
-
case 7:
|
|
424
|
-
this.Config = null;
|
|
425
|
-
_a.label = 8;
|
|
426
|
-
case 8: return [2 /*return*/];
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
|
-
});
|
|
430
|
-
};
|
|
431
|
-
OpenApiConfigService.GetOperation = function (operationId) {
|
|
432
|
-
if (!this.Config) {
|
|
433
|
-
throw new Error('Could not load open api config');
|
|
434
|
-
}
|
|
435
|
-
if (!this._operations) {
|
|
436
|
-
this._operations = this.LoadOperations(this.Config);
|
|
437
|
-
}
|
|
438
|
-
if (!this._operations.has(operationId)) {
|
|
439
|
-
throw new Error("The operation '" + operationId + "' is not defined in the openapi-json");
|
|
440
|
-
}
|
|
441
|
-
return this._operations.get(operationId);
|
|
442
|
-
};
|
|
443
|
-
OpenApiConfigService.LoadOperations = function (config) {
|
|
444
|
-
var operations = new Map();
|
|
445
|
-
Object.entries(config.paths)
|
|
446
|
-
.filter(function (item) { return item[0] !== undefined; })
|
|
447
|
-
.filter(function (_a) {
|
|
448
|
-
var _b = __read(_a, 2), _ = _b[0], methods = _b[1];
|
|
449
|
-
return methods &&
|
|
450
|
-
Object.keys(methods).some(function (method) { return ['get', 'put', 'post', 'delete', 'patch'].includes(method); });
|
|
451
|
-
})
|
|
452
|
-
.forEach(function (_a) {
|
|
453
|
-
var _b = __read(_a, 2), path = _b[0], methods = _b[1];
|
|
454
|
-
return Object.entries(methods)
|
|
455
|
-
.filter(function (item) { return item[0] !== undefined; })
|
|
456
|
-
.forEach(function (_a) {
|
|
457
|
-
var _b = __read(_a, 2), method = _b[0], operation = _b[1];
|
|
458
|
-
if (!operation.operationId) {
|
|
459
|
-
throw new Error('The OpenApu OperationId is not defined');
|
|
460
|
-
}
|
|
461
|
-
if (operations.has(operation.operationId)) {
|
|
462
|
-
throw new Error("The OpenApi Operation '" + operation.operationId + "' is already defined.");
|
|
463
|
-
}
|
|
464
|
-
operations.set(operation.operationId, Object.assign(Object.assign({}, operation), { path: path, method: method.toUpperCase() }));
|
|
465
|
-
});
|
|
466
|
-
});
|
|
467
|
-
return operations;
|
|
468
|
-
};
|
|
469
|
-
OpenApiConfigService.GetBaseUrl = function (config, serverIndex) {
|
|
470
|
-
if (serverIndex === void 0) { serverIndex = this.DefaultServerIndex; }
|
|
471
|
-
var server = config.servers ? config.servers[serverIndex] : null;
|
|
472
|
-
if (!server) {
|
|
473
|
-
console.debug("Could not extract the server config with the index '" + serverIndex + "' from the open api config", config);
|
|
474
|
-
throw new Error("Could not extract the server config with the index '" + serverIndex + "' from the open api config");
|
|
475
|
-
}
|
|
476
|
-
return server.url;
|
|
477
|
-
};
|
|
478
|
-
/**
|
|
479
|
-
* Replaces all $ref with the concrete definition
|
|
480
|
-
*
|
|
481
|
-
* @param config
|
|
482
|
-
* @private
|
|
483
|
-
*/
|
|
484
|
-
OpenApiConfigService.ExpandOpenApi = function (config) {
|
|
485
|
-
return Promise.resolve(config);
|
|
486
|
-
};
|
|
487
|
-
OpenApiConfigService.prototype.getOperation = function (operationId) {
|
|
488
|
-
if (!this._operations.has(operationId)) {
|
|
489
|
-
console.debug("The operation '" + operationId + "' is not defined in the openapi-json", this.config);
|
|
490
|
-
throw new Error("The operation '" + operationId + "' is not defined in the openapi-json");
|
|
491
|
-
}
|
|
492
|
-
return this._operations.get(operationId);
|
|
493
|
-
};
|
|
494
|
-
OpenApiConfigService.prototype.getBaseUrl = function (serverIndex) {
|
|
495
|
-
if (serverIndex === void 0) { serverIndex = this.defaultServerIndex; }
|
|
496
|
-
return OpenApiConfigService.GetBaseUrl(this.config, serverIndex);
|
|
497
|
-
};
|
|
498
|
-
OpenApiConfigService.prototype.insertServer = function (serverConfig, index) {
|
|
499
|
-
if (index === void 0) { index = this.defaultServerIndex; }
|
|
500
|
-
if (!this.config.servers) {
|
|
501
|
-
this.config.servers = [];
|
|
502
|
-
}
|
|
503
|
-
this.config.servers.splice(index, 1, serverConfig);
|
|
504
|
-
};
|
|
505
|
-
return OpenApiConfigService;
|
|
506
|
-
}());
|
|
507
|
-
OpenApiConfigService.Config = null;
|
|
508
|
-
OpenApiConfigService.DefaultServerIndex = 0;
|
|
509
|
-
OpenApiConfigService._operations = null;
|
|
510
|
-
OpenApiConfigService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: OpenApiConfigService, deps: [{ token: RXAP_OPEN_API_CONFIG, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
511
|
-
OpenApiConfigService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: OpenApiConfigService, providedIn: 'root' });
|
|
512
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: OpenApiConfigService, decorators: [{
|
|
513
|
-
type: i0.Injectable,
|
|
514
|
-
args: [{ providedIn: 'root' }]
|
|
515
|
-
}], ctorParameters: function () {
|
|
516
|
-
return [{ type: undefined, decorators: [{
|
|
517
|
-
type: i0.Optional
|
|
518
|
-
}, {
|
|
519
|
-
type: i0.Inject,
|
|
520
|
-
args: [RXAP_OPEN_API_CONFIG]
|
|
521
|
-
}] }];
|
|
522
|
-
} });
|
|
523
|
-
|
|
524
|
-
var SchemaValidationMixin = /** @class */ (function () {
|
|
525
|
-
function SchemaValidationMixin() {
|
|
526
|
-
}
|
|
527
|
-
/**
|
|
528
|
-
* Validates the parameters against the schema specified in the operation object
|
|
529
|
-
*
|
|
530
|
-
* @param operation
|
|
531
|
-
* @param parameters
|
|
532
|
-
* @param strict
|
|
533
|
-
* @protected
|
|
534
|
-
*/
|
|
535
|
-
SchemaValidationMixin.prototype.validateParameters = function (operation, parameters, strict) {
|
|
536
|
-
var e_1, _b;
|
|
537
|
-
if (strict === void 0) { strict = false; }
|
|
538
|
-
var operationParameters = utilities.coerceArray(operation.parameters);
|
|
539
|
-
if (!NotContainsReferenceObjects(operationParameters)) {
|
|
540
|
-
throw new RxapOpenApiError('The operation parameters contains ReferenceObject!');
|
|
541
|
-
}
|
|
542
|
-
if (parameters === undefined) {
|
|
543
|
-
// TODO : find concept to definition witch parameter should not be checked if required
|
|
544
|
-
// header parameters are never required if changes the semantic release manager breaks
|
|
545
|
-
var requiredParameters = operationParameters.filter(function (parameter) { return parameter.required && parameter.in !== 'header'; });
|
|
546
|
-
if (requiredParameters.length) {
|
|
547
|
-
if (i0.isDevMode()) {
|
|
548
|
-
console.debug('Some operation parameters are required!', requiredParameters.map(function (p) { return p.name; }));
|
|
549
|
-
}
|
|
550
|
-
this.validationError('Some operation parameters are required!', strict);
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
else if (utilities.IsRecord(parameters)) {
|
|
554
|
-
try {
|
|
555
|
-
for (var operationParameters_1 = __values(operationParameters), operationParameters_1_1 = operationParameters_1.next(); !operationParameters_1_1.done; operationParameters_1_1 = operationParameters_1.next()) {
|
|
556
|
-
var parameter = operationParameters_1_1.value;
|
|
557
|
-
if (parameter.required) {
|
|
558
|
-
// header parameters are never required if changes the semantic release manager breaks
|
|
559
|
-
if (parameter.in !== 'header') {
|
|
560
|
-
if (!parameters.hasOwnProperty(parameter.name)) {
|
|
561
|
-
this.validationError("The operation parameter '" + parameter.name + "' is required!", strict);
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
if (parameter.schema) {
|
|
566
|
-
if (parameters.hasOwnProperty(parameter.name)) {
|
|
567
|
-
var value = parameters[parameter.name];
|
|
568
|
-
if (!this.validate(parameter.schema, value)) {
|
|
569
|
-
this.validationError("The parameter '" + parameter.name + "' is not valid against the schema!", strict, parameter.schema, value);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
576
|
-
finally {
|
|
577
|
-
try {
|
|
578
|
-
if (operationParameters_1_1 && !operationParameters_1_1.done && (_b = operationParameters_1.return)) _b.call(operationParameters_1);
|
|
579
|
-
}
|
|
580
|
-
finally { if (e_1) throw e_1.error; }
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
else {
|
|
584
|
-
if (operationParameters.length === 0 || operationParameters.every(function (op) { return !op.required; })) {
|
|
585
|
-
if (i0.isDevMode()) {
|
|
586
|
-
console.warn("The operation " + operation.operationId + " does not expect any parameters. But a parameter is provided.", parameters);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
else {
|
|
590
|
-
throw new Error('The parameters object is not a record');
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
/**
|
|
595
|
-
* Validates the http response against the schema specified in the operation object
|
|
596
|
-
*
|
|
597
|
-
* @param operation
|
|
598
|
-
* @param response
|
|
599
|
-
* @param strict
|
|
600
|
-
* @protected
|
|
601
|
-
*/
|
|
602
|
-
SchemaValidationMixin.prototype.validateResponse = function (operation, response, strict) {
|
|
603
|
-
if (strict === void 0) { strict = false; }
|
|
604
|
-
// region only validate the response if the content type is undefined or application/json
|
|
605
|
-
var _a;
|
|
606
|
-
var contentType = response.headers.get('Content-Type');
|
|
607
|
-
if (contentType && contentType !== 'application/json') {
|
|
608
|
-
if (i0.isDevMode()) {
|
|
609
|
-
console.warn('Response validation is only supported for content type application/json');
|
|
610
|
-
}
|
|
611
|
-
return;
|
|
612
|
-
}
|
|
613
|
-
// endregion
|
|
614
|
-
if (operation.responses) {
|
|
615
|
-
var status = response.status;
|
|
616
|
-
// region extract the response object based on the response status
|
|
617
|
-
var responseObject = void 0;
|
|
618
|
-
if (operation.responses[status]) {
|
|
619
|
-
responseObject = operation.responses[status];
|
|
620
|
-
}
|
|
621
|
-
else {
|
|
622
|
-
// use the default response object if no matching was found.
|
|
623
|
-
responseObject = operation.responses.default;
|
|
624
|
-
}
|
|
625
|
-
// endregion
|
|
626
|
-
if (responseObject) {
|
|
627
|
-
if (IsReferenceObject(responseObject)) {
|
|
628
|
-
throw new RxapOpenApiError('Found a reference object. The operation config is not expand!');
|
|
629
|
-
}
|
|
630
|
-
// region validate the response against the schema if defined
|
|
631
|
-
// TODO : create schema that validates all parameters at once
|
|
632
|
-
if (responseObject.content && responseObject.content['application/json'] && responseObject.content['application/json'].schema) {
|
|
633
|
-
var schema = responseObject.content['application/json'].schema;
|
|
634
|
-
var data = (_a = response.body) !== null && _a !== void 0 ? _a : response.data;
|
|
635
|
-
if (!this.validate(schema, data)) {
|
|
636
|
-
this.validationError('The response is not valid ageist the operation schema!', strict, schema, data);
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
// endregion
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
SchemaValidationMixin.prototype.validateRequestBody = function (operation, body, strict) {
|
|
644
|
-
if (strict === void 0) { strict = false; }
|
|
645
|
-
// only validate body if type of object
|
|
646
|
-
if (typeof body !== 'object') {
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
if (operation.requestBody) {
|
|
650
|
-
if (IsReferenceObject(operation.requestBody)) {
|
|
651
|
-
throw new RxapOpenApiError('Found a reference object. The operation config is not expand!');
|
|
652
|
-
}
|
|
653
|
-
if (body === undefined && operation.requestBody.required) {
|
|
654
|
-
this.validationError('The request body is required!', strict);
|
|
655
|
-
}
|
|
656
|
-
if (operation.requestBody.content && operation.requestBody.content['application/json']) {
|
|
657
|
-
var schema = operation.requestBody.content['application/json'].schema;
|
|
658
|
-
if (schema) {
|
|
659
|
-
if (!this.validate(schema, body)) {
|
|
660
|
-
this.validationError('The request body is not valid!', strict, schema, body);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
};
|
|
666
|
-
SchemaValidationMixin.prototype.validationError = function (message, strict, schema, value) {
|
|
667
|
-
if (i0.isDevMode() && schema !== undefined) {
|
|
668
|
-
// tslint:disable-next-line:no-console
|
|
669
|
-
console.debug(message, { schema: schema, value: value });
|
|
670
|
-
}
|
|
671
|
-
if (strict || SchemaValidationMixin.STRICT) {
|
|
672
|
-
throw new RxapOpenApiError(message, '', 'SchemaValidationMixin');
|
|
673
|
-
}
|
|
674
|
-
else {
|
|
675
|
-
console.warn(message);
|
|
676
|
-
}
|
|
677
|
-
};
|
|
678
|
-
SchemaValidationMixin.prototype.buildHttpParams = function (operationParameters, parameters, ignoreUndefined) {
|
|
679
|
-
var e_2, _b, e_3, _c;
|
|
680
|
-
if (ignoreUndefined === void 0) { ignoreUndefined = true; }
|
|
681
|
-
var params = new http.HttpParams();
|
|
682
|
-
if (utilities.IsRecord(parameters)) {
|
|
683
|
-
try {
|
|
684
|
-
for (var _d = __values(operationParameters.filter(function (p) { return p.in === 'query'; })), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
685
|
-
var parameter = _e.value;
|
|
686
|
-
var parameterName = parameter.name;
|
|
687
|
-
if (parameters.hasOwnProperty(parameter.name)) {
|
|
688
|
-
var value = parameters[parameter.name];
|
|
689
|
-
if (value === undefined && ignoreUndefined) {
|
|
690
|
-
continue;
|
|
691
|
-
}
|
|
692
|
-
if (Array.isArray(value)) {
|
|
693
|
-
if (value.length) {
|
|
694
|
-
var first = value.shift();
|
|
695
|
-
params = params.set(parameterName, first);
|
|
696
|
-
try {
|
|
697
|
-
for (var value_1 = (e_3 = void 0, __values(value)), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {
|
|
698
|
-
var item = value_1_1.value;
|
|
699
|
-
params = params.append(parameterName, item);
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
703
|
-
finally {
|
|
704
|
-
try {
|
|
705
|
-
if (value_1_1 && !value_1_1.done && (_c = value_1.return)) _c.call(value_1);
|
|
706
|
-
}
|
|
707
|
-
finally { if (e_3) throw e_3.error; }
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
else {
|
|
712
|
-
params = params.set(parameter.name, value);
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
718
|
-
finally {
|
|
719
|
-
try {
|
|
720
|
-
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
721
|
-
}
|
|
722
|
-
finally { if (e_2) throw e_2.error; }
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
return params;
|
|
726
|
-
};
|
|
727
|
-
SchemaValidationMixin.prototype.buildHttpHeaders = function (operationParameters, parameters) {
|
|
728
|
-
var e_4, _b, e_5, _c;
|
|
729
|
-
var headers = new http.HttpHeaders();
|
|
730
|
-
if (utilities.IsRecord(parameters)) {
|
|
731
|
-
try {
|
|
732
|
-
for (var _d = __values(operationParameters.filter(function (p) { return p.in === 'header'; })), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
733
|
-
var parameter = _e.value;
|
|
734
|
-
if (parameters.hasOwnProperty(parameter.name)) {
|
|
735
|
-
var value = parameters[parameter.name];
|
|
736
|
-
if (Array.isArray(value)) {
|
|
737
|
-
if (value.length) {
|
|
738
|
-
var first = value.shift();
|
|
739
|
-
headers = headers.set(parameters.name, first);
|
|
740
|
-
try {
|
|
741
|
-
for (var value_2 = (e_5 = void 0, __values(value)), value_2_1 = value_2.next(); !value_2_1.done; value_2_1 = value_2.next()) {
|
|
742
|
-
var item = value_2_1.value;
|
|
743
|
-
headers = headers.append(parameters.name, item);
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
747
|
-
finally {
|
|
748
|
-
try {
|
|
749
|
-
if (value_2_1 && !value_2_1.done && (_c = value_2.return)) _c.call(value_2);
|
|
750
|
-
}
|
|
751
|
-
finally { if (e_5) throw e_5.error; }
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
else {
|
|
756
|
-
headers = headers.set(parameter.name, value);
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
762
|
-
finally {
|
|
763
|
-
try {
|
|
764
|
-
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
765
|
-
}
|
|
766
|
-
finally { if (e_4) throw e_4.error; }
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
return headers;
|
|
770
|
-
};
|
|
771
|
-
SchemaValidationMixin.prototype.buildHttpPathParams = function (operationParameters, parameters) {
|
|
772
|
-
var e_6, _b;
|
|
773
|
-
var pathParams = {};
|
|
774
|
-
if (utilities.IsRecord(parameters)) {
|
|
775
|
-
try {
|
|
776
|
-
for (var _c = __values(operationParameters.filter(function (p) { return p.in === 'path'; })), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
777
|
-
var parameter = _d.value;
|
|
778
|
-
if (parameters.hasOwnProperty(parameter.name)) {
|
|
779
|
-
pathParams[parameter.name] = encodeURIComponent(parameters[parameter.name]);
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
784
|
-
finally {
|
|
785
|
-
try {
|
|
786
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
787
|
-
}
|
|
788
|
-
finally { if (e_6) throw e_6.error; }
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
return pathParams;
|
|
792
|
-
};
|
|
793
|
-
/**
|
|
794
|
-
* Converts open api parameters into the corresponding http options to
|
|
795
|
-
* create a http request. The transformation is guided by the openapi definition
|
|
796
|
-
*
|
|
797
|
-
* @param operation
|
|
798
|
-
* @param parameters
|
|
799
|
-
* @param requestBody
|
|
800
|
-
* @param ignoreUndefined
|
|
801
|
-
*/
|
|
802
|
-
SchemaValidationMixin.prototype.buildHttpOptions = function (operation, parameters, requestBody, ignoreUndefined) {
|
|
803
|
-
if (ignoreUndefined === void 0) { ignoreUndefined = true; }
|
|
804
|
-
var options = {};
|
|
805
|
-
var operationParameters = utilities.coerceArray(operation.parameters);
|
|
806
|
-
if (!NotContainsReferenceObjects(operationParameters)) {
|
|
807
|
-
throw new RxapOpenApiError('The operation parameters contains ReferenceObject!');
|
|
808
|
-
}
|
|
809
|
-
var params = this.buildHttpParams(operationParameters, parameters, ignoreUndefined);
|
|
810
|
-
var headers = this.buildHttpHeaders(operationParameters, parameters);
|
|
811
|
-
var pathParams = this.buildHttpPathParams(operationParameters, parameters);
|
|
812
|
-
if (params.keys().length) {
|
|
813
|
-
options.params = params;
|
|
814
|
-
}
|
|
815
|
-
if (headers.keys().length) {
|
|
816
|
-
options.headers = headers;
|
|
817
|
-
}
|
|
818
|
-
if (Object.keys(pathParams).length) {
|
|
819
|
-
options.pathParams = pathParams;
|
|
820
|
-
}
|
|
821
|
-
if (requestBody !== undefined) {
|
|
822
|
-
options.body = requestBody;
|
|
823
|
-
}
|
|
824
|
-
return options;
|
|
825
|
-
};
|
|
826
|
-
SchemaValidationMixin.prototype.validate = function (schema, value) {
|
|
827
|
-
if (this.disableSchemaValidation) {
|
|
828
|
-
return true;
|
|
829
|
-
}
|
|
830
|
-
var result;
|
|
831
|
-
try {
|
|
832
|
-
result = new Ajv__namespace().validate(schema, utilities.clone(value));
|
|
833
|
-
}
|
|
834
|
-
catch (e) {
|
|
835
|
-
console.error(e.message);
|
|
836
|
-
return false;
|
|
837
|
-
}
|
|
838
|
-
if (utilities.isPromiseLike(result)) {
|
|
839
|
-
throw new Error('Async schema validation is not yet supported. Ensure the all refs in the openapi schema are internal!');
|
|
840
|
-
}
|
|
841
|
-
return result;
|
|
842
|
-
};
|
|
843
|
-
return SchemaValidationMixin;
|
|
844
|
-
}());
|
|
845
|
-
SchemaValidationMixin.STRICT = false;
|
|
846
|
-
|
|
847
|
-
/**
|
|
848
|
-
* Generated bundle index. Do not edit.
|
|
849
|
-
*/
|
|
850
|
-
|
|
851
|
-
exports.AssertOpenApiV3 = AssertOpenApiV3;
|
|
852
|
-
exports.DEFAULT_OPEN_API_DATA_SOURCE_META_DATA = DEFAULT_OPEN_API_DATA_SOURCE_META_DATA;
|
|
853
|
-
exports.DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA = DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA;
|
|
854
|
-
exports.DISABLE_SCHEMA_VALIDATION = DISABLE_SCHEMA_VALIDATION;
|
|
855
|
-
exports.DISABLE_VALIDATION = DISABLE_VALIDATION;
|
|
856
|
-
exports.IsOpenApiV3 = IsOpenApiV3;
|
|
857
|
-
exports.IsReferenceObject = IsReferenceObject;
|
|
858
|
-
exports.NotContainsReferenceObjects = NotContainsReferenceObjects;
|
|
859
|
-
exports.OpenApiConfigService = OpenApiConfigService;
|
|
860
|
-
exports.RXAP_OPEN_API_CONFIG = RXAP_OPEN_API_CONFIG;
|
|
861
|
-
exports.RXAP_OPEN_API_STRICT_VALIDATOR = RXAP_OPEN_API_STRICT_VALIDATOR;
|
|
862
|
-
exports.RxapOpenApiError = RxapOpenApiError;
|
|
863
|
-
exports.SchemaValidationMixin = SchemaValidationMixin;
|
|
864
|
-
|
|
865
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
866
|
-
|
|
867
|
-
}));
|
|
868
|
-
//# sourceMappingURL=rxap-open-api.umd.js.map
|