@readme/api-core 7.0.0-alpha.1 → 7.0.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.
@@ -11,11 +11,10 @@ function stripTrailingSlash(url) {
11
11
  * any server variables to be supplied to `@readme/oas-to-har`.
12
12
  *
13
13
  */
14
- function prepareServer(spec, url, variables) {
15
- if (variables === void 0) { variables = {}; }
16
- var serverIdx;
17
- var sanitizedUrl = stripTrailingSlash(url);
18
- (spec.api.servers || []).forEach(function (server, i) {
14
+ function prepareServer(spec, url, variables = {}) {
15
+ let serverIdx;
16
+ const sanitizedUrl = stripTrailingSlash(url);
17
+ (spec.api.servers || []).forEach((server, i) => {
19
18
  if (server.url === sanitizedUrl) {
20
19
  serverIdx = i;
21
20
  }
@@ -26,14 +25,14 @@ function prepareServer(spec, url, variables) {
26
25
  if (serverIdx) {
27
26
  return {
28
27
  selected: serverIdx,
29
- variables: variables,
28
+ variables,
30
29
  };
31
30
  }
32
31
  else if (Object.keys(variables).length) {
33
32
  // @todo we should run `oas.replaceUrl(url)` and pass that unto `@readme/oas-to-har`
34
33
  }
35
34
  else {
36
- var server = spec.splitVariables(url);
35
+ const server = spec.splitVariables(url);
37
36
  if (server) {
38
37
  return {
39
38
  selected: server.selected,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readme/api-core",
3
- "version": "7.0.0-alpha.1",
3
+ "version": "7.0.0-alpha.2",
4
4
  "description": "The magic behind `api` 🧙",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -26,25 +26,26 @@
26
26
  "node": ">=18"
27
27
  },
28
28
  "dependencies": {
29
- "@readme/oas-to-har": "^20.1.1",
29
+ "@readme/oas-to-har": "^23.0.8",
30
30
  "caseless": "^0.12.0",
31
31
  "datauri": "^4.1.0",
32
32
  "fetch-har": "^10.0.0",
33
33
  "get-stream": "^6.0.1",
34
34
  "json-schema-traverse": "^1.0.0",
35
35
  "lodash.merge": "^4.6.2",
36
- "oas": "^20.10.3",
36
+ "oas": "^22.0.0",
37
37
  "remove-undefined-objects": "^3.0.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@api/test-utils": "file:../test-utils",
40
+ "@api/test-utils": "^7.0.0-alpha.2",
41
41
  "@readme/oas-examples": "^5.12.0",
42
42
  "@types/caseless": "^0.12.3",
43
43
  "@types/lodash.merge": "^4.6.7",
44
44
  "@vitest/coverage-v8": "^0.34.4",
45
45
  "fetch-mock": "^9.11.0",
46
46
  "typescript": "^5.2.2",
47
- "vitest": "^0.34.4"
47
+ "vitest": "^0.34.5"
48
48
  },
49
- "prettier": "@readme/eslint-config/prettier"
49
+ "prettier": "@readme/eslint-config/prettier",
50
+ "gitHead": "fae2070b68d3f73bad20c92e112d41b4d5875ede"
50
51
  }
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Har } from 'har-format';
2
2
  import type Oas from 'oas';
3
- import type { Operation } from 'oas';
4
- import type { HttpMethods } from 'oas/dist/rmoas.types';
3
+ import type Operation from 'oas/operation';
4
+ import type { HttpMethods } from 'oas/rmoas.types';
5
5
 
6
6
  import oasToHar from '@readme/oas-to-har';
7
7
  import fetchHar from 'fetch-har';
@@ -1,5 +1,5 @@
1
- import type { SchemaWrapper } from 'oas/dist/operation/get-parameters-as-json-schema';
2
- import type { SchemaObject } from 'oas/dist/rmoas.types';
1
+ import type { SchemaWrapper } from 'oas/operation/get-parameters-as-json-schema';
2
+ import type { SchemaObject } from 'oas/rmoas.types';
3
3
 
4
4
  import traverse from 'json-schema-traverse';
5
5
 
@@ -1,6 +1,4 @@
1
- import { utils } from 'oas';
2
-
3
- const { matchesMimeType } = utils;
1
+ import { matchesMimeType } from 'oas/utils';
4
2
 
5
3
  export default async function parseResponse<HTTPStatus extends number = number>(response: Response) {
6
4
  const contentType = response.headers.get('Content-Type');
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-underscore-dangle */
2
- import type { Operation } from 'oas';
3
- import type { KeyedSecuritySchemeObject } from 'oas/dist/rmoas.types';
2
+ import type Operation from 'oas/operation';
3
+ import type { KeyedSecuritySchemeObject } from 'oas/rmoas.types';
4
4
 
5
5
  export default function prepareAuth(authKey: (number | string)[], operation: Operation) {
6
6
  if (authKey.length === 0) {
@@ -1,6 +1,6 @@
1
1
  import type { ReadStream } from 'node:fs';
2
- import type { Operation } from 'oas';
3
- import type { ParameterObject, SchemaObject } from 'oas/dist/rmoas.types';
2
+ import type Operation from 'oas/operation';
3
+ import type { ParameterObject, SchemaObject } from 'oas/rmoas.types';
4
4
 
5
5
  import fs from 'node:fs';
6
6
  import path from 'node:path';
package/tsconfig.json CHANGED
@@ -5,8 +5,10 @@
5
5
  "declaration": true,
6
6
  "esModuleInterop": true,
7
7
  "lib": ["DOM", "DOM.Iterable", "ES2020"],
8
+ "module": "NodeNext",
8
9
  "noImplicitAny": true,
9
10
  "outDir": "dist/",
11
+ "skipLibCheck": true,
10
12
  "strict": true
11
13
  },
12
14
  "include": ["./src/**/*"]