@traqula/test-utils 0.0.23 → 0.0.24

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.
@@ -1,49 +1,19 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11
4
  };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var fileUtils_exports = {};
30
- __export(fileUtils_exports, {
31
- readFile: () => readFile,
32
- readFileSync: () => readFileSync
33
- });
34
- module.exports = __toCommonJS(fileUtils_exports);
35
- var import_node_fs = __toESM(require("node:fs"), 1);
36
- var import_promises = __toESM(require("node:fs/promises"), 1);
37
- async function readFile(path, encoding = "utf-8") {
38
- const content = await import_promises.default.readFile(path, encoding);
39
- return content.replaceAll(/\r?\n/gu, "\n");
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.readFile = readFile;
7
+ exports.readFileSync = readFileSync;
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
+ const promises_1 = __importDefault(require("node:fs/promises"));
10
+ async function readFile(path, encoding = 'utf-8') {
11
+ const content = await promises_1.default.readFile(path, encoding);
12
+ return content.replaceAll(/\r?\n/gu, '\n');
40
13
  }
41
- function readFileSync(path, encoding = "utf-8") {
42
- const content = import_node_fs.default.readFileSync(path, encoding);
43
- return content.replaceAll(/\r?\n/gu, "\n");
14
+ function readFileSync(path, encoding = 'utf-8') {
15
+ // eslint-disable-next-line no-sync
16
+ const content = node_fs_1.default.readFileSync(path, encoding);
17
+ return content.replaceAll(/\r?\n/gu, '\n');
44
18
  }
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- readFile,
48
- readFileSync
49
- });
19
+ //# sourceMappingURL=fileUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileUtils.js","sourceRoot":"","sources":["../../../lib/fileUtils.ts"],"names":[],"mappings":";;;;;AAMA,4BAGC;AAED,oCAIC;AAbD,sDAAyB;AAEzB,gEAAmC;AAE5B,KAAK,UAAU,QAAQ,CAAC,IAA2B,EAAE,WAA2B,OAAO;IAC5F,MAAM,OAAO,GAAG,MAAM,kBAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACnD,OAAO,OAAO,CAAC,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED,SAAgB,YAAY,CAAC,IAAY,EAAE,WAA2B,OAAO;IAC3E,mCAAmC;IACnC,MAAM,OAAO,GAAG,iBAAE,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAChD,OAAO,OAAO,CAAC,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["/* eslint-disable import/no-nodejs-modules */\nimport type { PathLike } from 'node:fs';\nimport fs from 'node:fs';\nimport type { FileHandle } from 'node:fs/promises';\nimport fsp from 'node:fs/promises';\n\nexport async function readFile(path: PathLike | FileHandle, encoding: BufferEncoding = 'utf-8'): Promise<string> {\n const content = await fsp.readFile(path, encoding);\n return content.replaceAll(/\\r?\\n/gu, '\\n');\n}\n\nexport function readFileSync(path: string, encoding: BufferEncoding = 'utf-8'): string {\n // eslint-disable-next-line no-sync\n const content = fs.readFileSync(path, encoding);\n return content.replaceAll(/\\r?\\n/gu, '\\n');\n}\n"]}
@@ -1,91 +1,96 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var algebraGenerators_exports = {};
30
- __export(algebraGenerators_exports, {
31
- sparqlAlgebraTests: () => sparqlAlgebraTests,
32
- sparqlQueries: () => sparqlQueries
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
33
17
  });
