@aidc-toolkit/core 1.0.33-beta → 1.0.34-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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Core Package
2
2
 
3
- **Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit contributors**
3
+ **Copyright © 2024-2026 Dolphin Data Development Ltd. and AIDC Toolkit contributors**
4
4
 
5
5
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
6
6
 
@@ -10,10 +10,6 @@ Unless required by applicable law or agreed to in writing, software distributed
10
10
 
11
11
  ## Overview
12
12
 
13
- > [!WARNING]
14
- >
15
- > **This software is in beta**, with production release is scheduled for 2025Q4. To follow the status of this and other projects, go to the AIDC Toolkit [projects](https://github.com/orgs/aidc-toolkit/projects) page.
16
-
17
13
  The AIDC Toolkit `core` package contains artefacts to support other AIDC Toolkit packages; it does not itself provide any of the functionality of the AIDC Toolkit. It is a required dependency for all AIDC Toolkit packages.
18
14
 
19
15
  ## Types and Type Helpers
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit
2
+ * Copyright © 2024-2026 Dolphin Data Development Ltd. and AIDC Toolkit
3
3
  * contributors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,6 +17,8 @@
17
17
  export type * from "./type.js";
18
18
  export * from "./type-helper.js";
19
19
  export * from "./logger.js";
20
+ export * from "./parse-version.js";
21
+ export * from "./phase-url.js";
20
22
  export * from "./app-data.js";
21
23
  export * from "./app-data-storage.js";
22
24
  export * from "./local-app-data-storage.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,mBAAmB,WAAW,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,aAAa,CAAC;AAE5B,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"}
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,gBAAgB,CAAC;AAE/B,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
@@ -1,5 +1,23 @@
1
+ /*!
2
+ * Copyright © 2024-2026 Dolphin Data Development Ltd. and AIDC Toolkit
3
+ * contributors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
1
17
  export * from "./type-helper.js";
2
18
  export * from "./logger.js";
19
+ export * from "./parse-version.js";
20
+ export * from "./phase-url.js";
3
21
  export * from "./app-data.js";
4
22
  export * from "./app-data-storage.js";
5
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":"AAiBA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,aAAa,CAAC;AAE5B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,YAAY,CAAC;AAI3B,cAAc,kBAAkB,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,gBAAgB,CAAC;AAE/B,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,36 @@
1
+ /**
2
+ * Parsed version.
3
+ */
4
+ export interface ParsedVersion {
5
+ /**
6
+ * Major version.
7
+ */
8
+ readonly majorVersion: number;
9
+ /**
10
+ * Minor version.
11
+ */
12
+ readonly minorVersion: number;
13
+ /**
14
+ * Patch version.
15
+ */
16
+ readonly patchVersion: number;
17
+ /**
18
+ * Pre-release identifier.
19
+ */
20
+ readonly preReleaseIdentifier: string | undefined;
21
+ /**
22
+ * Date/time included with pre-release identifier.
23
+ */
24
+ readonly dateTime: string | undefined;
25
+ }
26
+ /**
27
+ * Parse version.
28
+ *
29
+ * @param version
30
+ * Version, typically from package.json.
31
+ *
32
+ * @returns
33
+ * Parsed version.
34
+ */
35
+ export declare function parseVersion(version: string): ParsedVersion;
36
+ //# sourceMappingURL=parse-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-version.d.ts","sourceRoot":"","sources":["../src/parse-version.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IAElD;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAc3D"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Parse version.
3
+ *
4
+ * @param version
5
+ * Version, typically from package.json.
6
+ *
7
+ * @returns
8
+ * Parsed version.
9
+ */
10
+ export function parseVersion(version) {
11
+ const parsedVersionGroups = /^(?<majorVersion>\d+)\.(?<minorVersion>\d+)\.(?<patchVersion>\d+)(?:-(?<preReleaseIdentifier>alpha|beta)(?:\.(?<dateTime>\d{12}))?)?$/u.exec(version)?.groups;
12
+ if (parsedVersionGroups === undefined) {
13
+ throw new Error(`Invalid package version ${version}`);
14
+ }
15
+ return {
16
+ majorVersion: Number(parsedVersionGroups["majorVersion"]),
17
+ minorVersion: Number(parsedVersionGroups["minorVersion"]),
18
+ patchVersion: Number(parsedVersionGroups["patchVersion"]),
19
+ preReleaseIdentifier: parsedVersionGroups["preReleaseIdentifier"],
20
+ dateTime: parsedVersionGroups["dateTime"]
21
+ };
22
+ }
23
+ //# sourceMappingURL=parse-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-version.js","sourceRoot":"","sources":["../src/parse-version.ts"],"names":[],"mappings":"AA8BA;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IACxC,MAAM,mBAAmB,GAAG,wIAAwI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE3L,IAAI,mBAAmB,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO;QACH,YAAY,EAAE,MAAM,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;QACzD,YAAY,EAAE,MAAM,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;QACzD,YAAY,EAAE,MAAM,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;QACzD,oBAAoB,EAAE,mBAAmB,CAAC,sBAAsB,CAAC;QACjE,QAAQ,EAAE,mBAAmB,CAAC,UAAU,CAAC;KAC5C,CAAC;AACN,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Get the URL for the phase as determined by the package version.
3
+ *
4
+ * @param version
5
+ * Package version.
6
+ *
7
+ * @param alphaURL
8
+ * Alpha URL.
9
+ *
10
+ * @param nonAlphaRelativeURL
11
+ * Non-alpha URL, relative to non-alpha base URL plus optionally the pre-release identifier and version.
12
+ *
13
+ * @returns
14
+ * Fully-formed URL for the phase.
15
+ */
16
+ export declare function phaseURL(version: string, alphaURL: string, nonAlphaRelativeURL?: string): string;
17
+ //# sourceMappingURL=phase-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-url.d.ts","sourceRoot":"","sources":["../src/phase-url.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM,CAsBhG"}
@@ -0,0 +1,39 @@
1
+ import { parseVersion } from "./parse-version.js";
2
+ const NON_ALPHA_BASE_URL = "https://aidc-toolkit.com";
3
+ /**
4
+ * Get the URL for the phase as determined by the package version.
5
+ *
6
+ * @param version
7
+ * Package version.
8
+ *
9
+ * @param alphaURL
10
+ * Alpha URL.
11
+ *
12
+ * @param nonAlphaRelativeURL
13
+ * Non-alpha URL, relative to non-alpha base URL plus optionally the pre-release identifier and version.
14
+ *
15
+ * @returns
16
+ * Fully-formed URL for the phase.
17
+ */
18
+ export function phaseURL(version, alphaURL, nonAlphaRelativeURL) {
19
+ const parsedVersion = parseVersion(version);
20
+ const preReleaseIdentifier = parsedVersion.preReleaseIdentifier;
21
+ let url;
22
+ if (preReleaseIdentifier === "alpha") {
23
+ // Alpha URL is absolute.
24
+ url = alphaURL;
25
+ }
26
+ else {
27
+ const relativeURL = nonAlphaRelativeURL !== undefined && nonAlphaRelativeURL !== "" ? `/${nonAlphaRelativeURL}` : "";
28
+ if (preReleaseIdentifier !== undefined) {
29
+ // Non-alpha URL is relative to non-alpha base URL plus pre-release identifier and version.
30
+ url = `${NON_ALPHA_BASE_URL}/${preReleaseIdentifier}/v${parsedVersion.majorVersion}.${parsedVersion.minorVersion}${relativeURL}`;
31
+ }
32
+ else {
33
+ // Production URL is relative to non-alpha base URL.
34
+ url = `${NON_ALPHA_BASE_URL}${relativeURL}`;
35
+ }
36
+ }
37
+ return url;
38
+ }
39
+ //# sourceMappingURL=phase-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-url.js","sourceRoot":"","sources":["../src/phase-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AAEtD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe,EAAE,QAAgB,EAAE,mBAA4B;IACpF,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,yBAAyB;QACzB,GAAG,GAAG,QAAQ,CAAC;IACnB,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,2FAA2F;YAC3F,GAAG,GAAG,GAAG,kBAAkB,IAAI,oBAAoB,KAAK,aAAa,CAAC,YAAY,IAAI,aAAa,CAAC,YAAY,GAAG,WAAW,EAAE,CAAC;QACrI,CAAC;aAAM,CAAC;YACJ,oDAAoD;YACpD,GAAG,GAAG,GAAG,kBAAkB,GAAG,WAAW,EAAE,CAAC;QAChD,CAAC;IACL,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.33-beta",
3
+ "version": "1.0.34-beta",
4
4
  "description": "Core functionality for AIDC Toolkit",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,17 +21,18 @@
