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