Skip to content

Commit c058d5e

Browse files
Copilothotlong
andcommitted
Only use ObjectQL storage when broker is available (fixes tests)
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 24d8b82 commit c058d5e

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

packages/audit/src/plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ export class AuditLogPlugin implements Plugin {
6262
this.context = context;
6363
this.startedAt = Date.now();
6464

65-
// Upgrade storage to ObjectQL if not explicitly provided
65+
// Upgrade storage to ObjectQL if not explicitly provided and broker is available
6666
// We do this in init because we need the context
67-
if (!this.config.storage) {
67+
if (!this.config.storage && (context as any).broker) {
6868
this.storage = new ObjectQLAuditStorage(context);
6969
context.logger.info('[Audit Log] Upgraded to ObjectQL storage');
7070
}

packages/automation/src/plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ export class AutomationPlugin implements Plugin, IAutomationService {
8282
this.context = context;
8383
this.startedAt = Date.now();
8484

85-
// Upgrade storage to ObjectQL if not explicitly provided
85+
// Upgrade storage to ObjectQL if not explicitly provided and broker is available
8686
// We do this in init because we need the context
87-
if (!this.config.storage) {
87+
if (!this.config.storage && (context as any).broker) {
8888
this.storage = new ObjectQLAutomationStorage(context);
8989
context.logger.info('[Automation Plugin] Upgraded to ObjectQL storage');
9090
}

packages/jobs/src/plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ export class JobsPlugin implements Plugin, IJobService {
8787
this.context = context;
8888
this.startedAt = Date.now();
8989

90-
// Upgrade storage to ObjectQL if not explicitly provided
90+
// Upgrade storage to ObjectQL if not explicitly provided and broker is available
9191
// We do this in init because we need the context
92-
if (!this.config.storage) {
92+
if (!this.config.storage && (context as any).broker) {
9393
this.storage = new ObjectQLJobStorage(context);
9494
// Reinitialize queue and scheduler with new storage
9595
this.queue = new JobQueue({

packages/permissions/src/plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ export class PermissionsPlugin implements Plugin {
7575
this.context = context;
7676
this.startedAt = Date.now();
7777

78-
// Upgrade storage to ObjectQL if not explicitly provided
78+
// Upgrade storage to ObjectQL if not explicitly provided and broker is available
7979
// We do this in init because we need the context
80-
if (!this.config.storage) {
80+
if (!this.config.storage && (context as any).broker) {
8181
this.storage = new ObjectQLPermissionStorage(context);
8282
this.engine = new PermissionEngine(this.storage, {
8383
defaultDeny: this.config.defaultDeny,

packages/workflow/src/plugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ export class WorkflowPlugin implements Plugin, IWorkflowService {
6666
this.logger = context.logger;
6767
this.startedAt = Date.now();
6868

69-
// Upgrade storage to ObjectQL if not explicitly provided
69+
// Upgrade storage to ObjectQL if not explicitly provided and broker is available
7070
// We do this in init because we need the context
71-
if (!this.config.storage) {
71+
if (!this.config.storage && (context as any).broker) {
7272
this.storage = new ObjectQLWorkflowStorage(context);
73-
this.logger.info('[Workflow Plugin] Upgraded to ObjectQL storage');
73+
context.logger.info('[Workflow Plugin] Upgraded to ObjectQL storage');
7474
// Re-initialize API with new storage
7575
this.api = new WorkflowAPI(this.storage, this.engine);
7676
}

0 commit comments

Comments
 (0)