@scalar/oas-utils 0.10.8 → 0.10.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/CHANGELOG.md +8 -0
- package/dist/entities/cookie/cookie.js +11 -15
- package/dist/entities/cookie/index.js +1 -5
- package/dist/entities/environment/environment.js +7 -11
- package/dist/entities/environment/index.js +1 -5
- package/dist/entities/hotkeys/hotkeys.js +116 -111
- package/dist/entities/hotkeys/index.js +1 -6
- package/dist/entities/shared/index.js +1 -7
- package/dist/entities/shared/utility.js +9 -9
- package/dist/entities/spec/collection.js +91 -89
- package/dist/entities/spec/index.js +10 -59
- package/dist/entities/spec/operation.js +6 -6
- package/dist/entities/spec/parameters.js +38 -38
- package/dist/entities/spec/request-examples.js +421 -331
- package/dist/entities/spec/requests.js +102 -84
- package/dist/entities/spec/server.js +61 -46
- package/dist/entities/spec/spec-objects.js +121 -76
- package/dist/entities/spec/x-scalar-environments.js +18 -20
- package/dist/entities/spec/x-scalar-secrets.js +6 -8
- package/dist/entities/workspace/index.js +1 -7
- package/dist/entities/workspace/workspace.js +47 -46
- package/dist/helpers/client-plugins.js +13 -13
- package/dist/helpers/fetch-document.js +30 -25
- package/dist/helpers/fetch-with-proxy-fallback.js +26 -21
- package/dist/helpers/index.d.ts +1 -2
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +80 -119
- package/dist/helpers/normalize-mime-type-object.js +19 -18
- package/dist/helpers/normalize-mime-type.js +11 -9
- package/dist/helpers/operation-stability.js +25 -20
- package/dist/helpers/parse.d.ts +0 -4
- package/dist/helpers/parse.d.ts.map +1 -1
- package/dist/helpers/parse.js +77 -77
- package/dist/helpers/schema-model.js +13 -16
- package/dist/helpers/security/get-schemes.js +7 -8
- package/dist/helpers/security/has-token.js +18 -19
- package/dist/helpers/security/index.js +2 -7
- package/dist/helpers/servers.js +128 -79
- package/dist/helpers/should-ignore-entity.js +4 -5
- package/dist/migrations/data-version.js +15 -7
- package/dist/migrations/generate-types.js +34 -37
- package/dist/migrations/index.js +4 -18
- package/dist/migrations/local-storage.js +31 -29
- package/dist/migrations/migrate-to-indexdb.js +706 -529
- package/dist/migrations/migrator.js +58 -54
- package/dist/migrations/semver.js +24 -24
- package/dist/migrations/v-0.0.0/types.generated.js +1 -1
- package/dist/migrations/v-2.1.0/migration.js +272 -258
- package/dist/migrations/v-2.1.0/types.generated.js +1 -1
- package/dist/migrations/v-2.2.0/migration.js +99 -96
- package/dist/migrations/v-2.2.0/types.generated.js +1 -1
- package/dist/migrations/v-2.3.0/migration.js +45 -48
- package/dist/migrations/v-2.3.0/types.generated.js +1 -1
- package/dist/migrations/v-2.4.0/migration.js +25 -25
- package/dist/migrations/v-2.4.0/types.generated.js +1 -1
- package/dist/migrations/v-2.5.0/migration.js +122 -139
- package/dist/migrations/v-2.5.0/types.generated.js +1 -1
- package/dist/spec-getters/get-example-from-schema.js +489 -385
- package/dist/spec-getters/get-parameters-from-operation.js +39 -23
- package/dist/spec-getters/get-request-body-from-operation.d.ts.map +1 -1
- package/dist/spec-getters/get-request-body-from-operation.js +168 -126
- package/dist/spec-getters/get-server-variable-examples.js +10 -13
- package/dist/spec-getters/index.js +4 -11
- package/dist/transforms/import-spec.js +381 -291
- package/dist/transforms/index.js +1 -11
- package/package.json +15 -19
- package/dist/entities/cookie/cookie.js.map +0 -7
- package/dist/entities/cookie/index.js.map +0 -7
- package/dist/entities/environment/environment.js.map +0 -7
- package/dist/entities/environment/index.js.map +0 -7
- package/dist/entities/hotkeys/hotkeys.js.map +0 -7
- package/dist/entities/hotkeys/index.js.map +0 -7
- package/dist/entities/shared/index.js.map +0 -7
- package/dist/entities/shared/utility.js.map +0 -7
- package/dist/entities/spec/collection.js.map +0 -7
- package/dist/entities/spec/index.js.map +0 -7
- package/dist/entities/spec/operation.js.map +0 -7
- package/dist/entities/spec/parameters.js.map +0 -7
- package/dist/entities/spec/request-examples.js.map +0 -7
- package/dist/entities/spec/requests.js.map +0 -7
- package/dist/entities/spec/server.js.map +0 -7
- package/dist/entities/spec/spec-objects.js.map +0 -7
- package/dist/entities/spec/x-scalar-environments.js.map +0 -7
- package/dist/entities/spec/x-scalar-secrets.js.map +0 -7
- package/dist/entities/workspace/index.js.map +0 -7
- package/dist/entities/workspace/workspace.js.map +0 -7
- package/dist/helpers/client-plugins.js.map +0 -7
- package/dist/helpers/fetch-document.js.map +0 -7
- package/dist/helpers/fetch-with-proxy-fallback.js.map +0 -7
- package/dist/helpers/index.js.map +0 -7
- package/dist/helpers/normalize-mime-type-object.js.map +0 -7
- package/dist/helpers/normalize-mime-type.js.map +0 -7
- package/dist/helpers/operation-stability.js.map +0 -7
- package/dist/helpers/parse.js.map +0 -7
- package/dist/helpers/pretty-print-json.d.ts +0 -9
- package/dist/helpers/pretty-print-json.d.ts.map +0 -1
- package/dist/helpers/pretty-print-json.js +0 -38
- package/dist/helpers/pretty-print-json.js.map +0 -7
- package/dist/helpers/schema-model.js.map +0 -7
- package/dist/helpers/security/get-schemes.js.map +0 -7
- package/dist/helpers/security/has-token.js.map +0 -7
- package/dist/helpers/security/index.js.map +0 -7
- package/dist/helpers/servers.js.map +0 -7
- package/dist/helpers/should-ignore-entity.js.map +0 -7
- package/dist/migrations/data-version.js.map +0 -7
- package/dist/migrations/generate-types.js.map +0 -7
- package/dist/migrations/index.js.map +0 -7
- package/dist/migrations/local-storage.js.map +0 -7
- package/dist/migrations/migrate-to-indexdb.js.map +0 -7
- package/dist/migrations/migrator.js.map +0 -7
- package/dist/migrations/semver.js.map +0 -7
- package/dist/migrations/v-0.0.0/types.generated.js.map +0 -7
- package/dist/migrations/v-2.1.0/migration.js.map +0 -7
- package/dist/migrations/v-2.1.0/types.generated.js.map +0 -7
- package/dist/migrations/v-2.2.0/migration.js.map +0 -7
- package/dist/migrations/v-2.2.0/types.generated.js.map +0 -7
- package/dist/migrations/v-2.3.0/migration.js.map +0 -7
- package/dist/migrations/v-2.3.0/types.generated.js.map +0 -7
- package/dist/migrations/v-2.4.0/migration.js.map +0 -7
- package/dist/migrations/v-2.4.0/types.generated.js.map +0 -7
- package/dist/migrations/v-2.5.0/migration.js.map +0 -7
- package/dist/migrations/v-2.5.0/types.generated.js.map +0 -7
- package/dist/spec-getters/get-example-from-schema.js.map +0 -7
- package/dist/spec-getters/get-parameters-from-operation.js.map +0 -7
- package/dist/spec-getters/get-request-body-from-operation.js.map +0 -7
- package/dist/spec-getters/get-server-variable-examples.js.map +0 -7
- package/dist/spec-getters/index.js.map +0 -7
- package/dist/transforms/import-spec.js.map +0 -7
- package/dist/transforms/index.js.map +0 -7
|
@@ -1,55 +1,59 @@
|
|
|
1
|
-
import { getLocalStorageVersion, parseLocalStorage } from
|
|
2
|
-
import { semverLessThan } from
|
|
3
|
-
import { migrate_v_2_1_0 } from
|
|
4
|
-
import { migrate_v_2_2_0 } from
|
|
5
|
-
import { migrate_v_2_3_0 } from
|
|
6
|
-
import { migrate_v_2_4_0 } from
|
|
7
|
-
import { migrate_v_2_5_0 } from
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
import { getLocalStorageVersion, parseLocalStorage } from '../migrations/local-storage.js';
|
|
2
|
+
import { semverLessThan } from '../migrations/semver.js';
|
|
3
|
+
import { migrate_v_2_1_0 } from '../migrations/v-2.1.0/migration.js';
|
|
4
|
+
import { migrate_v_2_2_0 } from '../migrations/v-2.2.0/migration.js';
|
|
5
|
+
import { migrate_v_2_3_0 } from '../migrations/v-2.3.0/migration.js';
|
|
6
|
+
import { migrate_v_2_4_0 } from '../migrations/v-2.4.0/migration.js';
|
|
7
|
+
import { migrate_v_2_5_0 } from '../migrations/v-2.5.0/migration.js';
|
|
8
|
+
/** Handles all data migrations per entity */
|
|
9
|
+
export const migrator = () => {
|
|
10
|
+
const dataVersion = getLocalStorageVersion();
|
|
11
|
+
console.info('Data version: ' + dataVersion);
|
|
12
|
+
// First we gather all of the old data
|
|
13
|
+
let data = {
|
|
14
|
+
collections: parseLocalStorage('collection'),
|
|
15
|
+
cookies: parseLocalStorage('cookie'),
|
|
16
|
+
environments: parseLocalStorage('environment'),
|
|
17
|
+
requestExamples: parseLocalStorage('requestExample'),
|
|
18
|
+
requests: parseLocalStorage('request'),
|
|
19
|
+
securitySchemes: parseLocalStorage('securityScheme'),
|
|
20
|
+
servers: parseLocalStorage('server'),
|
|
21
|
+
tags: parseLocalStorage('tag'),
|
|
22
|
+
workspaces: parseLocalStorage('workspace'),
|
|
23
|
+
};
|
|
24
|
+
// 0.0.0 -> 2.1.0 migration
|
|
25
|
+
if (semverLessThan(dataVersion, '2.1.0')) {
|
|
26
|
+
data = migrate_v_2_1_0(data);
|
|
27
|
+
}
|
|
28
|
+
// 2.1.0 -> 2.2.0 migration
|
|
29
|
+
if (semverLessThan(dataVersion, '2.2.0')) {
|
|
30
|
+
data = migrate_v_2_2_0(data);
|
|
31
|
+
}
|
|
32
|
+
// 2.2.0 -> 2.3.0 migration
|
|
33
|
+
if (semverLessThan(dataVersion, '2.3.0')) {
|
|
34
|
+
data = migrate_v_2_3_0(data);
|
|
35
|
+
}
|
|
36
|
+
// 2.3.0 -> 2.4.0 migration
|
|
37
|
+
if (semverLessThan(dataVersion, '2.4.0')) {
|
|
38
|
+
data = migrate_v_2_4_0(data);
|
|
39
|
+
}
|
|
40
|
+
// 2.4.0 -> 2.5.0 migration
|
|
41
|
+
if (semverLessThan(dataVersion, '2.5.0')) {
|
|
42
|
+
data = migrate_v_2_5_0(data);
|
|
43
|
+
}
|
|
44
|
+
// Convert to data array
|
|
45
|
+
return {
|
|
46
|
+
arrays: {
|
|
47
|
+
collections: Object.values(data.collections),
|
|
48
|
+
cookies: Object.values(data.cookies),
|
|
49
|
+
environments: Object.values(data.environments),
|
|
50
|
+
requestExamples: Object.values(data.requestExamples),
|
|
51
|
+
requests: Object.values(data.requests),
|
|
52
|
+
securitySchemes: Object.values(data.securitySchemes),
|
|
53
|
+
servers: Object.values(data.servers),
|
|
54
|
+
tags: Object.values(data.tags),
|
|
55
|
+
workspaces: Object.values(data.workspaces),
|
|
56
|
+
},
|
|
57
|
+
records: data,
|
|
58
|
+
};
|
|
51
59
|
};
|
|
52
|
-
export {
|
|
53
|
-
migrator
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=migrator.js.map
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Compares semver versions and checks if the left one is less than the right
|
|
3
|
+
*/
|
|
4
|
+
export const semverLessThan = (left, right) => {
|
|
5
|
+
// Parse the strings into numbers
|
|
6
|
+
const parseSemver = (version) => {
|
|
7
|
+
const [major = 0, minor = 0, patch = 0] = version.split('.').map((part) => Number.parseInt(part, 10));
|
|
8
|
+
return { major, minor, patch };
|
|
9
|
+
};
|
|
10
|
+
const { major: major1, minor: minor1, patch: patch1 } = parseSemver(left);
|
|
11
|
+
const { major: major2, minor: minor2, patch: patch2 } = parseSemver(right);
|
|
12
|
+
if (major1 < major2) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
if (major1 > major2) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (minor1 < minor2) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
if (minor1 > minor2) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return patch1 < patch2;
|
|
21
25
|
};
|
|
22
|
-
export {
|
|
23
|
-
semverLessThan
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=semver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|