@morphql/language-definitions 0.1.36 → 0.1.38
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.cjs +37 -0
- package/dist/index.js +37 -0
- package/dist/morphql-lang.json +49 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -595,6 +595,43 @@ var FUNCTIONS = [
|
|
|
595
595
|
example: "section multiple byCategory(\n set category = key\n set count = length(items)\n section multiple products(\n set name = name\n ) from items\n) from groupby(products, category)"
|
|
596
596
|
}
|
|
597
597
|
},
|
|
598
|
+
{
|
|
599
|
+
name: "lookup",
|
|
600
|
+
doc: {
|
|
601
|
+
signature: 'lookup(value, "key:val", ...)',
|
|
602
|
+
description: "Looks up a value in a dictionary of key-value pairs (colon-separated strings). Returns null if not found.",
|
|
603
|
+
parameters: [
|
|
604
|
+
{ name: "value", description: "The value to look up (coerced to string for matching)" },
|
|
605
|
+
{ name: "mappings", description: 'Variable number of "key:value" string arguments' }
|
|
606
|
+
],
|
|
607
|
+
returns: "any | null",
|
|
608
|
+
example: 'lookup(status, "1:open", "2:closed")'
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
name: "fromUnix",
|
|
613
|
+
doc: {
|
|
614
|
+
signature: "fromUnix(timestamp)",
|
|
615
|
+
description: "Converts a Unix timestamp string (seconds since epoch) to an ISO 8601 string.",
|
|
616
|
+
parameters: [
|
|
617
|
+
{ name: "timestamp", description: "Unix timestamp as a string or number" }
|
|
618
|
+
],
|
|
619
|
+
returns: "string | null",
|
|
620
|
+
example: 'fromUnix("1711468800") // "2024-03-26T16:00:00.000Z"'
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
name: "toUnix",
|
|
625
|
+
doc: {
|
|
626
|
+
signature: "toUnix(isoString)",
|
|
627
|
+
description: "Converts an ISO 8601 string to a Unix timestamp string (seconds since epoch).",
|
|
628
|
+
parameters: [
|
|
629
|
+
{ name: "isoString", description: "ISO 8601 date string" }
|
|
630
|
+
],
|
|
631
|
+
returns: "string | null",
|
|
632
|
+
example: 'toUnix("2024-03-26T16:00:00.000Z") // "1711468800"'
|
|
633
|
+
}
|
|
634
|
+
},
|
|
598
635
|
// ── Math functions ────────────────────────────────────────────────────────
|
|
599
636
|
{
|
|
600
637
|
name: "floor",
|
package/dist/index.js
CHANGED
|
@@ -553,6 +553,43 @@ var FUNCTIONS = [
|
|
|
553
553
|
example: "section multiple byCategory(\n set category = key\n set count = length(items)\n section multiple products(\n set name = name\n ) from items\n) from groupby(products, category)"
|
|
554
554
|
}
|
|
555
555
|
},
|
|
556
|
+
{
|
|
557
|
+
name: "lookup",
|
|
558
|
+
doc: {
|
|
559
|
+
signature: 'lookup(value, "key:val", ...)',
|
|
560
|
+
description: "Looks up a value in a dictionary of key-value pairs (colon-separated strings). Returns null if not found.",
|
|
561
|
+
parameters: [
|
|
562
|
+
{ name: "value", description: "The value to look up (coerced to string for matching)" },
|
|
563
|
+
{ name: "mappings", description: 'Variable number of "key:value" string arguments' }
|
|
564
|
+
],
|
|
565
|
+
returns: "any | null",
|
|
566
|
+
example: 'lookup(status, "1:open", "2:closed")'
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
name: "fromUnix",
|
|
571
|
+
doc: {
|
|
572
|
+
signature: "fromUnix(timestamp)",
|
|
573
|
+
description: "Converts a Unix timestamp string (seconds since epoch) to an ISO 8601 string.",
|
|
574
|
+
parameters: [
|
|
575
|
+
{ name: "timestamp", description: "Unix timestamp as a string or number" }
|
|
576
|
+
],
|
|
577
|
+
returns: "string | null",
|
|
578
|
+
example: 'fromUnix("1711468800") // "2024-03-26T16:00:00.000Z"'
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
name: "toUnix",
|
|
583
|
+
doc: {
|
|
584
|
+
signature: "toUnix(isoString)",
|
|
585
|
+
description: "Converts an ISO 8601 string to a Unix timestamp string (seconds since epoch).",
|
|
586
|
+
parameters: [
|
|
587
|
+
{ name: "isoString", description: "ISO 8601 date string" }
|
|
588
|
+
],
|
|
589
|
+
returns: "string | null",
|
|
590
|
+
example: 'toUnix("2024-03-26T16:00:00.000Z") // "1711468800"'
|
|
591
|
+
}
|
|
592
|
+
},
|
|
556
593
|
// ── Math functions ────────────────────────────────────────────────────────
|
|
557
594
|
{
|
|
558
595
|
name: "floor",
|
package/dist/morphql-lang.json
CHANGED
|
@@ -682,6 +682,55 @@
|
|
|
682
682
|
"example": "section multiple byCategory(\n set category = key\n set count = length(items)\n section multiple products(\n set name = name\n ) from items\n) from groupby(products, category)"
|
|
683
683
|
}
|
|
684
684
|
},
|
|
685
|
+
{
|
|
686
|
+
"name": "lookup",
|
|
687
|
+
"doc": {
|
|
688
|
+
"signature": "lookup(value, \"key:val\", ...)",
|
|
689
|
+
"description": "Looks up a value in a dictionary of key-value pairs (colon-separated strings). Returns null if not found.",
|
|
690
|
+
"parameters": [
|
|
691
|
+
{
|
|
692
|
+
"name": "value",
|
|
693
|
+
"description": "The value to look up (coerced to string for matching)"
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
"name": "mappings",
|
|
697
|
+
"description": "Variable number of \"key:value\" string arguments"
|
|
698
|
+
}
|
|
699
|
+
],
|
|
700
|
+
"returns": "any | null",
|
|
701
|
+
"example": "lookup(status, \"1:open\", \"2:closed\")"
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
"name": "fromUnix",
|
|
706
|
+
"doc": {
|
|
707
|
+
"signature": "fromUnix(timestamp)",
|
|
708
|
+
"description": "Converts a Unix timestamp string (seconds since epoch) to an ISO 8601 string.",
|
|
709
|
+
"parameters": [
|
|
710
|
+
{
|
|
711
|
+
"name": "timestamp",
|
|
712
|
+
"description": "Unix timestamp as a string or number"
|
|
713
|
+
}
|
|
714
|
+
],
|
|
715
|
+
"returns": "string | null",
|
|
716
|
+
"example": "fromUnix(\"1711468800\") // \"2024-03-26T16:00:00.000Z\""
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"name": "toUnix",
|
|
721
|
+
"doc": {
|
|
722
|
+
"signature": "toUnix(isoString)",
|
|
723
|
+
"description": "Converts an ISO 8601 string to a Unix timestamp string (seconds since epoch).",
|
|
724
|
+
"parameters": [
|
|
725
|
+
{
|
|
726
|
+
"name": "isoString",
|
|
727
|
+
"description": "ISO 8601 date string"
|
|
728
|
+
}
|
|
729
|
+
],
|
|
730
|
+
"returns": "string | null",
|
|
731
|
+
"example": "toUnix(\"2024-03-26T16:00:00.000Z\") // \"1711468800\""
|
|
732
|
+
}
|
|
733
|
+
},
|
|
685
734
|
{
|
|
686
735
|
"name": "floor",
|
|
687
736
|
"doc": {
|