@morphql/language-definitions 0.1.14 → 0.1.16
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 +46 -3
- package/dist/index.js +46 -3
- package/dist/morphql-lang.json +52 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -110,8 +110,8 @@ var KEYWORDS = [
|
|
|
110
110
|
name: "section",
|
|
111
111
|
category: "action",
|
|
112
112
|
doc: {
|
|
113
|
-
signature: "section [multiple] <name>( [subquery] <actions> ) [from <path>]",
|
|
114
|
-
description: "Creates a nested object or array in the output. Can optionally include a subquery for format conversion.",
|
|
113
|
+
signature: "section [multiple] <name>( [subquery] <actions> ) [from <path>] [where <condition>]",
|
|
114
|
+
description: "Creates a nested object or array in the output. Can optionally include a subquery for format conversion and a where clause for filtering.",
|
|
115
115
|
parameters: [
|
|
116
116
|
{ name: "multiple", description: "(Optional) Treat as array mapping" },
|
|
117
117
|
{ name: "name", description: "The section/field name" },
|
|
@@ -126,9 +126,28 @@ var KEYWORDS = [
|
|
|
126
126
|
{
|
|
127
127
|
name: "from",
|
|
128
128
|
description: "(Optional) Source path for the section data"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "where",
|
|
132
|
+
description: "(Optional) Condition to filter source items (only for arrays)"
|
|
129
133
|
}
|
|
130
134
|
],
|
|
131
|
-
example: "section items(\n
|
|
135
|
+
example: "section multiple items(\n set name = A\n) from rows where age > 18"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "where",
|
|
140
|
+
category: "control",
|
|
141
|
+
doc: {
|
|
142
|
+
signature: "section ... where <condition>",
|
|
143
|
+
description: "Filters elements in a section based on a condition. Only works when the source is an array.",
|
|
144
|
+
parameters: [
|
|
145
|
+
{
|
|
146
|
+
name: "condition",
|
|
147
|
+
description: "Boolean expression to evaluate for each item"
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
example: "section multiple users(set name = A) from rows where status == 'active'"
|
|
132
151
|
}
|
|
133
152
|
},
|
|
134
153
|
{
|
|
@@ -423,6 +442,30 @@ var FUNCTIONS = [
|
|
|
423
442
|
returns: "string",
|
|
424
443
|
example: 'pack(target, "id:0:5:left", "name:5:20")'
|
|
425
444
|
}
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
name: "list",
|
|
448
|
+
doc: {
|
|
449
|
+
signature: "list(value1, [value2, ...])",
|
|
450
|
+
description: "Creates an array from the given arguments. Useful for constructing nested structures in a single assignment.",
|
|
451
|
+
parameters: [
|
|
452
|
+
{ name: "values", description: "Values to include in the array" }
|
|
453
|
+
],
|
|
454
|
+
returns: "array",
|
|
455
|
+
example: 'list("A", "B", list("C1", "C2")) // ["A", "B", ["C1", "C2"]]'
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
name: "array",
|
|
460
|
+
doc: {
|
|
461
|
+
signature: "array(value1, [value2, ...])",
|
|
462
|
+
description: "Alias for `list()`. Creates an array from the given arguments.",
|
|
463
|
+
parameters: [
|
|
464
|
+
{ name: "values", description: "Values to include in the array" }
|
|
465
|
+
],
|
|
466
|
+
returns: "array",
|
|
467
|
+
example: "array(1, 2, 3) // [1, 2, 3]"
|
|
468
|
+
}
|
|
426
469
|
}
|
|
427
470
|
];
|
|
428
471
|
var getFunctionNames = () => FUNCTIONS.map((f) => f.name);
|
package/dist/index.js
CHANGED
|
@@ -68,8 +68,8 @@ var KEYWORDS = [
|
|
|
68
68
|
name: "section",
|
|
69
69
|
category: "action",
|
|
70
70
|
doc: {
|
|
71
|
-
signature: "section [multiple] <name>( [subquery] <actions> ) [from <path>]",
|
|
72
|
-
description: "Creates a nested object or array in the output. Can optionally include a subquery for format conversion.",
|
|
71
|
+
signature: "section [multiple] <name>( [subquery] <actions> ) [from <path>] [where <condition>]",
|
|
72
|
+
description: "Creates a nested object or array in the output. Can optionally include a subquery for format conversion and a where clause for filtering.",
|
|
73
73
|
parameters: [
|
|
74
74
|
{ name: "multiple", description: "(Optional) Treat as array mapping" },
|
|
75
75
|
{ name: "name", description: "The section/field name" },
|
|
@@ -84,9 +84,28 @@ var KEYWORDS = [
|
|
|
84
84
|
{
|
|
85
85
|
name: "from",
|
|
86
86
|
description: "(Optional) Source path for the section data"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "where",
|
|
90
|
+
description: "(Optional) Condition to filter source items (only for arrays)"
|
|
87
91
|
}
|
|
88
92
|
],
|
|
89
|
-
example: "section items(\n
|
|
93
|
+
example: "section multiple items(\n set name = A\n) from rows where age > 18"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "where",
|
|
98
|
+
category: "control",
|
|
99
|
+
doc: {
|
|
100
|
+
signature: "section ... where <condition>",
|
|
101
|
+
description: "Filters elements in a section based on a condition. Only works when the source is an array.",
|
|
102
|
+
parameters: [
|
|
103
|
+
{
|
|
104
|
+
name: "condition",
|
|
105
|
+
description: "Boolean expression to evaluate for each item"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
example: "section multiple users(set name = A) from rows where status == 'active'"
|
|
90
109
|
}
|
|
91
110
|
},
|
|
92
111
|
{
|
|
@@ -381,6 +400,30 @@ var FUNCTIONS = [
|
|
|
381
400
|
returns: "string",
|
|
382
401
|
example: 'pack(target, "id:0:5:left", "name:5:20")'
|
|
383
402
|
}
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
name: "list",
|
|
406
|
+
doc: {
|
|
407
|
+
signature: "list(value1, [value2, ...])",
|
|
408
|
+
description: "Creates an array from the given arguments. Useful for constructing nested structures in a single assignment.",
|
|
409
|
+
parameters: [
|
|
410
|
+
{ name: "values", description: "Values to include in the array" }
|
|
411
|
+
],
|
|
412
|
+
returns: "array",
|
|
413
|
+
example: 'list("A", "B", list("C1", "C2")) // ["A", "B", ["C1", "C2"]]'
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
name: "array",
|
|
418
|
+
doc: {
|
|
419
|
+
signature: "array(value1, [value2, ...])",
|
|
420
|
+
description: "Alias for `list()`. Creates an array from the given arguments.",
|
|
421
|
+
parameters: [
|
|
422
|
+
{ name: "values", description: "Values to include in the array" }
|
|
423
|
+
],
|
|
424
|
+
returns: "array",
|
|
425
|
+
example: "array(1, 2, 3) // [1, 2, 3]"
|
|
426
|
+
}
|
|
384
427
|
}
|
|
385
428
|
];
|
|
386
429
|
var getFunctionNames = () => FUNCTIONS.map((f) => f.name);
|
package/dist/morphql-lang.json
CHANGED
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"name": "section",
|
|
72
72
|
"category": "action",
|
|
73
73
|
"doc": {
|
|
74
|
-
"signature": "section [multiple] <name>( [subquery] <actions> ) [from <path>]",
|
|
75
|
-
"description": "Creates a nested object or array in the output. Can optionally include a subquery for format conversion.",
|
|
74
|
+
"signature": "section [multiple] <name>( [subquery] <actions> ) [from <path>] [where <condition>]",
|
|
75
|
+
"description": "Creates a nested object or array in the output. Can optionally include a subquery for format conversion and a where clause for filtering.",
|
|
76
76
|
"parameters": [
|
|
77
77
|
{
|
|
78
78
|
"name": "multiple",
|
|
@@ -93,9 +93,28 @@
|
|
|
93
93
|
{
|
|
94
94
|
"name": "from",
|
|
95
95
|
"description": "(Optional) Source path for the section data"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "where",
|
|
99
|
+
"description": "(Optional) Condition to filter source items (only for arrays)"
|
|
96
100
|
}
|
|
97
101
|
],
|
|
98
|
-
"example": "section items(\n
|
|
102
|
+
"example": "section multiple items(\n set name = A\n) from rows where age > 18"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "where",
|
|
107
|
+
"category": "control",
|
|
108
|
+
"doc": {
|
|
109
|
+
"signature": "section ... where <condition>",
|
|
110
|
+
"description": "Filters elements in a section based on a condition. Only works when the source is an array.",
|
|
111
|
+
"parameters": [
|
|
112
|
+
{
|
|
113
|
+
"name": "condition",
|
|
114
|
+
"description": "Boolean expression to evaluate for each item"
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"example": "section multiple users(set name = A) from rows where status == 'active'"
|
|
99
118
|
}
|
|
100
119
|
},
|
|
101
120
|
{
|
|
@@ -480,6 +499,36 @@
|
|
|
480
499
|
"returns": "string",
|
|
481
500
|
"example": "pack(target, \"id:0:5:left\", \"name:5:20\")"
|
|
482
501
|
}
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
"name": "list",
|
|
505
|
+
"doc": {
|
|
506
|
+
"signature": "list(value1, [value2, ...])",
|
|
507
|
+
"description": "Creates an array from the given arguments. Useful for constructing nested structures in a single assignment.",
|
|
508
|
+
"parameters": [
|
|
509
|
+
{
|
|
510
|
+
"name": "values",
|
|
511
|
+
"description": "Values to include in the array"
|
|
512
|
+
}
|
|
513
|
+
],
|
|
514
|
+
"returns": "array",
|
|
515
|
+
"example": "list(\"A\", \"B\", list(\"C1\", \"C2\")) // [\"A\", \"B\", [\"C1\", \"C2\"]]"
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
"name": "array",
|
|
520
|
+
"doc": {
|
|
521
|
+
"signature": "array(value1, [value2, ...])",
|
|
522
|
+
"description": "Alias for `list()`. Creates an array from the given arguments.",
|
|
523
|
+
"parameters": [
|
|
524
|
+
{
|
|
525
|
+
"name": "values",
|
|
526
|
+
"description": "Values to include in the array"
|
|
527
|
+
}
|
|
528
|
+
],
|
|
529
|
+
"returns": "array",
|
|
530
|
+
"example": "array(1, 2, 3) // [1, 2, 3]"
|
|
531
|
+
}
|
|
483
532
|
}
|
|
484
533
|
],
|
|
485
534
|
"operators": [
|