Skip to content

Commit 05e85cc

Browse files
committed
Fix bug w/ where I conflated endpoint and function options.
1 parent 029b878 commit 05e85cc

File tree

4 files changed

+19
-28
lines changed

4 files changed

+19
-28
lines changed

src/common/options.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
// SOFTWARE.
22+
import { ManifestEndpoint } from "../runtime/manifest";
2223

2324
/**
2425
* Special configuration type to reset configuration to platform default.
@@ -47,3 +48,16 @@ export const RESET_VALUE = ResetValue.getInstance();
4748
export type ResettableKeys<T> = Required<{
4849
[K in keyof T as [ResetValue] extends [T[K]] ? K : never]: null;
4950
}>;
51+
52+
/**
53+
* @internal
54+
*/
55+
export const RESETTABLE_OPTIONS: ResettableKeys<ManifestEndpoint> = {
56+
availableMemoryMb: null,
57+
timeoutSeconds: null,
58+
minInstances: null,
59+
maxInstances: null,
60+
ingressSettings: null,
61+
concurrency: null,
62+
serviceAccountEmail: null,
63+
};

src/runtime/manifest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ export interface ManifestEndpoint {
3838
timeoutSeconds?: number | Expression<number> | ResetValue;
3939
vpc?: {
4040
connector: string | Expression<string> | ResetValue;
41-
egressSettings?: string;
41+
egressSettings?: string | Expression<string> | ResetValue;
4242
};
4343
ingressSettings?: string | ResetValue;
44-
serviceAccountEmail?: string;
44+
serviceAccountEmail?: string | ResetValue;
4545
cpu?: number | "gcf_gen1";
4646
labels?: Record<string, string>;
4747
environmentVariables?: Record<string, string>;

src/v1/cloud-functions.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
export { Request, Response };
3131
import { convertIfPresent, copyIfPresent } from "../common/encoding";
3232
import { ManifestEndpoint, ManifestRequiredAPI } from "../runtime/manifest";
33-
import { ResettableKeys, ResetValue } from "../common/options";
33+
import { RESETTABLE_OPTIONS, ResetValue } from "../common/options";
3434

3535
export { Change } from "../common/change";
3636

@@ -480,17 +480,6 @@ function _detectAuthType(event: Event) {
480480
return "UNAUTHENTICATED";
481481
}
482482

483-
const RESETTABLE_OPTIONS: ResettableKeys<DeploymentOptions> = {
484-
ingressSettings: null,
485-
maxInstances: null,
486-
memory: null,
487-
minInstances: null,
488-
serviceAccount: null,
489-
timeoutSeconds: null,
490-
vpcConnector: null,
491-
vpcConnectorEgressSettings: null,
492-
};
493-
494483
/** @internal */
495484
export function optionsToEndpoint(options: DeploymentOptions): ManifestEndpoint {
496485
const endpoint: ManifestEndpoint = {};

src/v2/options.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727

2828
import { convertIfPresent, copyIfPresent } from "../common/encoding";
29-
import { RESET_VALUE, ResettableKeys, ResetValue } from "../common/options";
29+
import { RESET_VALUE, RESETTABLE_OPTIONS, ResetValue } from "../common/options";
3030
import { ManifestEndpoint } from "../runtime/manifest";
3131
import { declaredParams, Expression } from "../params";
3232
import { ParamSpec } from "../params/types";
@@ -250,22 +250,10 @@ export interface EventHandlerOptions extends Omit<GlobalOptions, "enforceAppChec
250250
channel?: string;
251251
}
252252

253-
const RESETTABLE_CONFIGS: ResettableKeys<GlobalOptions> = {
254-
memory: null,
255-
timeoutSeconds: null,
256-
minInstances: null,
257-
maxInstances: null,
258-
ingressSettings: null,
259-
vpcConnector: null,
260-
vpcConnectorEgressSettings: null,
261-
serviceAccount: null,
262-
concurrency: null,
263-
};
264-
265253
function initEndpoint(opts: GlobalOptions | EventHandlerOptions | HttpsOptions): ManifestEndpoint {
266254
const endpoint: ManifestEndpoint = {};
267255
if (!opts.preserveExternalChanges) {
268-
for (const k of Object.keys(RESETTABLE_CONFIGS)) {
256+
for (const k of Object.keys(RESETTABLE_OPTIONS)) {
269257
endpoint[k] = RESET_VALUE;
270258
}
271259
}

0 commit comments

Comments
 (0)