@aidc-toolkit/core 1.0.37-beta → 1.0.38-beta
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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/website-url.d.ts +29 -0
- package/dist/website-url.d.ts.map +1 -0
- package/dist/website-url.js +60 -0
- package/dist/website-url.js.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +1 -1
- package/src/website-url.ts +78 -0
- package/dist/base-url.d.ts +0 -26
- package/dist/base-url.d.ts.map +0 -1
- package/dist/base-url.js +0 -62
- package/dist/base-url.js.map +0 -1
- package/src/base-url.ts +0 -79
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type * from "./type.js";
|
|
|
18
18
|
export * from "./type-helper.js";
|
|
19
19
|
export * from "./logger.js";
|
|
20
20
|
export * from "./parse-version.js";
|
|
21
|
-
export * from "./
|
|
21
|
+
export * from "./website-url.js";
|
|
22
22
|
export * from "./app-data.js";
|
|
23
23
|
export * from "./app-data-storage.js";
|
|
24
24
|
export * from "./local-app-data-storage.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,mBAAmB,WAAW,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,aAAa,CAAC;AAE5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,mBAAmB,WAAW,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,aAAa,CAAC;AAE5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,YAAY,CAAC;AAE3B,mBAAmB,gBAAgB,CAAC;AAEpC,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
export * from "./type-helper.js";
|
|
18
18
|
export * from "./logger.js";
|
|
19
19
|
export * from "./parse-version.js";
|
|
20
|
-
export * from "./
|
|
20
|
+
export * from "./website-url.js";
|
|
21
21
|
export * from "./app-data.js";
|
|
22
22
|
export * from "./app-data-storage.js";
|
|
23
23
|
export * from "./local-app-data-storage.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,cAAc,kBAAkB,CAAC;AAEjC,cAAc,aAAa,CAAC;AAE5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,cAAc,kBAAkB,CAAC;AAEjC,cAAc,aAAa,CAAC;AAE5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,YAAY,CAAC;AAI3B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alpha URL. Reads from local application storage, path "config", key "resources.local", if present, otherwise defaults
|
|
3
|
+
* to Vite development server URL.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ALPHA_URL: Promise<string>;
|
|
6
|
+
/**
|
|
7
|
+
* AIDC Toolkit website base URL.
|
|
8
|
+
*/
|
|
9
|
+
export declare const WEBSITE_BASE_URL = "https://aidc-toolkit.com";
|
|
10
|
+
/**
|
|
11
|
+
* Determine the website URL based on the package version.
|
|
12
|
+
*
|
|
13
|
+
* @param version
|
|
14
|
+
* Package version.
|
|
15
|
+
*
|
|
16
|
+
* @param includeVersionInProduction
|
|
17
|
+
* If true, the version is included in the URL in production.
|
|
18
|
+
*
|
|
19
|
+
* @param alphaURL
|
|
20
|
+
* URL if pre-release identifier is "alpha".
|
|
21
|
+
*
|
|
22
|
+
* @param nonAlphaRelativeURL
|
|
23
|
+
* Non-alpha URL, relative to website base URL plus pre-release identifier (optional) and version.
|
|
24
|
+
*
|
|
25
|
+
* @returns
|
|
26
|
+
* Fully-formed website URL based on the package version.
|
|
27
|
+
*/
|
|
28
|
+
export declare function websiteURL(version: string, includeVersionInProduction: boolean, alphaURL: string, nonAlphaRelativeURL?: string): string;
|
|
29
|
+
//# sourceMappingURL=website-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"website-url.d.ts","sourceRoot":"","sources":["../src/website-url.ts"],"names":[],"mappings":"AAyBA;;;GAGG;AACH,eAAO,MAAM,SAAS,iBAKrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,6BAA6B,CAAC;AAE3D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,0BAA0B,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM,CAkBvI"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { LocalAppDataStorage } from "./local-app-data-storage.js";
|
|
2
|
+
import { parseVersion } from "./parse-version.js";
|
|
3
|
+
/**
|
|
4
|
+
* Default alpha URL (Vite development server URL) if no local resources found.
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_ALPHA_URL = "http://localhost:5173";
|
|
7
|
+
/**
|
|
8
|
+
* Configuration path, expected to be present in development but not necessarily in production.
|
|
9
|
+
*/
|
|
10
|
+
const CONFIGURATION_PATH = "config";
|
|
11
|
+
/**
|
|
12
|
+
* Key to local resources, expected to be present in development but not necessarily in production.
|
|
13
|
+
*/
|
|
14
|
+
const LOCAL_RESOURCES_KEY = "resources.local";
|
|
15
|
+
/**
|
|
16
|
+
* Alpha URL. Reads from local application storage, path "config", key "resources.local", if present, otherwise defaults
|
|
17
|
+
* to Vite development server URL.
|
|
18
|
+
*/
|
|
19
|
+
export const ALPHA_URL = LocalAppDataStorage.then(async (LocalAppDataStorage) => new LocalAppDataStorage(CONFIGURATION_PATH).read(LOCAL_RESOURCES_KEY)).then(resources =>
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Fallback works regardless of type.
|
|
21
|
+
resources?.alphaURL ?? DEFAULT_ALPHA_URL);
|
|
22
|
+
/**
|
|
23
|
+
* AIDC Toolkit website base URL.
|
|
24
|
+
*/
|
|
25
|
+
export const WEBSITE_BASE_URL = "https://aidc-toolkit.com";
|
|
26
|
+
/**
|
|
27
|
+
* Determine the website URL based on the package version.
|
|
28
|
+
*
|
|
29
|
+
* @param version
|
|
30
|
+
* Package version.
|
|
31
|
+
*
|
|
32
|
+
* @param includeVersionInProduction
|
|
33
|
+
* If true, the version is included in the URL in production.
|
|
34
|
+
*
|
|
35
|
+
* @param alphaURL
|
|
36
|
+
* URL if pre-release identifier is "alpha".
|
|
37
|
+
*
|
|
38
|
+
* @param nonAlphaRelativeURL
|
|
39
|
+
* Non-alpha URL, relative to website base URL plus pre-release identifier (optional) and version.
|
|
40
|
+
*
|
|
41
|
+
* @returns
|
|
42
|
+
* Fully-formed website URL based on the package version.
|
|
43
|
+
*/
|
|
44
|
+
export function websiteURL(version, includeVersionInProduction, alphaURL, nonAlphaRelativeURL) {
|
|
45
|
+
const parsedVersion = parseVersion(version);
|
|
46
|
+
const preReleaseIdentifier = parsedVersion.preReleaseIdentifier;
|
|
47
|
+
let url;
|
|
48
|
+
if (preReleaseIdentifier === "alpha") {
|
|
49
|
+
// Alpha base URL is absolute.
|
|
50
|
+
url = alphaURL;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const preReleaseIdentifierPath = preReleaseIdentifier !== undefined ? `/${preReleaseIdentifier}` : "";
|
|
54
|
+
const versionPath = preReleaseIdentifier !== undefined || includeVersionInProduction ? `/v${parsedVersion.majorVersion}.${parsedVersion.minorVersion}` : "";
|
|
55
|
+
const relativeURL = nonAlphaRelativeURL !== undefined && nonAlphaRelativeURL !== "" ? `/${nonAlphaRelativeURL}` : "";
|
|
56
|
+
url = `${WEBSITE_BASE_URL}${preReleaseIdentifierPath}${versionPath}${relativeURL}`;
|
|
57
|
+
}
|
|
58
|
+
return url;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=website-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"website-url.js","sourceRoot":"","sources":["../src/website-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAElD;;GAEG;AACH,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAEpC;;GAEG;AACH,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAS9C;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,mBAAmB,CAAC,IAAI,CAAC,KAAK,EAAC,mBAAmB,EAAC,EAAE,CAC1E,IAAI,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CACxE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;AACf,6GAA6G;AAC5G,SAA0C,EAAE,QAAQ,IAAI,iBAAiB,CAC7E,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAE3D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,0BAAmC,EAAE,QAAgB,EAAE,mBAA4B;IAC3H,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,oBAAoB,GAAG,aAAa,CAAC,oBAAoB,CAAC;IAEhE,IAAI,GAAW,CAAC;IAEhB,IAAI,oBAAoB,KAAK,OAAO,EAAE,CAAC;QACnC,8BAA8B;QAC9B,GAAG,GAAG,QAAQ,CAAC;IACnB,CAAC;SAAM,CAAC;QACJ,MAAM,wBAAwB,GAAG,oBAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtG,MAAM,WAAW,GAAG,oBAAoB,KAAK,SAAS,IAAI,0BAA0B,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,YAAY,IAAI,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5J,MAAM,WAAW,GAAG,mBAAmB,KAAK,SAAS,IAAI,mBAAmB,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAErH,GAAG,GAAG,GAAG,gBAAgB,GAAG,wBAAwB,GAAG,WAAW,GAAG,WAAW,EAAE,CAAC;IACvF,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidc-toolkit/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.38-beta",
|
|
4
4
|
"description": "Core functionality for AIDC Toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"build:doc": "npm run build:non-prod"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@aidc-toolkit/dev": "1.0.
|
|
31
|
+
"@aidc-toolkit/dev": "1.0.37-beta"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"base64-js": "^1.5.1",
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { LocalAppDataStorage } from "./local-app-data-storage.js";
|
|
2
|
+
import { parseVersion } from "./parse-version.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Default alpha URL (Vite development server URL) if no local resources found.
|
|
6
|
+
*/
|
|
7
|
+
const DEFAULT_ALPHA_URL = "http://localhost:5173";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Configuration path, expected to be present in development but not necessarily in production.
|
|
11
|
+
*/
|
|
12
|
+
const CONFIGURATION_PATH = "config";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Key to local resources, expected to be present in development but not necessarily in production.
|
|
16
|
+
*/
|
|
17
|
+
const LOCAL_RESOURCES_KEY = "resources.local";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Local resources.
|
|
21
|
+
*/
|
|
22
|
+
interface LocalResources {
|
|
23
|
+
alphaURL: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Alpha URL. Reads from local application storage, path "config", key "resources.local", if present, otherwise defaults
|
|
28
|
+
* to Vite development server URL.
|
|
29
|
+
*/
|
|
30
|
+
export const ALPHA_URL = LocalAppDataStorage.then(async LocalAppDataStorage =>
|
|
31
|
+
new LocalAppDataStorage(CONFIGURATION_PATH).read(LOCAL_RESOURCES_KEY)
|
|
32
|
+
).then(resources =>
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Fallback works regardless of type.
|
|
34
|
+
(resources as (LocalResources | undefined))?.alphaURL ?? DEFAULT_ALPHA_URL
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* AIDC Toolkit website base URL.
|
|
39
|
+
*/
|
|
40
|
+
export const WEBSITE_BASE_URL = "https://aidc-toolkit.com";
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Determine the website URL based on the package version.
|
|
44
|
+
*
|
|
45
|
+
* @param version
|
|
46
|
+
* Package version.
|
|
47
|
+
*
|
|
48
|
+
* @param includeVersionInProduction
|
|
49
|
+
* If true, the version is included in the URL in production.
|
|
50
|
+
*
|
|
51
|
+
* @param alphaURL
|
|
52
|
+
* URL if pre-release identifier is "alpha".
|
|
53
|
+
*
|
|
54
|
+
* @param nonAlphaRelativeURL
|
|
55
|
+
* Non-alpha URL, relative to website base URL plus pre-release identifier (optional) and version.
|
|
56
|
+
*
|
|
57
|
+
* @returns
|
|
58
|
+
* Fully-formed website URL based on the package version.
|
|
59
|
+
*/
|
|
60
|
+
export function websiteURL(version: string, includeVersionInProduction: boolean, alphaURL: string, nonAlphaRelativeURL?: string): string {
|
|
61
|
+
const parsedVersion = parseVersion(version);
|
|
62
|
+
const preReleaseIdentifier = parsedVersion.preReleaseIdentifier;
|
|
63
|
+
|
|
64
|
+
let url: string;
|
|
65
|
+
|
|
66
|
+
if (preReleaseIdentifier === "alpha") {
|
|
67
|
+
// Alpha base URL is absolute.
|
|
68
|
+
url = alphaURL;
|
|
69
|
+
} else {
|
|
70
|
+
const preReleaseIdentifierPath = preReleaseIdentifier !== undefined ? `/${preReleaseIdentifier}` : "";
|
|
71
|
+
const versionPath = preReleaseIdentifier !== undefined || includeVersionInProduction ? `/v${parsedVersion.majorVersion}.${parsedVersion.minorVersion}` : "";
|
|
72
|
+
const relativeURL = nonAlphaRelativeURL !== undefined && nonAlphaRelativeURL !== "" ? `/${nonAlphaRelativeURL}` : "";
|
|
73
|
+
|
|
74
|
+
url = `${WEBSITE_BASE_URL}${preReleaseIdentifierPath}${versionPath}${relativeURL}`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return url;
|
|
78
|
+
}
|
package/dist/base-url.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Alpha base URL. Reads from local application storage, path "config", key "resources.local", if present, otherwise
|
|
3
|
-
* defaults to the Vite server URL.
|
|
4
|
-
*/
|
|
5
|
-
export declare const ALPHA_BASE_URL: Promise<string>;
|
|
6
|
-
/**
|
|
7
|
-
* AIDC Toolkit base URL.
|
|
8
|
-
*/
|
|
9
|
-
export declare const AIDC_TOOLKIT_BASE_URL = "https://aidc-toolkit.com";
|
|
10
|
-
/**
|
|
11
|
-
* Determine the base URL for the phase based on the package version.
|
|
12
|
-
*
|
|
13
|
-
* @param version
|
|
14
|
-
* Package version.
|
|
15
|
-
*
|
|
16
|
-
* @param alphaBaseURL
|
|
17
|
-
* Alpha base URL.
|
|
18
|
-
*
|
|
19
|
-
* @param nonAlphaRelativeURL
|
|
20
|
-
* Non-alpha URL, relative to non-alpha base URL and optionally the pre-release identifier and version.
|
|
21
|
-
*
|
|
22
|
-
* @returns
|
|
23
|
-
* Fully-formed base URL for the phase.
|
|
24
|
-
*/
|
|
25
|
-
export declare function baseURL(version: string, alphaBaseURL: string, nonAlphaRelativeURL?: string): string;
|
|
26
|
-
//# sourceMappingURL=base-url.d.ts.map
|
package/dist/base-url.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-url.d.ts","sourceRoot":"","sources":["../src/base-url.ts"],"names":[],"mappings":"AAyBA;;;GAGG;AACH,eAAO,MAAM,cAAc,iBAK1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAEhE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM,CAsBnG"}
|
package/dist/base-url.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { LocalAppDataStorage } from "./local-app-data-storage.js";
|
|
2
|
-
import { parseVersion } from "./parse-version.js";
|
|
3
|
-
/**
|
|
4
|
-
* Default alpha URL (Vite development URL) if no local resources file is found.
|
|
5
|
-
*/
|
|
6
|
-
const DEFAULT_ALPHA_BASE_URL = "http://localhost:5173";
|
|
7
|
-
/**
|
|
8
|
-
* Configuration path, expected to be present in development but not necessarily in production.
|
|
9
|
-
*/
|
|
10
|
-
const CONFIGURATION_PATH = "config";
|
|
11
|
-
/**
|
|
12
|
-
* Key to local resources, expected to be present in development but not necessarily in production.
|
|
13
|
-
*/
|
|
14
|
-
const LOCAL_RESOURCES_KEY = "resources.local";
|
|
15
|
-
/**
|
|
16
|
-
* Alpha base URL. Reads from local application storage, path "config", key "resources.local", if present, otherwise
|
|
17
|
-
* defaults to the Vite server URL.
|
|
18
|
-
*/
|
|
19
|
-
export const ALPHA_BASE_URL = LocalAppDataStorage.then(async (LocalAppDataStorage) => new LocalAppDataStorage(CONFIGURATION_PATH).read(LOCAL_RESOURCES_KEY)).then(resources =>
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Fallback works regardless of type.
|
|
21
|
-
resources?.alphaBaseURL ?? DEFAULT_ALPHA_BASE_URL);
|
|
22
|
-
/**
|
|
23
|
-
* AIDC Toolkit base URL.
|
|
24
|
-
*/
|
|
25
|
-
export const AIDC_TOOLKIT_BASE_URL = "https://aidc-toolkit.com";
|
|
26
|
-
/**
|
|
27
|
-
* Determine the base URL for the phase based on the package version.
|
|
28
|
-
*
|
|
29
|
-
* @param version
|
|
30
|
-
* Package version.
|
|
31
|
-
*
|
|
32
|
-
* @param alphaBaseURL
|
|
33
|
-
* Alpha base URL.
|
|
34
|
-
*
|
|
35
|
-
* @param nonAlphaRelativeURL
|
|
36
|
-
* Non-alpha URL, relative to non-alpha base URL and optionally the pre-release identifier and version.
|
|
37
|
-
*
|
|
38
|
-
* @returns
|
|
39
|
-
* Fully-formed base URL for the phase.
|
|
40
|
-
*/
|
|
41
|
-
export function baseURL(version, alphaBaseURL, nonAlphaRelativeURL) {
|
|
42
|
-
const parsedVersion = parseVersion(version);
|
|
43
|
-
const preReleaseIdentifier = parsedVersion.preReleaseIdentifier;
|
|
44
|
-
let url;
|
|
45
|
-
if (preReleaseIdentifier === "alpha") {
|
|
46
|
-
// Alpha base URL is absolute.
|
|
47
|
-
url = alphaBaseURL;
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
const relativeURL = nonAlphaRelativeURL !== undefined && nonAlphaRelativeURL !== "" ? `/${nonAlphaRelativeURL}` : "";
|
|
51
|
-
if (preReleaseIdentifier !== undefined) {
|
|
52
|
-
// Non-alpha base URL is relative to AIDC Toolkit base URL plus pre-release identifier and version.
|
|
53
|
-
url = `${AIDC_TOOLKIT_BASE_URL}/${preReleaseIdentifier}/v${parsedVersion.majorVersion}.${parsedVersion.minorVersion}${relativeURL}`;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
// Production base URL is relative to AIDC Toolkit base URL.
|
|
57
|
-
url = `${AIDC_TOOLKIT_BASE_URL}${relativeURL}`;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return url;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=base-url.js.map
|
package/dist/base-url.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-url.js","sourceRoot":"","sources":["../src/base-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAEvD;;GAEG;AACH,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAEpC;;GAEG;AACH,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAS9C;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC,IAAI,CAAC,KAAK,EAAC,mBAAmB,EAAC,EAAE,CAC/E,IAAI,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CACxE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;AACf,6GAA6G;AAC5G,SAA0C,EAAE,YAAY,IAAI,sBAAsB,CACtF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAEhE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,OAAO,CAAC,OAAe,EAAE,YAAoB,EAAE,mBAA4B;IACvF,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,oBAAoB,GAAG,aAAa,CAAC,oBAAoB,CAAC;IAEhE,IAAI,GAAW,CAAC;IAEhB,IAAI,oBAAoB,KAAK,OAAO,EAAE,CAAC;QACnC,8BAA8B;QAC9B,GAAG,GAAG,YAAY,CAAC;IACvB,CAAC;SAAM,CAAC;QACJ,MAAM,WAAW,GAAG,mBAAmB,KAAK,SAAS,IAAI,mBAAmB,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAErH,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;YACrC,mGAAmG;YACnG,GAAG,GAAG,GAAG,qBAAqB,IAAI,oBAAoB,KAAK,aAAa,CAAC,YAAY,IAAI,aAAa,CAAC,YAAY,GAAG,WAAW,EAAE,CAAC;QACxI,CAAC;aAAM,CAAC;YACJ,4DAA4D;YAC5D,GAAG,GAAG,GAAG,qBAAqB,GAAG,WAAW,EAAE,CAAC;QACnD,CAAC;IACL,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC"}
|
package/src/base-url.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { LocalAppDataStorage } from "./local-app-data-storage.js";
|
|
2
|
-
import { parseVersion } from "./parse-version.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Default alpha URL (Vite development URL) if no local resources file is found.
|
|
6
|
-
*/
|
|
7
|
-
const DEFAULT_ALPHA_BASE_URL = "http://localhost:5173";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Configuration path, expected to be present in development but not necessarily in production.
|
|
11
|
-
*/
|
|
12
|
-
const CONFIGURATION_PATH = "config";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Key to local resources, expected to be present in development but not necessarily in production.
|
|
16
|
-
*/
|
|
17
|
-
const LOCAL_RESOURCES_KEY = "resources.local";
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Local resources.
|
|
21
|
-
*/
|
|
22
|
-
interface LocalResources {
|
|
23
|
-
alphaBaseURL: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Alpha base URL. Reads from local application storage, path "config", key "resources.local", if present, otherwise
|
|
28
|
-
* defaults to the Vite server URL.
|
|
29
|
-
*/
|
|
30
|
-
export const ALPHA_BASE_URL = LocalAppDataStorage.then(async LocalAppDataStorage =>
|
|
31
|
-
new LocalAppDataStorage(CONFIGURATION_PATH).read(LOCAL_RESOURCES_KEY)
|
|
32
|
-
).then(resources =>
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Fallback works regardless of type.
|
|
34
|
-
(resources as (LocalResources | undefined))?.alphaBaseURL ?? DEFAULT_ALPHA_BASE_URL
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* AIDC Toolkit base URL.
|
|
39
|
-
*/
|
|
40
|
-
export const AIDC_TOOLKIT_BASE_URL = "https://aidc-toolkit.com";
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Determine the base URL for the phase based on the package version.
|
|
44
|
-
*
|
|
45
|
-
* @param version
|
|
46
|
-
* Package version.
|
|
47
|
-
*
|
|
48
|
-
* @param alphaBaseURL
|
|
49
|
-
* Alpha base URL.
|
|
50
|
-
*
|
|
51
|
-
* @param nonAlphaRelativeURL
|
|
52
|
-
* Non-alpha URL, relative to non-alpha base URL and optionally the pre-release identifier and version.
|
|
53
|
-
*
|
|
54
|
-
* @returns
|
|
55
|
-
* Fully-formed base URL for the phase.
|
|
56
|
-
*/
|
|
57
|
-
export function baseURL(version: string, alphaBaseURL: string, nonAlphaRelativeURL?: string): string {
|
|
58
|
-
const parsedVersion = parseVersion(version);
|
|
59
|
-
const preReleaseIdentifier = parsedVersion.preReleaseIdentifier;
|
|
60
|
-
|
|
61
|
-
let url: string;
|
|
62
|
-
|
|
63
|
-
if (preReleaseIdentifier === "alpha") {
|
|
64
|
-
// Alpha base URL is absolute.
|
|
65
|
-
url = alphaBaseURL;
|
|
66
|
-
} else {
|
|
67
|
-
const relativeURL = nonAlphaRelativeURL !== undefined && nonAlphaRelativeURL !== "" ? `/${nonAlphaRelativeURL}` : "";
|
|
68
|
-
|
|
69
|
-
if (preReleaseIdentifier !== undefined) {
|
|
70
|
-
// Non-alpha base URL is relative to AIDC Toolkit base URL plus pre-release identifier and version.
|
|
71
|
-
url = `${AIDC_TOOLKIT_BASE_URL}/${preReleaseIdentifier}/v${parsedVersion.majorVersion}.${parsedVersion.minorVersion}${relativeURL}`;
|
|
72
|
-
} else {
|
|
73
|
-
// Production base URL is relative to AIDC Toolkit base URL.
|
|
74
|
-
url = `${AIDC_TOOLKIT_BASE_URL}${relativeURL}`;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return url;
|
|
79
|
-
}
|