@morphql/language-definitions 0.1.6 → 0.1.7

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 CHANGED
@@ -51,10 +51,10 @@ var KEYWORDS = [
51
51
  parameters: [
52
52
  {
53
53
  name: "format",
54
- description: "If used as first keyword: The starting format, one of `json`, `xml`, or `object`. When used after a section, defines its source"
54
+ description: "If used as first keyword: The starting format name (e.g., `json`, `xml`, `csv`, `object`). When used after a section, defines its source."
55
55
  }
56
56
  ],
57
- example: "from json to xml"
57
+ example: "from json to csv"
58
58
  }
59
59
  },
60
60
  {
@@ -64,18 +64,30 @@ var KEYWORDS = [
64
64
  signature: "to <format>",
65
65
  description: "Specifies the output data format.",
66
66
  parameters: [
67
- { name: "format", description: "One of: `json`, `xml`, or `object`" }
67
+ {
68
+ name: "format",
69
+ description: "The name of one of the available adapters."
70
+ }
68
71
  ],
69
- example: "from json to xml"
72
+ example: "from csv to json"
70
73
  }
71
74
  },
72
75
  {
73
76
  name: "transform",
74
77
  category: "control",
75
78
  doc: {
76
- signature: "transform",
77
- description: "Begins the transformation block containing actions.",
78
- example: "transform\n set name = firstName"
79
+ signature: "transform [unsafe]",
80
+ description: "Begins the transformation block containing actions. Optional 'unsafe' keyword disables safety features (optional chaining) for maximum performance.",
81
+ example: "transform\n set name = firstName\n\ntransform unsafe\n set result = price / quantity"
82
+ }
83
+ },
84
+ {
85
+ name: "unsafe",
86
+ category: "control",
87
+ doc: {
88
+ signature: "transform unsafe",
89
+ description: "Disables safety features (optional chaining) in generated code for maximum performance. Use only with validated/trusted input data.",
90
+ example: "transform unsafe\n set result = price / quantity"
79
91
  }
80
92
  },
81
93
  {
@@ -116,7 +128,7 @@ var KEYWORDS = [
116
128
  description: "(Optional) Source path for the section data"
117
129
  }
118
130
  ],
119
- example: "section metadata(\n from xml to object\n transform\n set name = root.productName\n) from xmlString"
131
+ example: "section items(\n from csv to object\n transform\n set name = A\n) from csvString"
120
132
  }
121
133
  },
122
134
  {
@@ -354,7 +366,7 @@ var FUNCTIONS = [
354
366
  name: "aslist",
355
367
  doc: {
356
368
  signature: "aslist(value)",
357
- description: "Ensures a value is an array. Useful for XML nodes that might be a single object or an array.",
369
+ description: "Ensures a value is an array. Useful for input formats like XML that might return a single object or an array for the same field.",
358
370
  parameters: [{ name: "value", description: "The value to normalize" }],
359
371
  returns: "array",
360
372
  example: "aslist(items) // Always returns an array"
package/dist/index.js CHANGED
@@ -9,10 +9,10 @@ var KEYWORDS = [
9
9
  parameters: [
10
10
  {
11
11
  name: "format",
12
- description: "If used as first keyword: The starting format, one of `json`, `xml`, or `object`. When used after a section, defines its source"
12
+ description: "If used as first keyword: The starting format name (e.g., `json`, `xml`, `csv`, `object`). When used after a section, defines its source."
13
13
  }
14
14
  ],
15
- example: "from json to xml"
15
+ example: "from json to csv"
16
16
  }
17
17
  },
18
18
  {
@@ -22,18 +22,30 @@ var KEYWORDS = [
22
22
  signature: "to <format>",
23
23
  description: "Specifies the output data format.",
24
24
  parameters: [
25
- { name: "format", description: "One of: `json`, `xml`, or `object`" }
25
+ {
26
+ name: "format",
27
+ description: "The name of one of the available adapters."
28
+ }
26
29
  ],
27
- example: "from json to xml"
30
+ example: "from csv to json"
28
31
  }
29
32
  },
30
33
  {
31
34
  name: "transform",
32
35
  category: "control",
33
36
  doc: {
34
- signature: "transform",
35
- description: "Begins the transformation block containing actions.",
36
- example: "transform\n set name = firstName"
37
+ signature: "transform [unsafe]",
38
+ description: "Begins the transformation block containing actions. Optional 'unsafe' keyword disables safety features (optional chaining) for maximum performance.",
39
+ example: "transform\n set name = firstName\n\ntransform unsafe\n set result = price / quantity"
40
+ }
41
+ },
42
+ {
43
+ name: "unsafe",
44
+ category: "control",
45
+ doc: {
46
+ signature: "transform unsafe",
47
+ description: "Disables safety features (optional chaining) in generated code for maximum performance. Use only with validated/trusted input data.",
48
+ example: "transform unsafe\n set result = price / quantity"
37
49
  }
38
50
  },
39
51
  {
@@ -74,7 +86,7 @@ var KEYWORDS = [
74
86
  description: "(Optional) Source path for the section data"
75
87
  }
76
88
  ],
77
- example: "section metadata(\n from xml to object\n transform\n set name = root.productName\n) from xmlString"
89
+ example: "section items(\n from csv to object\n transform\n set name = A\n) from csvString"
78
90
  }
79
91
  },
