@traqula/rules-sparql-1-2 0.0.1-alpha.148 → 0.0.1-alpha.9
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/README.md +5 -3
- package/lib/Factory.d.ts +18 -0
- package/lib/Factory.js +73 -0
- package/lib/Factory.js.map +1 -0
- package/lib/grammar.d.ts +90 -57
- package/lib/grammar.js +279 -157
- package/lib/grammar.js.map +1 -1
- package/lib/index.cjs +3943 -2297
- package/lib/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/lexer.d.ts +19 -52
- package/lib/lexer.js +4 -4
- package/lib/lexer.js.map +1 -1
- package/lib/parserUtils.d.ts +8 -0
- package/lib/parserUtils.js +13 -0
- package/lib/parserUtils.js.map +1 -0
- package/lib/sparql12HelperTypes.d.ts +50 -0
- package/lib/sparql12HelperTypes.js +2 -0
- package/lib/sparql12HelperTypes.js.map +1 -0
- package/lib/sparql12Types.d.ts +311 -19
- package/lib/sparql12Types.js.map +1 -1
- package/lib/validator.d.ts +2 -0
- package/lib/validator.js +17 -0
- package/lib/validator.js.map +1 -0
- package/package.json +12 -15
package/lib/validator.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Factory } from '@traqula/rules-sparql-1-1';
|
|
2
|
+
const F = new Factory();
|
|
3
|
+
function isLangDir(dir) {
|
|
4
|
+
return dir === 'ltr' || dir === 'rtl';
|
|
5
|
+
}
|
|
6
|
+
export function langTagHasCorrectDomain(literal) {
|
|
7
|
+
if (F.isTermLiteralLangStr(literal)) {
|
|
8
|
+
const dirSplit = literal.langOrIri.split('--');
|
|
9
|
+
if (dirSplit.length > 1) {
|
|
10
|
+
const [_, direction] = dirSplit;
|
|
11
|
+
if (!isLangDir(direction)) {
|
|
12
|
+
throw new Error(`language direction "${direction}" of literal "${JSON.stringify(literal)}" is not is required range 'ltr' | 'rtl'.`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGpD,MAAM,CAAC,GAAG,IAAI,OAAO,EAAE,CAAC;AAExB,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,GAAG,KAAK,KAAK,IAAI,GAAG,KAAK,KAAK,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAoB;IAC1D,IAAI,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,CAAE,CAAC,EAAE,SAAS,CAAE,GAAG,QAAQ,CAAC;YAClC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CAAC,uBAAuB,SAAS,iBAAiB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,2CAA2C,CAAC,CAAC;YACvI,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { Factory } from '@traqula/rules-sparql-1-1';\nimport type { TermLiteral } from './sparql12Types';\n\nconst F = new Factory();\n\nfunction isLangDir(dir: string): dir is 'ltr' | 'rtl' {\n return dir === 'ltr' || dir === 'rtl';\n}\n\nexport function langTagHasCorrectDomain(literal: TermLiteral): void {\n if (F.isTermLiteralLangStr(literal)) {\n const dirSplit = literal.langOrIri.split('--');\n if (dirSplit.length > 1) {\n const [ _, direction ] = dirSplit;\n if (!isLangDir(direction)) {\n throw new Error(`language direction \"${direction}\" of literal \"${JSON.stringify(literal)}\" is not is required range 'ltr' | 'rtl'.`);\n }\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@traqula/rules-sparql-1-2",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1-alpha.9+427f381",
|
|
5
|
+
"description": "Traqula Lexer and Grammar Rules for sparql 1.2",
|
|
5
6
|
"lsd:module": true,
|
|
6
7
|
"license": "MIT",
|
|
7
8
|
"repository": {
|
|
@@ -16,33 +17,29 @@
|
|
|
16
17
|
"publishConfig": {
|
|
17
18
|
"access": "public"
|
|
18
19
|
},
|
|
20
|
+
"exports": {
|
|
21
|
+
"import": "./lib/index.js",
|
|
22
|
+
"require": "./lib/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"main": "lib/lexer.js",
|
|
19
25
|
"files": [
|
|
26
|
+
"lib/**/*.cjs",
|
|
20
27
|
"lib/**/*.d.ts",
|
|
21
28
|
"lib/**/*.js",
|
|
22
|
-
"lib/**/*.cjs",
|
|
23
29
|
"lib/**/*.js.map"
|
|
24
30
|
],
|
|
25
31
|
"engines": {
|
|
26
32
|
"node": ">=18.0"
|
|
27
33
|
},
|
|
28
34
|
"typings": "lib/index",
|
|
29
|
-
"type": "module",
|
|
30
|
-
"main": "lib/lexer.js",
|
|
31
|
-
"exports": {
|
|
32
|
-
"import": "./lib/index.js",
|
|
33
|
-
"require": "./lib/index.cjs"
|
|
34
|
-
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "yarn build:ts && yarn build:transpile",
|
|
37
37
|
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
|
|
38
38
|
"build:transpile": " node \"../../node_modules/esbuild/bin/esbuild\" --format=cjs --bundle --log-level=error --outfile=lib/index.cjs lib/index.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@traqula/core": "^0.0.1-alpha.
|
|
42
|
-
"@traqula/rules-sparql-1-1": "^0.0.1-alpha.
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"@rdfjs/types": "^2.0.0"
|
|
41
|
+
"@traqula/core": "^0.0.1-alpha.9+427f381",
|
|
42
|
+
"@traqula/rules-sparql-1-1": "^0.0.1-alpha.9+427f381"
|
|
46
43
|
},
|
|
47
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "427f3819138dd557621cae40c761213573e60017"
|
|
48
45
|
}
|