Skip to content

Commit 488b05c

Browse files
Copilothotlong
andcommitted
Fix type issues in ObjectQL storage implementations
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent a9cad97 commit 488b05c

4 files changed

Lines changed: 18 additions & 17 deletions

File tree

packages/automation/objects/automation_rule.object.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ fields:
1515
type: object
1616
label: Trigger Configuration
1717
blackbox: true
18-
conditions:
19-
type: object
20-
label: Conditions
21-
blackbox: true
2218
actions:
2319
type: object
2420
label: Actions

packages/automation/src/objectql-storage.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class ObjectQLAutomationStorage implements AutomationStorage {
7171

7272
// Filter by trigger type if specified (post-query filtering)
7373
if (filter?.triggerType) {
74-
rules = rules.filter(r => r.trigger.type === filter.triggerType);
74+
rules = rules.filter((r: AutomationRule) => r.trigger.type === filter.triggerType);
7575
}
7676

7777
return rules;
@@ -84,9 +84,10 @@ export class ObjectQLAutomationStorage implements AutomationStorage {
8484
const docUpdates: any = {};
8585

8686
if (updates.name !== undefined) docUpdates.name = updates.name;
87-
if (updates.objectName !== undefined) docUpdates.object_name = updates.objectName;
88-
if (updates.trigger !== undefined) docUpdates.trigger = updates.trigger;
89-
if (updates.conditions !== undefined) docUpdates.conditions = updates.conditions;
87+
if (updates.trigger !== undefined) {
88+
docUpdates.trigger = updates.trigger;
89+
docUpdates.object_name = (updates.trigger as any).objectName;
90+
}
9091
if (updates.actions !== undefined) docUpdates.actions = updates.actions;
9192
if (updates.status !== undefined) docUpdates.status = updates.status;
9293
if (updates.priority !== undefined) docUpdates.priority = updates.priority;
@@ -205,9 +206,8 @@ export class ObjectQLAutomationStorage implements AutomationStorage {
205206
_id: rule.id,
206207
id: rule.id,
207208
name: rule.name,
208-
object_name: rule.objectName,
209+
object_name: (rule.trigger as any).objectName,
209210
trigger: rule.trigger,
210-
conditions: rule.conditions,
211211
actions: rule.actions,
212212
status: rule.status,
213213
priority: rule.priority,
@@ -226,11 +226,9 @@ export class ObjectQLAutomationStorage implements AutomationStorage {
226226
return {
227227
id: doc.id || doc._id,
228228
name: doc.name,
229-
objectName: doc.object_name,
229+
status: doc.status,
230230
trigger: doc.trigger,
231-
conditions: doc.conditions,
232231
actions: doc.actions,
233-
status: doc.status,
234232
priority: doc.priority,
235233
executionCount: doc.execution_count || 0,
236234
lastExecutedAt: doc.last_executed_at ? new Date(doc.last_executed_at) : undefined,

packages/jobs/objects/job.object.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ fields:
5656
type: number
5757
label: Retry Attempts
5858
default: 0
59-
max_attempts:
59+
max_retries:
6060
type: number
6161
label: Max Retry Attempts
6262
default: 3
63+
retry_delay:
64+
type: number
65+
label: Retry Delay (ms)
66+
default: 1000
6367
timeout:
6468
type: number
6569
label: Timeout (ms)

packages/jobs/src/objectql-storage.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export class ObjectQLJobStorage implements JobStorage {
5050
if (updates.result !== undefined) docUpdates.result = updates.result;
5151
if (updates.error !== undefined) docUpdates.error = updates.error;
5252
if (updates.attempts !== undefined) docUpdates.attempts = updates.attempts;
53-
if (updates.maxAttempts !== undefined) docUpdates.max_attempts = updates.maxAttempts;
53+
if (updates.maxRetries !== undefined) docUpdates.max_retries = updates.maxRetries;
54+
if (updates.retryDelay !== undefined) docUpdates.retry_delay = updates.retryDelay;
5455
if (updates.timeout !== undefined) docUpdates.timeout = updates.timeout;
5556
if (updates.nextRun !== undefined) docUpdates.next_run = updates.nextRun;
5657
if (updates.cronExpression !== undefined) docUpdates.cron_expression = updates.cronExpression;
@@ -205,7 +206,8 @@ export class ObjectQLJobStorage implements JobStorage {
205206
result: job.result,
206207
error: job.error,
207208
attempts: job.attempts,
208-
max_attempts: job.maxAttempts,
209+
max_retries: job.maxRetries,
210+
retry_delay: job.retryDelay,
209211
timeout: job.timeout,
210212
next_run: job.nextRun,
211213
cron_expression: job.cronExpression,
@@ -228,7 +230,8 @@ export class ObjectQLJobStorage implements JobStorage {
228230
result: doc.result,
229231
error: doc.error,
230232
attempts: doc.attempts || 0,
231-
maxAttempts: doc.max_attempts,
233+
maxRetries: doc.max_retries || 3,
234+
retryDelay: doc.retry_delay || 1000,
232235
timeout: doc.timeout,
233236
nextRun: doc.next_run ? new Date(doc.next_run) : undefined,
234237
cronExpression: doc.cron_expression,

0 commit comments

Comments
 (0)