@scalar/oas-utils 0.2.122 → 0.2.124
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 +17 -0
- package/dist/entities/cookie/cookie.d.ts +4 -4
- package/dist/entities/cookie/cookie.js +1 -1
- package/dist/entities/cookie/index.d.ts +1 -1
- package/dist/entities/cookie/index.d.ts.map +1 -1
- package/dist/entities/environment/environment.d.ts +2 -2
- package/dist/entities/environment/environment.js +1 -1
- package/dist/entities/environment/index.d.ts +1 -1
- package/dist/entities/environment/index.d.ts.map +1 -1
- package/dist/entities/hotkeys/index.d.ts +1 -1
- package/dist/entities/hotkeys/index.d.ts.map +1 -1
- package/dist/entities/shared/index.d.ts +1 -1
- package/dist/entities/shared/index.d.ts.map +1 -1
- package/dist/entities/shared/index.js +1 -1
- package/dist/entities/shared/utility.d.ts +0 -16
- package/dist/entities/shared/utility.d.ts.map +1 -1
- package/dist/entities/shared/utility.js +1 -8
- package/dist/entities/spec/collection.d.ts +40 -24
- package/dist/entities/spec/collection.d.ts.map +1 -1
- package/dist/entities/spec/collection.js +9 -2
- package/dist/entities/spec/index.d.ts +10 -11
- package/dist/entities/spec/index.d.ts.map +1 -1
- package/dist/entities/spec/index.js +8 -8
- package/dist/entities/spec/operation.d.ts +23 -23
- package/dist/entities/spec/operation.d.ts.map +1 -1
- package/dist/entities/spec/parameters.d.ts +6 -6
- package/dist/entities/spec/request-examples.d.ts +244 -244
- package/dist/entities/spec/request-examples.d.ts.map +1 -1
- package/dist/entities/spec/request-examples.js +6 -71
- package/dist/entities/spec/requests.d.ts +47 -47
- package/dist/entities/spec/requests.d.ts.map +1 -1
- package/dist/entities/spec/requests.js +3 -2
- package/dist/entities/spec/security.d.ts +39 -39
- package/dist/entities/spec/security.d.ts.map +1 -1
- package/dist/entities/spec/security.js +4 -4
- package/dist/entities/spec/server.d.ts +99 -28
- package/dist/entities/spec/server.d.ts.map +1 -1
- package/dist/entities/spec/server.js +1 -1
- package/dist/entities/spec/spec-objects.d.ts +3 -3
- package/dist/entities/spec/spec-objects.js +1 -1
- package/dist/entities/spec/x-scalar-environments.d.ts +9 -9
- package/dist/entities/spec/x-scalar-secrets.d.ts +4 -4
- package/dist/entities/workspace/index.d.ts +1 -1
- package/dist/entities/workspace/index.d.ts.map +1 -1
- package/dist/entities/workspace/workspace.d.ts +18 -18
- package/dist/entities/workspace/workspace.js +1 -1
- package/dist/helpers/{createHash.d.ts → create-hash.d.ts} +1 -1
- package/dist/helpers/create-hash.d.ts.map +1 -0
- package/dist/helpers/ensure-protocol.js +1 -1
- package/dist/helpers/{fetchSpecFromUrl.d.ts → fetch-spec-from-url.d.ts} +1 -1
- package/dist/helpers/fetch-spec-from-url.d.ts.map +1 -0
- package/dist/helpers/{fetchSpecFromUrl.js → fetch-spec-from-url.js} +1 -1
- package/dist/helpers/{fetchWithProxyFallback.d.ts → fetch-with-proxy-fallback.d.ts} +1 -1
- package/dist/helpers/fetch-with-proxy-fallback.d.ts.map +1 -0
- package/dist/helpers/{fetchWithProxyFallback.js → fetch-with-proxy-fallback.js} +1 -1
- package/dist/helpers/find-variables.d.ts +5 -0
- package/dist/helpers/find-variables.d.ts.map +1 -0
- package/dist/helpers/{findVariables.js → find-variables.js} +1 -1
- package/dist/helpers/{httpMethods.d.ts → http-methods.d.ts} +2 -2
- package/dist/helpers/http-methods.d.ts.map +1 -0
- package/dist/helpers/{httpStatusCodes.d.ts → http-status-codes.d.ts} +1 -1
- package/dist/helpers/http-status-codes.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +27 -26
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +21 -20
- package/dist/helpers/{isLocalUrl.d.ts → is-local-url.d.ts} +1 -1
- package/dist/helpers/is-local-url.d.ts.map +1 -0
- package/dist/helpers/{isValidUrl.d.ts → is-valid-url.d.ts} +1 -1
- package/dist/helpers/is-valid-url.d.ts.map +1 -0
- package/dist/helpers/{iterateTitle.d.ts → iterate-title.d.ts} +1 -1
- package/dist/helpers/iterate-title.d.ts.map +1 -0
- package/dist/helpers/{makeUrlAbsolute.d.ts → make-url-absolute.d.ts} +1 -1
- package/dist/helpers/make-url-absolute.d.ts.map +1 -0
- package/dist/helpers/merge-urls.d.ts.map +1 -1
- package/dist/helpers/merge-urls.js +2 -2
- package/dist/helpers/{normalizeMimeTypeObject.d.ts → normalize-mime-type-object.d.ts} +1 -1
- package/dist/helpers/normalize-mime-type-object.d.ts.map +1 -0
- package/dist/helpers/{normalizeMimeTypeObject.js → normalize-mime-type-object.js} +1 -1
- package/dist/helpers/{normalizeMimeType.d.ts → normalize-mime-type.d.ts} +1 -1
- package/dist/helpers/normalize-mime-type.d.ts.map +1 -0
- package/dist/helpers/parse.js +1 -1
- package/dist/helpers/{prettyPrintJson.d.ts → pretty-print-json.d.ts} +1 -1
- package/dist/helpers/pretty-print-json.d.ts.map +1 -0
- package/dist/helpers/{redirectToProxy.d.ts → redirect-to-proxy.d.ts} +1 -1
- package/dist/helpers/redirect-to-proxy.d.ts.map +1 -0
- package/dist/helpers/{redirectToProxy.js → redirect-to-proxy.js} +2 -2
- package/dist/helpers/{regexHelpers.d.ts → regex-helpers.d.ts} +1 -1
- package/dist/helpers/regex-helpers.d.ts.map +1 -0
- package/dist/helpers/{replaceVariables.d.ts → replace-variables.d.ts} +1 -1
- package/dist/helpers/replace-variables.d.ts.map +1 -0
- package/dist/helpers/{shouldIgnoreEntity.d.ts → should-ignore-entity.d.ts} +3 -2
- package/dist/helpers/should-ignore-entity.d.ts.map +1 -0
- package/dist/helpers/{ssrState.d.ts → ssr-state.d.ts} +1 -1
- package/dist/helpers/ssr-state.d.ts.map +1 -0
- package/dist/helpers/string.d.ts.map +1 -1
- package/dist/helpers/string.js +1 -1
- package/dist/migrations/index.d.ts +3 -3
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/local-storage.d.ts +1 -1
- package/dist/migrations/local-storage.d.ts.map +1 -1
- package/dist/migrations/migrator.d.ts +1 -1
- package/dist/migrations/migrator.d.ts.map +1 -1
- package/dist/migrations/semver.js +1 -1
- package/dist/migrations/v-2.1.0/migration.d.ts +2 -2
- package/dist/migrations/v-2.1.0/migration.d.ts.map +1 -1
- package/dist/migrations/v-2.1.0/migration.js +1 -1
- package/dist/migrations/v-2.2.0/migration.d.ts +2 -2
- package/dist/migrations/v-2.2.0/migration.d.ts.map +1 -1
- package/dist/migrations/v-2.3.0/migration.d.ts +2 -2
- package/dist/migrations/v-2.3.0/migration.d.ts.map +1 -1
- package/dist/migrations/v-2.4.0/migration.d.ts +2 -2
- package/dist/migrations/v-2.4.0/migration.d.ts.map +1 -1
- package/dist/migrations/v-2.5.0/migration.d.ts +2 -2
- package/dist/migrations/v-2.5.0/migration.d.ts.map +1 -1
- package/dist/migrations/v-2.5.0/migration.js +3 -3
- package/dist/migrations/v-2.5.0/types.generated.d.ts +9 -4
- package/dist/migrations/v-2.5.0/types.generated.d.ts.map +1 -1
- package/dist/spec-getters/{getExampleFromSchema.d.ts → get-example-from-schema.d.ts} +1 -1
- package/dist/spec-getters/get-example-from-schema.d.ts.map +1 -0
- package/dist/spec-getters/{getParametersFromOperation.d.ts → get-parameters-from-operation.d.ts} +1 -1
- package/dist/spec-getters/get-parameters-from-operation.d.ts.map +1 -0
- package/dist/spec-getters/{getParametersFromOperation.js → get-parameters-from-operation.js} +1 -1
- package/dist/spec-getters/{getRequestBodyFromOperation.d.ts → get-request-body-from-operation.d.ts} +2 -2
- package/dist/spec-getters/get-request-body-from-operation.d.ts.map +1 -0
- package/dist/spec-getters/{getRequestBodyFromOperation.js → get-request-body-from-operation.js} +7 -7
- package/dist/spec-getters/{getServerVariableExamples.d.ts → get-server-variable-examples.d.ts} +2 -2
- package/dist/spec-getters/get-server-variable-examples.d.ts.map +1 -0
- package/dist/spec-getters/index.d.ts +4 -4
- package/dist/spec-getters/index.d.ts.map +1 -1
- package/dist/spec-getters/index.js +4 -4
- package/dist/transforms/import-spec.d.ts +9 -5
- package/dist/transforms/import-spec.d.ts.map +1 -1
- package/dist/transforms/import-spec.js +39 -29
- package/dist/transforms/index.d.ts +1 -1
- package/dist/transforms/index.d.ts.map +1 -1
- package/dist/transforms/index.js +1 -1
- package/package.json +5 -43
- package/dist/diff/diff.d.ts +0 -13
- package/dist/diff/diff.d.ts.map +0 -1
- package/dist/diff/diff.js +0 -41
- package/dist/diff/index.d.ts +0 -2
- package/dist/diff/index.d.ts.map +0 -1
- package/dist/diff/index.js +0 -1
- package/dist/entities/index.d.ts +0 -2
- package/dist/entities/index.d.ts.map +0 -1
- package/dist/entities/index.js +0 -1
- package/dist/helpers/createHash.d.ts.map +0 -1
- package/dist/helpers/fetchSpecFromUrl.d.ts.map +0 -1
- package/dist/helpers/fetchWithProxyFallback.d.ts.map +0 -1
- package/dist/helpers/findVariables.d.ts +0 -5
- package/dist/helpers/findVariables.d.ts.map +0 -1
- package/dist/helpers/httpMethods.d.ts.map +0 -1
- package/dist/helpers/httpStatusCodes.d.ts.map +0 -1
- package/dist/helpers/isLocalUrl.d.ts.map +0 -1
- package/dist/helpers/isValidUrl.d.ts.map +0 -1
- package/dist/helpers/iterateTitle.d.ts.map +0 -1
- package/dist/helpers/makeUrlAbsolute.d.ts.map +0 -1
- package/dist/helpers/normalizeMimeType.d.ts.map +0 -1
- package/dist/helpers/normalizeMimeTypeObject.d.ts.map +0 -1
- package/dist/helpers/prettyPrintJson.d.ts.map +0 -1
- package/dist/helpers/redirectToProxy.d.ts.map +0 -1
- package/dist/helpers/regexHelpers.d.ts.map +0 -1
- package/dist/helpers/replaceVariables.d.ts.map +0 -1
- package/dist/helpers/shouldIgnoreEntity.d.ts.map +0 -1
- package/dist/helpers/ssrState.d.ts.map +0 -1
- package/dist/migrations/v-0.0.0/index.d.ts +0 -2
- package/dist/migrations/v-0.0.0/index.d.ts.map +0 -1
- package/dist/migrations/v-0.0.0/index.js +0 -1
- package/dist/migrations/v-2.1.0/index.d.ts +0 -3
- package/dist/migrations/v-2.1.0/index.d.ts.map +0 -1
- package/dist/migrations/v-2.1.0/index.js +0 -1
- package/dist/migrations/v-2.2.0/index.d.ts +0 -3
- package/dist/migrations/v-2.2.0/index.d.ts.map +0 -1
- package/dist/migrations/v-2.2.0/index.js +0 -1
- package/dist/migrations/v-2.3.0/index.d.ts +0 -3
- package/dist/migrations/v-2.3.0/index.d.ts.map +0 -1
- package/dist/migrations/v-2.3.0/index.js +0 -1
- package/dist/migrations/v-2.4.0/index.d.ts +0 -3
- package/dist/migrations/v-2.4.0/index.d.ts.map +0 -1
- package/dist/migrations/v-2.4.0/index.js +0 -1
- package/dist/migrations/v-2.5.0/index.d.ts +0 -3
- package/dist/migrations/v-2.5.0/index.d.ts.map +0 -1
- package/dist/migrations/v-2.5.0/index.js +0 -1
- package/dist/spec-getters/getExampleFromSchema.d.ts.map +0 -1
- package/dist/spec-getters/getParametersFromOperation.d.ts.map +0 -1
- package/dist/spec-getters/getRequestBodyFromOperation.d.ts.map +0 -1
- package/dist/spec-getters/getServerVariableExamples.d.ts.map +0 -1
- /package/dist/helpers/{createHash.js → create-hash.js} +0 -0
- /package/dist/helpers/{httpMethods.js → http-methods.js} +0 -0
- /package/dist/helpers/{httpStatusCodes.js → http-status-codes.js} +0 -0
- /package/dist/helpers/{isLocalUrl.js → is-local-url.js} +0 -0
- /package/dist/helpers/{isValidUrl.js → is-valid-url.js} +0 -0
- /package/dist/helpers/{iterateTitle.js → iterate-title.js} +0 -0
- /package/dist/helpers/{makeUrlAbsolute.js → make-url-absolute.js} +0 -0
- /package/dist/helpers/{normalizeMimeType.js → normalize-mime-type.js} +0 -0
- /package/dist/helpers/{prettyPrintJson.js → pretty-print-json.js} +0 -0
- /package/dist/helpers/{regexHelpers.js → regex-helpers.js} +0 -0
- /package/dist/helpers/{replaceVariables.js → replace-variables.js} +0 -0
- /package/dist/helpers/{shouldIgnoreEntity.js → should-ignore-entity.js} +0 -0
- /package/dist/helpers/{ssrState.js → ssr-state.js} +0 -0
- /package/dist/spec-getters/{getExampleFromSchema.js → get-example-from-schema.js} +0 -0
- /package/dist/spec-getters/{getServerVariableExamples.js → get-server-variable-examples.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export { DATA_VERSION, DATA_VERSION_LS_LEY } from './data-version.ts';
|
|
2
|
+
export { migrator } from './migrator.ts';
|
|
3
|
+
export { semverLessThan } from './semver.ts';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../../src/migrations/local-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../../src/migrations/local-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAKzD;;GAEG;AACH,eAAO,MAAM,iBAAiB,UAAW,CAAC,OAAO,OAAO,EAAE,MAAM,OAAO,OAAO,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAKvG,CAAA;AAED,oDAAoD;AACpD,eAAO,MAAM,sBAAsB,QAAO,MAyBzC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { v_2_5_0 } from '../migrations/v-2.5.0/types.generated.ts';
|
|
2
2
|
/** Handles all data migrations per entity */
|
|
3
3
|
export declare const migrator: () => v_2_5_0["DataArray"];
|
|
4
4
|
//# sourceMappingURL=migrator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrator.d.ts","sourceRoot":"","sources":["../../src/migrations/migrator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrator.d.ts","sourceRoot":"","sources":["../../src/migrations/migrator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAA;AAEtE,6CAA6C;AAC7C,eAAO,MAAM,QAAQ,QAAO,OAAO,CAAC,WAAW,CAoD9C,CAAA"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
const semverLessThan = (left, right) => {
|
|
5
5
|
// Parse the strings into numbers
|
|
6
6
|
const parseSemver = (version) => {
|
|
7
|
-
const [major, minor = 0, patch = 0] = version.split('.').map((part) => Number.parseInt(part, 10));
|
|
7
|
+
const [major = 0, minor = 0, patch = 0] = version.split('.').map((part) => Number.parseInt(part, 10));
|
|
8
8
|
return { major, minor, patch };
|
|
9
9
|
};
|
|
10
10
|
const { major: major1, minor: minor1, patch: patch1 } = parseSemver(left);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { v_0_0_0 } from '../../migrations/v-0.0.0/types.generated';
|
|
2
|
-
import type { v_2_1_0 } from './types.generated';
|
|
1
|
+
import type { v_0_0_0 } from '../../migrations/v-0.0.0/types.generated.ts';
|
|
2
|
+
import type { v_2_1_0 } from './types.generated.ts';
|
|
3
3
|
/** V-0.0.0 to V-2.1.0 migration */
|
|
4
4
|
export declare const migrate_v_2_1_0: (data: Omit<v_0_0_0.DataRecord, "folders">) => {
|
|
5
5
|
collections: Record<string, v_2_1_0.Collection>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.1.0/migration.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.1.0/migration.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAA;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEnD,mCAAmC;AACnC,eAAO,MAAM,eAAe,SAAU,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC;;;;;;;;;;CA0UxE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { v_2_1_0 } from '../../migrations/v-2.1.0/types.generated';
|
|
2
|
-
import type { v_2_2_0 } from './types.generated';
|
|
1
|
+
import type { v_2_1_0 } from '../../migrations/v-2.1.0/types.generated.ts';
|
|
2
|
+
import type { v_2_2_0 } from './types.generated.ts';
|
|
3
3
|
/** V-2.1.0 to V-2.2.0 migration */
|
|
4
4
|
export declare const migrate_v_2_2_0: (data: v_2_1_0.DataRecord) => v_2_2_0.DataRecord;
|
|
5
5
|
//# sourceMappingURL=migration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.2.0/migration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.2.0/migration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAA;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAkGnD,mCAAmC;AACnC,eAAO,MAAM,eAAe,SAAU,OAAO,CAAC,UAAU,KAAG,OAAO,CAAC,UA6BlE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { v_2_2_0 } from '../../migrations/v-2.2.0/types.generated';
|
|
2
|
-
import type { v_2_3_0 } from './types.generated';
|
|
1
|
+
import type { v_2_2_0 } from '../../migrations/v-2.2.0/types.generated.ts';
|
|
2
|
+
import type { v_2_3_0 } from './types.generated.ts';
|
|
3
3
|
/** V-2.2.0 to V-2.3.0 migration */
|
|
4
4
|
export declare const migrate_v_2_3_0: (data: v_2_2_0.DataRecord) => v_2_3_0.DataRecord;
|
|
5
5
|
//# sourceMappingURL=migration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.3.0/migration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.3.0/migration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAA;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEnD,mCAAmC;AACnC,eAAO,MAAM,eAAe,SAAU,OAAO,CAAC,UAAU,KAAG,OAAO,CAAC,UAqDlE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { v_2_3_0 } from '../../migrations/v-2.3.0/types.generated';
|
|
2
|
-
import type { v_2_4_0 } from './types.generated';
|
|
1
|
+
import type { v_2_3_0 } from '../../migrations/v-2.3.0/types.generated.ts';
|
|
2
|
+
import type { v_2_4_0 } from './types.generated.ts';
|
|
3
3
|
/** V-2.3.0 to V-2.4.0 migration */
|
|
4
4
|
export declare const migrate_v_2_4_0: (data: v_2_3_0.DataRecord) => v_2_4_0.DataRecord;
|
|
5
5
|
//# sourceMappingURL=migration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.4.0/migration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.4.0/migration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAA;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEnD,mCAAmC;AACnC,eAAO,MAAM,eAAe,SAAU,OAAO,CAAC,UAAU,KAAG,OAAO,CAAC,UA6BlE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { v_2_4_0 } from '../../migrations/v-2.4.0/types.generated';
|
|
2
|
-
import type { v_2_5_0 } from './types.generated';
|
|
1
|
+
import type { v_2_4_0 } from '../../migrations/v-2.4.0/types.generated.ts';
|
|
2
|
+
import type { v_2_5_0 } from './types.generated.ts';
|
|
3
3
|
/** V-2.4.0 to V-2.5.0 migration */
|
|
4
4
|
export declare const migrate_v_2_5_0: (data: v_2_4_0.DataRecord) => v_2_5_0["DataRecord"];
|
|
5
5
|
//# sourceMappingURL=migration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.5.0/migration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.5.0/migration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAA;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEnD,mCAAmC;AACnC,eAAO,MAAM,eAAe,SAAU,OAAO,CAAC,UAAU,KAAG,OAAO,CAAC,YAAY,CAkK9E,CAAA"}
|
|
@@ -22,6 +22,7 @@ const migrate_v_2_5_0 = (data) => {
|
|
|
22
22
|
requests: collection.requests.map((uid) => uid),
|
|
23
23
|
children: collection.children.map((uid) => uid),
|
|
24
24
|
selectedServerUid: collection.selectedServerUid,
|
|
25
|
+
useCollectionSecurity: false,
|
|
25
26
|
};
|
|
26
27
|
return acc;
|
|
27
28
|
}, {});
|
|
@@ -76,10 +77,9 @@ const migrate_v_2_5_0 = (data) => {
|
|
|
76
77
|
uid: server.uid,
|
|
77
78
|
variables: Object.entries(server.variables || {}).reduce((variablesAcc, [variableKey, variable]) => {
|
|
78
79
|
variablesAcc[variableKey] = {
|
|
79
|
-
...variable,
|
|
80
|
-
enum: variable.enum && variable.enum.length > 0 ? variable.enum : undefined,
|
|
81
80
|
default: variable.default ?? '',
|
|
82
|
-
description: variable.description,
|
|
81
|
+
description: variable.description ?? '',
|
|
82
|
+
...(variable.enum?.length && { enum: variable.enum }),
|
|
83
83
|
};
|
|
84
84
|
return variablesAcc;
|
|
85
85
|
}, {}),
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import type { Cookie } from '../../entities/cookie/
|
|
2
|
-
import type { Environment } from '../../entities/environment/
|
|
3
|
-
import type { Collection
|
|
4
|
-
import type {
|
|
1
|
+
import type { Cookie } from '../../entities/cookie/cookie.ts';
|
|
2
|
+
import type { Environment } from '../../entities/environment/environment.ts';
|
|
3
|
+
import type { Collection } from '../../entities/spec/collection.ts';
|
|
4
|
+
import type { RequestExample } from '../../entities/spec/request-examples.ts';
|
|
5
|
+
import type { Request } from '../../entities/spec/requests.ts';
|
|
6
|
+
import type { Server } from '../../entities/spec/server.ts';
|
|
7
|
+
import type { Tag } from '../../entities/spec/spec-objects.ts';
|
|
8
|
+
import type { Workspace } from '../../entities/workspace/workspace.ts';
|
|
9
|
+
import type { SecurityScheme } from '@scalar/types/entities';
|
|
5
10
|
export type v_2_5_0 = {
|
|
6
11
|
Cookie: Cookie;
|
|
7
12
|
Environment: Environment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.generated.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.5.0/types.generated.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.generated.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.5.0/types.generated.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAA;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAA;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE5D,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,WAAW,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;IAChB,cAAc,EAAE,cAAc,CAAA;IAC9B,cAAc,EAAE,cAAc,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,GAAG,CAAA;IACR,SAAS,EAAE,SAAS,CAAA;IAEpB,UAAU,EAAE;QACV,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;QACvC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAC/B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;QACzC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;QAC/C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QACjC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;QAC/C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QACzB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;KACtC,CAAA;IAED,SAAS,EAAE;QACT,WAAW,EAAE,UAAU,EAAE,CAAA;QACzB,OAAO,EAAE,MAAM,EAAE,CAAA;QACjB,YAAY,EAAE,WAAW,EAAE,CAAA;QAC3B,eAAe,EAAE,cAAc,EAAE,CAAA;QACjC,QAAQ,EAAE,OAAO,EAAE,CAAA;QACnB,eAAe,EAAE,cAAc,EAAE,CAAA;QACjC,OAAO,EAAE,MAAM,EAAE,CAAA;QACjB,IAAI,EAAE,GAAG,EAAE,CAAA;QACX,UAAU,EAAE,SAAS,EAAE,CAAA;KACxB,CAAA;CACF,CAAA"}
|
|
@@ -27,4 +27,4 @@ export declare const getExampleFromSchema: (schema: Record<string, any>, options
|
|
|
27
27
|
*/
|
|
28
28
|
omitEmptyAndOptionalProperties?: boolean;
|
|
29
29
|
}, level?: number, parentSchema?: Record<string, any>, name?: string) => any;
|
|
30
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=get-example-from-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../src/spec-getters/get-example-from-schema.ts"],"names":[],"mappings":"AAyDA;;GAEG;AACH,eAAO,MAAM,oBAAoB,WACvB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YACjB;IACR;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC/B;;;OAGG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,UACM,MAAM,iBACE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,SAC3B,MAAM,KACZ,GA8QF,CAAA"}
|
package/dist/spec-getters/{getParametersFromOperation.d.ts → get-parameters-from-operation.d.ts}
RENAMED
|
@@ -8,4 +8,4 @@ import type { BaseParameter, TransformedOperation } from '@scalar/types/legacy';
|
|
|
8
8
|
* - Swagger 2.0: Possible values are "query", "header", "path", "formData" or "body".
|
|
9
9
|
*/
|
|
10
10
|
export declare function getParametersFromOperation(operation: Omit<TransformedOperation, 'httpVerb'>, where: 'query' | 'header' | 'path' | 'cookie' | 'formData' | 'body', requiredOnly?: boolean): BaseParameter[];
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=get-parameters-from-operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-parameters-from-operation.d.ts","sourceRoot":"","sources":["../../src/spec-getters/get-parameters-from-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAI/E;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,EACjD,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,EACnE,YAAY,GAAE,OAAc,GAC3B,aAAa,EAAE,CAiCjB"}
|
package/dist/spec-getters/{getRequestBodyFromOperation.d.ts → get-request-body-from-operation.d.ts}
RENAMED
|
@@ -4,10 +4,10 @@ import type { ContentType, TransformedOperation } from '@scalar/types/legacy';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function getRequestBodyFromOperation(operation: Omit<TransformedOperation, 'httpVerb'>, selectedExampleKey?: string | number, omitEmptyAndOptionalProperties?: boolean): {
|
|
6
6
|
mimeType: ContentType;
|
|
7
|
-
text?: string;
|
|
7
|
+
text?: string | undefined;
|
|
8
8
|
params?: {
|
|
9
9
|
name: string;
|
|
10
10
|
value?: string;
|
|
11
11
|
}[];
|
|
12
12
|
} | null;
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=get-request-body-from-operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-request-body-from-operation.d.ts","sourceRoot":"","sources":["../../src/spec-getters/get-request-body-from-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAyC7E;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,EACjD,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM,EACpC,8BAA8B,CAAC,EAAE,OAAO,GACvC;IACD,QAAQ,EAAE,WAAW,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,EAAE,CAAA;CACJ,GAAG,IAAI,CA+JP"}
|
package/dist/spec-getters/{getRequestBodyFromOperation.js → get-request-body-from-operation.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { json2xml } from '../helpers/json2xml.js';
|
|
2
|
-
import { normalizeMimeTypeObject } from '../helpers/
|
|
3
|
-
import { prettyPrintJson } from '../helpers/
|
|
4
|
-
import { getExampleFromSchema } from './
|
|
5
|
-
import { getParametersFromOperation } from './
|
|
2
|
+
import { normalizeMimeTypeObject } from '../helpers/normalize-mime-type-object.js';
|
|
3
|
+
import { prettyPrintJson } from '../helpers/pretty-print-json.js';
|
|
4
|
+
import { getExampleFromSchema } from './get-example-from-schema.js';
|
|
5
|
+
import { getParametersFromOperation } from './get-parameters-from-operation.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Transform the object into a nested array of objects
|
|
@@ -40,7 +40,7 @@ function getRequestBodyFromOperation(operation, selectedExampleKey, omitEmptyAnd
|
|
|
40
40
|
/** Examples */
|
|
41
41
|
const examples = content?.[mimeType]?.examples ?? content?.['application/json']?.examples;
|
|
42
42
|
// Let’s use the first example
|
|
43
|
-
const selectedExample = examples?.[selectedExampleKey ?? Object.keys(examples ?? {})[0]];
|
|
43
|
+
const selectedExample = examples?.[selectedExampleKey ?? Object.keys(examples ?? {})[0] ?? ''];
|
|
44
44
|
if (selectedExample) {
|
|
45
45
|
return {
|
|
46
46
|
mimeType,
|
|
@@ -59,7 +59,7 @@ function getRequestBodyFromOperation(operation, selectedExampleKey, omitEmptyAnd
|
|
|
59
59
|
if (bodyParameters.length > 0) {
|
|
60
60
|
return {
|
|
61
61
|
mimeType: 'application/json',
|
|
62
|
-
text: prettyPrintJson(bodyParameters[0]
|
|
62
|
+
text: prettyPrintJson(bodyParameters[0]?.value ?? ''),
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
@@ -107,7 +107,7 @@ function getRequestBodyFromOperation(operation, selectedExampleKey, omitEmptyAnd
|
|
|
107
107
|
const exampleFromSchema = requestBodyObject?.schema
|
|
108
108
|
? getExampleFromSchema(requestBodyObject?.schema, {
|
|
109
109
|
mode: 'write',
|
|
110
|
-
omitEmptyAndOptionalProperties: omitEmptyAndOptionalProperties,
|
|
110
|
+
omitEmptyAndOptionalProperties: omitEmptyAndOptionalProperties ?? false,
|
|
111
111
|
})
|
|
112
112
|
: null;
|
|
113
113
|
const body = example ?? exampleFromSchema;
|
package/dist/spec-getters/{getServerVariableExamples.d.ts → get-server-variable-examples.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Server } from '../entities/spec/server.
|
|
1
|
+
import type { Server } from '../entities/spec/server.ts';
|
|
2
2
|
/** Retrieve example values for server variables */
|
|
3
3
|
export declare const getServerVariableExamples: (server: Server) => Record<string, string[]>;
|
|
4
|
-
//# sourceMappingURL=
|
|
4
|
+
//# sourceMappingURL=get-server-variable-examples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-server-variable-examples.d.ts","sourceRoot":"","sources":["../../src/spec-getters/get-server-variable-examples.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAEvD,mDAAmD;AACnD,eAAO,MAAM,yBAAyB,WAAY,MAAM,6BAUvD,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export { getExampleFromSchema } from './get-example-from-schema.ts';
|
|
2
|
+
export { getParametersFromOperation } from './get-parameters-from-operation.ts';
|
|
3
|
+
export { getRequestBodyFromOperation } from './get-request-body-from-operation.ts';
|
|
4
|
+
export { getServerVariableExamples } from './get-server-variable-examples.ts';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spec-getters/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spec-getters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAA;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAA;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getExampleFromSchema } from './
|
|
2
|
-
export { getParametersFromOperation } from './
|
|
3
|
-
export { getRequestBodyFromOperation } from './
|
|
4
|
-
export { getServerVariableExamples } from './
|
|
1
|
+
export { getExampleFromSchema } from './get-example-from-schema.js';
|
|
2
|
+
export { getParametersFromOperation } from './get-parameters-from-operation.js';
|
|
3
|
+
export { getRequestBodyFromOperation } from './get-request-body-from-operation.js';
|
|
4
|
+
export { getServerVariableExamples } from './get-server-variable-examples.js';
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type { SelectedSecuritySchemeUids } from '../entities/shared/utility.js';
|
|
2
|
-
import { type Collection, type CollectionPayload, type Request, type RequestExample, type Server, type Tag } from '../entities/spec/index.js';
|
|
3
|
-
import { type SecurityScheme } from '../entities/spec/security.js';
|
|
4
1
|
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
5
2
|
import type { ApiReferenceConfiguration } from '@scalar/types/api-reference';
|
|
6
3
|
import type { UnknownObject } from '@scalar/types/utils';
|
|
4
|
+
import type { SelectedSecuritySchemeUids } from '../entities/shared/utility.ts';
|
|
5
|
+
import { type Collection, type CollectionPayload } from '../entities/spec/collection.ts';
|
|
6
|
+
import { type RequestExample } from '../entities/spec/request-examples.ts';
|
|
7
|
+
import { type Request } from '../entities/spec/requests.ts';
|
|
8
|
+
import { type SecurityScheme } from '../entities/spec/security.ts';
|
|
9
|
+
import { type Server } from '../entities/spec/server.ts';
|
|
10
|
+
import { type Tag } from '../entities/spec/spec-objects.ts';
|
|
7
11
|
/** Takes a string or object and parses it into an openapi spec compliant schema */
|
|
8
12
|
export declare const parseSchema: (spec: string | UnknownObject, { shouldLoad }?: {
|
|
9
13
|
shouldLoad?: boolean | undefined;
|
|
@@ -21,7 +25,7 @@ export declare const getSelectedSecuritySchemeUids: (securityRequirements: (stri
|
|
|
21
25
|
export declare const getSlugUid: (slug: string) => Collection["uid"];
|
|
22
26
|
export type ImportSpecToWorkspaceArgs = Pick<CollectionPayload, 'documentUrl' | 'watchMode'> & Pick<ApiReferenceConfiguration, 'authentication' | 'baseServerURL' | 'servers' | 'slug'> & {
|
|
23
27
|
/** Sets the preferred security scheme on the collection instead of the requests */
|
|
24
|
-
|
|
28
|
+
useCollectionSecurity?: boolean;
|
|
25
29
|
/** Call the load step from the parser */
|
|
26
30
|
shouldLoad?: boolean;
|
|
27
31
|
};
|
|
@@ -38,7 +42,7 @@ export type ImportSpecToWorkspaceArgs = Pick<CollectionPayload, 'documentUrl' |
|
|
|
38
42
|
* - Proper linking between related components
|
|
39
43
|
* - Easy lookup and reference of dependent entities
|
|
40
44
|
*/
|
|
41
|
-
export declare function importSpecToWorkspace(spec: string | UnknownObject, { authentication, baseServerURL, documentUrl, servers: configuredServers,
|
|
45
|
+
export declare function importSpecToWorkspace(spec: string | UnknownObject, { authentication, baseServerURL, documentUrl, servers: configuredServers, useCollectionSecurity, slug, shouldLoad, watchMode, }?: ImportSpecToWorkspaceArgs): Promise<{
|
|
42
46
|
error: false;
|
|
43
47
|
collection: Collection;
|
|
44
48
|
requests: Request[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-spec.d.ts","sourceRoot":"","sources":["../../src/transforms/import-spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"import-spec.d.ts","sourceRoot":"","sources":["../../src/transforms/import-spec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AAC9E,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAoB,MAAM,+BAA+B,CAAA;AAEzG,OAAO,EAAE,KAAK,cAAc,EAA4B,MAAM,qCAAqC,CAAA;AACnG,OAAO,EAAE,KAAK,OAAO,EAAsC,MAAM,6BAA6B,CAAA;AAC9F,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAE,KAAK,GAAG,EAAa,MAAM,iCAAiC,CAAA;AAMrE,mFAAmF;AACnF,eAAO,MAAM,WAAW,SAAgB,MAAM,GAAG,aAAa;;;IAoC1D;;;OAGG;YAC8C,WAAW,CAAC,QAAQ;;EAGxE,CAAA;AAED,sDAAsD;AACtD,eAAO,MAAM,6BAA6B,yBAClB,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,0BACnB,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,iCAC1B,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,KACvD,0BAaF,CAAA;AAED,iCAAiC;AACjC,eAAO,MAAM,UAAU,SAAU,MAAM,KAA2B,UAAU,CAAC,KAAK,CAAC,CAAA;AAEnF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,WAAW,CAAC,GAC1F,IAAI,CAAC,yBAAyB,EAAE,gBAAgB,GAAG,eAAe,GAAG,SAAS,GAAG,MAAM,CAAC,GAAG;IACzF,mFAAmF;IACnF,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,yCAAyC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,MAAM,GAAG,aAAa,EAC5B,EACE,cAAc,EACd,aAAa,EACb,WAAW,EACX,OAAO,EAAE,iBAAiB,EAC1B,qBAA6B,EAC7B,IAAI,EACJ,UAAU,EACV,SAAiB,GAClB,GAAE,yBAA8B,GAChC,OAAO,CACN;IACE,KAAK,EAAE,KAAK,CAAA;IACZ,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAA;IAC5B,QAAQ,EAAE,cAAc,EAAE,CAAA;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,IAAI,EAAE,GAAG,EAAE,CAAA;IACX,eAAe,EAAE,cAAc,EAAE,CAAA;CAClC,GACD;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,SAAS,CAAA;CAAE,CACnE,CAyWA;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,WAAW,CAAC,YAAY,EAAE,GAAG,SAAS,EAC/C,EAAE,aAAa,EAAE,GAAE,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAM,GACvE,MAAM,EAAE,CA0CV"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { securitySchemeSchema } from '../entities/spec/security.js';
|
|
2
|
-
import { isHttpMethod } from '../helpers/httpMethods.js';
|
|
3
|
-
import { schemaModel } from '../helpers/schema-model.js';
|
|
4
1
|
import { keysOf } from '@scalar/object-utils/arrays';
|
|
5
2
|
import { load, upgrade, dereference } from '@scalar/openapi-parser';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { collectionSchema } from '../entities/spec/collection.js';
|
|
4
|
+
import { createExampleFromRequest } from '../entities/spec/request-examples.js';
|
|
8
5
|
import { requestSchema } from '../entities/spec/requests.js';
|
|
6
|
+
import { securitySchemeSchema } from '../entities/spec/security.js';
|
|
7
|
+
import { serverSchema } from '../entities/spec/server.js';
|
|
9
8
|
import { tagSchema } from '../entities/spec/spec-objects.js';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { isHttpMethod } from '../helpers/http-methods.js';
|
|
10
|
+
import { isDefined } from '../helpers/is-defined.js';
|
|
12
11
|
import { combineUrlAndPath } from '../helpers/merge-urls.js';
|
|
12
|
+
import { schemaModel } from '../helpers/schema-model.js';
|
|
13
13
|
|
|
14
14
|
/** Takes a string or object and parses it into an openapi spec compliant schema */
|
|
15
15
|
const parseSchema = async (spec, { shouldLoad = true } = {}) => {
|
|
@@ -57,7 +57,7 @@ const getSelectedSecuritySchemeUids = (securityRequirements, preferredSecurityNa
|
|
|
57
57
|
const names = securityRequirements[0] && !preferredSecurityNames.length ? [securityRequirements[0]] : preferredSecurityNames;
|
|
58
58
|
// Map names to uids
|
|
59
59
|
const uids = names
|
|
60
|
-
.map((name) =>
|
|
60
|
+
.map((name) => Array.isArray(name) ? name.map((k) => securitySchemeMap[k]).filter(isDefined) : securitySchemeMap[name])
|
|
61
61
|
.filter(isDefined);
|
|
62
62
|
return uids;
|
|
63
63
|
};
|
|
@@ -76,7 +76,7 @@ const getSlugUid = (slug) => `slug-uid-${slug}`;
|
|
|
76
76
|
* - Proper linking between related components
|
|
77
77
|
* - Easy lookup and reference of dependent entities
|
|
78
78
|
*/
|
|
79
|
-
async function importSpecToWorkspace(spec, { authentication, baseServerURL, documentUrl, servers: configuredServers,
|
|
79
|
+
async function importSpecToWorkspace(spec, { authentication, baseServerURL, documentUrl, servers: configuredServers, useCollectionSecurity = false, slug, shouldLoad, watchMode = false, } = {}) {
|
|
80
80
|
const { schema, errors } = await parseSchema(spec, { shouldLoad });
|
|
81
81
|
const importWarnings = [...errors.map((e) => e.message)];
|
|
82
82
|
if (!schema) {
|
|
@@ -105,11 +105,17 @@ async function importSpecToWorkspace(spec, { authentication, baseServerURL, docu
|
|
|
105
105
|
// ---------------------------------------------------------------------------
|
|
106
106
|
// SECURITY HANDLING
|
|
107
107
|
const security = schema.components?.securitySchemes ?? schema?.securityDefinitions ?? {};
|
|
108
|
+
// Toss out a deprecated warning for the old authentication state
|
|
109
|
+
if (authentication?.oAuth2 || authentication?.apiKey || authentication?.http) {
|
|
110
|
+
console.warn(`DEPRECATION WARNING: It looks like you're using legacy authentication config. Please migrate to use the updated config. See https://github.com/scalar/scalar/blob/main/documentation/configuration.md#authentication-partial This will be removed in a future version.`);
|
|
111
|
+
}
|
|
108
112
|
const securitySchemes = Object.entries(security)
|
|
109
113
|
.map?.(([nameKey, _scheme]) => {
|
|
110
114
|
// Apply any transforms we need before parsing
|
|
111
115
|
const payload = {
|
|
112
116
|
..._scheme,
|
|
117
|
+
// Add the new auth config overrides, we keep the old code below for backwards compatibility
|
|
118
|
+
...(authentication?.securitySchemes?.[nameKey] ?? {}),
|
|
113
119
|
nameKey,
|
|
114
120
|
};
|
|
115
121
|
// For oauth2 we need to add the type to the flows + prefill from authentication
|
|
@@ -119,10 +125,15 @@ async function importSpecToWorkspace(spec, { authentication, baseServerURL, docu
|
|
|
119
125
|
if (!payload.flows?.[key]) {
|
|
120
126
|
return;
|
|
121
127
|
}
|
|
128
|
+
// This part handles setting of flows via the new auth config, the rest can be removed in a future version
|
|
129
|
+
payload.flows[key] = {
|
|
130
|
+
...(_scheme.flows?.[key] ?? {}),
|
|
131
|
+
...(authentication?.securitySchemes?.[nameKey]?.flows?.[key] ?? {}),
|
|
132
|
+
};
|
|
122
133
|
const flow = payload.flows[key];
|
|
123
134
|
// Set the type
|
|
124
135
|
flow.type = key;
|
|
125
|
-
// Prefill values from authorization config
|
|
136
|
+
// Prefill values from authorization config - old deprecated config
|
|
126
137
|
if (authentication?.oAuth2) {
|
|
127
138
|
if (authentication.oAuth2.accessToken) {
|
|
128
139
|
flow.token = authentication.oAuth2.accessToken;
|
|
@@ -148,7 +159,7 @@ async function importSpecToWorkspace(spec, { authentication, baseServerURL, docu
|
|
|
148
159
|
}
|
|
149
160
|
});
|
|
150
161
|
}
|
|
151
|
-
// Otherwise we just prefill
|
|
162
|
+
// Otherwise we just prefill - old deprecated config
|
|
152
163
|
else if (authentication) {
|
|
153
164
|
// ApiKey
|
|
154
165
|
if (payload.type === 'apiKey' && authentication.apiKey?.token) {
|
|
@@ -161,14 +172,8 @@ async function importSpecToWorkspace(spec, { authentication, baseServerURL, docu
|
|
|
161
172
|
payload.password = authentication.http.basic.password ?? '';
|
|
162
173
|
}
|
|
163
174
|
// Bearer
|
|
164
|
-
else if (payload.scheme === 'bearer') {
|
|
165
|
-
|
|
166
|
-
payload.token = authentication.http.bearer.token ?? '';
|
|
167
|
-
}
|
|
168
|
-
// Temp multiple bearer
|
|
169
|
-
if (authentication.http?.bearer?.multiple?.[nameKey]) {
|
|
170
|
-
payload.token = authentication.http.bearer.multiple[nameKey];
|
|
171
|
-
}
|
|
175
|
+
else if (payload.scheme === 'bearer' && authentication.http?.bearer?.token) {
|
|
176
|
+
payload.token = authentication.http.bearer.token ?? '';
|
|
172
177
|
}
|
|
173
178
|
}
|
|
174
179
|
}
|
|
@@ -221,7 +226,7 @@ async function importSpecToWorkspace(spec, { authentication, baseServerURL, docu
|
|
|
221
226
|
return securityRequirements.includes(name);
|
|
222
227
|
});
|
|
223
228
|
// Set the initially selected security scheme
|
|
224
|
-
const selectedSecuritySchemeUids = securityRequirements.length && !
|
|
229
|
+
const selectedSecuritySchemeUids = securityRequirements.length && !useCollectionSecurity
|
|
225
230
|
? getSelectedSecuritySchemeUids(securityRequirements, preferredSecurityNames, securitySchemeMap)
|
|
226
231
|
: [];
|
|
227
232
|
const requestPayload = {
|
|
@@ -247,9 +252,11 @@ async function importSpecToWorkspace(spec, { authentication, baseServerURL, docu
|
|
|
247
252
|
// Handle the case of {} for optional
|
|
248
253
|
if (keys.length) {
|
|
249
254
|
const [key] = Object.keys(s);
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
255
|
+
if (key) {
|
|
256
|
+
return {
|
|
257
|
+
[key]: s[key],
|
|
258
|
+
};
|
|
259
|
+
}
|
|
253
260
|
}
|
|
254
261
|
return s;
|
|
255
262
|
});
|
|
@@ -283,17 +290,19 @@ async function importSpecToWorkspace(spec, { authentication, baseServerURL, docu
|
|
|
283
290
|
tags.forEach((t) => {
|
|
284
291
|
t['x-scalar-children']?.forEach((c) => {
|
|
285
292
|
// Add the uid to the appropriate parent.children
|
|
286
|
-
const nestedUid = tagMap[c.tagName]
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
293
|
+
const nestedUid = tagMap[c.tagName]?.uid;
|
|
294
|
+
if (nestedUid) {
|
|
295
|
+
t.children.push(nestedUid);
|
|
296
|
+
// Remove the nested uid from the root folder
|
|
297
|
+
collectionChildren.delete(nestedUid);
|
|
298
|
+
}
|
|
290
299
|
});
|
|
291
300
|
});
|
|
292
301
|
// Add the request UIDs to the tag children (or collection root)
|
|
293
302
|
requests.forEach((r) => {
|
|
294
303
|
if (r.tags?.length) {
|
|
295
304
|
r.tags.forEach((t) => {
|
|
296
|
-
tagMap[t]
|
|
305
|
+
tagMap[t]?.children.push(r.uid);
|
|
297
306
|
});
|
|
298
307
|
}
|
|
299
308
|
else {
|
|
@@ -323,7 +332,7 @@ async function importSpecToWorkspace(spec, { authentication, baseServerURL, docu
|
|
|
323
332
|
// Here we do not filter these as we let the preferredSecurityScheme override the requirements
|
|
324
333
|
const preferredSecurityNames = [authentication?.preferredSecurityScheme ?? []].flat();
|
|
325
334
|
// Set the initially selected security scheme
|
|
326
|
-
const selectedSecuritySchemeUids = (securityRequirements.length || preferredSecurityNames?.length) &&
|
|
335
|
+
const selectedSecuritySchemeUids = (securityRequirements.length || preferredSecurityNames?.length) && useCollectionSecurity
|
|
327
336
|
? getSelectedSecuritySchemeUids(securityRequirements, preferredSecurityNames, securitySchemeMap)
|
|
328
337
|
: [];
|
|
329
338
|
// Set the uid as a prefixed slug if we have one
|
|
@@ -333,6 +342,7 @@ async function importSpecToWorkspace(spec, { authentication, baseServerURL, docu
|
|
|
333
342
|
...schema,
|
|
334
343
|
watchMode,
|
|
335
344
|
documentUrl,
|
|
345
|
+
useCollectionSecurity,
|
|
336
346
|
requests: requests.map((r) => r.uid),
|
|
337
347
|
servers: servers.map((s) => s.uid),
|
|
338
348
|
tags: tags.map((t) => t.uid),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { getSlugUid, importSpecToWorkspace, parseSchema, type ImportSpecToWorkspaceArgs } from './import-spec.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transforms/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transforms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,WAAW,EAAE,KAAK,yBAAyB,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/transforms/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { getSlugUid, importSpecToWorkspace, parseSchema } from './import-spec.js';
|