@superdurable/connector-apifox 0.1.0 → 0.1.1

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,7 +4,7 @@
4
4
  "package": {
5
5
  "ecosystem": "npm",
6
6
  "name": "@superdurable/connector-apifox",
7
- "version": "0.1.0"
7
+ "version": "0.1.1"
8
8
  },
9
9
  "factories": [
10
10
  {
package/dist/index.js CHANGED
@@ -150,12 +150,15 @@ function classifyHTTPStatus(status) {
150
150
  return branch("providerRejected", kind, `Apifox rejected project export with HTTP ${status}`);
151
151
  }
152
152
  function decodeProjectSummary(value, token) {
153
- if (!isRecord(value) || typeof value.openapi !== "string" || !value.openapi.startsWith("3.1") || !isRecord(value.info) || !isRecord(value.paths)) return void 0;
154
- const title = value.info.title;
155
- const version = value.info.version;
153
+ if (!isRecord(value)) return void 0;
154
+ const document = Object.fromEntries(Object.entries(value).map(([key, field]) => [key.toLowerCase(), field]));
155
+ if (typeof document.openapi !== "string" || !document.openapi.startsWith("3.1") || !isRecord(document.info) || !isRecord(document.paths)) return void 0;
156
+ const info = Object.fromEntries(Object.entries(document.info).map(([key, field]) => [key.toLowerCase(), field]));
157
+ const title = info.title;
158
+ const version = info.version;
156
159
  if (typeof title !== "string" || typeof version !== "string" || !title || !version || Buffer.byteLength(title, "utf8") > 256 || Buffer.byteLength(version, "utf8") > 64 || /[\r\n\0]/.test(title + version) || (title + version).includes(token)) return void 0;
157
160
  let endpointCount = 0;
158
- for (const methods of Object.values(value.paths)) {
161
+ for (const methods of Object.values(document.paths)) {
159
162
  if (methods !== null && !isRecord(methods)) return void 0;
160
163
  if (methods === null) continue;
161
164
  for (const method of Object.keys(methods)) if (httpMethods.has(method.toLowerCase())) endpointCount++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdurable/connector-apifox",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "license": "MIT",
5
5
  "description": "Apifox connector for Dex TypeScript applications",
6
6
  "repository": {