@clipboard-health/ai-rules 1.6.9 → 1.6.10

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/backend/AGENTS.md CHANGED
@@ -23,7 +23,7 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
23
23
 
24
24
  <embedex source="packages/notifications/examples/usage.md">
25
25
 
26
- ## `triggerChunked`
26
+ ### `triggerChunked`
27
27
 
28
28
  `triggerChunked` stores the full, immutable trigger request at job enqueue time, eliminating issues with stale data, chunking requests to stay under provider limits, and idempotency key conflicts that can occur if the request is updated at job execution time.
29
29
 
@@ -48,8 +48,8 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
48
48
  import { TRIGGER_NOTIFICATION_JOB_NAME } from "./triggerNotification.constants";
49
49
 
50
50
  /**
51
- * For mongo-jobs, implement HandlerInterface<SerializableTriggerChunkedRequest>.
52
- * For background-jobs-postgres, implement Handler<SerializableTriggerChunkedRequest>.
51
+ * For mongo-jobs, implement `HandlerInterface<SerializableTriggerChunkedRequest>`.
52
+ * For background-jobs-postgres, implement `Handler<SerializableTriggerChunkedRequest>`.
53
53
  */
54
54
  export class TriggerNotificationJob implements BaseHandler<SerializableTriggerChunkedRequest> {
55
55
  public name = TRIGGER_NOTIFICATION_JOB_NAME;
@@ -63,6 +63,10 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
63
63
 
64
64
  public async perform(
65
65
  data: SerializableTriggerChunkedRequest,
66
+ /**
67
+ * For mongo-jobs, implement `BackgroundJobType<SerializableTriggerChunkedRequest>`, which has _id, attemptsCount, and uniqueKey.
68
+ * For background-jobs-postgres, implement `Job<SerializableTriggerChunkedRequest>`, which has id, retryAttempts, and idempotencyKey.
69
+ */
66
70
  job: { _id: string; attemptsCount: number; uniqueKey?: string },
67
71
  ) {
68
72
  const metadata = {
@@ -72,7 +76,7 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
72
76
  recipientCount: data.body.recipients.length,
73
77
  workflowKey: data.workflowKey,
74
78
  };
75
- this.logger.info("Processing", metadata);
79
+ this.logger.info("TriggerNotificationJob processing", metadata);
76
80
 
77
81
  try {
78
82
  const request = toTriggerChunkedRequest(data, {
@@ -85,9 +89,11 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
85
89
  throw result.error;
86
90
  }
87
91
 
88
- this.logger.info("Success", { ...metadata, response: result.value });
92
+ const success = "TriggerNotificationJob success";
93
+ this.logger.info(success, { ...metadata, response: result.value });
94
+ // For background-jobs-postgres, return the `success` string result.
89
95
  } catch (error) {
90
- this.logger.error("Failure", { ...metadata, error });
96
+ this.logger.error("TriggerNotificationJob failure", { ...metadata, error });
91
97
  throw error;
92
98
  }
93
99
  }
@@ -23,7 +23,7 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
23
23
 
24
24
  <embedex source="packages/notifications/examples/usage.md">
25
25
 
26
- ## `triggerChunked`
26
+ ### `triggerChunked`
27
27
 
28
28
  `triggerChunked` stores the full, immutable trigger request at job enqueue time, eliminating issues with stale data, chunking requests to stay under provider limits, and idempotency key conflicts that can occur if the request is updated at job execution time.
29
29
 
@@ -48,8 +48,8 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
48
48
  import { TRIGGER_NOTIFICATION_JOB_NAME } from "./triggerNotification.constants";
49
49
 
50
50
  /**
51
- * For mongo-jobs, implement HandlerInterface<SerializableTriggerChunkedRequest>.
52
- * For background-jobs-postgres, implement Handler<SerializableTriggerChunkedRequest>.
51
+ * For mongo-jobs, implement `HandlerInterface<SerializableTriggerChunkedRequest>`.
52
+ * For background-jobs-postgres, implement `Handler<SerializableTriggerChunkedRequest>`.
53
53
  */
54
54
  export class TriggerNotificationJob implements BaseHandler<SerializableTriggerChunkedRequest> {
55
55
  public name = TRIGGER_NOTIFICATION_JOB_NAME;
@@ -63,6 +63,10 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
63
63
 
64
64
  public async perform(
65
65
  data: SerializableTriggerChunkedRequest,
66
+ /**
67
+ * For mongo-jobs, implement `BackgroundJobType<SerializableTriggerChunkedRequest>`, which has _id, attemptsCount, and uniqueKey.
68
+ * For background-jobs-postgres, implement `Job<SerializableTriggerChunkedRequest>`, which has id, retryAttempts, and idempotencyKey.
69
+ */
66
70
  job: { _id: string; attemptsCount: number; uniqueKey?: string },
67
71
  ) {
68
72
  const metadata = {
@@ -72,7 +76,7 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
72
76
  recipientCount: data.body.recipients.length,
73
77
  workflowKey: data.workflowKey,
74
78
  };
75
- this.logger.info("Processing", metadata);
79
+ this.logger.info("TriggerNotificationJob processing", metadata);
76
80
 
77
81
  try {
78
82
  const request = toTriggerChunkedRequest(data, {
@@ -85,9 +89,11 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
85
89
  throw result.error;
86
90
  }
87
91
 
88
- this.logger.info("Success", { ...metadata, response: result.value });
92
+ const success = "TriggerNotificationJob success";
93
+ this.logger.info(success, { ...metadata, response: result.value });
94
+ // For background-jobs-postgres, return the `success` string result.
89
95
  } catch (error) {
90
- this.logger.error("Failure", { ...metadata, error });
96
+ this.logger.error("TriggerNotificationJob failure", { ...metadata, error });
91
97
  throw error;
92
98
  }
93
99
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@clipboard-health/ai-rules",
3
3
  "description": "Pre-built AI agent rules for consistent coding standards.",
4
- "version": "1.6.9",
4
+ "version": "1.6.10",
5
5
  "bugs": "https://github.com/ClipboardHealth/core-utils/issues",
6
6
  "devDependencies": {
7
7
  "@intellectronica/ruler": "0.3.21"