@aws-cdk/toolkit-lib 0.1.7 → 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 (64) 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 -2
  5. package/lib/actions/bootstrap/index.js +13 -6
  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 +20 -16
  15. package/lib/actions/diff/index.js +4 -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/index.d.ts +1 -0
  19. package/lib/actions/index.js +2 -1
  20. package/lib/actions/watch/index.d.ts +0 -14
  21. package/lib/actions/watch/index.js +1 -1
  22. package/lib/api/cloud-assembly/index.d.ts +1 -1
  23. package/lib/api/cloud-assembly/index.js +4 -2
  24. package/lib/api/cloud-assembly/private/context-aware-source.d.ts +1 -1
  25. package/lib/api/cloud-assembly/private/context-aware-source.js +5 -4
  26. package/lib/api/cloud-assembly/private/exec.js +5 -4
  27. package/lib/api/cloud-assembly/private/prepare-source.d.ts +50 -40
  28. package/lib/api/cloud-assembly/private/prepare-source.js +117 -97
  29. package/lib/api/cloud-assembly/private/source-builder.d.ts +0 -6
  30. package/lib/api/cloud-assembly/private/source-builder.js +14 -13
  31. package/lib/api/cloud-assembly/private/stack-assembly.d.ts +3 -3
  32. package/lib/api/cloud-assembly/private/stack-assembly.js +12 -12
  33. package/lib/api/shared-private.d.ts +4 -0
  34. package/lib/api/shared-private.js +11306 -52
  35. package/lib/api/shared-private.js.map +4 -4
  36. package/lib/api/shared-public.d.ts +259 -1104
  37. package/lib/api/shared-public.js +38 -61
  38. package/lib/api/shared-public.js.map +4 -4
  39. package/lib/index.d.ts +1 -0
  40. package/lib/index.js +3 -1
  41. package/lib/index_bg.wasm +0 -0
  42. package/lib/private/dispose-polyfill.d.ts +1 -0
  43. package/lib/private/dispose-polyfill.js +20 -0
  44. package/lib/private/util.js +35 -14
  45. package/lib/private/util.js.map +4 -4
  46. package/lib/toolkit/index.d.ts +2 -1
  47. package/lib/toolkit/index.js +3 -2
  48. package/lib/toolkit/non-interactive-io-host.d.ts +80 -0
  49. package/lib/toolkit/non-interactive-io-host.js +129 -0
  50. package/lib/toolkit/private/index.d.ts +2 -3
  51. package/lib/toolkit/private/index.js +4 -4
  52. package/lib/toolkit/toolkit.d.ts +44 -24
  53. package/lib/toolkit/toolkit.js +191 -93
  54. package/lib/toolkit/types.d.ts +163 -0
  55. package/lib/toolkit/types.js +3 -0
  56. package/lib/util/promises.d.ts +12 -0
  57. package/lib/util/promises.js +17 -0
  58. package/lib/util/shell-env.d.ts +10 -0
  59. package/lib/util/shell-env.js +19 -0
  60. package/package.json +24 -21
  61. package/tsconfig.dts.json +9 -0
  62. package/lib/api/aws-cdk.d.ts +0 -20
  63. package/lib/api/aws-cdk.js +0 -10917
  64. package/lib/api/aws-cdk.js.map +0 -7
@@ -1,7 +1,8 @@
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';
5
+ import type { DiffOptions } from '../actions/diff';
5
6
  import { type ListOptions } from '../actions/list';
6
7
  import { type RollbackOptions } from '../actions/rollback';
7
8
  import { type SynthOptions } from '../actions/synth';
@@ -15,13 +16,13 @@ export interface ToolkitOptions {
15
16
  /**
16
17
  * The IoHost implementation, handling the inline interactions between the Toolkit and an integration.
17
18
  */
18
- ioHost?: IIoHost;
19
+ readonly ioHost?: IIoHost;
19
20
  /**
20
21
  * Allow emojis in messages sent to the IoHost.
21
22
  *
22
23
  * @default true
23
24
  */
24
- emojis?: boolean;
25
+ readonly emojis?: boolean;
25
26
  /**
26
27
  * Whether to allow ANSI colors and formatting in IoHost messages.
27
28
  * Setting this value to `false` enforces that no color or style shows up
@@ -30,28 +31,28 @@ export interface ToolkitOptions {
30
31
  *
31
32
  * @default - detects color from the TTY status of the IoHost
32
33
  */
33
- color?: boolean;
34
+ readonly color?: boolean;
34
35
  /**
35
36
  * Configuration options for the SDK.
36
37
  */
37
- sdkConfig?: SdkConfig;
38
+ readonly sdkConfig?: SdkConfig;
38
39
  /**
39
40
  * Name of the toolkit stack to be used.
40
41
  *
41
42
  * @default "CDKToolkit"
42
43
  */
43
- toolkitStackName?: string;
44
+ readonly toolkitStackName?: string;
44
45
  /**
45
46
  * Fail Cloud Assemblies
46
47
  *
47
48
  * @default "error"
48
49
  */
49
- assemblyFailureAt?: 'error' | 'warn' | 'none';
50
+ readonly assemblyFailureAt?: 'error' | 'warn' | 'none';
50
51
  }
