sst 2.18.2 → 2.18.3
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/constructs/App.d.ts +1 -0
- package/constructs/App.js +45 -35
- package/package.json +1 -1
package/constructs/App.d.ts
CHANGED
|
@@ -160,6 +160,7 @@ export declare class App extends CDKApp {
|
|
|
160
160
|
private removeGovCloudUnsupportedResourceProperties;
|
|
161
161
|
private ensureUniqueConstructIds;
|
|
162
162
|
private codegenTypes;
|
|
163
|
+
private foreachConstruct;
|
|
163
164
|
stack<T extends FunctionalStack<any>>(fn: T, props?: StackProps & {
|
|
164
165
|
id?: string;
|
|
165
166
|
}): ReturnType<T> extends Promise<any> ? Promise<void> : App;
|
package/constructs/App.js
CHANGED
|
@@ -427,43 +427,53 @@ export class App extends CDKApp {
|
|
|
427
427
|
` }`,
|
|
428
428
|
`}`,
|
|
429
429
|
].join("\n"));
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
430
|
+
this.foreachConstruct((c) => {
|
|
431
|
+
if (!isSSTConstruct(c)) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
if (c instanceof Function && c._doNotAllowOthersToBind) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
const binding = bindType(c);
|
|
438
|
+
if (!binding) {
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
const className = c.constructor.name;
|
|
442
|
+
const id = c.id;
|
|
443
|
+
// Case 1: variable does not have properties, ie. Secrets and Parameters
|
|
444
|
+
fs.appendFileSync(`${typesPath}/index.ts`, (binding.variables[0] === "."
|
|
445
|
+
? [
|
|
446
|
+
`import "sst/node/${binding.clientPackage}";`,
|
|
447
|
+
`declare module "sst/node/${binding.clientPackage}" {`,
|
|
448
|
+
` export interface ${className}Resources {`,
|
|
449
|
+
` "${id}": string;`,
|
|
450
|
+
` }`,
|
|
451
|
+
`}`,
|
|
452
|
+
]
|
|
453
|
+
: [
|
|
454
|
+
`import "sst/node/${binding.clientPackage}";`,
|
|
455
|
+
`declare module "sst/node/${binding.clientPackage}" {`,
|
|
456
|
+
` export interface ${className}Resources {`,
|
|
457
|
+
` "${id}": {`,
|
|
458
|
+
...binding.variables.map((p) => ` ${p}: string;`),
|
|
459
|
+
` }`,
|
|
460
|
+
` }`,
|
|
461
|
+
`}`,
|
|
462
|
+
]).join("\n"));
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
foreachConstruct(fn) {
|
|
466
|
+
const loop = (parent) => {
|
|
467
|
+
for (const child of parent.node.children) {
|
|
468
|
+
fn(child);
|
|
469
|
+
loop(child);
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
for (const child of this.node.children) {
|
|
473
|
+
if (child instanceof Stack) {
|
|
474
|
+
loop(child);
|
|
464
475
|
}
|
|
465
476
|
}
|
|
466
|
-
Aspects.of(this).add(new CodegenTypes());
|
|
467
477
|
}
|
|
468
478
|
// Functional Stack
|
|
469
479
|
// This is a magical global to avoid having to pass app everywhere.
|