Skip to content

Commit ec05deb

Browse files
authored
Add Firebase Data Connect v2 support (#1727)
* Add Firebase Data Connect v2 support * Export dataconnect * Fix export * Rename Extract to VarName, since Extract is a built in type * Include auth context in event payload * Stronger typing for data connect params * Fix formatting and address comments * Apply another suggestion * Add region and fix bug in which event.service, event.connector, event.operation gets populated * Remove locations/... segment * Address comments
1 parent 337b47d commit ec05deb

File tree

8 files changed

+949
-13
lines changed

8 files changed

+949
-13
lines changed

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"./remoteConfig": "./lib/v2/providers/remoteConfig.js",
6363
"./testLab": "./lib/v2/providers/testLab.js",
6464
"./firestore": "./lib/v2/providers/firestore.js",
65+
"./dataconnect": "./lib/v2/providers/dataconnect.js",
6566
"./v2": "./lib/v2/index.js",
6667
"./v2/core": "./lib/v2/core.js",
6768
"./v2/options": "./lib/v2/options.js",
@@ -80,7 +81,8 @@
8081
"./v2/scheduler": "./lib/v2/providers/scheduler.js",
8182
"./v2/remoteConfig": "./lib/v2/providers/remoteConfig.js",
8283
"./v2/testLab": "./lib/v2/providers/testLab.js",
83-
"./v2/firestore": "./lib/v2/providers/firestore.js"
84+
"./v2/firestore": "./lib/v2/providers/firestore.js",
85+
"./v2/dataconnect": "./lib/v2/providers/dataconnect.js"
8486
},
8587
"typesVersions": {
8688
"*": {
@@ -180,6 +182,9 @@
180182
"firestore": [
181183
"./lib/v2/providers/firestore"
182184
],
185+
"dataconnect": [
186+
"./lib/v2/providers/dataconnect"
187+
],
183188
"v2": [
184189
"lib/v2"
185190
],
@@ -239,6 +244,9 @@
239244
],
240245
"v2/firestore": [
241246
"lib/v2/providers/firestore"
247+
],
248+
"v2/dataconnect": [
249+
"lib/v2/providers/dataconnect"
242250
]
243251
}
244252
},

spec/common/metaprogramming.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@
2323
/* eslint-disable @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function */
2424
export function expectType<Type>(value: Type) {}
2525
export function expectNever<Type extends never>() {}
26+
export function expectExtends<Type, Test extends Type>() {}

spec/common/params.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE ignoreUnusedWarning OR OTHER DEALINGS IN THE
2121
// SOFTWARE.
2222

23-
import { Extract, ParamsOf, Split } from "../../src/common/params";
23+
import { VarName, ParamsOf, Split } from "../../src/common/params";
2424
import { expectNever, expectType } from "./metaprogramming";
2525

2626
describe("Params namespace", () => {
@@ -56,21 +56,21 @@ describe("Params namespace", () => {
5656
});
5757
});
5858

59-
describe("Extract", () => {
59+
describe("VarName", () => {
6060
it("extracts nothing from strings without params", () => {
61-
expectNever<Extract<"uid">>();
61+
expectNever<VarName<"uid">>();
6262
});
6363

6464
it("extracts {segment} captures", () => {
65-
expectType<Extract<"{uid}">>("uid");
65+
expectType<VarName<"{uid}">>("uid");
6666
});
6767

6868
it("extracts {segment=*} captures", () => {
69-
expectType<Extract<"{uid=*}">>("uid");
69+
expectType<VarName<"{uid=*}">>("uid");
7070
});
7171

7272
it("extracts {segment=**} captures", () => {
73-
expectType<Extract<"{uid=**}">>("uid");
73+
expectType<VarName<"{uid=**}">>("uid");
7474
});
7575
});
7676

0 commit comments

Comments
 (0)