Commit 5538731
committed
fix: add explicit record casting to all graph functions for SurrealDB 2.x
Critical fix for SurrealDB 2.x compatibility: Since SurrealDB 2.0, strings
are no longer automatically converted to record types. All graph functions
were broken because they accepted string parameters but used them in FROM
clauses which require record types.
Fixed functions:
1. fn::node_reference() - Added type::thing() conversion before calling fn::node_info()
2. fn::get_transitive_dependencies() - Added $record conversion for FROM ONLY clause
3. fn::trace_call_chain() - Added $record conversion for FROM ONLY clause
4. fn::calculate_coupling_metrics() - Added $record for FROM ONLY and fn::node_info() call
5. fn::get_reverse_dependencies() - Added $record conversion for FROM ONLY clause
Pattern used:
LET $record = type::thing('nodes', $node_id);
FROM ONLY $record // or fn::node_info($record)
This ensures all string node IDs are properly cast to record<nodes> type
before use in graph traversal or function calls.
Ref: https://surrealdb.com/docs/surrealql/datamodel/casting1 parent 2eef1f1 commit 5538731
1 file changed
+12
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
347 | | - | |
| 347 | + | |
| 348 | + | |
348 | 349 | | |
349 | 350 | | |
350 | 351 | | |
| |||
369 | 370 | | |
370 | 371 | | |
371 | 372 | | |
| 373 | + | |
372 | 374 | | |
373 | 375 | | |
374 | 376 | | |
375 | | - | |
| 377 | + | |
376 | 378 | | |
377 | 379 | | |
378 | 380 | | |
| |||
499 | 501 | | |
500 | 502 | | |
501 | 503 | | |
| 504 | + | |
502 | 505 | | |
503 | 506 | | |
504 | 507 | | |
| |||
510 | 513 | | |
511 | 514 | | |
512 | 515 | | |
513 | | - | |
| 516 | + | |
514 | 517 | | |
515 | 518 | | |
516 | 519 | | |
| |||
534 | 537 | | |
535 | 538 | | |
536 | 539 | | |
| 540 | + | |
537 | 541 | | |
538 | 542 | | |
539 | 543 | | |
540 | | - | |
| 544 | + | |
541 | 545 | | |
542 | 546 | | |
543 | 547 | | |
544 | 548 | | |
545 | 549 | | |
546 | 550 | | |
547 | | - | |
| 551 | + | |
548 | 552 | | |
549 | 553 | | |
550 | 554 | | |
| |||
567 | 571 | | |
568 | 572 | | |
569 | 573 | | |
570 | | - | |
| 574 | + | |
571 | 575 | | |
572 | 576 | | |
573 | 577 | | |
| |||
678 | 682 | | |
679 | 683 | | |
680 | 684 | | |
| 685 | + | |
681 | 686 | | |
682 | 687 | | |
683 | 688 | | |
684 | | - | |
| 689 | + | |
685 | 690 | | |
686 | 691 | | |
687 | 692 | | |
| |||
0 commit comments