@clipboard-health/notifications 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@clipboard-health/notifications",
3
3
  "description": "Send notifications through third-party providers.",
4
- "version": "1.2.1",
4
+ "version": "1.2.2",
5
5
  "bugs": "https://github.com/ClipboardHealth/core-utils/issues",
6
6
  "dependencies": {
7
7
  "@clipboard-health/background-jobs-adapter": "0.5.1",
@@ -1,4 +1,4 @@
1
- import { type BackgroundJobsAdapter, type MongoEnqueueOptions, type PostgresEnqueueOptions } from "@clipboard-health/background-jobs-adapter";
1
+ import { type BackgroundJobsAdapter, type EnqueueOptions, type MongoEnqueueOptions, type PostgresEnqueueOptions } from "@clipboard-health/background-jobs-adapter";
2
2
  import { type TriggerIdempotencyKey } from "./triggerIdempotencyKey";
3
3
  type EnqueueParameters = Parameters<BackgroundJobsAdapter["enqueue"]>;
4
4
  export interface IdempotencyKey {
@@ -79,11 +79,14 @@ export interface NotificationData<T> {
79
79
  /**
80
80
  * `enqueueOneOrMore` sets `idempotencyKey`/`unique` automatically, so it's not accepted here.
81
81
  *
82
- * `startAt` is also not accepted. To prevent stale recipient lists, notification jobs shouldn't
83
- * start in the future. Use `startAt` to schedule a normal job in the future that, when executed,
84
- * looks up recipients and queues a notification job that runs immediately.
82
+ * Use `startAt` with care to prevent stale recipient lists. To prevent stale recipient lists, it
83
+ * may make more sense to schedule a normal job in the future that, when executed, looks up
84
+ * recipients and queues a notification job that runs immediately.
85
+ *
86
+ * There are valid use cases for `startAt`, however. For example, if you do checks in your job (or
87
+ * in a service the job calls) to validate the notification is still valid prior to triggering it.
85
88
  */
86
- export type EnqueueOneOrMoreOptions = Pick<MongoEnqueueOptions, "session"> | Pick<PostgresEnqueueOptions, "transaction">;
89
+ export type EnqueueOneOrMoreOptions = Pick<EnqueueOptions, "startAt"> & (Pick<MongoEnqueueOptions, "session" | "startAt"> | Pick<PostgresEnqueueOptions, "transaction" | "startAt">);
87
90
  interface NotificationJobEnqueuerParams {
88
91
  adapter: BackgroundJobsAdapter;
89
92
  }
@@ -1 +1 @@
1
- {"version":3,"file":"notificationJobEnqueuer.js","sourceRoot":"","sources":["../../../../../packages/notifications/src/lib/notificationJobEnqueuer.ts"],"names":[],"mappings":";;;AAAA,uFAKmD;AAEnD,gEAA6D;AAC7D,oGAAiG;AACjG,mEAIiC;AA4GjC,MAAa,uBAAuB;IACjB,OAAO,CAA2C;IAEnE,YAAY,MAAqC;QAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QAE3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmEG;IACH,KAAK,CAAC,gBAAgB,CACpB,sBAA4C,EAC5C,IAAkB,EAClB,OAAiC;QAEjC,MAAM,OAAO,CAAC,GAAG,CACf,IAAA,iCAAe,EAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE;YACpF,MAAM,oBAAoB,GAAgC;gBACxD,GAAG,IAAI,CAAC,cAAc;gBACtB,KAAK,EAAE,MAAM;gBACb,UAAU;gBACV,WAAW,EAAE,IAAI,CAAC,WAAW;aAC9B,CAAC;YAEF,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CACxB,sBAAsB,EACtB;gBACE,GAAG,IAAI;gBACP,UAAU;gBACV,cAAc,EAAE,IAAA,yDAAiC,EAAC,oBAAoB,CAAC;aACxE,EACD;gBACE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClC,CAAC,6CAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,EAC/D,IAAA,qEAAiC,EAAC,oBAAoB,CAAC;aAC1D,CACF,CAAC;QACJ,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF;AA3GD,0DA2GC"}
1
+ {"version":3,"file":"notificationJobEnqueuer.js","sourceRoot":"","sources":["../../../../../packages/notifications/src/lib/notificationJobEnqueuer.ts"],"names":[],"mappings":";;;AAAA,uFAMmD;AAEnD,gEAA6D;AAC7D,oGAAiG;AACjG,mEAIiC;AAiHjC,MAAa,uBAAuB;IACjB,OAAO,CAA2C;IAEnE,YAAY,MAAqC;QAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QAE3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmEG;IACH,KAAK,CAAC,gBAAgB,CACpB,sBAA4C,EAC5C,IAAkB,EAClB,OAAiC;QAEjC,MAAM,OAAO,CAAC,GAAG,CACf,IAAA,iCAAe,EAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE;YACpF,MAAM,oBAAoB,GAAgC;gBACxD,GAAG,IAAI,CAAC,cAAc;gBACtB,KAAK,EAAE,MAAM;gBACb,UAAU;gBACV,WAAW,EAAE,IAAI,CAAC,WAAW;aAC9B,CAAC;YAEF,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CACxB,sBAAsB,EACtB;gBACE,GAAG,IAAI;gBACP,UAAU;gBACV,cAAc,EAAE,IAAA,yDAAiC,EAAC,oBAAoB,CAAC;aACxE,EACD;gBACE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClC,CAAC,6CAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,EAC/D,IAAA,qEAAiC,EAAC,oBAAoB,CAAC;aAC1D,CACF,CAAC;QACJ,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF;AA3GD,0DA2GC"}