@dbsp/nql 1.6.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;
@@ -428,7 +471,7 @@ interface ColumnValidatorRelation {
428
471
  readonly type?: 'hasOne' | 'hasMany' | 'belongsTo' | 'belongsToMany';
429
472
  readonly foreignKey?: string | readonly string[] | undefined;
430
473
  readonly through?: string | undefined;
431
- readonly otherKey?: string | undefined;
474
+ readonly otherKey?: string | readonly string[] | undefined;
432
475
  readonly throughSourceKey?: string | undefined;
433
476
  readonly throughTargetKey?: string | undefined;
434
477
  readonly recursive?: unknown;
@@ -482,43 +525,6 @@ declare class NqlCompiler {
482
525
  */
483
526
  declare function createCompiler(options?: NqlCompilerOptions, schema?: ColumnValidatorSchema): NqlCompiler;
484
527
 
485
- /**
486
- * NQL Error Types
487
- *
488
- * Structured error types for lexer, parser, and semantic errors.
489
- */
490
- /** Source location for error reporting */
491
- interface SourceLocation {
492
- line: number;
493
- column: number;
494
- offset: number;
495
- }
496
- /** Base error interface for all NQL errors */
497
- interface NqlError {
498
- code: string;
499
- message: string;
500
- location?: SourceLocation | undefined;
501
- suggestion?: string | undefined;
502
- }
503
- /** Parser errors (syntax errors) */
504
- interface NqlParseError extends NqlError {
505
- code: `ERR-PARSE-${string}`;
506
- expected?: string[] | undefined;
507
- found?: string | undefined;
508
- }
509
- /** Semantic errors (validation failures) */
510
- interface NqlSemanticError extends NqlError {
511
- code: `ERR-SEM-${string}`;
512
- relatedSymbol?: string | undefined;
513
- }
514
- /** Warning (non-fatal issues) */
515
- interface NqlWarning {
516
- code: string;
517
- message: string;
518
- location?: SourceLocation | undefined;
519
- suggestion?: string | undefined;
520
- }
521
-
522
528
  declare const allTokens: chevrotain.TokenType[];
523
529
  declare const NqlLexer: Lexer;
524
530