Skip to content

Commit cbf289a

Browse files
authored
add /v2 imports back in to support firebase-functions versions below 6.x (#252)
1 parent b78cbc4 commit cbf289a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+79
-77
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- Explicitly import from the v1 namespace to unbreak firebase-functions 6.x (#243).
2+
- Explciitly import from the v2 namespace so that #243 doesn't break firebase-functions versions below 6.x (#252)
3+
- Also adds firebase-admin 13.x as a supported version in peer-deps (#252)

package-lock.json

Lines changed: 9 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"@types/mocha": "^5.2.7",
4949
"chai": "^4.2.0",
5050
"firebase-admin": "^12.0.0",
51-
"firebase-functions": "^6.0.1",
51+
"firebase-functions": "^4.9.0",
5252
"firebase-tools": "^8.9.2",
5353
"mocha": "^6.2.2",
5454
"prettier": "^1.19.1",
@@ -57,8 +57,8 @@
5757
"typescript": "^4.2.5"
5858
},
5959
"peerDependencies": {
60-
"firebase-admin": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0",
61-
"firebase-functions": ">=6.0.1",
60+
"firebase-admin": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0",
61+
"firebase-functions": ">=4.9.0",
6262
"jest": ">=28.0.0"
6363
},
6464
"engines": {

spec/cloudevent/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import { expect } from 'chai';
2424

25-
import { alerts, storage } from 'firebase-functions';
25+
import { alerts, storage } from 'firebase-functions/v2';
2626
import { generateMockCloudEvent } from '../../src/cloudevent/generate';
2727

2828
describe('generate (CloudEvent)', () => {

spec/main.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { mockConfig, makeChange, wrap } from '../src/main';
2828
import { _makeResourceName, _extractParams } from '../src/v1';
2929
import { features } from '../src/features';
3030
import { FirebaseFunctionsTest } from '../src/lifecycle';
31-
import { alerts } from 'firebase-functions';
31+
import { alerts } from 'firebase-functions/v2';
3232
import { wrapV2 } from '../src/v2';
3333

3434
describe('main', () => {

spec/v2.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
eventarc,
3636
https,
3737
firestore,
38-
} from 'firebase-functions';
38+
} from 'firebase-functions/v2';
3939
import { defineString } from 'firebase-functions/params';
4040
import { makeDataSnapshot } from '../src/providers/database';
4141
import { makeDocumentSnapshot } from '../src/providers/firestore';

src/cloudevent/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
CloudFunction,
44
database,
55
pubsub,
6-
} from 'firebase-functions';
6+
} from 'firebase-functions/v2';
77
import {
88
DocumentSnapshot,
99
QueryDocumentSnapshot,

src/cloudevent/mocks/alerts/alerts-on-alert-published.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { DeepPartial, MockCloudEventAbstractFactory } from '../../types';
2-
import { CloudFunction } from 'firebase-functions';
2+
import { CloudFunction } from 'firebase-functions/v2';
33
import {
44
APP_ID,
55
getBaseCloudEvent,
66
getEventType,
77
PROJECT_ID,
88
} from '../helpers';
9-
import { FirebaseAlertData, AlertEvent } from 'firebase-functions/alerts';
9+
import { FirebaseAlertData, AlertEvent } from 'firebase-functions/v2/alerts';
1010

1111
export const alertsOnAlertPublished: MockCloudEventAbstractFactory<AlertEvent<
1212
FirebaseAlertData

src/cloudevent/mocks/alerts/app-distribution-on-new-tester-ios-device-published.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DeepPartial, MockCloudEventAbstractFactory } from '../../types';
2-
import { CloudFunction } from 'firebase-functions';
2+
import { CloudFunction } from 'firebase-functions/v2';
33
import {
44
getBaseCloudEvent,
55
getEventFilters,
@@ -9,7 +9,7 @@ import {
99
import {
1010
AppDistributionEvent,
1111
NewTesterDevicePayload,
12-
} from 'firebase-functions/alerts/appDistribution';
12+
} from 'firebase-functions/v2/alerts/appDistribution';
1313

1414
export const alertsAppDistributionOnNewTesterIosDevicePublished: MockCloudEventAbstractFactory<AppDistributionEvent<
1515
NewTesterDevicePayload

src/cloudevent/mocks/alerts/billing-on-plan-automated-update-published.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { DeepPartial, MockCloudEventAbstractFactory } from '../../types';
2-
import { CloudFunction } from 'firebase-functions';
3-
import { FirebaseAlertData } from 'firebase-functions/alerts';
2+
import { CloudFunction } from 'firebase-functions/v2';
3+
import { FirebaseAlertData } from 'firebase-functions/v2/alerts';
44
import {
55
BillingEvent,
66
PlanAutomatedUpdatePayload,
7-
} from 'firebase-functions/alerts/billing';
7+
} from 'firebase-functions/v2/alerts/billing';
88
import {
99
getBaseCloudEvent,
1010
getEventFilters,

0 commit comments

Comments
 (0)