@terraforge/core 0.0.4 → 0.0.6

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/dist/index.d.ts CHANGED
@@ -1,348 +1,420 @@
1
+ import { UUID } from 'node:crypto';
2
+ import { AwsCredentialIdentity, AwsCredentialIdentityProvider } from '@aws-sdk/types';
3
+ import { S3Client } from '@aws-sdk/client-s3';
4
+ import { DynamoDB } from '@aws-sdk/client-dynamodb';
5
+
1
6
  declare class Future<T = unknown> {
2
- protected callback: (resolve: (data: T) => void, reject: (error: unknown) => void) => void;
3
- protected listeners;
4
- protected status: 0 | 1 | 2 | 3;
5
- protected data?: T;
6
- protected error?: unknown;
7
- constructor(callback: (resolve: (data: T) => void, reject: (error: unknown) => void) => void);
8
- get [Symbol.toStringTag]();
9
- pipe<N>(cb: (value: T) => N);
10
- then(resolve: (data: T) => void, reject?: (error: unknown) => void);
7
+ protected callback: (resolve: (data: T) => void, reject: (error: unknown) => void) => void;
8
+ protected listeners: Set<{
9
+ resolve: (data: T) => void;
10
+ reject?: (error: unknown) => void;
11
+ }>;
12
+ protected status: 0 | 1 | 2 | 3;
13
+ protected data?: T;
14
+ protected error?: unknown;
15
+ constructor(callback: (resolve: (data: T) => void, reject: (error: unknown) => void) => void);
16
+ get [Symbol.toStringTag](): string;
17
+ pipe<N>(cb: (value: T) => N): Future<Awaited<N>>;
18
+ then(resolve: (data: T) => void, reject?: (error: unknown) => void): void;
11
19
  }
20
+
12
21
  type Input<T = unknown> = T | Output<T> | Future<T> | Promise<T>;
13
22
  type OptionalInput<T = unknown> = Input<T> | Input<T | undefined> | Input<undefined>;
14
- declare const findInputDeps: unknown;
23
+ type UnwrapInputArray<T extends Input[]> = {
24
+ [K in keyof T]: UnwrapInput<T[K]>;
25
+ };
26
+ type UnwrapInput<T> = T extends Input<infer V> ? V : T;
27
+ declare const findInputDeps: (props: unknown) => Meta[];
15
28
  declare const resolveInputs: <T>(inputs: T) => Promise<T>;
29
+
16
30
  type OptionalOutput<T = unknown> = Output<T | undefined>;
17
31
  declare class Output<T = unknown> extends Future<T> {
18
- readonly dependencies: Set<Meta>;
19
- constructor(dependencies: Set<Meta>, callback: (resolve: (data: T) => void, reject: (error: unknown) => void) => void);
20
- pipe<N>(cb: (value: T) => N);
32
+ readonly dependencies: Set<Meta>;
33
+ constructor(dependencies: Set<Meta>, callback: (resolve: (data: T) => void, reject: (error: unknown) => void) => void);
34
+ pipe<N>(cb: (value: T) => N): Output<Awaited<N>>;
21
35
  }
22
- declare const deferredOutput: unknown;
23
- declare const output: unknown;
36
+ declare const deferredOutput: <T>(cb: (resolve: (data: T) => void) => void) => Output<T>;
37
+ declare const output: <T>(value: T) => Output<T>;
38
+ declare const combine: <T extends Input[], R = UnwrapInputArray<T>>(...inputs: T) => Output<R>;
39
+ declare const resolve: <T extends [Input, ...Input[]], R>(inputs: T, transformer: (...inputs: UnwrapInputArray<T>) => R) => Output<Awaited<R>>;
40
+ declare const interpolate: (literals: TemplateStringsArray, ...placeholders: Input<any>[]) => Output<string>;
41
+
24
42
  type URN = `urn:${string}`;
25
- declare const nodeMetaSymbol: unknown;
26
- type Node<
27
- T extends Tag = Tag,
28
- I extends State = State,
29
- O extends State = any,
30
- C extends Config = Config
31
- > = {
32
- readonly [nodeMetaSymbol]: Meta<T, I, O, C>;
33
- readonly urn: URN;
43
+
44
+ declare const nodeMetaSymbol: unique symbol;
45
+ type Node<T extends Tag = Tag, I extends State = State, O extends State = State, C extends Config = Config> = {
46
+ readonly [nodeMetaSymbol]: Meta<T, I, O, C>;
47
+ readonly urn: URN;
34
48
  } & O;
35
49
  declare const isNode: (obj: object) => obj is {
36
- [nodeMetaSymbol]: Meta;
50
+ [nodeMetaSymbol]: Meta;
37
51
  };
38
52
  declare function getMeta(node: Resource): ResourceMeta;
39
53
  declare function getMeta(node: DataSource): DataSourceMeta;
40
54
  declare function getMeta(node: Node): Meta;
41
55
  declare const isResource: (obj: object) => obj is Resource;
42
56
  declare const isDataSource: (obj: object) => obj is DataSource;
57
+
43
58
  type ResourceConfig = Config & {
44
- /** Import an existing resource instead of creating a new resource. */
45
- import?: string;
46
- /** If true the resource will be retained in the backing cloud provider during a Pulumi delete operation. */
47
- retainOnDelete?: boolean;
48
- /** Override the default create-after-delete behavior when replacing a resource. */
49
- /** If set, the provider’s Delete method will not be called for this resource if the specified resource is being deleted as well. */
50
- /** Declare that changes to certain properties should be treated as forcing a replacement. */
51
- replaceOnChanges?: string[];
59
+ /** Import an existing resource instead of creating a new resource. */
60
+ import?: string;
61
+ /** If true the resource will be retained in the backing cloud provider during a Pulumi delete operation. */
62
+ retainOnDelete?: boolean;
63
+ /** Override the default create-after-delete behavior when replacing a resource. */
64
+ /** If set, the provider’s Delete method will not be called for this resource if the specified resource is being deleted as well. */
65
+ /** Declare that changes to certain properties should be treated as forcing a replacement. */
66
+ replaceOnChanges?: string[];
52
67
  };
53
- type ResourceMeta<
54
- I extends State = State,
55
- O extends State = State
56
- > = Meta<"resource", I, O, ResourceConfig>;
57
- type Resource<
58
- I extends State = State,
59
- O extends State = State
60
- > = O & {
61
- readonly [nodeMetaSymbol]: ResourceMeta<I, O>;
62
- readonly urn: URN;
68
+ type ResourceMeta<I extends State = State, O extends State = State> = Meta<'resource', I, O, ResourceConfig>;
69
+ type Resource<I extends State = State, O extends State = State> = O & {
70
+ readonly [nodeMetaSymbol]: ResourceMeta<I, O>;
71
+ readonly urn: URN;
63
72
  };
64
- type ResourceClass<
65
- I extends State = State,
66
- O extends State = State
67
- > = {
68
- new (parent: Group, id: string, props: I, config?: ResourceConfig): Resource<I, O>;
69
- get(parent: Group, id: string, physicalId: string): DataSource<I, O>;
73
+ type ResourceClass<I extends State = State, O extends State = State> = {
74
+ new (parent: Group, id: string, props: I, config?: ResourceConfig): Resource<I, O>;
75
+ get(parent: Group, id: string, physicalId: string): DataSource<I, O>;
70
76
  };
77
+
71
78
  declare class Stack extends Group {
72
- readonly app: App;
73
- readonly dependencies;
74
- constructor(app: App, name: string);
75
- dependsOn(...stacks: Stack[]);
79
+ readonly app: App;
80
+ readonly dependencies: Set<Stack>;
81
+ constructor(app: App, name: string);
82
+ dependsOn(...stacks: Stack[]): this;
76
83
  }
77
- type Tag = "resource" | "data";
84
+
85
+ type Tag = 'resource' | 'data';
78
86
  type State = Record<string, unknown>;
79
87
  type Config = {
80
- /** Specify additional explicit dependencies in addition to the ones in the dependency graph. */
81
- dependsOn?: Resource<any, any>[];
82
- /** Pass an ID of an explicitly configured provider, instead of using the default provider. */
83
- provider?: string;
88
+ /** Specify additional explicit dependencies in addition to the ones in the dependency graph. */
89
+ dependsOn?: Resource<any, any>[];
90
+ /** Pass an ID of an explicitly configured provider, instead of using the default provider. */
91
+ provider?: string;
84
92
  };
85
- type Meta<
86
- T extends Tag = Tag,
87
- I extends State = State,
88
- O extends State = State,
89
- C extends Config = Config
90
- > = {
91
- readonly tag: T;
92
- readonly urn: URN;
93
- readonly logicalId: string;
94
- readonly type: string;
95
- readonly stack: Stack;
96
- readonly provider: string;
97
- readonly input: I;
98
- readonly config?: C;
99
- readonly dependencies: Set<URN>;
100
- readonly resolve: (data: O) => void;
101
- readonly output: <O>(cb: (data: State) => O) => Output<O>;
93
+ type Meta<T extends Tag = Tag, I extends State = State, O extends State = State, C extends Config = Config> = {
94
+ readonly tag: T;
95
+ readonly urn: URN;
96
+ readonly logicalId: string;
97
+ readonly type: string;
98
+ readonly stack: Stack;
99
+ readonly provider: string;
100
+ readonly input: I;
101
+ readonly config?: C;
102
+ readonly dependencies: Set<URN>;
103
+ readonly resolve: (data: O) => void;
104
+ readonly output: <O>(cb: (data: State) => O) => Output<O>;
102
105
  };
103
- declare const createMeta: <
104
- T extends Tag = Tag,
105
- I extends State = State,
106
- O extends State = State,
107
- C extends Config = Config
108
- >(tag: T, provider: string, parent: Group, type: string, logicalId: string, input: I, config?: C) => Meta<T, I, O, C>;
109
- type DataSourceMeta<
110
- I extends State = State,
111
- O extends State = State
112
- > = Meta<"data", I, O>;
113
- type DataSource<
114
- I extends State = State,
115
- O extends State = State
116
- > = {
117
- readonly [nodeMetaSymbol]: DataSourceMeta<I, O>;
106
+ declare const createMeta: <T extends Tag = Tag, I extends State = State, O extends State = State, C extends Config = Config>(tag: T, provider: string, parent: Group, type: string, logicalId: string, input: I, config?: C) => Meta<T, I, O, C>;
107
+
108
+ type DataSourceMeta<I extends State = State, O extends State = State> = Meta<'data', I, O>;
109
+ type DataSource<I extends State = State, O extends State = State> = {
110
+ readonly [nodeMetaSymbol]: DataSourceMeta<I, O>;
111
+ readonly urn: URN;
118
112
  } & O;
119
- type DataSourceFunction<
120
- I extends State = State,
121
- O extends State = State
122
- > = (parent: Group, id: string, input: I, config?: Config) => DataSource<I, O>;
113
+ type DataSourceFunction<I extends State = State, O extends State = State> = (parent: Group, id: string, input: I, config?: Config) => DataSource<I, O>;
114
+
123
115
  declare class Group {
124
- readonly parent: Group | undefined;
125
- readonly type: string;
126
- readonly name: string;
127
- protected children: Array<Group | Node>;
128
- constructor(parent: Group | undefined, type: string, name: string);
129
- get urn(): URN;
130
- protected addChild(child: Group | Node);
131
- add(...children: Array<Group | Node>);
132
- get nodes(): Node[];
133
- get resources(): Resource[];
134
- get dataSources(): DataSource[];
116
+ readonly parent: Group | undefined;
117
+ readonly type: string;
118
+ readonly name: string;
119
+ protected children: Array<Group | Node>;
120
+ constructor(parent: Group | undefined, type: string, name: string);
121
+ get urn(): URN;
122
+ protected addChild(child: Group | Node): void;
123
+ add(...children: Array<Group | Node>): void;
124
+ get nodes(): Node[];
125
+ get resources(): Resource[];
126
+ get dataSources(): DataSource[];
135
127
  }
128
+
136
129
  declare class App extends Group {
137
- readonly name: string;
138
- constructor(name: string);
139
- get stacks(): Stack[];
130
+ readonly name: string;
131
+ constructor(name: string);
132
+ get stacks(): Stack[];
140
133
  }
141
- declare const enableDebug: unknown;
142
- declare const createDebugger: (group: string) => unknown;
143
- import { UUID as UUID2 } from "node:crypto";
134
+
135
+ declare const enableDebug: () => void;
136
+ declare const createDebugger: (group: string) => (...args: unknown[]) => void;
137
+
144
138
  interface LockBackend {
145
- insecureReleaseLock(urn: URN): Promise<void>;
146
- locked(urn: URN): Promise<boolean>;
147
- lock(urn: URN): Promise<() => Promise<void>>;
139
+ insecureReleaseLock(urn: URN): Promise<void>;
140
+ locked(urn: URN): Promise<boolean>;
141
+ lock(urn: URN): Promise<() => Promise<void>>;
148
142
  }
149
- import { UUID } from "node:crypto";
143
+
150
144
  type AppState = {
151
- name: string;
152
- version?: number;
153
- idempotentToken?: UUID;
154
- stacks: Record<URN, StackState>;
145
+ name: string;
146
+ version?: number;
147
+ idempotentToken?: UUID;
148
+ stacks: Record<URN, StackState>;
155
149
  };
156
150
  type StackState = {
157
- name: string;
158
- nodes: Record<URN, NodeState>;
151
+ name: string;
152
+ nodes: Record<URN, NodeState>;
159
153
  };
160
154
  type NodeState = {
161
- tag: "resource" | "data";
162
- type: string;
163
- version?: number;
164
- provider: string;
165
- input: State;
166
- output: State;
167
- dependencies: URN[];
168
- lifecycle?: {
169
- retainOnDelete?: boolean;
170
- deleteAfterCreate?: boolean;
171
- };
155
+ tag: 'resource' | 'data';
156
+ type: string;
157
+ version?: number;
158
+ provider: string;
159
+ input: State;
160
+ output: State;
161
+ dependencies: URN[];
162
+ lifecycle?: {
163
+ retainOnDelete?: boolean;
164
+ deleteAfterCreate?: boolean;
165
+ };
172
166
  };
167
+
173
168
  type StateBackend = {
174
- get(urn: URN): Promise<AppState | undefined>;
175
- update(urn: URN, state: AppState): Promise<void>;
176
- delete(urn: URN): Promise<void>;
169
+ get(urn: URN): Promise<AppState | undefined>;
170
+ update(urn: URN, state: AppState): Promise<void>;
171
+ delete(urn: URN): Promise<void>;
177
172
  };
173
+
178
174
  type CreateProps<T = State> = {
179
- type: string;
180
- state: T;
181
- idempotantToken?: string;
175
+ type: string;
176
+ state: T;
177
+ idempotantToken?: string;
182
178
  };
183
179
  type UpdateProps<T = State> = {
184
- type: string;
185
- priorState: T;
186
- proposedState: T;
187
- idempotantToken?: string;
180
+ type: string;
181
+ priorState: T;
182
+ proposedState: T;
183
+ idempotantToken?: string;
188
184
  };
189
185
  type DeleteProps<T = State> = {
190
- type: string;
191
- state: T;
192
- idempotantToken?: string;
186
+ type: string;
187
+ state: T;
188
+ idempotantToken?: string;
189
+ };
190
+ type PlanProps<T = State> = {
191
+ type: string;
192
+ priorState: T;
193
+ proposedState: T;
193
194
  };
194
195
  type GetProps<T = State> = {
195
- type: string;
196
- state: T;
196
+ type: string;
197
+ state: T;
197
198
  };
198
199
  type GetDataProps<T = State> = {
199
- type: string;
200
- state: T;
200
+ type: string;
201
+ state: T;
201
202
  };
202
203
  interface Provider {
203
- ownResource(id: string): boolean;
204
- getResource(props: GetProps): Promise<{
205
- version: number;
206
- state: State;
207
- }>;
208
- createResource(props: CreateProps): Promise<{
209
- version: number;
210
- state: State;
211
- }>;
212
- updateResource(props: UpdateProps): Promise<{
213
- version: number;
214
- state: State;
215
- }>;
216
- deleteResource(props: DeleteProps): Promise<void>;
217
- getData?(props: GetDataProps): Promise<{
218
- state: State;
219
- }>;
220
- destroy?(): Promise<void>;
204
+ ownResource(id: string): boolean;
205
+ getResource(props: GetProps): Promise<{
206
+ version: number;
207
+ state: State;
208
+ }>;
209
+ createResource(props: CreateProps): Promise<{
210
+ version: number;
211
+ state: State;
212
+ }>;
213
+ updateResource(props: UpdateProps): Promise<{
214
+ version: number;
215
+ state: State;
216
+ }>;
217
+ deleteResource(props: DeleteProps): Promise<void>;
218
+ planResourceChange?(props: PlanProps): Promise<{
219
+ version: number;
220
+ state: State;
221
+ requiresReplacement: boolean;
222
+ }>;
223
+ getData?(props: GetDataProps): Promise<{
224
+ state: State;
225
+ }>;
226
+ destroy?(): Promise<void>;
221
227
  }
228
+
229
+ type ResourceEvent = {
230
+ urn: URN;
231
+ type: string;
232
+ };
233
+ type BeforeResourceCreateEvent = ResourceEvent & {
234
+ resource: Resource;
235
+ newInput: State;
236
+ };
237
+ type AfterResourceCreateEvent = ResourceEvent & {
238
+ resource: Resource;
239
+ newInput: State;
240
+ newOutput: State;
241
+ };
242
+ type BeforeResourceUpdateEvent = ResourceEvent & {
243
+ resource: Resource;
244
+ oldInput: State;
245
+ newInput: State;
246
+ oldOutput: State;
247
+ };
248
+ type AfterResourceUpdateEvent = ResourceEvent & {
249
+ resource: Resource;
250
+ oldInput: State;
251
+ newInput: State;
252
+ oldOutput: State;
253
+ newOutput: State;
254
+ };
255
+ type BeforeResourceDeleteEvent = ResourceEvent & {
256
+ oldInput: State;
257
+ oldOutput: State;
258
+ };
259
+ type AfterResourceDeleteEvent = ResourceEvent & {
260
+ oldInput: State;
261
+ oldOutput: State;
262
+ };
263
+ type Hooks = {
264
+ beforeResourceCreate?: (event: BeforeResourceCreateEvent) => Promise<void> | void;
265
+ beforeResourceUpdate?: (event: BeforeResourceUpdateEvent) => Promise<void> | void;
266
+ beforeResourceDelete?: (event: BeforeResourceDeleteEvent) => Promise<void> | void;
267
+ afterResourceCreate?: (event: AfterResourceCreateEvent) => Promise<void> | void;
268
+ afterResourceUpdate?: (event: AfterResourceUpdateEvent) => Promise<void> | void;
269
+ afterResourceDelete?: (event: AfterResourceDeleteEvent) => Promise<void> | void;
270
+ };
271
+
222
272
  type ProcedureOptions = {
223
- filters?: string[];
224
- idempotentToken?: UUID2;
273
+ filters?: string[];
274
+ idempotentToken?: UUID;
225
275
  };
226
276
  type WorkSpaceOptions = {
227
- providers: Provider[];
228
- concurrency?: number;
229
- backend: {
230
- state: StateBackend;
231
- lock: LockBackend;
232
- };
277
+ providers: Provider[];
278
+ concurrency?: number;
279
+ backend: {
280
+ state: StateBackend;
281
+ lock: LockBackend;
282
+ };
283
+ hooks?: Hooks;
233
284
  };
234
285
  declare class WorkSpace {
235
- protected props: WorkSpaceOptions;
236
- constructor(props: WorkSpaceOptions);
237
- /**
238
- * Deploy the entire app or use the filter option to deploy specific stacks inside your app.
239
- */
240
- deploy(app: App, options?: ProcedureOptions);
241
- /**
242
- * Delete the entire app or use the filter option to delete specific stacks inside your app.
243
- */
244
- delete(app: App, options?: ProcedureOptions);
245
- /**
246
- * Hydrate the outputs of the resources & data-sources inside your app.
247
- */
248
- hydrate(app: App);
249
- /**
250
- * Refresh the state of the resources & data-sources inside your app.
251
- */
252
- refresh(app: App);
253
- protected destroyProviders();
286
+ protected props: WorkSpaceOptions;
287
+ constructor(props: WorkSpaceOptions);
288
+ /**
289
+ * Deploy the entire app or use the filter option to deploy specific stacks inside your app.
290
+ */
291
+ deploy(app: App, options?: ProcedureOptions): Promise<void>;
292
+ /**
293
+ * Delete the entire app or use the filter option to delete specific stacks inside your app.
294
+ */
295
+ delete(app: App, options?: ProcedureOptions): Promise<void>;
296
+ /**
297
+ * Hydrate the outputs of the resources & data-sources inside your app.
298
+ */
299
+ hydrate(app: App): Promise<void>;
300
+ /**
301
+ * Refresh the state of the resources & data-sources inside your app.
302
+ */
303
+ refresh(app: App): Promise<void>;
304
+ protected destroyProviders(): Promise<void>;
254
305
  }
255
- type ResourceOperation = "create" | "update" | "delete" | "replace" | "import" | "resolve" | "get";
306
+
307
+ type ResourceOperation = 'create' | 'update' | 'delete' | 'replace' | 'import' | 'resolve' | 'get';
308
+
256
309
  declare class ResourceError extends Error {
257
- readonly urn: URN;
258
- readonly type: string;
259
- readonly operation: ResourceOperation;
260
- static wrap(urn: URN, type: string, operation: ResourceOperation, error: unknown);
261
- constructor(urn: URN, type: string, operation: ResourceOperation, message: string);
310
+ readonly urn: URN;
311
+ readonly type: string;
312
+ readonly operation: ResourceOperation;
313
+ static wrap(urn: URN, type: string, operation: ResourceOperation, error: unknown): ResourceError;
314
+ constructor(urn: URN, type: string, operation: ResourceOperation, message: string);
262
315
  }
263
316
  declare class AppError extends Error {
264
- readonly app: string;
265
- readonly issues: (ResourceError | Error)[];
266
- constructor(app: string, issues: (ResourceError | Error)[], message: string);
317
+ readonly app: string;
318
+ readonly issues: (ResourceError | Error)[];
319
+ constructor(app: string, issues: (ResourceError | Error)[], message: string);
320
+ }
321
+ declare class ResourceNotFound extends Error {
322
+ }
323
+ declare class ResourceAlreadyExists extends Error {
267
324
  }
268
- declare class ResourceNotFound extends Error {}
269
- declare class ResourceAlreadyExists extends Error {}
325
+
270
326
  declare class MemoryStateBackend implements StateBackend {
271
- protected states;
272
- get(urn: URN);
273
- update(urn: URN, state: AppState);
274
- delete(urn: URN);
275
- clear();
327
+ protected states: Map<`urn:${string}`, AppState>;
328
+ get(urn: URN): Promise<AppState | undefined>;
329
+ update(urn: URN, state: AppState): Promise<void>;
330
+ delete(urn: URN): Promise<void>;
331
+ clear(): void;
276
332
  }
333
+
277
334
  declare class MemoryLockBackend implements LockBackend {
278
- protected locks;
279
- insecureReleaseLock(urn: URN);
280
- locked(urn: URN);
281
- lock(urn: URN);
282
- clear();
335
+ protected locks: Map<`urn:${string}`, number>;
336
+ insecureReleaseLock(urn: URN): Promise<void>;
337
+ locked(urn: URN): Promise<boolean>;
338
+ lock(urn: URN): Promise<() => Promise<void>>;
339
+ clear(): void;
283
340
  }
341
+
284
342
  declare class FileStateBackend implements StateBackend {
285
- private props;
286
- constructor(props: {
287
- dir: string;
288
- });
289
- private stateFile;
290
- private mkdir;
291
- get(urn: URN);
292
- update(urn: URN, state: AppState);
293
- delete(urn: URN);
343
+ private props;
344
+ constructor(props: {
345
+ dir: string;
346
+ });
347
+ private stateFile;
348
+ private mkdir;
349
+ get(urn: URN): Promise<AppState | undefined>;
350
+ update(urn: URN, state: AppState): Promise<void>;
351
+ delete(urn: URN): Promise<void>;
294
352
  }
353
+
295
354
  declare class FileLockBackend implements LockBackend {
296
- private props;
297
- constructor(props: {
298
- dir: string;
299
- });
300
- private lockFile;
301
- private mkdir;
302
- insecureReleaseLock(urn: URN);
303
- locked(urn: URN);
304
- lock(urn: URN);
355
+ private props;
356
+ constructor(props: {
357
+ dir: string;
358
+ });
359
+ private lockFile;
360
+ private mkdir;
361
+ insecureReleaseLock(urn: URN): Promise<void>;
362
+ locked(urn: URN): Promise<boolean>;
363
+ lock(urn: URN): Promise<() => Promise<void>>;
305
364
  }
306
- import { AwsCredentialIdentity, AwsCredentialIdentityProvider } from "@aws-sdk/types";
307
- import { S3Client } from "@aws-sdk/client-s3";
308
- type Props = {
309
- credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider;
310
- region: string;
311
- bucket: string;
365
+
366
+ type Props$1 = {
367
+ credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider;
368
+ region: string;
369
+ bucket: string;
312
370
  };
313
371
  declare class S3StateBackend implements StateBackend {
314
- private props;
315
- protected client: S3Client;
316
- constructor(props: Props);
317
- get(urn: URN);
318
- update(urn: URN, state: AppState);
319
- delete(urn: URN);
372
+ private props;
373
+ protected client: S3Client;
374
+ constructor(props: Props$1);
375
+ get(urn: URN): Promise<any>;
376
+ update(urn: URN, state: AppState): Promise<void>;
377
+ delete(urn: URN): Promise<void>;
320
378
  }
321
- import { DynamoDB } from "@aws-sdk/client-dynamodb";
322
- import { AwsCredentialIdentity as AwsCredentialIdentity2, AwsCredentialIdentityProvider as AwsCredentialIdentityProvider2 } from "@aws-sdk/types";
323
- type Props2 = {
324
- credentials: AwsCredentialIdentity2 | AwsCredentialIdentityProvider2;
325
- region: string;
326
- tableName: string;
379
+
380
+ type Props = {
381
+ credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider;
382
+ region: string;
383
+ tableName: string;
327
384
  };
328
385
  declare class DynamoLockBackend implements LockBackend {
329
- private props;
330
- protected client: DynamoDB;
331
- constructor(props: Props2);
332
- insecureReleaseLock(urn: URN);
333
- locked(urn: URN);
334
- lock(urn: URN);
386
+ private props;
387
+ protected client: DynamoDB;
388
+ constructor(props: Props);
389
+ insecureReleaseLock(urn: URN): Promise<void>;
390
+ locked(urn: URN): Promise<boolean>;
391
+ lock(urn: URN): Promise<() => Promise<void>>;
392
+ }
393
+
394
+ declare const file: (path: string, encoding?: BufferEncoding) => Future<string>;
395
+ declare const hash: (path: string, algo?: string) => Future<string>;
396
+
397
+ declare global {
398
+ var $resolve: typeof resolve;
399
+ var $combine: typeof combine;
400
+ var $interpolate: typeof interpolate;
401
+ var $hash: typeof hash;
402
+ var $file: typeof file;
335
403
  }
336
- declare const createCustomResourceClass: <
337
- I extends State,
338
- O extends State
339
- >(providerId: string, resourceType: string) => ResourceClass<I, O>;
404
+
405
+ declare const createCustomResourceClass: <I extends State, O extends State>(providerId: string, resourceType: string) => ResourceClass<I, O>;
406
+
340
407
  type CustomResourceProvider = Partial<{
341
- getResource?(props: Omit<GetProps, "type">): Promise<State>;
342
- updateResource?(props: Omit<UpdateProps, "type">): Promise<State>;
343
- createResource?(props: Omit<CreateProps, "type">): Promise<State>;
344
- deleteResource?(props: Omit<DeleteProps, "type">): Promise<void>;
345
- getData?(props: Omit<GetDataProps, "type">): Promise<State>;
408
+ getResource?(props: Omit<GetProps, 'type'>): Promise<State>;
409
+ updateResource?(props: Omit<UpdateProps, 'type'>): Promise<State>;
410
+ createResource?(props: Omit<CreateProps, 'type'>): Promise<State>;
411
+ deleteResource?(props: Omit<DeleteProps, 'type'>): Promise<void>;
412
+ getData?(props: Omit<GetDataProps, 'type'>): Promise<State>;
413
+ planResourceChange?(props: Omit<PlanProps, 'type'>): Promise<{
414
+ state: State;
415
+ requiresReplacement: boolean;
416
+ }>;
346
417
  }>;
347
418
  declare const createCustomProvider: (providerId: string, resourceProviders: Record<string, CustomResourceProvider>) => Provider;
348
- export { resolveInputs, output, nodeMetaSymbol, isResource, isNode, isDataSource, getMeta, findInputDeps, enableDebug, deferredOutput, createMeta, createDebugger, createCustomResourceClass, createCustomProvider, WorkSpaceOptions, WorkSpace, UpdateProps, URN, Tag, StateBackend, State, Stack, S3StateBackend, ResourceNotFound, ResourceMeta, ResourceError, ResourceConfig, ResourceClass, ResourceAlreadyExists, Resource, Provider, ProcedureOptions, Output, OptionalOutput, OptionalInput, Node, Meta, MemoryStateBackend, MemoryLockBackend, LockBackend, Input, Group, GetProps, GetDataProps, Future, FileStateBackend, FileLockBackend, DynamoLockBackend, DeleteProps, DataSourceMeta, DataSourceFunction, DataSource, CustomResourceProvider, CreateProps, Config, AppError, App };
419
+
420
+ export { App, AppError, type Config, type CreateProps, type CustomResourceProvider, type DataSource, type DataSourceFunction, type DataSourceMeta, type DeleteProps, DynamoLockBackend, FileLockBackend, FileStateBackend, Future, type GetDataProps, type GetProps, Group, type Input, type LockBackend, MemoryLockBackend, MemoryStateBackend, type Meta, type Node, type OptionalInput, type OptionalOutput, Output, type PlanProps, type ProcedureOptions, type Provider, type Resource, ResourceAlreadyExists, type ResourceClass, type ResourceConfig, ResourceError, type ResourceMeta, ResourceNotFound, S3StateBackend, Stack, type State, type StateBackend, type Tag, type URN, type UpdateProps, WorkSpace, type WorkSpaceOptions, createCustomProvider, createCustomResourceClass, createDebugger, createMeta, deferredOutput, enableDebug, findInputDeps, getMeta, isDataSource, isNode, isResource, nodeMetaSymbol, output, resolveInputs };