{"_id":"@bpmromandie/notification-service-lib","_rev":"3-4bcd23e511672c12da2c3c5ce12a6c91","name":"@bpmromandie/notification-service-lib","dist-tags":{"latest":"1.0.15"},"versions":{"1.0.11":{"name":"@bpmromandie/notification-service-lib","version":"1.0.11","keywords":[],"author":"","license":"ISC","_id":"@bpmromandie/notification-service-lib@1.0.11","maintainers":[{"name":"akliluts","email":"aklilu.tsige.w@gmail.com"},{"name":"carnevluswisscom","email":"luca.carnevale@icloud.com"},{"name":"mfmanca2000","email":"mfmanca2000@hotmail.com"}],"dist":{"shasum":"07611a27a7a8a8c07200efd85a6bd99b520fa0ca","tarball":"https://registry.npmjs.org/@bpmromandie/notification-service-lib/-/notification-service-lib-1.0.11.tgz","fileCount":32,"integrity":"sha512-oh2+sqchNjIyn1Y+YzFUZza3I+ykYzSzszwGkeZfzOSuC3/o1gfr5BD6+9k2WNat5AVzN7aRROKGFA/zZ/Ipig==","signatures":[{"sig":"MEYCIQC3xkSIF8XePnF6FsBXxPNG36k8/HQ3Cfm2KfrlUaPdcgIhAIN4TX9gCmTVpQQICzfBBytWouShyHBkY4Aqd4gRudyc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28568},"main":"./dist/cjs/index.js","types":"./dist/esm/types/index.d.ts","gitHead":"b0c76e5b3046a0755b0e5a883f651aa259de4c4e","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run build:esm && npm run build:cjs","clean":"rm -rf ./dist","prepack":"npm run build","build:cjs":"tsc -p ./tsconfig.cjs.json","build:esm":"tsc -p ./tsconfig.esm.json && mv dist/esm/index.js dist/esm/index.mjs"},"_npmUser":{"name":"mfmanca2000","email":"mfmanca2000@hotmail.com"},"_npmVersion":"10.8.3","description":"The `@bpmromandie/notification-service-lib` is a library for sending notifications via different channels such as email, SMS, and UI. It provides a simple API to integrate notification services into other microservices and comes with built-in support for ","directories":{},"_nodeVersion":"20.11.0","dependencies":{"pino":"^9.4.0","axios":"^1.7.7","dotenv":"^16.4.5","pino-pretty":"^11.2.2"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.4","@types/node":"^22.5.3"},"_npmOperationalInternal":{"tmp":"tmp/notification-service-lib_1.0.11_1726436402778_0.11219574451056546","host":"s3://npm-registry-packages"}},"1.0.13":{"name":"@bpmromandie/notification-service-lib","version":"1.0.13","keywords":[],"author":"","license":"ISC","_id":"@bpmromandie/notification-service-lib@1.0.13","maintainers":[{"name":"akliluts","email":"aklilu.tsige.w@gmail.com"},{"name":"carnevluswisscom","email":"luca.carnevale@icloud.com"},{"name":"mfmanca2000","email":"mfmanca2000@hotmail.com"}],"dist":{"shasum":"d37268c6d84cd499d86b8a78ed437c4d7c230152","tarball":"https://registry.npmjs.org/@bpmromandie/notification-service-lib/-/notification-service-lib-1.0.13.tgz","fileCount":26,"integrity":"sha512-43BoeQ8FxaQ8owF/eIuTjRkGKcvQ1aKCcp9PwuMSWVbhWx7A+Seg/vgzPaFs6603uFPFY/8TKA5tIPqM0eexxA==","signatures":[{"sig":"MEUCIQDvrn+VAy3cR8vR48dijXcZPK4ruFyxKtG5odXGtOpflAIgJh384/HXzQ0DVBtJZklV4oRT/4j9DMi5E6+0nEPIHfw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26385},"main":"./dist/cjs/index.js","types":"./dist/esm/types/index.d.ts","gitHead":"8ac695580926aeef3b5f2732581c14189a9d48b2","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run build:esm && npm run build:cjs","clean":"rm -rf ./dist","prepack":"npm run build","build:cjs":"tsc -p ./tsconfig.cjs.json","build:esm":"tsc -p ./tsconfig.esm.json && mv dist/esm/index.js dist/esm/index.mjs"},"_npmUser":{"name":"mfmanca2000","email":"mfmanca2000@hotmail.com"},"_npmVersion":"10.8.3","description":"The `@bpmromandie/notification-service-lib` is a library for sending notifications via different channels such as email, SMS, and UI. It provides a simple API to integrate notification services into other microservices and comes with built-in support for ","directories":{},"_nodeVersion":"20.11.0","dependencies":{"pino":"^9.4.0","axios":"^1.7.7","dotenv":"^16.4.5","pino-pretty":"^11.2.2","@bpmromandie/kyc_common_types":"^2.0.12"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.4","@types/node":"^22.5.3"},"_npmOperationalInternal":{"tmp":"tmp/notification-service-lib_1.0.13_1726496756256_0.9255247941811804","host":"s3://npm-registry-packages"}},"1.0.14":{"name":"@bpmromandie/notification-service-lib","version":"1.0.14","keywords":[],"author":"","license":"ISC","_id":"@bpmromandie/notification-service-lib@1.0.14","maintainers":[{"name":"akliluts","email":"aklilu.tsige.w@gmail.com"},{"name":"carnevluswisscom","email":"luca.carnevale@icloud.com"},{"name":"mfmanca2000","email":"mfmanca2000@hotmail.com"}],"dist":{"shasum":"322f2d9ff42430bb0baed68c373d3cbca08ecdb9","tarball":"https://registry.npmjs.org/@bpmromandie/notification-service-lib/-/notification-service-lib-1.0.14.tgz","fileCount":26,"integrity":"sha512-tMpHRmi7ATh9BxECDTTSq+a9Tm5f3hZPLjd+uYiymiREIl3INAhaAGIuwwIQnrD1MGZjFyWiENIKeSrHdVX0kQ==","signatures":[{"sig":"MEUCIQDbpuAeV4n70CTcWGp2zY4RIjJ6j/yIpPuG+6bbMkWl2gIgBPl4z9yh3/tjBUAsoK5Yn2QybZVFuF+rfUs51j2oSRo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26461},"main":"./dist/cjs/index.js","types":"./dist/esm/types/index.d.ts","gitHead":"3addb708add8bc04f96fd51224351ba204186d2b","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run build:esm && npm run build:cjs","clean":"rm -rf ./dist","prepack":"npm run build","build:cjs":"tsc -p ./tsconfig.cjs.json","build:esm":"tsc -p ./tsconfig.esm.json && mv dist/esm/index.js dist/esm/index.mjs"},"_npmUser":{"name":"mfmanca2000","email":"mfmanca2000@hotmail.com"},"_npmVersion":"10.8.3","description":"The `@bpmromandie/notification-service-lib` is a library for sending notifications via different channels such as email, SMS, and UI. It provides a simple API to integrate notification services into other microservices and comes with built-in support for ","directories":{},"_nodeVersion":"20.11.0","dependencies":{"pino":"^9.4.0","axios":"^1.7.7","dotenv":"^16.4.5","pino-pretty":"^11.2.2","@bpmromandie/kyc_common_types":"^2.0.16"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.4","@types/node":"^22.5.3"},"_npmOperationalInternal":{"tmp":"tmp/notification-service-lib_1.0.14_1726501333973_0.05202656769182834","host":"s3://npm-registry-packages"}},"1.0.15":{"name":"@bpmromandie/notification-service-lib","version":"1.0.15","types":"./dist/esm/types/index.d.ts","main":"./dist/cjs/index.js","scripts":{"clean":"rm -rf ./dist","build":"npm run clean && npm run build:esm && npm run build:cjs","build:esm":"tsc -p ./tsconfig.esm.json && mv dist/esm/index.js dist/esm/index.mjs","build:cjs":"tsc -p ./tsconfig.cjs.json","prepack":"npm run build","test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":"","license":"ISC","description":"The `@bpmromandie/notification-service-lib` is a library for sending notifications via different channels such as email, SMS, and UI. It provides a simple API to integrate notification services into other microservices and comes with built-in support for ","dependencies":{"@bpmromandie/kyc_common_types":"^2.0.67","axios":"^1.7.7","dotenv":"^16.4.5","pino":"^9.4.0","pino-pretty":"^11.2.2"},"devDependencies":{"@types/node":"^22.5.3","typescript":"^5.5.4"},"_id":"@bpmromandie/notification-service-lib@1.0.15","gitHead":"4db0b6834dbd4211f4e96da7d929cf0540f7109f","_nodeVersion":"22.11.0","_npmVersion":"10.8.3","dist":{"integrity":"sha512-7f4PEVwwsJ+b8HmIPlhsWjguyZgZFNBrV6YXP/FDVgfnoakDWG2E2+fRh6ax/zLPrm3sYEp+VSlFvMKtNwSbrA==","shasum":"abba1484311a7b62647643e8b94ca35f6490ca1d","tarball":"https://registry.npmjs.org/@bpmromandie/notification-service-lib/-/notification-service-lib-1.0.15.tgz","fileCount":26,"unpackedSize":26987,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRkPhzswliREAVfoOHLIPEZRgpQ+y8qrXtUyPZfkpRoQIhANcIBkefVwyVSGOA5AvOxb955klJ/sPRtM+xZ4tVXLha"}]},"_npmUser":{"name":"mfmanca2000","email":"mfmanca2000@hotmail.com"},"directories":{},"maintainers":[{"name":"akliluts","email":"aklilu.tsige.w@gmail.com"},{"name":"mfmanca2000","email":"mfmanca2000@hotmail.com"},{"name":"carnevluswisscom","email":"luca.carnevale@icloud.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/notification-service-lib_1.0.15_1732813305936_0.3412130035847998"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-15T21:40:02.544Z","modified":"2024-11-28T17:01:46.408Z","1.0.11":"2024-09-15T21:40:02.911Z","1.0.13":"2024-09-16T14:25:56.443Z","1.0.14":"2024-09-16T15:42:14.123Z","1.0.15":"2024-11-28T17:01:46.130Z"},"license":"ISC","keywords":[],"description":"The `@bpmromandie/notification-service-lib` is a library for sending notifications via different channels such as email, SMS, and UI. It provides a simple API to integrate notification services into other microservices and comes with built-in support for ","maintainers":[{"name":"akliluts","email":"aklilu.tsige.w@gmail.com"},{"name":"mfmanca2000","email":"mfmanca2000@hotmail.com"},{"name":"carnevluswisscom","email":"luca.carnevale@icloud.com"}],"readme":"# @bpmromandie/notification-service-lib\r\nThe `@bpmromandie/notification-service-lib` is a library for sending notifications via different channels such as email, SMS, and UI. It provides a simple API to integrate notification services into other microservices and comes with built-in support for checking notification service health.\r\n\r\n## Features\r\n\r\n- Send notifications through various channels: email, SMS, UI, and queue.\r\n- Configurable via constructor for flexibility.\r\n- Supports Axios for making HTTP requests.\r\n- Easily integrable with different logging solutions.\r\n- Supports TypeScript with type declarations.\r\n\r\n## Login, Build, publish and View\r\n####  To Login \r\n````bash\r\nnpm login --registry=https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/ --auth-type=web\r\n````\r\n#### Build and publish\r\n````bash\r\nnpm run build\r\nnpm publish\r\n````\r\n#### To view\r\n````bash\r\nnpm view @bpmromandie/notification-service-lib --registry=https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/\r\n````\r\n\r\n## Installation\r\n\r\nYou can install the library using npm from our private Artifactory registry (https://bin.swisscom.com/artifactory):\r\n\r\n```bash\r\nnpm install @bpmromandie/notification-service-lib --registry=https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/\r\n````\r\nOr if you're testing locally and using npm link\r\n````bash\r\nnpm link notification-service-lib\r\n````\r\nOr if you using npm pack for local testing\r\n````\r\ncd ../libs/notification-service-lib\r\nnpm pack\r\n````\r\n\r\n\r\n## Usage\r\n\r\n### Import the Library\r\n````typescript\r\nimport NotificationService from '@bpmromandie/notification-service-lib';\r\n````\r\n### Sending Notifications \r\nTo send a notification, we need to create an instance of notificationService and use the sendNotification method.\r\n````typescript\r\nconst notificationService = new NotificationService({\r\n  baseURL: process.env.API_NOTIFICATION_URL || 'http://localhost:6003',// Fallback to a default URL\r\n  timeout: 10000, // Optional: You can set a custom timeout (default is 5000ms)\r\n});\r\n\r\nconst notificationContent = {\r\n  subject: 'KYC Rievew',\r\n  body: 'Please verify your account by clicking the link.',\r\n  recipient: 'user@example.com',\r\n};\r\n\r\n// Sending an email notification\r\nnotificationService.sendNotification('email', notificationContent)\r\n  .then(response => {\r\n    console.log('Notification sent successfully:', response);\r\n  })\r\n  .catch(error => {\r\n    console.error('Failed to send notification:', error);\r\n  });\r\n\r\n````\r\n\r\n### Checking Service Health\r\nTo verify if the notification service is running, use the checkNotificationConnection method:\r\n````typescript\r\nnotificationService.checkNotificationConnection()\r\n  .then(isHealthy => {\r\n    if (isHealthy) {\r\n      console.log('Notification service is healthy');\r\n    } else {\r\n      console.log('Notification service is down');\r\n    }\r\n  })\r\n  .catch(error => {\r\n    console.error('Error checking service health:', error);\r\n  });\r\n\r\n````\r\n\r\n## Configuration\r\nWhen initializing the NotificationService, you can configure the following options:\r\n\r\n- baseURL (required): The base URL of the notification service (e.g., http://localhost:6003).\r\n- timeout (optional): The maximum time (in milliseconds) before a request times out. Default is 5000.\r\n````typescript\r\nconst notificationService = new NotificationService({\r\n  baseURL: 'http://localhost:6003',\r\n  timeout: 8000,\r\n});\r\n````\r\n\r\n#### API - NotificationService\r\n- Constructor\r\n````typescript\r\nconstructor(config: { baseURL: string; timeout?: number });\r\n\r\n````\r\n- Methods : sendNotification(channel: string, content: any): Promise<any>\r\n\r\nSends a notification via the specified channel.\r\n\r\n- channel: The notification channel ('email', 'sms', 'ui', 'queue').\r\n- content: The content of the notification (e.g., subject, body, recipient).\r\n\r\n\r\n# Clean and Install Script\r\n\r\n#### The script used to clean up old dependencies and install both public and private npm packages from specified registries.\r\n- The script is available for both ***Linux/macOS*** (bash: clean-and-install.sh) and ***Windows*** (using PowerShell: clean-and-install.ps1).\r\n\r\n### Features\r\n\r\n- Cleans up `node_modules` and `package-lock.json`.\r\n- Cleans the npm cache.\r\n- Installs public npm packages from the public npm registry.\r\n- Installs private npm packages (https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/).\r\n- Verifies successful installation of private packages.\r\n- Prompts for user confirmation before starting and logs all actions.\r\n- Requires the user to press any key to close the script after it finishes, allowing them to review the logs.\r\n\r\n### Requirements\r\n- **npm**: Ensure that `npm` is installed and available in your system's PATH.\r\n- **Private npm registry**: If you're using a private npm registry (https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/), make sure to have the necessary authentication set up (e.g., using `.npmrc`).\r\n\r\n### Installation\r\n\r\n### `.npmrc` Configuration (Recommended)\r\n\r\nFor the correct registry settings, add the following to your project's `.npmrc` file:\r\n\r\n```ini\r\n# Use the default npm registry for public packages\r\nregistry=https://registry.npmjs.org/\r\n\r\n# Use the private Artifactory registry for @bpmromandie scope\r\n@bpmromandie:registry=https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/\r\n```\r\nThis ensures that public packages are fetched from the public registry and private packages (under @bpmromandie) are fetched from your Artifactory registry.\r\n\r\n### Usage Instructions\r\n##### For Linux/macOS Users (Bash)\r\n1. Open a terminal.\r\n\r\n2. Navigate to the project directory.\r\n\r\n3. Make sure the script is executable:\r\n   ````bash\r\n   chmod +x clean-and-install.sh\r\n   ````\r\n4. Run the script:\r\n   ````bash\r\n   ./clean-and-install.sh\r\n   ````\r\n5. The script will:\r\n\t- Prompt for confirmation to clean and install dependencies.\r\n\t- Remove node_modules and package-lock.json.\r\n\t- Clean the npm cache.\r\n\t- Install public and private packages.\r\n\t- Prompt for any key to be pressed before exiting to allow log review.\r\n\r\n##### For Windows Users (PowerShell)\r\n1. Open a PowerShell.\r\n2. Navigate to the project directory.\r\n3. Run the script:\r\n   ````powershell\r\n   ./clean-and-install.ps1\r\n   ````\r\n4. The script will:\r\n\t- Prompt for confirmation to clean and install dependencies.\r\n\t- Remove node_modules and package-lock.json.\r\n\t- Clean the npm cache.\r\n\t- Install public and private packages.\r\n\t- Prompt for any key to be pressed before exiting to allow log review.\r\n\r\n### Environment Variables\r\n#### The script uses the following environment variables:\r\n\r\n- PRIVATE_NPM_REGISTRY: The URL of your private npm registry (https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/). You can set it manually in the script if not using .npmrc.\r\n\r\n### Logs and Output\r\n#### The script provides detailed logs during execution:\r\n\r\n- [INFO]: General informational messages.\r\n\t- [ERROR]: Error messages in case of failures.\r\n\t    ````bash\r\n\t\tAre you sure you want to clean and install (y/n)? y\r\n\t\t[INFO] Starting clean and install process...\r\n\t\t[INFO] Cleaning up old node_modules and package-lock.json...\r\n\t\t[INFO] Removed node_modules.\r\n\t\t[INFO] Removed package-lock.json.\r\n\t\t[INFO] Cleaning npm cache...\r\n\t\t[INFO] Installing public npm packages from https://registry.npmjs.org/...\r\n\t\t[INFO] Installing private npm packages from https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/...\r\n\t\t[INFO] Installing @bpmromandie/notification-service-lib...\r\n\t\t[INFO] Installing @bpmromandie/kyc_common_types...\r\n\t\t[INFO] All packages installed successfully.\r\n\t\tPress any key to close...\r\n  \r\n\t\t````\r\n### Dockerfile.dev - Development Environment\r\n\r\nThis includes a development Dockerfile (`Dockerfile.dev`) that sets up a Node.js development environment with `nodemon` for hot reloading, installs public and private npm packages, and runs your app as a non-root user.\r\n\r\n#### Features\r\n\r\n- **Hot Reloading**: The development environment includes `nodemon` for automatic app restarts upon file changes.\r\n- **Private and Public NPM Registry Configuration**: Handles both public and private npm packages from your specified registry.\r\n- **Non-Root User**: Runs the application using a non-root user for improved security.\r\n- **Environment Variables**: Copies environment configuration from `.env.default` to `.env`.\r\n\r\n#### Requirements\r\n\r\n- **Docker**: Ensure that Docker is installed and running on your machine.\r\n- **Private NPM Registry**: If your project uses private npm packages (e.g., Artifactory), make sure your `.npmrc` is correctly configured for authentication.\r\n\r\n#### Setup\r\n\r\n##### 1. `.npmrc` Configuration for Private NPM Registry\r\n\r\nIf your project uses private npm packages (e.g., `@bpmromandie` scope), you must configure `.npmrc` with the correct registry and credentials. Here's an example `.npmrc` file:\r\n\r\n```ini\r\n@bpmromandie:registry=https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/\r\n//bin.swisscom.com/artifactory/api/npm/kyc-npm-local/:username=YOUR_USERNAME\r\n//bin.swisscom.com/artifactory/api/npm/kyc-npm-local/:_password=YOUR_BASE64_ENCODED_PASSWORD\r\n//bin.swisscom.com/artifactory/api/npm/kyc-npm-local/:email=YOUR_EMAIL\r\n```\r\n- Replace YOUR_USERNAME, YOUR_BASE64_ENCODED_PASSWORD, and YOUR_EMAIL with your actual credentials.\r\n- Ensure .npmrc is in your project root and will be copied during the Docker build process.\r\n\r\n\r\n\r\n## Quick local setup\r\n- npm config set @bpmromandie:registry https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/\r\n- npm login --scope=@bpmromandie --registry=https://bin.swisscom.com/artifactory/api/npm/kyc-npm-local/\r\n- npm i\r\n- modify the package version in package.json\r\n- npm run build\r\n- npm publish","readmeFilename":"README.md"}