@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
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { findReleaseById, findReleaseBySemver, toModuleContextItems, toFeatureContextItems, } from "./catalog.js";
|
|
2
|
+
export const buildEvalContext = (settings) => {
|
|
3
|
+
const features = settings.features ?? [];
|
|
4
|
+
const release = findReleaseById(settings.accelplatformVersion.label) ??
|
|
5
|
+
findReleaseBySemver(settings.accelplatformVersion.semver);
|
|
6
|
+
return {
|
|
7
|
+
accelplatformVersion: settings.accelplatformVersion,
|
|
8
|
+
modules: settings.modules,
|
|
9
|
+
features,
|
|
10
|
+
moduleItems: release
|
|
11
|
+
? toModuleContextItems(release, settings.modules, settings.locale)
|
|
12
|
+
: [],
|
|
13
|
+
featureItems: release
|
|
14
|
+
? toFeatureContextItems(release, features, settings.locale)
|
|
15
|
+
: [],
|
|
16
|
+
locale: settings.locale,
|
|
17
|
+
agents: settings.agents,
|
|
18
|
+
name: settings.name,
|
|
19
|
+
artifactId: settings.artifactId,
|
|
20
|
+
group: settings.group,
|
|
21
|
+
description: settings.description,
|
|
22
|
+
database: settings.database,
|
|
23
|
+
projectVersion: settings.projectVersion,
|
|
24
|
+
packageManager: settings.packageManager,
|
|
25
|
+
javascript: settings.javascript,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export const emptyEvalContext = (overrides = {}) => ({
|
|
29
|
+
accelplatformVersion: { label: "", semver: "0.0.0" },
|
|
30
|
+
modules: [],
|
|
31
|
+
features: [],
|
|
32
|
+
moduleItems: [],
|
|
33
|
+
featureItems: [],
|
|
34
|
+
locale: "",
|
|
35
|
+
agents: [],
|
|
36
|
+
name: "",
|
|
37
|
+
artifactId: "",
|
|
38
|
+
group: "",
|
|
39
|
+
description: "",
|
|
40
|
+
database: "",
|
|
41
|
+
projectVersion: "",
|
|
42
|
+
packageManager: "",
|
|
43
|
+
javascript: false,
|
|
44
|
+
...overrides,
|
|
45
|
+
});
|
package/dist/core/types.d.ts
CHANGED
|
@@ -4,12 +4,15 @@ export type AndCondition = {
|
|
|
4
4
|
export type OrCondition = {
|
|
5
5
|
or: Condition[];
|
|
6
6
|
};
|
|
7
|
-
export type
|
|
8
|
-
|
|
7
|
+
export type AccelplatformVersionCondition = {
|
|
8
|
+
accelplatformVersion: string;
|
|
9
9
|
};
|
|
10
10
|
export type ModuleCondition = {
|
|
11
11
|
module: string;
|
|
12
12
|
};
|
|
13
|
+
export type FeatureCondition = {
|
|
14
|
+
feature: string;
|
|
15
|
+
};
|
|
13
16
|
export type LocaleCondition = {
|
|
14
17
|
locale: string;
|
|
15
18
|
};
|
|
@@ -22,7 +25,7 @@ export type PackageManagerCondition = {
|
|
|
22
25
|
export type JavascriptCondition = {
|
|
23
26
|
javascript: boolean;
|
|
24
27
|
};
|
|
25
|
-
export type LeafCondition =
|
|
28
|
+
export type LeafCondition = AccelplatformVersionCondition | ModuleCondition | FeatureCondition | LocaleCondition | AgentCondition | PackageManagerCondition | JavascriptCondition;
|
|
26
29
|
export type Condition = AndCondition | OrCondition | LeafCondition;
|
|
27
30
|
export type TextReplacement = {
|
|
28
31
|
type: "text";
|
|
@@ -43,7 +46,15 @@ export type RegexReplacement = {
|
|
|
43
46
|
replacement: string;
|
|
44
47
|
condition: Condition;
|
|
45
48
|
};
|
|
46
|
-
export type
|
|
49
|
+
export type ForeachReplacement = {
|
|
50
|
+
type: "foreach";
|
|
51
|
+
target: string;
|
|
52
|
+
items: "modules" | "features";
|
|
53
|
+
template: string;
|
|
54
|
+
separator?: string;
|
|
55
|
+
condition?: Condition;
|
|
56
|
+
};
|
|
57
|
+
export type Replacement = TextReplacement | SectionReplacement | RegexReplacement | ForeachReplacement;
|
|
47
58
|
export type RenameRule = {
|
|
48
59
|
condition: Condition;
|
|
49
60
|
from: string;
|
|
@@ -56,10 +67,22 @@ export type MetaJson = {
|
|
|
56
67
|
rename?: RenameRule[];
|
|
57
68
|
replacements?: Replacement[];
|
|
58
69
|
};
|
|
59
|
-
export type
|
|
70
|
+
export type AccelplatformVersion = {
|
|
71
|
+
label: string;
|
|
60
72
|
semver: string;
|
|
73
|
+
};
|
|
74
|
+
export type ModuleContextItem = {
|
|
75
|
+
id: string;
|
|
76
|
+
groupId: string;
|
|
77
|
+
artifactId: string;
|
|
78
|
+
version: string;
|
|
79
|
+
name: string;
|
|
80
|
+
label: string;
|
|
81
|
+
};
|
|
82
|
+
export type FeatureContextItem = {
|
|
83
|
+
id: string;
|
|
84
|
+
name: string;
|
|
61
85
|
label: string;
|
|
62
|
-
codename: string;
|
|
63
86
|
};
|
|
64
87
|
export type AccelSettings = {
|
|
65
88
|
cliVersion: string;
|
|
@@ -69,8 +92,9 @@ export type AccelSettings = {
|
|
|
69
92
|
group: string;
|
|
70
93
|
projectVersion: string;
|
|
71
94
|
description: string;
|
|
72
|
-
accelplatformVersion:
|
|
95
|
+
accelplatformVersion: AccelplatformVersion;
|
|
73
96
|
modules: string[];
|
|
97
|
+
features: string[];
|
|
74
98
|
database: string;
|
|
75
99
|
agents: string[];
|
|
76
100
|
javascript: boolean;
|
|
@@ -89,15 +113,17 @@ export type AssetProvider = {
|
|
|
89
113
|
cleanup: () => Promise<void>;
|
|
90
114
|
};
|
|
91
115
|
export type EvalContext = {
|
|
92
|
-
|
|
116
|
+
accelplatformVersion: AccelplatformVersion;
|
|
93
117
|
modules: string[];
|
|
118
|
+
features: string[];
|
|
119
|
+
moduleItems: ModuleContextItem[];
|
|
120
|
+
featureItems: FeatureContextItem[];
|
|
94
121
|
locale: string;
|
|
95
122
|
agents: string[];
|
|
96
123
|
name: string;
|
|
97
124
|
artifactId: string;
|
|
98
125
|
group: string;
|
|
99
126
|
description: string;
|
|
100
|
-
accelplatformVersion: string;
|
|
101
127
|
database: string;
|
|
102
128
|
projectVersion: string;
|
|
103
129
|
packageManager: string;
|
|
@@ -105,9 +131,49 @@ export type EvalContext = {
|
|
|
105
131
|
};
|
|
106
132
|
export declare const isAndCondition: (c: Condition) => c is AndCondition;
|
|
107
133
|
export declare const isOrCondition: (c: Condition) => c is OrCondition;
|
|
108
|
-
export declare const
|
|
134
|
+
export declare const isAccelplatformVersionCondition: (c: Condition) => c is AccelplatformVersionCondition;
|
|
109
135
|
export declare const isModuleCondition: (c: Condition) => c is ModuleCondition;
|
|
136
|
+
export declare const isFeatureCondition: (c: Condition) => c is FeatureCondition;
|
|
110
137
|
export declare const isLocaleCondition: (c: Condition) => c is LocaleCondition;
|
|
111
138
|
export declare const isAgentCondition: (c: Condition) => c is AgentCondition;
|
|
112
139
|
export declare const isPackageManagerCondition: (c: Condition) => c is PackageManagerCondition;
|
|
113
140
|
export declare const isJavascriptCondition: (c: Condition) => c is JavascriptCondition;
|
|
141
|
+
export type AccelCredentials = {
|
|
142
|
+
endpoint: string;
|
|
143
|
+
apiKey: string;
|
|
144
|
+
};
|
|
145
|
+
export type StagingResponse = {
|
|
146
|
+
stagingId: string;
|
|
147
|
+
description?: string | null;
|
|
148
|
+
currentDeployId?: string | null;
|
|
149
|
+
createUserCd: string;
|
|
150
|
+
createDate: number;
|
|
151
|
+
};
|
|
152
|
+
export type StagingListResponse = {
|
|
153
|
+
totalCount: number;
|
|
154
|
+
offset: number;
|
|
155
|
+
limit: number;
|
|
156
|
+
records: StagingResponse[];
|
|
157
|
+
};
|
|
158
|
+
export type DeploymentResponse = {
|
|
159
|
+
deployId: string;
|
|
160
|
+
stagingId: string;
|
|
161
|
+
status: "STAGED" | "UNDEPLOYED";
|
|
162
|
+
description?: string | null;
|
|
163
|
+
createUserCd: string;
|
|
164
|
+
createDate: number;
|
|
165
|
+
};
|
|
166
|
+
export type ApiSuccess<T> = {
|
|
167
|
+
error: false;
|
|
168
|
+
data: T;
|
|
169
|
+
};
|
|
170
|
+
export type ApiErrorBody = {
|
|
171
|
+
error: true;
|
|
172
|
+
errorMessage: string;
|
|
173
|
+
};
|
|
174
|
+
export type DeployError = {
|
|
175
|
+
_tag: "DeployError";
|
|
176
|
+
kind: "network" | "http";
|
|
177
|
+
status?: number;
|
|
178
|
+
serverMessage?: string;
|
|
179
|
+
};
|
package/dist/core/types.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export const isAndCondition = (c) => "and" in c;
|
|
2
2
|
export const isOrCondition = (c) => "or" in c;
|
|
3
|
-
export const
|
|
3
|
+
export const isAccelplatformVersionCondition = (c) => "accelplatformVersion" in c;
|
|
4
4
|
export const isModuleCondition = (c) => "module" in c;
|
|
5
|
+
export const isFeatureCondition = (c) => "feature" in c;
|
|
5
6
|
export const isLocaleCondition = (c) => "locale" in c;
|
|
6
7
|
export const isAgentCondition = (c) => "agent" in c;
|
|
7
8
|
export const isPackageManagerCondition = (c) => "packageManager" in c;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import { type Release } from "./catalog.js";
|
|
1
2
|
export type Validator = (value: string | undefined) => string | undefined;
|
|
2
3
|
export type Validators = {
|
|
3
4
|
name: Validator;
|
|
4
5
|
artifactId: Validator;
|
|
5
6
|
group: Validator;
|
|
6
7
|
projectVersion: Validator;
|
|
7
|
-
|
|
8
|
-
module: Validator;
|
|
8
|
+
accelplatformVersion: Validator;
|
|
9
9
|
database: Validator;
|
|
10
10
|
agent: Validator;
|
|
11
11
|
packageManager: Validator;
|
|
12
12
|
};
|
|
13
|
+
export type ReleaseValidators = {
|
|
14
|
+
module: Validator;
|
|
15
|
+
feature: Validator;
|
|
16
|
+
};
|
|
13
17
|
export declare const createValidators: (locale: string) => Validators;
|
|
18
|
+
export declare const createReleaseValidators: (locale: string, release: Release) => ReleaseValidators;
|
package/dist/core/validators.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getMessage } from "../i18n/index.js";
|
|
2
|
-
import { AGENT_OPTIONS, DATABASE_OPTIONS,
|
|
3
|
-
import {
|
|
2
|
+
import { AGENT_OPTIONS, DATABASE_OPTIONS, PACKAGE_MANAGER_OPTIONS, } from "./constants.js";
|
|
3
|
+
import { findReleaseById } from "./catalog.js";
|
|
4
4
|
const ARTIFACT_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
5
5
|
const GROUP_PATTERN = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*$/;
|
|
6
6
|
const PROJECT_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
@@ -19,8 +19,7 @@ const isValidName = (value) => {
|
|
|
19
19
|
const isValidArtifactId = (value) => ARTIFACT_ID_PATTERN.test(value);
|
|
20
20
|
const isValidGroup = (value) => GROUP_PATTERN.test(value);
|
|
21
21
|
const isValidProjectVersion = (value) => PROJECT_VERSION_PATTERN.test(value);
|
|
22
|
-
const
|
|
23
|
-
const isValidModule = (value) => MODULE_OPTIONS.includes(value);
|
|
22
|
+
const isValidReleaseId = (value) => findReleaseById(value) !== undefined;
|
|
24
23
|
const isValidDatabase = (value) => DATABASE_OPTIONS.includes(value);
|
|
25
24
|
const isValidAgent = (value) => AGENT_OPTIONS.includes(value);
|
|
26
25
|
const isValidPackageManager = (value) => PACKAGE_MANAGER_OPTIONS.includes(value);
|
|
@@ -49,18 +48,12 @@ export const createValidators = (locale) => ({
|
|
|
49
48
|
? undefined
|
|
50
49
|
: getMessage("error.invalidProjectVersion", locale, { value: v });
|
|
51
50
|
},
|
|
52
|
-
|
|
51
|
+
accelplatformVersion: (value) => {
|
|
53
52
|
const v = value ?? "";
|
|
54
|
-
return
|
|
53
|
+
return isValidReleaseId(v)
|
|
55
54
|
? undefined
|
|
56
55
|
: getMessage("error.invalidVersion", locale, { version: v });
|
|
57
56
|
},
|
|
58
|
-
module: (value) => {
|
|
59
|
-
const v = value ?? "";
|
|
60
|
-
return isValidModule(v)
|
|
61
|
-
? undefined
|
|
62
|
-
: getMessage("error.invalidModule", locale, { module: v });
|
|
63
|
-
},
|
|
64
57
|
database: (value) => {
|
|
65
58
|
const v = value ?? "";
|
|
66
59
|
return isValidDatabase(v)
|
|
@@ -82,3 +75,23 @@ export const createValidators = (locale) => ({
|
|
|
82
75
|
});
|
|
83
76
|
},
|
|
84
77
|
});
|
|
78
|
+
export const createReleaseValidators = (locale, release) => ({
|
|
79
|
+
module: (value) => {
|
|
80
|
+
const v = value ?? "";
|
|
81
|
+
return release.modules.some((m) => m.artifactId === v)
|
|
82
|
+
? undefined
|
|
83
|
+
: getMessage("error.invalidModule", locale, {
|
|
84
|
+
module: v,
|
|
85
|
+
release: release.id,
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
feature: (value) => {
|
|
89
|
+
const v = value ?? "";
|
|
90
|
+
return release.functions.some((f) => f.id === v)
|
|
91
|
+
? undefined
|
|
92
|
+
: getMessage("error.invalidFeature", locale, {
|
|
93
|
+
feature: v,
|
|
94
|
+
release: release.id,
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { EvalContext } from "./types.js";
|
|
2
|
-
export declare const interpolateVariables: (template: string, context: EvalContext) => string;
|
|
2
|
+
export declare const interpolateVariables: (template: string, context: EvalContext, extraVariables?: ReadonlyMap<string, string>) => string;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
const
|
|
2
|
-
["name",
|
|
3
|
-
["artifactId",
|
|
4
|
-
["group",
|
|
5
|
-
["description",
|
|
6
|
-
["
|
|
7
|
-
["accelplatformVersion",
|
|
8
|
-
["locale",
|
|
9
|
-
["database",
|
|
10
|
-
["projectVersion",
|
|
11
|
-
["packageManager",
|
|
1
|
+
const VARIABLE_RESOLVERS = new Map([
|
|
2
|
+
["name", (c) => c.name],
|
|
3
|
+
["artifactId", (c) => c.artifactId],
|
|
4
|
+
["group", (c) => c.group],
|
|
5
|
+
["description", (c) => c.description],
|
|
6
|
+
["accelplatformVersion.semver", (c) => c.accelplatformVersion.semver],
|
|
7
|
+
["accelplatformVersion.label", (c) => c.accelplatformVersion.label],
|
|
8
|
+
["locale", (c) => c.locale],
|
|
9
|
+
["database", (c) => c.database],
|
|
10
|
+
["projectVersion", (c) => c.projectVersion],
|
|
11
|
+
["packageManager", (c) => c.packageManager],
|
|
12
12
|
]);
|
|
13
|
-
const INTERPOLATION_PATTERN = /\{\{\$(\w+)\}\}/g;
|
|
14
|
-
export const interpolateVariables = (template, context) => {
|
|
13
|
+
const INTERPOLATION_PATTERN = /\{\{\$([\w.]+)\}\}/g;
|
|
14
|
+
export const interpolateVariables = (template, context, extraVariables) => {
|
|
15
15
|
return template.replace(INTERPOLATION_PATTERN, (match, varName) => {
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
return
|
|
16
|
+
const extra = extraVariables?.get(varName);
|
|
17
|
+
if (extra !== undefined) {
|
|
18
|
+
return extra;
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
20
|
+
const resolver = VARIABLE_RESOLVERS.get(varName);
|
|
21
|
+
if (resolver === undefined) {
|
|
22
22
|
return match;
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return resolver(context);
|
|
25
25
|
});
|
|
26
26
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StagingResponse, DeploymentResponse, DeployError } from "../core/types.js";
|
|
2
|
+
type FetchFn = typeof globalThis.fetch;
|
|
3
|
+
export declare const makeDeployError: (kind: DeployError["kind"], extra?: {
|
|
4
|
+
status?: number;
|
|
5
|
+
serverMessage?: string;
|
|
6
|
+
}) => DeployError;
|
|
7
|
+
export declare const isDeployError: (e: unknown) => e is DeployError;
|
|
8
|
+
export type ApiClient = {
|
|
9
|
+
verifyToken: () => Promise<void>;
|
|
10
|
+
listStagings: () => Promise<StagingResponse[]>;
|
|
11
|
+
createDeployment: (stagingId: string, bytes: Uint8Array, immFileName: string, description?: string) => Promise<DeploymentResponse>;
|
|
12
|
+
};
|
|
13
|
+
export declare const createApiClient: (endpoint: string, apiKey: string, deps?: {
|
|
14
|
+
fetch?: FetchFn;
|
|
15
|
+
}) => ApiClient;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const STAGING_PATH = "/api/bearer/development/staging";
|
|
2
|
+
const VERIFY_PATH = "/oauth/token/verify";
|
|
3
|
+
const PAGE_LIMIT = 100;
|
|
4
|
+
const MAX_PAGES = 1000;
|
|
5
|
+
export const makeDeployError = (kind, extra = {}) => ({ _tag: "DeployError", kind, ...extra });
|
|
6
|
+
export const isDeployError = (e) => typeof e === "object" &&
|
|
7
|
+
e !== null &&
|
|
8
|
+
e._tag === "DeployError";
|
|
9
|
+
export const createApiClient = (endpoint, apiKey, deps = {}) => {
|
|
10
|
+
const doFetch = deps.fetch ?? globalThis.fetch;
|
|
11
|
+
const baseHeaders = {
|
|
12
|
+
"X-Intramart-Session": "never",
|
|
13
|
+
Authorization: `Bearer ${apiKey}`,
|
|
14
|
+
};
|
|
15
|
+
const request = async (url, init) => {
|
|
16
|
+
let res;
|
|
17
|
+
try {
|
|
18
|
+
res = await doFetch(url, init);
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
throw makeDeployError("network", {
|
|
22
|
+
serverMessage: err instanceof Error ? err.message : String(err),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const text = await res.text();
|
|
26
|
+
let body;
|
|
27
|
+
try {
|
|
28
|
+
body = text.length > 0 ? JSON.parse(text) : undefined;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
throw makeDeployError("http", { status: res.status });
|
|
32
|
+
}
|
|
33
|
+
if (body !== null &&
|
|
34
|
+
typeof body === "object" &&
|
|
35
|
+
body.error === true) {
|
|
36
|
+
throw makeDeployError("http", {
|
|
37
|
+
status: res.status,
|
|
38
|
+
serverMessage: body.errorMessage,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (!res.ok) {
|
|
42
|
+
throw makeDeployError("http", { status: res.status });
|
|
43
|
+
}
|
|
44
|
+
if (body !== null &&
|
|
45
|
+
typeof body === "object" &&
|
|
46
|
+
"data" in body) {
|
|
47
|
+
return body.data;
|
|
48
|
+
}
|
|
49
|
+
throw makeDeployError("http", { status: res.status });
|
|
50
|
+
};
|
|
51
|
+
const verifyToken = async () => {
|
|
52
|
+
const url = `${endpoint}${VERIFY_PATH}`;
|
|
53
|
+
const body = new URLSearchParams({ access_token: apiKey }).toString();
|
|
54
|
+
let res;
|
|
55
|
+
try {
|
|
56
|
+
res = await doFetch(url, {
|
|
57
|
+
method: "POST",
|
|
58
|
+
headers: {
|
|
59
|
+
...baseHeaders,
|
|
60
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
61
|
+
},
|
|
62
|
+
body,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
throw makeDeployError("network", {
|
|
67
|
+
serverMessage: err instanceof Error ? err.message : String(err),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (res.status === 200)
|
|
71
|
+
return;
|
|
72
|
+
throw makeDeployError("http", { status: res.status });
|
|
73
|
+
};
|
|
74
|
+
const listStagings = async () => {
|
|
75
|
+
const records = [];
|
|
76
|
+
let offset = 0;
|
|
77
|
+
for (let page = 0; page < MAX_PAGES; page++) {
|
|
78
|
+
const url = `${endpoint}${STAGING_PATH}?offset=${offset}&limit=${PAGE_LIMIT}`;
|
|
79
|
+
const data = await request(url, {
|
|
80
|
+
method: "GET",
|
|
81
|
+
headers: baseHeaders,
|
|
82
|
+
});
|
|
83
|
+
records.push(...data.records);
|
|
84
|
+
if (records.length >= data.totalCount || data.records.length === 0) {
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
offset += PAGE_LIMIT;
|
|
88
|
+
}
|
|
89
|
+
return records;
|
|
90
|
+
};
|
|
91
|
+
const createDeployment = async (stagingId, bytes, immFileName, description) => {
|
|
92
|
+
const form = new FormData();
|
|
93
|
+
form.append("archiveFile", new File([bytes], immFileName, { type: "application/zip" }));
|
|
94
|
+
if (description && description.length > 0) {
|
|
95
|
+
form.append("description", description);
|
|
96
|
+
}
|
|
97
|
+
const url = `${endpoint}${STAGING_PATH}/${encodeURIComponent(stagingId)}/deploy`;
|
|
98
|
+
return request(url, {
|
|
99
|
+
method: "POST",
|
|
100
|
+
headers: baseHeaders,
|
|
101
|
+
body: form,
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
return { verifyToken, listStagings, createDeployment };
|
|
105
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { readdir } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
const DEFAULT_DIR = "target";
|
|
4
|
+
const DEFAULT_PATTERN = /\.zip$/i;
|
|
5
|
+
export const scanTargets = async (projectDir, opts = {}) => {
|
|
6
|
+
const dir = opts.dir ?? DEFAULT_DIR;
|
|
7
|
+
const pattern = opts.pattern ?? DEFAULT_PATTERN;
|
|
8
|
+
const targetDir = join(projectDir, dir);
|
|
9
|
+
let entries;
|
|
10
|
+
try {
|
|
11
|
+
entries = await readdir(targetDir, { withFileTypes: true });
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
return entries
|
|
17
|
+
.filter((e) => e.isFile() && pattern.test(e.name))
|
|
18
|
+
.map((e) => join(targetDir, e.name))
|
|
19
|
+
.sort();
|
|
20
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type TargetSelection = {
|
|
2
|
+
auto: string;
|
|
3
|
+
} | {
|
|
4
|
+
candidates: string[];
|
|
5
|
+
};
|
|
6
|
+
type ArtifactInfo = {
|
|
7
|
+
artifactId: string;
|
|
8
|
+
projectVersion: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const selectDeployTarget: (zips: string[], settings: ArtifactInfo | null) => TargetSelection;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { basename } from "node:path";
|
|
2
|
+
const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3
|
+
export const selectDeployTarget = (zips, settings) => {
|
|
4
|
+
if (!settings) {
|
|
5
|
+
return { candidates: zips };
|
|
6
|
+
}
|
|
7
|
+
const { artifactId, projectVersion } = settings;
|
|
8
|
+
const exactName = `${artifactId}-${projectVersion}.zip`;
|
|
9
|
+
const exact = zips.find((z) => basename(z) === exactName);
|
|
10
|
+
if (exact) {
|
|
11
|
+
return { auto: exact };
|
|
12
|
+
}
|
|
13
|
+
const intermediate = new RegExp(`^${escapeRegExp(artifactId)}-\\D`);
|
|
14
|
+
const filtered = zips.filter((z) => !intermediate.test(basename(z)));
|
|
15
|
+
return { candidates: filtered.length > 0 ? filtered : zips };
|
|
16
|
+
};
|
package/dist/i18n/en.js
CHANGED
|
@@ -11,6 +11,8 @@ export const messages = {
|
|
|
11
11
|
"prompt.accelplatformVersion.hint": "iAP release version. The deployed assets (CLAUDE.md, etc.) adapt to this version",
|
|
12
12
|
"prompt.modules": "Select modules to use",
|
|
13
13
|
"prompt.modules.hint": "iAP optional product modules. Each selection deploys matching skills, config, and CLAUDE.md sections",
|
|
14
|
+
"prompt.features": "Select features to use (optional)",
|
|
15
|
+
"prompt.features.hint": "iAP features used in this project. Skills and CLAUDE.md sections for the selected features will be deployed",
|
|
14
16
|
"prompt.group": "Enter group name",
|
|
15
17
|
"prompt.group.hint": "Recorded in pom.xml as the Maven groupId (dot-separated organization identifier)\nAn identifier for your organization or team; reverse-domain notation reduces collisions (e.g. com.example, jp.co.intra_mart.app)",
|
|
16
18
|
"prompt.projectVersion": "Enter project version",
|
|
@@ -28,6 +30,7 @@ export const messages = {
|
|
|
28
30
|
"juggling.detected.version": "Detected version from juggling.im: {version}",
|
|
29
31
|
"juggling.detected.modules": "Detected modules from juggling.im: {modules}",
|
|
30
32
|
"juggling.notFound": "juggling.im not found at specified path: {path}",
|
|
33
|
+
"juggling.versionUnknown": "The juggling.im version {version} is not in the catalog. Select the version and modules manually.",
|
|
31
34
|
"warning.versionMismatch": "Specified iAP version ({option}) differs from juggling.im ({juggling}). Using specified value.",
|
|
32
35
|
"warning.moduleMismatch": "Specified modules differ from juggling.im. Using specified values.",
|
|
33
36
|
"warning.gitNotFound": "git command not found. Skipping Git initialization.",
|
|
@@ -51,7 +54,9 @@ export const messages = {
|
|
|
51
54
|
"error.accelNotFound": ".accel directory not found",
|
|
52
55
|
"error.missingRequiredOptions": "The following required options are missing: {options}",
|
|
53
56
|
"error.invalidVersion": "Invalid iAP version: {version}",
|
|
54
|
-
"error.invalidModule": "Invalid module: {module}",
|
|
57
|
+
"error.invalidModule": "Invalid module (not in release {release}): {module}",
|
|
58
|
+
"error.invalidFeature": "Invalid feature (not in release {release}): {feature}",
|
|
59
|
+
"error.jugglingVersionUnknown": "The juggling.im version {version} is not in the catalog.",
|
|
55
60
|
"error.invalidDatabase": "Invalid database: {database}",
|
|
56
61
|
"error.invalidAgent": "Invalid agent: {agent}",
|
|
57
62
|
"error.invalidPackageManager": "Invalid package manager (expected one of bun, npm, yarn, pnpm): {packageManager}",
|
|
@@ -67,6 +72,7 @@ export const messages = {
|
|
|
67
72
|
"summary.label.description": "Description",
|
|
68
73
|
"summary.label.accelplatformVersion": "iAP version",
|
|
69
74
|
"summary.label.modules": "Modules",
|
|
75
|
+
"summary.label.features": "Features",
|
|
70
76
|
"summary.label.database": "Database",
|
|
71
77
|
"summary.label.javascript": "JavaScript",
|
|
72
78
|
"summary.label.agents": "Agents",
|
|
@@ -86,4 +92,50 @@ export const messages = {
|
|
|
86
92
|
"nextSteps.cd": "cd {path}",
|
|
87
93
|
"nextSteps.agent.claudeCode": "Run claude to start agent-driven development",
|
|
88
94
|
"nextSteps.agent.githubCopilot": "Run gh copilot to start agent-driven development",
|
|
95
|
+
"credentials.prompt.endpoint": "Enter the iAP endpoint (base URL)",
|
|
96
|
+
"credentials.prompt.endpoint.hint": "Specify the iAP base URL (e.g. https://example.com/imart). The API path (/api/bearer/...) is assembled automatically",
|
|
97
|
+
"credentials.prompt.apiKey": "Enter the API key (OAuth Bearer token)",
|
|
98
|
+
"credentials.prompt.apiKey.hint": "iAP OAuth token (scope: development). Saved to .accel/credentials.json and added to .gitignore",
|
|
99
|
+
"credentials.error.required": "A value is required",
|
|
100
|
+
"credentials.error.missingNonInteractive": "Connection information is required in non-interactive mode. Missing: {fields} (provide them via --endpoint / --api-key or the ACCEL_ENDPOINT / ACCEL_API_KEY environment variables).",
|
|
101
|
+
"credentials.verify.progress": "Verifying your connection information...",
|
|
102
|
+
"credentials.verify.notice": "Please re-enter your connection information.",
|
|
103
|
+
"credentials.verify.error.network": "Could not connect to iAP: {message}",
|
|
104
|
+
"credentials.verify.error.unauthorized": "Authentication failed (401). Check that the API key is correct.",
|
|
105
|
+
"credentials.verify.error.notFound": "Could not reach the given endpoint (404). Check that the endpoint URL is correct.",
|
|
106
|
+
"credentials.verify.error.unexpected": "Failed to verify connection information (HTTP {status}).",
|
|
107
|
+
"login.intro": "Accel CLI - login",
|
|
108
|
+
"login.complete": "Connection information saved.",
|
|
109
|
+
"deploy.intro": "Accel CLI - deploy",
|
|
110
|
+
"deploy.progress.fetchingStagings": "Fetching staging environments...",
|
|
111
|
+
"deploy.progress.deploying": "Deploying...",
|
|
112
|
+
"deploy.selectStaging": "Select the target staging environment",
|
|
113
|
+
"deploy.selectZip": "Select the file to deploy",
|
|
114
|
+
"deploy.descriptionPrompt": "Enter a deployment description (optional)",
|
|
115
|
+
"deploy.confirm": "Deploy with the following settings. Continue?",
|
|
116
|
+
"deploy.confirm.endpoint": "Endpoint",
|
|
117
|
+
"deploy.confirm.stagingId": "Staging",
|
|
118
|
+
"deploy.confirm.sourceFile": "Source file",
|
|
119
|
+
"deploy.confirm.sentAs": "Sent as",
|
|
120
|
+
"deploy.result.deployId": "Deploy ID",
|
|
121
|
+
"deploy.result.stagingId": "Staging",
|
|
122
|
+
"deploy.result.status": "Status",
|
|
123
|
+
"deploy.result.createDate": "Created at",
|
|
124
|
+
"deploy.success": "Deployment complete.",
|
|
125
|
+
"deploy.cancelled": "Deployment cancelled.",
|
|
126
|
+
"deploy.error.noStagings": "No staging environments found. Create a staging environment on the iAP side first.",
|
|
127
|
+
"deploy.error.noTargetZip": "No deployable zip found under ./target/. Run a build (e.g. mvn package) first.",
|
|
128
|
+
"deploy.error.missingStagingId": "--staging-id is required in non-interactive mode. Specify the target staging ID.",
|
|
129
|
+
"deploy.error.zipNotResolved": "Could not uniquely determine the zip to deploy. Specify the file explicitly with --file.",
|
|
130
|
+
"deploy.error.fileNotFound": "The specified file was not found: {path}",
|
|
131
|
+
"deploy.error.network": "Could not connect to iAP: {message}",
|
|
132
|
+
"deploy.error.server": "iAP returned an error: {message}",
|
|
133
|
+
"deploy.error.unauthorized": "Authentication failed (401). Check that the API key is correct.",
|
|
134
|
+
"deploy.error.forbidden": "Access denied (403). Check your permissions for this staging.",
|
|
135
|
+
"deploy.error.notFound": "Staging not found (404). Create the staging environment beforehand.",
|
|
136
|
+
"deploy.error.badRequest": "Bad request (400).",
|
|
137
|
+
"deploy.error.serverError": "A server error occurred (500).",
|
|
138
|
+
"deploy.error.unexpectedResponse": "Received an unexpected response (HTTP {status}).",
|
|
139
|
+
"deploy.reauth.notFound": "The endpoint could not be reached (404). Check that the endpoint URL is correct.",
|
|
140
|
+
"deploy.reauth.notice": "Please re-enter your connection information.",
|
|
89
141
|
};
|