51
52
  /**
52
53
  * The AWS CDK Programmatic Toolkit
53
54
  */
54
- export declare class Toolkit extends CloudAssemblySourceBuilder implements AsyncDisposable {
55
+ export declare class Toolkit extends CloudAssemblySourceBuilder {
55
56
  private readonly props;
56
57
  /**
57
58
  * The toolkit stack name used for bootstrapping resources.
@@ -61,18 +62,11 @@ export declare class Toolkit extends CloudAssemblySourceBuilder implements Async
61
62
  * The IoHost of this Toolkit
62
63
  */
63
64
  readonly ioHost: IIoHost;
64
- private _sdkProvider?;
65
- constructor(props?: ToolkitOptions);
66
- dispose(): Promise<void>;
67
- [Symbol.asyncDispose](): Promise<void>;
68
65
  /**
69
- * Access to the AWS SDK
66
+ * Cache of the internal SDK Provider instance
70
67
  */
71
- private sdkProvider;
72
- /**
73
- * Helper to provide the CloudAssemblySourceBuilder with required toolkit services
74
- */
75
- protected sourceBuilderServices(): Promise<ToolkitServices>;
68
+ private sdkProviderCache?;
69
+ constructor(props?: ToolkitOptions);
76
70
  /**
77
71
  * Bootstrap Action
78
72
  */
@@ -81,6 +75,10 @@ export declare class Toolkit extends CloudAssemblySourceBuilder implements Async
81
75
  * Synth Action
82
76
  */
83
77
  synth(cx: ICloudAssemblySource, options?: SynthOptions): Promise<ICloudAssemblySource>;
78
+ /**
79
+ * Diff Action
80
+ */
81
+ diff(cx: ICloudAssemblySource, options: DiffOptions): Promise<void>;
84
82
  /**
85
83
  * List Action
86
84
  *
@@ -92,7 +90,7 @@ export declare class Toolkit extends CloudAssemblySourceBuilder implements Async
92
90
  *
93
91
  * Deploys the selected stacks into an AWS account
94
92
  */
95
- deploy(cx: ICloudAssemblySource, options?: DeployOptions): Promise<void>;
93
+ deploy(cx: ICloudAssemblySource, options?: DeployOptions): Promise<DeployResult>;
96
94
  /**
97
95
  * Helper to allow deploy being called as part of the watch action.
98
96
  */
@@ -100,16 +98,18 @@ export declare class Toolkit extends CloudAssemblySourceBuilder implements Async
100
98
  /**
101
99
  * Watch Action
102
100
  *
103
- * Continuously observe project files and deploy the selected stacks automatically when changes are detected.
104
- * 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.
105
105
  */
106
- watch(cx: ICloudAssemblySource, options: WatchOptions): Promise<void>;
106
+ watch(cx: ICloudAssemblySource, options: WatchOptions): Promise<IWatcher>;
107
107
  /**
108
108
  * Rollback Action
109
109
  *
110
110
  * Rolls back the selected stacks.
111
111
  */
112
- rollback(cx: ICloudAssemblySource, options: RollbackOptions): Promise<void>;
112
+ rollback(cx: ICloudAssemblySource, options: RollbackOptions): Promise<RollbackResult>;
113
113
  /**
114
114
  * Helper to allow rollback being called as part of the deploy or watch action.
115
115
  */
@@ -119,7 +119,7 @@ export declare class Toolkit extends CloudAssemblySourceBuilder implements Async
119
119
  *
120
120
  * Destroys the selected Stacks.
121
121
  */
122
- destroy(cx: ICloudAssemblySource, options: DestroyOptions): Promise<void>;
122
+ destroy(cx: ICloudAssemblySource, options: DestroyOptions): Promise<DestroyResult>;
123
123
  /**
124
124
  * Helper to allow destroy being called as part of the deploy action.
125
125
  */
@@ -134,3 +134,23 @@ export declare class Toolkit extends CloudAssemblySourceBuilder implements Async
134
134
  private deploymentsForAction;
135
135
  private invokeDeployFromWatch;
136
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
+ }