@xano/xanoscript-language-server 11.3.0 → 11.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/package.json
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { EqualToken, LCurly, RCurly } from "../../../lexer/control.js";
|
|
2
1
|
import { CreateAuthTokenToken } from "../../../lexer/security.js";
|
|
3
|
-
import { Identifier, NewlineToken } from "../../../lexer/tokens.js";
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* @param {import('../../base_parser.js').XanoBaseParser} $
|
|
@@ -9,15 +7,21 @@ export function securityCreateAuthTokenFn($) {
|
|
|
9
7
|
return () => {
|
|
10
8
|
$.sectionStack.push("securityCreateAuthTokenFn");
|
|
11
9
|
const fnToken = $.CONSUME(CreateAuthTokenToken); // "create_auth_token"
|
|
12
|
-
|
|
13
|
-
$.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
|
|
11
|
+
$.SUBRULE($.schemaParseAttributeFn, {
|
|
12
|
+
ARGS: [
|
|
13
|
+
fnToken,
|
|
14
|
+
{
|
|
15
|
+
extras: "[expression]",
|
|
16
|
+
table: "[expression]",
|
|
17
|
+
expiration: "[expression]",
|
|
18
|
+
id: "[expression]",
|
|
19
|
+
"description?": "[string]",
|
|
20
|
+
"disabled?": "[boolean]",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
18
23
|
});
|
|
19
|
-
|
|
20
|
-
$.CONSUME(RCurly); // "}"
|
|
24
|
+
|
|
21
25
|
$.SUBRULE($.asVariable, { ARGS: [fnToken] });
|
|
22
26
|
$.sectionStack.pop();
|
|
23
27
|
};
|
|
@@ -17,8 +17,35 @@ describe("securityCreateAuthTokenFn", () => {
|
|
|
17
17
|
table = "empty"
|
|
18
18
|
extras = {}
|
|
19
19
|
expiration = 86400
|
|
20
|
-
id =
|
|
20
|
+
id = $user.id
|
|
21
21
|
} as $authToken`);
|
|
22
22
|
expect(parser.errors).to.be.empty;
|
|
23
23
|
});
|
|
24
|
+
|
|
25
|
+
it("securityCreateAuthTokenFn requires an expiration attribute", () => {
|
|
26
|
+
const parser = parse(`create_auth_token {
|
|
27
|
+
table = "empty"
|
|
28
|
+
extras = {}
|
|
29
|
+
id = $user.id
|
|
30
|
+
} as $authToken`);
|
|
31
|
+
expect(parser.errors).to.not.be.empty;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("securityCreateAuthTokenFn requires an extra attribute", () => {
|
|
35
|
+
const parser = parse(`create_auth_token {
|
|
36
|
+
table = "empty"
|
|
37
|
+
expiration = 86400
|
|
38
|
+
id = $user.id
|
|
39
|
+
} as $authToken`);
|
|
40
|
+
expect(parser.errors).to.not.be.empty;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("securityCreateAuthTokenFn requires a table attribute", () => {
|
|
44
|
+
const parser = parse(`create_auth_token {
|
|
45
|
+
expiration = 86400
|
|
46
|
+
id = $user.id
|
|
47
|
+
extras = {"role": "admin"}
|
|
48
|
+
} as $authToken`);
|
|
49
|
+
expect(parser.errors).to.not.be.empty;
|
|
50
|
+
});
|
|
24
51
|
});
|