@dbsp/nql 1.5.0 → 1.7.0

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/dist/index.d.ts CHANGED
@@ -402,21 +402,64 @@ interface NqlAssignment {
402
402
  value: NqlExpression;
403
403
  }
404
404
 
405
+ /**
406
+ * NQL Error Types
407
+ *
408
+ * Structured error types for lexer, parser, and semantic errors.
409
+ */
410
+ /** Source location for error reporting */
411
+ interface SourceLocation {
412
+ line: number;
413
+ column: number;
414
+ offset: number;
415
+ }
416
+ /** Base error interface for all NQL errors */
417
+ interface NqlError {
418
+ code: string;
419
+ message: string;
420
+ location?: SourceLocation | undefined;
421
+ suggestion?: string | undefined;
422
+ }
423
+ /** Parser errors (syntax errors) */
424
+ interface NqlParseError extends NqlError {
425
+ code: `ERR-PARSE-${string}`;
426
+ expected?: string[] | undefined;
427
+ found?: string | undefined;
428
+ }
429
+ /** Semantic errors (validation failures) */
430
+ interface NqlSemanticError extends NqlError {
431
+ code: `ERR-SEM-${string}`;
432
+ relatedSymbol?: string | undefined;
433
+ }
434
+ /** Warning (non-fatal issues) */
435
+ interface NqlWarning {
436
+ code: string;
437
+ message: string;
438
+ location?: SourceLocation | undefined;
439
+ suggestion?: string | undefined;
440
+ }
441
+
405
442
  type CompileResult = CompiledNqlQuery;
406
443
 
407
444
  /**
408
445
  * Duck-type interface for schema-based column validation.
409
446
  * Loose coupling: ModelIR from @dbsp/core satisfies this shape without direct import.
410
447
  */
448
+ interface ColumnValidatorPseudoColumn {
449
+ readonly table?: string;
450
+ readonly foreignKeyColumn?: string;
451
+ readonly targetColumn?: string;
452
+ readonly parentRole: string;
453
+ readonly childRole: string;
454
+ readonly ascendantKeyword?: string;
455
+ readonly descendantKeyword?: string;
456
+ }
411
457
  interface ColumnValidatorSchema {
412
458
  getTable(name: string): {
413
459
  readonly columns: readonly {
414
460
  readonly name: string;
415
461
  }[];
416
- readonly pseudoColumns?: readonly {
417
- readonly parentRole: string;
418
- readonly childRole: string;
419
- }[];
462
+ readonly pseudoColumns?: readonly ColumnValidatorPseudoColumn[];
420
463
  } | undefined;
421
464
  getRelationsFrom(sourceTable: string): readonly ColumnValidatorRelation[];
422
465
  getRelation?(qualifiedName: string): ColumnValidatorRelation | undefined;
@@ -427,8 +470,13 @@ interface ColumnValidatorRelation {
427
470
  readonly target: string;
428
471
  readonly type?: 'hasOne' | 'hasMany' | 'belongsTo' | 'belongsToMany';
429
472
  readonly foreignKey?: string | readonly string[] | undefined;
430
- readonly sourceKey?: string | undefined;
431
- readonly targetKey?: string | undefined;
473
+ readonly through?: string | undefined;
474
+ readonly otherKey?: string | readonly string[] | undefined;
475
+ readonly throughSourceKey?: string | undefined;
476
+ readonly throughTargetKey?: string | undefined;
477
+ readonly recursive?: unknown;
478
+ readonly sourceKey?: string | readonly string[] | undefined;
479
+ readonly targetKey?: string | readonly string[] | undefined;
432
480
  }
433
481
  /**
434
482
  * Options for the NQL compiler.
@@ -477,43 +525,6 @@ declare class NqlCompiler {
477
525
  */
478
526
  declare function createCompiler(options?: NqlCompilerOptions, schema?: ColumnValidatorSchema): NqlCompiler;
479
527
 
480
- /**
481
- * NQL Error Types
482
- *
483
- * Structured error types for lexer, parser, and semantic errors.
484
- */
485
- /** Source location for error reporting */
486
- interface SourceLocation {
487
- line: number;
488
- column: number;
489
- offset: number;
490
- }
491
- /** Base error interface for all NQL errors */
492
- interface NqlError {
493
- code: string;
494
- message: string;
495
- location?: SourceLocation | undefined;
496
- suggestion?: string | undefined;
497
- }
498
- /** Parser errors (syntax errors) */
499
- interface NqlParseError extends NqlError {
500
- code: `ERR-PARSE-${string}`;
501
- expected?: string[] | undefined;
502
- found?: string | undefined;
503
- }
504
- /** Semantic errors (validation failures) */
505
- interface NqlSemanticError extends NqlError {
506
- code: `ERR-SEM-${string}`;
507
- relatedSymbol?: string | undefined;
508
- }
509
- /** Warning (non-fatal issues) */
510
- interface NqlWarning {
511
- code: string;
512
- message: string;
513
- location?: SourceLocation | undefined;
514
- suggestion?: string | undefined;
515
- }
516
-
517
528
  declare const allTokens: chevrotain.TokenType[];
518
529
  declare const NqlLexer: Lexer;
519
530