@apimatic/cli 1.1.0-beta.10 → 1.1.0-beta.13

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.
Files changed (166) hide show
  1. package/README.md +105 -6
  2. package/lib/actions/portal/generate.js +7 -1
  3. package/lib/actions/portal/generate.js.map +1 -1
  4. package/lib/actions/publishing/profile/list.d.ts +11 -0
  5. package/lib/actions/publishing/profile/list.js +29 -0
  6. package/lib/actions/publishing/profile/list.js.map +1 -0
  7. package/lib/actions/sdk/generate.d.ts +5 -1
  8. package/lib/actions/sdk/generate.js +55 -40
  9. package/lib/actions/sdk/generate.js.map +1 -1
  10. package/lib/actions/sdk/merge-source-tree.d.ts +12 -0
  11. package/lib/actions/sdk/merge-source-tree.js +78 -0
  12. package/lib/actions/sdk/merge-source-tree.js.map +1 -0
  13. package/lib/actions/sdk/publish/interactive.d.ts +13 -0
  14. package/lib/actions/sdk/publish/interactive.js +105 -0
  15. package/lib/actions/sdk/publish/interactive.js.map +1 -0
  16. package/lib/actions/sdk/publish/non-interactive.d.ts +14 -0
  17. package/lib/actions/sdk/publish/non-interactive.js +101 -0
  18. package/lib/actions/sdk/publish/non-interactive.js.map +1 -0
  19. package/lib/actions/sdk/publish.d.ts +18 -0
  20. package/lib/actions/sdk/publish.js +56 -0
  21. package/lib/actions/sdk/publish.js.map +1 -0
  22. package/lib/actions/sdk/quickstart.js +1 -1
  23. package/lib/actions/sdk/quickstart.js.map +1 -1
  24. package/lib/actions/sdk/save-changes.d.ts +8 -0
  25. package/lib/actions/sdk/save-changes.js +93 -0
  26. package/lib/actions/sdk/save-changes.js.map +1 -0
  27. package/lib/commands/portal/recipe/new.js +2 -2
  28. package/lib/commands/portal/recipe/new.js.map +1 -1
  29. package/lib/commands/portal/toc/new.js +2 -2
  30. package/lib/commands/portal/toc/new.js.map +1 -1
  31. package/lib/commands/publishing/profile/list.d.ts +9 -0
  32. package/lib/commands/publishing/profile/list.js +28 -0
  33. package/lib/commands/publishing/profile/list.js.map +1 -0
  34. package/lib/commands/quickstart.js +1 -1
  35. package/lib/commands/quickstart.js.map +1 -1
  36. package/lib/commands/sdk/generate.d.ts +4 -2
  37. package/lib/commands/sdk/generate.js +26 -8
  38. package/lib/commands/sdk/generate.js.map +1 -1
  39. package/lib/commands/sdk/publish.d.ts +18 -0
  40. package/lib/commands/sdk/publish.js +73 -0
  41. package/lib/commands/sdk/publish.js.map +1 -0
  42. package/lib/commands/sdk/save-changes.d.ts +14 -0
  43. package/lib/commands/sdk/save-changes.js +51 -0
  44. package/lib/commands/sdk/save-changes.js.map +1 -0
  45. package/lib/hooks/not-found.js +1 -1
  46. package/lib/hooks/not-found.js.map +1 -1
  47. package/lib/infrastructure/env-info.d.ts +2 -0
  48. package/lib/infrastructure/env-info.js +22 -11
  49. package/lib/infrastructure/env-info.js.map +1 -1
  50. package/lib/infrastructure/file-service.d.ts +9 -0
  51. package/lib/infrastructure/file-service.js +94 -5
  52. package/lib/infrastructure/file-service.js.map +1 -1
  53. package/lib/infrastructure/git-service.d.ts +14 -0
  54. package/lib/infrastructure/git-service.js +90 -0
  55. package/lib/infrastructure/git-service.js.map +1 -0
  56. package/lib/infrastructure/launcher-service.d.ts +5 -0
  57. package/lib/infrastructure/launcher-service.js +35 -2
  58. package/lib/infrastructure/launcher-service.js.map +1 -1
  59. package/lib/infrastructure/os-extensions.d.ts +2 -0
  60. package/lib/infrastructure/os-extensions.js +6 -0
  61. package/lib/infrastructure/os-extensions.js.map +1 -0
  62. package/lib/infrastructure/service-error.d.ts +14 -2
  63. package/lib/infrastructure/service-error.js +26 -9
  64. package/lib/infrastructure/service-error.js.map +1 -1
  65. package/lib/infrastructure/services/portal-service.d.ts +6 -1
  66. package/lib/infrastructure/services/portal-service.js +37 -18
  67. package/lib/infrastructure/services/portal-service.js.map +1 -1
  68. package/lib/infrastructure/services/publishing-api-service.d.ts +19 -0
  69. package/lib/infrastructure/services/publishing-api-service.js +111 -0
  70. package/lib/infrastructure/services/publishing-api-service.js.map +1 -0
  71. package/lib/infrastructure/zip-service.d.ts +2 -2
  72. package/lib/infrastructure/zip-service.js +29 -11
  73. package/lib/infrastructure/zip-service.js.map +1 -1
  74. package/lib/prompts/format.d.ts +0 -2
  75. package/lib/prompts/format.js +0 -31
  76. package/lib/prompts/format.js.map +1 -1
  77. package/lib/prompts/portal/generate.d.ts +1 -1
  78. package/lib/prompts/portal/generate.js +9 -3
  79. package/lib/prompts/portal/generate.js.map +1 -1
  80. package/lib/prompts/prompt.d.ts +6 -0
  81. package/lib/prompts/prompt.js +45 -0
  82. package/lib/prompts/prompt.js.map +1 -1
  83. package/lib/prompts/publishing/profile/list.d.ts +9 -0
  84. package/lib/prompts/publishing/profile/list.js +27 -0
  85. package/lib/prompts/publishing/profile/list.js.map +1 -0
  86. package/lib/prompts/sdk/generate.d.ts +5 -3
  87. package/lib/prompts/sdk/generate.js +20 -14
  88. package/lib/prompts/sdk/generate.js.map +1 -1
  89. package/lib/prompts/sdk/merge-source-tree.d.ts +22 -0
  90. package/lib/prompts/sdk/merge-source-tree.js +90 -0
  91. package/lib/prompts/sdk/merge-source-tree.js.map +1 -0
  92. package/lib/prompts/sdk/publish/interactive.d.ts +30 -0
  93. package/lib/prompts/sdk/publish/interactive.js +139 -0
  94. package/lib/prompts/sdk/publish/interactive.js.map +1 -0
  95. package/lib/prompts/sdk/publish/non-interactive.d.ts +27 -0
  96. package/lib/prompts/sdk/publish/non-interactive.js +97 -0
  97. package/lib/prompts/sdk/publish/non-interactive.js.map +1 -0
  98. package/lib/prompts/sdk/publish.d.ts +12 -0
  99. package/lib/prompts/sdk/publish.js +16 -0
  100. package/lib/prompts/sdk/publish.js.map +1 -0
  101. package/lib/prompts/sdk/save-changes.d.ts +21 -0
  102. package/lib/prompts/sdk/save-changes.js +84 -0
  103. package/lib/prompts/sdk/save-changes.js.map +1 -0
  104. package/lib/types/build/build.d.ts +2 -0
  105. package/lib/types/build/build.js.map +1 -1
  106. package/lib/types/build-context.d.ts +11 -0
  107. package/lib/types/build-context.js +81 -1
  108. package/lib/types/build-context.js.map +1 -1
  109. package/lib/types/events/sdk-changes-saved.d.ts +8 -0
  110. package/lib/types/events/sdk-changes-saved.js +11 -0
  111. package/lib/types/events/sdk-changes-saved.js.map +1 -0
  112. package/lib/types/events/sdk-changes-tracked.d.ts +8 -0
  113. package/lib/types/events/sdk-changes-tracked.js +11 -0
  114. package/lib/types/events/sdk-changes-tracked.js.map +1 -0
  115. package/lib/types/events/sdk-conflicts-resolved.d.ts +8 -0
  116. package/lib/types/events/sdk-conflicts-resolved.js +11 -0
  117. package/lib/types/events/sdk-conflicts-resolved.js.map +1 -0
  118. package/lib/types/events/sdk-publish-validation-failed.d.ts +5 -0
  119. package/lib/types/events/sdk-publish-validation-failed.js +8 -0
  120. package/lib/types/events/sdk-publish-validation-failed.js.map +1 -0
  121. package/lib/types/file/directory.d.ts +10 -1
  122. package/lib/types/file/directory.js +63 -5
  123. package/lib/types/file/directory.js.map +1 -1
  124. package/lib/types/file/directoryPath.js.map +1 -1
  125. package/lib/types/merge-source-tree-context.d.ts +28 -0
  126. package/lib/types/merge-source-tree-context.js +63 -0
  127. package/lib/types/merge-source-tree-context.js.map +1 -0
  128. package/lib/types/package-settings-context.d.ts +10 -0
  129. package/lib/types/package-settings-context.js +20 -0
  130. package/lib/types/package-settings-context.js.map +1 -0
  131. package/lib/types/publish/package-settings-configuration.d.ts +70 -0
  132. package/lib/types/publish/package-settings-configuration.js +46 -0
  133. package/lib/types/publish/package-settings-configuration.js.map +1 -0
  134. package/lib/types/publish/profile-id.d.ts +10 -0
  135. package/lib/types/publish/profile-id.js +22 -0
  136. package/lib/types/publish/profile-id.js.map +1 -0
  137. package/lib/types/publish/publishing-profile.d.ts +18 -0
  138. package/lib/types/publish/publishing-profile.js +105 -0
  139. package/lib/types/publish/publishing-profile.js.map +1 -0
  140. package/lib/types/publish/publishing-profiles.d.ts +12 -0
  141. package/lib/types/publish/publishing-profiles.js +36 -0
  142. package/lib/types/publish/publishing-profiles.js.map +1 -0
  143. package/lib/types/publish/version.d.ts +7 -0
  144. package/lib/types/publish/version.js +17 -0
  145. package/lib/types/publish/version.js.map +1 -0
  146. package/lib/types/publish-api/publish-log.d.ts +20 -0
  147. package/lib/types/publish-api/publish-log.js +2 -0
  148. package/lib/types/publish-api/publish-log.js.map +1 -0
  149. package/lib/types/publish-api/publishing-info.d.ts +4 -0
  150. package/lib/types/publish-api/publishing-info.js +2 -0
  151. package/lib/types/publish-api/publishing-info.js.map +1 -0
  152. package/lib/types/publish-api/publishing-profile-item.d.ts +183 -0
  153. package/lib/types/publish-api/publishing-profile-item.js +6 -0
  154. package/lib/types/publish-api/publishing-profile-item.js.map +1 -0
  155. package/lib/types/save-changes-context.d.ts +17 -0
  156. package/lib/types/save-changes-context.js +42 -0
  157. package/lib/types/save-changes-context.js.map +1 -0
  158. package/lib/types/sdk-context.d.ts +5 -4
  159. package/lib/types/sdk-context.js +26 -13
  160. package/lib/types/sdk-context.js.map +1 -1
  161. package/lib/types/spec-context.js.map +1 -1
  162. package/lib/types/temp-context.js.map +1 -1
  163. package/package.json +18 -9
  164. package/lib/types/versioned-build-context.d.ts +0 -15
  165. package/lib/types/versioned-build-context.js +0 -28
  166. package/lib/types/versioned-build-context.js.map +0 -1
package/README.md CHANGED
@@ -24,7 +24,7 @@ $ npm install -g @apimatic/cli
24
24
  $ apimatic COMMAND
25
25
  running command...
26
26
  $ apimatic (--version)
27
- @apimatic/cli/1.1.0-beta.8 win32-x64 node-v23.4.0
27
+ @apimatic/cli/1.1.0-beta.11 win32-x64 node-v23.4.0
28
28
  $ apimatic --help [COMMAND]
29
29
  USAGE
30
30
  $ apimatic COMMAND
@@ -46,8 +46,11 @@ USAGE
46
46
  * [`apimatic portal recipe new`](#apimatic-portal-recipe-new)
47
47
  * [`apimatic portal serve`](#apimatic-portal-serve)
48
48
  * [`apimatic portal toc new`](#apimatic-portal-toc-new)
49
+ * [`apimatic publishing profile list`](#apimatic-publishing-profile-list)
49
50
  * [`apimatic quickstart`](#apimatic-quickstart)
50
51
  * [`apimatic sdk generate`](#apimatic-sdk-generate)
52
+ * [`apimatic sdk publish`](#apimatic-sdk-publish)
53
+ * [`apimatic sdk save-changes`](#apimatic-sdk-save-changes)
51
54
 
52
55
  ## `apimatic api transform`
53
56
 
@@ -386,6 +389,25 @@ EXAMPLES
386
389
 
387
390
  _See code: [src/commands/portal/toc/new.ts](https://github.com/apimatic/apimatic-cli/blob/beta/src/commands/portal/toc/new.ts)_
388
391
 
392
+ ## `apimatic publishing profile list`
393
+
394
+ List all publishing profiles
395
+
396
+ ```
397
+ USAGE
398
+ $ apimatic publishing profile list
399
+
400
+ DESCRIPTION
401
+ List all publishing profiles
402
+
403
+ Display all publishing profiles associated with your account, including each profile's name, ID and enabled languages.
404
+
405
+ EXAMPLES
406
+ apimatic publishing profile list
407
+ ```
408
+
409
+ _See code: [src/commands/publishing/profile/list.ts](https://github.com/apimatic/apimatic-cli/blob/beta/src/commands/publishing/profile/list.ts)_
410
+
389
411
  ## `apimatic quickstart`
390
412
 
391
413
  Create your first SDK or API Portal using APIMatic.
@@ -411,18 +433,21 @@ Generate an SDK for your API
411
433
 
412
434
  ```
413
435
  USAGE
414
- $ apimatic sdk generate -l csharp|java|php|python|ruby|typescript|go [-i <value>] [-d <value>] [--api-version
415
- <value>] [-f] [--zip] [-k <value>]
436
+ $ apimatic sdk generate -l csharp|java|php|python|ruby|typescript|go [-d <value>] [--skip-changes]
437
+ [--api-version <value>] [--zip] [--track-changes] [-i <value>] [-f] [-k <value>]
416
438
 
417
439
  FLAGS
418
- -d, --destination=<value> directory where the SDK will be generated
440
+ -d, --destination=<value> [default: <input>/sdk/<language> | <input>/sdk/<api-version>/<language>] path where the SDK
441
+ will be generated
419
442
  -f, --force overwrite changes without asking for user consent.
420
443
  -i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes
421
444
  API specifications and configuration files.
422
445
  -k, --auth-key=<value> override current authentication state with an authentication key.
423
- -l, --language=<option> (required) programming language for SDK generation
446
+ -l, --language=<option> (required) Programming language for SDK generation
424
447
  <options: csharp|java|php|python|ruby|typescript|go>
425
448
  --api-version=<value> Version of the API to use for SDK generation (if multiple versions exist)
449
+ --skip-changes Do not apply the saved changes to the generated SDK
450
+ --track-changes Enable change tracking for SDK generation (only required for initial setup)
426
451
  --zip Download the generated SDK as a .zip archive
427
452
 
428
453
  DESCRIPTION
@@ -440,4 +465,78 @@ EXAMPLES
440
465
  ```
441
466
 
442
467
  _See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/beta/src/commands/sdk/generate.ts)_
443
- <!-- commandsstop -->
468
+
469
+ ## `apimatic sdk publish`
470
+
471
+ Generate and publish an SDK to a package registry and/or source repository
472
+
473
+ ```
474
+ USAGE
475
+ $ apimatic sdk publish [-p <value>] [-v <value>] [-d <value>] [-l csharp|java|php|python|ruby|typescript] [-f]
476
+ [-i <value>] [--publish-type package|sourcecode...] [--dry-run]
477
+
478
+ FLAGS
479
+ -d, --destination=<value> [default: <input>/sdk] path where the sdk will be generated.
480
+ -f, --force overwrite changes without asking for user consent.
481
+ -i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which
482
+ includes API specifications and configuration files.
483
+ -l, --language=<option> Language of the SDK to generate and publish.
484
+ <options: csharp|java|php|python|ruby|typescript>
485
+ -p, --profile-id=<value> Id of the publishing profile to use.
486
+ -v, --version=<value> Semantic version of the SDK to publish (e.g. 1.0.0).
487
+ --dry-run Generate the SDK locally for review without publishing.
488
+ --publish-type=<option>... One or more publishing targets: 'package' for a package registry, 'sourcecode' for a
489
+ git repository.
490
+ <options: package|sourcecode>
491
+
492
+ DESCRIPTION
493
+ Generate and publish an SDK to a package registry and/or source repository
494
+
495
+ Generate and publish an SDK using a publishing profile configured in the APIMatic App. Requires an input directory
496
+ containing the API specification. Run without flags for a step-by-step interactive experience, or pass all required
497
+ flags for CI/CD automation.
498
+
499
+ EXAMPLES
500
+ apimatic sdk publish
501
+
502
+ apimatic sdk publish --profile-id=a1b2c3d4e5f6a1b2c3d4e5f6 --language=typescript --version=1.0.0 --publish-type=package --publish-type=sourcecode
503
+
504
+ apimatic sdk publish --profile-id=b2c3d4e5f6a1b2c3d4e5f6a1 --language=java --version=2.0.0 --publish-type=sourcecode
505
+
506
+ apimatic sdk publish --profile-id=c3d4e5f6a1b2c3d4e5f6a1b2 --language=python --version=1.0.0 --publish-type=package --dry-run
507
+ ```
508
+
509
+ _See code: [src/commands/sdk/publish.ts](https://github.com/apimatic/apimatic-cli/blob/beta/src/commands/sdk/publish.ts)_
510
+
511
+ ## `apimatic sdk save-changes`
512
+
513
+ Save customizations made to an auto-generated SDK
514
+
515
+ ```
516
+ USAGE
517
+ $ apimatic sdk save-changes -l csharp|java|php|python|ruby|typescript|go [--sdk <value>] [--api-version <value>] [-i
518
+ <value>]
519
+
520
+ FLAGS
521
+ -i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes
522
+ API specifications and configuration files.
523
+ -l, --language=<option> (required) Programming language of the SDK
524
+ <options: csharp|java|php|python|ruby|typescript|go>
525
+ --api-version=<value> Version of the API where changes should be saved (if multiple versions exist).
526
+ --sdk=<value> [default: ./sdk/<language> | ./sdk/<api-version>/<language>] path to the folder containing
527
+ the updated SDK.
528
+
529
+ DESCRIPTION
530
+ Save customizations made to an auto-generated SDK
531
+
532
+ Requires an input directory with API specifications, a path to the updated SDK directory, and the programming
533
+ language.
534
+
535
+ EXAMPLES
536
+ apimatic sdk save-changes --language=csharp
537
+
538
+ apimatic sdk save-changes --language=java --sdk=./sdk
539
+ ```
540
+
541
+ _See code: [src/commands/sdk/save-changes.ts](https://github.com/apimatic/apimatic-cli/blob/beta/src/commands/sdk/save-changes.ts)_
542
+ <!-- commandsstop -->
@@ -34,7 +34,13 @@ export class GenerateAction {
34
34
  if (response.isErr()) {
35
35
  const error = response.error;
36
36
  if (error instanceof ServiceError) {
37
- this.prompts.portalGenerationServiceError(error);
37
+ const sdkMergeFailedErrors = error.getError("sdkMergeFailed");
38
+ if (sdkMergeFailedErrors) {
39
+ this.prompts.portalGenerationSdkMergeFailed(sdkMergeFailedErrors);
40
+ }
41
+ else {
42
+ this.prompts.portalGenerationError(error.errorMessage);
43
+ }
38
44
  }
39
45
  else if (typeof error === "string") {
40
46
  this.prompts.portalGenerationError(error);
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/actions/portal/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,MAAM,OAAO,cAAc;IAQzB,YAAY,SAAwB,EAAE,eAAgC,EAAE,UAAyB,IAAI;QAPpF,YAAO,GAA0B,IAAI,qBAAqB,EAAE,CAAC;QAC7D,oBAAe,GAAoB,IAAI,eAAe,EAAE,CAAC;QACzD,kBAAa,GAAkB,IAAI,aAAa,EAAE,CAAC;QAWpD,YAAO,GAAG,KAAK,EAC7B,cAA6B,EAC7B,eAA8B,EAC9B,KAAc,EACd,SAAkB,EAClB,kBAA2B,IAAI,EACR,EAAE;YACzB,IAAI,cAAc,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;gBAC5C,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;gBACpD,OAAO,YAAY,C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,GAAG,MAAM,aAAa,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;wBAC/D,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;wBAChD,IAAI,CAAC,OAAO,CAAC,+BAA+B,CAAC,UAAU,CAAC,CAAC;oBAC3D,CAAC;oBACD,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC/B,CAAC;gBAED,MAAM,iBAAiB,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACjE,MAAM,aAAa,CAAC,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;gBAEvD,IAAI,eAAe,EAAE,CAAC;oBACpB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;gBAChD,CAAC;gBAED,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAlEA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CAgEF"}
@@ -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"}
@@ -2,6 +2,7 @@ import { DirectoryPath } from "../../types/file/directoryPath.js";
2
2
  import { ActionResult } from "../action-result.js";
3
3
  import { CommandMetadata } from "../../types/common/command-metadata.js";
4
4
  import { Language } 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, sdkDirectory: DirectoryPath, language: Language, force: boolean, zipSdk: boolean, apiVersion?: string) => Promise<ActionResult>;
13
+ readonly execute: (buildDirectory: DirectoryPath, destinationSdkDirectory: DirectoryPath, language: Language, force: boolean, zipSdk: boolean, skipChanges: boolean, trackChanges: boolean, apiVersion?: string, packageVersion?: SemVersion, packageSettingsDirectory?: DirectoryPath) => Promise<ActionResult<{
14
+ sourceTreeTrackingInitiated: boolean;
15
+ conflictsResolved: boolean;
16
+ }>>;
13
17
  }
@@ -2,71 +2,86 @@ import { PortalService } from "../../infrastructure/services/portal-service.js";
2
2
  import { ActionResult } from "../action-result.js";
3
3
  import { withDirPath } from "../../infrastructure/tmp-extensions.js";
4
4
  import { SdkContext } from "../../types/sdk-context.js";
5
- import { VersionedBuildContext } from "../../types/versioned-build-context.js";
6
5
  import { SdkGeneratePrompts } from "../../prompts/sdk/generate.js";
7
6
  import { TempContext } from "../../types/temp-context.js";
8
- import { SpecContext } from "../../types/spec-context.js";
7
+ import { MergeSourceTreeAction } from "./merge-source-tree.js";
8
+ import { BuildContext } from "../../types/build-context.js";
9
9
  export class GenerateAction {
10
10
  constructor(configDir, commandMetadata, authKey = null) {
11
11
  this.prompts = new SdkGeneratePrompts();
12
12
  this.portalService = new PortalService();
13
- this.execute = async (buildDirectory, sdkDirectory, language, force, zipSdk, apiVersion) => {
14
- if (buildDirectory.isEqual(sdkDirectory)) {
13
+ this.execute = async (buildDirectory, destinationSdkDirectory, language, force, zipSdk, skipChanges, trackChanges, apiVersion, packageVersion, packageSettingsDirectory) => {
14
+ if (buildDirectory.isEqual(destinationSdkDirectory)) {
15
15
  this.prompts.sameBuildAndSdkDir(buildDirectory);
16
16
  return ActionResult.failed();
17
17
  }
18
- const versionedBuildContext = new VersionedBuildContext(buildDirectory);
19
- const versionedBuildResult = await versionedBuildContext.validate();
20
- if (versionedBuildResult.isValid) {
21
- if (versionedBuildResult.versions.length === 0) {
22
- this.prompts.versionedBuildEmpty(versionedBuildResult.versionsDirectory);
23
- return ActionResult.failed();
18
+ const rootBuildContext = new BuildContext(buildDirectory);
19
+ if (!(await rootBuildContext.exists())) {
20
+ this.prompts.srcDirectoryEmpty(buildDirectory);
21
+ return ActionResult.failed();
22
+ }
23
+ const versionedContextGetter = async () => {
24
+ if (!await rootBuildContext.isVersionedBuild()) {
25
+ if (apiVersion)
26
+ this.prompts.apiVersionOnlyApplicableWithVersionedBuild();
27
+ return { version: undefined, buildContext: rootBuildContext };
24
28
  }
25
- let version;
26
- if (apiVersion) {
27
- if (!versionedBuildResult.versions.includes(apiVersion)) {
28
- this.prompts.versionNotFound();
29
- return ActionResult.failed();
30
- }
31
- version = apiVersion;
29
+ const versionedBuildDirectory = await rootBuildContext.getVersionedBuildDirectory();
30
+ if (!versionedBuildDirectory) {
31
+ this.prompts.invalidVersionedDocsDirectory(buildDirectory);
32
+ return ActionResult.failed();
32
33
  }
33
- else if (versionedBuildResult.versions.length === 1) {
34
- version = versionedBuildResult.versions[0];
34
+ const singleVersionedBuildDirectory = await rootBuildContext.getSingleVersionedBuildDirectory();
35
+ if (!apiVersion && singleVersionedBuildDirectory) {
36
+ return {
37
+ version: singleVersionedBuildDirectory.leafName(),
38
+ buildContext: new BuildContext(singleVersionedBuildDirectory)
39
+ };
35
40
  }
36
- else {
37
- const selectedVersion = await this.prompts.selectVersion(versionedBuildResult.versions);
38
- if (!selectedVersion) {
39
- return ActionResult.cancelled();
40
- }
41
- version = selectedVersion;
41
+ const selectedVersionedBuildDirectory = await rootBuildContext.getSelectedVersionedBuildDirectory(apiVersion ? async () => apiVersion : this.prompts.selectVersion);
42
+ if (!selectedVersionedBuildDirectory) {
43
+ this.prompts.versionNotFound();
44
+ return ActionResult.failed();
42
45
  }
43
- buildDirectory = versionedBuildResult.versionsDirectory.join(version);
44
- sdkDirectory = sdkDirectory.join(version);
46
+ return {
47
+ version: selectedVersionedBuildDirectory.leafName(),
48
+ buildContext: new BuildContext(selectedVersionedBuildDirectory)
49
+ };
50
+ };
51
+ const versionedContext = await versionedContextGetter();
52
+ if (versionedContext instanceof ActionResult) {
53
+ return versionedContext;
45
54
  }
46
- const specDirectory = buildDirectory.join("spec");
47
- const specContext = new SpecContext(specDirectory);
48
- if (!(await specContext.validate())) {
49
- this.prompts.specDirectoryEmpty(specDirectory);
55
+ const { version, buildContext } = versionedContext;
56
+ if (!(await buildContext.getSpecContext().validate())) {
57
+ this.prompts.specDirectoryEmpty(buildDirectory);
50
58
  return ActionResult.failed();
51
59
  }
52
- const sdkContext = new SdkContext(sdkDirectory, language);
53
- if (!force && (await sdkContext.exists()) && !(await this.prompts.overwriteSdk(sdkContext.sdkLanguageDirectory))) {
60
+ const hasSdkSourceTree = await buildContext.hasSdkSourceTree(language);
61
+ const sdkContext = new SdkContext(language, destinationSdkDirectory, skipChanges && hasSdkSourceTree, version);
62
+ if (!force && await sdkContext.exists() && !(await this.prompts.overwriteSdk(destinationSdkDirectory))) {
54
63
  this.prompts.destinationDirNotEmpty();
55
64
  return ActionResult.cancelled();
56
65
  }
57
66
  return await withDirPath(async (tempDirectory) => {
58
67
  const tempContext = new TempContext(tempDirectory);
59
- const buildZipPath = await tempContext.zip(buildDirectory);
60
- const response = await this.prompts.generateSDK(this.portalService.generateSdk(buildZipPath, language, this.configDir, this.commandMetadata, this.authKey));
61
- // TODO: this should be service error
68
+ const buildZipPath = await buildContext.getBuildZipPath(tempDirectory, packageSettingsDirectory);
69
+ const response = await this.prompts.generateSDK(this.portalService.generateSdk(buildZipPath, language, this.configDir, this.commandMetadata, this.authKey, packageVersion));
62
70
  if (response.isErr()) {
63
71
  this.prompts.sdkGenerationServiceError(response.error);
64
72
  return ActionResult.failed();
65
73
  }
66
- const tempSdkFilePath = await tempContext.save(response.value);
67
- const sdkLanguageDirectory = await sdkContext.save(tempSdkFilePath, zipSdk);
68
- this.prompts.sdkGenerated(sdkLanguageDirectory);
69
- return ActionResult.success();
74
+ const responseSdkZipPath = await tempContext.save(response.value.sdk);
75
+ const tempSdk = await sdkContext.loadSdkInTempDirectory(tempDirectory, responseSdkZipPath);
76
+ if (!trackChanges && !hasSdkSourceTree) {
77
+ this.prompts.sdkGenerated(await sdkContext.save(tempSdk, zipSdk));
78
+ return ActionResult.success();
79
+ }
80
+ const sdkSourceTreeTempFilePath = await tempContext.save(response.value.sdkSourceTree);
81
+ const tempSdkWithSourceTree = await sdkContext.loadSdkWithSourceTreeInTempDirectory(tempDirectory, responseSdkZipPath, sdkSourceTreeTempFilePath);
82
+ const destinationSourceTreePath = buildContext.getSdkSourceTree(language);
83
+ const mergeSourceTree = new MergeSourceTreeAction();
84
+ return await mergeSourceTree.execute(tempSdkWithSourceTree, tempSdk, destinationSourceTreePath, trackChanges, skipChanges, hasSdkSourceTree, language, destinationSdkDirectory, version, zipSdk);
70
85
  });
71
86
  };
72
87
  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,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,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,YAA2B,EAC3B,QAAkB,EAClB,KAAc,EACd,MAAe,EACf,UAA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IAAI,CAAC,gBAAgB,EAAE,CAAC;oBACvC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;oBAClE,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;gBAChC,CAAC;gBAED,MAAM,yBAAyB,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;gBAEvF,MAAM,qBAAqB,GAAG,MAAM,UAAU,CAAC,oCAAoC,CACjF,aAAa,EACb,kBAAkB,EAClB,yBAAyB,CAC1B,CAAC;gBACF,MAAM,yBAAyB,GAAG,YAAY,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;gBAE1E,MAAM,eAAe,GAAG,IAAI,qBAAqB,EAAE,CAAC;gBACpD,OAAO,MAAM,eAAe,CAAC,OAAO,CAClC,qBAAqB,EAAE,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EACtG,QAAQ,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,CACnD,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QArHA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CAmHF"}
@@ -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;YAEhF,MAAM,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,GAAG,MAAM,sBAAsB,C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,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