Skip to content

[FR] Export Message types so they can be re-used #1146

Description

@BorntraegerMarc

Is your feature request related to a problem? Please describe.
Take the following code:

import{TokenMessage}from'firebase-admin/lib/messaging';constallPushTokenSubscriptionMessage2DArray: Array<Array<fcm.messaging.Message>>;// Contains all the TokenMessage's I'd like to send a FCM message to. It's 2D because the max. nr. of tokens that is expected is 500. So if we want to send to 501 devices then the last device is in the next entry of the 2D array.constbatchResponses: Array<fcm.messaging.BatchResponse|null>=awaitPromise.all(allPushTokenSubscriptionMessage2DArray.map(async(pushTokenSubscriptionMessageArray: Array<fcm.messaging.Message>)=>this.firebaseMessaging.sendAll(pushTokenSubscriptionMessageArray)));batchResponses.forEach((batch: fcm.messaging.BatchResponse,batchIndex: number)=>{batch.responses.forEach((res: fcm.messaging.SendResponse,responseIndex: number)=>{// Based on answers here https://github.com/firebase/firebase-admin-node/issues/600 responses should be ordered as requestsconsttoken: string=(allPushTokenSubscriptionMessage2DArray[batchIndex][responseIndex]asTokenMessage).token;console.log(`Failed to send to token ${token}`);});});

The problem is now that TokenMessage is no longer exported in this lib. So TS transpilation will fail with the error Cannot find name 'TokenMessage'.

Describe the solution you'd like
Export all types of Messages.

Describe alternatives you've considered
None.

Additional context
None.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions