diff --git a/package-lock.json b/package-lock.json index 84a91a3..2a88c5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "@types/mocha": "^5.2.7", "chai": "^4.2.0", "firebase-admin": "^12.0.0", - "firebase-functions": "^4.9.0", + "firebase-functions": "^6.0.1", "firebase-tools": "^8.9.2", "mocha": "^6.2.2", "prettier": "^1.19.1", @@ -32,7 +32,7 @@ }, "peerDependencies": { "firebase-admin": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0", - "firebase-functions": ">=4.9.0", + "firebase-functions": ">=6.0.1", "jest": ">=28.0.0" } }, @@ -5435,10 +5435,11 @@ "dev": true }, "node_modules/firebase-functions": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-4.9.0.tgz", - "integrity": "sha512-IqxOEsVAWGcRv9KRGzWQR5mOFuNsil3vsfkRPPiaV1U/ATC27/jbahh4z8I4rW8Xqa6cQE5xqnw0ueyMH7i7Ag==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-6.0.1.tgz", + "integrity": "sha512-0rIpTU6dnLRvP3IK+okn1FDjoqjzShm0/S+i4OMY7JFu/HJoyJ1JNkrT4KjECy1/mCHK49KsmH8iYE0rzrglHg==", "dev": true, + "license": "MIT", "dependencies": { "@types/cors": "^2.8.5", "@types/express": "4.17.3", @@ -5453,7 +5454,7 @@ "node": ">=14.10.0" }, "peerDependencies": { - "firebase-admin": "^10.0.0 || ^11.0.0 || ^12.0.0" + "firebase-admin": "^11.10.0 || ^12.0.0" } }, "node_modules/firebase-functions/node_modules/@types/express": { @@ -17805,9 +17806,9 @@ } }, "firebase-functions": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-4.9.0.tgz", - "integrity": "sha512-IqxOEsVAWGcRv9KRGzWQR5mOFuNsil3vsfkRPPiaV1U/ATC27/jbahh4z8I4rW8Xqa6cQE5xqnw0ueyMH7i7Ag==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-6.0.1.tgz", + "integrity": "sha512-0rIpTU6dnLRvP3IK+okn1FDjoqjzShm0/S+i4OMY7JFu/HJoyJ1JNkrT4KjECy1/mCHK49KsmH8iYE0rzrglHg==", "dev": true, "requires": { "@types/cors": "^2.8.5", diff --git a/package.json b/package.json index 759646c..ca9ee47 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@types/mocha": "^5.2.7", "chai": "^4.2.0", "firebase-admin": "^12.0.0", - "firebase-functions": "^4.9.0", + "firebase-functions": "^6.0.1", "firebase-tools": "^8.9.2", "mocha": "^6.2.2", "prettier": "^1.19.1", @@ -58,7 +58,7 @@ }, "peerDependencies": { "firebase-admin": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0", - "firebase-functions": ">=4.9.0", + "firebase-functions": ">=6.0.1", "jest": ">=28.0.0" }, "engines": { diff --git a/spec/cloudevent/generate.ts b/spec/cloudevent/generate.ts index f245887..ebbd0f6 100644 --- a/spec/cloudevent/generate.ts +++ b/spec/cloudevent/generate.ts @@ -22,7 +22,7 @@ import { expect } from 'chai'; -import { alerts, storage } from 'firebase-functions/v2'; +import { alerts, storage } from 'firebase-functions'; import { generateMockCloudEvent } from '../../src/cloudevent/generate'; describe('generate (CloudEvent)', () => { diff --git a/spec/main.spec.ts b/spec/main.spec.ts index 867cc50..dfa23cc 100644 --- a/spec/main.spec.ts +++ b/spec/main.spec.ts @@ -21,14 +21,14 @@ // SOFTWARE. import { expect } from 'chai'; -import * as functions from 'firebase-functions'; +import * as functions from 'firebase-functions/v1'; import { set } from 'lodash'; import { mockConfig, makeChange, wrap } from '../src/main'; import { _makeResourceName, _extractParams } from '../src/v1'; import { features } from '../src/features'; import { FirebaseFunctionsTest } from '../src/lifecycle'; -import { alerts } from 'firebase-functions/v2'; +import { alerts } from 'firebase-functions'; import { wrapV2 } from '../src/v2'; describe('main', () => { diff --git a/spec/providers/https.spec.ts b/spec/providers/https.spec.ts index 99793c1..21768ef 100644 --- a/spec/providers/https.spec.ts +++ b/spec/providers/https.spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import * as functions from 'firebase-functions'; +import * as functions from 'firebase-functions/v1'; import fft = require('../../src/index'); const cfToUpperCaseOnRequest = functions.https.onRequest((req, res) => { diff --git a/spec/providers/scheduled.spec.ts b/spec/providers/scheduled.spec.ts index 6aa921a..e8477a0 100644 --- a/spec/providers/scheduled.spec.ts +++ b/spec/providers/scheduled.spec.ts @@ -1,5 +1,5 @@ import * as sinon from 'sinon'; -import * as functions from 'firebase-functions'; +import * as functions from 'firebase-functions/v1'; import fft = require('../../src/index'); import { WrappedScheduledFunction } from '../../src/main'; diff --git a/spec/v2.spec.ts b/spec/v2.spec.ts index 1101aa7..921c93a 100644 --- a/spec/v2.spec.ts +++ b/spec/v2.spec.ts @@ -35,7 +35,7 @@ import { eventarc, https, firestore, -} from 'firebase-functions/v2'; +} from 'firebase-functions'; import { defineString } from 'firebase-functions/params'; import { makeDataSnapshot } from '../src/providers/database'; import { makeDocumentSnapshot } from '../src/providers/firestore'; diff --git a/src/cloudevent/generate.ts b/src/cloudevent/generate.ts index 5f5377d..0111d26 100644 --- a/src/cloudevent/generate.ts +++ b/src/cloudevent/generate.ts @@ -3,14 +3,14 @@ import { CloudFunction, database, pubsub, -} from 'firebase-functions/v2'; +} from 'firebase-functions'; import { DocumentSnapshot, QueryDocumentSnapshot, } from 'firebase-admin/firestore'; import { LIST_OF_MOCK_CLOUD_EVENT_PARTIALS } from './mocks/partials'; import { DeepPartial } from './types'; -import { Change } from 'firebase-functions'; +import { Change } from 'firebase-functions/v1'; import merge from 'ts-deepmerge'; /** diff --git a/src/cloudevent/mocks/alerts/alerts-on-alert-published.ts b/src/cloudevent/mocks/alerts/alerts-on-alert-published.ts index a13c371..2607817 100644 --- a/src/cloudevent/mocks/alerts/alerts-on-alert-published.ts +++ b/src/cloudevent/mocks/alerts/alerts-on-alert-published.ts @@ -1,12 +1,12 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction } from 'firebase-functions/v2'; +import { CloudFunction } from 'firebase-functions'; import { APP_ID, getBaseCloudEvent, getEventType, PROJECT_ID, } from '../helpers'; -import { FirebaseAlertData, AlertEvent } from 'firebase-functions/v2/alerts'; +import { FirebaseAlertData, AlertEvent } from 'firebase-functions/alerts'; export const alertsOnAlertPublished: MockCloudEventAbstractFactory = { diff --git a/src/cloudevent/mocks/firestore/firestore-on-document-created-with-auth-context.ts b/src/cloudevent/mocks/firestore/firestore-on-document-created-with-auth-context.ts index bf4359c..6e795bd 100644 --- a/src/cloudevent/mocks/firestore/firestore-on-document-created-with-auth-context.ts +++ b/src/cloudevent/mocks/firestore/firestore-on-document-created-with-auth-context.ts @@ -1,5 +1,5 @@ import { MockCloudEventAbstractFactory } from '../../types'; -import { CloudEvent, CloudFunction, firestore } from 'firebase-functions/v2'; +import { CloudEvent, CloudFunction, firestore } from 'firebase-functions'; import { getEventType } from '../helpers'; import { QueryDocumentSnapshot } from 'firebase-admin/firestore'; import { getDocumentSnapshotCloudEventWithAuthContext } from './helpers'; diff --git a/src/cloudevent/mocks/firestore/firestore-on-document-created.ts b/src/cloudevent/mocks/firestore/firestore-on-document-created.ts index 4b8b532..4768b4c 100644 --- a/src/cloudevent/mocks/firestore/firestore-on-document-created.ts +++ b/src/cloudevent/mocks/firestore/firestore-on-document-created.ts @@ -1,5 +1,5 @@ import { MockCloudEventAbstractFactory } from '../../types'; -import { CloudEvent, CloudFunction, firestore } from 'firebase-functions/v2'; +import { CloudEvent, CloudFunction, firestore } from 'firebase-functions'; import { getEventType } from '../helpers'; import { QueryDocumentSnapshot } from 'firebase-admin/firestore'; import { getDocumentSnapshotCloudEvent } from './helpers'; diff --git a/src/cloudevent/mocks/firestore/firestore-on-document-deleted-with-auth-context.ts b/src/cloudevent/mocks/firestore/firestore-on-document-deleted-with-auth-context.ts index 942ebc7..40fd9e4 100644 --- a/src/cloudevent/mocks/firestore/firestore-on-document-deleted-with-auth-context.ts +++ b/src/cloudevent/mocks/firestore/firestore-on-document-deleted-with-auth-context.ts @@ -1,5 +1,5 @@ import { MockCloudEventAbstractFactory } from '../../types'; -import { CloudEvent, CloudFunction, firestore } from 'firebase-functions/v2'; +import { CloudEvent, CloudFunction, firestore } from 'firebase-functions'; import { getEventType } from '../helpers'; import { QueryDocumentSnapshot } from 'firebase-admin/firestore'; import { getDocumentSnapshotCloudEventWithAuthContext } from './helpers'; diff --git a/src/cloudevent/mocks/firestore/firestore-on-document-deleted.ts b/src/cloudevent/mocks/firestore/firestore-on-document-deleted.ts index e29f1f6..fde9b2d 100644 --- a/src/cloudevent/mocks/firestore/firestore-on-document-deleted.ts +++ b/src/cloudevent/mocks/firestore/firestore-on-document-deleted.ts @@ -1,5 +1,5 @@ import { MockCloudEventAbstractFactory } from '../../types'; -import { CloudEvent, CloudFunction, firestore } from 'firebase-functions/v2'; +import { CloudEvent, CloudFunction, firestore } from 'firebase-functions'; import { getEventType } from '../helpers'; import { QueryDocumentSnapshot } from 'firebase-admin/firestore'; import { getDocumentSnapshotCloudEvent } from './helpers'; diff --git a/src/cloudevent/mocks/firestore/firestore-on-document-updated-with-auth-context.ts b/src/cloudevent/mocks/firestore/firestore-on-document-updated-with-auth-context.ts index a023ce8..95f26a0 100644 --- a/src/cloudevent/mocks/firestore/firestore-on-document-updated-with-auth-context.ts +++ b/src/cloudevent/mocks/firestore/firestore-on-document-updated-with-auth-context.ts @@ -4,7 +4,7 @@ import { CloudEvent, CloudFunction, firestore, -} from 'firebase-functions/v2'; +} from 'firebase-functions'; import { getEventType } from '../helpers'; import { QueryDocumentSnapshot } from 'firebase-admin/firestore'; import { getDocumentSnapshotChangeCloudEventWithAuthContext } from './helpers'; diff --git a/src/cloudevent/mocks/firestore/firestore-on-document-updated.ts b/src/cloudevent/mocks/firestore/firestore-on-document-updated.ts index bf5da64..9ee0cd9 100644 --- a/src/cloudevent/mocks/firestore/firestore-on-document-updated.ts +++ b/src/cloudevent/mocks/firestore/firestore-on-document-updated.ts @@ -4,7 +4,7 @@ import { CloudEvent, CloudFunction, firestore, -} from 'firebase-functions/v2'; +} from 'firebase-functions'; import { getEventType } from '../helpers'; import { QueryDocumentSnapshot } from 'firebase-admin/firestore'; import { getDocumentSnapshotChangeCloudEvent } from './helpers'; diff --git a/src/cloudevent/mocks/firestore/firestore-on-document-written-with-auth-context.ts b/src/cloudevent/mocks/firestore/firestore-on-document-written-with-auth-context.ts index a9171a9..c57ac54 100644 --- a/src/cloudevent/mocks/firestore/firestore-on-document-written-with-auth-context.ts +++ b/src/cloudevent/mocks/firestore/firestore-on-document-written-with-auth-context.ts @@ -4,7 +4,7 @@ import { CloudEvent, CloudFunction, firestore, -} from 'firebase-functions/v2'; +} from 'firebase-functions'; import { getEventType } from '../helpers'; import { DocumentSnapshot } from 'firebase-admin/firestore'; import { getDocumentSnapshotChangeCloudEventWithAuthContext } from './helpers'; diff --git a/src/cloudevent/mocks/firestore/firestore-on-document-written.ts b/src/cloudevent/mocks/firestore/firestore-on-document-written.ts index 20e9f0e..71f0a57 100644 --- a/src/cloudevent/mocks/firestore/firestore-on-document-written.ts +++ b/src/cloudevent/mocks/firestore/firestore-on-document-written.ts @@ -4,7 +4,7 @@ import { CloudEvent, CloudFunction, firestore, -} from 'firebase-functions/v2'; +} from 'firebase-functions'; import { getEventType } from '../helpers'; import { DocumentSnapshot } from 'firebase-admin/firestore'; import { getDocumentSnapshotChangeCloudEvent } from './helpers'; diff --git a/src/cloudevent/mocks/firestore/helpers.ts b/src/cloudevent/mocks/firestore/helpers.ts index 77b144c..dabf425 100644 --- a/src/cloudevent/mocks/firestore/helpers.ts +++ b/src/cloudevent/mocks/firestore/helpers.ts @@ -1,5 +1,5 @@ import { DocumentSnapshot } from 'firebase-admin/firestore'; -import { Change, CloudFunction, firestore } from 'firebase-functions/v2'; +import { Change, CloudFunction, firestore } from 'firebase-functions'; import { exampleDocumentSnapshot, exampleDocumentSnapshotChange, diff --git a/src/cloudevent/mocks/helpers.ts b/src/cloudevent/mocks/helpers.ts index 60c010d..3715c92 100644 --- a/src/cloudevent/mocks/helpers.ts +++ b/src/cloudevent/mocks/helpers.ts @@ -1,5 +1,5 @@ -import * as v1 from 'firebase-functions'; -import * as v2 from 'firebase-functions/v2'; +import * as v1 from 'firebase-functions/v1'; +import * as v2 from 'firebase-functions'; import { Expression } from 'firebase-functions/params'; export const APP_ID = '__APP_ID__'; diff --git a/src/cloudevent/mocks/pubsub/pubsub-on-message-published.ts b/src/cloudevent/mocks/pubsub/pubsub-on-message-published.ts index 78a0af7..7826a29 100644 --- a/src/cloudevent/mocks/pubsub/pubsub-on-message-published.ts +++ b/src/cloudevent/mocks/pubsub/pubsub-on-message-published.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudEvent, CloudFunction, pubsub } from 'firebase-functions/v2'; +import { CloudEvent, CloudFunction, pubsub } from 'firebase-functions'; import { getBaseCloudEvent, getEventFilters, diff --git a/src/cloudevent/mocks/remoteconfig/remote-config-on-config-updated.ts b/src/cloudevent/mocks/remoteconfig/remote-config-on-config-updated.ts index 2f257db..53a36a1 100644 --- a/src/cloudevent/mocks/remoteconfig/remote-config-on-config-updated.ts +++ b/src/cloudevent/mocks/remoteconfig/remote-config-on-config-updated.ts @@ -1,6 +1,6 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction, CloudEvent } from 'firebase-functions/v2'; -import { ConfigUpdateData } from 'firebase-functions/v2/remoteConfig'; +import { CloudFunction, CloudEvent } from 'firebase-functions'; +import { ConfigUpdateData } from 'firebase-functions/remoteConfig'; import { getBaseCloudEvent, getEventType, PROJECT_ID } from '../helpers'; export const remoteConfigOnConfigUpdated: MockCloudEventAbstractFactory = { [Key in keyof T]?: T[Key] extends object ? DeepPartial : T[Key]; diff --git a/src/main.ts b/src/main.ts index cb0a089..6764246 100644 --- a/src/main.ts +++ b/src/main.ts @@ -24,17 +24,17 @@ import { CloudFunction as CloudFunctionV1, HttpsFunction, Runnable, -} from 'firebase-functions'; +} from 'firebase-functions/v1'; import { CloudFunction as CloudFunctionV2, CloudEvent, -} from 'firebase-functions/v2'; +} from 'firebase-functions'; import { CallableFunction, HttpsFunction as HttpsFunctionV2, -} from 'firebase-functions/v2/https'; +} from 'firebase-functions/https'; import { wrapV1, WrappedFunction, WrappedScheduledFunction } from './v1'; diff --git a/src/providers/analytics.ts b/src/providers/analytics.ts index 038480b..11f0f99 100644 --- a/src/providers/analytics.ts +++ b/src/providers/analytics.ts @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { analytics } from 'firebase-functions'; +import { analytics } from 'firebase-functions/v1'; /** Create an AnalyticsEvent */ export function makeAnalyticsEvent( diff --git a/src/providers/auth.ts b/src/providers/auth.ts index 3261597..d6998fe 100644 --- a/src/providers/auth.ts +++ b/src/providers/auth.ts @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { auth } from 'firebase-functions'; +import { auth } from 'firebase-functions/v1'; /** Create a UserRecord. */ export function makeUserRecord( diff --git a/src/providers/database.ts b/src/providers/database.ts index f37ba4a..fc177b3 100644 --- a/src/providers/database.ts +++ b/src/providers/database.ts @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { database, Change } from 'firebase-functions'; +import { database, Change } from 'firebase-functions/v1'; import { app } from 'firebase-admin'; import { testApp } from '../app'; diff --git a/src/providers/firestore.ts b/src/providers/firestore.ts index 010b61f..5254e82 100644 --- a/src/providers/firestore.ts +++ b/src/providers/firestore.ts @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { Change } from 'firebase-functions'; +import { Change } from 'firebase-functions/v1'; import { firestore, app } from 'firebase-admin'; import { has, get, isEmpty, isPlainObject, mapValues } from 'lodash'; import { inspect } from 'util'; diff --git a/src/providers/pubsub.ts b/src/providers/pubsub.ts index 507ac91..994ba34 100644 --- a/src/providers/pubsub.ts +++ b/src/providers/pubsub.ts @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { pubsub } from 'firebase-functions'; +import { pubsub } from 'firebase-functions/v1'; /** Create a Message from a JSON object. */ export function makeMessage( diff --git a/src/providers/storage.ts b/src/providers/storage.ts index b333ac0..a790386 100644 --- a/src/providers/storage.ts +++ b/src/providers/storage.ts @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { storage } from 'firebase-functions'; +import { storage } from 'firebase-functions/v1'; /** Create an ObjectMetadata */ export function makeObjectMetadata( diff --git a/src/v1.ts b/src/v1.ts index abd8d03..8a7ccfc 100644 --- a/src/v1.ts +++ b/src/v1.ts @@ -34,7 +34,7 @@ import { Runnable, // @ts-ignore resetCache, -} from 'firebase-functions'; +} from 'firebase-functions/v1'; import { Expression } from 'firebase-functions/params'; import { getEventFilters, diff --git a/src/v2.ts b/src/v2.ts index e3fef18..ed2152c 100644 --- a/src/v2.ts +++ b/src/v2.ts @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { CloudFunction, CloudEvent } from 'firebase-functions/v2'; -import { CallableFunction, CallableRequest } from 'firebase-functions/v2/https'; +import { CloudFunction, CloudEvent } from 'firebase-functions'; +import { CallableFunction, CallableRequest } from 'firebase-functions/https'; import { generateCombinedCloudEvent } from './cloudevent/generate'; import { DeepPartial } from './cloudevent/types';