34
- module.exports = __toCommonJS(algebraGenerators_exports);
35
- var fs = __toESM(require("node:fs"), 1);
36
- var path = __toESM(require("node:path"), 1);
37
- var import_fileUtils = require("../fileUtils.js");
38
- var import_utils = require("./utils.js");
39
- const rootDir = (0, import_utils.getStaticFilePath)("algebra");
40
- const rootSparql = path.join(rootDir, "sparql");
41
- const rootJson = path.join(rootDir, "algebra");
42
- const rootJsonBlankToVariable = path.join(rootDir, "algebra-blank-to-var");
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.sparqlAlgebraTests = sparqlAlgebraTests;
37
+ exports.sparqlQueries = sparqlQueries;
38
+ /* eslint-disable import/no-nodejs-modules,no-sync */
39
+ const fs = __importStar(require("node:fs"));
40
+ const path = __importStar(require("node:path"));
41
+ const fileUtils_js_1 = require("../fileUtils.js");
42
+ const utils_js_1 = require("./utils.js");
43
+ const rootDir = (0, utils_js_1.getStaticFilePath)('algebra');
44
+ const rootSparql = path.join(rootDir, 'sparql');
45
+ const rootJson = path.join(rootDir, 'algebra');
46
+ const rootJsonBlankToVariable = path.join(rootDir, 'algebra-blank-to-var');
43
47
  function* sparqlAlgebraTests(suite, blankToVariable, getSPARQL) {
44
- function* subGen(relativePath) {
45
- const absolutePath = path.join(blankToVariable ? rootJsonBlankToVariable : rootJson, relativePath);
46
- if (fs.lstatSync(absolutePath).isDirectory()) {
47
- for (const sub of fs.readdirSync(absolutePath)) {
48
- yield* subGen(path.join(relativePath, sub));
49
- }
50
- } else {
51
- const name = relativePath.replace(/\.json$/u, "");
52
- const sparqlPath = path.join(rootSparql, relativePath.replace(/\.json/u, ".sparql"));
53
- yield {
54
- name,
55
- json: JSON.parse((0, import_fileUtils.readFileSync)(absolutePath)),
56
- sparql: getSPARQL ? (0, import_fileUtils.readFileSync)(sparqlPath, "utf8") : void 0,
57
- quads: name.endsWith("-quads")
58
- };
48
+ // Relative path starting from roots declared above.
49
+ function* subGen(relativePath) {
50
+ const absolutePath = path.join(blankToVariable ? rootJsonBlankToVariable : rootJson, relativePath);
51
+ if (fs.lstatSync(absolutePath).isDirectory()) {
52
+ // Recursion
53
+ for (const sub of fs.readdirSync(absolutePath)) {
54
+ yield* subGen(path.join(relativePath, sub));
55
+ }
56
+ }
57
+ else {
58
+ const name = relativePath.replace(/\.json$/u, '');
59
+ const sparqlPath = path.join(rootSparql, relativePath.replace(/\.json/u, '.sparql'));
60
+ yield {
61
+ name,
62
+ json: JSON.parse((0, fileUtils_js_1.readFileSync)(absolutePath)),
63
+ sparql: getSPARQL ? (0, fileUtils_js_1.readFileSync)(sparqlPath, 'utf8') : undefined,
64
+ quads: name.endsWith('-quads'),
65
+ };
66
+ }
67
+ }
68
+ const subfolders = fs.readdirSync(blankToVariable ? rootJsonBlankToVariable : rootJson);
69
+ if (subfolders.includes(suite)) {
70
+ yield* subGen(suite);
59
71
  }
60
- }
61
- const subfolders = fs.readdirSync(blankToVariable ? rootJsonBlankToVariable : rootJson);
62
- if (subfolders.includes(suite)) {
63
- yield* subGen(suite);
64
- }
65
72
  }
66
73
  function* sparqlQueries(suite) {
67
- function* subGen(relativePath) {
68
- const absolutePath = path.join(rootSparql, relativePath);
69
- if (fs.lstatSync(absolutePath).isDirectory()) {
70
- for (const sub of fs.readdirSync(absolutePath)) {
71
- yield* subGen(path.join(relativePath, sub));
72
- }
73
- } else {
74
- const name = relativePath.replace(/\.sparql$/u, "");
75
- const content = fs.readFileSync(absolutePath, "utf-8");
76
- yield {
77
- name,
78
- query: content.replaceAll(/\r?\n/gu, "\n")
79
- };
74
+ function* subGen(relativePath) {
75
+ const absolutePath = path.join(rootSparql, relativePath);
76
+ if (fs.lstatSync(absolutePath).isDirectory()) {
77
+ // Recursion
78
+ for (const sub of fs.readdirSync(absolutePath)) {
79
+ yield* subGen(path.join(relativePath, sub));
80
+ }
81
+ }
82
+ else {
83
+ const name = relativePath.replace(/\.sparql$/u, '');
84
+ const content = fs.readFileSync(absolutePath, 'utf-8');
85
+ yield {
86
+ name,
87
+ query: content.replaceAll(/\r?\n/gu, '\n'),
88
+ };
89
+ }
90
+ }
91
+ const subfolders = fs.readdirSync(rootSparql);
92
+ if (subfolders.includes(suite)) {
93
+ yield* subGen(suite);
80
94
  }
81
- }
82
- const subfolders = fs.readdirSync(rootSparql);
83
- if (subfolders.includes(suite)) {
84
- yield* subGen(suite);
85
- }
86
95
  }
87
- // Annotate the CommonJS export names for ESM import in node:
88
- 0 && (module.exports = {
89
- sparqlAlgebraTests,
90
- sparqlQueries
91
- });
96
+ //# sourceMappingURL=algebraGenerators.js.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AAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YACvD,MAAM;gBACJ,IAAI;gBACJ,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC;aAC3C,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,UAAU,GAAG,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC9C,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable import/no-nodejs-modules,no-sync */\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { readFileSync } from '../fileUtils.js';\nimport { getStaticFilePath } from './utils.js';\n\nconst rootDir = getStaticFilePath('algebra');\nconst rootSparql = path.join(rootDir, 'sparql');\nconst rootJson = path.join(rootDir, 'algebra');\nconst rootJsonBlankToVariable = path.join(rootDir, 'algebra-blank-to-var');\n\nexport interface algebraTestGen {\n name: string;\n json: unknown;\n quads: boolean;\n sparql: string | undefined;\n}\n\nexport type AlgebraTestSuite = 'dawg-syntax' | 'sparql-1.1' | 'sparql11-query' | 'sparql12';\n\nexport function sparqlAlgebraTests(suites: AlgebraTestSuite, blankToVariable: boolean, getSPARQL: true):\nGenerator<algebraTestGen & { sparql: string }>;\nexport function sparqlAlgebraTests(suites: AlgebraTestSuite, blankToVariable: boolean, getSPARQL: boolean):\nGenerator<algebraTestGen>;\nexport function* sparqlAlgebraTests(suite: AlgebraTestSuite, blankToVariable: boolean, getSPARQL: boolean):\nGenerator<algebraTestGen> {\n // Relative path starting from roots declared above.\n function* subGen(relativePath: string): Generator<algebraTestGen> {\n const absolutePath = path.join(blankToVariable ? rootJsonBlankToVariable : rootJson, relativePath);\n if (fs.lstatSync(absolutePath).isDirectory()) {\n // Recursion\n for (const sub of fs.readdirSync(absolutePath)) {\n yield* subGen(path.join(relativePath, sub));\n }\n } else {\n const name = relativePath.replace(/\\.json$/u, '');\n const sparqlPath = path.join(rootSparql, relativePath.replace(/\\.json/u, '.sparql'));\n yield {\n name,\n json: JSON.parse(readFileSync(absolutePath)),\n sparql: getSPARQL ? readFileSync(sparqlPath, 'utf8') : undefined,\n quads: name.endsWith('-quads'),\n };\n }\n }\n\n const subfolders = fs.readdirSync(blankToVariable ? rootJsonBlankToVariable : rootJson);\n if (subfolders.includes(suite)) {\n yield* subGen(suite);\n }\n}\n\ntype GenQuery = { query: string; name: string };\nexport function* sparqlQueries(suite: AlgebraTestSuite): Generator<GenQuery> {\n function* subGen(relativePath: string): Generator<GenQuery> {\n const absolutePath = path.join(rootSparql, relativePath);\n if (fs.lstatSync(absolutePath).isDirectory()) {\n // Recursion\n for (const sub of fs.readdirSync(absolutePath)) {\n yield* subGen(path.join(relativePath, sub));\n }\n } else {\n const name = relativePath.replace(/\\.sparql$/u, '');\n const content = fs.readFileSync(absolutePath, 'utf-8');\n yield {\n name,\n query: content.replaceAll(/\\r?\\n/gu, '\\n'),\n };\n }\n }\n\n const subfolders = fs.readdirSync(rootSparql);\n if (subfolders.includes(suite)) {\n yield* subGen(suite);\n }\n}\n"]}
@@ -1,92 +1,93 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var generators_exports = {};
30
- __export(generators_exports, {
31
- negativeTest: () => negativeTest,
32
- positiveTest: () => positiveTest
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
33
17
  });
34
- module.exports = __toCommonJS(generators_exports);
35
- var fs = __toESM(require("node:fs"), 1);
36
- var import_fileUtils = require("../fileUtils.js");
37
- var import_utils = require("./utils.js");
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.positiveTest = positiveTest;
37
+ exports.negativeTest = negativeTest;
38
+ /* eslint-disable import/no-nodejs-modules,no-sync */
39
+ const fs = __importStar(require("node:fs"));
40
+ const fileUtils_js_1 = require("../fileUtils.js");
41
+ const utils_js_1 = require("./utils.js");
38
42
  function* positiveTest(type, filter) {
39
- const dir = (0, import_utils.getStaticFilePath)(type);
40
- const statics = fs.readdirSync(dir);
41
- for (const file of statics) {
42
- if (file.endsWith(".json")) {
43
- if (filter && !filter(file.replace(".json", ""))) {
44
- continue;
45
- }
46
- yield {
47
- name: file.replace(/\.json$/u, ""),
48
- statics: async () => {
49
- const query = await (0, import_fileUtils.readFile)(`${dir}/${file.replace(".json", ".sparql")}`);
50
- const result = await (0, import_fileUtils.readFile)(`${dir}/${file}`);
51
- let autoGen;
52
- try {
53
- autoGen = await (0, import_fileUtils.readFile)(`${dir}/${file.replace(".json", "-generated.sparql")}`);
54
- } catch {
55
- autoGen = query;
56
- }
57
- const json = JSON.parse(result);
58
- return {
59
- query,
60
- ast: json,
61
- autoGen
62
- };
43
+ const dir = (0, utils_js_1.getStaticFilePath)(type);
44
+ const statics = fs.readdirSync(dir);
45
+ for (const file of statics) {
46
+ if (file.endsWith('.json')) {
47
+ if (filter && !filter(file.replace('.json', ''))) {
48
+ continue;
49
+ }
50
+ yield {
51
+ name: file.replace(/\.json$/u, ''),
52
+ statics: async () => {
53
+ const query = await (0, fileUtils_js_1.readFile)(`${dir}/${file.replace('.json', '.sparql')}`);
54
+ const result = await (0, fileUtils_js_1.readFile)(`${dir}/${file}`);
55
+ let autoGen;
56
+ try {
57
+ autoGen = await (0, fileUtils_js_1.readFile)(`${dir}/${file.replace('.json', '-generated.sparql')}`);
58
+ }
59
+ catch {
60
+ autoGen = query;
61
+ }
62
+ const json = JSON.parse(result);
63
+ return {
64
+ query,
65
+ ast: json,
66
+ autoGen,
67
+ };
68
+ },
69
+ };
63
70
  }
64
- };
65
71
  }
66
- }
67
72
  }
68
73
  function* negativeTest(type, filter) {
69
- const dir = (0, import_utils.getStaticFilePath)(type);
70
- const statics = fs.readdirSync(dir);
71
- for (const file of statics) {
72
- if (file.endsWith(".sparql")) {
73
- if (filter && !filter(file.replace(".sparql", ""))) {
74
- continue;
75
- }
76
- yield {
77
- name: file.replace(/\.sparql$/u, ""),
78
- statics: async () => {
79
- const query = await (0, import_fileUtils.readFile)(`${dir}/${file}`);
80
- return {
81
- query
82
- };
74
+ const dir = (0, utils_js_1.getStaticFilePath)(type);
75
+ const statics = fs.readdirSync(dir);
76
+ for (const file of statics) {
77
+ if (file.endsWith('.sparql')) {
78
+ if (filter && !filter(file.replace('.sparql', ''))) {
79
+ continue;
80
+ }
81
+ yield {
82
+ name: file.replace(/\.sparql$/u, ''),
83
+ statics: async () => {
84
+ const query = await (0, fileUtils_js_1.readFile)(`${dir}/${file}`);
85
+ return {
86
+ query,
87
+ };
88
+ },
89
+ };
83
90
  }
84
- };
85
91
  }
86
- }
87
92
  }
88
- // Annotate the CommonJS export names for ESM import in node:
89
- 0 && (module.exports = {
90
- negativeTest,
91
- positiveTest
92
- });
93
+ //# sourceMappingURL=generators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators.js","sourceRoot":"","sources":["../../../../lib/generators/generators.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,oCAgCC;AASD,oCAsBC;AA7ED,qDAAqD;AACrD,4CAA8B;AAC9B,kDAA2C;AAC3C,yCAA+C;AAW/C,QAAe,CAAC,CAAC,YAAY,CAC3B,IAA2C,EAC3C,MAAkC;IAElC,MAAM,GAAG,GAAG,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,EAAE,CAAC,W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AC,GAAG,CAAC,CAAC;IACpC,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC;gBACnD,SAAS;YACX,CAAC;YACD,MAAM;gBACJ,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;gBACpC,OAAO,EAAE,KAAK,IAAG,EAAE;oBACjB,MAAM,KAAK,GAAG,MAAM,IAAA,uBAAQ,EAAC,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,CAAC;oBAC/C,OAAO;wBACL,KAAK;qBACN,CAAC;gBACJ,CAAC;aACF,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable import/no-nodejs-modules,no-sync */\nimport * as fs from 'node:fs';\nimport { readFile } from '../fileUtils.js';\nimport { getStaticFilePath } from './utils.js';\n\ninterface PositiveTest {\n name: string;\n statics: () => Promise<{\n query: string;\n ast: unknown;\n autoGen: string;\n }>;\n}\n\nexport function* positiveTest(\n type: 'paths' | 'sparql-1-1' | 'sparql-1-2',\n filter?: (name: string) => boolean,\n): Generator<PositiveTest> {\n const dir = getStaticFilePath(type);\n const statics = fs.readdirSync(dir);\n for (const file of statics) {\n if (file.endsWith('.json')) {\n if (filter && !filter(file.replace('.json', ''))) {\n continue;\n }\n yield {\n name: file.replace(/\\.json$/u, ''),\n statics: async() => {\n const query = await readFile(`${dir}/${file.replace('.json', '.sparql')}`);\n const result = await readFile(`${dir}/${file}`);\n let autoGen: string;\n try {\n autoGen = await readFile(`${dir}/${file.replace('.json', '-generated.sparql')}`);\n } catch {\n autoGen = query;\n }\n const json: unknown = JSON.parse(result);\n return {\n query,\n ast: json,\n autoGen,\n };\n },\n };\n }\n }\n}\n\ninterface NegativeTest {\n name: string;\n statics: () => Promise<{\n query: string;\n }>;\n}\n\nexport function* negativeTest(\n type: 'sparql-1-1-invalid' | 'sparql-1-2-invalid',\n filter?: (name: string) => boolean,\n): Generator<NegativeTest> {\n const dir = getStaticFilePath(type);\n const statics = fs.readdirSync(dir);\n for (const file of statics) {\n if (file.endsWith('.sparql')) {\n if (filter && !filter(file.replace('.sparql', ''))) {\n continue;\n }\n yield {\n name: file.replace(/\\.sparql$/u, ''),\n statics: async() => {\n const query = await readFile(`${dir}/${file}`);\n return {\n query,\n };\n },\n };\n }\n }\n}\n"]}
@@ -1,42 +1,14 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11
4
  };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var utils_exports = {};
30
- __export(utils_exports, {
31
- getStaticFilePath: () => getStaticFilePath
32
- });
33
- module.exports = __toCommonJS(utils_exports);
34
- var import_node_path = __toESM(require("node:path"), 1);
35
- const staticsPath = import_node_path.default.join(__dirname, "..", "..", "..", "..", "statics");
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getStaticFilePath = getStaticFilePath;
7
+ /* eslint-disable import/no-nodejs-modules */
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ // Note that this path is correct AFTER tsc conversion
10
+ const staticsPath = node_path_1.default.join(__dirname, '..', '..', '..', '..', 'statics');
36
11
  function getStaticFilePath(...paths) {
37
- return import_node_path.default.join(staticsPath, ...paths);
12
+ return node_path_1.default.join(staticsPath, ...paths);
38
13
  }
39
- // Annotate the CommonJS export names for ESM import in node:
40
- 0 && (module.exports = {
41
- getStaticFilePath
42
- });
14
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../lib/generators/utils.ts"],"names":[],"mappings":";;;;;AAMA,8CAEC;AARD,6CAA6C;AAC7C,0DAA6B;AAE7B,sDAAsD;AACtD,MAAM,WAAW,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AAE5E,SAAgB,iBAAiB,CAAC,GAAG,KAAe;IAClD,OAAO,mBAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/* eslint-disable import/no-nodejs-modules */\nimport path from 'node:path';\n\n// Note that this path is correct AFTER tsc conversion\nconst staticsPath = path.join(__dirname, '..', '..', '..', '..', 'statics');\n\nexport function getStaticFilePath(...paths: string[]): string {\n return path.join(staticsPath, ...paths);\n}\n"]}
@@ -1,34 +1,24 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
13
15
  };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var index_exports = {};
17
- module.exports = __toCommonJS(index_exports);
18
- __reExport(index_exports, require("./matchers/toEqualParsedQuery.js"), module.exports);
19
- __reExport(index_exports, require("./matchers/vitest.js"), module.exports);
20
- __reExport(index_exports, require("./generators/generators.js"), module.exports);
21
- __reExport(index_exports, require("./generators/algebraGenerators.js"), module.exports);
22
- __reExport(index_exports, require("./generators/utils.js"), module.exports);
23
- __reExport(index_exports, require("./Sparql11NotesTest.js"), module.exports);
24
- __reExport(index_exports, require("./fileUtils.js"), module.exports);
25
- // Annotate the CommonJS export names for ESM import in node:
26
- 0 && (module.exports = {
27
- ...require("./matchers/toEqualParsedQuery.js"),
28
- ...require("./matchers/vitest.js"),
29
- ...require("./generators/generators.js"),
30
- ...require("./generators/algebraGenerators.js"),
31
- ...require("./generators/utils.js"),
32
- ...require("./Sparql11NotesTest.js"),
33
- ...require("./fileUtils.js")
34
- });
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./matchers/toEqualParsedQuery.js"), exports);
18
+ __exportStar(require("./matchers/vitest.js"), exports);
19
+ __exportStar(require("./generators/generators.js"), exports);
20
+ __exportStar(require("./generators/algebraGenerators.js"), exports);
21
+ __exportStar(require("./generators/utils.js"), exports);
22
+ __exportStar(require("./Sparql11NotesTest.js"), exports);
23
+ __exportStar(require("./fileUtils.js"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,uDAAqC;AACrC,6DAA2C;AAC3C,oEAAkD;AAClD,wDAAsC;AACtC,yDAAuC;AACvC,iDAA+B","sourcesContent":["export * from './matchers/toEqualParsedQuery.js';\nexport * from './matchers/vitest.js';\nexport * from './generators/generators.js';\nexport * from './generators/algebraGenerators.js';\nexport * from './generators/utils.js';\nexport * from './Sparql11NotesTest.js';\nexport * from './fileUtils.js';\n"]}