@clipboard-health/ai-rules 1.6.12 → 1.6.14
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 +18 -5
- package/fullstack/AGENTS.md +18 -5
- package/package.json +1 -1
package/backend/AGENTS.md
CHANGED
|
@@ -48,10 +48,20 @@ 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
|
|
52
|
-
*
|
|
51
|
+
* For @clipboard-health/mongo-jobs:
|
|
52
|
+
* 1. Implement `HandlerInterface<SerializableTriggerChunkedRequest>`.
|
|
53
|
+
* 2. The 10 default `maxAttempts` with exponential backoff of `2^attemptsCount` means ~17 minutes
|
|
54
|
+
* of cumulative delay. If your notification could be stale before this, set
|
|
55
|
+
* `SerializableTriggerChunkedRequest.expiresAt` when enqueueing.
|
|
56
|
+
*
|
|
57
|
+
* For @clipboard-health/background-jobs-postgres:
|
|
58
|
+
* 1. Implement `Handler<SerializableTriggerChunkedRequest>`.
|
|
59
|
+
* 2. The 20 default `maxRetryAttempts` with exponential backoff of `10s * 2^(attempt - 1)` means
|
|
60
|
+
* ~121 days of cumulative delay. If your notification could be stale before this, set
|
|
61
|
+
* `maxRetryAttempts` (and `SerializableTriggerChunkedRequest.expiresAt`) when enqueueing.
|
|
53
62
|
*/
|
|
54
63
|
export class TriggerNotificationJob implements BaseHandler<SerializableTriggerChunkedRequest> {
|
|
64
|
+
// For background-jobs-postgres, use `public static queueName = TRIGGER_NOTIFICATION_JOB_NAME;`
|
|
55
65
|
public name = TRIGGER_NOTIFICATION_JOB_NAME;
|
|
56
66
|
private readonly logger = new CBHLogger({
|
|
57
67
|
defaultMeta: {
|
|
@@ -64,13 +74,16 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
|
|
|
64
74
|
public async perform(
|
|
65
75
|
data: SerializableTriggerChunkedRequest,
|
|
66
76
|
/**
|
|
67
|
-
* For mongo-jobs, implement `BackgroundJobType<SerializableTriggerChunkedRequest>`, which has
|
|
68
|
-
*
|
|
77
|
+
* For mongo-jobs, implement `BackgroundJobType<SerializableTriggerChunkedRequest>`, which has
|
|
78
|
+
* `_id`, `attemptsCount`, and `uniqueKey`.
|
|
79
|
+
*
|
|
80
|
+
* For background-jobs-postgres, implement `Job<SerializableTriggerChunkedRequest>`, which has
|
|
81
|
+
* `id`, `retryAttempts`, and `idempotencyKey`.
|
|
69
82
|
*/
|
|
70
83
|
job: { _id: string; attemptsCount: number; uniqueKey?: string },
|
|
71
84
|
) {
|
|
72
85
|
const metadata = {
|
|
73
|
-
//
|
|
86
|
+
// For background-jobs-postgres, this is called `retryAttempts`.
|
|
74
87
|
attempt: job.attemptsCount + 1,
|
|
75
88
|
jobId: job._id,
|
|
76
89
|
recipientCount: data.body.recipients.length,
|
package/fullstack/AGENTS.md
CHANGED
|
@@ -48,10 +48,20 @@ 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
|
|
52
|
-
*
|
|
51
|
+
* For @clipboard-health/mongo-jobs:
|
|
52
|
+
* 1. Implement `HandlerInterface<SerializableTriggerChunkedRequest>`.
|
|
53
|
+
* 2. The 10 default `maxAttempts` with exponential backoff of `2^attemptsCount` means ~17 minutes
|
|
54
|
+
* of cumulative delay. If your notification could be stale before this, set
|
|
55
|
+
* `SerializableTriggerChunkedRequest.expiresAt` when enqueueing.
|
|
56
|
+
*
|
|
57
|
+
* For @clipboard-health/background-jobs-postgres:
|
|
58
|
+
* 1. Implement `Handler<SerializableTriggerChunkedRequest>`.
|
|
59
|
+
* 2. The 20 default `maxRetryAttempts` with exponential backoff of `10s * 2^(attempt - 1)` means
|
|
60
|
+
* ~121 days of cumulative delay. If your notification could be stale before this, set
|
|
61
|
+
* `maxRetryAttempts` (and `SerializableTriggerChunkedRequest.expiresAt`) when enqueueing.
|
|
53
62
|
*/
|
|
54
63
|
export class TriggerNotificationJob implements BaseHandler<SerializableTriggerChunkedRequest> {
|
|
64
|
+
// For background-jobs-postgres, use `public static queueName = TRIGGER_NOTIFICATION_JOB_NAME;`
|
|
55
65
|
public name = TRIGGER_NOTIFICATION_JOB_NAME;
|
|
56
66
|
private readonly logger = new CBHLogger({
|
|
57
67
|
defaultMeta: {
|
|
@@ -64,13 +74,16 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
|
|
|
64
74
|
public async perform(
|
|
65
75
|
data: SerializableTriggerChunkedRequest,
|
|
66
76
|
/**
|
|
67
|
-
* For mongo-jobs, implement `BackgroundJobType<SerializableTriggerChunkedRequest>`, which has
|
|
68
|
-
*
|
|
77
|
+
* For mongo-jobs, implement `BackgroundJobType<SerializableTriggerChunkedRequest>`, which has
|
|
78
|
+
* `_id`, `attemptsCount`, and `uniqueKey`.
|
|
79
|
+
*
|
|
80
|
+
* For background-jobs-postgres, implement `Job<SerializableTriggerChunkedRequest>`, which has
|
|
81
|
+
* `id`, `retryAttempts`, and `idempotencyKey`.
|
|
69
82
|
*/
|
|
70
83
|
job: { _id: string; attemptsCount: number; uniqueKey?: string },
|
|
71
84
|
) {
|
|
72
85
|
const metadata = {
|
|
73
|
-
//
|
|
86
|
+
// For background-jobs-postgres, this is called `retryAttempts`.
|
|
74
87
|
attempt: job.attemptsCount + 1,
|
|
75
88
|
jobId: job._id,
|
|
76
89
|
recipientCount: data.body.recipients.length,
|
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.
|
|
4
|
+
"version": "1.6.14",
|
|
5
5
|
"bugs": "https://github.com/ClipboardHealth/core-utils/issues",
|
|
6
6
|
"devDependencies": {
|
|
7
7
|
"@intellectronica/ruler": "0.3.21"
|