-
Notifications
You must be signed in to change notification settings - Fork 212
Add new option to preserveExternalChanges. #1253
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6c08780
Add new option to preserveExternalChanges.
taeold 9659f96
Address minor issues.
taeold 809e699
Fix bug w/ where I conflated endpoint and function options.
taeold 0a138ff
Fix bug where reset keys were based on fn opt not endpoint.
taeold 54621e3
Refactor initializing endpoint to fix bug.
taeold 2f19a6c
Change default endponit cfg for v1.
taeold 39a9cad
Make linter happy.
taeold 39a8842
Move code around.
taeold 331d8a6
Refactor function type.
taeold fb930cd
Fix bug with duplicate calls to initEndpoint.
taeold 65d8fec
Fix bug where v1 endpoints set concurrency opt.
taeold 538953d
Fix tsc error.
taeold a0c19d8
Fix bug w/ resetting vpc settings.
taeold 8c63b28
Add copyright notice.
taeold 15c38b3
Fix broken test. (#1254)
taeold File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const functions = require("firebase-functions"); | ||
const functionsv2 = require("firebase-functions/v2"); | ||
|
||
exports.v1http = functions.https.onRequest((req, resp) => { | ||
resp.status(200).send("PASS"); | ||
}); | ||
|
||
exports.v1httpPreserve = functions | ||
.runWith({ preserveExternalChanges: true }) | ||
.https.onRequest((req, resp) => { | ||
resp.status(200).send("PASS"); | ||
}); | ||
|
||
functionsv2.setGlobalOptions({ preserveExternalChanges: true }); | ||
|
||
exports.v2http = functionsv2.https.onRequest((req, resp) => { | ||
resp.status(200).send("PASS"); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "commonjs-preserve" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// The MIT License (MIT) | ||
// | ||
// Copyright (c) 2022 Firebase | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE ignoreUnusedWarning OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
import { ResettableKeys, ResetValue } from "../../src/common/options"; | ||
import { expectNever, expectType } from "./metaprogramming"; | ||
|
||
describe("ResettableKeys", () => { | ||
it("should pick out keys with a type that includes ResetValue", () => { | ||
type A = { a: number; b: ResetValue; c: number | boolean | ResetValue }; | ||
expectType<keyof ResettableKeys<A>>("b"); | ||
expectType<keyof ResettableKeys<A>>("c"); | ||
}); | ||
|
||
it("should return an empty type if no keys are resettable", () => { | ||
type A = { a: number }; | ||
expectNever<keyof ResettableKeys<A>>(); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// The MIT License (MIT) | ||
// | ||
// Copyright (c) 2022 Firebase | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
import { ManifestEndpoint } from "../src/runtime/manifest"; | ||
import { RESET_VALUE } from "../src/common/options"; | ||
|
||
export const MINIMAL_V2_ENDPOINT: ManifestEndpoint = { | ||
availableMemoryMb: RESET_VALUE, | ||
concurrency: RESET_VALUE, | ||
ingressSettings: RESET_VALUE, | ||
maxInstances: RESET_VALUE, | ||
minInstances: RESET_VALUE, | ||
serviceAccountEmail: RESET_VALUE, | ||
timeoutSeconds: RESET_VALUE, | ||
vpc: RESET_VALUE, | ||
}; | ||
|
||
export const MINIMAL_V1_ENDPOINT: ManifestEndpoint = { | ||
availableMemoryMb: RESET_VALUE, | ||
ingressSettings: RESET_VALUE, | ||
maxInstances: RESET_VALUE, | ||
minInstances: RESET_VALUE, | ||
serviceAccountEmail: RESET_VALUE, | ||
timeoutSeconds: RESET_VALUE, | ||
vpc: RESET_VALUE, | ||
}; | ||
|
||
export const FULL_ENDPOINT: ManifestEndpoint = { | ||
region: ["us-west1"], | ||
availableMemoryMb: 512, | ||
timeoutSeconds: 60, | ||
minInstances: 1, | ||
maxInstances: 3, | ||
concurrency: 20, | ||
vpc: { | ||
connector: "aConnector", | ||
egressSettings: "ALL_TRAFFIC", | ||
}, | ||
serviceAccountEmail: "root@", | ||
ingressSettings: "ALLOW_ALL", | ||
cpu: "gcf_gen1", | ||
labels: { | ||
hello: "world", | ||
}, | ||
secretEnvironmentVariables: [{ key: "MY_SECRET" }], | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Missing copyright notice, maybe we can have the linter add things like this?