@apimatic/cli 1.1.0-beta.8 → 1.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/README.md +117 -13
- package/lib/actions/portal/copilot.d.ts +1 -0
- package/lib/actions/portal/copilot.js +12 -12
- package/lib/actions/portal/copilot.js.map +1 -1
- package/lib/actions/portal/generate.js +7 -1
- package/lib/actions/portal/generate.js.map +1 -1
- package/lib/actions/portal/quickstart.d.ts +1 -0
- package/lib/actions/portal/quickstart.js +40 -6
- package/lib/actions/portal/quickstart.js.map +1 -1
- package/lib/actions/portal/serve.d.ts +1 -0
- package/lib/actions/portal/serve.js +77 -20
- package/lib/actions/portal/serve.js.map +1 -1
- package/lib/actions/portal/toc/new-toc.js +8 -20
- package/lib/actions/portal/toc/new-toc.js.map +1 -1
- package/lib/actions/publishing/profile/list.d.ts +11 -0
- package/lib/actions/publishing/profile/list.js +29 -0
- package/lib/actions/publishing/profile/list.js.map +1 -0
- package/lib/actions/sdk/generate.d.ts +9 -5
- package/lib/actions/sdk/generate.js +76 -30
- package/lib/actions/sdk/generate.js.map +1 -1
- package/lib/actions/sdk/merge-source-tree.d.ts +12 -0
- package/lib/actions/sdk/merge-source-tree.js +78 -0
- package/lib/actions/sdk/merge-source-tree.js.map +1 -0
- package/lib/actions/sdk/publish/interactive.d.ts +13 -0
- package/lib/actions/sdk/publish/interactive.js +105 -0
- package/lib/actions/sdk/publish/interactive.js.map +1 -0
- package/lib/actions/sdk/publish/non-interactive.d.ts +14 -0
- package/lib/actions/sdk/publish/non-interactive.js +101 -0
- package/lib/actions/sdk/publish/non-interactive.js.map +1 -0
- package/lib/actions/sdk/publish.d.ts +18 -0
- package/lib/actions/sdk/publish.js +56 -0
- package/lib/actions/sdk/publish.js.map +1 -0
- package/lib/actions/sdk/quickstart.js +2 -1
- package/lib/actions/sdk/quickstart.js.map +1 -1
- package/lib/actions/sdk/save-changes.d.ts +8 -0
- package/lib/actions/sdk/save-changes.js +93 -0
- package/lib/actions/sdk/save-changes.js.map +1 -0
- package/lib/application/portal/recipe/recipe-generator.js +14 -29
- package/lib/application/portal/recipe/recipe-generator.js.map +1 -1
- package/lib/application/portal/toc/toc-structure-generator.d.ts +3 -19
- package/lib/application/portal/toc/toc-structure-generator.js +43 -33
- package/lib/application/portal/toc/toc-structure-generator.js.map +1 -1
- package/lib/commands/portal/recipe/new.js +2 -2
- package/lib/commands/portal/recipe/new.js.map +1 -1
- package/lib/commands/portal/serve.js +3 -3
- package/lib/commands/portal/serve.js.map +1 -1
- package/lib/commands/portal/toc/new.js +2 -2
- package/lib/commands/portal/toc/new.js.map +1 -1
- package/lib/commands/publishing/profile/list.d.ts +9 -0
- package/lib/commands/publishing/profile/list.js +28 -0
- package/lib/commands/publishing/profile/list.js.map +1 -0
- package/lib/commands/quickstart.js +1 -1
- package/lib/commands/quickstart.js.map +1 -1
- package/lib/commands/sdk/generate.d.ts +7 -2
- package/lib/commands/sdk/generate.js +37 -9
- package/lib/commands/sdk/generate.js.map +1 -1
- package/lib/commands/sdk/publish.d.ts +18 -0
- package/lib/commands/sdk/publish.js +73 -0
- package/lib/commands/sdk/publish.js.map +1 -0
- package/lib/commands/sdk/save-changes.d.ts +14 -0
- package/lib/commands/sdk/save-changes.js +51 -0
- package/lib/commands/sdk/save-changes.js.map +1 -0
- package/lib/hooks/not-found.js +1 -1
- package/lib/hooks/not-found.js.map +1 -1
- package/lib/infrastructure/debounce-service.js +3 -0
- package/lib/infrastructure/debounce-service.js.map +1 -1
- package/lib/infrastructure/env-info.d.ts +2 -0
- package/lib/infrastructure/env-info.js +23 -12
- package/lib/infrastructure/env-info.js.map +1 -1
- package/lib/infrastructure/file-service.d.ts +9 -0
- package/lib/infrastructure/file-service.js +94 -5
- package/lib/infrastructure/file-service.js.map +1 -1
- package/lib/infrastructure/git-service.d.ts +14 -0
- package/lib/infrastructure/git-service.js +90 -0
- package/lib/infrastructure/git-service.js.map +1 -0
- package/lib/infrastructure/launcher-service.d.ts +5 -0
- package/lib/infrastructure/launcher-service.js +35 -2
- package/lib/infrastructure/launcher-service.js.map +1 -1
- package/lib/infrastructure/os-extensions.d.ts +2 -0
- package/lib/infrastructure/os-extensions.js +6 -0
- package/lib/infrastructure/os-extensions.js.map +1 -0
- package/lib/infrastructure/service-error.d.ts +14 -2
- package/lib/infrastructure/service-error.js +26 -9
- package/lib/infrastructure/service-error.js.map +1 -1
- package/lib/infrastructure/services/api-service.d.ts +1 -0
- package/lib/infrastructure/services/api-service.js +26 -2
- package/lib/infrastructure/services/api-service.js.map +1 -1
- package/lib/infrastructure/services/portal-service.d.ts +11 -2
- package/lib/infrastructure/services/portal-service.js +123 -18
- package/lib/infrastructure/services/portal-service.js.map +1 -1
- package/lib/infrastructure/services/publishing-api-service.d.ts +19 -0
- package/lib/infrastructure/services/publishing-api-service.js +111 -0
- package/lib/infrastructure/services/publishing-api-service.js.map +1 -0
- package/lib/infrastructure/services/validation-service.js.map +1 -1
- package/lib/infrastructure/zip-service.d.ts +2 -2
- package/lib/infrastructure/zip-service.js +46 -25
- package/lib/infrastructure/zip-service.js.map +1 -1
- package/lib/prompts/format.d.ts +0 -2
- package/lib/prompts/format.js +0 -31
- package/lib/prompts/format.js.map +1 -1
- package/lib/prompts/portal/generate.d.ts +1 -1
- package/lib/prompts/portal/generate.js +9 -3
- package/lib/prompts/portal/generate.js.map +1 -1
- package/lib/prompts/portal/quickstart.d.ts +4 -0
- package/lib/prompts/portal/quickstart.js +22 -0
- package/lib/prompts/portal/quickstart.js.map +1 -1
- package/lib/prompts/portal/serve.d.ts +4 -0
- package/lib/prompts/portal/serve.js +20 -1
- package/lib/prompts/portal/serve.js.map +1 -1
- package/lib/prompts/portal/toc/new-toc.d.ts +2 -2
- package/lib/prompts/portal/toc/new-toc.js +3 -3
- package/lib/prompts/portal/toc/new-toc.js.map +1 -1
- package/lib/prompts/prompt.d.ts +6 -0
- package/lib/prompts/prompt.js +45 -0
- package/lib/prompts/prompt.js.map +1 -1
- package/lib/prompts/publishing/profile/list.d.ts +9 -0
- package/lib/prompts/publishing/profile/list.js +27 -0
- package/lib/prompts/publishing/profile/list.js.map +1 -0
- package/lib/prompts/sdk/generate.d.ts +9 -4
- package/lib/prompts/sdk/generate.js +37 -15
- package/lib/prompts/sdk/generate.js.map +1 -1
- package/lib/prompts/sdk/merge-source-tree.d.ts +22 -0
- package/lib/prompts/sdk/merge-source-tree.js +90 -0
- package/lib/prompts/sdk/merge-source-tree.js.map +1 -0
- package/lib/prompts/sdk/publish/interactive.d.ts +30 -0
- package/lib/prompts/sdk/publish/interactive.js +139 -0
- package/lib/prompts/sdk/publish/interactive.js.map +1 -0
- package/lib/prompts/sdk/publish/non-interactive.d.ts +27 -0
- package/lib/prompts/sdk/publish/non-interactive.js +97 -0
- package/lib/prompts/sdk/publish/non-interactive.js.map +1 -0
- package/lib/prompts/sdk/publish.d.ts +12 -0
- package/lib/prompts/sdk/publish.js +16 -0
- package/lib/prompts/sdk/publish.js.map +1 -0
- package/lib/prompts/sdk/save-changes.d.ts +21 -0
- package/lib/prompts/sdk/save-changes.js +84 -0
- package/lib/prompts/sdk/save-changes.js.map +1 -0
- package/lib/types/build/build.d.ts +81 -2
- package/lib/types/build/build.js +158 -0
- package/lib/types/build/build.js.map +1 -1
- package/lib/types/build-context.d.ts +12 -1
- package/lib/types/build-context.js +78 -4
- package/lib/types/build-context.js.map +1 -1
- package/lib/types/events/sdk-changes-saved.d.ts +8 -0
- package/lib/types/events/sdk-changes-saved.js +11 -0
- package/lib/types/events/sdk-changes-saved.js.map +1 -0
- package/lib/types/events/sdk-changes-tracked.d.ts +8 -0
- package/lib/types/events/sdk-changes-tracked.js +11 -0
- package/lib/types/events/sdk-changes-tracked.js.map +1 -0
- package/lib/types/events/sdk-conflicts-resolved.d.ts +8 -0
- package/lib/types/events/sdk-conflicts-resolved.js +11 -0
- package/lib/types/events/sdk-conflicts-resolved.js.map +1 -0
- package/lib/types/events/sdk-publish-validation-failed.d.ts +5 -0
- package/lib/types/events/sdk-publish-validation-failed.js +8 -0
- package/lib/types/events/sdk-publish-validation-failed.js.map +1 -0
- package/lib/types/file/directory.d.ts +10 -1
- package/lib/types/file/directory.js +63 -5
- package/lib/types/file/directory.js.map +1 -1
- package/lib/types/file/directoryPath.js.map +1 -1
- package/lib/types/file/urlPath.d.ts +4 -0
- package/lib/types/file/urlPath.js +9 -0
- package/lib/types/file/urlPath.js.map +1 -1
- package/lib/types/merge-source-tree-context.d.ts +28 -0
- package/lib/types/merge-source-tree-context.js +63 -0
- package/lib/types/merge-source-tree-context.js.map +1 -0
- package/lib/types/package-settings-context.d.ts +10 -0
- package/lib/types/package-settings-context.js +20 -0
- package/lib/types/package-settings-context.js.map +1 -0
- package/lib/types/publish/package-settings-configuration.d.ts +74 -0
- package/lib/types/publish/package-settings-configuration.js +2 -0
- package/lib/types/publish/package-settings-configuration.js.map +1 -0
- package/lib/types/publish/profile-id.d.ts +10 -0
- package/lib/types/publish/profile-id.js +22 -0
- package/lib/types/publish/profile-id.js.map +1 -0
- package/lib/types/publish/publishing-profile.d.ts +26 -0
- package/lib/types/publish/publishing-profile.js +154 -0
- package/lib/types/publish/publishing-profile.js.map +1 -0
- package/lib/types/publish/publishing-profiles.d.ts +12 -0
- package/lib/types/publish/publishing-profiles.js +36 -0
- package/lib/types/publish/publishing-profiles.js.map +1 -0
- package/lib/types/publish/version.d.ts +7 -0
- package/lib/types/publish/version.js +17 -0
- package/lib/types/publish/version.js.map +1 -0
- package/lib/types/publish-api/publish-log.d.ts +20 -0
- package/lib/types/publish-api/publish-log.js +2 -0
- package/lib/types/publish-api/publish-log.js.map +1 -0
- package/lib/types/publish-api/publishing-info.d.ts +4 -0
- package/lib/types/publish-api/publishing-info.js +2 -0
- package/lib/types/publish-api/publishing-info.js.map +1 -0
- package/lib/types/publish-api/publishing-profile-item.d.ts +190 -0
- package/lib/types/publish-api/publishing-profile-item.js +6 -0
- package/lib/types/publish-api/publishing-profile-item.js.map +1 -0
- package/lib/types/save-changes-context.d.ts +17 -0
- package/lib/types/save-changes-context.js +42 -0
- package/lib/types/save-changes-context.js.map +1 -0
- package/lib/types/sdk/generate.d.ts +8 -0
- package/lib/types/sdk/generate.js +10 -0
- package/lib/types/sdk/generate.js.map +1 -1
- package/lib/types/sdk-context.d.ts +5 -4
- package/lib/types/sdk-context.js +26 -13
- package/lib/types/sdk-context.js.map +1 -1
- package/lib/types/sdl/sdl.d.ts +0 -28
- package/lib/types/sdl/sdl.js +1 -128
- package/lib/types/sdl/sdl.js.map +1 -1
- package/lib/types/spec-context.js.map +1 -1
- package/lib/types/temp-context.js.map +1 -1
- package/lib/types/toc/toc-components.d.ts +37 -0
- package/lib/types/toc/toc-components.js +97 -0
- package/lib/types/toc/toc-components.js.map +1 -0
- package/lib/types/toc/toc.d.ts +11 -0
- package/lib/utils/string-utils.d.ts +0 -1
- package/lib/utils/string-utils.js +0 -42
- package/lib/utils/string-utils.js.map +1 -1
- package/package.json +28 -20
- package/lib/types/versioned-build-context.d.ts +0 -9
- package/lib/types/versioned-build-context.js +0 -21
- package/lib/types/versioned-build-context.js.map +0 -1
|
@@ -4,7 +4,7 @@ import { ActionResult } from '../../action-result.js';
|
|
|
4
4
|
import { TocContext } from '../../../types/toc-context.js';
|
|
5
5
|
import { FileService } from '../../../infrastructure/file-service.js';
|
|
6
6
|
import { BuildContext } from '../../../types/build-context.js';
|
|
7
|
-
import {
|
|
7
|
+
import { TocComponents } from '../../../types/toc/toc-components.js';
|
|
8
8
|
import { withDirPath } from '../../../infrastructure/tmp-extensions.js';
|
|
9
9
|
import { TempContext } from '../../../types/temp-context.js';
|
|
10
10
|
import { PortalService } from '../../../infrastructure/services/portal-service.js';
|
|
@@ -31,7 +31,6 @@ export class PortalNewTocAction {
|
|
|
31
31
|
this.portalService = new PortalService();
|
|
32
32
|
}
|
|
33
33
|
async execute(buildDirectory, tocDirectory, force = false, expandEndpoints = false, expandModels = false, expandWebhooks = false, expandCallbacks = false) {
|
|
34
|
-
var _a, _b;
|
|
35
34
|
// Validate build directory
|
|
36
35
|
const buildContext = new BuildContext(buildDirectory);
|
|
37
36
|
if (!(await buildContext.validate())) {
|
|
@@ -39,41 +38,30 @@ export class PortalNewTocAction {
|
|
|
39
38
|
return ActionResult.failed();
|
|
40
39
|
}
|
|
41
40
|
const buildConfig = await buildContext.getBuildFileContents();
|
|
42
|
-
const contentDirectory = buildDirectory.join(
|
|
41
|
+
const contentDirectory = buildDirectory.join(buildConfig.contentFolder());
|
|
43
42
|
const tocDir = tocDirectory !== null && tocDirectory !== void 0 ? tocDirectory : contentDirectory;
|
|
44
43
|
const tocContext = new TocContext(tocDir);
|
|
45
44
|
if (!force && (await tocContext.exists()) && !(await this.prompts.overwriteToc(tocContext.tocPath))) {
|
|
46
45
|
this.prompts.tocFileAlreadyExists();
|
|
47
46
|
return ActionResult.cancelled();
|
|
48
47
|
}
|
|
49
|
-
const
|
|
50
|
-
const defaultComponents = {
|
|
51
|
-
endpointGroups: new Map(),
|
|
52
|
-
models: [],
|
|
53
|
-
webhookGroups: new Map(),
|
|
54
|
-
callbackGroups: new Map()
|
|
55
|
-
};
|
|
48
|
+
const tocComponents = await (async () => {
|
|
56
49
|
const specDirectory = buildDirectory.join('spec');
|
|
57
50
|
if (!(await this.fileService.directoryExists(specDirectory))) {
|
|
58
51
|
this.prompts.fallingBackToDefault();
|
|
59
|
-
return
|
|
52
|
+
return TocComponents.empty();
|
|
60
53
|
}
|
|
61
54
|
return await withDirPath(async (tempDirectory) => {
|
|
62
55
|
const tempContext = new TempContext(tempDirectory);
|
|
63
56
|
const specZipPath = await tempContext.zip(specDirectory);
|
|
64
57
|
const specFileStream = await this.fileService.getStream(specZipPath);
|
|
65
|
-
const result = await this.prompts.
|
|
58
|
+
const result = await this.prompts.extractTocData(this.portalService.generateTocData(specFileStream, this.configDirectory, this.commandMetadata), expandEndpoints, expandModels, expandWebhooks, expandCallbacks);
|
|
66
59
|
specFileStream.close();
|
|
67
60
|
if (result.isErr()) {
|
|
68
61
|
this.prompts.fallingBackToDefault();
|
|
69
|
-
return
|
|
62
|
+
return TocComponents.empty();
|
|
70
63
|
}
|
|
71
|
-
return
|
|
72
|
-
endpointGroups: extractEndpointGroupsForToc(result.value),
|
|
73
|
-
models: extractModelsForToc(result.value),
|
|
74
|
-
webhookGroups: extractWebhooksForToc(result.value),
|
|
75
|
-
callbackGroups: extractCallbacksForToc(result.value)
|
|
76
|
-
};
|
|
64
|
+
return TocComponents.fromTocData(result.value);
|
|
77
65
|
});
|
|
78
66
|
})();
|
|
79
67
|
const contentContext = new ContentContext(contentDirectory);
|
|
@@ -86,7 +74,7 @@ export class PortalNewTocAction {
|
|
|
86
74
|
else {
|
|
87
75
|
contentGroups = await contentContext.extractContentGroups();
|
|
88
76
|
}
|
|
89
|
-
const toc = this.tocGenerator.createTocStructure(
|
|
77
|
+
const toc = this.tocGenerator.createTocStructure(tocComponents, expandEndpoints, expandModels, expandWebhooks, expandCallbacks, contentGroups);
|
|
90
78
|
const yamlString = this.tocGenerator.transformToYaml(toc);
|
|
91
79
|
const tocFilePath = await tocContext.save(yamlString);
|
|
92
80
|
this.prompts.tocCreated(tocFilePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-toc.js","sourceRoot":"","sources":["../../../../src/actions/portal/toc/new-toc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AAInG,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"new-toc.js","sourceRoot":"","sources":["../../../../src/actions/portal/toc/new-toc.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CAAC,gBAAgB,CAAC,CAAC;YACxD,aAAa,GAAG,EAAE,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,aAAa,GAAG,MAAM,cAAc,CAAC,oBAAoB,EAAE,CAAC;QAC9D,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAC9C,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,eAAe,EACf,aAAa,CACd,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QAC1D,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEtD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAErC,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DirectoryPath } from '../../../types/file/directoryPath.js';
|
|
2
|
+
import { CommandMetadata } from '../../../types/common/command-metadata.js';
|
|
3
|
+
import { ActionResult } from '../../action-result.js';
|
|
4
|
+
export declare class PublishingProfileListAction {
|
|
5
|
+
private readonly configDir;
|
|
6
|
+
private readonly commandMetadata;
|
|
7
|
+
private readonly prompts;
|
|
8
|
+
private readonly publishingApiService;
|
|
9
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata);
|
|
10
|
+
execute(): Promise<ActionResult>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PublishingApiService } from '../../../infrastructure/services/publishing-api-service.js';
|
|
2
|
+
import { PublishingProfileListPrompts } from '../../../prompts/publishing/profile/list.js';
|
|
3
|
+
import { ActionResult } from '../../action-result.js';
|
|
4
|
+
import { PublishingProfiles } from '../../../types/publish/publishing-profiles.js';
|
|
5
|
+
export class PublishingProfileListAction {
|
|
6
|
+
constructor(configDir, commandMetadata) {
|
|
7
|
+
this.configDir = configDir;
|
|
8
|
+
this.commandMetadata = commandMetadata;
|
|
9
|
+
this.prompts = new PublishingProfileListPrompts();
|
|
10
|
+
this.publishingApiService = new PublishingApiService();
|
|
11
|
+
}
|
|
12
|
+
async execute() {
|
|
13
|
+
const profilesResult = await this.prompts.fetchProfiles(this.publishingApiService.getPublishingProfiles(this.configDir, this.commandMetadata.shell));
|
|
14
|
+
if (profilesResult.isErr()) {
|
|
15
|
+
this.prompts.fetchError(profilesResult.error);
|
|
16
|
+
return ActionResult.failed();
|
|
17
|
+
}
|
|
18
|
+
const publishingProfilesResult = PublishingProfiles.create(profilesResult.value);
|
|
19
|
+
if (publishingProfilesResult.isErr()) {
|
|
20
|
+
this.prompts.noProfilesFound();
|
|
21
|
+
return ActionResult.success();
|
|
22
|
+
}
|
|
23
|
+
const publishingProfiles = publishingProfilesResult.value;
|
|
24
|
+
const publishingProfileSummariesByApiGroups = publishingProfiles.toPublishingProfileSummariesByApiGroups();
|
|
25
|
+
this.prompts.displayProfiles(publishingProfileSummariesByApiGroups);
|
|
26
|
+
return ActionResult.success();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/actions/publishing/profile/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAGlG,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAEnF,MAAM,OAAO,2BAA2B;IAItC,YAA6B,SAAwB,EAAmB,eAAgC;QAA3E,cAAS,GAAT,SAAS,CAAe;QAAmB,oBAAe,GAAf,eAAe,CAAiB;QAHvF,YAAO,GAAG,IAAI,4BAA4B,EAAE,CAAC;QAC7C,yBAAoB,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAEwC,CAAC;IAErG,KAAK,CAAC,OAAO;QAClB,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CACrD,IAAI,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAC5F,CAAC;QAEF,IAAI,cAAc,CAAC,KAAK,EAAE,EAAE,CAAC;YAC3B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC9C,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;QAC/B,CAAC;QAED,MAAM,wBAAwB,GAAG,kBAAkB,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACjF,IAAI,wBAAwB,CAAC,KAAK,EAAE,EAAE,CAAC;YACrC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;YAC/B,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;QAChC,CAAC;QAED,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,KAAK,CAAC;QAC1D,MAAM,qCAAqC,GAAG,kBAAkB,CAAC,uCAAuC,EAAE,CAAC;QAC3G,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,qCAAqC,CAAC,CAAC;QACpE,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { DirectoryPath } from
|
|
2
|
-
import { ActionResult } from
|
|
3
|
-
import { CommandMetadata } from
|
|
4
|
-
import { Language } from
|
|
1
|
+
import { DirectoryPath } from '../../types/file/directoryPath.js';
|
|
2
|
+
import { ActionResult } from '../action-result.js';
|
|
3
|
+
import { CommandMetadata } from '../../types/common/command-metadata.js';
|
|
4
|
+
import { CodeGenerationVersion, Language, Stability } from '../../types/sdk/generate.js';
|
|
5
|
+
import { SemVersion } from '../../types/publish/version.js';
|
|
5
6
|
export declare class GenerateAction {
|
|
6
7
|
private readonly prompts;
|
|
7
8
|
private readonly portalService;
|
|
@@ -9,5 +10,8 @@ export declare class GenerateAction {
|
|
|
9
10
|
private readonly commandMetadata;
|
|
10
11
|
private readonly authKey;
|
|
11
12
|
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
|
|
12
|
-
readonly execute: (buildDirectory: DirectoryPath,
|
|
13
|
+
readonly execute: (buildDirectory: DirectoryPath, destinationSdkDirectory: DirectoryPath, language: Language, force: boolean, zipSdk: boolean, skipChanges: boolean, trackChanges: boolean, codeGenVersion: CodeGenerationVersion, stability: Stability, apiVersion?: string, packageVersion?: SemVersion, packageSettingsDirectory?: DirectoryPath) => Promise<ActionResult<{
|
|
14
|
+
sourceTreeTrackingInitiated: boolean;
|
|
15
|
+
conflictsResolved: boolean;
|
|
16
|
+
}>>;
|
|
13
17
|
}
|
|
@@ -1,54 +1,100 @@
|
|
|
1
|
-
import { PortalService } from
|
|
2
|
-
import { ActionResult } from
|
|
3
|
-
import { withDirPath } from
|
|
4
|
-
import { SdkContext } from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { PortalService } from '../../infrastructure/services/portal-service.js';
|
|
2
|
+
import { ActionResult } from '../action-result.js';
|
|
3
|
+
import { withDirPath } from '../../infrastructure/tmp-extensions.js';
|
|
4
|
+
import { SdkContext } from '../../types/sdk-context.js';
|
|
5
|
+
import { SdkGeneratePrompts } from '../../prompts/sdk/generate.js';
|
|
6
|
+
import { TempContext } from '../../types/temp-context.js';
|
|
7
|
+
import { CodeGenerationVersion } from '../../types/sdk/generate.js';
|
|
8
|
+
import { MergeSourceTreeAction } from './merge-source-tree.js';
|
|
9
|
+
import { BuildContext } from '../../types/build-context.js';
|
|
9
10
|
export class GenerateAction {
|
|
10
11
|
constructor(configDir, commandMetadata, authKey = null) {
|
|
11
12
|
this.prompts = new SdkGeneratePrompts();
|
|
12
13
|
this.portalService = new PortalService();
|
|
13
|
-
this.execute = async (buildDirectory,
|
|
14
|
-
if (buildDirectory.isEqual(
|
|
14
|
+
this.execute = async (buildDirectory, destinationSdkDirectory, language, force, zipSdk, skipChanges, trackChanges, codeGenVersion, stability, apiVersion, packageVersion, packageSettingsDirectory) => {
|
|
15
|
+
if (buildDirectory.isEqual(destinationSdkDirectory)) {
|
|
15
16
|
this.prompts.sameBuildAndSdkDir(buildDirectory);
|
|
16
17
|
return ActionResult.failed();
|
|
17
18
|
}
|
|
18
|
-
const
|
|
19
|
-
if (await
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const rootBuildContext = new BuildContext(buildDirectory);
|
|
20
|
+
if (!(await rootBuildContext.exists())) {
|
|
21
|
+
this.prompts.srcDirectoryEmpty(buildDirectory);
|
|
22
|
+
return ActionResult.failed();
|
|
23
|
+
}
|
|
24
|
+
const versionedContextGetter = async () => {
|
|
25
|
+
if (!(await rootBuildContext.isVersionedBuild())) {
|
|
26
|
+
if (apiVersion)
|
|
27
|
+
this.prompts.apiVersionOnlyApplicableWithVersionedBuild();
|
|
28
|
+
return { version: undefined, buildContext: rootBuildContext };
|
|
29
|
+
}
|
|
30
|
+
const versionedBuildDirectory = await rootBuildContext.getVersionedBuildDirectory();
|
|
31
|
+
if (!versionedBuildDirectory) {
|
|
32
|
+
this.prompts.invalidVersionedDocsDirectory(buildDirectory);
|
|
33
|
+
return ActionResult.failed();
|
|
34
|
+
}
|
|
35
|
+
const singleVersionedBuildDirectory = await rootBuildContext.getSingleVersionedBuildDirectory();
|
|
36
|
+
if (!apiVersion && singleVersionedBuildDirectory) {
|
|
37
|
+
return {
|
|
38
|
+
version: singleVersionedBuildDirectory.leafName(),
|
|
39
|
+
buildContext: new BuildContext(singleVersionedBuildDirectory)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const selectedVersionedBuildDirectory = await rootBuildContext.getSelectedVersionedBuildDirectory(apiVersion ? async () => apiVersion : this.prompts.selectVersion);
|
|
43
|
+
if (!selectedVersionedBuildDirectory) {
|
|
44
|
+
this.prompts.versionNotFound();
|
|
23
45
|
return ActionResult.failed();
|
|
24
46
|
}
|
|
25
|
-
|
|
26
|
-
|
|
47
|
+
return {
|
|
48
|
+
version: selectedVersionedBuildDirectory.leafName(),
|
|
49
|
+
buildContext: new BuildContext(selectedVersionedBuildDirectory)
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
const versionedContext = await versionedContextGetter();
|
|
53
|
+
if (versionedContext instanceof ActionResult) {
|
|
54
|
+
return versionedContext;
|
|
27
55
|
}
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.prompts.specDirectoryEmpty(specDirectory);
|
|
56
|
+
const { version, buildContext } = versionedContext;
|
|
57
|
+
if (!(await buildContext.getSpecContext().validate())) {
|
|
58
|
+
this.prompts.specDirectoryEmpty(buildDirectory);
|
|
32
59
|
return ActionResult.failed();
|
|
33
60
|
}
|
|
34
|
-
const
|
|
35
|
-
|
|
61
|
+
const hasSdkSourceTree = await buildContext.hasSdkSourceTree(language);
|
|
62
|
+
const sdkContext = new SdkContext(language, destinationSdkDirectory, skipChanges && hasSdkSourceTree, version);
|
|
63
|
+
if (!force && (await sdkContext.exists()) && !(await this.prompts.overwriteSdk(destinationSdkDirectory))) {
|
|
36
64
|
this.prompts.destinationDirNotEmpty();
|
|
37
65
|
return ActionResult.cancelled();
|
|
38
66
|
}
|
|
39
67
|
return await withDirPath(async (tempDirectory) => {
|
|
40
68
|
const tempContext = new TempContext(tempDirectory);
|
|
41
|
-
const buildZipPath = await
|
|
42
|
-
|
|
43
|
-
|
|
69
|
+
const buildZipPath = await buildContext.getBuildZipPath(tempDirectory, packageSettingsDirectory);
|
|
70
|
+
if (codeGenVersion === CodeGenerationVersion.V4) {
|
|
71
|
+
this.prompts.sdkCustomizationsNotSupportedForV4();
|
|
72
|
+
const response = await this.prompts.generateV4SDK(this.portalService.generateV4Sdk(buildZipPath, language, stability, this.configDir, this.commandMetadata, this.authKey));
|
|
73
|
+
if (response.isErr()) {
|
|
74
|
+
this.prompts.sdkGenerationServiceError(response.error);
|
|
75
|
+
return ActionResult.failed();
|
|
76
|
+
}
|
|
77
|
+
const responseSdkZipPath = await tempContext.save(response.value);
|
|
78
|
+
const tempSdk = await sdkContext.loadSdkInTempDirectory(tempDirectory, responseSdkZipPath);
|
|
79
|
+
this.prompts.sdkGenerated(await sdkContext.save(tempSdk, zipSdk));
|
|
80
|
+
return ActionResult.success();
|
|
81
|
+
}
|
|
82
|
+
const response = await this.prompts.generateSDK(this.portalService.generateSdk(buildZipPath, language, this.configDir, this.commandMetadata, this.authKey, packageVersion));
|
|
44
83
|
if (response.isErr()) {
|
|
45
84
|
this.prompts.sdkGenerationServiceError(response.error);
|
|
46
85
|
return ActionResult.failed();
|
|
47
86
|
}
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
87
|
+
const responseSdkZipPath = await tempContext.save(response.value.sdk);
|
|
88
|
+
const tempSdk = await sdkContext.loadSdkInTempDirectory(tempDirectory, responseSdkZipPath);
|
|
89
|
+
if (!trackChanges && !hasSdkSourceTree) {
|
|
90
|
+
this.prompts.sdkGenerated(await sdkContext.save(tempSdk, zipSdk));
|
|
91
|
+
return ActionResult.success();
|
|
92
|
+
}
|
|
93
|
+
const sdkSourceTreeTempFilePath = await tempContext.save(response.value.sdkSourceTree);
|
|
94
|
+
const tempSdkWithSourceTree = await sdkContext.loadSdkWithSourceTreeInTempDirectory(tempDirectory, responseSdkZipPath, sdkSourceTreeTempFilePath);
|
|
95
|
+
const destinationSourceTreePath = buildContext.getSdkSourceTree(language);
|
|
96
|
+
const mergeSourceTree = new MergeSourceTreeAction();
|
|
97
|
+
return await mergeSourceTree.execute(tempSdkWithSourceTree, tempSdk, destinationSourceTreePath, trackChanges, skipChanges, hasSdkSourceTree, language, destinationSdkDirectory, version, zipSdk);
|
|
52
98
|
});
|
|
53
99
|
};
|
|
54
100
|
this.configDir = configDir;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/actions/sdk/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/actions/sdk/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAuB,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5D,MAAM,OAAO,cAAc;IAOzB,YAAY,SAAwB,EAAE,eAAgC,EAAE,UAAyB,IAAI;QANpF,YAAO,GAAuB,IAAI,kBAAkB,EAAE,CAAC;QACvD,kBAAa,GAAkB,IAAI,aAAa,EAAE,CAAC;QAWpD,YAAO,GAAG,KAAK,EAC7B,cAA6B,EAC7B,uBAAsC,EACtC,QAAkB,EAClB,KAAc,EACd,MAAe,EACf,WAAoB,EACpB,YAAqB,EACrB,cAAqC,E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,EACzB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,uBAAuB,EACvB,OAAO,EACP,MAAM,CACP,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QA/JA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CA6JF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
|
+
import { FilePath } from "../../types/file/filePath.js";
|
|
3
|
+
import { Language } from "../../types/sdk/generate.js";
|
|
4
|
+
import { ActionResult } from "../action-result.js";
|
|
5
|
+
export declare class MergeSourceTreeAction {
|
|
6
|
+
private readonly prompts;
|
|
7
|
+
private readonly launcherService;
|
|
8
|
+
readonly execute: (sdkWithSourceTree: DirectoryPath, sdkWithoutSourceTree: DirectoryPath, destinationSourceTreePath: FilePath, trackChanges: boolean, skipChanges: boolean, hasSdkSourceTree: boolean, language: Language, outputSdkDirectory: DirectoryPath, version: string | undefined, zipSdk: boolean) => Promise<ActionResult<{
|
|
9
|
+
sourceTreeTrackingInitiated: boolean;
|
|
10
|
+
conflictsResolved: boolean;
|
|
11
|
+
}>>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { LauncherService } from "../../infrastructure/launcher-service.js";
|
|
2
|
+
import { MergeSourceTreePrompts } from "../../prompts/sdk/merge-source-tree.js";
|
|
3
|
+
import { ActionResult } from "../action-result.js";
|
|
4
|
+
import isInCi from "is-in-ci";
|
|
5
|
+
import { MergeSourceTreeContext } from "../../types/merge-source-tree-context.js";
|
|
6
|
+
import { SdkContext } from "../../types/sdk-context.js";
|
|
7
|
+
export class MergeSourceTreeAction {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.prompts = new MergeSourceTreePrompts();
|
|
10
|
+
this.launcherService = new LauncherService();
|
|
11
|
+
this.execute = async (sdkWithSourceTree, sdkWithoutSourceTree, destinationSourceTreePath, trackChanges, skipChanges, hasSdkSourceTree, language, outputSdkDirectory, version, zipSdk) => {
|
|
12
|
+
const mergeSourceTreeContext = new MergeSourceTreeContext(sdkWithSourceTree, sdkWithoutSourceTree, destinationSourceTreePath, trackChanges, skipChanges, hasSdkSourceTree);
|
|
13
|
+
const sdkContext = new SdkContext(language, outputSdkDirectory, skipChanges && hasSdkSourceTree, version);
|
|
14
|
+
const saveSdk = async () => await sdkContext.save(sdkWithoutSourceTree, zipSdk);
|
|
15
|
+
const { hasSkippedChangesEnabled, hasSkippedCustomizations } = await mergeSourceTreeContext.saveSkippingChanges();
|
|
16
|
+
if (hasSkippedCustomizations) {
|
|
17
|
+
this.prompts.successfullySkippedChanges(language);
|
|
18
|
+
this.prompts.sdkGenerated(await saveSdk());
|
|
19
|
+
return ActionResult.success();
|
|
20
|
+
}
|
|
21
|
+
if (hasSkippedChangesEnabled) {
|
|
22
|
+
this.prompts.sdkGenerated(await saveSdk());
|
|
23
|
+
return ActionResult.success();
|
|
24
|
+
}
|
|
25
|
+
const { hasSourceTreeTracked, hasSourceTreeAlreadyTracked, hasAppliedCustomizations } = await mergeSourceTreeContext.saveWithoutConflicts();
|
|
26
|
+
if (hasAppliedCustomizations) {
|
|
27
|
+
this.prompts.successfullyAppliedChanges(language);
|
|
28
|
+
this.prompts.sdkGeneratedWithSourceTree(await saveSdk(), destinationSourceTreePath);
|
|
29
|
+
return ActionResult.success();
|
|
30
|
+
}
|
|
31
|
+
if (hasSourceTreeAlreadyTracked) {
|
|
32
|
+
this.prompts.changeTrackingAlreadyEnabled(language);
|
|
33
|
+
this.prompts.sdkGeneratedWithSourceTree(await saveSdk(), destinationSourceTreePath);
|
|
34
|
+
return ActionResult.success();
|
|
35
|
+
}
|
|
36
|
+
if (hasSourceTreeTracked) {
|
|
37
|
+
this.prompts.sdkGenerated(await saveSdk());
|
|
38
|
+
this.prompts.changeTrackingEnabled(language, destinationSourceTreePath);
|
|
39
|
+
return ActionResult.success({ sourceTreeTrackingInitiated: true, conflictsResolved: false });
|
|
40
|
+
}
|
|
41
|
+
this.prompts.startApplyingConflictedChanges(language);
|
|
42
|
+
let conflictedFilesDirectory = await mergeSourceTreeContext.getConflictedFilesDirectory();
|
|
43
|
+
if (isInCi) {
|
|
44
|
+
this.prompts.conflictsDetectedInCi(language, conflictedFilesDirectory);
|
|
45
|
+
return ActionResult.failed();
|
|
46
|
+
}
|
|
47
|
+
while (!conflictedFilesDirectory.isEmpty()) {
|
|
48
|
+
this.prompts.conflictsDetected(conflictedFilesDirectory);
|
|
49
|
+
if (!await this.prompts.resolveNowOrAbandon()) {
|
|
50
|
+
this.prompts.mergeAbandoned(language);
|
|
51
|
+
return ActionResult.failed();
|
|
52
|
+
}
|
|
53
|
+
if (await this.launcherService.isIdeAvailable()) {
|
|
54
|
+
this.prompts.openingVsCodeForConflictResolution(language);
|
|
55
|
+
await this.launcherService.openFolderInIdeWithWait(sdkWithSourceTree, conflictedFilesDirectory.getAllFiles());
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.prompts.openFilesForConflictResolution(language, sdkWithSourceTree);
|
|
59
|
+
}
|
|
60
|
+
const response = await this.prompts.confirmConflictsResolved();
|
|
61
|
+
if (response === "cancelled") {
|
|
62
|
+
this.prompts.mergeAbandoned(language);
|
|
63
|
+
return ActionResult.failed();
|
|
64
|
+
}
|
|
65
|
+
if (response === "resolved") {
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
conflictedFilesDirectory = await mergeSourceTreeContext.getConflictedFilesDirectory();
|
|
69
|
+
}
|
|
70
|
+
await mergeSourceTreeContext.saveWithResolvedConflicts();
|
|
71
|
+
this.prompts.conflictsResolved(language);
|
|
72
|
+
this.prompts.sdkGeneratedWithSourceTree(await saveSdk(), destinationSourceTreePath);
|
|
73
|
+
await mergeSourceTreeContext.cleanUp(() => this.prompts.directoryStillOpen(sdkWithSourceTree));
|
|
74
|
+
return ActionResult.success({ sourceTreeTrackingInitiated: false, conflictsResolved: true });
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=merge-source-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-source-tree.js","sourceRoot":"","sources":["../../../src/actions/sdk/merge-source-tree.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,MAAM,OAAO,qBAAqB;IAAlC;QACmB,YAAO,GAAG,IAAI,sBAAsB,EAAE,CAAC;QACvC,oBAAe,GAAG,IAAI,eAAe,EAAE,CAAC;QAEzC,YAAO,GAAG,KAAK,EAC7B,iBAAgC,EAChC,oBAAmC,EACnC,yBAAmC,EACnC,YAAqB,EACrB,WAAoB,EACpB,gBAAyB,EACzB,QAAkB,EAClB,kBAAiC,EACjC,OAA2B,EAC3B,MAAe,EAC4E,EAAE;YAC7F,MAAM,sBAAsB,GAAG,IAAI,sBAAsB,CACvD,iBAAiB,EAAE,oBAAoB,EAAE,yBAAyB,EAClE,YAAY,EAAE,WAAW,EAAE,gBAAgB,CAC5C,CAAC;YACF,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,QAAQ,EAAE,kBAAkB,EAAE,WAAW,IAAI,gBAAgB,EAAE,OAAO,CAAC,CAAC;YAC1G,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;YAE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AAW,EAAE,CAAC;oBAC7B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;oBACtC,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC/B,CAAC;gBAED,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;oBAC5B,MAAM;gBACR,CAAC;gBAED,wBAAwB,GAAG,MAAM,sBAAsB,CAAC,2BAA2B,EAAE,CAAC;YACxF,CAAC;YAED,MAAM,sBAAsB,CAAC,yBAAyB,EAAE,CAAC;YACzD,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YACzC,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,MAAM,OAAO,EAAE,EAAE,yBAAyB,CAAC,CAAC;YAEpF,MAAM,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAAC;YAC/F,OAAO,YAAY,CAAC,OAAO,CAAC,EAAC,2BAA2B,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAC,CAAC,CAAC;QAC7F,CAAC,CAAC;IACJ,CAAC;CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommandMetadata } from '../../../types/common/command-metadata.js';
|
|
2
|
+
import { DirectoryPath } from '../../../types/file/directoryPath.js';
|
|
3
|
+
import { ActionResult } from '../../action-result.js';
|
|
4
|
+
export declare class SdkPublishInteractiveAction {
|
|
5
|
+
private readonly configDir;
|
|
6
|
+
private readonly commandMetadata;
|
|
7
|
+
private readonly prompts;
|
|
8
|
+
private readonly publishingApiService;
|
|
9
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata);
|
|
10
|
+
readonly execute: (defaultBuildDirectory: DirectoryPath, onPublishSdkError: (errorMessage: string) => void) => Promise<ActionResult>;
|
|
11
|
+
static workingDirectoryValidator(defaultBuildDirectory: DirectoryPath): (value: string | undefined) => string | undefined;
|
|
12
|
+
static sdkDirectoryValidator(buildDirectory: DirectoryPath): (value: string | undefined) => string | undefined;
|
|
13
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { PublishingApiService } from '../../../infrastructure/services/publishing-api-service.js';
|
|
2
|
+
import { SdkPublishInteractivePrompts } from '../../../prompts/sdk/publish/interactive.js';
|
|
3
|
+
import { DirectoryPath } from '../../../types/file/directoryPath.js';
|
|
4
|
+
import { PublishType } from '../../../types/publish-api/publishing-profile-item.js';
|
|
5
|
+
import { PublishingProfile } from '../../../types/publish/publishing-profile.js';
|
|
6
|
+
import { PublishingProfiles } from '../../../types/publish/publishing-profiles.js';
|
|
7
|
+
import { ActionResult } from '../../action-result.js';
|
|
8
|
+
import { SdkPublishAction } from '../publish.js';
|
|
9
|
+
import { BuildContext } from '../../../types/build-context.js';
|
|
10
|
+
import { ProfileId } from '../../../types/publish/profile-id.js';
|
|
11
|
+
import { removeQuotes } from '../../../utils/string-utils.js';
|
|
12
|
+
export class SdkPublishInteractiveAction {
|
|
13
|
+
constructor(configDir, commandMetadata) {
|
|
14
|
+
this.configDir = configDir;
|
|
15
|
+
this.commandMetadata = commandMetadata;
|
|
16
|
+
this.prompts = new SdkPublishInteractivePrompts();
|
|
17
|
+
this.publishingApiService = new PublishingApiService();
|
|
18
|
+
this.execute = async (defaultBuildDirectory, onPublishSdkError) => {
|
|
19
|
+
const workingDirectory = await this.prompts.inputWorkingDirectory(defaultBuildDirectory, SdkPublishInteractiveAction.workingDirectoryValidator(defaultBuildDirectory));
|
|
20
|
+
if (!workingDirectory) {
|
|
21
|
+
await this.prompts.noInputDirectoryProvided();
|
|
22
|
+
return ActionResult.cancelled();
|
|
23
|
+
}
|
|
24
|
+
const buildDirectory = workingDirectory.join('src');
|
|
25
|
+
const defaultSdkDirectory = workingDirectory.join('sdk');
|
|
26
|
+
const sdkDirectory = await this.prompts.inputSdkDirectory(defaultSdkDirectory, SdkPublishInteractiveAction.sdkDirectoryValidator(buildDirectory));
|
|
27
|
+
if (!sdkDirectory) {
|
|
28
|
+
await this.prompts.noSdkDirectoryProvided();
|
|
29
|
+
return ActionResult.cancelled();
|
|
30
|
+
}
|
|
31
|
+
const publishingProfilesResponse = await this.prompts.getPublishingProfiles(this.publishingApiService.getPublishingProfiles(this.configDir, this.commandMetadata.shell));
|
|
32
|
+
if (publishingProfilesResponse.isErr()) {
|
|
33
|
+
this.prompts.getPublishingProfilesServiceError(publishingProfilesResponse.error);
|
|
34
|
+
return ActionResult.failed();
|
|
35
|
+
}
|
|
36
|
+
const publishingProfileItems = publishingProfilesResponse.value;
|
|
37
|
+
const publishingProfilesResult = PublishingProfiles.create(publishingProfileItems);
|
|
38
|
+
if (publishingProfilesResult.isErr()) {
|
|
39
|
+
this.prompts.noPublishingProfilesFound(publishingProfilesResult.error);
|
|
40
|
+
return ActionResult.failed();
|
|
41
|
+
}
|
|
42
|
+
const activePublishingProfiles = publishingProfilesResult.value.getActiveProfiles();
|
|
43
|
+
if (activePublishingProfiles.length === 0) {
|
|
44
|
+
this.prompts.noProfileWithEnabledLanguagesFound();
|
|
45
|
+
return ActionResult.failed();
|
|
46
|
+
}
|
|
47
|
+
const publishingProfileItem = await this.prompts.selectPublishingProfile(publishingProfilesResult.value.toActiveProfilesGroups());
|
|
48
|
+
if (!publishingProfileItem) {
|
|
49
|
+
this.prompts.noPublishingProfileSelected();
|
|
50
|
+
return ActionResult.cancelled();
|
|
51
|
+
}
|
|
52
|
+
const publishingProfile = PublishingProfile.create(publishingProfileItem);
|
|
53
|
+
const language = await this.prompts.selectLanguage(publishingProfile);
|
|
54
|
+
if (!language) {
|
|
55
|
+
this.prompts.noLanguageSelected();
|
|
56
|
+
return ActionResult.cancelled();
|
|
57
|
+
}
|
|
58
|
+
const version = await this.prompts.inputVersion();
|
|
59
|
+
if (!version) {
|
|
60
|
+
this.prompts.noVersionSpecified();
|
|
61
|
+
return ActionResult.cancelled();
|
|
62
|
+
}
|
|
63
|
+
const publishTypes = publishingProfile.getPublishTypesForLanguage(language);
|
|
64
|
+
this.prompts.publishingSummary(publishingProfile, language, version, publishTypes);
|
|
65
|
+
const confirmed = await this.prompts.confirmPublishing();
|
|
66
|
+
if (!confirmed) {
|
|
67
|
+
this.prompts.publishingCancelled();
|
|
68
|
+
return ActionResult.cancelled();
|
|
69
|
+
}
|
|
70
|
+
if (!publishTypes.includes(PublishType.PackagePublishing)) {
|
|
71
|
+
this.prompts.sourceCodeOnlyPublishingNotice();
|
|
72
|
+
}
|
|
73
|
+
const publishingProfileId = ProfileId.createFromPublishingProfileItem(publishingProfileItem);
|
|
74
|
+
const publishResult = await new SdkPublishAction(this.configDir, this.commandMetadata).execute(buildDirectory, sdkDirectory, language, publishTypes, false, publishingProfileId, version, publishingProfile, false, onPublishSdkError);
|
|
75
|
+
if (publishResult.isFailed()) {
|
|
76
|
+
return ActionResult.failed();
|
|
77
|
+
}
|
|
78
|
+
if (publishResult.isCancelled()) {
|
|
79
|
+
return ActionResult.cancelled();
|
|
80
|
+
}
|
|
81
|
+
this.prompts.sdkPublishingInProgress(publishResult.getValue().publishingLogUrl);
|
|
82
|
+
return ActionResult.success();
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
static workingDirectoryValidator(defaultBuildDirectory) {
|
|
86
|
+
return (value) => {
|
|
87
|
+
if (!value) {
|
|
88
|
+
if (!new BuildContext(defaultBuildDirectory.join('src')).existsSync())
|
|
89
|
+
return "The 'src' directory does not exist at the provided location. Please check the path and try again.";
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (!new BuildContext(new DirectoryPath(removeQuotes(value.trim())).join('src')).existsSync())
|
|
93
|
+
return "The 'src' directory does not exist at the provided location. Please check the path and try again.";
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
static sdkDirectoryValidator(buildDirectory) {
|
|
97
|
+
return (value) => {
|
|
98
|
+
if (!value)
|
|
99
|
+
return;
|
|
100
|
+
if (new DirectoryPath(removeQuotes(value.trim())).isEqual(buildDirectory))
|
|
101
|
+
return 'SDK directory must be different from the src directory.';
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=interactive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactive.js","sourceRoot":"","sources":["../../../../src/actions/sdk/publish/interactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAClG,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAE3F,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,uDAAuD,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,MAAM,OAAO,2BAA2B;IAItC,YAAoC,SAAwB,EAAmB,eAAgC;QAA3E,cAAS,GAAT,SAAS,CAAe;QAAmB,oBAAe,GAAf,eAAe,CAAiB;QAH9F,YAAO,GAAiC,IAAI,4BAA4B,EAAE,CAAC;QAC3E,yBAAoB,GAAyB,IAAI,oBAAoB,EAAE,CAAC;QAIzE,YAAO,GAAG,KAAK,EAC7B,qBAAoC,EACpC,iBAAiD,EAC1B,EAAE;YACzB,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAC/D,qBAAqB,EACrB,2BAA2B,CAAC,yBAAyB,CAAC,qBAAqB,CAA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,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,EAAE;oBACnE,OAAO,mGAAmG,CAAC;gBAC7G,OAAO;YACT,CAAC;YACD,IAAI,CAAC,IAAI,YAAY,CAAC,IAAI,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,EAAE;gBAC3F,OAAO,mGAAmG,CAAC;QAC/G,CAAC,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,qBAAqB,CACjC,cAA6B;QAE7B,OAAO,CAAC,KAAK,EAAE,EAAE;YACf,IAAI,CAAC,KAAK;gBAAE,OAAO;YACnB,IAAI,IAAI,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;gBACvE,OAAO,yDAAyD,CAAC;QACrE,CAAC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CommandMetadata } from '../../../types/common/command-metadata.js';
|
|
2
|
+
import { DirectoryPath } from '../../../types/file/directoryPath.js';
|
|
3
|
+
import { PublishType } from '../../../types/publish-api/publishing-profile-item.js';
|
|
4
|
+
import { Language } from '../../../types/sdk/generate.js';
|
|
5
|
+
import { ActionResult } from '../../action-result.js';
|
|
6
|
+
export declare class SdkPublishNonInteractiveAction {
|
|
7
|
+
private readonly configDir;
|
|
8
|
+
private readonly commandMetadata;
|
|
9
|
+
private readonly prompts;
|
|
10
|
+
private readonly publishingApiService;
|
|
11
|
+
private readonly fileService;
|
|
12
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata);
|
|
13
|
+
readonly execute: (buildDirectory: DirectoryPath, sdkDirectory: DirectoryPath, language: Language, publishTypes: PublishType[], force: boolean, dryRun: boolean, onPublishSdkError: (errorMessage: string) => void, profileId?: string, version?: string) => Promise<ActionResult>;
|
|
14
|
+
}
|