80
92
  {
@@ -312,7 +324,7 @@ var FUNCTIONS = [
312
324
  name: "aslist",
313
325
  doc: {
314
326
  signature: "aslist(value)",
315
- description: "Ensures a value is an array. Useful for XML nodes that might be a single object or an array.",
327
+ description: "Ensures a value is an array. Useful for input formats like XML that might return a single object or an array for the same field.",
316
328
  parameters: [{ name: "value", description: "The value to normalize" }],
317
329
  returns: "array",
318
330
  example: "aslist(items) // Always returns an array"
@@ -9,10 +9,10 @@
9
9
  "parameters": [
10
10
  {
11
11
  "name": "format",
12
- "description": "If used as first keyword: The starting format, one of `json`, `xml`, or `object`. When used after a section, defines its source"
12
+ "description": "If used as first keyword: The starting format name (e.g., `json`, `xml`, `csv`, `object`). When used after a section, defines its source."
13
13
  }
14
14
  ],
15
- "example": "from json to xml"
15
+ "example": "from json to csv"
16
16
  }
17
17
  },
18
18
  {
@@ -24,19 +24,28 @@
24
24
  "parameters": [
25
25
  {
26
26
  "name": "format",
27
- "description": "One of: `json`, `xml`, or `object`"
27
+ "description": "The name of one of the available adapters."
28
28
  }
29
29
  ],
30
- "example": "from json to xml"
30
+ "example": "from csv to json"
31
31
  }
32
32
  },
33
33
  {
34
34
  "name": "transform",
35
35
  "category": "control",
36
36
  "doc": {
37
- "signature": "transform",
38
- "description": "Begins the transformation block containing actions.",
39
- "example": "transform\n set name = firstName"
37
+ "signature": "transform [unsafe]",
38
+ "description": "Begins the transformation block containing actions. Optional 'unsafe' keyword disables safety features (optional chaining) for maximum performance.",
39
+ "example": "transform\n set name = firstName\n\ntransform unsafe\n set result = price / quantity"
40
+ }
41
+ },
42
+ {
43
+ "name": "unsafe",
44
+ "category": "control",
45
+ "doc": {
46
+ "signature": "transform unsafe",
47
+ "description": "Disables safety features (optional chaining) in generated code for maximum performance. Use only with validated/trusted input data.",
48
+ "example": "transform unsafe\n set result = price / quantity"
40
49
  }
41
50
  },
42
51
  {
@@ -86,7 +95,7 @@
86
95
  "description": "(Optional) Source path for the section data"
87
96
  }
88
97
  ],
89
- "example": "section metadata(\n from xml to object\n transform\n set name = root.productName\n) from xmlString"
98
+ "example": "section items(\n from csv to object\n transform\n set name = A\n) from csvString"
90
99
  }
91
100
  },
92
101
  {
@@ -393,7 +402,7 @@
393
402
  "name": "aslist",
394
403
  "doc": {
395
404
  "signature": "aslist(value)",
396
- "description": "Ensures a value is an array. Useful for XML nodes that might be a single object or an array.",
405
+ "description": "Ensures a value is an array. Useful for input formats like XML that might return a single object or an array for the same field.",
397
406
  "parameters": [
398
407
  {
399
408
  "name": "value",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphql/language-definitions",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Shared language definitions for MorphQL across VSCode, Monaco, and documentation",
5
5
  "type": "module",
6
6
  "publishConfig": {