3535
3636import { describe , it , expect , afterEach } from 'vitest' ;
3737import { ObjectQL } from '@objectstack/objectql' ;
38+ import type { ExecutionContext } from '@objectstack/spec/kernel' ;
3839import { SqlDriver } from '@objectstack/driver-sql' ;
3940import { SysNotification } from '@objectstack/platform-objects' ;
4041import { MessagingService , NOTIFICATION_EVENT_OBJECT } from './messaging-service.js' ;
4142import { createInboxChannel , INBOX_OBJECT , RECEIPT_OBJECT } from './inbox-channel.js' ;
4243import { SqlNotificationOutbox , DELIVERY_OBJECT } from './sql-outbox.js' ;
4344import { InboxMessage , NotificationDelivery , NotificationPreference , NotificationReceipt } from './objects/index.js' ;
4445
45- const SYSTEM = { context : { isSystem : true } } as const ;
46+ const SYSTEM = { context : { isSystem : true } as ExecutionContext } ;
4647
4748const SYS_ORGANIZATION = { name : 'sys_organization' , label : 'Organization' , fields : { name : { type : 'text' , label : 'Name' } } } ;
4849const SYS_USER = { name : 'sys_user' , label : 'User' , fields : { name : { type : 'text' , label : 'Name' } } } ;
@@ -67,15 +68,15 @@ async function boot(organizations: readonly string[]): Promise<ObjectQL> {
6768 }
6869 await ql . syncSchemas ( ) ;
6970 ql . setTenancyPostureProvider ( ( ) => 'single' ) ;
70- for ( const id of organizations ) await ql . insert ( 'sys_organization' , { id, name : id } , SYSTEM as any ) ;
71- await ql . insert ( 'sys_user' , { id : 'user_1' , name : 'Recipient' } , SYSTEM as any ) ;
71+ for ( const id of organizations ) await ql . insert ( 'sys_organization' , { id, name : id } , SYSTEM ) ;
72+ await ql . insert ( 'sys_user' , { id : 'user_1' , name : 'Recipient' } , SYSTEM ) ;
7273 engine = ql ;
7374 return ql ;
7475}
7576
7677async function organizationsOf ( ql : ObjectQL , object : string ) : Promise < string [ ] > {
77- const rows = ( await ql . find ( object , { fields : [ 'id' , 'organization_id' ] } as any , SYSTEM as any ) ) ?? [ ] ;
78- return rows . map ( ( r : any ) => r . organization_id ?? 'NULL' ) ;
78+ const rows = ( await ql . find ( object , { fields : [ 'id' , 'organization_id' ] } , SYSTEM ) ) ?? [ ] ;
79+ return rows . map ( ( r : Record < string , unknown > ) => String ( r . organization_id ?? 'NULL' ) ) ;
7980}
8081
8182const EMIT = { topic : 'sweep.breach' , audience : [ 'user_1' ] , payload : { title : 'Breach' , body : 'An SLA was breached.' } } ;
0 commit comments