@xano/xanoscript-language-server 12.4.0 → 12.5.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/lexer/tokens.js +0 -6
- package/package.json +1 -1
- package/parser/clauses/nakedStackFn.js +0 -1
- package/parser/functions/db/dbAddFn.js +1 -0
- package/parser/functions/db/dbAddOrEditFn.js +1 -0
- package/parser/functions/db/dbEditFn.js +1 -0
- package/parser/functions/register.js +0 -4
- package/lexer/datadog.js +0 -57
- package/parser/functions/datadog/datadogLogBulkFn.js +0 -21
- package/parser/functions/datadog/datadogLogFn.js +0 -36
- package/parser/functions/datadog/datadogMetricBulkFn.js +0 -21
- package/parser/functions/datadog/datadogMetricFn.js +0 -36
- package/parser/functions/datadog/register.js +0 -18
- package/parser/functions/datadogFn.js +0 -20
package/lexer/tokens.js
CHANGED
|
@@ -52,10 +52,6 @@ import {
|
|
|
52
52
|
ControlTokens,
|
|
53
53
|
mapTokenToType as mapControlsTokenToType,
|
|
54
54
|
} from "./control.js";
|
|
55
|
-
import {
|
|
56
|
-
DatadogTokens,
|
|
57
|
-
mapTokenToType as mapDatadogTokenToType,
|
|
58
|
-
} from "./datadog.js";
|
|
59
55
|
import { DbTokens, mapTokenToType as mapDbTokenToType } from "./db.js";
|
|
60
56
|
import { DebugTokens, mapTokenToType as mapDebugTokenToType } from "./debug.js";
|
|
61
57
|
import {
|
|
@@ -421,7 +417,6 @@ export const allTokens = uniq([
|
|
|
421
417
|
...RunTokens,
|
|
422
418
|
...ObjectTokens,
|
|
423
419
|
...StreamTokens,
|
|
424
|
-
...DatadogTokens,
|
|
425
420
|
...DebugTokens,
|
|
426
421
|
...ExpectFnTokens,
|
|
427
422
|
...VarTokens,
|
|
@@ -454,7 +449,6 @@ const tokenMappers = [
|
|
|
454
449
|
mapColumnTokenToType,
|
|
455
450
|
mapCommentTokenToType,
|
|
456
451
|
mapControlsTokenToType,
|
|
457
|
-
mapDatadogTokenToType,
|
|
458
452
|
mapDbTokenToType,
|
|
459
453
|
mapDebugTokenToType,
|
|
460
454
|
mapErrorTriggerTokenToType,
|
package/package.json
CHANGED
|
@@ -44,7 +44,6 @@ export function nakedStackFn($) {
|
|
|
44
44
|
{ ALT: () => $.SUBRULE($.redisFn) },
|
|
45
45
|
{ ALT: () => $.SUBRULE($.controlFn, { ARGS: [options] }) },
|
|
46
46
|
{ ALT: () => $.SUBRULE($.debugFn) },
|
|
47
|
-
{ ALT: () => $.SUBRULE($.datadogFn) },
|
|
48
47
|
{ ALT: () => $.SUBRULE($.storageFn) },
|
|
49
48
|
{ ALT: () => $.SUBRULE($.streamFn) },
|
|
50
49
|
{ ALT: () => $.SUBRULE($.actionCallFn) },
|
|
@@ -27,6 +27,7 @@ export function dbAddFn($) {
|
|
|
27
27
|
data: { "[string]": "[expression]" },
|
|
28
28
|
"description?": "[string]",
|
|
29
29
|
"disabled?": "[boolean]",
|
|
30
|
+
"enforce_hidden_fields?": "[boolean]",
|
|
30
31
|
"addon?": [addonSchema],
|
|
31
32
|
"mock?": { "![string]": "[expression]" },
|
|
32
33
|
"output?": ["[string]"],
|
|
@@ -31,6 +31,7 @@ export function dbEditFn($) {
|
|
|
31
31
|
data: { "[string]": "[expression]" },
|
|
32
32
|
"description?": "[string]",
|
|
33
33
|
"disabled?": "[boolean]",
|
|
34
|
+
"enforce_hidden_fields?": "[boolean]",
|
|
34
35
|
"output?": ["[string]"],
|
|
35
36
|
"addon?": [addonSchema],
|
|
36
37
|
"mock?": { "![string]": "[expression]" },
|
|
@@ -10,8 +10,6 @@ import { register as register_cloud } from "./cloud/register.js";
|
|
|
10
10
|
import { cloudFn } from "./cloudFn.js";
|
|
11
11
|
import { controlFn } from "./controlFn.js";
|
|
12
12
|
import { register as register_controls } from "./controls/register.js";
|
|
13
|
-
import { register as register_datadog } from "./datadog/register.js";
|
|
14
|
-
import { datadogFn } from "./datadogFn.js";
|
|
15
13
|
import { register as register_db } from "./db/register.js";
|
|
16
14
|
import { dbFn } from "./dbFn.js";
|
|
17
15
|
import { register as register_debug } from "./debug/register.js";
|
|
@@ -58,7 +56,6 @@ export const register = ($) => {
|
|
|
58
56
|
$.arrayFn = $.RULE("arrayFn", arrayFn($));
|
|
59
57
|
$.cloudFn = $.RULE("cloudFn", cloudFn($));
|
|
60
58
|
$.controlFn = $.RULE("controlFn", controlFn($));
|
|
61
|
-
$.datadogFn = $.RULE("datadogFn", datadogFn($));
|
|
62
59
|
$.dbFn = $.RULE("dbFn", dbFn($));
|
|
63
60
|
$.debugFn = $.RULE("debugFn", debugFn($));
|
|
64
61
|
$.mathFn = $.RULE("mathFn", mathFn($));
|
|
@@ -81,7 +78,6 @@ export const register = ($) => {
|
|
|
81
78
|
register_array($);
|
|
82
79
|
register_cloud($);
|
|
83
80
|
register_controls($);
|
|
84
|
-
register_datadog($);
|
|
85
81
|
register_db($);
|
|
86
82
|
register_debug($);
|
|
87
83
|
register_math($);
|
package/lexer/datadog.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { DebugLogToken } from "./debug.js";
|
|
2
|
-
import { Identifier } from "./identifier.js";
|
|
3
|
-
import { createTokenByName } from "./utils.js";
|
|
4
|
-
|
|
5
|
-
// datadog
|
|
6
|
-
export const DatadogToken = createTokenByName("datadog", {
|
|
7
|
-
longer_alt: Identifier,
|
|
8
|
-
categories: [Identifier],
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
// datadog.log reuses the existing "log" token from debug
|
|
12
|
-
export { DebugLogToken as DatadogLogToken };
|
|
13
|
-
|
|
14
|
-
// datadog.log_bulk
|
|
15
|
-
export const DatadogLogBulkToken = createTokenByName("log_bulk", {
|
|
16
|
-
longer_alt: Identifier,
|
|
17
|
-
categories: [Identifier],
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// datadog.metric
|
|
21
|
-
export const DatadogMetricToken = createTokenByName("metric", {
|
|
22
|
-
longer_alt: Identifier,
|
|
23
|
-
categories: [Identifier],
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// datadog.metric_bulk
|
|
27
|
-
export const DatadogMetricBulkToken = createTokenByName("metric_bulk", {
|
|
28
|
-
longer_alt: Identifier,
|
|
29
|
-
categories: [Identifier],
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// Order matters: longer patterns must come before shorter prefixes
|
|
33
|
-
// (e.g. metric_bulk before metric) so the lexer matches them correctly.
|
|
34
|
-
// Note: `log_bulk` ordering vs the reused `log` token depends on
|
|
35
|
-
// DatadogTokens being registered before DebugTokens in lexer/tokens.js.
|
|
36
|
-
export const DatadogTokens = [
|
|
37
|
-
DatadogToken,
|
|
38
|
-
DatadogLogBulkToken,
|
|
39
|
-
DatadogMetricBulkToken,
|
|
40
|
-
DatadogMetricToken,
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Maps a token name to a type
|
|
45
|
-
* @param {string} token the token name
|
|
46
|
-
*/
|
|
47
|
-
export function mapTokenToType(token) {
|
|
48
|
-
switch (token) {
|
|
49
|
-
case DatadogToken.name:
|
|
50
|
-
case DatadogLogBulkToken.name:
|
|
51
|
-
case DatadogMetricToken.name:
|
|
52
|
-
case DatadogMetricBulkToken.name:
|
|
53
|
-
return "function";
|
|
54
|
-
default:
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { DatadogLogBulkToken } from "../../../lexer/datadog.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* datadog.log_bulk {
|
|
5
|
-
* entries = $entries
|
|
6
|
-
* }
|
|
7
|
-
* @param {import('../../base_parser.js').XanoBaseParser} $
|
|
8
|
-
*/
|
|
9
|
-
export function datadogLogBulkFn($) {
|
|
10
|
-
const requiredAttrs = ["entries"];
|
|
11
|
-
const optionalAttrs = ["description", "disabled"];
|
|
12
|
-
|
|
13
|
-
return () => {
|
|
14
|
-
$.sectionStack.push("datadogLogBulk");
|
|
15
|
-
const tokenFn = $.CONSUME(DatadogLogBulkToken); // log_bulk
|
|
16
|
-
$.SUBRULE($.functionAttrReq, {
|
|
17
|
-
ARGS: [tokenFn, requiredAttrs, optionalAttrs],
|
|
18
|
-
});
|
|
19
|
-
$.sectionStack.pop();
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { DatadogLogToken } from "../../../lexer/datadog.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* datadog.log {
|
|
5
|
-
* message = "hi"
|
|
6
|
-
* status = "info"
|
|
7
|
-
* attributes = '{"A":"B"}'|json_decode
|
|
8
|
-
* }
|
|
9
|
-
* @param {import('../../base_parser.js').XanoBaseParser} $
|
|
10
|
-
*/
|
|
11
|
-
export function datadogLogFn($) {
|
|
12
|
-
const requiredAttrs = ["message"];
|
|
13
|
-
const optionalAttrs = [
|
|
14
|
-
"status",
|
|
15
|
-
"attributes",
|
|
16
|
-
"service",
|
|
17
|
-
"source",
|
|
18
|
-
"env",
|
|
19
|
-
"hostname",
|
|
20
|
-
"ddtags",
|
|
21
|
-
"tags",
|
|
22
|
-
"timestamp",
|
|
23
|
-
"connection",
|
|
24
|
-
"description",
|
|
25
|
-
"disabled",
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
return () => {
|
|
29
|
-
$.sectionStack.push("datadogLog");
|
|
30
|
-
const tokenFn = $.CONSUME(DatadogLogToken); // log
|
|
31
|
-
$.SUBRULE($.functionAttrReq, {
|
|
32
|
-
ARGS: [tokenFn, requiredAttrs, optionalAttrs],
|
|
33
|
-
});
|
|
34
|
-
$.sectionStack.pop();
|
|
35
|
-
};
|
|
36
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { DatadogMetricBulkToken } from "../../../lexer/datadog.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* datadog.metric_bulk {
|
|
5
|
-
* entries = $entries
|
|
6
|
-
* }
|
|
7
|
-
* @param {import('../../base_parser.js').XanoBaseParser} $
|
|
8
|
-
*/
|
|
9
|
-
export function datadogMetricBulkFn($) {
|
|
10
|
-
const requiredAttrs = ["entries"];
|
|
11
|
-
const optionalAttrs = ["description", "disabled"];
|
|
12
|
-
|
|
13
|
-
return () => {
|
|
14
|
-
$.sectionStack.push("datadogMetricBulk");
|
|
15
|
-
const tokenFn = $.CONSUME(DatadogMetricBulkToken); // metric_bulk
|
|
16
|
-
$.SUBRULE($.functionAttrReq, {
|
|
17
|
-
ARGS: [tokenFn, requiredAttrs, optionalAttrs],
|
|
18
|
-
});
|
|
19
|
-
$.sectionStack.pop();
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { DatadogMetricToken } from "../../../lexer/datadog.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* datadog.metric {
|
|
5
|
-
* metric = "requests.count"
|
|
6
|
-
* value = 1
|
|
7
|
-
* type = "count"
|
|
8
|
-
* tags = '{"env":"prod"}'|json_decode
|
|
9
|
-
* }
|
|
10
|
-
* @param {import('../../base_parser.js').XanoBaseParser} $
|
|
11
|
-
*/
|
|
12
|
-
export function datadogMetricFn($) {
|
|
13
|
-
const requiredAttrs = ["metric", "value"];
|
|
14
|
-
const optionalAttrs = [
|
|
15
|
-
"type",
|
|
16
|
-
"tags",
|
|
17
|
-
"service",
|
|
18
|
-
"source",
|
|
19
|
-
"env",
|
|
20
|
-
"hostname",
|
|
21
|
-
"ddtags",
|
|
22
|
-
"timestamp",
|
|
23
|
-
"connection",
|
|
24
|
-
"description",
|
|
25
|
-
"disabled",
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
return () => {
|
|
29
|
-
$.sectionStack.push("datadogMetric");
|
|
30
|
-
const tokenFn = $.CONSUME(DatadogMetricToken); // metric
|
|
31
|
-
$.SUBRULE($.functionAttrReq, {
|
|
32
|
-
ARGS: [tokenFn, requiredAttrs, optionalAttrs],
|
|
33
|
-
});
|
|
34
|
-
$.sectionStack.pop();
|
|
35
|
-
};
|
|
36
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { datadogLogBulkFn } from "./datadogLogBulkFn.js";
|
|
2
|
-
import { datadogLogFn } from "./datadogLogFn.js";
|
|
3
|
-
import { datadogMetricBulkFn } from "./datadogMetricBulkFn.js";
|
|
4
|
-
import { datadogMetricFn } from "./datadogMetricFn.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Registers all the parsers in this folder
|
|
8
|
-
* @param {import('../base_parser.js').XanoBaseParser} $
|
|
9
|
-
*/
|
|
10
|
-
export const register = ($) => {
|
|
11
|
-
$.datadogLogFn = $.RULE("datadogLogFn", datadogLogFn($));
|
|
12
|
-
$.datadogLogBulkFn = $.RULE("datadogLogBulkFn", datadogLogBulkFn($));
|
|
13
|
-
$.datadogMetricFn = $.RULE("datadogMetricFn", datadogMetricFn($));
|
|
14
|
-
$.datadogMetricBulkFn = $.RULE(
|
|
15
|
-
"datadogMetricBulkFn",
|
|
16
|
-
datadogMetricBulkFn($)
|
|
17
|
-
);
|
|
18
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { DatadogToken } from "../../lexer/datadog.js";
|
|
2
|
-
import { DotToken } from "../../lexer/tokens.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @param {import('../base_parser.js').XanoBaseParser} $
|
|
6
|
-
*/
|
|
7
|
-
export function datadogFn($) {
|
|
8
|
-
return () => {
|
|
9
|
-
$.sectionStack.push("datadog");
|
|
10
|
-
$.CONSUME(DatadogToken); // "datadog"
|
|
11
|
-
$.CONSUME(DotToken); // "."
|
|
12
|
-
$.OR([
|
|
13
|
-
{ ALT: () => $.SUBRULE($.datadogLogBulkFn) }, // datadog.log_bulk
|
|
14
|
-
{ ALT: () => $.SUBRULE($.datadogLogFn) }, // datadog.log
|
|
15
|
-
{ ALT: () => $.SUBRULE($.datadogMetricBulkFn) }, // datadog.metric_bulk
|
|
16
|
-
{ ALT: () => $.SUBRULE($.datadogMetricFn) }, // datadog.metric
|
|
17
|
-
]);
|
|
18
|
-
$.sectionStack.pop();
|
|
19
|
-
};
|
|
20
|
-
}
|