Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tngtech/momo-scheduler

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tngtech/momo-scheduler - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

5

CHANGELOG.md

@@ -6,2 +6,7 @@ # Change Log

## v2.3.0 (2024-10-18)
- Feat: Add option to pass MongoClientOptions to momo ([#857](https://github.com/TNG/momo-scheduler/issues/857))
- Feat: Add index for scheduleId column ([#839](https://github.com/TNG/momo-scheduler/issues/839))
- Chore: Dependency updates
## v2.2.0 (2024-09-13)

@@ -8,0 +13,0 @@ - Chore: Dependency updates

9

dist/Connection.d.ts

@@ -0,1 +1,2 @@

import { MongoClientOptions } from 'mongodb';
import { SchedulesRepository } from './repository/SchedulesRepository';

@@ -9,2 +10,8 @@ import { JobRepository } from './repository/JobRepository';

/**
* Additional options for the connection to the Mongo client.
* Refer to MongoClientOptions in the MongoDB API documentation for a list of all available settings.
* Useful for providing configuration options that are not available via the connection string (url).
*/
mongoClientOptions?: MongoClientOptions;
/**
* Used to prefix all mongodb collections created by Momo.

@@ -19,3 +26,3 @@ */

private constructor();
static create({ url, collectionsPrefix }: MomoConnectionOptions, pingIntervalMs: number, scheduleId: string, scheduleName: string): Promise<Connection>;
static create({ url, mongoClientOptions, collectionsPrefix }: MomoConnectionOptions, pingIntervalMs: number, scheduleId: string, scheduleName: string): Promise<Connection>;
getSchedulesRepository(): SchedulesRepository;

@@ -22,0 +29,0 @@ getJobRepository(): JobRepository;

4

dist/Connection.js

@@ -15,4 +15,4 @@ "use strict";

static create(_a, pingIntervalMs_1, scheduleId_1, scheduleName_1) {
return tslib_1.__awaiter(this, arguments, void 0, function* ({ url, collectionsPrefix }, pingIntervalMs, scheduleId, scheduleName) {
const mongoClient = new mongodb_1.MongoClient(url);
return tslib_1.__awaiter(this, arguments, void 0, function* ({ url, mongoClientOptions, collectionsPrefix }, pingIntervalMs, scheduleId, scheduleName) {
const mongoClient = new mongodb_1.MongoClient(url, mongoClientOptions);
yield mongoClient.connect();

@@ -19,0 +19,0 @@ const schedulesRepository = new SchedulesRepository_1.SchedulesRepository(mongoClient, 2 * pingIntervalMs, scheduleId, scheduleName, collectionsPrefix);

@@ -110,2 +110,3 @@ "use strict";

yield this.collection.createIndex({ name: 1 }, { unique: true });
yield this.collection.createIndex({ scheduleId: 1 }, { unique: true });
});

@@ -112,0 +113,0 @@ }

{
"name": "@tngtech/momo-scheduler",
"version": "2.2.0",
"version": "2.3.0",
"description": "momo is a scheduler that persists jobs in mongodb",

@@ -46,17 +46,17 @@ "main": "dist/index.js",

"devDependencies": {
"@sinonjs/fake-timers": "13.0.1",
"@sinonjs/fake-timers": "13.0.3",
"@stylistic/eslint-plugin": "^2.8.0",
"@types/human-interval": "1.0.2",
"@types/jest": "29.5.13",
"@types/lodash": "4.17.7",
"@types/lodash": "4.17.10",
"@types/luxon": "3.4.2",
"@types/node": "20.16.5",
"@types/node": "20.16.12",
"@types/sinonjs__fake-timers": "8.1.5",
"@types/uuid": "10.0.0",
"@typescript-eslint/eslint-plugin": "8.5.0",
"@typescript-eslint/parser": "8.5.0",
"eslint": "9.10.0",
"@typescript-eslint/eslint-plugin": "8.10.0",
"@typescript-eslint/parser": "8.10.0",
"eslint": "9.12.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jest": "28.8.3",
"eslint-plugin-jsdoc": "50.2.3",
"eslint-plugin-jsdoc": "50.4.3",
"eslint-plugin-markdown": "5.1.0",

@@ -66,4 +66,4 @@ "eslint-plugin-prefer-arrow": "1.2.3",

"jest": "29.7.0",
"mongodb-memory-server": "10.0.0",
"pino": "9.4.0",
"mongodb-memory-server": "10.1.2",
"pino": "9.5.0",
"prettier": "3.3.3",

@@ -73,4 +73,4 @@ "ts-jest": "29.2.5",

"ts-node": "10.9.2",
"typescript": "5.6.2"
"typescript": "5.6.3"
}
}

@@ -153,8 +153,9 @@ # Momo scheduler <img src="momo_logo.svg" align="right" />

| property | type | mandatory | default | description |
|-------------------|----------|-----------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| url | `string` | yes | | The connection string of your database. |
| scheduleName | `string` | yes | | Only one schedule per name can be active at a time. If multiple instances of your application define a schedule with the same name, only one at a time will actually run jobs. |
| collectionsPrefix | `string` | no | no prefix | A prefix for all collections created by Momo. |
| pingIntervalMs | number | no | `60_000` | The keep alive ping interval of the schedule, in milliseconds. After twice the amount of time has elapsed without a ping of your Momo instance, other instances may take over. You might want to reduce this if you have jobs running on short intervals. |
| property | type | mandatory | default | description |
|--------------------|----------------------|-----------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| url | `string` | yes | | The connection string of your database. |
| scheduleName | `string` | yes | | Only one schedule per name can be active at a time. If multiple instances of your application define a schedule with the same name, only one at a time will actually run jobs. |
| collectionsPrefix | `string` | no | no prefix | A prefix for all collections created by Momo. |
| pingIntervalMs | number | no | `60_000` | The keep alive ping interval of the schedule, in milliseconds. After twice the amount of time has elapsed without a ping of your Momo instance, other instances may take over. You might want to reduce this if you have jobs running on short intervals. |
| mongoClientOptions | `MongoClientOptions` | no | | Options for the connection to the MongoDB client as specified by the MongoDB API. Useful for providing configuration options that are not available via the connection string (url). |

@@ -161,0 +162,0 @@ ### Reacting to events

@@ -1,2 +0,2 @@

import { MongoClient } from 'mongodb';
import { MongoClient, MongoClientOptions } from 'mongodb';

@@ -12,2 +12,8 @@ import { SchedulesRepository } from './repository/SchedulesRepository';

/**
* Additional options for the connection to the Mongo client.
* Refer to MongoClientOptions in the MongoDB API documentation for a list of all available settings.
* Useful for providing configuration options that are not available via the connection string (url).
*/
mongoClientOptions?: MongoClientOptions;
/**
* Used to prefix all mongodb collections created by Momo.

@@ -26,3 +32,3 @@ */

static async create(
{ url, collectionsPrefix }: MomoConnectionOptions,
{ url, mongoClientOptions, collectionsPrefix }: MomoConnectionOptions,
pingIntervalMs: number,

@@ -32,3 +38,3 @@ scheduleId: string,

): Promise<Connection> {
const mongoClient = new MongoClient(url);
const mongoClient = new MongoClient(url, mongoClientOptions);
await mongoClient.connect();

@@ -35,0 +41,0 @@

@@ -135,2 +135,3 @@ import { Filter, FindOneAndUpdateOptions, MongoClient, MongoServerError } from 'mongodb';

await this.collection.createIndex({ name: 1 }, { unique: true });
await this.collection.createIndex({ scheduleId: 1 }, { unique: true });
}

@@ -137,0 +138,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc