File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -966,3 +966,48 @@ export class ExcelDriver implements Driver {
966966 return `${ objectName } -${ timestamp } -${ counter } ` ;
967967 }
968968}
969+
970+ /**
971+ * Excel Driver Plugin for ObjectQL
972+ *
973+ * A plugin wrapper that registers an Excel driver as a datasource in ObjectQL.
974+ * This follows the @objectstack/spec plugin protocol.
975+ *
976+ * @example
977+ * ```typescript
978+ * import { ObjectQL } from '@objectql/core';
979+ * import { createExcelDriverPlugin } from '@objectql/driver-excel';
980+ *
981+ * const app = new ObjectQL({
982+ * plugins: [
983+ * createExcelDriverPlugin({
984+ * name: 'default',
985+ * config: {
986+ * filePath: './data.xlsx',
987+ * storageMode: 'single-file'
988+ * }
989+ * })
990+ * ]
991+ * });
992+ *
993+ * await app.init();
994+ * ```
995+ */
996+ import { ObjectQLPlugin , IObjectQL } from '@objectql/types' ;
997+
998+ export interface ExcelDriverPluginConfig {
999+ /** Name of the datasource (e.g., 'default', 'export') */
1000+ name : string ;
1001+ /** Excel driver configuration */
1002+ config : ExcelDriverConfig ;
1003+ }
1004+
1005+ export function createExcelDriverPlugin ( options : ExcelDriverPluginConfig ) : ObjectQLPlugin {
1006+ return {
1007+ name : `excel-driver:${ options . name } ` ,
1008+ setup ( app : IObjectQL ) {
1009+ const driver = new ExcelDriver ( options . config ) ;
1010+ app . registerDatasource ( options . name , driver ) ;
1011+ }
1012+ } ;
1013+ }
Original file line number Diff line number Diff line change @@ -708,3 +708,49 @@ export class FileSystemDriver implements Driver {
708708 return `${ objectName } -${ timestamp } -${ counter } ` ;
709709 }
710710}
711+
712+ /**
713+ * FileSystem Driver Plugin for ObjectQL
714+ *
715+ * A plugin wrapper that registers a FileSystem driver as a datasource in ObjectQL.
716+ * This follows the @objectstack/spec plugin protocol.
717+ *
718+ * @example
719+ * ```typescript
720+ * import { ObjectQL } from '@objectql/core';
721+ * import { createFileSystemDriverPlugin } from '@objectql/driver-fs';
722+ *
723+ * const app = new ObjectQL({
724+ * plugins: [
725+ * createFileSystemDriverPlugin({
726+ * name: 'default',
727+ * config: {
728+ * dataDir: './data',
729+ * prettyPrint: true,
730+ * enableBackup: true
731+ * }
732+ * })
733+ * ]
734+ * });
735+ *
736+ * await app.init();
737+ * ```
738+ */
739+ import { ObjectQLPlugin , IObjectQL } from '@objectql/types' ;
740+
741+ export interface FileSystemDriverPluginConfig {
742+ /** Name of the datasource (e.g., 'default', 'backup') */
743+ name : string ;
744+ /** FileSystem driver configuration */
745+ config : FileSystemDriverConfig ;
746+ }
747+
748+ export function createFileSystemDriverPlugin ( options : FileSystemDriverPluginConfig ) : ObjectQLPlugin {
749+ return {
750+ name : `fs-driver:${ options . name } ` ,
751+ setup ( app : IObjectQL ) {
752+ const driver = new FileSystemDriver ( options . config ) ;
753+ app . registerDatasource ( options . name , driver ) ;
754+ }
755+ } ;
756+ }
Original file line number Diff line number Diff line change @@ -631,3 +631,48 @@ export class LocalStorageDriver implements Driver {
631631 return `${ objectName } -${ timestamp } -${ counter } ` ;
632632 }
633633}
634+
635+ /**
636+ * LocalStorage Driver Plugin for ObjectQL
637+ *
638+ * A plugin wrapper that registers a LocalStorage driver as a datasource in ObjectQL.
639+ * This follows the @objectstack/spec plugin protocol.
640+ *
641+ * @example
642+ * ```typescript
643+ * import { ObjectQL } from '@objectql/core';
644+ * import { createLocalStorageDriverPlugin } from '@objectql/driver-localstorage';
645+ *
646+ * const app = new ObjectQL({
647+ * plugins: [
648+ * createLocalStorageDriverPlugin({
649+ * name: 'default',
650+ * config: {
651+ * namespace: 'myapp',
652+ * strictMode: true
653+ * }
654+ * })
655+ * ]
656+ * });
657+ *
658+ * await app.init();
659+ * ```
660+ */
661+ import { ObjectQLPlugin , IObjectQL } from '@objectql/types' ;
662+
663+ export interface LocalStorageDriverPluginConfig {
664+ /** Name of the datasource (e.g., 'default', 'cache') */
665+ name : string ;
666+ /** LocalStorage driver configuration */
667+ config ?: LocalStorageDriverConfig ;
668+ }
669+
670+ export function createLocalStorageDriverPlugin ( options : LocalStorageDriverPluginConfig ) : ObjectQLPlugin {
671+ return {
672+ name : `localstorage-driver:${ options . name } ` ,
673+ setup ( app : IObjectQL ) {
674+ const driver = new LocalStorageDriver ( options . config ) ;
675+ app . registerDatasource ( options . name , driver ) ;
676+ }
677+ } ;
678+ }
Original file line number Diff line number Diff line change @@ -533,3 +533,50 @@ export class MemoryDriver implements Driver {
533533 return `${ objectName } -${ timestamp } -${ counter } ` ;
534534 }
535535}
536+
537+ /**
538+ * Memory Driver Plugin for ObjectQL
539+ *
540+ * A plugin wrapper that registers a Memory driver as a datasource in ObjectQL.
541+ * This follows the @objectstack/spec plugin protocol.
542+ *
543+ * @example
544+ * ```typescript
545+ * import { ObjectQL } from '@objectql/core';
546+ * import { createMemoryDriverPlugin } from '@objectql/driver-memory';
547+ *
548+ * const app = new ObjectQL({
549+ * plugins: [
550+ * createMemoryDriverPlugin({
551+ * name: 'default',
552+ * config: {
553+ * strictMode: true,
554+ * initialData: {
555+ * users: [{ id: '1', name: 'Alice' }]
556+ * }
557+ * }
558+ * })
559+ * ]
560+ * });
561+ *
562+ * await app.init();
563+ * ```
564+ */
565+ import { ObjectQLPlugin , IObjectQL } from '@objectql/types' ;
566+
567+ export interface MemoryDriverPluginConfig {
568+ /** Name of the datasource (e.g., 'default', 'cache') */
569+ name : string ;
570+ /** Memory driver configuration */
571+ config ?: MemoryDriverConfig ;
572+ }
573+
574+ export function createMemoryDriverPlugin ( options : MemoryDriverPluginConfig ) : ObjectQLPlugin {
575+ return {
576+ name : `memory-driver:${ options . name } ` ,
577+ setup ( app : IObjectQL ) {
578+ const driver = new MemoryDriver ( options . config ) ;
579+ app . registerDatasource ( options . name , driver ) ;
580+ }
581+ } ;
582+ }
Original file line number Diff line number Diff line change @@ -309,3 +309,53 @@ export class MongoDriver implements Driver {
309309 }
310310}
311311
312+ /**
313+ * MongoDB Driver Plugin for ObjectQL
314+ *
315+ * A plugin wrapper that registers a MongoDB driver as a datasource in ObjectQL.
316+ * This follows the @objectstack/spec plugin protocol.
317+ *
318+ * @example
319+ * ```typescript
320+ * import { ObjectQL } from '@objectql/core';
321+ * import { createMongoDriverPlugin } from '@objectql/driver-mongo';
322+ *
323+ * const app = new ObjectQL({
324+ * plugins: [
325+ * createMongoDriverPlugin({
326+ * name: 'default',
327+ * config: {
328+ * url: 'mongodb://localhost:27017',
329+ * dbName: 'mydb'
330+ * }
331+ * })
332+ * ]
333+ * });
334+ *
335+ * await app.init();
336+ * ```
337+ */
338+ import { ObjectQLPlugin , IObjectQL } from '@objectql/types' ;
339+
340+ export interface MongoDriverPluginConfig {
341+ /** Name of the datasource (e.g., 'default', 'analytics') */
342+ name : string ;
343+ /** MongoDB connection configuration */
344+ config : {
345+ /** MongoDB connection URL */
346+ url : string ;
347+ /** Database name */
348+ dbName ?: string ;
349+ } ;
350+ }
351+
352+ export function createMongoDriverPlugin ( options : MongoDriverPluginConfig ) : ObjectQLPlugin {
353+ return {
354+ name : `mongo-driver:${ options . name } ` ,
355+ setup ( app : IObjectQL ) {
356+ const driver = new MongoDriver ( options . config ) ;
357+ app . registerDatasource ( options . name , driver ) ;
358+ }
359+ } ;
360+ }
361+
Original file line number Diff line number Diff line change @@ -428,3 +428,47 @@ export class RedisDriver implements Driver {
428428 } ) ;
429429 }
430430}
431+
432+ /**
433+ * Redis Driver Plugin for ObjectQL
434+ *
435+ * A plugin wrapper that registers a Redis driver as a datasource in ObjectQL.
436+ * This follows the @objectstack/spec plugin protocol.
437+ *
438+ * @example
439+ * ```typescript
440+ * import { ObjectQL } from '@objectql/core';
441+ * import { createRedisDriverPlugin } from '@objectql/driver-redis';
442+ *
443+ * const app = new ObjectQL({
444+ * plugins: [
445+ * createRedisDriverPlugin({
446+ * name: 'default',
447+ * config: {
448+ * url: 'redis://localhost:6379'
449+ * }
450+ * })
451+ * ]
452+ * });
453+ *
454+ * await app.init();
455+ * ```
456+ */
457+ import { ObjectQLPlugin , IObjectQL } from '@objectql/types' ;
458+
459+ export interface RedisDriverPluginConfig {
460+ /** Name of the datasource (e.g., 'default', 'cache') */
461+ name : string ;
462+ /** Redis connection configuration */
463+ config : RedisDriverConfig ;
464+ }
465+
466+ export function createRedisDriverPlugin ( options : RedisDriverPluginConfig ) : ObjectQLPlugin {
467+ return {
468+ name : `redis-driver:${ options . name } ` ,
469+ setup ( app : IObjectQL ) {
470+ const driver = new RedisDriver ( options . config ) ;
471+ app . registerDatasource ( options . name , driver ) ;
472+ }
473+ } ;
474+ }
Original file line number Diff line number Diff line change @@ -428,3 +428,48 @@ export class MetadataApiClient implements IMetadataApiClient {
428428 ) ;
429429 }
430430}
431+
432+ /**
433+ * SDK Driver Plugin for ObjectQL
434+ *
435+ * A plugin wrapper that registers an SDK driver as a datasource in ObjectQL.
436+ * This follows the @objectstack/spec plugin protocol.
437+ *
438+ * @example
439+ * ```typescript
440+ * import { ObjectQL } from '@objectql/core';
441+ * import { createSdkDriverPlugin } from '@objectql/driver-sdk';
442+ *
443+ * const app = new ObjectQL({
444+ * plugins: [
445+ * createSdkDriverPlugin({
446+ * name: 'remote',
447+ * config: {
448+ * baseUrl: 'https://api.example.com',
449+ * apiKey: 'your-api-key'
450+ * }
451+ * })
452+ * ]
453+ * });
454+ *
455+ * await app.init();
456+ * ```
457+ */
458+ import { ObjectQLPlugin , IObjectQL } from '@objectql/types' ;
459+
460+ export interface SdkDriverPluginConfig {
461+ /** Name of the datasource (e.g., 'remote', 'api') */
462+ name : string ;
463+ /** SDK driver configuration */
464+ config : DataApiClientConfig ;
465+ }
466+
467+ export function createSdkDriverPlugin ( options : SdkDriverPluginConfig ) : ObjectQLPlugin {
468+ return {
469+ name : `sdk-driver:${ options . name } ` ,
470+ setup ( app : IObjectQL ) {
471+ const driver = new DataApiClient ( options . config ) ;
472+ app . registerDatasource ( options . name , driver ) ;
473+ }
474+ } ;
475+ }
Original file line number Diff line number Diff line change @@ -837,3 +837,49 @@ export class SqlDriver implements Driver {
837837 * @deprecated Use SqlDriver instead.
838838 */
839839export { SqlDriver as KnexDriver } ;
840+
841+ /**
842+ * SQL Driver Plugin for ObjectQL
843+ *
844+ * A plugin wrapper that registers an SQL driver as a datasource in ObjectQL.
845+ * This follows the @objectstack/spec plugin protocol.
846+ *
847+ * @example
848+ * ```typescript
849+ * import { ObjectQL } from '@objectql/core';
850+ * import { createSqlDriverPlugin } from '@objectql/driver-sql';
851+ *
852+ * const app = new ObjectQL({
853+ * plugins: [
854+ * createSqlDriverPlugin({
855+ * name: 'default',
856+ * config: {
857+ * client: 'sqlite3',
858+ * connection: { filename: ':memory:' },
859+ * useNullAsDefault: true
860+ * }
861+ * })
862+ * ]
863+ * });
864+ *
865+ * await app.init();
866+ * ```
867+ */
868+ import { ObjectQLPlugin , IObjectQL } from '@objectql/types' ;
869+
870+ export interface SqlDriverPluginConfig {
871+ /** Name of the datasource (e.g., 'default', 'analytics') */
872+ name : string ;
873+ /** Knex configuration */
874+ config : any ;
875+ }
876+
877+ export function createSqlDriverPlugin ( options : SqlDriverPluginConfig ) : ObjectQLPlugin {
878+ return {
879+ name : `sql-driver:${ options . name } ` ,
880+ setup ( app : IObjectQL ) {
881+ const driver = new SqlDriver ( options . config ) ;
882+ app . registerDatasource ( options . name , driver ) ;
883+ }
884+ } ;
885+ }
You can’t perform that action at this time.
0 commit comments