@appland/appmap 3.25.1 → 3.25.4
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/CHANGELOG.md +22 -0
- package/built/appmap.html +1 -1
- package/built/main.js.map +1 -1
- package/built/package.json +2 -3
- package/built/src/cli.js +21 -2
- package/built/src/cli.js.map +1 -1
- package/built/src/{openapi/command.js → cmds/openapi.js} +7 -11
- package/built/src/cmds/openapi.js.map +1 -0
- package/built/src/cmds/record/test/isAgentAvailable.js +4 -3
- package/built/src/cmds/record/test/isAgentAvailable.js.map +1 -1
- package/built/src/fingerprint/canonicalize/classes.js +1 -1
- package/built/src/fingerprint/canonicalize/classes.js.map +1 -1
- package/built/src/fingerprint/fingerprinter.js +16 -3
- package/built/src/fingerprint/fingerprinter.js.map +1 -1
- package/built/src/utils.js +75 -27
- package/built/src/utils.js.map +1 -1
- package/package.json +3 -4
- package/built/src/openapi/command.js.map +0 -1
- package/built/src/openapi/index.js +0 -28
- package/built/src/openapi/index.js.map +0 -1
- package/built/src/openapi/method.js +0 -121
- package/built/src/openapi/method.js.map +0 -1
- package/built/src/openapi/model.js +0 -47
- package/built/src/openapi/model.js.map +0 -1
- package/built/src/openapi/objectSchema.js +0 -47
- package/built/src/openapi/objectSchema.js.map +0 -1
- package/built/src/openapi/parseHTTPServerRequests.js +0 -11
- package/built/src/openapi/parseHTTPServerRequests.js.map +0 -1
- package/built/src/openapi/path.js +0 -34
- package/built/src/openapi/path.js.map +0 -1
- package/built/src/openapi/provider.js +0 -73
- package/built/src/openapi/provider.js.map +0 -1
- package/built/src/openapi/response.js +0 -53
- package/built/src/openapi/response.js.map +0 -1
- package/built/src/openapi/rpcRequest.js +0 -87
- package/built/src/openapi/rpcRequest.js.map +0 -1
- package/built/src/openapi/schemaInferrer.js +0 -59
- package/built/src/openapi/schemaInferrer.js.map +0 -1
- package/built/src/openapi/securitySchemes.js +0 -31
- package/built/src/openapi/securitySchemes.js.map +0 -1
- package/built/src/openapi/statusCodes.js +0 -68
- package/built/src/openapi/statusCodes.js.map +0 -1
- package/built/src/openapi/util.js +0 -131
- package/built/src/openapi/util.js.map +0 -1
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const response_1 = __importDefault(require("./response"));
|
|
7
|
-
const objectSchema_1 = __importDefault(require("./objectSchema"));
|
|
8
|
-
const util_1 = require("./util");
|
|
9
|
-
const bodyParamMethods = new Set(['delete', 'put', 'post', 'patch']);
|
|
10
|
-
function openapiIn(rpcRequest, name) {
|
|
11
|
-
const pathInfo = rpcRequest.requestPath;
|
|
12
|
-
// Trim format info from Rails paths, e.g. /foo/bar(.:format)
|
|
13
|
-
const tokens = pathInfo.split('/').map((token) => token.split('(')[0]);
|
|
14
|
-
// Recognize Rails-style normalized paths /org/:org_id and OpenAPI-style paths /org/{org_id}
|
|
15
|
-
if (tokens.includes(`:${name}`) || tokens.includes(`{${name}}`)) {
|
|
16
|
-
return 'path';
|
|
17
|
-
}
|
|
18
|
-
return 'query';
|
|
19
|
-
}
|
|
20
|
-
class Method {
|
|
21
|
-
constructor() {
|
|
22
|
-
this.rpcRequests = [];
|
|
23
|
-
this.responses = {};
|
|
24
|
-
}
|
|
25
|
-
openapi() {
|
|
26
|
-
const responseByStatus = Object.keys(this.responses)
|
|
27
|
-
.sort()
|
|
28
|
-
.reduce((memo, status) => {
|
|
29
|
-
// eslint-disable-next-line no-param-reassign
|
|
30
|
-
memo[status] = this.responses[status].openapi();
|
|
31
|
-
return memo;
|
|
32
|
-
}, {});
|
|
33
|
-
const schemata = {};
|
|
34
|
-
const parameters = [];
|
|
35
|
-
let securitySchemeId;
|
|
36
|
-
const uniqueNames = new Set(['controller', 'action', '_method']);
|
|
37
|
-
this.rpcRequests.forEach((rpcRequest) => {
|
|
38
|
-
const messages = rpcRequest.parameters;
|
|
39
|
-
if (!securitySchemeId) {
|
|
40
|
-
const authorization = rpcRequest.requestHeaders['Authorization'];
|
|
41
|
-
if (authorization) {
|
|
42
|
-
const scheme = (0, util_1.parseScheme)(authorization);
|
|
43
|
-
securitySchemeId = scheme.schemeId;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
let schema;
|
|
47
|
-
if (rpcRequest.requestContentType) {
|
|
48
|
-
const mimeType = rpcRequest.requestContentType.split(';')[0];
|
|
49
|
-
if (!schemata[mimeType]) {
|
|
50
|
-
schemata[mimeType] = new objectSchema_1.default();
|
|
51
|
-
}
|
|
52
|
-
schema = schemata[mimeType];
|
|
53
|
-
}
|
|
54
|
-
messages.forEach((message) => {
|
|
55
|
-
if (!message.name) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (uniqueNames.has(message.name)) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
uniqueNames.add(message.name);
|
|
62
|
-
const inLocation = openapiIn(rpcRequest, message.name);
|
|
63
|
-
if (inLocation !== 'path' &&
|
|
64
|
-
rpcRequest.requestMethod &&
|
|
65
|
-
bodyParamMethods.has(rpcRequest.requestMethod)) {
|
|
66
|
-
if (schema) {
|
|
67
|
-
schema.addExample(message);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
const parameter = {
|
|
72
|
-
name: message.name,
|
|
73
|
-
in: inLocation,
|
|
74
|
-
schema: (0, util_1.messageToOpenAPISchema)(message),
|
|
75
|
-
};
|
|
76
|
-
if (parameter.in === 'path') {
|
|
77
|
-
parameter.required = true;
|
|
78
|
-
}
|
|
79
|
-
parameters.push(parameter);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
const response = {
|
|
84
|
-
responses: responseByStatus,
|
|
85
|
-
};
|
|
86
|
-
if (securitySchemeId) {
|
|
87
|
-
const securityObj = {};
|
|
88
|
-
securityObj[securitySchemeId] = [];
|
|
89
|
-
response.security = [securityObj];
|
|
90
|
-
}
|
|
91
|
-
const mediaTypes = Object.keys(schemata)
|
|
92
|
-
.sort()
|
|
93
|
-
.map((contentType) => ({
|
|
94
|
-
contentType,
|
|
95
|
-
schema: schemata[contentType].schema(),
|
|
96
|
-
}))
|
|
97
|
-
.filter((entry) => entry.schema);
|
|
98
|
-
if (mediaTypes.length > 0) {
|
|
99
|
-
const content = mediaTypes.reduce((memo, entry) => {
|
|
100
|
-
memo[entry.contentType] = { schema: entry.schema };
|
|
101
|
-
return memo;
|
|
102
|
-
}, {});
|
|
103
|
-
response.requestBody = { content };
|
|
104
|
-
}
|
|
105
|
-
if (parameters.length > 0) {
|
|
106
|
-
response.parameters = parameters.sort((a, b) => a.name.localeCompare(b.name));
|
|
107
|
-
}
|
|
108
|
-
return response;
|
|
109
|
-
}
|
|
110
|
-
addRpcRequest(request) {
|
|
111
|
-
const { status } = request;
|
|
112
|
-
if (!this.responses[status]) {
|
|
113
|
-
this.responses[status] = new response_1.default(status);
|
|
114
|
-
}
|
|
115
|
-
this.rpcRequests.push(request);
|
|
116
|
-
const responseObj = this.responses[status];
|
|
117
|
-
responseObj.addRpcRequest(request);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
exports.default = Method;
|
|
121
|
-
//# sourceMappingURL=method.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"method.js","sourceRoot":"","sources":["../../../src/openapi/method.ts"],"names":[],"mappings":";;;;;AAEA,0DAAkC;AAElC,kEAA0C;AAC1C,iCAA6D;AAE7D,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAErE,SAAS,SAAS,CAAC,UAAsB,EAAE,IAAY;IACrD,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,CAAC;IACxC,6DAA6D;I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CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAC7B,CAAC;SACH;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,aAAa,CAAC,OAAmB;QAC/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC3B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;YAC3B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,kBAAQ,CAAC,MAAM,CAAC,CAAC;SAC/C;QACD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/B,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC3C,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACF;AA7GD,yBA6GC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("./path"));
|
|
7
|
-
class Model {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.paths = {};
|
|
10
|
-
}
|
|
11
|
-
openapi() {
|
|
12
|
-
const paths = Object.keys(this.paths)
|
|
13
|
-
.sort()
|
|
14
|
-
.reduce((memo, path) => {
|
|
15
|
-
// eslint-disable-next-line no-param-reassign
|
|
16
|
-
memo[path] = this.paths[path].openapi();
|
|
17
|
-
return memo;
|
|
18
|
-
}, {});
|
|
19
|
-
return paths;
|
|
20
|
-
}
|
|
21
|
-
addRpcRequest(rpcRequest) {
|
|
22
|
-
const path = Model.basePath(rpcRequest.requestPath);
|
|
23
|
-
if (!this.paths[path]) {
|
|
24
|
-
this.paths[path] = new path_1.default();
|
|
25
|
-
}
|
|
26
|
-
const pathObj = this.paths[path];
|
|
27
|
-
pathObj.addRpcRequest(rpcRequest);
|
|
28
|
-
}
|
|
29
|
-
static basePath(path) {
|
|
30
|
-
const pathTokens = path
|
|
31
|
-
.split('(')[0]
|
|
32
|
-
.split('/')
|
|
33
|
-
.map((entry) => {
|
|
34
|
-
if (entry.match(/^:(.*)/)) {
|
|
35
|
-
// eslint-disable-next-line no-param-reassign
|
|
36
|
-
entry = `{${entry.substring(1)}}`;
|
|
37
|
-
}
|
|
38
|
-
return entry;
|
|
39
|
-
});
|
|
40
|
-
if (pathTokens.length === 1 && path[0] === '') {
|
|
41
|
-
pathTokens.push('');
|
|
42
|
-
}
|
|
43
|
-
return pathTokens.join('/');
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.default = Model;
|
|
47
|
-
//# sourceMappingURL=model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/openapi/model.ts"],"names":[],"mappings":";;;;;AACA,kDAA0B;AAG1B,MAAqB,KAAK;IAA1B;QACE,UAAK,GAAyB,EAAE,CAAC;IAsCnC,CAAC;IApCC,OAAO;QACL,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;aAClC,IAAI,EAAE;aACN,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;YACrB,6CAA6C;YAC7C,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC;QACd,CAAC,EAAE,EAA8C,CAAC,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,aAAa,CAAC,UAAsB;QAClC,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YACrB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,cAAI,EAAE,CAAC;SAC/B;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,IAAY;QAC1B,MAAM,UAAU,GAAG,IAAI;aACpB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;aACb,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACb,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;gBACzB,6CAA6C;gBAC7C,KAAK,GAAG,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC;aACnC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QACL,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YAC7C,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACrB;QACD,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF;AAvCD,wBAuCC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const schemaInferrer_1 = __importDefault(require("./schemaInferrer"));
|
|
7
|
-
class ObjectSchema {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.examples = [];
|
|
10
|
-
}
|
|
11
|
-
addExample(message) {
|
|
12
|
-
if (!message.name) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
this.examples.push(message);
|
|
16
|
-
}
|
|
17
|
-
get empty() {
|
|
18
|
-
return this.examples.length > 0;
|
|
19
|
-
}
|
|
20
|
-
schema() {
|
|
21
|
-
const schemata = {};
|
|
22
|
-
this.examples
|
|
23
|
-
.filter((message) => message.name)
|
|
24
|
-
.sort((a, b) => a.name.localeCompare(b.name))
|
|
25
|
-
.forEach((message) => {
|
|
26
|
-
if (!schemata[message.name]) {
|
|
27
|
-
schemata[message.name] = new schemaInferrer_1.default();
|
|
28
|
-
}
|
|
29
|
-
schemata[message.name].addExample(message);
|
|
30
|
-
});
|
|
31
|
-
if (Object.keys(schemata).length === 0) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const properties = Object.keys(schemata).reduce((memo, name) => {
|
|
35
|
-
const schema = schemata[name].openapi();
|
|
36
|
-
if (schema)
|
|
37
|
-
memo[name] = schema;
|
|
38
|
-
return memo;
|
|
39
|
-
}, {});
|
|
40
|
-
return {
|
|
41
|
-
type: 'object',
|
|
42
|
-
properties,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.default = ObjectSchema;
|
|
47
|
-
//# sourceMappingURL=objectSchema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"objectSchema.js","sourceRoot":"","sources":["../../../src/openapi/objectSchema.ts"],"names":[],"mappings":";;;;;AAEA,sEAA8C;AAE9C,MAAqB,YAAY;IAG/B;QACE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,UAAU,CAAC,OAAwB;QACjC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YACjB,OAAO;SACR;QACD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,MAAM;QACJ,MAAM,QAAQ,GAAmC,EAAE,CAAC;QACpD,IAAI,CAAC,QAAQ;aACV,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;aACjC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAK,CAAC,aAAa,CAAC,CAAC,CAAC,IAAK,CAAC,CAAC;aAC9C,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACnB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAK,CAAC,EAAE;gBAC5B,QAAQ,CAAC,OAAO,CAAC,IAAK,CAAC,GAAG,IAAI,wBAAc,EAAE,CAAC;aAChD;YACD,QAAQ,CAAC,OAAO,CAAC,IAAK,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;QACL,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;YACtC,OAAO;SACR;QAED,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;YAC7D,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;YACxC,IAAI,MAAM;gBAAE,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC,EAAE,EAA4C,CAAC,CAAC;QACjD,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,UAAU;SACX,CAAC;IACJ,CAAC;CACF;AA3CD,+BA2CC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const models_1 = require("@appland/models");
|
|
4
|
-
function parseHTTPServerRequests(source, collector) {
|
|
5
|
-
const appmap = (0, models_1.buildAppMap)().source(source).normalize().build();
|
|
6
|
-
appmap.events
|
|
7
|
-
.filter((e) => e.httpServerRequest && e.httpServerResponse)
|
|
8
|
-
.forEach(collector);
|
|
9
|
-
}
|
|
10
|
-
exports.default = parseHTTPServerRequests;
|
|
11
|
-
//# sourceMappingURL=parseHTTPServerRequests.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseHTTPServerRequests.js","sourceRoot":"","sources":["../../../src/openapi/parseHTTPServerRequests.ts"],"names":[],"mappings":";;AAAA,4CAAqD;AAGrD,SAAwB,uBAAuB,CAC7C,MAAW,EACX,SAAiC;IAEjC,MAAM,MAAM,GAAG,IAAA,oBAAW,GAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC;IAEhE,MAAM,CAAC,MAAM;SACV,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,CAAC,kBAAkB,CAAC;SAC1D,OAAO,CAAC,SAAS,CAAC,CAAC;AACxB,CAAC;AATD,0CASC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const method_1 = __importDefault(require("./method"));
|
|
7
|
-
class Path {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.methods = {};
|
|
10
|
-
}
|
|
11
|
-
openapi() {
|
|
12
|
-
return Object.keys(this.methods)
|
|
13
|
-
.sort()
|
|
14
|
-
.reduce((memo, method) => {
|
|
15
|
-
// eslint-disable-next-line no-param-reassign
|
|
16
|
-
memo[method] =
|
|
17
|
-
this.methods[method].openapi();
|
|
18
|
-
return memo;
|
|
19
|
-
}, {});
|
|
20
|
-
}
|
|
21
|
-
addRpcRequest(rpcRequest) {
|
|
22
|
-
const method = rpcRequest.requestMethod;
|
|
23
|
-
if (!method) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (!this.methods[method]) {
|
|
27
|
-
this.methods[method] = new method_1.default();
|
|
28
|
-
}
|
|
29
|
-
const methodObj = this.methods[method];
|
|
30
|
-
methodObj.addRpcRequest(rpcRequest);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.default = Path;
|
|
34
|
-
//# sourceMappingURL=path.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/openapi/path.ts"],"names":[],"mappings":";;;;;AACA,sDAA8B;AAG9B,MAAqB,IAAI;IAAzB;QACE,YAAO,GAA2B,EAAE,CAAC;IAyBvC,CAAC;IAvBC,OAAO;QACL,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;aAC7B,IAAI,EAAE;aACN,MAAM,CAAC,CAAC,IAAI,EAAE,MAAc,EAAE,EAAE;YAC/B,6CAA6C;YAC7C,IAAI,CAAC,MAA+B,CAAC;gBACnC,IAAI,CAAC,OAAO,CAAC,MAA+B,CAAC,CAAC,OAAO,EAAE,CAAC;YAC1D,OAAO,IAAI,CAAC;QACd,CAAC,EAAE,EAA8D,CAAC,CAAC;IACvE,CAAC;IAED,aAAa,CAAC,UAAsB;QAClC,MAAM,MAAM,GAAG,UAAU,CAAC,aAAa,CAAC;QACxC,IAAI,CAAC,MAAM,EAAE;YACX,OAAO;SACR;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACzB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,gBAAM,EAAE,CAAC;SACrC;QACD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACvC,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;CACF;AA1BD,uBA0BC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const js_yaml_1 = require("js-yaml");
|
|
7
|
-
const url_1 = require("url");
|
|
8
|
-
const http_1 = __importDefault(require("http"));
|
|
9
|
-
const https_1 = __importDefault(require("https"));
|
|
10
|
-
const promises_1 = require("fs/promises");
|
|
11
|
-
const URLLoader = (protocol) => {
|
|
12
|
-
return (url) => {
|
|
13
|
-
return new Promise((resolve, reject) => {
|
|
14
|
-
protocol
|
|
15
|
-
.get(url)
|
|
16
|
-
.on('response', (response) => {
|
|
17
|
-
if (response.statusCode !== 200) {
|
|
18
|
-
return reject(`${response.statusCode} ${response.statusMessage}`);
|
|
19
|
-
}
|
|
20
|
-
const data = [];
|
|
21
|
-
response
|
|
22
|
-
.on('data', (chunk) => {
|
|
23
|
-
data.push(Buffer.from(chunk));
|
|
24
|
-
})
|
|
25
|
-
.on('end', () => {
|
|
26
|
-
resolve(Buffer.concat(data));
|
|
27
|
-
});
|
|
28
|
-
})
|
|
29
|
-
.on('error', reject);
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
const FileLoader = (url) => {
|
|
34
|
-
return (0, promises_1.readFile)(url.pathname);
|
|
35
|
-
};
|
|
36
|
-
const ProtocolLoader = {
|
|
37
|
-
'http:': URLLoader(http_1.default),
|
|
38
|
-
'https:': URLLoader(https_1.default),
|
|
39
|
-
'file:': FileLoader,
|
|
40
|
-
};
|
|
41
|
-
const fetch = (urlStr) => {
|
|
42
|
-
const url = new url_1.URL(urlStr);
|
|
43
|
-
const loader = ProtocolLoader[url.protocol];
|
|
44
|
-
if (!loader) {
|
|
45
|
-
throw new Error(`No schema loader for protocol ${url.protocol}`);
|
|
46
|
-
}
|
|
47
|
-
return loader(url);
|
|
48
|
-
};
|
|
49
|
-
const SchemaCache = {};
|
|
50
|
-
const schemaCache = async (key, fn) => {
|
|
51
|
-
const cachedResult = SchemaCache[key];
|
|
52
|
-
if (cachedResult) {
|
|
53
|
-
return cachedResult;
|
|
54
|
-
}
|
|
55
|
-
const result = await fn(key);
|
|
56
|
-
SchemaCache[key] = result;
|
|
57
|
-
return result;
|
|
58
|
-
};
|
|
59
|
-
const fetchSchema = async (sourceURL) => {
|
|
60
|
-
return schemaCache(sourceURL, async (sourceURL) => {
|
|
61
|
-
const data = await fetch(sourceURL);
|
|
62
|
-
return (0, js_yaml_1.load)(data.toString());
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
const lookup = async (host, openapiSchemata) => {
|
|
66
|
-
const sourceURL = openapiSchemata[host];
|
|
67
|
-
if (!sourceURL) {
|
|
68
|
-
throw new Error(`No OpenAPI schema URL configured for host ${host}. Available hosts are: ${Object.keys(openapiSchemata).join(', ')}`);
|
|
69
|
-
}
|
|
70
|
-
return await fetchSchema(sourceURL);
|
|
71
|
-
};
|
|
72
|
-
exports.default = lookup;
|
|
73
|
-
//# sourceMappingURL=provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/openapi/provider.ts"],"names":[],"mappings":";;;;;AAAA,qCAA+B;AAC/B,6BAA0B;AAE1B,gDAA6C;AAC7C,kDAA0B;AAC1B,0CAAuC;AAIvC,MAAM,SAAS,GAAG,CAAC,QAAa,EAAE,EAAE;IAClC,OAAO,CAAC,GAAQ,EAAmB,EAAE;QACnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,QAAQ;iBACL,GAAG,CAAC,GAAG,CAAC;iBACR,EAAE,CAAC,UAAU,EAAE,CAAC,QAAyB,EAAE,EAAE;gBAC5C,IAAI,QAAQ,CAAC,UAAU,KAAK,GAAG,EAAE;oBAC/B,OAAO,MAAM,CAAC,GAAG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AK,EAAE,GAAW,EAAE,EAAgD,EAAE,EAAE;IAC1F,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,YAAY,EAAE;QAChB,OAAO,YAAY,CAAC;KACrB;IAED,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;IAC7B,WAAW,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IAC1B,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,KAAK,EAAE,SAAiB,EAA+B,EAAE;IAC3E,OAAO,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,SAAiB,EAAE,EAAE;QACxD,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC;QACpC,OAAO,IAAA,cAAI,EAAC,IAAI,CAAC,QAAQ,EAAE,CAAuB,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,KAAK,EAClB,IAAY,EACZ,eAAuC,EACV,EAAE;IAC/B,MAAM,SAAS,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CACb,6CAA6C,IAAI,0BAA0B,MAAM,CAAC,IAAI,CACpF,eAAe,CAChB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACf,CAAC;KACH;IACD,OAAO,MAAM,WAAW,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,kBAAe,MAAM,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const statusCodes_1 = __importDefault(require("./statusCodes"));
|
|
7
|
-
const schemaInferrer_1 = __importDefault(require("./schemaInferrer"));
|
|
8
|
-
class Response {
|
|
9
|
-
constructor(statusCode) {
|
|
10
|
-
this.statusCode = statusCode;
|
|
11
|
-
this.rpcRequests = [];
|
|
12
|
-
}
|
|
13
|
-
openapi() {
|
|
14
|
-
// eslint-disable-next-line arrow-body-style
|
|
15
|
-
const contentTypes = () => {
|
|
16
|
-
return this.rpcRequests
|
|
17
|
-
.map((rpcRequest) => rpcRequest.responseContentType)
|
|
18
|
-
.filter((ct) => ct)
|
|
19
|
-
.map((ct) => ct.split(';')[0]);
|
|
20
|
-
};
|
|
21
|
-
const schemata = {};
|
|
22
|
-
this.rpcRequests.forEach((rpcRequest) => {
|
|
23
|
-
const returnValue = rpcRequest.returnValue;
|
|
24
|
-
if (!returnValue)
|
|
25
|
-
return;
|
|
26
|
-
if (rpcRequest.responseContentType) {
|
|
27
|
-
const mimeType = rpcRequest.responseContentType.split(';')[0];
|
|
28
|
-
if (!schemata[mimeType]) {
|
|
29
|
-
schemata[mimeType] = new schemaInferrer_1.default();
|
|
30
|
-
}
|
|
31
|
-
schemata[mimeType].addExample(returnValue);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const content = [...new Set(contentTypes())]
|
|
35
|
-
.sort()
|
|
36
|
-
.reduce((memo, mimeType) => {
|
|
37
|
-
memo[mimeType] = {};
|
|
38
|
-
if (!schemata[mimeType])
|
|
39
|
-
return memo;
|
|
40
|
-
// eslint-disable-next-line no-param-reassign
|
|
41
|
-
const schema = schemata[mimeType].openapi();
|
|
42
|
-
if (schema)
|
|
43
|
-
memo[mimeType].schema = schema;
|
|
44
|
-
return memo;
|
|
45
|
-
}, {});
|
|
46
|
-
return { content, description: statusCodes_1.default[this.statusCode] };
|
|
47
|
-
}
|
|
48
|
-
addRpcRequest(rpcRequest) {
|
|
49
|
-
this.rpcRequests.push(rpcRequest);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.default = Response;
|
|
53
|
-
//# sourceMappingURL=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,CAAC,YAAY,EAAE,CAAC,CAAC;aACzC,IAAI,EAAE;aACN,MAAM,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE;YACzB,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;YAEpB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAAE,OAAO,IAAI,CAAC;YAErC,6CAA6C;YAC7C,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;YAC5C,IAAI,MAAM;gBAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC;YAE3C,OAAO,IAAI,CAAC;QACd,CAAC,EAAE,EAA+C,CAAC,CAAC;QACtD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,qBAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;IAChE,CAAC;IAED,aAAa,CAAC,UAAsB;QAClC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;CACF;AAhDD,2BAgDC"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rpcRequestForEvent = void 0;
|
|
4
|
-
const url_1 = require("url");
|
|
5
|
-
const util_1 = require("./util");
|
|
6
|
-
class ServerRPCRequest {
|
|
7
|
-
constructor(event) {
|
|
8
|
-
this.event = event;
|
|
9
|
-
}
|
|
10
|
-
get status() {
|
|
11
|
-
return this.event.httpServerResponse.status;
|
|
12
|
-
}
|
|
13
|
-
get parameters() {
|
|
14
|
-
return this.event.message || [];
|
|
15
|
-
}
|
|
16
|
-
get returnValue() {
|
|
17
|
-
return this.event.returnValue;
|
|
18
|
-
}
|
|
19
|
-
get requestHeaders() {
|
|
20
|
-
var _a;
|
|
21
|
-
return ((_a = this.event.httpServerRequest) === null || _a === void 0 ? void 0 : _a.headers) || {};
|
|
22
|
-
}
|
|
23
|
-
get responseHeaders() {
|
|
24
|
-
var _a;
|
|
25
|
-
return ((_a = this.event.httpServerResponse) === null || _a === void 0 ? void 0 : _a.headers) || {};
|
|
26
|
-
}
|
|
27
|
-
get requestContentType() {
|
|
28
|
-
return this.event.requestContentType;
|
|
29
|
-
}
|
|
30
|
-
get responseContentType() {
|
|
31
|
-
return this.event.responseContentType;
|
|
32
|
-
}
|
|
33
|
-
get requestMethod() {
|
|
34
|
-
var _a;
|
|
35
|
-
return (_a = this.event.requestMethod) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
36
|
-
}
|
|
37
|
-
get requestPath() {
|
|
38
|
-
return (0, util_1.ensureString)(this.event.httpServerRequest.normalized_path_info ||
|
|
39
|
-
this.event.httpServerRequest.path_info);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
class ClientRPCRequest {
|
|
43
|
-
constructor(event) {
|
|
44
|
-
this.event = event;
|
|
45
|
-
}
|
|
46
|
-
get status() {
|
|
47
|
-
return this.event.httpClientResponse.status;
|
|
48
|
-
}
|
|
49
|
-
get parameters() {
|
|
50
|
-
return this.event.parameters || [];
|
|
51
|
-
}
|
|
52
|
-
get returnValue() {
|
|
53
|
-
return this.event.returnValue;
|
|
54
|
-
}
|
|
55
|
-
get requestHeaders() {
|
|
56
|
-
var _a;
|
|
57
|
-
return ((_a = this.event.httpClientRequest) === null || _a === void 0 ? void 0 : _a.headers) || {};
|
|
58
|
-
}
|
|
59
|
-
get responseHeaders() {
|
|
60
|
-
var _a;
|
|
61
|
-
return ((_a = this.event.httpClientResponse) === null || _a === void 0 ? void 0 : _a.headers) || {};
|
|
62
|
-
}
|
|
63
|
-
get requestContentType() {
|
|
64
|
-
return this.event.requestContentType;
|
|
65
|
-
}
|
|
66
|
-
get responseContentType() {
|
|
67
|
-
return this.event.responseContentType;
|
|
68
|
-
}
|
|
69
|
-
get requestMethod() {
|
|
70
|
-
var _a;
|
|
71
|
-
return (_a = this.event.requestMethod) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
72
|
-
}
|
|
73
|
-
get requestPath() {
|
|
74
|
-
// TODO: Back-substitute query parameters into the URL.
|
|
75
|
-
return new url_1.URL(this.event.httpClientRequest.url).pathname;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function rpcRequestForEvent(event) {
|
|
79
|
-
if (event.httpServerRequest && event.httpServerResponse) {
|
|
80
|
-
return new ServerRPCRequest(event);
|
|
81
|
-
}
|
|
82
|
-
else if (event.httpClientRequest && event.httpClientResponse) {
|
|
83
|
-
return new ClientRPCRequest(event);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.rpcRequestForEvent = rpcRequestForEvent;
|
|
87
|
-
//# sourceMappingURL=rpcRequest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rpcRequest.js","sourceRoot":"","sources":["../../../src/openapi/rpcRequest.ts"],"names":[],"mappings":";;;AAEA,6BAA0B;AAC1B,iCAAsC;AActC,MAAM,gBAAgB;IACpB,YAAoB,KAAY;QAAZ,UAAK,GAAL,KAAK,CAAO;IAAG,CAAC;IAEpC,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,kBAAmB,CAAC,MAAM,CAAC;IAC/C,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC;IAClC,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;IAChC,CAAC;IAED,IAAI,cAAc;;QAChB,OAAO,CAAA,MAAA,IAAI,CAAC,KAAK,CAAC,iBAAiB,0CAAE,OAAO,KAAI,EAAE,CAAC;IACrD,CAAC;IAED,IAAI,eAAe;;QACjB,OAAO,CAAA,MAAA,IAAI,CAAC,KAAK,CAAC,kBAAkB,0CAAE,OAAO,KAAI,EAAE,CAAC;IACtD,CAAC;IAED,IAAI,kBAAkB;QACpB,OAAO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AA2B,CAAC;IAC1E,CAAC;IAED,IAAI,WAAW;QACb,uDAAuD;QACvD,OAAO,IAAI,SAAG,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAkB,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;IAC7D,CAAC;CACF;AAED,SAAgB,kBAAkB,CAAC,KAAY;IAC7C,IAAI,KAAK,CAAC,iBAAiB,IAAI,KAAK,CAAC,kBAAkB,EAAE;QACvD,OAAO,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC;KACpC;SAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,KAAK,CAAC,kBAAkB,EAAE;QAC9D,OAAO,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC;KACpC;AACH,CAAC;AAND,gDAMC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const util_1 = require("./util");
|
|
4
|
-
function mergeProperties(a, b) {
|
|
5
|
-
a || (a = {});
|
|
6
|
-
b || (b = {});
|
|
7
|
-
return Object.keys(a)
|
|
8
|
-
.concat(Object.keys(b))
|
|
9
|
-
.reduce((memo, key) => {
|
|
10
|
-
memo[key] = mergeType(a[key] || {}, b[key] || {});
|
|
11
|
-
return memo;
|
|
12
|
-
}, {});
|
|
13
|
-
}
|
|
14
|
-
// Merge type, items and properties of schema objects.
|
|
15
|
-
function mergeType(a, b) {
|
|
16
|
-
var _a, _b, _c, _d;
|
|
17
|
-
if (b === null || b === undefined)
|
|
18
|
-
return a;
|
|
19
|
-
const result = Object.assign({}, a);
|
|
20
|
-
if (!a.type) {
|
|
21
|
-
result.type = b.type;
|
|
22
|
-
}
|
|
23
|
-
else if (b.type === 'array') {
|
|
24
|
-
result.type = 'array';
|
|
25
|
-
}
|
|
26
|
-
else if (b.type === 'object') {
|
|
27
|
-
result.type = 'object';
|
|
28
|
-
}
|
|
29
|
-
if (a.items || b.items) {
|
|
30
|
-
result.items = mergeType(a.items || {}, b.items);
|
|
31
|
-
if (((_a = a.items) === null || _a === void 0 ? void 0 : _a.properties) || ((_b = b.items) === null || _b === void 0 ? void 0 : _b.properties)) {
|
|
32
|
-
result.items.properties = mergeProperties((_c = a.items) === null || _c === void 0 ? void 0 : _c.properties, (_d = b.items) === null || _d === void 0 ? void 0 : _d.properties);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
if (a.properties || b.properties) {
|
|
37
|
-
result.properties = mergeProperties(a.properties, b.properties);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
class SchemaInferrer {
|
|
43
|
-
constructor() {
|
|
44
|
-
this.examples = [];
|
|
45
|
-
}
|
|
46
|
-
openapi() {
|
|
47
|
-
if (this.examples.length === 0)
|
|
48
|
-
return;
|
|
49
|
-
return this.examples.reduce((memo, example) => {
|
|
50
|
-
const schema = (0, util_1.messageToOpenAPISchema)(example);
|
|
51
|
-
return mergeType(memo, schema);
|
|
52
|
-
}, {});
|
|
53
|
-
}
|
|
54
|
-
addExample(value) {
|
|
55
|
-
this.examples.push(value);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.default = SchemaInferrer;
|
|
59
|
-
//# sourceMappingURL=schemaInferrer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemaInferrer.js","sourceRoot":"","sources":["../../../src/openapi/schemaInferrer.ts"],"names":[],"mappings":";;AAEA,iCAAgD;AAEhD,SAAS,eAAe,CAAC,CAAM,EAAE,CAAM;IACrC,CAAC,KAAD,CAAC,GAAK,EAAE,EAAC;IACT,CAAC,KAAD,CAAC,GAAK,EAAE,EAAC;IAET,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;SAClB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACtB,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAA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M,CAAC,UAAU,GAAG,eAAe,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;SACjE;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAqB,cAAc;IAGjC;QACE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAEvC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;YAC5C,MAAM,MAAM,GAAG,IAAA,6BAAsB,EAAC,OAAO,CAAC,CAAC;YAC/C,OAAO,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACjC,CAAC,EAAE,EAAS,CAAC,CAAC;IAChB,CAAC;IAED,UAAU,CAAC,KAAgB;QACzB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;CACF;AAnBD,iCAmBC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const util_1 = require("./util");
|
|
4
|
-
class SecuritySchemes {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.rpcRequests = [];
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Adds an event to the security schemes, and assigns a security scheme id.
|
|
10
|
-
* If the event has no detectable security scheme, this function returns null.
|
|
11
|
-
*
|
|
12
|
-
* @returns the security scheme id for the event, or null.
|
|
13
|
-
*/
|
|
14
|
-
addRpcRequest(rpcRequest) {
|
|
15
|
-
this.rpcRequests.push(rpcRequest);
|
|
16
|
-
}
|
|
17
|
-
openapi() {
|
|
18
|
-
return this.rpcRequests
|
|
19
|
-
.map((rpcRequest) => rpcRequest.requestHeaders['Authorization'])
|
|
20
|
-
.filter((authorization) => authorization)
|
|
21
|
-
.reduce((memo, authorization) => {
|
|
22
|
-
const scheme = (0, util_1.parseScheme)(authorization);
|
|
23
|
-
if (!memo[scheme.schemeId]) {
|
|
24
|
-
memo[scheme.schemeId] = scheme.scheme;
|
|
25
|
-
}
|
|
26
|
-
return memo;
|
|
27
|
-
}, {});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.default = SecuritySchemes;
|
|
31
|
-
//# sourceMappingURL=securitySchemes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"securitySchemes.js","sourceRoot":"","sources":["../../../src/openapi/securitySchemes.ts"],"names":[],"mappings":";;AAEA,iCAAqC;AAErC,MAAqB,eAAe;IAApC;QACE,gBAAW,GAAiB,EAAE,CAAC;IAwBjC,CAAC;IAtBC;;;;;OAKG;IACH,aAAa,CAAC,UAAsB;QAClC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,WAAW;aACpB,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;aAC/D,MAAM,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,aAAa,CAAC;aACxC,MAAM,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE;YAC9B,MAAM,MAAM,GAAG,IAAA,kBAAW,EAAC,aAAa,CAAC,CAAC;YAC1C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;gBAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;aACvC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,EAAE,EAAoD,CAAC,CAAC;IAC7D,CAAC;CACF;AAzBD,kCAyBC"}
|