{"_id":"@arunvaradharajalu/common.firebase-cloud-messaging","_rev":"2-baae6c06d24cad70e018e42b7d210047","name":"@arunvaradharajalu/common.firebase-cloud-messaging","description":"This package contains wrapper for firebase cloud messaging","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@arunvaradharajalu/common.firebase-cloud-messaging","version":"1.0.0","keywords":["firebase-cloud-messaging-wrapper"],"author":{"name":"Arun Varadharajalu"},"license":"ISC","_id":"@arunvaradharajalu/common.firebase-cloud-messaging@1.0.0","maintainers":[{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"}],"homepage":"https://github.com/arunv11u/common.firebase-cloud-messaging#readme","bugs":{"url":"https://github.com/arunv11u/common.firebase-cloud-messaging/issues"},"dist":{"shasum":"039ccf088b9b5c879e30d29227476dcea13691a0","tarball":"https://registry.npmjs.org/@arunvaradharajalu/common.firebase-cloud-messaging/-/common.firebase-cloud-messaging-1.0.0.tgz","fileCount":11,"integrity":"sha512-iXsyb0hvO1rqRmD/e+JcPTy1e5/f0N/L36mJr3SBPxUau/tZGpDMP7yNRO7UrsElhmS+rs8+swE0oDDbwwSQlA==","signatures":[{"sig":"MEUCIQDZlNDZqHO7nqtguIApQCe+klIjUE1pS2FYyrbNFHqt+gIgfwb6nKt3LXNdBfRf+reDPoAGpY4PJ51hZhv4d7CFM/E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25503},"jest":{"roots":["<rootDir>/test"],"preset":"ts-jest","reporters":["default",["./node_modules/jest-html-reporter",{"pageTitle":"Firebase Cloud Messaging Test Report"}]],"clearMocks":true,"testEnvironment":"node"},"main":"./build/index.js","types":"./build/index.d.ts","gitHead":"3ed18af08547289200d4ef1a91b7020cf9889c4c","scripts":{"test":"jest --watchAll --verbose --no-cache --detectOpenHandles --env=node --coverage","build":"npm run clean && tsc --project tsconfig.build.json","clean":"rimraf build"},"_npmUser":{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"},"repository":{"url":"git+https://github.com/arunv11u/common.firebase-cloud-messaging.git","type":"git"},"_npmVersion":"10.2.4","description":"This package contains wrapper for firebase cloud messaging","directories":{},"_nodeVersion":"20.11.0","dependencies":{"firebase-admin":"^12.1.1","@faker-js/faker":"^7.6.0","@arunvaradharajalu/common.errors":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.7","ts-jest":"^29.1.4","@types/jest":"^29.5.12","jest-html-reporter":"^3.10.2"},"_npmOperationalInternal":{"tmp":"tmp/common.firebase-cloud-messaging_1.0.0_1718407749688_0.16369144970528327","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@arunvaradharajalu/common.firebase-cloud-messaging","version":"1.0.1","keywords":["firebase-cloud-messaging-wrapper"],"author":{"name":"Arun Varadharajalu"},"license":"ISC","_id":"@arunvaradharajalu/common.firebase-cloud-messaging@1.0.1","maintainers":[{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"}],"homepage":"https://github.com/arunv11u/common.firebase-cloud-messaging#readme","bugs":{"url":"https://github.com/arunv11u/common.firebase-cloud-messaging/issues"},"dist":{"shasum":"5b2724454a116e9ef1ae6b0f01794610cf451cbe","tarball":"https://registry.npmjs.org/@arunvaradharajalu/common.firebase-cloud-messaging/-/common.firebase-cloud-messaging-1.0.1.tgz","fileCount":11,"integrity":"sha512-+EltxaEKgKgbr+cMnEmqzV5mJu8r2BXZJi3j/9/Vz5lu40TWNycGYC5LuhvG92qCDJ1GXo8jLeNjW8NuJ3X4nA==","signatures":[{"sig":"MEYCIQCD46Wc/U4bzyct5tyKG+lqFGGMoTu/sqiSwmHVjGKg6gIhAOynExcOzONYsJOnHtUnvOcG9Ffic7xTuoDtJVUYnLyr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25503},"jest":{"roots":["<rootDir>/test"],"preset":"ts-jest","reporters":["default",["./node_modules/jest-html-reporter",{"pageTitle":"Firebase Cloud Messaging Test Report"}]],"clearMocks":true,"testEnvironment":"node"},"main":"./build/index.js","types":"./build/index.d.ts","gitHead":"0a101db85cd18f67c5e4ca38de064a1062158164","scripts":{"test":"jest --watchAll --verbose --no-cache --detectOpenHandles --env=node --coverage","build":"npm run clean && tsc --project tsconfig.build.json","clean":"rimraf build"},"_npmUser":{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"},"repository":{"url":"git+https://github.com/arunv11u/common.firebase-cloud-messaging.git","type":"git"},"_npmVersion":"10.2.4","description":"This package contains wrapper for firebase cloud messaging","directories":{},"_nodeVersion":"20.11.0","dependencies":{"firebase-admin":"^12.1.1","@arunvaradharajalu/common.errors":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.7","ts-jest":"^29.1.4","@types/jest":"^29.5.12","@faker-js/faker":"^7.6.0","jest-html-reporter":"^3.10.2"},"_npmOperationalInternal":{"tmp":"tmp/common.firebase-cloud-messaging_1.0.1_1718409445061_0.8767932253103086","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@arunvaradharajalu/common.firebase-cloud-messaging","version":"1.1.0","description":"This package contains wrapper for firebase cloud messaging","main":"./build/index.js","types":"./build/index.d.ts","scripts":{"clean":"rimraf build","build":"npm run clean && tsc --project tsconfig.build.json","test":"jest --watchAll --verbose --no-cache --detectOpenHandles --env=node --coverage"},"jest":{"preset":"ts-jest","testEnvironment":"node","roots":["<rootDir>/test"],"clearMocks":true,"reporters":["default",["./node_modules/jest-html-reporter",{"pageTitle":"Firebase Cloud Messaging Test Report"}]]},"repository":{"type":"git","url":"git+https://github.com/arunv11u/common.firebase-cloud-messaging.git"},"keywords":["firebase-cloud-messaging-wrapper"],"author":{"name":"Arun Varadharajalu"},"license":"ISC","bugs":{"url":"https://github.com/arunv11u/common.firebase-cloud-messaging/issues"},"homepage":"https://github.com/arunv11u/common.firebase-cloud-messaging#readme","devDependencies":{"@types/jest":"^29.5.12","jest-html-reporter":"^3.10.2","rimraf":"^5.0.7","ts-jest":"^29.1.4","@faker-js/faker":"^7.6.0"},"dependencies":{"@arunvaradharajalu/common.errors":"^1.0.0","firebase-admin":"^12.1.1"},"_id":"@arunvaradharajalu/common.firebase-cloud-messaging@1.1.0","gitHead":"227574af67647db88b7af518c1dba1e2a71c24d7","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-3Q4jGP5/BirUjMJwCePaOSSxibSbF7i3Fz7II5hswZgwjoT6yEf8ywUmNtOc9VchJUg7PdDuQf9jkA8iRUJYxw==","shasum":"4ed303e0a750306157e53278e2d4fc506a7ae7a5","tarball":"https://registry.npmjs.org/@arunvaradharajalu/common.firebase-cloud-messaging/-/common.firebase-cloud-messaging-1.1.0.tgz","fileCount":13,"unpackedSize":29161,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDV62MzMgb+87yjn4ON/GZ0bTPbdHBPthmRSDCcKZr7fgIhAM526EEYjAxxiU27EIClfP+oWm0NcuLtDPp/tUe7CpKp"}]},"_npmUser":{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"},"directories":{},"maintainers":[{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/common.firebase-cloud-messaging_1.1.0_1720162856049_0.6072894836467766"},"_hasShrinkwrap":false}},"time":{"created":"2024-06-14T23:29:09.623Z","modified":"2024-07-05T07:00:56.397Z","1.0.0":"2024-06-14T23:29:09.843Z","1.0.1":"2024-06-14T23:57:25.225Z","1.1.0":"2024-07-05T07:00:56.229Z"},"maintainers":[{"name":"arunvaradharajalu","email":"arunvaradharajalu@gmail.com"}],"author":{"name":"Arun Varadharajalu"},"repository":{"type":"git","url":"git+https://github.com/arunv11u/common.firebase-cloud-messaging.git"},"keywords":["firebase-cloud-messaging-wrapper"],"license":"ISC","homepage":"https://github.com/arunv11u/common.firebase-cloud-messaging#readme","bugs":{"url":"https://github.com/arunv11u/common.firebase-cloud-messaging/issues"},"readme":"# @arunvaradharajalu/common.firebase-cloud-messaging\n\n[![npm version](https://badge.fury.io/js/%40arunvaradharajalu%2Fcommon.firebase-cloud-messaging.svg)](https://badge.fury.io/js/%40arunvaradharajalu%2Fcommon.firebase-cloud-messaging)\n[![GitHub issues](https://img.shields.io/github/issues/arunv11u/common.firebase-cloud-messaging)](https://github.com/arunv11u/common.errors/firebase-cloud-messaging)\n[![GitHub license](https://img.shields.io/github/license/arunv11u/common.firebase-cloud-messaging)](https://github.com/arunv11u/common.firebase-cloud-messaging/blob/master/LICENSE)\n\nThis package contains a wrapper for Firebase Cloud Messaging (FCM), making it easier to interact with FCM in your Node.js applications.\n\n## Installation\n\nTo install the package, run:\n\n```bash\nnpm install @arunvaradharajalu/common.firebase-cloud-messaging\n```\n\n## Usage\n\nHere's a basic example of how to use this package:\n\n```typescript\nimport { firebaseCloudMessaging } from \"@arunvaradharajalu/common.firebase-cloud-messaging\";\n\n// Set your Firebase configuration\nfirebaseCloudMessaging.name = \"your-fcm-app-name\";\nfirebaseCloudMessaging.projectId = \"your-project-id\";\nfirebaseCloudMessaging.clientEmail = \"your-client-email\";\nfirebaseCloudMessaging.privateKey = \"your-private-key\";\n\n// Initialize Firebase Cloud Messaging\nfirebaseCloudMessaging.init();\n\n// Create a message to send\nconst message = {\n  token: \"recipient-fcm-token\",\n  notification: {\n    title: \"Hello\",\n    body: \"World\"\n  }\n};\n\n// Send the message\nfirebaseCloudMessaging.send(message)\n  .then(response => {\n    console.log(\"Successfully sent message:\", response);\n  })\n  .catch(error => {\n    console.error(\"Error sending message:\", error);\n  });\n```\n\n## API\n\n### Properties\n\n- `name`: Sets the name of the Firebase application.\n- `projectId`: Sets the project ID of your Firebase project.\n- `clientEmail`: Sets the client email for Firebase authentication.\n- `privateKey`: Sets the private key for Firebase authentication.\n- `fcm`: Gets the initialized Firebase app instance.\n\n### Methods\n\n- `init()`: Initializes the Firebase app with the provided configuration.\n- `send(message: FcmMessage, dryRun?: boolean): Promise<string>`: Sends a message to a device. Optionally performs a dry run (validation only).\n\n\n## Errors\n\nThis package uses custom error classes from `@arunvaradharajalu/common.errors` for specific error scenarios:\n\n- `FirebaseCloudMessagingConnectionError`: Thrown when FCM is not properly initialized before usage.\n\n## Running Tests\n\nTo run the tests, use:\n\n```bash\nnpm test\n```\n\nThe test results will be generated in an HTML report with the title \"FIrebase Cloud Messaging Test Report\".\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a pull request or open an issue for bug fixes, improvements, or new features.\n\n## Author\n\nArun Varadharajalu\n\n## License\n\nThis project is licensed under the ISC License.","readmeFilename":"README.md"}