@aws-cdk/toolkit-lib 0.1.8 → 0.3.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.
Files changed (78) hide show
  1. package/api-extractor.json +36 -0
  2. package/build-info.json +2 -2
  3. package/db.json.gz +0 -0
  4. package/lib/actions/bootstrap/index.d.ts +1 -1
  5. package/lib/actions/bootstrap/index.js +69 -5
  6. package/lib/actions/deploy/index.d.ts +1 -21
  7. package/lib/actions/deploy/index.js +1 -1
  8. package/lib/actions/deploy/private/deploy-options.d.ts +16 -4
  9. package/lib/actions/deploy/private/deploy-options.js +1 -1
  10. package/lib/actions/deploy/private/helpers.d.ts +3 -3
  11. package/lib/actions/deploy/private/helpers.js +5 -5
  12. package/lib/actions/destroy/index.d.ts +0 -6
  13. package/lib/actions/destroy/index.js +1 -1
  14. package/lib/actions/diff/index.d.ts +9 -1
  15. package/lib/actions/diff/index.js +1 -1
  16. package/lib/actions/diff/private/helpers.d.ts +19 -0
  17. package/lib/actions/diff/private/helpers.js +114 -1
  18. package/lib/actions/index.d.ts +1 -0
  19. package/lib/actions/index.js +2 -1
  20. package/lib/actions/refactor/index.d.ts +15 -0
  21. package/lib/actions/refactor/index.js +3 -0
  22. package/lib/actions/watch/index.d.ts +0 -14
  23. package/lib/actions/watch/index.js +1 -1
  24. package/lib/api/cloud-assembly/cached-source.d.ts +36 -0
  25. package/lib/api/cloud-assembly/cached-source.js +52 -0
  26. package/lib/api/cloud-assembly/index.d.ts +2 -1
  27. package/lib/api/cloud-assembly/index.js +5 -2
  28. package/lib/api/cloud-assembly/private/borrowed-assembly.d.ts +14 -0
  29. package/lib/api/cloud-assembly/private/borrowed-assembly.js +22 -0
  30. package/lib/api/cloud-assembly/private/context-aware-source.d.ts +19 -6
  31. package/lib/api/cloud-assembly/private/context-aware-source.js +29 -11
  32. package/lib/api/cloud-assembly/private/exec.js +5 -4
  33. package/lib/api/cloud-assembly/private/index.d.ts +0 -2
  34. package/lib/api/cloud-assembly/private/index.js +1 -3
  35. package/lib/api/cloud-assembly/private/prepare-source.d.ts +37 -8
  36. package/lib/api/cloud-assembly/private/prepare-source.js +79 -19
  37. package/lib/api/cloud-assembly/private/readable-assembly.d.ts +26 -0
  38. package/lib/api/cloud-assembly/private/readable-assembly.js +34 -0
  39. package/lib/api/cloud-assembly/private/source-builder.d.ts +27 -6
  40. package/lib/api/cloud-assembly/private/source-builder.js +143 -34
  41. package/lib/api/cloud-assembly/private/stack-assembly.d.ts +10 -5
  42. package/lib/api/cloud-assembly/private/stack-assembly.js +30 -12
  43. package/lib/api/cloud-assembly/source-builder.d.ts +6 -0
  44. package/lib/api/cloud-assembly/source-builder.js +1 -1
  45. package/lib/api/cloud-assembly/types.d.ts +32 -1
  46. package/lib/api/cloud-assembly/types.js +1 -1
  47. package/lib/api/shared-private.d.ts +4 -0
  48. package/lib/api/shared-private.js +11636 -52
  49. package/lib/api/shared-private.js.map +4 -4
  50. package/lib/api/shared-public.d.ts +295 -1394
  51. package/lib/api/shared-public.js +32 -923
  52. package/lib/api/shared-public.js.map +4 -4
  53. package/lib/index_bg.wasm +0 -0
  54. package/lib/private/util.js +35 -14
  55. package/lib/private/util.js.map +4 -4
  56. package/lib/toolkit/index.d.ts +2 -1
  57. package/lib/toolkit/index.js +3 -2
  58. package/lib/toolkit/non-interactive-io-host.d.ts +80 -0
  59. package/lib/toolkit/non-interactive-io-host.js +129 -0
  60. package/lib/toolkit/private/index.d.ts +5 -2
  61. package/lib/toolkit/private/index.js +7 -2
  62. package/lib/toolkit/toolkit.d.ts +54 -26
  63. package/lib/toolkit/toolkit.js +413 -282
  64. package/lib/toolkit/types.d.ts +163 -0
  65. package/lib/toolkit/types.js +3 -0
  66. package/lib/util/promises.d.ts +12 -0
  67. package/lib/util/promises.js +17 -0
  68. package/lib/util/shell-env.d.ts +10 -0
  69. package/lib/util/shell-env.js +19 -0
  70. package/package.json +17 -14
  71. package/tsconfig.dts.json +9 -0
  72. package/lib/api/aws-cdk.d.ts +0 -20
  73. package/lib/api/aws-cdk.js +0 -11041
  74. package/lib/api/aws-cdk.js.map +0 -7
  75. package/lib/api/cloud-assembly/private/cached-source.d.ts +0 -15
  76. package/lib/api/cloud-assembly/private/cached-source.js +0 -25
  77. package/lib/api/cloud-assembly/private/identity-source.d.ts +0 -10
  78. package/lib/api/cloud-assembly/private/identity-source.js +0 -17
@@ -1,14 +1,17 @@
1
- import type { ToolkitServices } from './private';
1
+ import type { TemplateDiff } from '@aws-cdk/cloudformation-diff';
2
+ import type { DeployResult, DestroyResult, RollbackResult } from './types';
2
3
  import type { BootstrapEnvironments, BootstrapOptions, BootstrapResult } from '../actions/bootstrap';
3
4
  import { type DeployOptions } from '../actions/deploy';
4
5
  import { type DestroyOptions } from '../actions/destroy';
5
6
  import type { DiffOptions } from '../actions/diff';
6
7
  import { type ListOptions } from '../actions/list';
8
+ import type { RefactorOptions } from '../actions/refactor';
7
9
  import { type RollbackOptions } from '../actions/rollback';
8
10
  import { type SynthOptions } from '../actions/synth';
9
11
  import type { WatchOptions } from '../actions/watch';
10
12
  import { type SdkConfig } from '../api/aws-auth';
11
13
  import type { ICloudAssemblySource } from '../api/cloud-assembly';
14
+ import { CachedCloudAssembly } from '../api/cloud-assembly';
12
15
  import { CloudAssemblySourceBuilder } from '../api/cloud-assembly/private';
13
16
  import type { IIoHost } from '../api/io';
14
17
  import type { StackDetails } from '../api/shared-public';
@@ -16,13 +19,13 @@ export interface ToolkitOptions {
16
19
  /**
17
20
  * The IoHost implementation, handling the inline interactions between the Toolkit and an integration.
18
21
  */
19
- ioHost?: IIoHost;
22
+ readonly ioHost?: IIoHost;
20
23
  /**
21
24
  * Allow emojis in messages sent to the IoHost.
22
25
  *
23
26
  * @default true
24
27
  */
25
- emojis?: boolean;
28
+ readonly emojis?: boolean;
26
29
  /**
27
30
  * Whether to allow ANSI colors and formatting in IoHost messages.
28
31
  * Setting this value to `false` enforces that no color or style shows up
@@ -31,28 +34,28 @@ export interface ToolkitOptions {
31
34
  *
32
35
  * @default - detects color from the TTY status of the IoHost
33
36
  */
34
- color?: boolean;
37
+ readonly color?: boolean;
35
38
  /**
36
39
  * Configuration options for the SDK.
37
40
  */
38
- sdkConfig?: SdkConfig;
41
+ readonly sdkConfig?: SdkConfig;
39
42
  /**
40
43
  * Name of the toolkit stack to be used.
41
44
  *
42
45
  * @default "CDKToolkit"
43
46
  */
44
- toolkitStackName?: string;
47
+ readonly toolkitStackName?: string;
45
48
  /**
46
49
  * Fail Cloud Assemblies
47
50
  *
48
51
  * @default "error"
49
52
  */
50
- assemblyFailureAt?: 'error' | 'warn' | 'none';
53
+ readonly assemblyFailureAt?: 'error' | 'warn' | 'none';
51
54
  }
52
55
  /**
53
56
  * The AWS CDK Programmatic Toolkit
54
57
  */
55
- export declare class Toolkit extends CloudAssemblySourceBuilder implements AsyncDisposable {
58
+ export declare class Toolkit extends CloudAssemblySourceBuilder {
56
59
  private readonly props;
57
60
  /**
58
61
  * The toolkit stack name used for bootstrapping resources.
@@ -62,30 +65,28 @@ export declare class Toolkit extends CloudAssemblySourceBuilder implements Async
62
65
  * The IoHost of this Toolkit
63
66
  */
64
67
  readonly ioHost: IIoHost;
65
- private _sdkProvider?;
66
- constructor(props?: ToolkitOptions);
67
- dispose(): Promise<void>;
68
- [Symbol.asyncDispose](): Promise<void>;
69
68
  /**
70
- * Access to the AWS SDK
69
+ * Cache of the internal SDK Provider instance
71
70
  */
72
- private sdkProvider;
73
- /**
74
- * Helper to provide the CloudAssemblySourceBuilder with required toolkit services
75
- */
76
- protected sourceBuilderServices(): Promise<ToolkitServices>;
71
+ private sdkProviderCache?;
72
+ constructor(props?: ToolkitOptions);
77
73
  /**
78
74
  * Bootstrap Action
79
75
  */
80
76
  bootstrap(environments: BootstrapEnvironments, options: BootstrapOptions): Promise<BootstrapResult>;
81
77
  /**
82
78
  * Synth Action
79
+ *
80
+ * The caller assumes ownership of the `CachedCloudAssembly` and is responsible for calling `dispose()` on
81
+ * it after use.
83
82
  */
84
- synth(cx: ICloudAssemblySource, options?: SynthOptions): Promise<ICloudAssemblySource>;
83
+ synth(cx: ICloudAssemblySource, options?: SynthOptions): Promise<CachedCloudAssembly>;
85
84
  /**
86
85
  * Diff Action
87
86
  */
88
- diff(cx: ICloudAssemblySource, options: DiffOptions): Promise<void>;
87
+ diff(cx: ICloudAssemblySource, options: DiffOptions): Promise<{
88
+ [name: string]: TemplateDiff;
89
+ }>;
89
90
  /**
90
91
  * List Action
91
92
  *
@@ -97,7 +98,7 @@ export declare class Toolkit extends CloudAssemblySourceBuilder implements Async
97
98
  *
98
99
  * Deploys the selected stacks into an AWS account
99
100
  */
100
- deploy(cx: ICloudAssemblySource, options?: DeployOptions): Promise<void>;
101
+ deploy(cx: ICloudAssemblySource, options?: DeployOptions): Promise<DeployResult>;
101
102
  /**
102
103
  * Helper to allow deploy being called as part of the watch action.
103
104
  */
@@ -105,26 +106,33 @@ export declare class Toolkit extends CloudAssemblySourceBuilder implements Async
105
106
  /**
106
107
  * Watch Action
107
108
  *
108
- * Continuously observe project files and deploy the selected stacks automatically when changes are detected.
109
- * Implies hotswap deployments.
109
+ * Continuously observe project files and deploy the selected stacks
110
+ * automatically when changes are detected. Implies hotswap deployments.
111
+ *
112
+ * This function returns immediately, starting a watcher in the background.
110
113
  */
111
- watch(cx: ICloudAssemblySource, options: WatchOptions): Promise<void>;
114
+ watch(cx: ICloudAssemblySource, options: WatchOptions): Promise<IWatcher>;
112
115
  /**
113
116
  * Rollback Action
114
117
  *
115
118
  * Rolls back the selected stacks.
116
119
  */
117
- rollback(cx: ICloudAssemblySource, options: RollbackOptions): Promise<void>;
120
+ rollback(cx: ICloudAssemblySource, options: RollbackOptions): Promise<RollbackResult>;
118
121
  /**
119
122
  * Helper to allow rollback being called as part of the deploy or watch action.
120
123
  */
121
124
  private _rollback;
125
+ /**
126
+ * Refactor Action. Moves resources from one location (stack + logical ID) to another.
127
+ */
128
+ refactor(cx: ICloudAssemblySource, options?: RefactorOptions): Promise<void>;
129
+ private _refactor;
122
130
  /**
123
131
  * Destroy Action
124
132
  *
125
133
  * Destroys the selected Stacks.
126
134
  */
127
- destroy(cx: ICloudAssemblySource, options: DestroyOptions): Promise<void>;
135
+ destroy(cx: ICloudAssemblySource, options: DestroyOptions): Promise<DestroyResult>;
128
136
  /**
129
137
  * Helper to allow destroy being called as part of the deploy action.
130
138
  */
@@ -139,3 +147,23 @@ export declare class Toolkit extends CloudAssemblySourceBuilder implements Async
139
147
  private deploymentsForAction;
140
148
  private invokeDeployFromWatch;
141
149
  }
150
+ /**
151
+ * The result of a `cdk.watch()` operation.
152
+ */
153
+ export interface IWatcher extends AsyncDisposable {
154
+ /**
155
+ * Stop the watcher and wait for the current watch iteration to complete.
156
+ *
157
+ * An alias for `[Symbol.asyncDispose]`, as a more readable alternative for
158
+ * environments that don't support the Disposable APIs yet.
159
+ */
160
+ dispose(): Promise<void>;
161
+ /**
162
+ * Wait for the watcher to stop.
163
+ *
164
+ * The watcher will only stop if `dispose()` or `[Symbol.asyncDispose]()` are called.
165
+ *
166
+ * If neither of those is called, awaiting this promise will wait forever.
167
+ */
168
+ waitForEnd(): Promise<void>;
169
+ }