@intra-mart/accel 0.2.0 → 0.3.0-dev.202606150745
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 +148 -4
- package/dist/asset/deployer.js +8 -17
- package/dist/asset/foreach-replacement.d.ts +2 -0
- package/dist/asset/foreach-replacement.js +20 -0
- package/dist/asset/github-provider.d.ts +2 -0
- package/dist/asset/github-provider.js +37 -0
- package/dist/asset/local-provider.js +1 -22
- package/dist/asset/walker.js +4 -15
- package/dist/commands/attach.d.ts +13 -1
- package/dist/commands/attach.js +33 -12
- package/dist/commands/deploy.d.ts +62 -0
- package/dist/commands/deploy.js +293 -0
- package/dist/commands/init.d.ts +13 -1
- package/dist/commands/init.js +33 -12
- package/dist/commands/login.d.ts +31 -0
- package/dist/commands/login.js +75 -0
- package/dist/core/catalog.d.ts +11 -0
- package/dist/core/catalog.js +40 -0
- package/dist/core/condition-evaluator.js +6 -3
- package/dist/core/constants.d.ts +2 -2
- package/dist/core/constants.js +4 -9
- package/dist/core/eval-context.d.ts +3 -0
- package/dist/core/eval-context.js +45 -0
- package/dist/core/types.d.ts +76 -10
- package/dist/core/types.js +2 -1
- package/dist/core/validators.d.ts +7 -2
- package/dist/core/validators.js +25 -12
- package/dist/core/variable-interpolator.d.ts +1 -1
- package/dist/core/variable-interpolator.js +19 -19
- package/dist/deploy/api-client.d.ts +16 -0
- package/dist/deploy/api-client.js +105 -0
- package/dist/deploy/target-scanner.d.ts +5 -0
- package/dist/deploy/target-scanner.js +20 -0
- package/dist/deploy/target-selector.d.ts +11 -0
- package/dist/deploy/target-selector.js +16 -0
- package/dist/i18n/en.js +53 -1
- package/dist/i18n/ja.js +53 -1
- package/dist/i18n/zh_CN.js +53 -1
- package/dist/index.js +4 -0
- package/dist/interactive/credential-auth.d.ts +15 -0
- package/dist/interactive/credential-auth.js +61 -0
- package/dist/interactive/credentials-prompts.d.ts +4 -0
- package/dist/interactive/credentials-prompts.js +85 -0
- package/dist/interactive/prompts.d.ts +3 -0
- package/dist/interactive/prompts.js +125 -26
- package/dist/interactive/summary.js +12 -0
- package/dist/juggling/extractor.d.ts +3 -2
- package/dist/juggling/extractor.js +9 -9
- package/dist/utils/args.d.ts +1 -0
- package/dist/utils/args.js +4 -0
- package/dist/utils/credentials.d.ts +12 -0
- package/dist/utils/credentials.js +46 -0
- package/dist/utils/date-formatter.d.ts +1 -0
- package/dist/utils/date-formatter.js +23 -0
- package/dist/utils/gitignore.d.ts +1 -0
- package/dist/utils/gitignore.js +23 -0
- package/dist/utils/https.d.ts +2 -0
- package/dist/utils/https.js +44 -0
- package/dist/utils/settings-io.d.ts +1 -0
- package/dist/utils/settings-io.js +8 -0
- package/package.json +5 -5
- package/assets/assets.tar.gz +0 -0
- package/dist/asset/default-source.d.ts +0 -1
- package/dist/asset/default-source.js +0 -6
- package/dist/core/module-map.d.ts +0 -3
- package/dist/core/module-map.js +0 -7
- package/dist/core/version-map.d.ts +0 -7
- package/dist/core/version-map.js +0 -45
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { semverToLabel } from "../core/version-map.js";
|
|
1
|
+
import { findReleaseBySemver, findModuleByCatalogId, } from "../core/catalog.js";
|
|
3
2
|
export const extractVersion = (data) => data.baseVersion;
|
|
4
|
-
export const
|
|
5
|
-
export const extractModules = (data) => {
|
|
6
|
-
const selectedModules = data.modules.filter((m) => m.selected);
|
|
3
|
+
export const findRelease = (data) => findReleaseBySemver(data.baseVersion);
|
|
4
|
+
export const extractModules = (data, release) => {
|
|
7
5
|
const result = [];
|
|
8
|
-
for (const mod of
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
for (const mod of data.modules) {
|
|
7
|
+
if (!mod.selected)
|
|
8
|
+
continue;
|
|
9
|
+
const entry = findModuleByCatalogId(release, mod.id);
|
|
10
|
+
if (entry) {
|
|
11
|
+
result.push(entry.artifactId);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
return [...new Set(result)].sort();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const lastFlagValue: (v: unknown) => string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AccelCredentials } from "../core/types.js";
|
|
2
|
+
export declare const CREDENTIALS_GITIGNORE_ENTRY = ".accel/credentials.json";
|
|
3
|
+
export declare const normalizeEndpoint: (raw: string) => string;
|
|
4
|
+
export declare const ENDPOINT_ENV = "ACCEL_ENDPOINT";
|
|
5
|
+
export declare const API_KEY_ENV = "ACCEL_API_KEY";
|
|
6
|
+
export declare const resolveCredentialInputs: (flags: {
|
|
7
|
+
endpoint?: string;
|
|
8
|
+
apiKey?: string;
|
|
9
|
+
}, env: Record<string, string | undefined>) => Partial<AccelCredentials>;
|
|
10
|
+
export declare const readCredentials: (projectDir: string) => Promise<Partial<AccelCredentials>>;
|
|
11
|
+
export declare const writeCredentials: (projectDir: string, creds: AccelCredentials) => Promise<void>;
|
|
12
|
+
export declare const persistCredentials: (projectDir: string, creds: AccelCredentials) => Promise<void>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { ensureGitignoreEntry } from "./gitignore.js";
|
|
4
|
+
const ACCEL_DIR = ".accel";
|
|
5
|
+
const CREDENTIALS_FILE = "credentials.json";
|
|
6
|
+
export const CREDENTIALS_GITIGNORE_ENTRY = `${ACCEL_DIR}/${CREDENTIALS_FILE}`;
|
|
7
|
+
export const normalizeEndpoint = (raw) => raw.trim().replace(/\/+$/, "");
|
|
8
|
+
export const ENDPOINT_ENV = "ACCEL_ENDPOINT";
|
|
9
|
+
export const API_KEY_ENV = "ACCEL_API_KEY";
|
|
10
|
+
export const resolveCredentialInputs = (flags, env) => {
|
|
11
|
+
const pick = (flag, envVal) => {
|
|
12
|
+
const raw = flag ?? envVal;
|
|
13
|
+
return raw && raw.trim().length > 0 ? raw : undefined;
|
|
14
|
+
};
|
|
15
|
+
const endpoint = pick(flags.endpoint, env[ENDPOINT_ENV]);
|
|
16
|
+
const apiKey = pick(flags.apiKey, env[API_KEY_ENV]);
|
|
17
|
+
const result = {};
|
|
18
|
+
if (endpoint !== undefined)
|
|
19
|
+
result.endpoint = normalizeEndpoint(endpoint);
|
|
20
|
+
if (apiKey !== undefined)
|
|
21
|
+
result.apiKey = apiKey;
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
export const readCredentials = async (projectDir) => {
|
|
25
|
+
const filePath = join(projectDir, ACCEL_DIR, CREDENTIALS_FILE);
|
|
26
|
+
try {
|
|
27
|
+
const content = await readFile(filePath, "utf-8");
|
|
28
|
+
const parsed = JSON.parse(content);
|
|
29
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
30
|
+
return {};
|
|
31
|
+
return parsed;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
export const writeCredentials = async (projectDir, creds) => {
|
|
38
|
+
const accelDir = join(projectDir, ACCEL_DIR);
|
|
39
|
+
await mkdir(accelDir, { recursive: true });
|
|
40
|
+
const filePath = join(accelDir, CREDENTIALS_FILE);
|
|
41
|
+
await writeFile(filePath, JSON.stringify(creds, null, 2) + "\n", "utf-8");
|
|
42
|
+
};
|
|
43
|
+
export const persistCredentials = async (projectDir, creds) => {
|
|
44
|
+
await writeCredentials(projectDir, creds);
|
|
45
|
+
await ensureGitignoreEntry(projectDir, CREDENTIALS_GITIGNORE_ENTRY);
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatEpochMillis: (ms: number, locale: string) => string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const INTL_LOCALE_MAP = {
|
|
2
|
+
ja: "ja-JP",
|
|
3
|
+
en: "en-US",
|
|
4
|
+
zh_CN: "zh-CN",
|
|
5
|
+
};
|
|
6
|
+
export const formatEpochMillis = (ms, locale) => {
|
|
7
|
+
if (!Number.isFinite(ms))
|
|
8
|
+
return String(ms);
|
|
9
|
+
const intlLocale = INTL_LOCALE_MAP[locale] ?? INTL_LOCALE_MAP["en"];
|
|
10
|
+
try {
|
|
11
|
+
return new Intl.DateTimeFormat(intlLocale, {
|
|
12
|
+
year: "numeric",
|
|
13
|
+
month: "2-digit",
|
|
14
|
+
day: "2-digit",
|
|
15
|
+
hour: "2-digit",
|
|
16
|
+
minute: "2-digit",
|
|
17
|
+
second: "2-digit",
|
|
18
|
+
}).format(new Date(ms));
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return String(ms);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ensureGitignoreEntry: (projectDir: string, entry: string) => Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
export const ensureGitignoreEntry = async (projectDir, entry) => {
|
|
4
|
+
const gitignorePath = join(projectDir, ".gitignore");
|
|
5
|
+
let content = "";
|
|
6
|
+
try {
|
|
7
|
+
content = await readFile(gitignorePath, "utf-8");
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
content = "";
|
|
11
|
+
}
|
|
12
|
+
const alreadyPresent = content
|
|
13
|
+
.split("\n")
|
|
14
|
+
.some((line) => line.trim() === entry);
|
|
15
|
+
if (alreadyPresent)
|
|
16
|
+
return;
|
|
17
|
+
let next = content;
|
|
18
|
+
if (next.length > 0 && !next.endsWith("\n")) {
|
|
19
|
+
next += "\n";
|
|
20
|
+
}
|
|
21
|
+
next += `${entry}\n`;
|
|
22
|
+
await writeFile(gitignorePath, next, "utf-8");
|
|
23
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { get as httpGet } from "node:http";
|
|
2
|
+
import { get as httpsGet } from "node:https";
|
|
3
|
+
import { createWriteStream } from "node:fs";
|
|
4
|
+
const MAX_REDIRECTS = 5;
|
|
5
|
+
export const isInsecureRedirect = (from, location) => {
|
|
6
|
+
if (!from.startsWith("https:"))
|
|
7
|
+
return false;
|
|
8
|
+
return new URL(location, from).protocol === "http:";
|
|
9
|
+
};
|
|
10
|
+
export const downloadFile = (url, destPath, redirectsLeft = MAX_REDIRECTS) => {
|
|
11
|
+
const requester = url.startsWith("http:") ? httpGet : httpsGet;
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
requester(url, (response) => {
|
|
14
|
+
const status = response.statusCode ?? 0;
|
|
15
|
+
const location = response.headers.location;
|
|
16
|
+
if (status >= 300 && status < 400 && location) {
|
|
17
|
+
response.resume();
|
|
18
|
+
if (redirectsLeft <= 0) {
|
|
19
|
+
reject(new Error(`Too many redirects when downloading from ${url}`));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (isInsecureRedirect(url, location)) {
|
|
23
|
+
reject(new Error(`Refusing insecure https→http redirect from ${url} to ${location}`));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const nextUrl = new URL(location, url).toString();
|
|
27
|
+
downloadFile(nextUrl, destPath, redirectsLeft - 1).then(resolve, reject);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (status !== 200) {
|
|
31
|
+
response.resume();
|
|
32
|
+
reject(new Error(`HTTP ${status} when downloading from ${url}`));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const file = createWriteStream(destPath);
|
|
36
|
+
response.pipe(file);
|
|
37
|
+
file.on("finish", () => file.close(() => resolve()));
|
|
38
|
+
file.on("error", (err) => {
|
|
39
|
+
file.close();
|
|
40
|
+
reject(err);
|
|
41
|
+
});
|
|
42
|
+
}).on("error", reject);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AccelSettings, HashsumEntry } from "../core/types.js";
|
|
2
2
|
export declare const writeSettings: (projectDir: string, settings: AccelSettings) => Promise<void>;
|
|
3
3
|
export declare const readSettings: (projectDir: string) => Promise<AccelSettings>;
|
|
4
|
+
export declare const readSettingsSafe: (projectDir: string) => Promise<AccelSettings | null>;
|
|
4
5
|
export declare const serializeHashsum: (entries: HashsumEntry[]) => string;
|
|
5
6
|
export declare const parseHashsum: (content: string) => HashsumEntry[];
|
|
6
7
|
export declare const writeHashsum: (projectDir: string, entries: HashsumEntry[]) => Promise<void>;
|
|
@@ -18,6 +18,14 @@ export const readSettings = async (projectDir) => {
|
|
|
18
18
|
const content = await readFile(filePath, "utf-8");
|
|
19
19
|
return JSON.parse(content);
|
|
20
20
|
};
|
|
21
|
+
export const readSettingsSafe = async (projectDir) => {
|
|
22
|
+
try {
|
|
23
|
+
return await readSettings(projectDir);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
21
29
|
export const serializeHashsum = (entries) => {
|
|
22
30
|
const sorted = [...entries].sort((a, b) => a.filePath.localeCompare(b.filePath));
|
|
23
31
|
return sorted
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intra-mart/accel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-dev.202606150745",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI tool for intra-mart Accel Platform development",
|
|
6
6
|
"author": "NTT DATA INTRAMART",
|
|
@@ -19,11 +19,10 @@
|
|
|
19
19
|
"accel": "./dist/index.js"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
"assets/assets.tar.gz"
|
|
22
|
+
"dist"
|
|
24
23
|
],
|
|
25
24
|
"engines": {
|
|
26
|
-
"node": ">=
|
|
25
|
+
"node": ">=24.0.0"
|
|
27
26
|
},
|
|
28
27
|
"publishConfig": {
|
|
29
28
|
"access": "public"
|
|
@@ -40,6 +39,7 @@
|
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
41
|
"@clack/prompts": "^1.4.0",
|
|
42
|
+
"@intra-mart/catalog": "^0.1.0",
|
|
43
43
|
"citty": "^0.1.6",
|
|
44
44
|
"fast-xml-parser": "^5.2.0",
|
|
45
45
|
"remark": "^15.0.1",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"unist-util-visit": "^5.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@types/node": "^
|
|
54
|
+
"@types/node": "^24",
|
|
55
55
|
"@types/semver": "^7.7.0",
|
|
56
56
|
"execa": "^9.5.2",
|
|
57
57
|
"typescript": "^5.8.3",
|
package/assets/assets.tar.gz
DELETED
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const defaultAssetSourcePath: () => string;
|
package/dist/core/module-map.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export const MODULE_ID_MAP = {
|
|
2
|
-
workflow: "jp.co.intra_mart.im_workflow",
|
|
3
|
-
copilot: "jp.co.intra_mart.im_copilot",
|
|
4
|
-
};
|
|
5
|
-
const reverseMap = new Map(Object.entries(MODULE_ID_MAP).map(([key, value]) => [value, key]));
|
|
6
|
-
export const xmlIdToModuleName = (xmlId) => reverseMap.get(xmlId);
|
|
7
|
-
export const moduleNameToXmlId = (moduleName) => MODULE_ID_MAP[moduleName];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { IapVersion } from "./types.js";
|
|
2
|
-
export declare const IAP_VERSIONS: readonly IapVersion[];
|
|
3
|
-
export declare const SELECTABLE_VERSIONS: readonly IapVersion[];
|
|
4
|
-
export declare const labelToSemver: (label: string) => string;
|
|
5
|
-
export declare const semverToLabel: (semver: string) => string;
|
|
6
|
-
export declare const findByLabel: (label: string) => IapVersion | undefined;
|
|
7
|
-
export declare const findBySemver: (semver: string) => IapVersion | undefined;
|
package/dist/core/version-map.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export const IAP_VERSIONS = [
|
|
2
|
-
{ semver: "8.0.19", label: "2018-Spring", codename: "Skylark" },
|
|
3
|
-
{ semver: "8.0.20", label: "2018-Summer", codename: "Tiffany" },
|
|
4
|
-
{ semver: "8.0.21", label: "2018-Winter", codename: "Urara" },
|
|
5
|
-
{ semver: "8.0.22", label: "2019-Spring", codename: "Violette" },
|
|
6
|
-
{ semver: "8.0.23", label: "2019-Summer", codename: "Waltz" },
|
|
7
|
-
{ semver: "8.0.24", label: "2019-Winter", codename: "Xanadu" },
|
|
8
|
-
{ semver: "8.0.25", label: "2020-Spring", codename: "Yorkshire" },
|
|
9
|
-
{ semver: "8.0.26", label: "2020-Summer", codename: "Zephirine" },
|
|
10
|
-
{ semver: "8.0.27", label: "2020-Winter", codename: "Azalea" },
|
|
11
|
-
{ semver: "8.0.28", label: "2021-Spring", codename: "Bergamot" },
|
|
12
|
-
{ semver: "8.0.29", label: "2021-Summer", codename: "Cattleya" },
|
|
13
|
-
{ semver: "8.0.30", label: "2021-Winter", codename: "Dandelion" },
|
|
14
|
-
{ semver: "8.0.31", label: "2022-Spring", codename: "Eustoma" },
|
|
15
|
-
{ semver: "8.0.32", label: "2022-Winter", codename: "Freesia" },
|
|
16
|
-
{ semver: "8.0.33", label: "2023-Spring", codename: "Gerbera" },
|
|
17
|
-
{ semver: "8.0.34", label: "2023-Autumn", codename: "Hollyhock" },
|
|
18
|
-
{ semver: "8.0.35", label: "2024-Spring", codename: "Iris" },
|
|
19
|
-
{ semver: "8.0.36", label: "2024-Autumn", codename: "Jasmine" },
|
|
20
|
-
{ semver: "8.0.37", label: "2025-Spring", codename: "Kamille" },
|
|
21
|
-
{ semver: "8.0.38", label: "2025-Autumn", codename: "Lilac" },
|
|
22
|
-
{ semver: "8.0.39", label: "2026-Spring", codename: "Mimosa" },
|
|
23
|
-
];
|
|
24
|
-
export const SELECTABLE_VERSIONS = IAP_VERSIONS.filter((v) => {
|
|
25
|
-
const minor = parseInt(v.semver.split(".")[2], 10);
|
|
26
|
-
return minor >= 35;
|
|
27
|
-
});
|
|
28
|
-
const labelToVersionMap = new Map(IAP_VERSIONS.map((v) => [v.label, v]));
|
|
29
|
-
const semverToVersionMap = new Map(IAP_VERSIONS.map((v) => [v.semver, v]));
|
|
30
|
-
export const labelToSemver = (label) => {
|
|
31
|
-
const version = labelToVersionMap.get(label);
|
|
32
|
-
if (!version) {
|
|
33
|
-
throw new Error(`Unknown iAP version label: ${label}`);
|
|
34
|
-
}
|
|
35
|
-
return version.semver;
|
|
36
|
-
};
|
|
37
|
-
export const semverToLabel = (semver) => {
|
|
38
|
-
const version = semverToVersionMap.get(semver);
|
|
39
|
-
if (!version) {
|
|
40
|
-
throw new Error(`Unknown iAP semver: ${semver}`);
|
|
41
|
-
}
|
|
42
|
-
return version.label;
|
|
43
|
-
};
|
|
44
|
-
export const findByLabel = (label) => labelToVersionMap.get(label);
|
|
45
|
-
export const findBySemver = (semver) => semverToVersionMap.get(semver);
|