vintasend 0.6.0 → 0.6.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/README.md CHANGED
@@ -347,6 +347,8 @@ VintaSend has many backend, adapter, and template renderer implementations. If y
347
347
  * **[vintasend-nodemailer](https://github.com/vintasoftware/vintasend-nodemailer/)**: Uses nodemailer to send transactional emails to users.
348
348
  * **[vintasend-sendgrid](https://github.com/vintasoftware/vintasend-ts-sendgrid/)**: Uses SendGrid's API to send transactional emails with attachment support.
349
349
  * **[vintasend-medplum](https://github.com/vintasoftware/vintasend-medplum/)**: Uses Medplum's email API to send notifications in healthcare applications.
350
+ * **[vintasend-mailgun](https://github.com/vintasoftware/vintasend-ts-mailgun/)**: Uses Mailgun's API to send transactional emails with attachment support.
351
+ * **[vintasend-twilio](https://github.com/vintasoftware/vintasend-ts-twilio/)**: Uses Twilio's API to send transactional SMS.
350
352
 
351
353
  ##### Attachment Managers
352
354
 
@@ -57,6 +57,25 @@ export type NotificationFilter<Config extends BaseNotificationTypeConfig> = Noti
57
57
  } | {
58
58
  not: NotificationFilter<Config>;
59
59
  };
60
+ export declare const DEFAULT_BACKEND_FILTER_CAPABILITIES: {
61
+ 'logical.and': boolean;
62
+ 'logical.or': boolean;
63
+ 'logical.not': boolean;
64
+ 'logical.notNested': boolean;
65
+ 'fields.status': boolean;
66
+ 'fields.notificationType': boolean;
67
+ 'fields.adapterUsed': boolean;
68
+ 'fields.userId': boolean;
69
+ 'fields.bodyTemplate': boolean;
70
+ 'fields.subjectTemplate': boolean;
71
+ 'fields.contextName': boolean;
72
+ 'fields.sendAfterRange': boolean;
73
+ 'fields.createdAtRange': boolean;
74
+ 'fields.sentAtRange': boolean;
75
+ 'negation.sendAfterRange': boolean;
76
+ 'negation.createdAtRange': boolean;
77
+ 'negation.sentAtRange': boolean;
78
+ };
60
79
  export interface BaseNotificationBackend<Config extends BaseNotificationTypeConfig> {
61
80
  getAllPendingNotifications(): Promise<AnyDatabaseNotification<Config>[]>;
62
81
  getPendingNotifications(page: number, pageSize: number): Promise<AnyDatabaseNotification<Config>[]>;
@@ -103,8 +122,8 @@ export interface BaseNotificationBackend<Config extends BaseNotificationTypeConf
103
122
  * - `logical.and`, `logical.or`, `logical.not`, `logical.notNested`
104
123
  * - `fields.status`, `fields.notificationType`, `fields.adapterUsed`, `fields.userId`,
105
124
  * `fields.bodyTemplate`, `fields.subjectTemplate`, `fields.contextName`,
106
- * `fields.sendAfterRange`, `fields.createdAtRange`, `fields.sentAtRange`
107
- * - `negation.sendAfterRange`, `negation.createdAtRange`, `negation.sentAtRange`
125
+ * `fields.sendAfterRange`, `fields.createdAtRange`, `fields.sentAtRange`
126
+ * - `negation.sendAfterRange`, `negation.createdAtRange`, `negation.sentAtRange`
108
127
  *
109
128
  * If this method is not implemented, all features are assumed to be supported.
110
129
  * If this method is implemented, missing keys default to true (supported) for forward compatibility.
@@ -1,7 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_BACKEND_FILTER_CAPABILITIES = void 0;
3
4
  exports.isFieldFilter = isFieldFilter;
4
5
  exports.supportsAttachments = supportsAttachments;
6
+ exports.DEFAULT_BACKEND_FILTER_CAPABILITIES = {
7
+ 'logical.and': true,
8
+ 'logical.or': true,
9
+ 'logical.not': true,
10
+ 'logical.notNested': true,
11
+ 'fields.status': true,
12
+ 'fields.notificationType': true,
13
+ 'fields.adapterUsed': true,
14
+ 'fields.userId': true,
15
+ 'fields.bodyTemplate': true,
16
+ 'fields.subjectTemplate': true,
17
+ 'fields.contextName': true,
18
+ 'fields.sendAfterRange': true,
19
+ 'fields.createdAtRange': true,
20
+ 'fields.sentAtRange': true,
21
+ 'negation.sendAfterRange': true,
22
+ 'negation.createdAtRange': true,
23
+ 'negation.sentAtRange': true,
24
+ };
5
25
  /**
6
26
  * Type guard to check if a filter is a field filter (leaf node).
7
27
  */
@@ -5,7 +5,7 @@ import type { OneOffNotificationInput } from '../types/one-off-notification';
5
5
  import type { BaseAttachmentManager } from './attachment-manager/base-attachment-manager';
6
6
  import type { BaseLogger } from './loggers/base-logger';
7
7
  import { type BaseNotificationAdapter } from './notification-adapters/base-notification-adapter';
8
- import type { BaseNotificationBackend } from './notification-backends/base-notification-backend';
8
+ import { type BaseNotificationBackend, type NotificationFilterFields } from './notification-backends/base-notification-backend';
9
9
  import type { BaseNotificationQueueService } from './notification-queue-service/base-notification-queue-service';
10
10
  import type { BaseNotificationTemplateRenderer } from './notification-template-renderers/base-notification-template-renderer';
11
11
  type VintaSendOptions = {
@@ -86,6 +86,26 @@ export declare class VintaSend<Config extends BaseNotificationTypeConfig, Adapte
86
86
  getNotifications(page: number, pageSize: number): Promise<AnyDatabaseNotification<Config>[]>;
87
87
  getOneOffNotifications(page: number, pageSize: number): Promise<DatabaseOneOffNotification<Config>[]>;
88
88
  getNotification(notificationId: Config['NotificationIdType'], forUpdate?: boolean): Promise<AnyDatabaseNotification<Config> | null>;
89
+ filterNotifications(filter: NotificationFilterFields<Config>, page: number, pageSize: number): Promise<AnyDatabaseNotification<Config>[]>;
90
+ getBackendSupportedFilterCapabilities(): Promise<{
91
+ 'logical.and': boolean;
92
+ 'logical.or': boolean;
93
+ 'logical.not': boolean;
94
+ 'logical.notNested': boolean;
95
+ 'fields.status': boolean;
96
+ 'fields.notificationType': boolean;
97
+ 'fields.adapterUsed': boolean;
98
+ 'fields.userId': boolean;
99
+ 'fields.bodyTemplate': boolean;
100
+ 'fields.subjectTemplate': boolean;
101
+ 'fields.contextName': boolean;
102
+ 'fields.sendAfterRange': boolean;
103
+ 'fields.createdAtRange': boolean;
104
+ 'fields.sentAtRange': boolean;
105
+ 'negation.sendAfterRange': boolean;
106
+ 'negation.createdAtRange': boolean;
107
+ 'negation.sentAtRange': boolean;
108
+ }>;
89
109
  /**
90
110
  * Gets a one-off notification by ID.
91
111
  *
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VintaSend = exports.VintaSendFactory = void 0;
4
4
  const base_notification_adapter_1 = require("./notification-adapters/base-notification-adapter");
5
+ const base_notification_backend_1 = require("./notification-backends/base-notification-backend");
5
6
  const notification_context_generators_map_1 = require("./notification-context-generators-map");
6
7
  class VintaSendFactory {
7
8
  /**
@@ -264,6 +265,13 @@ class VintaSend {
264
265
  async getNotification(notificationId, forUpdate = false) {
265
266
  return this.backend.getNotification(notificationId, forUpdate);
266
267
  }
268
+ async filterNotifications(filter, page, pageSize) {
269
+ return this.backend.filterNotifications(filter, page, pageSize);
270
+ }
271
+ async getBackendSupportedFilterCapabilities() {
272
+ var _a, _b, _c;
273
+ return { ...base_notification_backend_1.DEFAULT_BACKEND_FILTER_CAPABILITIES, ...((_c = (_b = (_a = this.backend).getFilterCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : {}) };
274
+ }
267
275
  /**
268
276
  * Gets a one-off notification by ID.
269
277
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vintasend",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist"