@equinor/fusion-framework-module-msal 4.0.8 → 4.1.0
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 +40 -0
- package/README.md +203 -48
- package/dist/esm/__tests__/versioning/resolve-version.test.js +207 -0
- package/dist/esm/__tests__/versioning/resolve-version.test.js.map +1 -0
- package/dist/esm/static.js +1 -1
- package/dist/esm/v2/provider.js +1 -1
- package/dist/esm/v2/provider.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/versioning/VersionError.js +78 -0
- package/dist/esm/versioning/VersionError.js.map +1 -0
- package/dist/esm/versioning/create-version-message.js +54 -0
- package/dist/esm/versioning/create-version-message.js.map +1 -0
- package/dist/esm/versioning/index.js +25 -0
- package/dist/esm/versioning/index.js.map +1 -0
- package/dist/esm/versioning/resolve-version.js +90 -0
- package/dist/esm/versioning/resolve-version.js.map +1 -0
- package/dist/esm/versioning/static.js +10 -0
- package/dist/esm/versioning/static.js.map +1 -0
- package/dist/esm/versioning/types.js +2 -0
- package/dist/esm/versioning/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/__tests__/versioning/resolve-version.test.d.ts +1 -0
- package/dist/types/static.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/versioning/VersionError.d.ts +73 -0
- package/dist/types/versioning/create-version-message.d.ts +34 -0
- package/dist/types/versioning/index.d.ts +23 -0
- package/dist/types/versioning/resolve-version.d.ts +43 -0
- package/dist/types/versioning/static.d.ts +8 -0
- package/dist/types/versioning/types.d.ts +54 -0
- package/package.json +5 -4
- package/src/__tests__/versioning/resolve-version.test.ts +255 -0
- package/src/v2/provider.ts +1 -1
- package/src/version.ts +1 -1
- package/src/versioning/VersionError.ts +103 -0
- package/src/versioning/create-version-message.ts +63 -0
- package/src/versioning/index.ts +29 -0
- package/src/versioning/resolve-version.ts +125 -0
- package/src/versioning/static.ts +8 -0
- package/src/versioning/types.ts +60 -0
- package/tsconfig.json +1 -1
- package/vitest.config.ts +11 -0
- package/dist/esm/resolve-version.js +0 -27
- package/dist/esm/resolve-version.js.map +0 -1
- package/dist/types/resolve-version.d.ts +0 -10
- package/src/resolve-version.ts +0 -43
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { SemVer } from 'semver';
|
|
2
|
+
import { VersionMessageType } from './static';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates a human-readable version message based on the version message type.
|
|
6
|
+
*
|
|
7
|
+
* This function generates descriptive error messages for different version compatibility
|
|
8
|
+
* scenarios, helping developers understand version-related issues.
|
|
9
|
+
*
|
|
10
|
+
* @param type - The type of version message to create
|
|
11
|
+
* @param requestedVersion - The version that was requested by the user
|
|
12
|
+
* @param latestVersion - The latest available version in the system
|
|
13
|
+
* @returns A formatted, human-readable version message string
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const message = createVersionMessage(
|
|
18
|
+
* VersionMessageType.MajorIncompatibility,
|
|
19
|
+
* '3.0.0',
|
|
20
|
+
* '2.1.0'
|
|
21
|
+
* );
|
|
22
|
+
* // Returns: "Requested major version 3.0.0 is greater than the latest major version 2.1.0"
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const message = createVersionMessage(
|
|
28
|
+
* VersionMessageType.MinorMismatch,
|
|
29
|
+
* '2.1.0',
|
|
30
|
+
* '2.2.0'
|
|
31
|
+
* );
|
|
32
|
+
* // Returns: "Minor version mismatch, requested 2.1.0, latest 2.2.0"
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export const createVersionMessage = (
|
|
36
|
+
type: VersionMessageType,
|
|
37
|
+
requestedVersion: string | SemVer,
|
|
38
|
+
latestVersion: string | SemVer,
|
|
39
|
+
): string => {
|
|
40
|
+
// Convert versions to strings for consistent formatting
|
|
41
|
+
const requestedVersionString = String(requestedVersion);
|
|
42
|
+
const latestVersionString = String(latestVersion);
|
|
43
|
+
switch (type) {
|
|
44
|
+
case VersionMessageType.MajorIncompatibility:
|
|
45
|
+
return `Requested major version ${requestedVersionString} is greater than the latest major version ${latestVersionString}`;
|
|
46
|
+
case VersionMessageType.InvalidVersion:
|
|
47
|
+
return `Invalid version ${requestedVersionString}`;
|
|
48
|
+
case VersionMessageType.InvalidLatestVersion:
|
|
49
|
+
return `Failed to parse latest version "${latestVersionString}" - this indicates the version.ts file was not generated correctly. Check for import errors in the build process.`;
|
|
50
|
+
case VersionMessageType.MinorMismatch:
|
|
51
|
+
return `Minor version mismatch, requested ${requestedVersionString}, latest ${latestVersionString}`;
|
|
52
|
+
case VersionMessageType.PatchDifference:
|
|
53
|
+
return `Patch version difference, requested ${requestedVersionString}, latest ${latestVersionString}`;
|
|
54
|
+
case VersionMessageType.IncompatibleVersion:
|
|
55
|
+
return `Incompatible version, requested ${requestedVersionString}, latest ${latestVersionString}`;
|
|
56
|
+
default:
|
|
57
|
+
return createVersionMessage(
|
|
58
|
+
VersionMessageType.IncompatibleVersion,
|
|
59
|
+
requestedVersion,
|
|
60
|
+
latestVersion,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Versioning module for MSAL module compatibility checking.
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive version resolution and validation functionality
|
|
5
|
+
* for the MSAL module, ensuring compatibility between different MSAL library versions.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { resolveVersion, VersionError } from '@equinor/fusion-framework-module-msal/versioning';
|
|
10
|
+
*
|
|
11
|
+
* try {
|
|
12
|
+
* const result = resolveVersion('2.1.0');
|
|
13
|
+
* console.log('Version is compatible:', result.satisfiesLatest);
|
|
14
|
+
* } catch (error) {
|
|
15
|
+
* if (error instanceof VersionError) {
|
|
16
|
+
* console.error('Version error:', error.message);
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
// Core versioning functionality
|
|
23
|
+
export { resolveVersion } from './resolve-version';
|
|
24
|
+
|
|
25
|
+
// Error handling
|
|
26
|
+
export { VersionError } from './VersionError';
|
|
27
|
+
|
|
28
|
+
// Types
|
|
29
|
+
export type { ResolvedVersion } from './types';
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import semver, { type SemVer } from 'semver';
|
|
2
|
+
|
|
3
|
+
import { MsalModuleVersion } from '../static';
|
|
4
|
+
|
|
5
|
+
import { VersionError } from './VersionError';
|
|
6
|
+
import type { ResolvedVersion } from './types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Resolves and validates a version string against the latest available MSAL version.
|
|
10
|
+
*
|
|
11
|
+
* This function performs comprehensive version checking including:
|
|
12
|
+
* - Parsing and validating the requested version
|
|
13
|
+
* - Checking major version compatibility (throws on incompatibility)
|
|
14
|
+
* - Warning on minor version mismatches (logs warning but continues)
|
|
15
|
+
* - Ignoring patch version differences for maximum compatibility
|
|
16
|
+
*
|
|
17
|
+
* @param version - The version string or SemVer object to resolve. If not provided, defaults to latest.
|
|
18
|
+
* @returns A ResolvedVersion object containing parsed versions and compatibility information
|
|
19
|
+
*
|
|
20
|
+
* @throws {VersionError} When the requested version is invalid or incompatible
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Resolve a specific version
|
|
25
|
+
* const result = resolveVersion('2.1.0');
|
|
26
|
+
* console.log(result.satisfiesLatest); // true if major version matches
|
|
27
|
+
*
|
|
28
|
+
* // Resolve with SemVer object
|
|
29
|
+
* const result2 = resolveVersion(new SemVer('2.0.0'));
|
|
30
|
+
*
|
|
31
|
+
* // Default to latest version
|
|
32
|
+
* const result3 = resolveVersion();
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* // Error handling
|
|
38
|
+
* try {
|
|
39
|
+
* const result = resolveVersion('3.0.0'); // Assuming latest is 2.x
|
|
40
|
+
* } catch (error) {
|
|
41
|
+
* if (error instanceof VersionError) {
|
|
42
|
+
* console.error('Version error:', error.message);
|
|
43
|
+
* }
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export function resolveVersion(version?: string | SemVer): ResolvedVersion {
|
|
48
|
+
// Initialize warnings array to collect any version mismatches
|
|
49
|
+
const warnings: string[] = [];
|
|
50
|
+
|
|
51
|
+
// Parse the requested version, defaulting to latest if not provided
|
|
52
|
+
const versionString = version || MsalModuleVersion.Latest;
|
|
53
|
+
|
|
54
|
+
// Parse versions using coerce for backward compatibility
|
|
55
|
+
const wantedVersion = semver.coerce(versionString);
|
|
56
|
+
const latestVersion = semver.coerce(MsalModuleVersion.Latest);
|
|
57
|
+
|
|
58
|
+
// Validate that the requested version is a valid semver
|
|
59
|
+
if (!wantedVersion) {
|
|
60
|
+
throw VersionError.create(
|
|
61
|
+
VersionError.Type.InvalidVersion,
|
|
62
|
+
versionString,
|
|
63
|
+
MsalModuleVersion.Latest,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// This should never happen! Indicates version.ts was not generated correctly
|
|
68
|
+
// This is a critical build-time issue that needs immediate attention
|
|
69
|
+
if (!latestVersion) {
|
|
70
|
+
throw VersionError.create(
|
|
71
|
+
VersionError.Type.InvalidLatestVersion,
|
|
72
|
+
versionString,
|
|
73
|
+
MsalModuleVersion.Latest,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Major version incompatibility check - this is a hard error
|
|
78
|
+
// Users cannot request a major version that doesn't exist yet
|
|
79
|
+
if (wantedVersion.major > latestVersion.major) {
|
|
80
|
+
throw VersionError.create(
|
|
81
|
+
VersionError.Type.MajorIncompatibility,
|
|
82
|
+
String(wantedVersion),
|
|
83
|
+
String(latestVersion),
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Minor version mismatch - add warning but don't throw
|
|
88
|
+
// This helps developers stay aware of version differences without breaking functionality
|
|
89
|
+
if (wantedVersion.major === latestVersion.major && wantedVersion.minor !== latestVersion.minor) {
|
|
90
|
+
const minorMismatchWarning = VersionError.create(
|
|
91
|
+
VersionError.Type.MinorMismatch,
|
|
92
|
+
String(wantedVersion),
|
|
93
|
+
String(latestVersion),
|
|
94
|
+
);
|
|
95
|
+
warnings.push(minorMismatchWarning.message);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Find the corresponding enum version for the requested major version
|
|
99
|
+
// This is used for module configuration and feature detection
|
|
100
|
+
const enumVersion = Object.values(MsalModuleVersion).find(
|
|
101
|
+
(x) => semver.coerce(x)?.major === wantedVersion.major,
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
// If no matching enum version is found, this indicates a major version
|
|
105
|
+
// that doesn't have a corresponding enum value defined
|
|
106
|
+
if (!enumVersion) {
|
|
107
|
+
throw VersionError.create(
|
|
108
|
+
VersionError.Type.MajorIncompatibility,
|
|
109
|
+
String(wantedVersion),
|
|
110
|
+
String(latestVersion),
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Return comprehensive version resolution result
|
|
115
|
+
return {
|
|
116
|
+
wantedVersion,
|
|
117
|
+
latestVersion,
|
|
118
|
+
isLatest: wantedVersion.compare(latestVersion) === 0,
|
|
119
|
+
satisfiesLatest: wantedVersion.major === latestVersion.major,
|
|
120
|
+
enumVersion,
|
|
121
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
122
|
+
} satisfies ResolvedVersion;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export default resolveVersion;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export enum VersionMessageType {
|
|
2
|
+
MajorIncompatibility = 'major-incompatibility',
|
|
3
|
+
MinorMismatch = 'minor-mismatch',
|
|
4
|
+
PatchDifference = 'patch-difference',
|
|
5
|
+
InvalidVersion = 'invalid-version',
|
|
6
|
+
InvalidLatestVersion = 'invalid-latest-version',
|
|
7
|
+
IncompatibleVersion = 'incompatible-version',
|
|
8
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { SemVer } from 'semver';
|
|
2
|
+
import type { MsalModuleVersion } from '../static';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Result of version resolution containing parsed versions and compatibility information.
|
|
6
|
+
*
|
|
7
|
+
* This type represents the outcome of resolving a version string against the latest
|
|
8
|
+
* available MSAL version, providing detailed compatibility information for consumers.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const result: ResolvedVersion = {
|
|
13
|
+
* wantedVersion: new SemVer('2.1.0'),
|
|
14
|
+
* latestVersion: new SemVer('2.2.0'),
|
|
15
|
+
* isLatest: false,
|
|
16
|
+
* satisfiesLatest: true,
|
|
17
|
+
* enumVersion: MsalModuleVersion.V2
|
|
18
|
+
* };
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export type ResolvedVersion = {
|
|
22
|
+
/**
|
|
23
|
+
* The version that was requested and successfully parsed.
|
|
24
|
+
* This is the SemVer object representing the user's requested version.
|
|
25
|
+
*/
|
|
26
|
+
wantedVersion: SemVer;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The latest available version in the system.
|
|
30
|
+
* This represents the most recent MSAL version that the module supports.
|
|
31
|
+
*/
|
|
32
|
+
latestVersion: SemVer;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Whether the wanted version is exactly the latest version.
|
|
36
|
+
* True when wantedVersion.compare(latestVersion) === 0
|
|
37
|
+
*/
|
|
38
|
+
isLatest: boolean;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Whether the wanted version satisfies the latest major version.
|
|
42
|
+
* True when major versions match, regardless of minor/patch differences.
|
|
43
|
+
* This is the primary compatibility check for MSAL versions.
|
|
44
|
+
*/
|
|
45
|
+
satisfiesLatest: boolean;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The corresponding enum version for the wanted version.
|
|
49
|
+
* Maps the major version number to the appropriate MsalModuleVersion enum value.
|
|
50
|
+
* Used for module configuration and feature detection.
|
|
51
|
+
*/
|
|
52
|
+
enumVersion: MsalModuleVersion;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Optional array of warning messages for version mismatches.
|
|
56
|
+
* Present when there are minor version differences but major versions match.
|
|
57
|
+
* Consumers can check this field to log warnings or handle version differences.
|
|
58
|
+
*/
|
|
59
|
+
warnings?: string[];
|
|
60
|
+
};
|
package/tsconfig.json
CHANGED
package/vitest.config.ts
ADDED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import semver from 'semver';
|
|
2
|
-
import { MsalModuleVersion } from './static';
|
|
3
|
-
export function resolveVersion(version) {
|
|
4
|
-
const wantedVersion = semver.coerce(version || MsalModuleVersion.Latest);
|
|
5
|
-
const latestVersion = semver.coerce(MsalModuleVersion.Latest);
|
|
6
|
-
// check if version is valid semver version
|
|
7
|
-
if (!wantedVersion) {
|
|
8
|
-
throw new Error(`Invalid version ${version} provided`);
|
|
9
|
-
}
|
|
10
|
-
if (!latestVersion) {
|
|
11
|
-
throw new Error('Invalid latest version');
|
|
12
|
-
}
|
|
13
|
-
// check if version is greater than latest
|
|
14
|
-
if (semver.gt(wantedVersion, latestVersion)) {
|
|
15
|
-
throw new Error(`Requested version ${version} is greater than the latest version ${MsalModuleVersion.Latest}`);
|
|
16
|
-
}
|
|
17
|
-
const enumVersion = Object.values(MsalModuleVersion).find((x) => semver.coerce(x)?.major === wantedVersion.major);
|
|
18
|
-
return {
|
|
19
|
-
wantedVersion,
|
|
20
|
-
latestVersion,
|
|
21
|
-
enumVersion,
|
|
22
|
-
isLatest: wantedVersion.compare(latestVersion) === 0,
|
|
23
|
-
satisfiesLatest: wantedVersion.major === latestVersion.major,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export default resolveVersion;
|
|
27
|
-
//# sourceMappingURL=resolve-version.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-version.js","sourceRoot":"","sources":["../../src/resolve-version.ts"],"names":[],"mappings":"AAAA,OAAO,MAAuB,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,UAAU,cAAc,CAAC,OAAwB;IAOrD,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACzE,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC9D,2CAA2C;IAC3C,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,WAAW,CAAC,CAAC;IACzD,CAAC;IAED,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;IAED,0CAA0C;IAC1C,IAAI,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,aAAc,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CACb,qBAAqB,OAAO,uCAAuC,iBAAiB,CAAC,MAAM,EAAE,CAC9F,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,IAAI,CACvD,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,aAAa,CAAC,KAAK,CAClC,CAAC;IAEvB,OAAO;QACL,aAAa;QACb,aAAa;QACb,WAAW;QACX,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC;QACpD,eAAe,EAAE,aAAa,CAAC,KAAK,KAAK,aAAa,CAAC,KAAK;KAC7D,CAAC;AACJ,CAAC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type SemVer } from 'semver';
|
|
2
|
-
import { MsalModuleVersion } from './static';
|
|
3
|
-
export declare function resolveVersion(version: string | SemVer): {
|
|
4
|
-
wantedVersion: SemVer;
|
|
5
|
-
latestVersion: SemVer;
|
|
6
|
-
isLatest: boolean;
|
|
7
|
-
satisfiesLatest: boolean;
|
|
8
|
-
enumVersion: MsalModuleVersion;
|
|
9
|
-
};
|
|
10
|
-
export default resolveVersion;
|
package/src/resolve-version.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import semver, { type SemVer } from 'semver';
|
|
2
|
-
|
|
3
|
-
import { MsalModuleVersion } from './static';
|
|
4
|
-
|
|
5
|
-
export function resolveVersion(version: string | SemVer): {
|
|
6
|
-
wantedVersion: SemVer;
|
|
7
|
-
latestVersion: SemVer;
|
|
8
|
-
isLatest: boolean;
|
|
9
|
-
satisfiesLatest: boolean;
|
|
10
|
-
enumVersion: MsalModuleVersion;
|
|
11
|
-
} {
|
|
12
|
-
const wantedVersion = semver.coerce(version || MsalModuleVersion.Latest);
|
|
13
|
-
const latestVersion = semver.coerce(MsalModuleVersion.Latest);
|
|
14
|
-
// check if version is valid semver version
|
|
15
|
-
if (!wantedVersion) {
|
|
16
|
-
throw new Error(`Invalid version ${version} provided`);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (!latestVersion) {
|
|
20
|
-
throw new Error('Invalid latest version');
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// check if version is greater than latest
|
|
24
|
-
if (semver.gt(wantedVersion, latestVersion!)) {
|
|
25
|
-
throw new Error(
|
|
26
|
-
`Requested version ${version} is greater than the latest version ${MsalModuleVersion.Latest}`,
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const enumVersion = Object.values(MsalModuleVersion).find(
|
|
31
|
-
(x) => semver.coerce(x)?.major === wantedVersion.major,
|
|
32
|
-
) as MsalModuleVersion;
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
wantedVersion,
|
|
36
|
-
latestVersion,
|
|
37
|
-
enumVersion,
|
|
38
|
-
isLatest: wantedVersion.compare(latestVersion) === 0,
|
|
39
|
-
satisfiesLatest: wantedVersion.major === latestVersion.major,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default resolveVersion;
|