From 87bd7e109adba801c563f17915717a71e0341523 Mon Sep 17 00:00:00 2001 From: Victor Fan Date: Tue, 17 Dec 2024 14:31:47 -0800 Subject: [PATCH 1/7] plain imports --- spec/main.spec.ts | 2 +- spec/v2.spec.ts | 2 +- src/cloudevent/generate.ts | 2 +- src/cloudevent/mocks/alerts/alerts-on-alert-published.ts | 2 +- .../app-distribution-on-new-tester-ios-device-published.ts | 2 +- .../mocks/alerts/billing-on-plan-automated-update-published.ts | 2 +- src/cloudevent/mocks/alerts/billing-on-plan-update-published.ts | 2 +- .../mocks/alerts/crashlytics-on-new-anr-issue-published.ts | 2 +- .../mocks/alerts/crashlytics-on-new-fatal-issue-published.ts | 2 +- .../mocks/alerts/crashlytics-on-new-nonfatal-issue-published.ts | 2 +- .../mocks/alerts/crashlytics-on-regression-alert-published.ts | 2 +- .../mocks/alerts/crashlytics-on-stability-digest-published.ts | 2 +- .../mocks/alerts/crashlytics-on-velocity-alert-published.ts | 2 +- .../mocks/alerts/performance-on-threshold-alert-published.ts | 2 +- src/cloudevent/mocks/database/database-on-value-created.ts | 2 +- src/cloudevent/mocks/database/database-on-value-deleted.ts | 2 +- src/cloudevent/mocks/database/database-on-value-updated.ts | 2 +- src/cloudevent/mocks/database/database-on-value-written.ts | 2 +- src/cloudevent/mocks/database/helpers.ts | 2 +- .../mocks/eventarc/eventarc-on-custom-event-published.ts | 2 +- .../firestore-on-document-created-with-auth-context.ts | 2 +- src/cloudevent/mocks/firestore/firestore-on-document-created.ts | 2 +- .../firestore-on-document-deleted-with-auth-context.ts | 2 +- src/cloudevent/mocks/firestore/firestore-on-document-deleted.ts | 2 +- .../firestore-on-document-updated-with-auth-context.ts | 2 +- src/cloudevent/mocks/firestore/firestore-on-document-updated.ts | 2 +- .../firestore-on-document-written-with-auth-context.ts | 2 +- src/cloudevent/mocks/firestore/firestore-on-document-written.ts | 2 +- src/cloudevent/mocks/firestore/helpers.ts | 2 +- src/cloudevent/mocks/helpers.ts | 2 +- src/cloudevent/mocks/pubsub/pubsub-on-message-published.ts | 2 +- .../mocks/remoteconfig/remote-config-on-config-updated.ts | 2 +- src/cloudevent/mocks/storage/index.ts | 2 +- src/cloudevent/mocks/storage/storage-data.ts | 2 +- .../mocks/testlab/test-lab-on-test-matrix-completed.ts | 2 +- src/cloudevent/types.ts | 2 +- src/main.ts | 2 +- src/v2.ts | 2 +- 38 files changed, 38 insertions(+), 38 deletions(-) diff --git a/spec/main.spec.ts b/spec/main.spec.ts index dfa23cc..703495c 100644 --- a/spec/main.spec.ts +++ b/spec/main.spec.ts @@ -28,7 +28,7 @@ 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'; +import { alerts } from 'firebase-functions/v2'; import { wrapV2 } from '../src/v2'; describe('main', () => { diff --git a/spec/v2.spec.ts b/spec/v2.spec.ts index 921c93a..1101aa7 100644 --- a/spec/v2.spec.ts +++ b/spec/v2.spec.ts @@ -35,7 +35,7 @@ import { eventarc, https, firestore, -} from 'firebase-functions'; +} from 'firebase-functions/v2'; 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 0111d26..4cb908d 100644 --- a/src/cloudevent/generate.ts +++ b/src/cloudevent/generate.ts @@ -3,7 +3,7 @@ import { CloudFunction, database, pubsub, -} from 'firebase-functions'; +} from 'firebase-functions/v2'; import { DocumentSnapshot, QueryDocumentSnapshot, diff --git a/src/cloudevent/mocks/alerts/alerts-on-alert-published.ts b/src/cloudevent/mocks/alerts/alerts-on-alert-published.ts index 2607817..99788e4 100644 --- a/src/cloudevent/mocks/alerts/alerts-on-alert-published.ts +++ b/src/cloudevent/mocks/alerts/alerts-on-alert-published.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction } from 'firebase-functions'; +import { CloudFunction } from 'firebase-functions/v2'; import { APP_ID, getBaseCloudEvent, diff --git a/src/cloudevent/mocks/alerts/app-distribution-on-new-tester-ios-device-published.ts b/src/cloudevent/mocks/alerts/app-distribution-on-new-tester-ios-device-published.ts index 2a2b55a..741d2e5 100644 --- a/src/cloudevent/mocks/alerts/app-distribution-on-new-tester-ios-device-published.ts +++ b/src/cloudevent/mocks/alerts/app-distribution-on-new-tester-ios-device-published.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction } from 'firebase-functions'; +import { CloudFunction } from 'firebase-functions/v2'; import { getBaseCloudEvent, getEventFilters, diff --git a/src/cloudevent/mocks/alerts/billing-on-plan-automated-update-published.ts b/src/cloudevent/mocks/alerts/billing-on-plan-automated-update-published.ts index 200a8b0..d755fe4 100644 --- a/src/cloudevent/mocks/alerts/billing-on-plan-automated-update-published.ts +++ b/src/cloudevent/mocks/alerts/billing-on-plan-automated-update-published.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction } from 'firebase-functions'; +import { CloudFunction } from 'firebase-functions/v2'; import { FirebaseAlertData } from 'firebase-functions/alerts'; import { BillingEvent, diff --git a/src/cloudevent/mocks/alerts/billing-on-plan-update-published.ts b/src/cloudevent/mocks/alerts/billing-on-plan-update-published.ts index b86a491..a3b40c8 100644 --- a/src/cloudevent/mocks/alerts/billing-on-plan-update-published.ts +++ b/src/cloudevent/mocks/alerts/billing-on-plan-update-published.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction } from 'firebase-functions'; +import { CloudFunction } from 'firebase-functions/v2'; import { FirebaseAlertData } from 'firebase-functions/alerts'; import { BillingEvent, diff --git a/src/cloudevent/mocks/alerts/crashlytics-on-new-anr-issue-published.ts b/src/cloudevent/mocks/alerts/crashlytics-on-new-anr-issue-published.ts index c618ce3..c0d41df 100644 --- a/src/cloudevent/mocks/alerts/crashlytics-on-new-anr-issue-published.ts +++ b/src/cloudevent/mocks/alerts/crashlytics-on-new-anr-issue-published.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction } from 'firebase-functions'; +import { CloudFunction } from 'firebase-functions/v2'; import { getBaseCloudEvent, getEventFilters, diff --git a/src/cloudevent/mocks/alerts/crashlytics-on-new-fatal-issue-published.ts b/src/cloudevent/mocks/alerts/crashlytics-on-new-fatal-issue-published.ts index d758cbb..8e69378 100644 --- a/src/cloudevent/mocks/alerts/crashlytics-on-new-fatal-issue-published.ts +++ b/src/cloudevent/mocks/alerts/crashlytics-on-new-fatal-issue-published.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction } from 'firebase-functions'; +import { CloudFunction } from 'firebase-functions/v2'; import { getBaseCloudEvent, getEventFilters, diff --git a/src/cloudevent/mocks/alerts/crashlytics-on-new-nonfatal-issue-published.ts b/src/cloudevent/mocks/alerts/crashlytics-on-new-nonfatal-issue-published.ts index e4d5f86..70e58e5 100644 --- a/src/cloudevent/mocks/alerts/crashlytics-on-new-nonfatal-issue-published.ts +++ b/src/cloudevent/mocks/alerts/crashlytics-on-new-nonfatal-issue-published.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction } from 'firebase-functions'; +import { CloudFunction } from 'firebase-functions/v2'; import { getBaseCloudEvent, getEventFilters, diff --git a/src/cloudevent/mocks/alerts/crashlytics-on-regression-alert-published.ts b/src/cloudevent/mocks/alerts/crashlytics-on-regression-alert-published.ts index cfc4e8f..f1bcb6e 100644 --- a/src/cloudevent/mocks/alerts/crashlytics-on-regression-alert-published.ts +++ b/src/cloudevent/mocks/alerts/crashlytics-on-regression-alert-published.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction } from 'firebase-functions'; +import { CloudFunction } from 'firebase-functions/v2'; import { getBaseCloudEvent, getEventFilters, diff --git a/src/cloudevent/mocks/alerts/crashlytics-on-stability-digest-published.ts b/src/cloudevent/mocks/alerts/crashlytics-on-stability-digest-published.ts index 9a7bb5f..559c5fc 100644 --- a/src/cloudevent/mocks/alerts/crashlytics-on-stability-digest-published.ts +++ b/src/cloudevent/mocks/alerts/crashlytics-on-stability-digest-published.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction } from 'firebase-functions'; +import { CloudFunction } from 'firebase-functions/v2'; import { getBaseCloudEvent, getEventFilters, diff --git a/src/cloudevent/mocks/alerts/crashlytics-on-velocity-alert-published.ts b/src/cloudevent/mocks/alerts/crashlytics-on-velocity-alert-published.ts index 191c422..1e9ef90 100644 --- a/src/cloudevent/mocks/alerts/crashlytics-on-velocity-alert-published.ts +++ b/src/cloudevent/mocks/alerts/crashlytics-on-velocity-alert-published.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction } from 'firebase-functions'; +import { CloudFunction } from 'firebase-functions/v2'; import { getBaseCloudEvent, getEventFilters, diff --git a/src/cloudevent/mocks/alerts/performance-on-threshold-alert-published.ts b/src/cloudevent/mocks/alerts/performance-on-threshold-alert-published.ts index 8e479ac..410dc25 100644 --- a/src/cloudevent/mocks/alerts/performance-on-threshold-alert-published.ts +++ b/src/cloudevent/mocks/alerts/performance-on-threshold-alert-published.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction } from 'firebase-functions'; +import { CloudFunction } from 'firebase-functions/v2'; import { PerformanceEvent, ThresholdAlertPayload, diff --git a/src/cloudevent/mocks/database/database-on-value-created.ts b/src/cloudevent/mocks/database/database-on-value-created.ts index d8bf4e6..b5db271 100644 --- a/src/cloudevent/mocks/database/database-on-value-created.ts +++ b/src/cloudevent/mocks/database/database-on-value-created.ts @@ -1,5 +1,5 @@ import { MockCloudEventAbstractFactory } from '../../types'; -import { CloudEvent, CloudFunction, database } from 'firebase-functions'; +import { CloudEvent, CloudFunction, database } from 'firebase-functions/v2'; import { getEventType } from '../helpers'; import { getDatabaseSnapshotCloudEvent } from './helpers'; diff --git a/src/cloudevent/mocks/database/database-on-value-deleted.ts b/src/cloudevent/mocks/database/database-on-value-deleted.ts index 99f8a17..17b1b12 100644 --- a/src/cloudevent/mocks/database/database-on-value-deleted.ts +++ b/src/cloudevent/mocks/database/database-on-value-deleted.ts @@ -1,5 +1,5 @@ import { MockCloudEventAbstractFactory } from '../../types'; -import { CloudEvent, CloudFunction, database } from 'firebase-functions'; +import { CloudEvent, CloudFunction, database } from 'firebase-functions/v2'; import { getEventType } from '../helpers'; import { getDatabaseSnapshotCloudEvent } from './helpers'; diff --git a/src/cloudevent/mocks/database/database-on-value-updated.ts b/src/cloudevent/mocks/database/database-on-value-updated.ts index 58cbf02..0244a69 100644 --- a/src/cloudevent/mocks/database/database-on-value-updated.ts +++ b/src/cloudevent/mocks/database/database-on-value-updated.ts @@ -1,5 +1,5 @@ import { MockCloudEventAbstractFactory } from '../../types'; -import { CloudEvent, CloudFunction, database } from 'firebase-functions'; +import { CloudEvent, CloudFunction, database } from 'firebase-functions/v2'; import { getEventType } from '../helpers'; import { Change } from 'firebase-functions/v1'; import { getDatabaseChangeSnapshotCloudEvent } from './helpers'; diff --git a/src/cloudevent/mocks/database/database-on-value-written.ts b/src/cloudevent/mocks/database/database-on-value-written.ts index 0fe4b71..20d2fb9 100644 --- a/src/cloudevent/mocks/database/database-on-value-written.ts +++ b/src/cloudevent/mocks/database/database-on-value-written.ts @@ -1,5 +1,5 @@ import { MockCloudEventAbstractFactory } from '../../types'; -import { CloudEvent, CloudFunction, database } from 'firebase-functions'; +import { CloudEvent, CloudFunction, database } from 'firebase-functions/v2'; import { getEventType } from '../helpers'; import { Change } from 'firebase-functions/v1'; import { getDatabaseChangeSnapshotCloudEvent } from './helpers'; diff --git a/src/cloudevent/mocks/database/helpers.ts b/src/cloudevent/mocks/database/helpers.ts index fc2675a..aa4cc94 100644 --- a/src/cloudevent/mocks/database/helpers.ts +++ b/src/cloudevent/mocks/database/helpers.ts @@ -1,4 +1,4 @@ -import { CloudFunction, database } from 'firebase-functions'; +import { CloudFunction, database } from 'firebase-functions/v2'; import { DeepPartial } from '../../types'; import { exampleDataSnapshot, diff --git a/src/cloudevent/mocks/eventarc/eventarc-on-custom-event-published.ts b/src/cloudevent/mocks/eventarc/eventarc-on-custom-event-published.ts index ba21594..7043875 100644 --- a/src/cloudevent/mocks/eventarc/eventarc-on-custom-event-published.ts +++ b/src/cloudevent/mocks/eventarc/eventarc-on-custom-event-published.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudEvent, CloudFunction } from 'firebase-functions'; +import { CloudEvent, CloudFunction } from 'firebase-functions/v2'; import { getBaseCloudEvent } from '../helpers'; export const eventarcOnCustomEventPublished: 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 6e795bd..bf4359c 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'; +import { CloudEvent, CloudFunction, firestore } from 'firebase-functions/v2'; 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 4768b4c..4b8b532 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'; +import { CloudEvent, CloudFunction, firestore } from 'firebase-functions/v2'; 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 40fd9e4..942ebc7 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'; +import { CloudEvent, CloudFunction, firestore } from 'firebase-functions/v2'; 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 fde9b2d..e29f1f6 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'; +import { CloudEvent, CloudFunction, firestore } from 'firebase-functions/v2'; 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 95f26a0..a023ce8 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'; +} from 'firebase-functions/v2'; 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 9ee0cd9..bf5da64 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'; +} from 'firebase-functions/v2'; 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 c57ac54..a9171a9 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'; +} from 'firebase-functions/v2'; 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 71f0a57..20e9f0e 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'; +} from 'firebase-functions/v2'; 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 dabf425..77b144c 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'; +import { Change, CloudFunction, firestore } from 'firebase-functions/v2'; import { exampleDocumentSnapshot, exampleDocumentSnapshotChange, diff --git a/src/cloudevent/mocks/helpers.ts b/src/cloudevent/mocks/helpers.ts index 3715c92..5bc785e 100644 --- a/src/cloudevent/mocks/helpers.ts +++ b/src/cloudevent/mocks/helpers.ts @@ -1,5 +1,5 @@ import * as v1 from 'firebase-functions/v1'; -import * as v2 from 'firebase-functions'; +import * as v2 from 'firebase-functions/v2'; 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 7826a29..78a0af7 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'; +import { CloudEvent, CloudFunction, pubsub } from 'firebase-functions/v2'; 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 53a36a1..32f42c2 100644 --- a/src/cloudevent/mocks/remoteconfig/remote-config-on-config-updated.ts +++ b/src/cloudevent/mocks/remoteconfig/remote-config-on-config-updated.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction, CloudEvent } from 'firebase-functions'; +import { CloudFunction, CloudEvent } from 'firebase-functions/v2'; import { ConfigUpdateData } from 'firebase-functions/remoteConfig'; import { getBaseCloudEvent, getEventType, PROJECT_ID } from '../helpers'; diff --git a/src/cloudevent/mocks/storage/index.ts b/src/cloudevent/mocks/storage/index.ts index b3a5a04..d5722a4 100644 --- a/src/cloudevent/mocks/storage/index.ts +++ b/src/cloudevent/mocks/storage/index.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction, CloudEvent } from 'firebase-functions'; +import { CloudFunction, CloudEvent } from 'firebase-functions/v2'; import { StorageEvent } from 'firebase-functions/storage'; import { FILENAME, diff --git a/src/cloudevent/mocks/storage/storage-data.ts b/src/cloudevent/mocks/storage/storage-data.ts index 3ff4252..fb3d524 100644 --- a/src/cloudevent/mocks/storage/storage-data.ts +++ b/src/cloudevent/mocks/storage/storage-data.ts @@ -1,4 +1,4 @@ -import { storage } from 'firebase-functions'; +import { storage } from 'firebase-functions/v2'; import { FILENAME } from '../helpers'; /** Storage Data */ diff --git a/src/cloudevent/mocks/testlab/test-lab-on-test-matrix-completed.ts b/src/cloudevent/mocks/testlab/test-lab-on-test-matrix-completed.ts index 6231039..962b0f3 100644 --- a/src/cloudevent/mocks/testlab/test-lab-on-test-matrix-completed.ts +++ b/src/cloudevent/mocks/testlab/test-lab-on-test-matrix-completed.ts @@ -1,5 +1,5 @@ import { DeepPartial, MockCloudEventAbstractFactory } from '../../types'; -import { CloudFunction, CloudEvent } from 'firebase-functions'; +import { CloudFunction, CloudEvent } from 'firebase-functions/v2'; import { TestMatrixCompletedData } from 'firebase-functions/testLab'; import { getBaseCloudEvent, getEventType, PROJECT_ID } from '../helpers'; diff --git a/src/cloudevent/types.ts b/src/cloudevent/types.ts index 406555c..ab51ad5 100644 --- a/src/cloudevent/types.ts +++ b/src/cloudevent/types.ts @@ -1,4 +1,4 @@ -import { CloudEvent, CloudFunction } from 'firebase-functions'; +import { CloudEvent, CloudFunction } from 'firebase-functions/v2'; export type DeepPartial = { [Key in keyof T]?: T[Key] extends object ? DeepPartial : T[Key]; diff --git a/src/main.ts b/src/main.ts index 6764246..a71bbd0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -29,7 +29,7 @@ import { import { CloudFunction as CloudFunctionV2, CloudEvent, -} from 'firebase-functions'; +} from 'firebase-functions/v2'; import { CallableFunction, diff --git a/src/v2.ts b/src/v2.ts index ed2152c..6cc0324 100644 --- a/src/v2.ts +++ b/src/v2.ts @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { CloudFunction, CloudEvent } from 'firebase-functions'; +import { CloudFunction, CloudEvent } from 'firebase-functions/v2'; import { CallableFunction, CallableRequest } from 'firebase-functions/https'; import { generateCombinedCloudEvent } from './cloudevent/generate'; From 319bc3316670168bb4fb639f0ec4ca8980edd297 Mon Sep 17 00:00:00 2001 From: Victor Fan Date: Tue, 17 Dec 2024 14:39:00 -0800 Subject: [PATCH 2/7] sub-directory imports --- src/cloudevent/mocks/alerts/alerts-on-alert-published.ts | 2 +- .../app-distribution-on-new-tester-ios-device-published.ts | 2 +- .../alerts/billing-on-plan-automated-update-published.ts | 4 ++-- .../mocks/alerts/billing-on-plan-update-published.ts | 4 ++-- .../mocks/alerts/crashlytics-on-new-anr-issue-published.ts | 4 ++-- .../mocks/alerts/crashlytics-on-new-fatal-issue-published.ts | 4 ++-- .../alerts/crashlytics-on-new-nonfatal-issue-published.ts | 4 ++-- .../mocks/alerts/crashlytics-on-regression-alert-published.ts | 4 ++-- .../mocks/alerts/crashlytics-on-stability-digest-published.ts | 4 ++-- .../mocks/alerts/crashlytics-on-velocity-alert-published.ts | 4 ++-- .../mocks/alerts/performance-on-threshold-alert-published.ts | 4 ++-- .../mocks/remoteconfig/remote-config-on-config-updated.ts | 2 +- src/cloudevent/mocks/storage/index.ts | 2 +- .../mocks/testlab/test-lab-on-test-matrix-completed.ts | 2 +- src/main.ts | 2 +- src/v2.ts | 2 +- 16 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/cloudevent/mocks/alerts/alerts-on-alert-published.ts b/src/cloudevent/mocks/alerts/alerts-on-alert-published.ts index 99788e4..a13c371 100644 --- a/src/cloudevent/mocks/alerts/alerts-on-alert-published.ts +++ b/src/cloudevent/mocks/alerts/alerts-on-alert-published.ts @@ -6,7 +6,7 @@ import { getEventType, PROJECT_ID, } from '../helpers'; -import { FirebaseAlertData, AlertEvent } from 'firebase-functions/alerts'; +import { FirebaseAlertData, AlertEvent } from 'firebase-functions/v2/alerts'; export const alertsOnAlertPublished: MockCloudEventAbstractFactory Date: Tue, 17 Dec 2024 14:40:47 -0800 Subject: [PATCH 3/7] allow old firebase-functions versions --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ca9ee47..759646c 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": "^6.0.1", + "firebase-functions": "^4.9.0", "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": ">=6.0.1", + "firebase-functions": ">=4.9.0", "jest": ">=28.0.0" }, "engines": { From 251fe2f0ea1115145225966f770ea29e0e8eb094 Mon Sep 17 00:00:00 2001 From: Victor Fan Date: Tue, 17 Dec 2024 14:43:30 -0800 Subject: [PATCH 4/7] update package-lock.json --- package-lock.json | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2a88c5a..84a91a3 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": "^6.0.1", + "firebase-functions": "^4.9.0", "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": ">=6.0.1", + "firebase-functions": ">=4.9.0", "jest": ">=28.0.0" } }, @@ -5435,11 +5435,10 @@ "dev": true }, "node_modules/firebase-functions": { - "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==", + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-4.9.0.tgz", + "integrity": "sha512-IqxOEsVAWGcRv9KRGzWQR5mOFuNsil3vsfkRPPiaV1U/ATC27/jbahh4z8I4rW8Xqa6cQE5xqnw0ueyMH7i7Ag==", "dev": true, - "license": "MIT", "dependencies": { "@types/cors": "^2.8.5", "@types/express": "4.17.3", @@ -5454,7 +5453,7 @@ "node": ">=14.10.0" }, "peerDependencies": { - "firebase-admin": "^11.10.0 || ^12.0.0" + "firebase-admin": "^10.0.0 || ^11.0.0 || ^12.0.0" } }, "node_modules/firebase-functions/node_modules/@types/express": { @@ -17806,9 +17805,9 @@ } }, "firebase-functions": { - "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==", + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-4.9.0.tgz", + "integrity": "sha512-IqxOEsVAWGcRv9KRGzWQR5mOFuNsil3vsfkRPPiaV1U/ATC27/jbahh4z8I4rW8Xqa6cQE5xqnw0ueyMH7i7Ag==", "dev": true, "requires": { "@types/cors": "^2.8.5", From c4938cd5c9ccd38155366c3eee16360d104a4267 Mon Sep 17 00:00:00 2001 From: Victor Fan Date: Tue, 17 Dec 2024 14:53:12 -0800 Subject: [PATCH 5/7] missed a file? --- spec/cloudevent/generate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/cloudevent/generate.ts b/spec/cloudevent/generate.ts index ebbd0f6..f245887 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'; +import { alerts, storage } from 'firebase-functions/v2'; import { generateMockCloudEvent } from '../../src/cloudevent/generate'; describe('generate (CloudEvent)', () => { From feba5cfe4ba93565ef1b77197e5590968a9aa8f8 Mon Sep 17 00:00:00 2001 From: Victor Fan Date: Wed, 18 Dec 2024 15:52:00 -0800 Subject: [PATCH 6/7] Update package.json to allow firebase-admin 13.x in peer-deps Co-authored-by: Dennis Kugelmann --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 759646c..178b4fb 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "typescript": "^4.2.5" }, "peerDependencies": { - "firebase-admin": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0", + "firebase-admin": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0", "firebase-functions": ">=4.9.0", "jest": ">=28.0.0" }, From a267528aa6de6ba6f94812177a2bcfd5d1bd3e5f Mon Sep 17 00:00:00 2001 From: Victor Fan Date: Wed, 18 Dec 2024 15:56:26 -0800 Subject: [PATCH 7/7] update changelog.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29..34f4893 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +- Explicitly import from the v1 namespace to unbreak firebase-functions 6.x (#243). +- Explciitly import from the v2 namespace so that #243 doesn't break firebase-functions versions below 6.x (#252) +- Also adds firebase-admin 13.x as a supported version in peer-deps (#252)