21
21
  "scripts": {
22
22
  "lint": "eslint",
23
23
  "tsc-src": "tsc --project tsconfig-src.json",
24
- "build:alpha": "rimraf dist && npm run tsc-src -- --declarationMap --sourceMap",
25
- "build:beta": "npm run build:alpha",
24
+ "build:non-prod": "rimraf dist && npm run tsc-src -- --declarationMap --sourceMap",
25
+ "build:alpha": "npm run build:non-prod && tsc --project tsconfig-config.json --noEmit",
26
+ "build:beta": "npm run build:non-prod",
26
27
  "build:prod": "npm run tsc-src -- --noEmit && tsup",
27
- "build:doc": "npm run build:alpha"
28
+ "build:doc": "npm run build:non-prod"
28
29
  },
29
30
  "devDependencies": {
30
- "@aidc-toolkit/dev": "1.0.33-beta"
31
+ "@aidc-toolkit/dev": "1.0.34-beta"
31
32
  },
32
33
  "dependencies": {
33
34
  "base64-js": "^1.5.1",
34
- "i18next": "^25.7.4",
35
+ "i18next": "^25.8.0",
35
36
  "i18next-browser-languagedetector": "^8.2.0",
36
37
  "i18next-cli-language-detector": "^1.1.8",
37
38
  "tslog": "^4.10.2"
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit
2
+ * Copyright © 2024-2026 Dolphin Data Development Ltd. and AIDC Toolkit
3
3
  * contributors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,11 +14,15 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+
17
18
  export type * from "./type.js";
18
19
  export * from "./type-helper.js";
19
20
 
20
21
  export * from "./logger.js";
21
22
 
23
+ export * from "./parse-version.js";
24
+ export * from "./phase-url.js";
25
+
22
26
  export * from "./app-data.js";
23
27
  export * from "./app-data-storage.js";
24
28
  export * from "./local-app-data-storage.js";
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Parsed version.
3
+ */
4
+ export interface ParsedVersion {
5
+ /**
6
+ * Major version.
7
+ */
8
+ readonly majorVersion: number;
9
+
10
+ /**
11
+ * Minor version.
12
+ */
13
+ readonly minorVersion: number;
14
+
15
+ /**
16
+ * Patch version.
17
+ */
18
+ readonly patchVersion: number;
19
+
20
+ /**
21
+ * Pre-release identifier.
22
+ */
23
+ readonly preReleaseIdentifier: string | undefined;
24
+
25
+ /**
26
+ * Date/time included with pre-release identifier.
27
+ */
28
+ readonly dateTime: string | undefined;
29
+ }
30
+
31
+ /**
32
+ * Parse version.
33
+ *
34
+ * @param version
35
+ * Version, typically from package.json.
36
+ *
37
+ * @returns
38
+ * Parsed version.
39
+ */
40
+ export function parseVersion(version: string): ParsedVersion {
41
+ const parsedVersionGroups = /^(?<majorVersion>\d+)\.(?<minorVersion>\d+)\.(?<patchVersion>\d+)(?:-(?<preReleaseIdentifier>alpha|beta)(?:\.(?<dateTime>\d{12}))?)?$/u.exec(version)?.groups;
42
+
43
+ if (parsedVersionGroups === undefined) {
44
+ throw new Error(`Invalid package version ${version}`);
45
+ }
46
+
47
+ return {
48
+ majorVersion: Number(parsedVersionGroups["majorVersion"]),
49
+ minorVersion: Number(parsedVersionGroups["minorVersion"]),
50
+ patchVersion: Number(parsedVersionGroups["patchVersion"]),
51
+ preReleaseIdentifier: parsedVersionGroups["preReleaseIdentifier"],
52
+ dateTime: parsedVersionGroups["dateTime"]
53
+ };
54
+ }
@@ -0,0 +1,42 @@
1
+ import { parseVersion } from "./parse-version.js";
2
+
3
+ const NON_ALPHA_BASE_URL = "https://aidc-toolkit.com";
4
+
5
+ /**
6
+ * Get the URL for the phase as determined by the package version.
7
+ *
8
+ * @param version
9
+ * Package version.
10
+ *
11
+ * @param alphaURL
12
+ * Alpha URL.
13
+ *
14
+ * @param nonAlphaRelativeURL
15
+ * Non-alpha URL, relative to non-alpha base URL plus optionally the pre-release identifier and version.
16
+ *
17
+ * @returns
18
+ * Fully-formed URL for the phase.
19
+ */
20
+ export function phaseURL(version: string, alphaURL: string, nonAlphaRelativeURL?: string): string {
21
+ const parsedVersion = parseVersion(version);
22
+ const preReleaseIdentifier = parsedVersion.preReleaseIdentifier;
23
+
24
+ let url: string;
25
+
26
+ if (preReleaseIdentifier === "alpha") {
27
+ // Alpha URL is absolute.
28
+ url = alphaURL;
29
+ } else {
30
+ const relativeURL = nonAlphaRelativeURL !== undefined && nonAlphaRelativeURL !== "" ? `/${nonAlphaRelativeURL}` : "";
31
+
32
+ if (preReleaseIdentifier !== undefined) {
33
+ // Non-alpha URL is relative to non-alpha base URL plus pre-release identifier and version.
34
+ url = `${NON_ALPHA_BASE_URL}/${preReleaseIdentifier}/v${parsedVersion.majorVersion}.${parsedVersion.minorVersion}${relativeURL}`;
35
+ } else {
36
+ // Production URL is relative to non-alpha base URL.
37
+ url = `${NON_ALPHA_BASE_URL}${relativeURL}`;
38
+ }
39
+ }
40
+
41
+ return url;
42
+ }