New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sdk/nodejs): delegates alias computation to the engine #11206
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
changes: | ||
- type: feat | ||
scope: sdk/nodejs | ||
description: Delegates alias computation to engine for Node SDK |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -518,6 +518,17 @@ export async function monitorSupportsDeletedWith(): Promise<boolean> { | |
return monitorSupportsFeature("deletedWith"); | ||
} | ||
|
||
/** | ||
* monitorSupportsAliasSpecs returns a promise that when resolved tells you if the resource monitor we are | ||
* connected to is able to support alias specs across its RPC interface. When it does, we marshal aliases | ||
* in a special way. | ||
* | ||
* @internal | ||
*/ | ||
export async function monitorSupportsAliasSpecs(): Promise<boolean> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we mark this as We should probably go back and make the other exported ones |
||
return monitorSupportsFeature("aliasSpecs"); | ||
} | ||
|
||
// sxsRandomIdentifier is a module level global that is transfered to process.env. | ||
// the goal is to detect side by side (sxs) pulumi/pulumi situations for inline programs | ||
// and fail fast. See https://github.com/pulumi/pulumi/issues/7333 for details. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1249,14 +1249,13 @@ describe("rpc", () => { | |
return { urn: makeUrn(t, name), id: undefined, props: undefined }; | ||
}, | ||
}, | ||
/** Skipping this test case as it requires limiting the alias multiplication which occurs */ | ||
// "large_alias_lineage_chains": { | ||
// program: path.join(base, "072.large_alias_lineage_chains"), | ||
// expectResourceCount: 1, | ||
// registerResource: (ctx: any, dryrun: boolean, t: string, name: string, res: any, ...args: any) => { | ||
// return { urn: makeUrn(t, name), id: undefined, props: undefined }; | ||
// }, | ||
// } | ||
"large_alias_lineage_chains": { | ||
program: path.join(base, "072.large_alias_lineage_chains"), | ||
expectResourceCount: 3, | ||
registerResource: (ctx: any, dryrun: boolean, t: string, name: string, res: any, ...args: any) => { | ||
return { urn: makeUrn(t, name), id: undefined, props: undefined }; | ||
}, | ||
}, | ||
}; | ||
|
||
for (const casename of Object.keys(cases)) { | ||
|
@@ -1418,7 +1417,7 @@ describe("rpc", () => { | |
// SupportsFeature callback | ||
(call: any, callback: any) => { | ||
const resp = new resproto.SupportsFeatureResponse(); | ||
resp.setHassupport(false); | ||
resp.setHassupport(true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not 100% sure why this was set to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's OK to set it to true. I don't think we have any tests that assume it's false. |
||
callback(undefined, resp); | ||
}, | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a little strange having
Set<Alias>
given thatAlias
is an object type which I believe means object reference equality will be used to compare what's already in theSet<Alias>
.I wonder if rather than keeping this code here, it should move into the
!monitorSupportsStructuredAliases && parent
case above, e.g. something like (I'm writing in GH without compiler help):There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, missed that you'd still need to loop through and do
const aliasVal = await output(alias).promise();
for the non-computed case. I think it's simpler to leave it the way you had it.