diff --git a/.gitignore b/.gitignore
index b947077..18566ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
node_modules/
-dist/
+.vscode
\ No newline at end of file
diff --git a/.mocharc.json b/.mocharc.json
new file mode 100644
index 0000000..24bb7d6
--- /dev/null
+++ b/.mocharc.json
@@ -0,0 +1,17 @@
+{
+ "loader": "ts-node/esm",
+ "extensions": [
+ "ts",
+ "tsx"
+ ],
+ "spec": [
+ "src/**/*.test.*"
+ ],
+ "node-option": [
+ "experimental-specifier-resolution=node",
+ "loader=ts-node/esm"
+ ],
+ "watch-files": [
+ "src"
+ ]
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 72d0169..faa2412 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ For development you will need to get the latest `woql.json` from the
terminusdb repository. Assuming you have wget installed, you can run:
```
-$ npm run woql-get
+$ npm run woqlget
```
After which you can build the new `woql.ts` file by running
@@ -24,3 +24,55 @@ After which you can build the new `woql.ts` file by running
```
$ npx src/generate.ts
```
+
+## Usage example
+
+The WOQL below query identifies document identifiers that are not subdocuments.
+
+```javascript
+const woqlStr = `
+and(triple(doc, "rdf:type", type),
+ not(quad(type, "sys:subdocument", unbound, "schema")),
+)
+`
+const woql = parseWoqlString(woqlStr);
+const postBody = prepareWoqlHttpPostBody(woql);
+const result = await terminusClient.sendCustomRequest("POST", `http://localhost:6363/api/woql/admin/sandbox/local/branch/main`, postBody);
+```
+
+
+## Syntax options for variables
+
+The WOQL DSL parser and WOQL transformer supports new WOQL authoring styles. Variables can now be declared in multiple ways, and the DSL even support undeclared variables.
+
+* Variables get assigned through the new `(var1, var2, var3...) => { ... }`
+* Undeclared variables are supported for the DSL (similar to datalog variables)
+* Variables support the `v:` prefix to maintain backwards compatibility
+
+### Examples
+
+```javascript
+(doc, type, unbound) =>
+ and(
+ triple(doc, "rdf:type", type),
+ not(quad(type, "sys:subdocument", unbound, "schema")),
+ )
+```
+
+```javascript
+and(
+ triple(doc, "rdf:type", type),
+ not(quad(type, "sys:subdocument", unbound, "schema")),
+)
+```
+
+```javascript
+and(
+ triple("v:doc", "rdf:type", "v:type"),
+ not(quad("v:type", "sys:subdocument", "v:unbound", "schema")),
+)
+```
+
+## Unimplemented key functionality
+
+* As (for CSV Get handling to support previous functionality)
diff --git a/dist/generate.d.ts b/dist/generate.d.ts
new file mode 100644
index 0000000..cb0ff5c
--- /dev/null
+++ b/dist/generate.d.ts
@@ -0,0 +1 @@
+export {};
diff --git a/dist/generate.js b/dist/generate.js
new file mode 100644
index 0000000..042fd4c
--- /dev/null
+++ b/dist/generate.js
@@ -0,0 +1,3 @@
+import { generateWoql } from './woql_defs/generate.js';
+await generateWoql();
+//# sourceMappingURL=generate.js.map
\ No newline at end of file
diff --git a/dist/generate.js.map b/dist/generate.js.map
new file mode 100644
index 0000000..0819a3c
--- /dev/null
+++ b/dist/generate.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEtD,MAAM,YAAY,EAAE,CAAA"}
\ No newline at end of file
diff --git a/dist/index.d.ts b/dist/index.d.ts
new file mode 100644
index 0000000..219c9fb
--- /dev/null
+++ b/dist/index.d.ts
@@ -0,0 +1,3 @@
+export * from './syntax.js';
+export * from './lib/index.js';
+export * as WOQL from './syntax.js';
diff --git a/dist/index.js b/dist/index.js
new file mode 100644
index 0000000..11229de
--- /dev/null
+++ b/dist/index.js
@@ -0,0 +1,4 @@
+export * from './syntax.js';
+export * from './lib/index.js';
+export * as WOQL from './syntax.js';
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/dist/index.js.map b/dist/index.js.map
new file mode 100644
index 0000000..5e76d4f
--- /dev/null
+++ b/dist/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/JsWoqlAstTransformer.d.ts b/dist/lib/AstTransformation/JsWoqlAstTransformer.d.ts
new file mode 100644
index 0000000..880a9bd
--- /dev/null
+++ b/dist/lib/AstTransformation/JsWoqlAstTransformer.d.ts
@@ -0,0 +1,14 @@
+import type { Node } from 'acorn';
+import type { Query } from '../../syntax.js';
+export declare class AstJsWoqlTransformer {
+ transform(node: Node): Query;
+ private visitNodeValue;
+ private visitNode;
+ private visitIdentifier;
+ private visitLiteral;
+ private readonly literalExceptions;
+ private currentCallExpression;
+ private visitCallExpression;
+ private readonly registeredVariableNames;
+ private visitArrowFunctionExpression;
+}
diff --git a/dist/lib/AstTransformation/JsWoqlAstTransformer.js b/dist/lib/AstTransformation/JsWoqlAstTransformer.js
new file mode 100644
index 0000000..c126245
--- /dev/null
+++ b/dist/lib/AstTransformation/JsWoqlAstTransformer.js
@@ -0,0 +1,247 @@
+import { Graph, lit } from '../../syntax.js';
+import { WOQL } from '../../index.js';
+function lowerCamelCase(inputString) {
+ if (inputString.length > 1) {
+ return (inputString[0].toLowerCase() + inputString.slice(1, inputString.length));
+ }
+ return inputString.toLowerCase();
+}
+function renameFunction(inputString) {
+ const newName = lowerCamelCase(inputString);
+ if (newName === 'eval') {
+ return 'compute';
+ }
+ else if (newName === 'true') {
+ return 'success';
+ }
+ else {
+ return newName;
+ }
+}
+const supportedWoql = [
+ 'Using',
+ 'Select',
+ 'Distinct',
+ 'And',
+ 'Or',
+ 'From',
+ 'Into',
+ 'Triple',
+ 'AddTriple',
+ 'AddedTriple',
+ 'DeleteTriple',
+ 'DeletedTriple',
+ 'Subsumption',
+ 'Equals',
+ 'Substring',
+ 'ReadDocument',
+ 'UpdateDocument',
+ 'InsertDocument',
+ 'DeleteDocument',
+ 'Get',
+ 'Trim',
+ 'Eval',
+ 'Plus',
+ 'Minus',
+ 'Times',
+ 'Divide',
+ 'Div',
+ 'Exp',
+ 'Floor',
+ 'IsA',
+ 'Like',
+ 'Less',
+ 'Greater',
+ 'Optional',
+ 'Upper',
+ 'Lower',
+ 'Pad',
+ 'Split',
+ 'Member',
+ 'Concatenate',
+ 'Join',
+ 'Sum',
+ 'Start',
+ 'Limit',
+ 'Regexp',
+ 'True',
+ 'OrderBy',
+ 'GroupBy',
+ 'Length',
+ 'Not',
+ 'Once',
+ 'Immediately',
+ 'Count',
+ 'Typecast',
+ 'Path',
+ 'PathPredicate',
+ 'InversePathPredicate',
+ 'PathSequence',
+ 'PathOr',
+ 'PathPlus',
+ 'PathStar',
+ 'PathTimes',
+ 'Dot',
+ 'TypeOf',
+ 'Quad',
+];
+const supportedWoqlFunctions = supportedWoql.map((woql) => renameFunction(woql));
+export class AstJsWoqlTransformer {
+ constructor() {
+ this.literalExceptions = ['triple', 'quad'];
+ this.currentCallExpression = undefined;
+ this.registeredVariableNames = [];
+ }
+ transform(node) {
+ return this.visitNode(node);
+ }
+ visitNodeValue(node, nodeType) {
+ switch (node === null || node === void 0 ? void 0 : node.type) {
+ case 'Identifier': {
+ return this.visitIdentifier(node, nodeType);
+ }
+ case 'Literal': {
+ const valueNode = node;
+ if (typeof (valueNode === null || valueNode === void 0 ? void 0 : valueNode.value) !== 'string')
+ throw new Error(`${nodeType} is not a string`);
+ if (valueNode.value.startsWith('v:')) {
+ return {
+ '@type': nodeType,
+ variable: valueNode.value.substring(2),
+ };
+ }
+ return {
+ '@type': nodeType,
+ node: valueNode.value,
+ };
+ }
+ default:
+ throw new Error(`Unhandled value type: ${node === null || node === void 0 ? void 0 : node.type}, full node: ${JSON.stringify(node)}`);
+ }
+ }
+ visitNode(node) {
+ switch (node === null || node === void 0 ? void 0 : node.type) {
+ case 'Program': {
+ const body = node === null || node === void 0 ? void 0 : node.body;
+ if (Array.isArray(body) && body.length === 1) {
+ return this.visitNode(body[0]);
+ }
+ else {
+ throw new Error(`Only a single expression is supported: ${node === null || node === void 0 ? void 0 : node.type}`);
+ }
+ }
+ case 'BlockStatement': {
+ const body = node === null || node === void 0 ? void 0 : node.body;
+ if (Array.isArray(body) && body.length === 1) {
+ return this.visitNode(body[0]);
+ }
+ else {
+ throw new Error(`Only a single expression is supported: ${node === null || node === void 0 ? void 0 : node.type}`);
+ }
+ }
+ case 'ExpressionStatement': {
+ const expression = node.expression;
+ return this.visitNode(expression);
+ }
+ case 'CallExpression': {
+ return this.visitCallExpression(node);
+ }
+ case 'Identifier': {
+ return this.visitIdentifier(node, 'NodeValue');
+ }
+ case 'Literal': {
+ return this.visitLiteral(node);
+ }
+ case 'ArrowFunctionExpression':
+ return this.visitArrowFunctionExpression(node);
+ default:
+ throw new Error(`Unhandled node type: ${node === null || node === void 0 ? void 0 : node.type}, full node: ${JSON.stringify(node)}`);
+ }
+ }
+ visitIdentifier(node, identifierType) {
+ if (node.type === 'Identifier') {
+ return {
+ '@type': identifierType,
+ variable: node.name,
+ };
+ }
+ else {
+ throw new Error(`Unhandled node type: ${node === null || node === void 0 ? void 0 : node.type}`);
+ }
+ }
+ visitLiteral(node) {
+ var _a, _b;
+ try {
+ const value = (_b = JSON.parse((_a = node.raw) !== null && _a !== void 0 ? _a : '')) !== null && _b !== void 0 ? _b : node.value;
+ if (typeof this.currentCallExpression === 'string' &&
+ this.currentCallExpression !== '' &&
+ this.literalExceptions.includes(this.currentCallExpression)) {
+ return lit(value);
+ }
+ else {
+ return value;
+ }
+ }
+ catch (e) {
+ throw new Error(`Unhandled literal value: ${node === null || node === void 0 ? void 0 : node.value}`);
+ }
+ }
+ visitCallExpression(node) {
+ var _a;
+ const callIdentifier = this.visitIdentifier(node.callee, undefined);
+ const callee = callIdentifier === null || callIdentifier === void 0 ? void 0 : callIdentifier.variable;
+ this.currentCallExpression = callee;
+ if (typeof callee === 'string' &&
+ callee !== '' &&
+ supportedWoqlFunctions.includes(callee)) {
+ switch (callee) {
+ case 'select':
+ case 'distinct': {
+ const lastArg = node.arguments.pop();
+ if (lastArg === null || lastArg === undefined) {
+ throw new Error(`${callee} requires at least one argument`);
+ }
+ const woql = this.visitNode(lastArg);
+ const identifiers = node.arguments.map((arg) => this.visitIdentifier(arg, 'NodeValue').variable);
+ if (callee === 'select') {
+ return WOQL.select(identifiers, woql);
+ }
+ else if (callee === 'distinct') {
+ return WOQL.distinct(identifiers, woql);
+ }
+ else {
+ throw new Error(`Unhandled ${callee}`);
+ }
+ }
+ case 'triple': {
+ return WOQL.triple(this.visitNodeValue(node.arguments[0], 'NodeValue'), this.visitNodeValue(node.arguments[1], 'NodeValue'), this.visitNodeValue(node.arguments[2], 'Value'));
+ }
+ case 'quad': {
+ return WOQL.quad(this.visitNodeValue(node.arguments[0], 'NodeValue'), this.visitNodeValue(node.arguments[1], 'NodeValue'), this.visitNodeValue(node.arguments[2], 'Value'), (_a = (this.visitLiteral(node.arguments[3])['@value'] ===
+ 'instance'
+ ? Graph.instance
+ : Graph.schema)) !== null && _a !== void 0 ? _a : undefined);
+ }
+ case 'equals': {
+ return WOQL.equals(this.visitNodeValue(node.arguments[0], 'Value'), this.visitNodeValue(node.arguments[1], 'Value'));
+ }
+ default: {
+ // Here we limit what functions can be called from the library to the allowed terms
+ // It must not be allowed to call any function, but restricted to only functions.
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ return WOQL[callee](...node.arguments.map((arg) => this.visitNode(arg)));
+ }
+ }
+ }
+ else {
+ throw new Error(`Unsupported function: ${callee}`);
+ }
+ }
+ visitArrowFunctionExpression(node) {
+ const params = Array.isArray(node.params) ? node.params : [node.params];
+ const variables = params.map((identifer) => { var _a; return (_a = this.visitIdentifier(identifer, undefined)) === null || _a === void 0 ? void 0 : _a.variable; });
+ this.registeredVariableNames.push(...variables);
+ return this.visitNode(node.body);
+ }
+}
+//# sourceMappingURL=JsWoqlAstTransformer.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/JsWoqlAstTransformer.js.map b/dist/lib/AstTransformation/JsWoqlAstTransformer.js.map
new file mode 100644
index 0000000..a0f3418
--- /dev/null
+++ b/dist/lib/AstTransformation/JsWoqlAstTransformer.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"JsWoqlAstTransformer.js","sourceRoot":"","sources":["../../../src/lib/AstTransformation/JsWoqlAstTransformer.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAErC,SAAS,cAAc,CAAC,WAAmB;IACzC,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;QAC1B,OAAO,CACL,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CACxE,CAAA;KACF;IACD,OAAO,WAAW,CAAC,WAAW,EAAE,CAAA;AAClC,CAAC;AAED,SAAS,cAAc,CAAC,WAAmB;IACzC,MAAM,OAAO,GAAG,cAAc,CAAC,WAAW,CAAC,CAAA;IAC3C,IAAI,OAAO,KAAK,MAAM,EAAE;QACtB,OAAO,SAAS,CAAA;KACjB;SAAM,IAAI,OAAO,KAAK,MAAM,EAAE;QAC7B,OAAO,SAAS,CAAA;KACjB;SAAM;QACL,OAAO,OAAO,CAAA;KACf;AACH,CAAC;AAED,MAAM,aAAa,GAAG;IACpB,OAAO;IACP,QAAQ;IACR,UAAU;IACV,KAAK;IACL,IAAI;IACJ,MAAM;IACN,MAAM;IACN,QAAQ;IACR,WAAW;IACX,aAAa;IACb,cAAc;IACd,eAAe;IACf,aAAa;IACb,QAAQ;IACR,WAAW;IACX,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;IACR,KAAK;IACL,KAAK;IACL,OAAO;IACP,KAAK;IACL,MAAM;IACN,M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,KAAK,QAAQ,CAAC,CAAC;oBACb,OAAO,IAAI,CAAC,MAAM,CAChB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAC/C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAChD,CAAA;iBACF;gBACD,OAAO,CAAC,CAAC;oBACP,mFAAmF;oBACnF,iFAAiF;oBACjF,8DAA8D;oBAC9D,OAAQ,IAAI,CAAC,MAA2B,CAAS,CAC/C,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CACpD,CAAA;iBACF;aACF;SACF;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAA;SACnD;IACH,CAAC;IAIO,4BAA4B,CAClC,IAA6B;QAE7B,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACvE,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAC1B,CAAC,SAAS,EAAE,EAAE,WAAC,OAAA,MAAA,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,0CAAE,QAAQ,CAAA,EAAA,CACpE,CAAA;QACD,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAA;QAC/C,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAClC,CAAC;CACF"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/JsWoqlAstTransformer.test.d.ts b/dist/lib/AstTransformation/JsWoqlAstTransformer.test.d.ts
new file mode 100644
index 0000000..152756f
--- /dev/null
+++ b/dist/lib/AstTransformation/JsWoqlAstTransformer.test.d.ts
@@ -0,0 +1,5 @@
+import type { Query } from '../../syntax.js';
+export interface MockData {
+ textWoql: string;
+ woqlAst: Query;
+}
diff --git a/dist/lib/AstTransformation/JsWoqlAstTransformer.test.js b/dist/lib/AstTransformation/JsWoqlAstTransformer.test.js
new file mode 100644
index 0000000..c193fdf
--- /dev/null
+++ b/dist/lib/AstTransformation/JsWoqlAstTransformer.test.js
@@ -0,0 +1,22 @@
+// tests/calculator.spec.tx
+import { assert } from 'chai';
+import mock from './mock/index.js';
+import documentQuery from './mock/_documentQuery.woql.js';
+import { parseWoqlString } from './parseWoqlString.js';
+describe('Basic AST Transformation Sanity Check', () => {
+ it('should compile the string WOQL to an accurate WOQL AST', () => {
+ const result = parseWoqlString(documentQuery.textWoql);
+ assert.deepEqual(result, documentQuery.woqlAst);
+ });
+});
+describe('Specific AST Transformation Checks', () => {
+ Object.keys(mock).forEach((testTerm) => {
+ mock[testTerm].forEach((testCase, index) => {
+ it(`should compile ${testTerm} test ${index} correctly to WOQL AST`, () => {
+ const result = parseWoqlString(testCase.textWoql);
+ assert.deepEqual(result, testCase.woqlAst);
+ });
+ });
+ });
+});
+//# sourceMappingURL=JsWoqlAstTransformer.test.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/JsWoqlAstTransformer.test.js.map b/dist/lib/AstTransformation/JsWoqlAstTransformer.test.js.map
new file mode 100644
index 0000000..9b9864e
--- /dev/null
+++ b/dist/lib/AstTransformation/JsWoqlAstTransformer.test.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"JsWoqlAstTransformer.test.js","sourceRoot":"","sources":["../../../src/lib/AstTransformation/JsWoqlAstTransformer.test.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,IAAI,MAAM,iBAAiB,CAAA;AAClC,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAStD,QAAQ,CAAC,uCAAuC,EAAE,GAAG,EAAE;IACrD,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAChE,MAAM,MAAM,GAAG,eAAe,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;QACtD,MAAM,CAAC,SAAS,CAAC,MAAgB,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IAC3D,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,oCAAoC,EAAE,GAAG,EAAE;IAClD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACrC,IAAI,CAAC,QAAoB,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;YACrD,EAAE,CAAC,kBAAkB,QAAQ,SAAS,KAAK,wBAAwB,EAAE,GAAG,EAAE;gBACxE,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;gBACjD,MAAM,CAAC,SAAS,CAAC,MAAgB,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;YACtD,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/_allMocks.d.ts b/dist/lib/AstTransformation/mock/_allMocks.d.ts
new file mode 100644
index 0000000..9e46365
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/_allMocks.d.ts
@@ -0,0 +1,7 @@
+export { default as select } from './select.woql.js';
+export { default as distinct } from './distinct.woql.js';
+export { default as or } from './or.woql.js';
+export { default as and } from './and.woql.js';
+export { default as triple } from './triple.woql.js';
+export { default as equals } from './equals.woql.js';
+export { default as not } from './not.woql.js';
diff --git a/dist/lib/AstTransformation/mock/_allMocks.js b/dist/lib/AstTransformation/mock/_allMocks.js
new file mode 100644
index 0000000..ee45459
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/_allMocks.js
@@ -0,0 +1,8 @@
+export { default as select } from './select.woql.js';
+export { default as distinct } from './distinct.woql.js';
+export { default as or } from './or.woql.js';
+export { default as and } from './and.woql.js';
+export { default as triple } from './triple.woql.js';
+export { default as equals } from './equals.woql.js';
+export { default as not } from './not.woql.js';
+//# sourceMappingURL=_allMocks.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/_allMocks.js.map b/dist/lib/AstTransformation/mock/_allMocks.js.map
new file mode 100644
index 0000000..2473570
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/_allMocks.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"_allMocks.js","sourceRoot":"","sources":["../../../../src/lib/AstTransformation/mock/_allMocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,eAAe,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/_documentQuery.woql.d.ts b/dist/lib/AstTransformation/mock/_documentQuery.woql.d.ts
new file mode 100644
index 0000000..3e654e5
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/_documentQuery.woql.d.ts
@@ -0,0 +1,5 @@
+declare const _default: {
+ textWoql: string;
+ woqlAst: import("../../../syntax.js").And;
+};
+export default _default;
diff --git a/dist/lib/AstTransformation/mock/_documentQuery.woql.js b/dist/lib/AstTransformation/mock/_documentQuery.woql.js
new file mode 100644
index 0000000..8df4845
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/_documentQuery.woql.js
@@ -0,0 +1,54 @@
+import { Graph } from '../../../syntax.js';
+const textWoql = `
+(doc, type, unbound) => {
+ and(
+ triple(doc, "rdf:type", type),
+ not(quad(type, "sys:subdocument", unbound, "schema")),
+ )
+}
+`;
+const woqlAst = {
+ '@type': 'And',
+ and: [
+ {
+ '@type': 'Triple',
+ graph: undefined,
+ subject: {
+ '@type': 'NodeValue',
+ variable: 'doc',
+ },
+ predicate: {
+ '@type': 'NodeValue',
+ node: 'rdf:type',
+ },
+ object: {
+ '@type': 'Value',
+ variable: 'type',
+ },
+ },
+ {
+ '@type': 'Not',
+ query: {
+ '@type': 'Triple',
+ subject: {
+ '@type': 'NodeValue',
+ variable: 'type',
+ },
+ predicate: {
+ '@type': 'NodeValue',
+ node: 'sys:subdocument',
+ },
+ object: {
+ '@type': 'Value',
+ variable: 'unbound',
+ },
+ graph: Graph.schema,
+ },
+ },
+ ],
+};
+export default {
+ textWoql,
+ woqlAst,
+};
+//# sourceMappingURL=_documentQuery.woql.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/_documentQuery.woql.js.map b/dist/lib/AstTransformation/mock/_documentQuery.woql.js.map
new file mode 100644
index 0000000..0a256b8
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/_documentQuery.woql.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"_documentQuery.woql.js","sourceRoot":"","sources":["../../../../src/lib/AstTransformation/mock/_documentQuery.woql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,oBAAoB,CAAA;AAEtD,MAAM,QAAQ,GAAW;;;;;;;CAOxB,CAAA;AAED,MAAM,OAAO,GAAU;IACrB,OAAO,EAAE,KAAK;IACd,GAAG,EAAE;QACH;YACE,OAAO,EAAE,QAAQ;YACjB,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE;gBACP,OAAO,EAAE,WAAW;gBACpB,QAAQ,EAAE,KAAK;aAChB;YACD,SAAS,EAAE;gBACT,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,UAAU;aACjB;YACD,MAAM,EAAE;gBACN,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,MAAM;aACjB;SACF;QACD;YACE,OAAO,EAAE,KAAK;YACd,KAAK,EAAE;gBACL,OAAO,EAAE,QAAQ;gBACjB,OAAO,EAAE;oBACP,OAAO,EAAE,WAAW;oBACpB,QAAQ,EAAE,MAAM;iBACjB;gBACD,SAAS,EAAE;oBACT,OAAO,EAAE,WAAW;oBACpB,IAAI,EAAE,iBAAiB;iBACxB;gBACD,MAAM,EAAE;oBACN,OAAO,EAAE,OAAO;oBAChB,QAAQ,EAAE,SAAS;iBACpB;gBACD,KAAK,EAAE,KAAK,CAAC,MAAM;aACpB;SACF;KACF;CACF,CAAA;AAED,eAAe;IACb,QAAQ;IACR,OAAO;CACR,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/allMocks.d.ts b/dist/lib/AstTransformation/mock/allMocks.d.ts
new file mode 100644
index 0000000..fd25a87
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/allMocks.d.ts
@@ -0,0 +1,5 @@
+export { default as select } from './select.woql.js';
+export { default as or } from './or.woql.js';
+export { default as and } from './and.woql.js';
+export { default as triple } from './triple.woql.js';
+export { default as eq } from './eq.woql.js';
diff --git a/dist/lib/AstTransformation/mock/allMocks.js b/dist/lib/AstTransformation/mock/allMocks.js
new file mode 100644
index 0000000..2db6888
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/allMocks.js
@@ -0,0 +1,6 @@
+export { default as select } from './select.woql.js';
+export { default as or } from './or.woql.js';
+export { default as and } from './and.woql.js';
+export { default as triple } from './triple.woql.js';
+export { default as eq } from './eq.woql.js';
+//# sourceMappingURL=allMocks.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/allMocks.js.map b/dist/lib/AstTransformation/mock/allMocks.js.map
new file mode 100644
index 0000000..e776576
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/allMocks.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"allMocks.js","sourceRoot":"","sources":["../../../../src/lib/AstTransformation/mock/allMocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,cAAc,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/and.woql.d.ts b/dist/lib/AstTransformation/mock/and.woql.d.ts
new file mode 100644
index 0000000..3a50fcd
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/and.woql.d.ts
@@ -0,0 +1,3 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js';
+declare const mock: MockData[];
+export default mock;
diff --git a/dist/lib/AstTransformation/mock/and.woql.js b/dist/lib/AstTransformation/mock/and.woql.js
new file mode 100644
index 0000000..1ab0a7c
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/and.woql.js
@@ -0,0 +1,33 @@
+const mock = [
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ and(
+ triple(doc,"rdf:type",type),
+ triple(doc,"rdf:type",type)
+ )
+}
+`,
+ woqlAst: {
+ '@type': 'And',
+ and: [
+ {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ ],
+ },
+ },
+];
+export default mock;
+//# sourceMappingURL=and.woql.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/and.woql.js.map b/dist/lib/AstTransformation/mock/and.woql.js.map
new file mode 100644
index 0000000..9dfb133
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/and.woql.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"and.woql.js","sourceRoot":"","sources":["../../../../src/lib/AstTransformation/mock/and.woql.ts"],"names":[],"mappings":"AAEA,MAAM,IAAI,GAAe;IACvB;QACE,QAAQ,EAAE;;;;;;;CAOb;QACG,OAAO,EAAE;YACP,OAAO,EAAE,KAAK;YACd,GAAG,EAAE;gBACH;oBACE,OAAO,EAAE,QAAQ;oBACjB,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE;oBAClD,SAAS,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE;oBACrD,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;oBAC9C,KAAK,EAAE,SAAS;iBACjB;gBACD;oBACE,OAAO,EAAE,QAAQ;oBACjB,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE;oBAClD,SAAS,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE;oBACrD,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;oBAC9C,KAAK,EAAE,SAAS;iBACjB;aACF;SACF;KACF;CACF,CAAA;AAED,eAAe,IAAI,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/distinct.woql.d.ts b/dist/lib/AstTransformation/mock/distinct.woql.d.ts
new file mode 100644
index 0000000..3a50fcd
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/distinct.woql.d.ts
@@ -0,0 +1,3 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js';
+declare const mock: MockData[];
+export default mock;
diff --git a/dist/lib/AstTransformation/mock/distinct.woql.js b/dist/lib/AstTransformation/mock/distinct.woql.js
new file mode 100644
index 0000000..5dbdf78
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/distinct.woql.js
@@ -0,0 +1,37 @@
+const mock = [
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ distinct(doc,and())
+}
+`,
+ woqlAst: {
+ '@type': 'Distinct',
+ query: {
+ '@type': 'And',
+ and: [],
+ },
+ variables: ['doc'],
+ },
+ },
+ {
+ textWoql: `
+ (doc, type, unbound) => {
+ distinct(doc,type,triple(doc,"rdf:type",type))
+ }
+ `,
+ woqlAst: {
+ '@type': 'Distinct',
+ query: {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ variables: ['doc', 'type'],
+ },
+ },
+];
+export default mock;
+//# sourceMappingURL=distinct.woql.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/distinct.woql.js.map b/dist/lib/AstTransformation/mock/distinct.woql.js.map
new file mode 100644
index 0000000..a3c09cb
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/distinct.woql.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"distinct.woql.js","sourceRoot":"","sources":["../../../../src/lib/AstTransformation/mock/distinct.woql.ts"],"names":[],"mappings":"AAEA,MAAM,IAAI,GAAe;IACvB;QACE,QAAQ,EAAE;;;;CAIb;QACG,OAAO,EAAE;YACP,OAAO,EAAE,UAAU;YACnB,KAAK,EAAE;gBACL,OAAO,EAAE,KAAK;gBACd,GAAG,EAAE,EAAE;aACR;YACD,SAAS,EAAE,CAAC,KAAK,CAAC;SACnB;KACF;IACD;QACE,QAAQ,EAAE;;;;GAIX;QAEC,OAAO,EAAE;YACP,OAAO,EAAE,UAAU;YACnB,KAAK,EAAE;gBACL,OAAO,EAAE,QAAQ;gBACjB,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE;gBAClD,SAAS,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE;gBACrD,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;gBAC9C,KAAK,EAAE,SAAS;aACjB;YACD,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;SAC3B;KACF;CACF,CAAA;AAED,eAAe,IAAI,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/eq.woql.d.ts b/dist/lib/AstTransformation/mock/eq.woql.d.ts
new file mode 100644
index 0000000..3a50fcd
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/eq.woql.d.ts
@@ -0,0 +1,3 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js';
+declare const mock: MockData[];
+export default mock;
diff --git a/dist/lib/AstTransformation/mock/eq.woql.js b/dist/lib/AstTransformation/mock/eq.woql.js
new file mode 100644
index 0000000..4c2e868
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/eq.woql.js
@@ -0,0 +1,40 @@
+const mock = [
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ equals(doc,"rdf:type")
+}
+`,
+ woqlAst: {
+ '@type': 'Equals',
+ left: {
+ '@type': 'Value',
+ variable: 'doc',
+ },
+ right: {
+ '@type': 'Value',
+ node: 'rdf:type',
+ },
+ },
+ },
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ eq(doc,"rdf:type")
+}
+`,
+ woqlAst: {
+ '@type': 'Equals',
+ left: {
+ '@type': 'Value',
+ variable: 'doc',
+ },
+ right: {
+ '@type': 'Value',
+ node: 'rdf:type',
+ },
+ },
+ },
+];
+export default mock;
+//# sourceMappingURL=eq.woql.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/eq.woql.js.map b/dist/lib/AstTransformation/mock/eq.woql.js.map
new file mode 100644
index 0000000..ae8baa6
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/eq.woql.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"eq.woql.js","sourceRoot":"","sources":["../../../../src/lib/AstTransformation/mock/eq.woql.ts"],"names":[],"mappings":"AAEA,MAAM,IAAI,GAAe;IACvB;QACE,QAAQ,EAAE;;;;CAIb;QACG,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ;YACjB,IAAI,EAAE;gBACJ,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,KAAK;aAChB;YACD,KAAK,EAAE;gBACL,OAAO,EAAE,OAAO;gBAChB,IAAI,EAAE,UAAU;aACjB;SACF;KACF;IACD;QACE,QAAQ,EAAE;;;;CAIb;QACG,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ;YACjB,IAAI,EAAE;gBACJ,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,KAAK;aAChB;YACD,KAAK,EAAE;gBACL,OAAO,EAAE,OAAO;gBAChB,IAAI,EAAE,UAAU;aACjB;SACF;KACF;CACF,CAAA;AAED,eAAe,IAAI,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/equals.woql.d.ts b/dist/lib/AstTransformation/mock/equals.woql.d.ts
new file mode 100644
index 0000000..3a50fcd
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/equals.woql.d.ts
@@ -0,0 +1,3 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js';
+declare const mock: MockData[];
+export default mock;
diff --git a/dist/lib/AstTransformation/mock/equals.woql.js b/dist/lib/AstTransformation/mock/equals.woql.js
new file mode 100644
index 0000000..4377441
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/equals.woql.js
@@ -0,0 +1,22 @@
+const mock = [
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ equals(doc,"rdf:type")
+}
+`,
+ woqlAst: {
+ '@type': 'Equals',
+ left: {
+ '@type': 'Value',
+ variable: 'doc',
+ },
+ right: {
+ '@type': 'Value',
+ node: 'rdf:type',
+ },
+ },
+ },
+];
+export default mock;
+//# sourceMappingURL=equals.woql.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/equals.woql.js.map b/dist/lib/AstTransformation/mock/equals.woql.js.map
new file mode 100644
index 0000000..fcd6c96
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/equals.woql.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"equals.woql.js","sourceRoot":"","sources":["../../../../src/lib/AstTransformation/mock/equals.woql.ts"],"names":[],"mappings":"AAEA,MAAM,IAAI,GAAe;IACvB;QACE,QAAQ,EAAE;;;;CAIb;QACG,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ;YACjB,IAAI,EAAE;gBACJ,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,KAAK;aAChB;YACD,KAAK,EAAE;gBACL,OAAO,EAAE,OAAO;gBAChB,IAAI,EAAE,UAAU;aACjB;SACF;KACF;CACF,CAAA;AAED,eAAe,IAAI,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/index.d.ts b/dist/lib/AstTransformation/mock/index.d.ts
new file mode 100644
index 0000000..647cbcf
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/index.d.ts
@@ -0,0 +1,2 @@
+import * as mock from './_allMocks.js';
+export default mock;
diff --git a/dist/lib/AstTransformation/mock/index.js b/dist/lib/AstTransformation/mock/index.js
new file mode 100644
index 0000000..e1c361c
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/index.js
@@ -0,0 +1,3 @@
+import * as mock from './_allMocks.js';
+export default mock;
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/index.js.map b/dist/lib/AstTransformation/mock/index.js.map
new file mode 100644
index 0000000..8c2a6bc
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/AstTransformation/mock/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAEtC,eAAe,IAAI,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/not.woql.d.ts b/dist/lib/AstTransformation/mock/not.woql.d.ts
new file mode 100644
index 0000000..3a50fcd
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/not.woql.d.ts
@@ -0,0 +1,3 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js';
+declare const mock: MockData[];
+export default mock;
diff --git a/dist/lib/AstTransformation/mock/not.woql.js b/dist/lib/AstTransformation/mock/not.woql.js
new file mode 100644
index 0000000..49b1ce1
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/not.woql.js
@@ -0,0 +1,29 @@
+const mock = [
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ and(
+ not(
+ triple(doc,"rdf:type",type)
+ ))
+}
+`,
+ woqlAst: {
+ '@type': 'And',
+ and: [
+ {
+ '@type': 'Not',
+ query: {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ },
+ ],
+ },
+ },
+];
+export default mock;
+//# sourceMappingURL=not.woql.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/not.woql.js.map b/dist/lib/AstTransformation/mock/not.woql.js.map
new file mode 100644
index 0000000..0846dbb
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/not.woql.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"not.woql.js","sourceRoot":"","sources":["../../../../src/lib/AstTransformation/mock/not.woql.ts"],"names":[],"mappings":"AAEA,MAAM,IAAI,GAAe;IACvB;QACE,QAAQ,EAAE;;;;;;;CAOb;QACG,OAAO,EAAE;YACP,OAAO,EAAE,KAAK;YACd,GAAG,EAAE;gBACH;oBACE,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE;wBACL,OAAO,EAAE,QAAQ;wBACjB,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE;wBAClD,SAAS,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE;wBACrD,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;wBAC9C,KAAK,EAAE,SAAS;qBACjB;iBACF;aACF;SACF;KACF;CACF,CAAA;AAED,eAAe,IAAI,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/or.woql.d.ts b/dist/lib/AstTransformation/mock/or.woql.d.ts
new file mode 100644
index 0000000..3a50fcd
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/or.woql.d.ts
@@ -0,0 +1,3 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js';
+declare const mock: MockData[];
+export default mock;
diff --git a/dist/lib/AstTransformation/mock/or.woql.js b/dist/lib/AstTransformation/mock/or.woql.js
new file mode 100644
index 0000000..c70900c
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/or.woql.js
@@ -0,0 +1,33 @@
+const mock = [
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ or(
+ triple(doc,"rdf:type",type),
+ triple(doc,"rdf:type",type)
+ )
+}
+`,
+ woqlAst: {
+ '@type': 'Or',
+ or: [
+ {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ ],
+ },
+ },
+];
+export default mock;
+//# sourceMappingURL=or.woql.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/or.woql.js.map b/dist/lib/AstTransformation/mock/or.woql.js.map
new file mode 100644
index 0000000..bfba3af
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/or.woql.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"or.woql.js","sourceRoot":"","sources":["../../../../src/lib/AstTransformation/mock/or.woql.ts"],"names":[],"mappings":"AAEA,MAAM,IAAI,GAAe;IACvB;QACE,QAAQ,EAAE;;;;;;;CAOb;QACG,OAAO,EAAE;YACP,OAAO,EAAE,IAAI;YACb,EAAE,EAAE;gBACF;oBACE,OAAO,EAAE,QAAQ;oBACjB,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE;oBAClD,SAAS,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE;oBACrD,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;oBAC9C,KAAK,EAAE,SAAS;iBACjB;gBACD;oBACE,OAAO,EAAE,QAAQ;oBACjB,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE;oBAClD,SAAS,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE;oBACrD,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;oBAC9C,KAAK,EAAE,SAAS;iBACjB;aACF;SACF;KACF;CACF,CAAA;AAED,eAAe,IAAI,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/select.woql.d.ts b/dist/lib/AstTransformation/mock/select.woql.d.ts
new file mode 100644
index 0000000..3a50fcd
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/select.woql.d.ts
@@ -0,0 +1,3 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js';
+declare const mock: MockData[];
+export default mock;
diff --git a/dist/lib/AstTransformation/mock/select.woql.js b/dist/lib/AstTransformation/mock/select.woql.js
new file mode 100644
index 0000000..76cae9a
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/select.woql.js
@@ -0,0 +1,37 @@
+const mock = [
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ select(doc,and())
+}
+`,
+ woqlAst: {
+ '@type': 'Select',
+ query: {
+ '@type': 'And',
+ and: [],
+ },
+ variables: ['doc'],
+ },
+ },
+ {
+ textWoql: `
+ (doc, type, unbound) => {
+ select(doc,type,triple(doc,"rdf:type",type))
+ }
+ `,
+ woqlAst: {
+ '@type': 'Select',
+ query: {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ variables: ['doc', 'type'],
+ },
+ },
+];
+export default mock;
+//# sourceMappingURL=select.woql.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/select.woql.js.map b/dist/lib/AstTransformation/mock/select.woql.js.map
new file mode 100644
index 0000000..ae90c4a
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/select.woql.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"select.woql.js","sourceRoot":"","sources":["../../../../src/lib/AstTransformation/mock/select.woql.ts"],"names":[],"mappings":"AAEA,MAAM,IAAI,GAAe;IACvB;QACE,QAAQ,EAAE;;;;CAIb;QACG,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ;YACjB,KAAK,EAAE;gBACL,OAAO,EAAE,KAAK;gBACd,GAAG,EAAE,EAAE;aACR;YACD,SAAS,EAAE,CAAC,KAAK,CAAC;SACnB;KACF;IACD;QACE,QAAQ,EAAE;;;;GAIX;QAEC,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ;YACjB,KAAK,EAAE;gBACL,OAAO,EAAE,QAAQ;gBACjB,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE;gBAClD,SAAS,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE;gBACrD,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;gBAC9C,KAAK,EAAE,SAAS;aACjB;YACD,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;SAC3B;KACF;CACF,CAAA;AAED,eAAe,IAAI,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/triple.woql.d.ts b/dist/lib/AstTransformation/mock/triple.woql.d.ts
new file mode 100644
index 0000000..3a50fcd
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/triple.woql.d.ts
@@ -0,0 +1,3 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js';
+declare const mock: MockData[];
+export default mock;
diff --git a/dist/lib/AstTransformation/mock/triple.woql.js b/dist/lib/AstTransformation/mock/triple.woql.js
new file mode 100644
index 0000000..096b6a8
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/triple.woql.js
@@ -0,0 +1,32 @@
+const mock = [
+ {
+ textWoql: `
+(doc, type) => {
+ triple(doc,"rdf:type",type)
+}
+`,
+ woqlAst: {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ },
+ {
+ textWoql: `
+(doc, type) => {
+ triple("v:doc","rdf:type","@schema:MyType")
+}
+`,
+ woqlAst: {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', node: '@schema:MyType' },
+ graph: undefined,
+ },
+ },
+];
+export default mock;
+//# sourceMappingURL=triple.woql.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/triple.woql.js.map b/dist/lib/AstTransformation/mock/triple.woql.js.map
new file mode 100644
index 0000000..3d41bd3
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/triple.woql.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"triple.woql.js","sourceRoot":"","sources":["../../../../src/lib/AstTransformation/mock/triple.woql.ts"],"names":[],"mappings":"AAEA,MAAM,IAAI,GAAe;IACvB;QACE,QAAQ,EAAE;;;;CAIb;QACG,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE;YAClD,SAAS,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE;YACrD,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;YAC9C,KAAK,EAAE,SAAS;SACjB;KACF;IACD;QACE,QAAQ,EAAE;;;;CAIb;QACG,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE;YAClD,SAAS,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE;YACrD,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE;YACpD,KAAK,EAAE,SAAS;SACjB;KACF;CACF,CAAA;AAED,eAAe,IAAI,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/tripleVariable.woql.d.ts b/dist/lib/AstTransformation/mock/tripleVariable.woql.d.ts
new file mode 100644
index 0000000..3a50fcd
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/tripleVariable.woql.d.ts
@@ -0,0 +1,3 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js';
+declare const mock: MockData[];
+export default mock;
diff --git a/dist/lib/AstTransformation/mock/tripleVariable.woql.js b/dist/lib/AstTransformation/mock/tripleVariable.woql.js
new file mode 100644
index 0000000..2d4c860
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/tripleVariable.woql.js
@@ -0,0 +1,18 @@
+const mock = [
+ {
+ textWoql: `
+(doc, type) => {
+ triple("v:doc","rdf:type","@schema:MyType")
+}
+`,
+ woqlAst: {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', node: '@schema:MyType' },
+ graph: undefined,
+ },
+ },
+];
+export default mock;
+//# sourceMappingURL=tripleVariable.woql.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/mock/tripleVariable.woql.js.map b/dist/lib/AstTransformation/mock/tripleVariable.woql.js.map
new file mode 100644
index 0000000..a4231b4
--- /dev/null
+++ b/dist/lib/AstTransformation/mock/tripleVariable.woql.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"tripleVariable.woql.js","sourceRoot":"","sources":["../../../../src/lib/AstTransformation/mock/tripleVariable.woql.ts"],"names":[],"mappings":"AAEA,MAAM,IAAI,GAAe;IACvB;QACE,QAAQ,EAAE;;;;CAIb;QACG,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE;YAClD,SAAS,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE;YACrD,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE;YACpD,KAAK,EAAE,SAAS;SACjB;KACF;CACF,CAAA;AAED,eAAe,IAAI,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/parseWoqlString.d.ts b/dist/lib/AstTransformation/parseWoqlString.d.ts
new file mode 100644
index 0000000..c0d5d21
--- /dev/null
+++ b/dist/lib/AstTransformation/parseWoqlString.d.ts
@@ -0,0 +1,4 @@
+import type { Program } from 'acorn';
+import type { Query } from '../../syntax.js';
+export declare const generateWoqlStringFromJsAst: (ast: Program) => string;
+export declare const parseWoqlString: (woql: string) => Query;
diff --git a/dist/lib/AstTransformation/parseWoqlString.js b/dist/lib/AstTransformation/parseWoqlString.js
new file mode 100644
index 0000000..c5caa75
--- /dev/null
+++ b/dist/lib/AstTransformation/parseWoqlString.js
@@ -0,0 +1,22 @@
+import { AstJsWoqlTransformer } from '../AstTransformation/JsWoqlAstTransformer.js';
+import { parse } from 'acorn';
+import escodegen from 'escodegen';
+const parseWoqlStringToJsAst = (code) => {
+ const ast = parse(code, {
+ ecmaVersion: 2020,
+ sourceType: 'module',
+ });
+ return ast;
+};
+export const generateWoqlStringFromJsAst = (ast) => {
+ return escodegen.generate(ast);
+};
+export const parseWoqlString = (woql) => {
+ const ast = parseWoqlStringToJsAst(woql);
+ if (ast === undefined) {
+ throw new Error('Could not parse WOQL string');
+ }
+ const transformer = new AstJsWoqlTransformer();
+ return transformer.transform(ast);
+};
+//# sourceMappingURL=parseWoqlString.js.map
\ No newline at end of file
diff --git a/dist/lib/AstTransformation/parseWoqlString.js.map b/dist/lib/AstTransformation/parseWoqlString.js.map
new file mode 100644
index 0000000..5e5d713
--- /dev/null
+++ b/dist/lib/AstTransformation/parseWoqlString.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"parseWoqlString.js","sourceRoot":"","sources":["../../../src/lib/AstTransformation/parseWoqlString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAA;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAG7B,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,MAAM,sBAAsB,GAAG,CAAC,IAAY,EAAuB,EAAE;IACnE,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,EAAE;QACtB,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,QAAQ;KACrB,CAAC,CAAA;IACF,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,GAAY,EAAU,EAAE;IAClE,OAAO,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AAChC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAS,EAAE;IACrD,MAAM,GAAG,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAA;IACxC,IAAI,GAAG,KAAK,SAAS,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;KAC/C;IACD,MAAM,WAAW,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC9C,OAAO,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;AACnC,CAAC,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/index.d.ts b/dist/lib/index.d.ts
new file mode 100644
index 0000000..9b0a1a5
--- /dev/null
+++ b/dist/lib/index.d.ts
@@ -0,0 +1,3 @@
+export { parseWoqlString } from './AstTransformation/parseWoqlString.js';
+export { embedWoqlQuery } from './utils/prepareWoqlQuery.js';
+export { prepareWoqlHttpPostBody } from './utils/prepareWoqlQuery.js';
diff --git a/dist/lib/index.js b/dist/lib/index.js
new file mode 100644
index 0000000..700cb22
--- /dev/null
+++ b/dist/lib/index.js
@@ -0,0 +1,4 @@
+export { parseWoqlString } from './AstTransformation/parseWoqlString.js';
+export { embedWoqlQuery } from './utils/prepareWoqlQuery.js';
+export { prepareWoqlHttpPostBody } from './utils/prepareWoqlQuery.js';
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/dist/lib/index.js.map b/dist/lib/index.js.map
new file mode 100644
index 0000000..07cd165
--- /dev/null
+++ b/dist/lib/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA"}
\ No newline at end of file
diff --git a/dist/lib/utils/prepareWoqlQuery.d.ts b/dist/lib/utils/prepareWoqlQuery.d.ts
new file mode 100644
index 0000000..fe124f6
--- /dev/null
+++ b/dist/lib/utils/prepareWoqlQuery.d.ts
@@ -0,0 +1,19 @@
+///
+import type { Query } from '../../syntax.js';
+interface WOQLQuery {
+ query: Query;
+ all_witnesses?: boolean;
+}
+interface WoqlQueryOptions {
+ allWitnesses?: boolean;
+}
+export declare function embedWoqlQuery(woql: Query, options?: WoqlQueryOptions): WOQLQuery;
+interface WoqlFileAttachments {
+ [filename: string]: string;
+}
+interface WoqlHttpPostBodyOptions {
+ allWitnesses?: boolean;
+ attachments?: WoqlFileAttachments;
+}
+export declare const prepareWoqlHttpPostBody: (woql: Query, options?: WoqlHttpPostBodyOptions) => WOQLQuery | FormData;
+export {};
diff --git a/dist/lib/utils/prepareWoqlQuery.js b/dist/lib/utils/prepareWoqlQuery.js
new file mode 100644
index 0000000..f4d2910
--- /dev/null
+++ b/dist/lib/utils/prepareWoqlQuery.js
@@ -0,0 +1,59 @@
+export function embedWoqlQuery(woql, options) {
+ var _a;
+ return {
+ query: woql,
+ all_witnesses: (_a = options === null || options === void 0 ? void 0 : options.allWitnesses) !== null && _a !== void 0 ? _a : undefined,
+ };
+}
+export const prepareWoqlHttpPostBody = (woql, options) => {
+ const woqlQuery = embedWoqlQuery(woql, {
+ allWitnesses: options === null || options === void 0 ? void 0 : options.allWitnesses,
+ });
+ const resourceObjects = getResourceObjects(woqlQuery.query);
+ let postBody;
+ if (resourceObjects.length > 0) {
+ const formData = new FormData();
+ resourceObjects.forEach((resourceObject) => {
+ var _a, _b, _c, _d;
+ const fileName = (_c = (_b = (_a = resourceObject.source.post) === null || _a === void 0 ? void 0 : _a.split('/').pop()) === null || _b === void 0 ? void 0 : _b.split('\\').pop()) !== null && _c !== void 0 ? _c : 'unknown.csv';
+ resourceObject.source.post = fileName;
+ const attachment = (_d = options === null || options === void 0 ? void 0 : options.attachments) === null || _d === void 0 ? void 0 : _d[fileName];
+ if (typeof attachment === 'string' && attachment !== '') {
+ formData.append('file', attachment);
+ }
+ });
+ formData.append('payload', new Blob([JSON.stringify(woqlQuery)], { type: 'application/json' }), 'body.json');
+ postBody = formData;
+ }
+ else {
+ postBody = woqlQuery;
+ }
+ return postBody;
+};
+// recurse the WOQL query for all properties and arrays. If @type on an object = QueryResource,
+// add it to the post body.
+const getResourceObjects = (woql) => (Array.isArray(woql) ? woql : [woql]).reduce((resources, query) => {
+ if (query !== null && typeof query === 'object') {
+ Object.keys(query).forEach((key) => {
+ const resourceKey = 'resource';
+ if (key !== resourceKey)
+ return;
+ if (!(key in query))
+ return; // Looks like a type inaccuracy bug in TypeScript
+ const value = query[resourceKey];
+ if (value !== null && typeof value === 'object') {
+ if ('@type' in value && value['@type'] === 'QueryResource') {
+ resources.push(value);
+ }
+ else {
+ resources = resources.concat(getResourceObjects(value));
+ }
+ }
+ });
+ }
+ else if (typeof query !== 'string' && Array.isArray(query)) {
+ resources.concat(getResourceObjects(query));
+ }
+ return resources;
+}, []);
+//# sourceMappingURL=prepareWoqlQuery.js.map
\ No newline at end of file
diff --git a/dist/lib/utils/prepareWoqlQuery.js.map b/dist/lib/utils/prepareWoqlQuery.js.map
new file mode 100644
index 0000000..2cfda65
--- /dev/null
+++ b/dist/lib/utils/prepareWoqlQuery.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"prepareWoqlQuery.js","sourceRoot":"","sources":["../../../src/lib/utils/prepareWoqlQuery.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,cAAc,CAC5B,IAAW,EACX,OAA0B;;IAE1B,OAAO;QACL,KAAK,EAAE,IAAI;QACX,aAAa,EAA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S,CAAA;AAClB,CAAC,EACD,EAAE,CACH,CAAA"}
\ No newline at end of file
diff --git a/dist/syntax.d.ts b/dist/syntax.d.ts
new file mode 100644
index 0000000..95c7af9
--- /dev/null
+++ b/dist/syntax.d.ts
@@ -0,0 +1,4 @@
+export * from './woql_defs/woql.js';
+export { and, or } from './woql_defs/extra_signatures.js';
+export * from './woql_defs/types.js';
+export * from './woql_local/index.js';
diff --git a/dist/syntax.js b/dist/syntax.js
new file mode 100644
index 0000000..d13add3
--- /dev/null
+++ b/dist/syntax.js
@@ -0,0 +1,6 @@
+// Convenience functions for defining ASTs in WOQL
+export * from './woql_defs/woql.js';
+export { and, or } from './woql_defs/extra_signatures.js';
+export * from './woql_defs/types.js';
+export * from './woql_local/index.js';
+//# sourceMappingURL=syntax.js.map
\ No newline at end of file
diff --git a/dist/syntax.js.map b/dist/syntax.js.map
new file mode 100644
index 0000000..f8be732
--- /dev/null
+++ b/dist/syntax.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"syntax.js","sourceRoot":"","sources":["../src/syntax.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,cAAc,qBAAqB,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,iCAAiC,CAAA;AACzD,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA"}
\ No newline at end of file
diff --git a/dist/woql_defs/extra_signatures.d.ts b/dist/woql_defs/extra_signatures.d.ts
new file mode 100644
index 0000000..204cde1
--- /dev/null
+++ b/dist/woql_defs/extra_signatures.d.ts
@@ -0,0 +1,5 @@
+import * as W from './woql.js';
+import { type Var } from './types.js';
+export declare function and(...args: W.Query[]): W.Query;
+export declare function or(...args: W.Query[]): W.Query;
+export declare function letvars(fn: (...x: Var[]) => W.Query): W.Query;
diff --git a/dist/woql_defs/extra_signatures.js b/dist/woql_defs/extra_signatures.js
new file mode 100644
index 0000000..8188851
--- /dev/null
+++ b/dist/woql_defs/extra_signatures.js
@@ -0,0 +1,19 @@
+import * as W from './woql.js';
+export function and(...args) {
+ return W.and(args);
+}
+export function or(...args) {
+ return W.or(args);
+}
+export function letvars(fn) {
+ var _a;
+ const func = fn.toString();
+ const args = (_a = func.slice(func.indexOf('(') + 1, func.indexOf(')')).match(/([^\s,]+)/g)) !== null && _a !== void 0 ? _a : [];
+ const vs = args.map((v) => {
+ return {
+ variable: v,
+ };
+ });
+ return fn(...vs);
+}
+//# sourceMappingURL=extra_signatures.js.map
\ No newline at end of file
diff --git a/dist/woql_defs/extra_signatures.js.map b/dist/woql_defs/extra_signatures.js.map
new file mode 100644
index 0000000..29c05a6
--- /dev/null
+++ b/dist/woql_defs/extra_signatures.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"extra_signatures.js","sourceRoot":"","sources":["../../src/woql_defs/extra_signatures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAG9B,MAAM,UAAU,GAAG,CAAC,GAAG,IAAe;IACpC,OAAO,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AACpB,CAAC;AAED,MAAM,UAAU,EAAE,CAAC,GAAG,IAAe;IACnC,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;AACnB,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,EAA4B;;IAClD,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAA;IAC1B,MAAM,IAAI,GACR,MAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,mCACxE,EAAE,CAAA;IACJ,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACxB,OAAO;YACL,QAAQ,EAAE,CAAC;SACZ,CAAA;IACH,CAAC,CAAC,CAAA;IACF,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,CAAA;AAClB,CAAC"}
\ No newline at end of file
diff --git a/dist/woql_defs/generate.d.ts b/dist/woql_defs/generate.d.ts
new file mode 100644
index 0000000..55b8804
--- /dev/null
+++ b/dist/woql_defs/generate.d.ts
@@ -0,0 +1,14 @@
+export interface WOQLDefinition {
+ name: string;
+ group: string;
+ funName: string;
+ fields: string[];
+ types: string[];
+ args: string[];
+}
+export type WOQLSchema = {
+ [K in string]: WOQLDefinition;
+};
+export declare const woqlSchema: WOQLSchema;
+export declare function optionType(s: string): string | null;
+export declare function generateWoql(): Promise;
diff --git a/dist/woql_defs/generate.js b/dist/woql_defs/generate.js
new file mode 100644
index 0000000..dd1c9c0
--- /dev/null
+++ b/dist/woql_defs/generate.js
@@ -0,0 +1,208 @@
+import { readFile, writeFile } from 'fs/promises';
+import { fileURLToPath } from 'url';
+import { dirname } from 'path';
+import * as prettier from 'prettier';
+const dir = dirname(fileURLToPath(import.meta.url));
+const schemaList = JSON.parse(await readFile(dir + '/woql_list.json', 'utf8'));
+export const woqlSchema = {};
+schemaList.forEach((obj) => {
+ if ('@metadata' in obj && '@inherits' in obj && '@id' in obj) {
+ const name = obj['@id'];
+ const group = obj['@inherits'];
+ const funName = renameFunction(name);
+ const metadata = obj['@metadata'];
+ const definitionRecord = metadata['https://terminusdb.com'];
+ const fields = definitionRecord.fields;
+ const types = associatedTypes(definitionRecord.types);
+ const args = argsList(fields, types);
+ woqlSchema[name] = {
+ name,
+ group,
+ funName,
+ fields,
+ types,
+ args,
+ };
+ }
+});
+function listType(s) {
+ if (s.length > 5 && s.slice(0, 5) === 'list(') {
+ return s.slice(5, s.length - 1);
+ }
+ else {
+ return null;
+ }
+}
+export function optionType(s) {
+ if (s.length > 9 && s.slice(0, 9) === 'optional(') {
+ return s.slice(9, s.length - 1);
+ }
+ else {
+ return null;
+ }
+}
+function associatedType(ty) {
+ const lt = listType(ty);
+ const ot = optionType(ty);
+ if (lt !== null) {
+ const t = associatedType(lt);
+ return `${t}[]`;
+ }
+ else if (ot !== null) {
+ const t = associatedType(ot);
+ return `${t} | undefined`;
+ }
+ else if (ty === 'query') {
+ return `Query`;
+ }
+ else if (ty === 'graph') {
+ return 'Graph';
+ }
+ else if (ty === 'column') {
+ return 'Column';
+ }
+ else if (ty === 'node') {
+ return 'Node';
+ }
+ else if (ty === 'value') {
+ return 'Value';
+ }
+ else if (ty === 'integer') {
+ return 'number';
+ }
+ else if (ty === 'boolean') {
+ return 'boolean';
+ }
+ else if (ty === 'json') {
+ return 'any';
+ }
+ else if (ty === 'resource') {
+ return 'string';
+ }
+ else if (ty === 'string') {
+ return 'string';
+ }
+ else if (ty === 'float') {
+ return 'number';
+ }
+ else if (ty === 'path') {
+ return 'PathPattern';
+ }
+ else if (ty === 'arithmetic') {
+ return 'ArithmeticExpression';
+ }
+ else {
+ return 'any';
+ }
+}
+function associatedTypes(types) {
+ return types.map((ty) => {
+ return associatedType(ty);
+ });
+}
+function lowerCamelCase(inputString) {
+ if (inputString.length > 1) {
+ return (inputString[0].toLowerCase() + inputString.slice(1, inputString.length));
+ }
+ return inputString.toLowerCase();
+}
+function renameFunction(inputString) {
+ const newName = lowerCamelCase(inputString);
+ if (newName === 'eval') {
+ return 'compute';
+ }
+ else if (newName === 'true') {
+ return 'success';
+ }
+ else {
+ return newName;
+ }
+}
+function argsList(fields, types) {
+ const args = [];
+ fields.forEach((name, i) => {
+ const typ = types[i];
+ const res = typ.match(/(\S*)\s*\|\s*undefined/);
+ if (res != null) {
+ args.push(`${name}?: ${res[1]}`);
+ }
+ else {
+ args.push(`${name}: ${typ}`);
+ }
+ });
+ return args;
+}
+function renderBody(name, fields) {
+ const inner = fields
+ .map((s) => {
+ return `${s}`;
+ })
+ .join(', ');
+ return `{ '@type': '${name}', ${inner} }`;
+}
+function generateFunDef(name, funName, fields, args) {
+ const body = renderBody(name, fields);
+ const funArgs = args.join(', ');
+ return `
+export function ${funName}(${funArgs}): ${name} {
+ return ${body}
+}
+`;
+}
+function generateTypeDef(name, args) {
+ const types = args.join('\n ');
+ return `
+ export interface ${name} {
+'@type': '${name}'
+ ${types}
+}
+`;
+}
+function generateDefs(schema, cls, otherTypes = []) {
+ let defs = '';
+ let clsTypeList = [];
+ for (const obj of Object.values(schema)) {
+ if (obj.group === cls) {
+ const name = obj.name;
+ const fields = obj.fields;
+ const funName = obj.funName;
+ const args = obj.args;
+ const typeDef = generateTypeDef(name, args);
+ defs += typeDef;
+ const funDef = generateFunDef(name, funName, fields, args);
+ defs += funDef;
+ clsTypeList.push(name);
+ }
+ }
+ clsTypeList = clsTypeList.concat(otherTypes);
+ const queryType = `
+export type ${cls} = ${clsTypeList.join(' | ')}
+`;
+ defs += queryType;
+ return defs;
+}
+export async function generateWoql() {
+ let defs = `
+/* eslint-disable @typescript-eslint/no-empty-interface */
+/* eslint-disable @typescript-eslint/naming-convention */
+import { type Graph, type Value, type Node, type Column, type Literal, type WoqlNode } from './types.js'
+
+`;
+ const queryDefs = generateDefs(woqlSchema, 'Query');
+ defs += queryDefs;
+ const pathDefs = generateDefs(woqlSchema, 'PathPattern');
+ defs += pathDefs;
+ const arithmeticDefs = generateDefs(woqlSchema, 'ArithmeticExpression', [
+ 'Literal',
+ ]);
+ defs += arithmeticDefs;
+ const pretty = await prettier.format(defs, {
+ parser: 'typescript',
+ trailingComma: 'all',
+ tabWidth: 2,
+ semi: false,
+ singleQuote: true,
+ });
+ await writeFile(dir + '/woql.ts', pretty);
+}
+//# sourceMappingURL=generate.js.map
\ No newline at end of file
diff --git a/dist/woql_defs/generate.js.map b/dist/woql_defs/generate.js.map
new file mode 100644
index 0000000..9d74525
--- /dev/null
+++ b/dist/woql_defs/generate.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/woql_defs/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA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xD,IAAI,IAAI,QAAQ,CAAA;IAEhB,MAAM,cAAc,GAAG,YAAY,CAAC,UAAU,EAAE,sBAAsB,EAAE;QACtE,SAAS;KACV,CAAC,CAAA;IAEF,IAAI,IAAI,cAAc,CAAA;IAEtB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE;QACzC,MAAM,EAAE,YAAY;QACpB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,CAAC;QACX,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,IAAI;KAClB,CAAC,CAAA;IACF,MAAM,SAAS,CAAC,GAAG,GAAG,UAAU,EAAE,MAAM,CAAC,CAAA;AAC3C,CAAC"}
\ No newline at end of file
diff --git a/dist/woql_defs/types.d.ts b/dist/woql_defs/types.d.ts
new file mode 100644
index 0000000..965e783
--- /dev/null
+++ b/dist/woql_defs/types.d.ts
@@ -0,0 +1,80 @@
+export declare enum Graph {
+ instance = "instance",
+ schema = "schema"
+}
+export interface Uri {
+ '@type'?: 'NodeValue' | 'Value';
+ node: string;
+}
+export declare enum LiteralType {
+ string = "xsd:string",
+ boolean = "xsd:boolean",
+ decimal = "xsd:decimal",
+ integer = "xsd:integer",
+ double = "xsd:double",
+ float = "xsd:float",
+ date = "xsd:date",
+ time = "xsd:time",
+ dateTime = "xsd:dateTime",
+ dateTimeStamp = "xsd:dateTimeStamp",
+ gYear = "xsd:gYear",
+ gMonth = "xsd:gMonth",
+ gDay = "xsd:gDay",
+ gYearMonth = "xsd:gYearMonth",
+ gMonthDay = "xsd:gMonthDay",
+ duration = "xsd:duration",
+ yearMonthDuration = "xsd:yearMonthDuration",
+ dayTimeDuration = "xsd:dayTimeDuration",
+ byte = "xsd:byte",
+ short = "xsd:short",
+ int = "xsd:int",
+ long = "xsd:long",
+ unsignedByte = "xsd:unsignedByte",
+ unsignedShort = "xsd:unsignedShort",
+ unsignedInt = "xsd:unsignedInt",
+ unsignedLong = "xsd:unsignedLong",
+ positiveInteger = "xsd:positiveInteger",
+ nonNegativeInteger = "xsd:nonNegativeInteger",
+ negativeInteger = "xsd:negativeInteger",
+ nonPositiveInteger = "xsd:nonPositiveInteger",
+ hexBinary = "xsd:hexBinary",
+ base64Binary = "xsd:base64Binary",
+ anyURI = "xsd:anyURI",
+ language = "xsd:language",
+ normalizedString = "xsd:normalizedString",
+ NMTOKEN = "xsd:NMTOKEN",
+ Name = "xsd:Name",
+ NCName = "xsd:NCName"
+}
+export interface Literal {
+ '@type': LiteralType;
+ '@value': string | number | boolean | null;
+}
+export declare function lit(value: any, type?: LiteralType): Literal;
+export interface Quad {
+ '@type': 'Triple';
+ subject: Node;
+ predicate: Node;
+ object: Value;
+ graph?: Graph;
+}
+export declare function quad(subject: Node, predicate: Node, object: Value, graph?: Graph): Quad;
+export declare function uri(value: string): Uri;
+export interface Var {
+ '@type'?: 'NodeValue' | 'Value';
+ variable: string;
+}
+export type Value = Var | Uri | Literal;
+export type Node = Var | Uri;
+export declare function Vars(...args: string[]): {
+ [K in string]: Var;
+};
+export interface Indicator {
+ index: number;
+ name: string;
+}
+export interface Column {
+ '@type': 'Column';
+ indicator: Indicator;
+ type?: Literal;
+}
diff --git a/dist/woql_defs/types.js b/dist/woql_defs/types.js
new file mode 100644
index 0000000..67ca140
--- /dev/null
+++ b/dist/woql_defs/types.js
@@ -0,0 +1,71 @@
+export var Graph;
+(function (Graph) {
+ Graph["instance"] = "instance";
+ Graph["schema"] = "schema";
+})(Graph || (Graph = {}));
+export var LiteralType;
+(function (LiteralType) {
+ // Core types
+ LiteralType["string"] = "xsd:string";
+ LiteralType["boolean"] = "xsd:boolean";
+ LiteralType["decimal"] = "xsd:decimal";
+ LiteralType["integer"] = "xsd:integer";
+ // IEEE floating-point numbers
+ LiteralType["double"] = "xsd:double";
+ LiteralType["float"] = "xsd:float";
+ // Time and date
+ LiteralType["date"] = "xsd:date";
+ LiteralType["time"] = "xsd:time";
+ LiteralType["dateTime"] = "xsd:dateTime";
+ LiteralType["dateTimeStamp"] = "xsd:dateTimeStamp";
+ // Recurring and partial dates
+ LiteralType["gYear"] = "xsd:gYear";
+ LiteralType["gMonth"] = "xsd:gMonth";
+ LiteralType["gDay"] = "xsd:gDay";
+ LiteralType["gYearMonth"] = "xsd:gYearMonth";
+ LiteralType["gMonthDay"] = "xsd:gMonthDay";
+ LiteralType["duration"] = "xsd:duration";
+ LiteralType["yearMonthDuration"] = "xsd:yearMonthDuration";
+ LiteralType["dayTimeDuration"] = "xsd:dayTimeDuration";
+ // Limited-range integer numbers
+ LiteralType["byte"] = "xsd:byte";
+ LiteralType["short"] = "xsd:short";
+ LiteralType["int"] = "xsd:int";
+ LiteralType["long"] = "xsd:long";
+ LiteralType["unsignedByte"] = "xsd:unsignedByte";
+ LiteralType["unsignedShort"] = "xsd:unsignedShort";
+ LiteralType["unsignedInt"] = "xsd:unsignedInt";
+ LiteralType["unsignedLong"] = "xsd:unsignedLong";
+ LiteralType["positiveInteger"] = "xsd:positiveInteger";
+ LiteralType["nonNegativeInteger"] = "xsd:nonNegativeInteger";
+ LiteralType["negativeInteger"] = "xsd:negativeInteger";
+ LiteralType["nonPositiveInteger"] = "xsd:nonPositiveInteger";
+ // Encoded binary data
+ LiteralType["hexBinary"] = "xsd:hexBinary";
+ LiteralType["base64Binary"] = "xsd:base64Binary";
+ // Miscellaneous XSD types
+ LiteralType["anyURI"] = "xsd:anyURI";
+ LiteralType["language"] = "xsd:language";
+ LiteralType["normalizedString"] = "xsd:normalizedString";
+ LiteralType["NMTOKEN"] = "xsd:NMTOKEN";
+ LiteralType["Name"] = "xsd:Name";
+ LiteralType["NCName"] = "xsd:NCName";
+})(LiteralType || (LiteralType = {}));
+export function lit(value, type = LiteralType.string) {
+ return { '@type': type, '@value': value };
+}
+export function quad(subject, predicate, object, graph) {
+ return { '@type': 'Triple', subject, predicate, object, graph };
+}
+export function uri(value) {
+ return { node: value };
+}
+export function Vars(...args) {
+ const varObj = {};
+ for (let i = 0, j = arguments.length; i < j; i += 1) {
+ const argumentName = args[i];
+ varObj[argumentName] = { variable: argumentName };
+ }
+ return varObj;
+}
+//# sourceMappingURL=types.js.map
\ No newline at end of file
diff --git a/dist/woql_defs/types.js.map b/dist/woql_defs/types.js.map
new file mode 100644
index 0000000..f7f9fbd
--- /dev/null
+++ b/dist/woql_defs/types.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/woql_defs/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,KAGX;AAHD,WAAY,KAAK;IACf,8BAAqB,CAAA;IACrB,0BAAiB,CAAA;AACnB,CAAC,EAHW,KAAK,KAAL,KAAK,QAGhB;AAOD,MAAM,CAAN,IAAY,WA8CX;AA9CD,WAAY,WAAW;IACrB,aAAa;IACb,oCAAqB,CAAA;IACrB,sCAAuB,CAAA;IACvB,sCAAuB,CAAA;IACvB,sCAAuB,CAAA;IACvB,8BAA8B;IAC9B,oCAAqB,CAAA;IACrB,kCAAmB,CAAA;IACnB,gBAAgB;IAChB,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;IACjB,wCAAyB,CAAA;IACzB,kDAAmC,CAAA;IACnC,8BAA8B;IAC9B,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,gCAAiB,CAAA;IACjB,4CAA6B,CAAA;IAC7B,0CAA2B,CAAA;IAC3B,wCAAyB,CAAA;IACzB,0DAA2C,CAAA;IAC3C,sDAAuC,CAAA;IACvC,gCAAgC;IAChC,gCAAiB,CAAA;IACjB,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IACf,gCAAiB,CAAA;IACjB,gDAAiC,CAAA;IACjC,kDAAmC,CAAA;IACnC,8CAA+B,CAAA;IAC/B,gDAAiC,CAAA;IACjC,sDAAuC,CAAA;IACvC,4DAA6C,CAAA;IAC7C,sDAAuC,CAAA;IACvC,4DAA6C,CAAA;IAC7C,sBAAsB;IACtB,0CAA2B,CAAA;IAC3B,gDAAiC,CAAA;IACjC,0BAA0B;IAC1B,oCAAqB,CAAA;IACrB,wCAAyB,CAAA;IACzB,wDAAyC,CAAA;IACzC,sCAAuB,CAAA;IACvB,gCAAiB,CAAA;IACjB,oCAAqB,CAAA;AACvB,CAAC,EA9CW,WAAW,KAAX,WAAW,QA8CtB;AAOD,MAAM,UAAU,GAAG,CACjB,KAAU,EACV,OAAoB,WAAW,CAAC,MAAM;IAEtC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;AAC3C,CAAC;AAUD,MAAM,UAAU,IAAI,CAClB,OAAa,EACb,SAAe,EACf,MAAa,EACb,KAAa;IAEb,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;AACjE,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,KAAa;IAC/B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;AACxB,CAAC;AAUD,MAAM,UAAU,IAAI,CAAC,GAAG,IAAc;IACpC,MAAM,MAAM,GAA2B,EAAE,CAAA;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE;QACnD,MAAM,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QAE5B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAA;KAClD;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
\ No newline at end of file
diff --git a/dist/woql_defs/woql.d.ts b/dist/woql_defs/woql.d.ts
new file mode 100644
index 0000000..a353143
--- /dev/null
+++ b/dist/woql_defs/woql.d.ts
@@ -0,0 +1,399 @@
+import { type Graph, type Value, type Node, type Column, type Literal } from './types.js';
+export interface Using {
+ '@type': 'Using';
+ collection: any;
+ query: Query;
+}
+export declare function using(collection: any, query: Query): Using;
+export interface Select {
+ '@type': 'Select';
+ variables: string[];
+ query: Query;
+}
+export declare function select(variables: string[], query: Query): Select;
+export interface Distinct {
+ '@type': 'Distinct';
+ variables: string[];
+ query: Query;
+}
+export declare function distinct(variables: string[], query: Query): Distinct;
+export interface And {
+ '@type': 'And';
+ and: Query[];
+}
+export declare function and(and: Query[]): And;
+export interface Or {
+ '@type': 'Or';
+ or: Query[];
+}
+export declare function or(or: Query[]): Or;
+export interface From {
+ '@type': 'From';
+ graph: Graph;
+ query: Query;
+}
+export declare function from(graph: Graph, query: Query): From;
+export interface Into {
+ '@type': 'Into';
+ graph: Graph;
+ query: Query;
+}
+export declare function into(graph: Graph, query: Query): Into;
+export interface Triple {
+ '@type': 'Triple';
+ subject: Node;
+ predicate: Node;
+ object: Value;
+ graph?: Graph;
+}
+export declare function triple(subject: Node, predicate: Node, object: Value, graph?: Graph): Triple;
+export interface AddTriple {
+ '@type': 'AddTriple';
+ subject: Node;
+ predicate: Node;
+ object: Value;
+ graph?: Graph;
+}
+export declare function addTriple(subject: Node, predicate: Node, object: Value, graph?: Graph): AddTriple;
+export interface AddedTriple {
+ '@type': 'AddedTriple';
+ subject: Node;
+ predicate: Node;
+ object: Value;
+ graph?: Graph;
+}
+export declare function addedTriple(subject: Node, predicate: Node, object: Value, graph?: Graph): AddedTriple;
+export interface DeleteTriple {
+ '@type': 'DeleteTriple';
+ subject: Node;
+ predicate: Node;
+ object: Value;
+ graph?: Graph;
+}
+export declare function deleteTriple(subject: Node, predicate: Node, object: Value, graph?: Graph): DeleteTriple;
+export interface DeletedTriple {
+ '@type': 'DeletedTriple';
+ subject: Node;
+ predicate: Node;
+ object: Value;
+ graph?: Graph;
+}
+export declare function deletedTriple(subject: Node, predicate: Node, object: Value, graph?: Graph): DeletedTriple;
+export interface Subsumption {
+ '@type': 'Subsumption';
+ child: Node;
+ parent: Node;
+}
+export declare function subsumption(child: Node, parent: Node): Subsumption;
+export interface Equals {
+ '@type': 'Equals';
+ left: any;
+ right: any;
+}
+export declare function equals(left: any, right: any): Equals;
+export interface Substring {
+ '@type': 'Substring';
+ string: string;
+ before: number;
+ length: number;
+ after: number;
+ substring: string;
+}
+export declare function substring(string: string, before: number, length: number, after: number, substring: string): Substring;
+export interface ReadDocument {
+ '@type': 'ReadDocument';
+ identifier: Node;
+ document: any;
+}
+export declare function readDocument(identifier: Node, document: any): ReadDocument;
+export interface UpdateDocument {
+ '@type': 'UpdateDocument';
+ document: Node;
+ identifier?: any;
+}
+export declare function updateDocument(document: Node, identifier?: any): UpdateDocument;
+export interface InsertDocument {
+ '@type': 'InsertDocument';
+ document: Node;
+ identifier?: any;
+}
+export declare function insertDocument(document: Node, identifier?: any): InsertDocument;
+export interface DeleteDocument {
+ '@type': 'DeleteDocument';
+ identifier: Node;
+}
+export declare function deleteDocument(identifier: Node): DeleteDocument;
+export interface Get {
+ '@type': 'Get';
+ columns: Column[];
+ resource: string;
+ has_header?: boolean;
+}
+export declare function get(columns: Column[], resource: string, has_header?: boolean): Get;
+export interface Trim {
+ '@type': 'Trim';
+ untrimmed: string;
+ trimmed: string;
+}
+export declare function trim(untrimmed: string, trimmed: string): Trim;
+export interface Eval {
+ '@type': 'Eval';
+ expression: ArithmeticExpression;
+ result: any;
+}
+export declare function compute(expression: ArithmeticExpression, result: any): Eval;
+export interface IsA {
+ '@type': 'IsA';
+ element: Node;
+ type: Node;
+}
+export declare function isA(element: Node, type: Node): IsA;
+export interface Like {
+ '@type': 'Like';
+ left: string;
+ right: string;
+ similarity: number;
+}
+export declare function like(left: string, right: string, similarity: number): Like;
+export interface Less {
+ '@type': 'Less';
+ left: any;
+ right: any;
+}
+export declare function less(left: any, right: any): Less;
+export interface Greater {
+ '@type': 'Greater';
+ left: any;
+ right: any;
+}
+export declare function greater(left: any, right: any): Greater;
+export interface Optional {
+ '@type': 'Optional';
+ query: Query;
+}
+export declare function optional(query: Query): Optional;
+export interface Upper {
+ '@type': 'Upper';
+ mixed: string;
+ upper: string;
+}
+export declare function upper(mixed: string, upper: string): Upper;
+export interface Lower {
+ '@type': 'Lower';
+ mixed: string;
+ lower: string;
+}
+export declare function lower(mixed: string, lower: string): Lower;
+export interface Pad {
+ '@type': 'Pad';
+ string: string;
+ char: string;
+ times: number;
+ result: string;
+}
+export declare function pad(string: string, char: string, times: number, result: string): Pad;
+export interface Split {
+ '@type': 'Split';
+ string: string;
+ pattern: string;
+ list: string[];
+}
+export declare function split(string: string, pattern: string, list: string[]): Split;
+export interface Member {
+ '@type': 'Member';
+ member: any;
+ list: any[];
+}
+export declare function member(member: any, list: any[]): Member;
+export interface Concatenate {
+ '@type': 'Concatenate';
+ list: string[];
+ result: string;
+}
+export declare function concatenate(list: string[], result: string): Concatenate;
+export interface Join {
+ '@type': 'Join';
+ list: any[];
+ separator: string;
+ result: string;
+}
+export declare function join(list: any[], separator: string, result: string): Join;
+export interface Sum {
+ '@type': 'Sum';
+ list: any[];
+ result: any;
+}
+export declare function sum(list: any[], result: any): Sum;
+export interface Start {
+ '@type': 'Start';
+ start: number;
+ query: Query;
+}
+export declare function start(start: number, query: Query): Start;
+export interface Limit {
+ '@type': 'Limit';
+ limit: number;
+ query: Query;
+}
+export declare function limit(limit: number, query: Query): Limit;
+export interface Regexp {
+ '@type': 'Regexp';
+ pattern: string;
+ string: string;
+ result: string[];
+}
+export declare function regexp(pattern: string, string: string, result: string[]): Regexp;
+export interface True {
+ '@type': 'True';
+}
+export declare function success(): True;
+export interface OrderBy {
+ '@type': 'OrderBy';
+ ordering: any[];
+ query: Query;
+}
+export declare function orderBy(ordering: any[], query: Query): OrderBy;
+export interface GroupBy {
+ '@type': 'GroupBy';
+ template: Value;
+ group_by: any;
+ value: any;
+ query: Query;
+}
+export declare function groupBy(template: Value, group_by: any, value: any, query: Query): GroupBy;
+export interface Length {
+ '@type': 'Length';
+ list: any[];
+ length: number;
+}
+export declare function length(list: any[], length: number): Length;
+export interface Not {
+ '@type': 'Not';
+ query: Query;
+}
+export declare function not(query: Query): Not;
+export interface Once {
+ '@type': 'Once';
+ query: Query;
+}
+export declare function once(query: Query): Once;
+export interface Immediately {
+ '@type': 'Immediately';
+ query: Query;
+}
+export declare function immediately(query: Query): Immediately;
+export interface Count {
+ '@type': 'Count';
+ query: Query;
+ count: any;
+}
+export declare function count(query: Query, count: any): Count;
+export interface Typecast {
+ '@type': 'Typecast';
+ value: Value;
+ type: Node;
+ result: Value;
+}
+export declare function typecast(value: Value, type: Node, result: Value): Typecast;
+export interface Path {
+ '@type': 'Path';
+ subject: Node;
+ pattern: any;
+ object: Node;
+ path?: PathPattern;
+}
+export declare function path(subject: Node, pattern: any, object: Node, path?: PathPattern): Path;
+export interface Dot {
+ '@type': 'Dot';
+ document: any;
+ field: string;
+ value: any;
+}
+export declare function dot(document: any, field: string, value: any): Dot;
+export interface TypeOf {
+ '@type': 'TypeOf';
+ value: Value;
+ type: Node;
+}
+export declare function typeOf(value: Value, type: Node): TypeOf;
+export type Query = Using | Select | Distinct | And | Or | From | Into | Triple | AddTriple | AddedTriple | DeleteTriple | DeletedTriple | Subsumption | Equals | Substring | ReadDocument | UpdateDocument | InsertDocument | DeleteDocument | Get | Trim | Eval | IsA | Like | Less | Greater | Optional | Upper | Lower | Pad | Split | Member | Concatenate | Join | Sum | Start | Limit | Regexp | True | OrderBy | GroupBy | Length | Not | Once | Immediately | Count | Typecast | Path | Dot | TypeOf;
+export interface PathPredicate {
+ '@type': 'PathPredicate';
+ predicate?: string;
+}
+export declare function pathPredicate(predicate?: string): PathPredicate;
+export interface InversePathPredicate {
+ '@type': 'InversePathPredicate';
+ predicate?: string;
+}
+export declare function inversePathPredicate(predicate?: string): InversePathPredicate;
+export interface PathSequence {
+ '@type': 'PathSequence';
+ sequence: PathPattern[];
+}
+export declare function pathSequence(sequence: PathPattern[]): PathSequence;
+export interface PathOr {
+ '@type': 'PathOr';
+ or: PathPattern[];
+}
+export declare function pathOr(or: PathPattern[]): PathOr;
+export interface PathPlus {
+ '@type': 'PathPlus';
+ plus: PathPattern;
+}
+export declare function pathPlus(plus: PathPattern): PathPlus;
+export interface PathStar {
+ '@type': 'PathStar';
+ star: PathPattern;
+}
+export declare function pathStar(star: PathPattern): PathStar;
+export interface PathTimes {
+ '@type': 'PathTimes';
+ times: PathPattern;
+ from: number;
+ to: number;
+}
+export declare function pathTimes(times: PathPattern, from: number, to: number): PathTimes;
+export type PathPattern = PathPredicate | InversePathPredicate | PathSequence | PathOr | PathPlus | PathStar | PathTimes;
+export interface Plus {
+ '@type': 'Plus';
+ left: ArithmeticExpression;
+ right: ArithmeticExpression;
+}
+export declare function plus(left: ArithmeticExpression, right: ArithmeticExpression): Plus;
+export interface Minus {
+ '@type': 'Minus';
+ left: ArithmeticExpression;
+ right: ArithmeticExpression;
+}
+export declare function minus(left: ArithmeticExpression, right: ArithmeticExpression): Minus;
+export interface Times {
+ '@type': 'Times';
+ left: ArithmeticExpression;
+ right: ArithmeticExpression;
+}
+export declare function times(left: ArithmeticExpression, right: ArithmeticExpression): Times;
+export interface Divide {
+ '@type': 'Divide';
+ left: ArithmeticExpression;
+ right: ArithmeticExpression;
+}
+export declare function divide(left: ArithmeticExpression, right: ArithmeticExpression): Divide;
+export interface Div {
+ '@type': 'Div';
+ left: ArithmeticExpression;
+ right: ArithmeticExpression;
+}
+export declare function div(left: ArithmeticExpression, right: ArithmeticExpression): Div;
+export interface Exp {
+ '@type': 'Exp';
+ left: ArithmeticExpression;
+ right: ArithmeticExpression;
+}
+export declare function exp(left: ArithmeticExpression, right: ArithmeticExpression): Exp;
+export interface Floor {
+ '@type': 'Floor';
+ argument: ArithmeticExpression;
+}
+export declare function floor(argument: ArithmeticExpression): Floor;
+export type ArithmeticExpression = Plus | Minus | Times | Divide | Div | Exp | Floor | Literal;
diff --git a/dist/woql_defs/woql.js b/dist/woql_defs/woql.js
new file mode 100644
index 0000000..4e9b583
--- /dev/null
+++ b/dist/woql_defs/woql.js
@@ -0,0 +1,193 @@
+export function using(collection, query) {
+ return { '@type': 'Using', collection, query };
+}
+export function select(variables, query) {
+ return { '@type': 'Select', variables, query };
+}
+export function distinct(variables, query) {
+ return { '@type': 'Distinct', variables, query };
+}
+export function and(and) {
+ return { '@type': 'And', and };
+}
+export function or(or) {
+ return { '@type': 'Or', or };
+}
+export function from(graph, query) {
+ return { '@type': 'From', graph, query };
+}
+export function into(graph, query) {
+ return { '@type': 'Into', graph, query };
+}
+export function triple(subject, predicate, object, graph) {
+ return { '@type': 'Triple', subject, predicate, object, graph };
+}
+export function addTriple(subject, predicate, object, graph) {
+ return { '@type': 'AddTriple', subject, predicate, object, graph };
+}
+export function addedTriple(subject, predicate, object, graph) {
+ return { '@type': 'AddedTriple', subject, predicate, object, graph };
+}
+export function deleteTriple(subject, predicate, object, graph) {
+ return { '@type': 'DeleteTriple', subject, predicate, object, graph };
+}
+export function deletedTriple(subject, predicate, object, graph) {
+ return { '@type': 'DeletedTriple', subject, predicate, object, graph };
+}
+export function subsumption(child, parent) {
+ return { '@type': 'Subsumption', child, parent };
+}
+export function equals(left, right) {
+ return { '@type': 'Equals', left, right };
+}
+export function substring(string, before, length, after, substring) {
+ return { '@type': 'Substring', string, before, length, after, substring };
+}
+export function readDocument(identifier, document) {
+ return { '@type': 'ReadDocument', identifier, document };
+}
+export function updateDocument(document, identifier) {
+ return { '@type': 'UpdateDocument', document, identifier };
+}
+export function insertDocument(document, identifier) {
+ return { '@type': 'InsertDocument', document, identifier };
+}
+export function deleteDocument(identifier) {
+ return { '@type': 'DeleteDocument', identifier };
+}
+export function get(columns, resource, has_header) {
+ return { '@type': 'Get', columns, resource, has_header };
+}
+export function trim(untrimmed, trimmed) {
+ return { '@type': 'Trim', untrimmed, trimmed };
+}
+export function compute(expression, result) {
+ return { '@type': 'Eval', expression, result };
+}
+export function isA(element, type) {
+ return { '@type': 'IsA', element, type };
+}
+export function like(left, right, similarity) {
+ return { '@type': 'Like', left, right, similarity };
+}
+export function less(left, right) {
+ return { '@type': 'Less', left, right };
+}
+export function greater(left, right) {
+ return { '@type': 'Greater', left, right };
+}
+export function optional(query) {
+ return { '@type': 'Optional', query };
+}
+export function upper(mixed, upper) {
+ return { '@type': 'Upper', mixed, upper };
+}
+export function lower(mixed, lower) {
+ return { '@type': 'Lower', mixed, lower };
+}
+export function pad(string, char, times, result) {
+ return { '@type': 'Pad', string, char, times, result };
+}
+export function split(string, pattern, list) {
+ return { '@type': 'Split', string, pattern, list };
+}
+export function member(member, list) {
+ return { '@type': 'Member', member, list };
+}
+export function concatenate(list, result) {
+ return { '@type': 'Concatenate', list, result };
+}
+export function join(list, separator, result) {
+ return { '@type': 'Join', list, separator, result };
+}
+export function sum(list, result) {
+ return { '@type': 'Sum', list, result };
+}
+export function start(start, query) {
+ return { '@type': 'Start', start, query };
+}
+export function limit(limit, query) {
+ return { '@type': 'Limit', limit, query };
+}
+export function regexp(pattern, string, result) {
+ return { '@type': 'Regexp', pattern, string, result };
+}
+export function success() {
+ return { '@type': 'True' };
+}
+export function orderBy(ordering, query) {
+ return { '@type': 'OrderBy', ordering, query };
+}
+export function groupBy(template, group_by, value, query) {
+ return { '@type': 'GroupBy', template, group_by, value, query };
+}
+export function length(list, length) {
+ return { '@type': 'Length', list, length };
+}
+export function not(query) {
+ return { '@type': 'Not', query };
+}
+export function once(query) {
+ return { '@type': 'Once', query };
+}
+export function immediately(query) {
+ return { '@type': 'Immediately', query };
+}
+export function count(query, count) {
+ return { '@type': 'Count', query, count };
+}
+export function typecast(value, type, result) {
+ return { '@type': 'Typecast', value, type, result };
+}
+export function path(subject, pattern, object, path) {
+ return { '@type': 'Path', subject, pattern, object, path };
+}
+export function dot(document, field, value) {
+ return { '@type': 'Dot', document, field, value };
+}
+export function typeOf(value, type) {
+ return { '@type': 'TypeOf', value, type };
+}
+export function pathPredicate(predicate) {
+ return { '@type': 'PathPredicate', predicate };
+}
+export function inversePathPredicate(predicate) {
+ return { '@type': 'InversePathPredicate', predicate };
+}
+export function pathSequence(sequence) {
+ return { '@type': 'PathSequence', sequence };
+}
+export function pathOr(or) {
+ return { '@type': 'PathOr', or };
+}
+export function pathPlus(plus) {
+ return { '@type': 'PathPlus', plus };
+}
+export function pathStar(star) {
+ return { '@type': 'PathStar', star };
+}
+export function pathTimes(times, from, to) {
+ return { '@type': 'PathTimes', times, from, to };
+}
+export function plus(left, right) {
+ return { '@type': 'Plus', left, right };
+}
+export function minus(left, right) {
+ return { '@type': 'Minus', left, right };
+}
+export function times(left, right) {
+ return { '@type': 'Times', left, right };
+}
+export function divide(left, right) {
+ return { '@type': 'Divide', left, right };
+}
+export function div(left, right) {
+ return { '@type': 'Div', left, right };
+}
+export function exp(left, right) {
+ return { '@type': 'Exp', left, right };
+}
+export function floor(argument) {
+ return { '@type': 'Floor', argument };
+}
+//# sourceMappingURL=woql.js.map
\ No newline at end of file
diff --git a/dist/woql_defs/woql.js.map b/dist/woql_defs/woql.js.map
new file mode 100644
index 0000000..8fce6f6
--- /dev/null
+++ b/dist/woql_defs/woql.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"woql.js","sourceRoot":"","sources":["../../src/woql_defs/woql.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,KAAK,CAAC,UAAe,EAAE,KAAY;IACjD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAA;AAChD,CAAC;AAQD,MAAM,UAAU,MAAM,CAAC,SAAmB,EAAE,KAAY;IACtD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA;AAChD,CAAC;AAQD,MAAM,UAAU,QAAQ,CAAC,SAAmB,EAAE,KAAY;IACxD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA;AAClD,CAAC;AAOD,MAAM,UAAU,GAAG,CAAC,GAAY;IAC9B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAA;AAChC,CAAC;AAOD,MAAM,UAAU,EAAE,CAAC,EAAW;IAC5B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,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E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;AACzC,CAAC;AAQD,MAAM,UAAU,KAAK,CACnB,IAA0B,EAC1B,KAA2B;IAE3B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;AAC1C,CAAC;AAQD,MAAM,UAAU,KAAK,CACnB,IAA0B,EAC1B,KAA2B;IAE3B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;AAC1C,CAAC;AAQD,MAAM,UAAU,MAAM,CACpB,IAA0B,EAC1B,KAA2B;IAE3B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;AAC3C,CAAC;AAQD,MAAM,UAAU,GAAG,CACjB,IAA0B,EAC1B,KAA2B;IAE3B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;AACxC,CAAC;AAQD,MAAM,UAAU,GAAG,CACjB,IAA0B,EAC1B,KAA2B;IAE3B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;AACxC,CAAC;AAOD,MAAM,UAAU,KAAK,CAAC,QAA8B;IAClD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;AACvC,CAAC"}
\ No newline at end of file
diff --git a/dist/woql_local/index.d.ts b/dist/woql_local/index.d.ts
new file mode 100644
index 0000000..0fd63e4
--- /dev/null
+++ b/dist/woql_local/index.d.ts
@@ -0,0 +1,3 @@
+import type { Var } from '../syntax.js';
+import type * as W from '../woql_defs/woql.js';
+export declare function letvars(fn: (...x: Var[]) => W.Query): W.Query;
diff --git a/dist/woql_local/index.js b/dist/woql_local/index.js
new file mode 100644
index 0000000..274469b
--- /dev/null
+++ b/dist/woql_local/index.js
@@ -0,0 +1,12 @@
+export function letvars(fn) {
+ var _a;
+ const func = fn.toString();
+ const args = (_a = func.slice(func.indexOf('(') + 1, func.indexOf(')')).match(/([^\s,]+)/g)) !== null && _a !== void 0 ? _a : [];
+ const vs = args.map((v) => {
+ return {
+ variable: v,
+ };
+ });
+ return fn(...vs);
+}
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/dist/woql_local/index.js.map b/dist/woql_local/index.js.map
new file mode 100644
index 0000000..1bb165c
--- /dev/null
+++ b/dist/woql_local/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/woql_local/index.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,OAAO,CAAC,EAA4B;;IAClD,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAA;IAC1B,MAAM,IAAI,GACR,MAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,mCACxE,EAAE,CAAA;IACJ,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACxB,OAAO;YACL,QAAQ,EAAE,CAAC;SACZ,CAAA;IACH,CAAC,CAAC,CAAA;IACF,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,CAAA;AAClB,CAAC"}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index f581b6c..3319ab9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,16 +8,22 @@
"name": "@terminusdb/woql",
"version": "1.0.0",
"dependencies": {
+ "acorn": "^8.11.3",
+ "escodegen": "^2.1.0",
"moo": "^0.5.2",
"mustache": "^4.2.0",
"tsconfig": "^7.0.0"
},
"devDependencies": {
"@tsconfig/node18": "^18.2.2",
+ "@types/chai": "^4.3.11",
+ "@types/escodegen": "^0.0.10",
+ "@types/mocha": "^10.0.6",
"@types/moo": "^0.5.9",
"@types/mustache": "^4.2.5",
"@types/node": "^20.9.0",
"@typescript-eslint/eslint-plugin": "^6.7.4",
+ "chai": "^5.0.0",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard-with-typescript": "^39.1.0",
@@ -25,7 +31,9 @@
"eslint-plugin-n": "^16.1.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^6.1.1",
+ "mocha": "^10.2.0",
"prettier": "^3.0.3",
+ "ts-node": "^10.9.2",
"typescript": "^5.2.2"
}
},
@@ -38,6 +46,18 @@
"node": ">=0.10.0"
}
},
+ "node_modules/@cspotcode/source-map-support": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
+ "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
+ "dev": true,
+ "dependencies": {
+ "@jridgewell/trace-mapping": "0.3.9"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/@eslint-community/eslint-utils": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
@@ -127,6 +147,31 @@
"integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
"dev": true
},
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
+ "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==",
+ "dev": true,
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.4.15",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
+ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
+ "dev": true
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
+ "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
+ "dev": true,
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.0.3",
+ "@jridgewell/sourcemap-codec": "^1.4.10"
+ }
+ },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -182,12 +227,48 @@
"url": "https://opencollective.com/unts"
}
},
+ "node_modules/@tsconfig/node10": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
+ "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
+ "dev": true
+ },
+ "node_modules/@tsconfig/node12": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
+ "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
+ "dev": true
+ },
+ "node_modules/@tsconfig/node14": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
+ "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
+ "dev": true
+ },
+ "node_modules/@tsconfig/node16": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
+ "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
+ "dev": true
+ },
"node_modules/@tsconfig/node18": {
"version": "18.2.2",
"resolved": "https://registry.npmjs.org/@tsconfig/node18/-/node18-18.2.2.tgz",
"integrity": "sha512-d6McJeGsuoRlwWZmVIeE8CUA27lu6jLjvv1JzqmpsytOYYbVi1tHZEnwCNVOXnj4pyLvneZlFlpXUK+X9wBWyw==",
"dev": true
},
+ "node_modules/@types/chai": {
+ "version": "4.3.11",
+ "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.11.tgz",
+ "integrity": "sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ==",
+ "dev": true
+ },
+ "node_modules/@types/escodegen": {
+ "version": "0.0.10",
+ "resolved": "https://registry.npmjs.org/@types/escodegen/-/escodegen-0.0.10.tgz",
+ "integrity": "sha512-IVvcNLEFbiL17qiGRGzyfx/u9K6lA5w6wcQSIgv2h4JG3ZAFIY1Be9ITTSPuARIxRpzW54s8OvcF6PdonBbDzg==",
+ "dev": true
+ },
"node_modules/@types/json-schema": {
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
@@ -200,6 +281,12 @@
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
"dev": true
},
+ "node_modules/@types/mocha": {
+ "version": "10.0.6",
+ "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.6.tgz",
+ "integrity": "sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==",
+ "dev": true
+ },
"node_modules/@types/moo": {
"version": "0.5.9",
"resolved": "https://registry.npmjs.org/@types/moo/-/moo-0.5.9.tgz",
@@ -433,10 +520,9 @@
"dev": true
},
"node_modules/acorn": {
- "version": "8.11.2",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
- "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
- "dev": true,
+ "version": "8.11.3",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
+ "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
"bin": {
"acorn": "bin/acorn"
},
@@ -453,6 +539,15 @@
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
+ "node_modules/acorn-walk": {
+ "version": "8.3.1",
+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.1.tgz",
+ "integrity": "sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
"node_modules/ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
@@ -469,6 +564,15 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
+ "node_modules/ansi-colors": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
+ "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
@@ -493,6 +597,25 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
+ "node_modules/anymatch": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
+ "dev": true,
+ "dependencies": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/arg": {
+ "version": "4.1.3",
+ "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
+ "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
+ "dev": true
+ },
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@@ -616,6 +739,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/assertion-error": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
+ "dev": true,
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/available-typed-arrays": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz",
@@ -643,6 +775,15 @@
"node": ">=0.6"
}
},
+ "node_modules/binary-extensions": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
+ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/bplist-parser": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz",
@@ -677,6 +818,12 @@
"node": ">=8"
}
},
+ "node_modules/browser-stdout": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
+ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
+ "dev": true
+ },
"node_modules/builtin-modules": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz",
@@ -736,6 +883,34 @@
"node": ">=6"
}
},
+ "node_modules/camelcase": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
+ "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/chai": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/chai/-/chai-5.0.0.tgz",
+ "integrity": "sha512-HO5p0oEKd5M6HEcwOkNAThAE3j960vIZvVcc0t2tI06Dd0ATu69cEnMB2wOhC5/ZyQ6m67w3ePjU/HzXsSsdBA==",
+ "dev": true,
+ "dependencies": {
+ "assertion-error": "^2.0.1",
+ "check-error": "^2.0.0",
+ "deep-eql": "^5.0.1",
+ "loupe": "^3.0.0",
+ "pathval": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -752,6 +927,65 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
+ "node_modules/check-error": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.0.0.tgz",
+ "integrity": "sha512-tjLAOBHKVxtPoHe/SA7kNOMvhCRdCJ3vETdeY0RuAc9popf+hyaSV6ZEg9hr4cpWF7jmo/JSWEnLDrnijS9Tog==",
+ "dev": true,
+ "engines": {
+ "node": ">= 16"
+ }
+ },
+ "node_modules/chokidar": {
+ "version": "3.5.3",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
+ "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://paulmillr.com/funding/"
+ }
+ ],
+ "dependencies": {
+ "anymatch": "~3.1.2",
+ "braces": "~3.0.2",
+ "glob-parent": "~5.1.2",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.6.0"
+ },
+ "engines": {
+ "node": ">= 8.10.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/chokidar/node_modules/glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "dev": true,
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/cliui": {
+ "version": "7.0.4",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
+ "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
+ "dev": true,
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0",
+ "wrap-ansi": "^7.0.0"
+ }
+ },
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -776,6 +1010,12 @@
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true
},
+ "node_modules/create-require": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
+ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
+ "dev": true
+ },
"node_modules/cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@@ -807,6 +1047,27 @@
}
}
},
+ "node_modules/decamelize": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
+ "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/deep-eql": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.1.tgz",
+ "integrity": "sha512-nwQCf6ne2gez3o1MxWifqkciwt0zhl0LO1/UwVu4uMBuPmflWM4oQ70XMqHqnBJA+nhzncaqL9HVL6KkHJ28lw==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/deep-is": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
@@ -890,6 +1151,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/diff": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
+ "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.3.1"
+ }
+ },
"node_modules/dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
@@ -914,6 +1184,12 @@
"node": ">=6.0.0"
}
},
+ "node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
"node_modules/es-abstract": {
"version": "1.22.3",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.3.tgz",
@@ -1007,6 +1283,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/escalade": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
+ "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/escape-string-regexp": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
@@ -1019,6 +1304,26 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/escodegen": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz",
+ "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==",
+ "dependencies": {
+ "esprima": "^4.0.1",
+ "estraverse": "^5.2.0",
+ "esutils": "^2.0.2"
+ },
+ "bin": {
+ "escodegen": "bin/escodegen.js",
+ "esgenerate": "bin/esgenerate.js"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "optionalDependencies": {
+ "source-map": "~0.6.1"
+ }
+ },
"node_modules/eslint": {
"version": "8.53.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.53.0.tgz",
@@ -1372,6 +1677,18 @@
"url": "https://opencollective.com/eslint"
}
},
+ "node_modules/esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+ "bin": {
+ "esparse": "bin/esparse.js",
+ "esvalidate": "bin/esvalidate.js"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/esquery": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",
@@ -1400,7 +1717,6 @@
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
- "dev": true,
"engines": {
"node": ">=4.0"
}
@@ -1409,7 +1725,6 @@
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
- "dev": true,
"engines": {
"node": ">=0.10.0"
}
@@ -1538,6 +1853,15 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/flat": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
+ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",
+ "dev": true,
+ "bin": {
+ "flat": "cli.js"
+ }
+ },
"node_modules/flat-cache": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz",
@@ -1573,6 +1897,20 @@
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true
},
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
@@ -1609,6 +1947,24 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true,
+ "engines": {
+ "node": "6.* || 8.* || >= 10.*"
+ }
+ },
+ "node_modules/get-func-name": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz",
+ "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
"node_modules/get-intrinsic": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz",
@@ -1845,6 +2201,15 @@
"node": ">= 0.4"
}
},
+ "node_modules/he": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
+ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
+ "dev": true,
+ "bin": {
+ "he": "bin/he"
+ }
+ },
"node_modules/human-signals": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz",
@@ -1944,6 +2309,18 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "dev": true,
+ "dependencies": {
+ "binary-extensions": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/is-boolean-object": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz",
@@ -2038,6 +2415,15 @@
"node": ">=0.10.0"
}
},
+ "node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
@@ -2113,6 +2499,15 @@
"node": ">=8"
}
},
+ "node_modules/is-plain-obj": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
+ "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/is-regex": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",
@@ -2198,6 +2593,18 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-unicode-supported": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
+ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/is-weakref": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz",
@@ -2334,6 +2741,31 @@
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
"dev": true
},
+ "node_modules/log-symbols": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
+ "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
+ "dev": true,
+ "dependencies": {
+ "chalk": "^4.1.0",
+ "is-unicode-supported": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/loupe": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.0.2.tgz",
+ "integrity": "sha512-Tzlkbynv7dtqxTROe54Il+J4e/zG2iehtJGZUYpTv8WzlkW9qyEcE83UhGJCeuF3SCfzHuM5VWhBi47phV3+AQ==",
+ "dev": true,
+ "dependencies": {
+ "get-func-name": "^2.0.1"
+ }
+ },
"node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@@ -2346,6 +2778,12 @@
"node": ">=10"
}
},
+ "node_modules/make-error": {
+ "version": "1.3.6",
+ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
+ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
+ "dev": true
+ },
"node_modules/merge-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
@@ -2407,6 +2845,120 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/mocha": {
+ "version": "10.2.0",
+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz",
+ "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==",
+ "dev": true,
+ "dependencies": {
+ "ansi-colors": "4.1.1",
+ "browser-stdout": "1.3.1",
+ "chokidar": "3.5.3",
+ "debug": "4.3.4",
+ "diff": "5.0.0",
+ "escape-string-regexp": "4.0.0",
+ "find-up": "5.0.0",
+ "glob": "7.2.0",
+ "he": "1.2.0",
+ "js-yaml": "4.1.0",
+ "log-symbols": "4.1.0",
+ "minimatch": "5.0.1",
+ "ms": "2.1.3",
+ "nanoid": "3.3.3",
+ "serialize-javascript": "6.0.0",
+ "strip-json-comments": "3.1.1",
+ "supports-color": "8.1.1",
+ "workerpool": "6.2.1",
+ "yargs": "16.2.0",
+ "yargs-parser": "20.2.4",
+ "yargs-unparser": "2.0.0"
+ },
+ "bin": {
+ "_mocha": "bin/_mocha",
+ "mocha": "bin/mocha.js"
+ },
+ "engines": {
+ "node": ">= 14.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/mochajs"
+ }
+ },
+ "node_modules/mocha/node_modules/glob": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",
+ "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==",
+ "dev": true,
+ "dependencies": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/mocha/node_modules/glob/node_modules/minimatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+ "dev": true,
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/mocha/node_modules/minimatch": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
+ "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
+ "dev": true,
+ "dependencies": {
+ "brace-expansion": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/mocha/node_modules/minimatch/node_modules/brace-expansion": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
+ "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
+ "dev": true,
+ "dependencies": {
+ "balanced-match": "^1.0.0"
+ }
+ },
+ "node_modules/mocha/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true
+ },
+ "node_modules/mocha/node_modules/supports-color": {
+ "version": "8.1.1",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
+ "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
+ "dev": true,
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/supports-color?sponsor=1"
+ }
+ },
"node_modules/moo": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/moo/-/moo-0.5.2.tgz",
@@ -2426,12 +2978,33 @@
"mustache": "bin/mustache"
}
},
+ "node_modules/nanoid": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz",
+ "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==",
+ "dev": true,
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
"node_modules/natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
"integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
"dev": true
},
+ "node_modules/normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/npm-run-path": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz",
@@ -2684,6 +3257,15 @@
"node": ">=8"
}
},
+ "node_modules/pathval": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz",
+ "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 14.16"
+ }
+ },
"node_modules/picocolors": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
@@ -2767,6 +3349,27 @@
}
]
},
+ "node_modules/randombytes": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
+ "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
+ "dev": true,
+ "dependencies": {
+ "safe-buffer": "^5.1.0"
+ }
+ },
+ "node_modules/readdirp": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "dev": true,
+ "dependencies": {
+ "picomatch": "^2.2.1"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
"node_modules/regexp.prototype.flags": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz",
@@ -2784,6 +3387,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/resolve": {
"version": "1.22.8",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
@@ -2989,6 +3601,26 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
"node_modules/safe-regex-test": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz",
@@ -3018,6 +3650,15 @@
"node": ">=10"
}
},
+ "node_modules/serialize-javascript": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz",
+ "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==",
+ "dev": true,
+ "dependencies": {
+ "randombytes": "^2.1.0"
+ }
+ },
"node_modules/set-function-length": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz",
@@ -3097,6 +3738,29 @@
"node": ">=8"
}
},
+ "node_modules/source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "optional": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/string.prototype.trim": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz",
@@ -3268,6 +3932,58 @@
"typescript": ">=4.2.0"
}
},
+ "node_modules/ts-node": {
+ "version": "10.9.2",
+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
+ "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
+ "dev": true,
+ "dependencies": {
+ "@cspotcode/source-map-support": "^0.8.0",
+ "@tsconfig/node10": "^1.0.7",
+ "@tsconfig/node12": "^1.0.7",
+ "@tsconfig/node14": "^1.0.0",
+ "@tsconfig/node16": "^1.0.2",
+ "acorn": "^8.4.1",
+ "acorn-walk": "^8.1.1",
+ "arg": "^4.1.0",
+ "create-require": "^1.1.0",
+ "diff": "^4.0.1",
+ "make-error": "^1.1.1",
+ "v8-compile-cache-lib": "^3.0.1",
+ "yn": "3.1.1"
+ },
+ "bin": {
+ "ts-node": "dist/bin.js",
+ "ts-node-cwd": "dist/bin-cwd.js",
+ "ts-node-esm": "dist/bin-esm.js",
+ "ts-node-script": "dist/bin-script.js",
+ "ts-node-transpile-only": "dist/bin-transpile.js",
+ "ts-script": "dist/bin-script-deprecated.js"
+ },
+ "peerDependencies": {
+ "@swc/core": ">=1.2.50",
+ "@swc/wasm": ">=1.2.50",
+ "@types/node": "*",
+ "typescript": ">=2.7"
+ },
+ "peerDependenciesMeta": {
+ "@swc/core": {
+ "optional": true
+ },
+ "@swc/wasm": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/ts-node/node_modules/diff": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
+ "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.3.1"
+ }
+ },
"node_modules/tsconfig": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-7.0.0.tgz",
@@ -3446,6 +4162,12 @@
"punycode": "^2.1.0"
}
},
+ "node_modules/v8-compile-cache-lib": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
+ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
+ "dev": true
+ },
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -3496,18 +4218,101 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/workerpool": {
+ "version": "6.2.1",
+ "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz",
+ "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==",
+ "dev": true
+ },
+ "node_modules/wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "dev": true,
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true
},
+ "node_modules/y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
},
+ "node_modules/yargs": {
+ "version": "16.2.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
+ "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
+ "dev": true,
+ "dependencies": {
+ "cliui": "^7.0.2",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.0",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^20.2.2"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yargs-parser": {
+ "version": "20.2.4",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz",
+ "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yargs-unparser": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz",
+ "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==",
+ "dev": true,
+ "dependencies": {
+ "camelcase": "^6.0.0",
+ "decamelize": "^4.0.0",
+ "flat": "^5.0.2",
+ "is-plain-obj": "^2.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yn": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
+ "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/yocto-queue": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
diff --git a/package.json b/package.json
index fd4fc76..ebca224 100644
--- a/package.json
+++ b/package.json
@@ -3,10 +3,17 @@
"version": "1.0.0",
"description": "A library for WOQL manipulation in TerminusDB",
"type": "module",
- "licenses": {
- "type": "MIT",
- "url": "https://www.opensource.org/licenses/mit-license.php"
- },
+ "main": "dist/index.js",
+ "types": "dist/index.d.ts",
+ "files": [
+ "/dist"
+ ],
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "https://www.opensource.org/licenses/mit-license.php"
+ }
+ ],
"author": {
"name": "Gavin Mendel-Gleason",
"email": "gavin@terminusdb.com"
@@ -15,21 +22,30 @@
{
"name": "Matthijs van Otterdijk",
"email": "matthijs@terminusdb.com"
+ },
+ {
+ "name": "Philippe Höij",
+ "email": "philippe.hoij@dfrnt.com"
}
],
"scripts": {
"woqlget": "wget \"https://raw.githubusercontent.com/terminusdb/terminusdb/main/src/terminus-schema/woql.json\" -O src/woql_defs/woql.json && cat src/woql_defs/woql.json | jq -s '.' > src/woql_defs/woql_list.json",
"build": "tsc",
"clean": "rm -rf ./dist",
+ "test": "mocha",
"dev": "tsc -w",
"lint": "eslint . --ext ts"
},
"devDependencies": {
"@tsconfig/node18": "^18.2.2",
+ "@types/chai": "^4.3.11",
+ "@types/escodegen": "^0.0.10",
+ "@types/mocha": "^10.0.6",
"@types/moo": "^0.5.9",
"@types/mustache": "^4.2.5",
"@types/node": "^20.9.0",
"@typescript-eslint/eslint-plugin": "^6.7.4",
+ "chai": "^5.0.0",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard-with-typescript": "^39.1.0",
@@ -37,10 +53,14 @@
"eslint-plugin-n": "^16.1.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^6.1.1",
+ "mocha": "^10.2.0",
"prettier": "^3.0.3",
+ "ts-node": "^10.9.2",
"typescript": "^5.2.2"
},
"dependencies": {
+ "acorn": "^8.11.3",
+ "escodegen": "^2.1.0",
"moo": "^0.5.2",
"mustache": "^4.2.0",
"tsconfig": "^7.0.0"
diff --git a/src/index.ts b/src/index.ts
index 43fab88..6064584 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1 +1,3 @@
-export * from './syntax.js';
+export * from './syntax.js'
+export * from './lib/index.js'
+export * as WOQL from './syntax.js'
diff --git a/src/lib/AstTransformation/JsWoqlAstTransformer.test.ts b/src/lib/AstTransformation/JsWoqlAstTransformer.test.ts
new file mode 100644
index 0000000..bbd8f3b
--- /dev/null
+++ b/src/lib/AstTransformation/JsWoqlAstTransformer.test.ts
@@ -0,0 +1,30 @@
+// tests/calculator.spec.tx
+import { assert } from 'chai'
+import mock from './mock/index.js'
+import documentQuery from './mock/_documentQuery.woql.js'
+import { parseWoqlString } from './parseWoqlString.js'
+import type { Query } from '../../syntax.js'
+
+type MockName = keyof typeof mock
+export interface MockData {
+ textWoql: string
+ woqlAst: Query
+}
+
+describe('Basic AST Transformation Sanity Check', () => {
+ it('should compile the string WOQL to an accurate WOQL AST', () => {
+ const result = parseWoqlString(documentQuery.textWoql)
+ assert.deepEqual(result as object, documentQuery.woqlAst)
+ })
+})
+
+describe('Specific AST Transformation Checks', () => {
+ Object.keys(mock).forEach((testTerm) => {
+ mock[testTerm as MockName].forEach((testCase, index) => {
+ it(`should compile ${testTerm} test ${index} correctly to WOQL AST`, () => {
+ const result = parseWoqlString(testCase.textWoql)
+ assert.deepEqual(result as object, testCase.woqlAst)
+ })
+ })
+ })
+})
diff --git a/src/lib/AstTransformation/JsWoqlAstTransformer.ts b/src/lib/AstTransformation/JsWoqlAstTransformer.ts
new file mode 100644
index 0000000..9c26ef3
--- /dev/null
+++ b/src/lib/AstTransformation/JsWoqlAstTransformer.ts
@@ -0,0 +1,309 @@
+import type {
+ Program,
+ Node,
+ BlockStatement,
+ ExpressionStatement,
+ CallExpression,
+ ArrowFunctionExpression,
+ Identifier,
+ Expression,
+ Super,
+ Pattern,
+ Literal as AcornLiteral,
+} from 'acorn'
+import type { Var, Literal, Query, Uri } from '../../syntax.js'
+import { Graph, lit } from '../../syntax.js'
+import { WOQL } from '../../index.js'
+
+function lowerCamelCase(inputString: string): string {
+ if (inputString.length > 1) {
+ return (
+ inputString[0].toLowerCase() + inputString.slice(1, inputString.length)
+ )
+ }
+ return inputString.toLowerCase()
+}
+
+function renameFunction(inputString: string): string {
+ const newName = lowerCamelCase(inputString)
+ if (newName === 'eval') {
+ return 'compute'
+ } else if (newName === 'true') {
+ return 'success'
+ } else {
+ return newName
+ }
+}
+
+const supportedWoql = [
+ 'Using',
+ 'Select', // hastest
+ 'Distinct',
+ 'And', // hastest
+ 'Or', // hastest
+ 'From',
+ 'Into',
+ 'Triple', // hastest
+ 'AddTriple',
+ 'AddedTriple',
+ 'DeleteTriple',
+ 'DeletedTriple',
+ 'Subsumption',
+ 'Equals', // hastest (failing)
+ 'Substring',
+ 'ReadDocument',
+ 'UpdateDocument',
+ 'InsertDocument',
+ 'DeleteDocument',
+ 'Get',
+ 'Trim',
+ 'Eval',
+ 'Plus',
+ 'Minus',
+ 'Times',
+ 'Divide',
+ 'Div',
+ 'Exp',
+ 'Floor',
+ 'IsA',
+ 'Like',
+ 'Less',
+ 'Greater',
+ 'Optional',
+ 'Upper',
+ 'Lower',
+ 'Pad',
+ 'Split',
+ 'Member',
+ 'Concatenate',
+ 'Join',
+ 'Sum',
+ 'Start',
+ 'Limit',
+ 'Regexp',
+ 'True',
+ 'OrderBy',
+ 'GroupBy',
+ 'Length',
+ 'Not',
+ 'Once',
+ 'Immediately',
+ 'Count',
+ 'Typecast',
+ 'Path',
+ 'PathPredicate',
+ 'InversePathPredicate',
+ 'PathSequence',
+ 'PathOr',
+ 'PathPlus',
+ 'PathStar',
+ 'PathTimes',
+ 'Dot',
+ 'TypeOf',
+ 'Quad',
+]
+
+const supportedWoqlFunctions = supportedWoql.map((woql) => renameFunction(woql))
+
+type WoqlElement = Query | Var | Literal
+
+export class AstJsWoqlTransformer {
+ transform(node: Node): Query {
+ return this.visitNode(node) as Query
+ }
+
+ private visitNodeValue(
+ node: Node,
+ nodeType: 'NodeValue' | 'Value',
+ ): Var | Uri {
+ switch (node?.type) {
+ case 'Identifier': {
+ return this.visitIdentifier(node as Identifier, nodeType)
+ }
+ case 'Literal': {
+ const valueNode = node as AcornLiteral
+ if (typeof valueNode?.value !== 'string')
+ throw new Error(`${nodeType} is not a string`)
+ if (valueNode.value.startsWith('v:')) {
+ return {
+ '@type': nodeType,
+ variable: valueNode.value.substring(2),
+ }
+ }
+ return {
+ '@type': nodeType,
+ node: valueNode.value,
+ }
+ }
+ default:
+ throw new Error(
+ `Unhandled value type: ${node?.type}, full node: ${JSON.stringify(
+ node,
+ )}`,
+ )
+ }
+ }
+
+ private visitNode(node: Node): WoqlElement {
+ switch (node?.type) {
+ case 'Program': {
+ const body = (node as Program)?.body
+ if (Array.isArray(body) && body.length === 1) {
+ return this.visitNode(body[0])
+ } else {
+ throw new Error(
+ `Only a single expression is supported: ${node?.type}`,
+ )
+ }
+ }
+ case 'BlockStatement': {
+ const body = (node as BlockStatement)?.body
+ if (Array.isArray(body) && body.length === 1) {
+ return this.visitNode(body[0])
+ } else {
+ throw new Error(
+ `Only a single expression is supported: ${node?.type}`,
+ )
+ }
+ }
+ case 'ExpressionStatement': {
+ const expression = (node as ExpressionStatement).expression
+ return this.visitNode(expression)
+ }
+ case 'CallExpression': {
+ return this.visitCallExpression(node as CallExpression)
+ }
+ case 'Identifier': {
+ return this.visitIdentifier(node as Identifier, 'NodeValue')
+ }
+ case 'Literal': {
+ return this.visitLiteral(node as AcornLiteral)
+ }
+ case 'ArrowFunctionExpression':
+ return this.visitArrowFunctionExpression(
+ node as ArrowFunctionExpression,
+ )
+ default:
+ throw new Error(
+ `Unhandled node type: ${node?.type}, full node: ${JSON.stringify(
+ node,
+ )}`,
+ )
+ }
+ }
+
+ private visitIdentifier(
+ node: Identifier | Expression | Super | Pattern,
+ identifierType: 'NodeValue' | 'Value' | undefined,
+ ): Var {
+ if (node.type === 'Identifier') {
+ return {
+ '@type': identifierType,
+ variable: node.name,
+ }
+ } else {
+ throw new Error(`Unhandled node type: ${node?.type}`)
+ }
+ }
+
+ private visitLiteral(node: AcornLiteral): Literal {
+ try {
+ const value = JSON.parse(node.raw ?? '') ?? node.value
+ if (
+ typeof this.currentCallExpression === 'string' &&
+ this.currentCallExpression !== '' &&
+ this.literalExceptions.includes(this.currentCallExpression)
+ ) {
+ return lit(value)
+ } else {
+ return value
+ }
+ } catch (e) {
+ throw new Error(`Unhandled literal value: ${node?.value}`)
+ }
+ }
+
+ private readonly literalExceptions = ['triple', 'quad']
+ private currentCallExpression: string | undefined = undefined
+
+ private visitCallExpression(node: CallExpression): Query {
+ const callIdentifier = this.visitIdentifier(node.callee, undefined)
+ const callee = callIdentifier?.variable
+ this.currentCallExpression = callee
+
+ if (
+ typeof callee === 'string' &&
+ callee !== '' &&
+ supportedWoqlFunctions.includes(callee)
+ ) {
+ switch (callee) {
+ case 'select':
+ case 'distinct': {
+ const lastArg = node.arguments.pop()
+ if (lastArg === null || lastArg === undefined) {
+ throw new Error(`${callee} requires at least one argument`)
+ }
+ const woql = this.visitNode(lastArg)
+ const identifiers = node.arguments.map(
+ (arg) =>
+ this.visitIdentifier(arg as AcornLiteral, 'NodeValue').variable,
+ )
+ if (callee === 'select') {
+ return WOQL.select(identifiers, woql as Query)
+ } else if (callee === 'distinct') {
+ return WOQL.distinct(identifiers, woql as Query)
+ } else {
+ throw new Error(`Unhandled ${callee as string}`)
+ }
+ }
+ case 'triple': {
+ return WOQL.triple(
+ this.visitNodeValue(node.arguments[0], 'NodeValue'),
+ this.visitNodeValue(node.arguments[1], 'NodeValue'),
+ this.visitNodeValue(node.arguments[2], 'Value'),
+ )
+ }
+ case 'quad': {
+ return WOQL.quad(
+ this.visitNodeValue(node.arguments[0], 'NodeValue'),
+ this.visitNodeValue(node.arguments[1], 'NodeValue'),
+ this.visitNodeValue(node.arguments[2], 'Value'),
+ (this.visitLiteral(node.arguments[3] as AcornLiteral)['@value'] ===
+ 'instance'
+ ? Graph.instance
+ : Graph.schema) ?? undefined,
+ )
+ }
+ case 'equals': {
+ return WOQL.equals(
+ this.visitNodeValue(node.arguments[0], 'Value'),
+ this.visitNodeValue(node.arguments[1], 'Value'),
+ )
+ }
+ default: {
+ // Here we limit what functions can be called from the library to the allowed terms
+ // It must not be allowed to call any function, but restricted to only functions.
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ return (WOQL[callee as keyof typeof WOQL] as any)(
+ ...node.arguments.map((arg) => this.visitNode(arg)),
+ )
+ }
+ }
+ } else {
+ throw new Error(`Unsupported function: ${callee}`)
+ }
+ }
+
+ private readonly registeredVariableNames: string[] = []
+
+ private visitArrowFunctionExpression(
+ node: ArrowFunctionExpression,
+ ): WoqlElement {
+ const params = Array.isArray(node.params) ? node.params : [node.params]
+ const variables = params.map(
+ (identifer) => this.visitIdentifier(identifer, undefined)?.variable,
+ )
+ this.registeredVariableNames.push(...variables)
+ return this.visitNode(node.body)
+ }
+}
diff --git a/src/lib/AstTransformation/mock/_allMocks.ts b/src/lib/AstTransformation/mock/_allMocks.ts
new file mode 100644
index 0000000..ac11358
--- /dev/null
+++ b/src/lib/AstTransformation/mock/_allMocks.ts
@@ -0,0 +1,7 @@
+export { default as select } from './select.woql.js'
+export { default as distinct } from './distinct.woql.js'
+export { default as or } from './or.woql.js'
+export { default as and } from './and.woql.js'
+export { default as triple } from './triple.woql.js'
+export { default as equals } from './equals.woql.js'
+export { default as not } from './not.woql.js'
diff --git a/src/lib/AstTransformation/mock/_documentQuery.woql.ts b/src/lib/AstTransformation/mock/_documentQuery.woql.ts
new file mode 100644
index 0000000..8c71a2e
--- /dev/null
+++ b/src/lib/AstTransformation/mock/_documentQuery.woql.ts
@@ -0,0 +1,56 @@
+import { Graph, type Query } from '../../../syntax.js'
+
+const textWoql: string = `
+(doc, type, unbound) => {
+ and(
+ triple(doc, "rdf:type", type),
+ not(quad(type, "sys:subdocument", unbound, "schema")),
+ )
+}
+`
+
+const woqlAst: Query = {
+ '@type': 'And',
+ and: [
+ {
+ '@type': 'Triple',
+ graph: undefined,
+ subject: {
+ '@type': 'NodeValue',
+ variable: 'doc',
+ },
+ predicate: {
+ '@type': 'NodeValue',
+ node: 'rdf:type',
+ },
+ object: {
+ '@type': 'Value',
+ variable: 'type',
+ },
+ },
+ {
+ '@type': 'Not',
+ query: {
+ '@type': 'Triple',
+ subject: {
+ '@type': 'NodeValue',
+ variable: 'type',
+ },
+ predicate: {
+ '@type': 'NodeValue',
+ node: 'sys:subdocument',
+ },
+ object: {
+ '@type': 'Value',
+ variable: 'unbound',
+ },
+ graph: Graph.schema,
+ },
+ },
+ ],
+}
+
+export default {
+ textWoql,
+ woqlAst,
+}
diff --git a/src/lib/AstTransformation/mock/and.woql.ts b/src/lib/AstTransformation/mock/and.woql.ts
new file mode 100644
index 0000000..57c5042
--- /dev/null
+++ b/src/lib/AstTransformation/mock/and.woql.ts
@@ -0,0 +1,35 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js'
+
+const mock: MockData[] = [
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ and(
+ triple(doc,"rdf:type",type),
+ triple(doc,"rdf:type",type)
+ )
+}
+`,
+ woqlAst: {
+ '@type': 'And',
+ and: [
+ {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ ],
+ },
+ },
+]
+
+export default mock
diff --git a/src/lib/AstTransformation/mock/distinct.woql.ts b/src/lib/AstTransformation/mock/distinct.woql.ts
new file mode 100644
index 0000000..a5b8482
--- /dev/null
+++ b/src/lib/AstTransformation/mock/distinct.woql.ts
@@ -0,0 +1,40 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js'
+
+const mock: MockData[] = [
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ distinct(doc,and())
+}
+`,
+ woqlAst: {
+ '@type': 'Distinct',
+ query: {
+ '@type': 'And',
+ and: [],
+ },
+ variables: ['doc'],
+ },
+ },
+ {
+ textWoql: `
+ (doc, type, unbound) => {
+ distinct(doc,type,triple(doc,"rdf:type",type))
+ }
+ `,
+
+ woqlAst: {
+ '@type': 'Distinct',
+ query: {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ variables: ['doc', 'type'],
+ },
+ },
+]
+
+export default mock
diff --git a/src/lib/AstTransformation/mock/equals.woql.ts b/src/lib/AstTransformation/mock/equals.woql.ts
new file mode 100644
index 0000000..e3a3a9b
--- /dev/null
+++ b/src/lib/AstTransformation/mock/equals.woql.ts
@@ -0,0 +1,24 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js'
+
+const mock: MockData[] = [
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ equals(doc,"rdf:type")
+}
+`,
+ woqlAst: {
+ '@type': 'Equals',
+ left: {
+ '@type': 'Value',
+ variable: 'doc',
+ },
+ right: {
+ '@type': 'Value',
+ node: 'rdf:type',
+ },
+ },
+ },
+]
+
+export default mock
diff --git a/src/lib/AstTransformation/mock/index.ts b/src/lib/AstTransformation/mock/index.ts
new file mode 100644
index 0000000..05be93b
--- /dev/null
+++ b/src/lib/AstTransformation/mock/index.ts
@@ -0,0 +1,3 @@
+import * as mock from './_allMocks.js'
+
+export default mock
diff --git a/src/lib/AstTransformation/mock/not.woql.ts b/src/lib/AstTransformation/mock/not.woql.ts
new file mode 100644
index 0000000..e298d5d
--- /dev/null
+++ b/src/lib/AstTransformation/mock/not.woql.ts
@@ -0,0 +1,31 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js'
+
+const mock: MockData[] = [
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ and(
+ not(
+ triple(doc,"rdf:type",type)
+ ))
+}
+`,
+ woqlAst: {
+ '@type': 'And',
+ and: [
+ {
+ '@type': 'Not',
+ query: {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ },
+ ],
+ },
+ },
+]
+
+export default mock
diff --git a/src/lib/AstTransformation/mock/or.woql.ts b/src/lib/AstTransformation/mock/or.woql.ts
new file mode 100644
index 0000000..6c97c2c
--- /dev/null
+++ b/src/lib/AstTransformation/mock/or.woql.ts
@@ -0,0 +1,35 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js'
+
+const mock: MockData[] = [
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ or(
+ triple(doc,"rdf:type",type),
+ triple(doc,"rdf:type",type)
+ )
+}
+`,
+ woqlAst: {
+ '@type': 'Or',
+ or: [
+ {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ ],
+ },
+ },
+]
+
+export default mock
diff --git a/src/lib/AstTransformation/mock/select.woql.ts b/src/lib/AstTransformation/mock/select.woql.ts
new file mode 100644
index 0000000..209c621
--- /dev/null
+++ b/src/lib/AstTransformation/mock/select.woql.ts
@@ -0,0 +1,40 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js'
+
+const mock: MockData[] = [
+ {
+ textWoql: `
+(doc, type, unbound) => {
+ select(doc,and())
+}
+`,
+ woqlAst: {
+ '@type': 'Select',
+ query: {
+ '@type': 'And',
+ and: [],
+ },
+ variables: ['doc'],
+ },
+ },
+ {
+ textWoql: `
+ (doc, type, unbound) => {
+ select(doc,type,triple(doc,"rdf:type",type))
+ }
+ `,
+
+ woqlAst: {
+ '@type': 'Select',
+ query: {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ variables: ['doc', 'type'],
+ },
+ },
+]
+
+export default mock
diff --git a/src/lib/AstTransformation/mock/triple.woql.ts b/src/lib/AstTransformation/mock/triple.woql.ts
new file mode 100644
index 0000000..5594389
--- /dev/null
+++ b/src/lib/AstTransformation/mock/triple.woql.ts
@@ -0,0 +1,34 @@
+import type { MockData } from '../JsWoqlAstTransformer.test.js'
+
+const mock: MockData[] = [
+ {
+ textWoql: `
+(doc, type) => {
+ triple(doc,"rdf:type",type)
+}
+`,
+ woqlAst: {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', variable: 'type' },
+ graph: undefined,
+ },
+ },
+ {
+ textWoql: `
+(doc, type) => {
+ triple("v:doc","rdf:type","@schema:MyType")
+}
+`,
+ woqlAst: {
+ '@type': 'Triple',
+ subject: { '@type': 'NodeValue', variable: 'doc' },
+ predicate: { '@type': 'NodeValue', node: 'rdf:type' },
+ object: { '@type': 'Value', node: '@schema:MyType' },
+ graph: undefined,
+ },
+ },
+]
+
+export default mock
diff --git a/src/lib/AstTransformation/parseWoqlString.ts b/src/lib/AstTransformation/parseWoqlString.ts
new file mode 100644
index 0000000..d514740
--- /dev/null
+++ b/src/lib/AstTransformation/parseWoqlString.ts
@@ -0,0 +1,26 @@
+import { AstJsWoqlTransformer } from '../AstTransformation/JsWoqlAstTransformer.js'
+import { parse } from 'acorn'
+import type { Program } from 'acorn'
+import type { Query } from '../../syntax.js'
+import escodegen from 'escodegen'
+
+const parseWoqlStringToJsAst = (code: string): Program | undefined => {
+ const ast = parse(code, {
+ ecmaVersion: 2020,
+ sourceType: 'module',
+ })
+ return ast
+}
+
+export const generateWoqlStringFromJsAst = (ast: Program): string => {
+ return escodegen.generate(ast)
+}
+
+export const parseWoqlString = (woql: string): Query => {
+ const ast = parseWoqlStringToJsAst(woql)
+ if (ast === undefined) {
+ throw new Error('Could not parse WOQL string')
+ }
+ const transformer = new AstJsWoqlTransformer()
+ return transformer.transform(ast)
+}
diff --git a/src/lib/index.ts b/src/lib/index.ts
new file mode 100644
index 0000000..6ad7582
--- /dev/null
+++ b/src/lib/index.ts
@@ -0,0 +1,3 @@
+export { parseWoqlString } from './AstTransformation/parseWoqlString.js'
+export { embedWoqlQuery } from './utils/prepareWoqlQuery.js'
+export { prepareWoqlHttpPostBody } from './utils/prepareWoqlQuery.js'
diff --git a/src/lib/utils/prepareWoqlQuery.ts b/src/lib/utils/prepareWoqlQuery.ts
new file mode 100644
index 0000000..ff170d6
--- /dev/null
+++ b/src/lib/utils/prepareWoqlQuery.ts
@@ -0,0 +1,110 @@
+import type { Query } from '../../syntax.js'
+
+interface WOQLQuery {
+ query: Query
+ all_witnesses?: boolean
+}
+
+interface WoqlQueryOptions {
+ allWitnesses?: boolean
+}
+
+export function embedWoqlQuery(
+ woql: Query,
+ options?: WoqlQueryOptions,
+): WOQLQuery {
+ return {
+ query: woql,
+ all_witnesses: options?.allWitnesses ?? undefined,
+ }
+}
+
+interface Source {
+ '@type': 'Source'
+ post?: string
+ url?: string
+}
+
+interface QueryResource {
+ '@type': 'QueryResource'
+ format: 'csv'
+ source: Source
+ options?: object
+}
+
+// Disabled linting as the Record form is not as expressive for what the key is
+// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
+interface WoqlFileAttachments {
+ [filename: string]: string
+}
+
+interface WoqlHttpPostBodyOptions {
+ allWitnesses?: boolean
+ attachments?: WoqlFileAttachments
+}
+
+export const prepareWoqlHttpPostBody = (
+ woql: Query,
+ options?: WoqlHttpPostBodyOptions,
+): WOQLQuery | FormData => {
+ const woqlQuery = embedWoqlQuery(woql, {
+ allWitnesses: options?.allWitnesses,
+ })
+
+ const resourceObjects = getResourceObjects(woqlQuery.query)
+
+ let postBody
+ if (resourceObjects.length > 0) {
+ const formData = new FormData()
+
+ resourceObjects.forEach((resourceObject) => {
+ const fileName =
+ resourceObject.source.post?.split('/').pop()?.split('\\').pop() ??
+ 'unknown.csv'
+ resourceObject.source.post = fileName
+
+ const attachment = options?.attachments?.[fileName]
+ if (typeof attachment === 'string' && attachment !== '') {
+ formData.append('file', attachment)
+ }
+ })
+
+ formData.append(
+ 'payload',
+ new Blob([JSON.stringify(woqlQuery)], { type: 'application/json' }),
+ 'body.json',
+ )
+
+ postBody = formData
+ } else {
+ postBody = woqlQuery
+ }
+ return postBody
+}
+
+// recurse the WOQL query for all properties and arrays. If @type on an object = QueryResource,
+// add it to the post body.
+const getResourceObjects = (woql: Query): QueryResource[] =>
+ (Array.isArray(woql) ? woql : [woql]).reduce(
+ (resources: QueryResource[], query: Query) => {
+ if (query !== null && typeof query === 'object') {
+ Object.keys(query).forEach((key) => {
+ const resourceKey = 'resource'
+ if (key !== resourceKey) return
+ if (!(key in query)) return // Looks like a type inaccuracy bug in TypeScript
+ const value = query[resourceKey]
+ if (value !== null && typeof value === 'object') {
+ if ('@type' in value && value['@type'] === 'QueryResource') {
+ resources.push(value as QueryResource)
+ } else {
+ resources = resources.concat(getResourceObjects(value))
+ }
+ }
+ })
+ } else if (typeof query !== 'string' && Array.isArray(query)) {
+ resources.concat(getResourceObjects(query))
+ }
+ return resources
+ },
+ [],
+ )
diff --git a/src/syntax.ts b/src/syntax.ts
index 2cff698..94fabb1 100644
--- a/src/syntax.ts
+++ b/src/syntax.ts
@@ -1,26 +1,5 @@
// Convenience functions for defining ASTs in WOQL
-import * as W from './woql_defs/woql.js'
-import { type Var } from './woql_defs/types.js'
export * from './woql_defs/woql.js'
+export { and, or } from './woql_defs/extra_signatures.js'
export * from './woql_defs/types.js'
-
-export function and(...args: W.Query[]): W.Query {
- return W.and(args)
-}
-
-export function or(...args: W.Query[]): W.Query {
- return W.or(args)
-}
-
-export function letvars(fn: (...x: Var[]) => W.Query): W.Query {
- const func = fn.toString()
- const args =
- func.slice(func.indexOf('(') + 1, func.indexOf(')')).match(/([^\s,]+)/g) ??
- []
- const vs = args.map((v) => {
- return {
- variable: v,
- }
- })
- return fn(...vs)
-}
+export * from './woql_local/index.js'
diff --git a/src/woql_defs/extra_signatures.ts b/src/woql_defs/extra_signatures.ts
new file mode 100644
index 0000000..56574e3
--- /dev/null
+++ b/src/woql_defs/extra_signatures.ts
@@ -0,0 +1,23 @@
+import * as W from './woql.js'
+import { type Var } from './types.js'
+
+export function and(...args: W.Query[]): W.Query {
+ return W.and(args)
+}
+
+export function or(...args: W.Query[]): W.Query {
+ return W.or(args)
+}
+
+export function letvars(fn: (...x: Var[]) => W.Query): W.Query {
+ const func = fn.toString()
+ const args =
+ func.slice(func.indexOf('(') + 1, func.indexOf(')')).match(/([^\s,]+)/g) ??
+ []
+ const vs = args.map((v) => {
+ return {
+ variable: v,
+ }
+ })
+ return fn(...vs)
+}
diff --git a/src/woql_defs/generate.ts b/src/woql_defs/generate.ts
index 16b52f2..7d8c62a 100644
--- a/src/woql_defs/generate.ts
+++ b/src/woql_defs/generate.ts
@@ -206,7 +206,7 @@ export async function generateWoql(): Promise {
let defs = `
/* eslint-disable @typescript-eslint/no-empty-interface */
/* eslint-disable @typescript-eslint/naming-convention */
-import { type Graph, type Value, type Node, type Column, type Literal } from './types.js'
+import { type Graph, type Value, type Node, type Column, type Literal, type WoqlNode } from './types.js'
`
const queryDefs = generateDefs(woqlSchema, 'Query')
diff --git a/src/woql_defs/types.ts b/src/woql_defs/types.ts
index a782274..a73316c 100644
--- a/src/woql_defs/types.ts
+++ b/src/woql_defs/types.ts
@@ -4,6 +4,7 @@ export enum Graph {
}
export interface Uri {
+ '@type'?: 'NodeValue' | 'Value'
node: string
}
@@ -67,11 +68,29 @@ export function lit(
return { '@type': type, '@value': value }
}
+export interface Quad {
+ '@type': 'Triple'
+ subject: Node
+ predicate: Node
+ object: Value
+ graph?: Graph
+}
+
+export function quad(
+ subject: Node,
+ predicate: Node,
+ object: Value,
+ graph?: Graph,
+): Quad {
+ return { '@type': 'Triple', subject, predicate, object, graph }
+}
+
export function uri(value: string): Uri {
return { node: value }
}
export interface Var {
+ '@type'?: 'NodeValue' | 'Value'
variable: string
}
diff --git a/src/woql_defs/woql_list.json b/src/woql_defs/woql_list.json
index 47fd9b8..a0f770c 100644
--- a/src/woql_defs/woql_list.json
+++ b/src/woql_defs/woql_list.json
@@ -270,6 +270,31 @@
"@type": "List"
}
},
+ {
+ "@documentation": {
+ "@comment": "Keep a subquery from being optimized, 'Pin' it in the order given",
+ "@properties": {
+ "query": "The query to pin"
+ }
+ },
+ "@id": "Pin",
+ "@inherits": "Query",
+ "@metadata": {
+ "https://terminusdb.com": {
+ "fields": [
+ "query"
+ ],
+ "mode": [
+ ":"
+ ],
+ "types": [
+ "query"
+ ]
+ }
+ },
+ "@type": "Class",
+ "query": "Query"
+ },
{
"@documentation": {
"@comment": "A conjunction of queries which must all have a solution.",
@@ -423,7 +448,7 @@
"subject",
"predicate",
"object",
- "graph"
+ "optional(graph)"
],
"mode": [
"?",
@@ -435,7 +460,7 @@
"node",
"node",
"value",
- "optional(graph)"
+ "graph"
]
}
},
@@ -469,7 +494,7 @@
"subject",
"predicate",
"object",
- "graph"
+ "optional(graph)"
],
"mode": [
"+",
@@ -481,7 +506,7 @@
"node",
"node",
"value",
- "optional(graph)"
+ "graph"
]
}
},
@@ -515,7 +540,7 @@
"subject",
"predicate",
"object",
- "graph"
+ "optional(graph)"
],
"mode": [
"?",
@@ -527,7 +552,7 @@
"node",
"node",
"value",
- "optional(graph)"
+ "graph"
]
}
},
@@ -561,7 +586,7 @@
"subject",
"predicate",
"object",
- "graph"
+ "optional(graph)"
],
"mode": [
"+",
@@ -573,7 +598,7 @@
"node",
"node",
"value",
- "optional(graph)"
+ "graph"
]
}
},
@@ -607,7 +632,7 @@
"subject",
"predicate",
"object",
- "graph"
+ "optional(graph)"
],
"mode": [
"?",
@@ -619,7 +644,7 @@
"node",
"node",
"value",
- "optional(graph)"
+ "graph"
]
}
},
@@ -844,7 +869,7 @@
"https://terminusdb.com": {
"fields": [
"document",
- "identifier"
+ "optional(identifier)"
],
"mode": [
"+",
@@ -852,7 +877,7 @@
],
"types": [
"node",
- "optional(json)"
+ "json"
]
}
},
@@ -880,7 +905,7 @@
"https://terminusdb.com": {
"fields": [
"document",
- "identifier"
+ "optional(identifier)"
],
"mode": [
"+",
@@ -888,7 +913,7 @@
],
"types": [
"node",
- "optional(json)"
+ "json"
]
}
},
@@ -996,7 +1021,7 @@
"fields": [
"columns",
"resource",
- "has_header"
+ "optional(has_header)"
],
"mode": [
[
@@ -1008,7 +1033,7 @@
"types": [
"list(column)",
"resource",
- "optional(boolean)"
+ "boolean"
]
}
},
@@ -1235,16 +1260,16 @@
"@metadata": {
"https://terminusdb.com": {
"fields": [
- "expression",
- "result"
+ "result",
+ "expression"
],
"mode": [
- "+",
- "?"
+ "?",
+ "+"
],
"types": [
- "arithmetic",
- "decimal"
+ "decimal",
+ "arithmetic"
]
}
},
@@ -1295,22 +1320,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "left",
- "right"
- ],
- "mode": [
- "+",
- "+"
- ],
- "types": [
- "arithmetic",
- "arithmetic"
- ]
- }
- },
"@type": "Class",
"left": "ArithmeticExpression",
"right": "ArithmeticExpression"
@@ -1328,22 +1337,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "left",
- "right"
- ],
- "mode": [
- "+",
- "+"
- ],
- "types": [
- "arithmetic",
- "arithmetic"
- ]
- }
- },
"@type": "Class",
"left": "ArithmeticExpression",
"right": "ArithmeticExpression"
@@ -1361,22 +1354,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "left",
- "right"
- ],
- "mode": [
- "+",
- "+"
- ],
- "types": [
- "arithmetic",
- "arithmetic"
- ]
- }
- },
"@type": "Class",
"left": "ArithmeticExpression",
"right": "ArithmeticExpression"
@@ -1394,22 +1371,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "left",
- "right"
- ],
- "mode": [
- "+",
- "+"
- ],
- "types": [
- "arithmetic",
- "arithmetic"
- ]
- }
- },
"@type": "Class",
"left": "ArithmeticExpression",
"right": "ArithmeticExpression"
@@ -1427,22 +1388,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "left",
- "right"
- ],
- "mode": [
- "+",
- "+"
- ],
- "types": [
- "arithmetic",
- "arithmetic"
- ]
- }
- },
"@type": "Class",
"left": "ArithmeticExpression",
"right": "ArithmeticExpression"
@@ -1460,22 +1405,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "left",
- "right"
- ],
- "mode": [
- "+",
- "+"
- ],
- "types": [
- "arithmetic",
- "arithmetic"
- ]
- }
- },
"@type": "Class",
"left": "ArithmeticExpression",
"right": "ArithmeticExpression"
@@ -1492,20 +1421,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "argument"
- ],
- "mode": [
- "+",
- "+"
- ],
- "types": [
- "arithmetic"
- ]
- }
- },
"@type": "Class",
"argument": "ArithmeticExpression"
},
@@ -1688,6 +1603,25 @@
"@key": {
"@type": "ValueHash"
},
+ "@metadata": {
+ "https://terminusdb.com": {
+ "fields": [
+ "base",
+ "key_list",
+ "uri"
+ ],
+ "mode": [
+ "+",
+ "+",
+ "?"
+ ],
+ "types": [
+ "string",
+ "list(string)",
+ "node"
+ ]
+ }
+ },
"@type": "Class",
"base": "DataValue",
"key_list": {
@@ -1727,6 +1661,25 @@
"@key": {
"@type": "ValueHash"
},
+ "@metadata": {
+ "https://terminusdb.com": {
+ "fields": [
+ "base",
+ "key_list",
+ "uri"
+ ],
+ "mode": [
+ "+",
+ "+",
+ "?"
+ ],
+ "types": [
+ "string",
+ "list(string)",
+ "node"
+ ]
+ }
+ },
"@type": "Class",
"base": "DataValue",
"key_list": {
@@ -2276,7 +2229,6 @@
"length"
],
"mode": [
- "+",
"+",
"?"
],
@@ -2471,7 +2423,7 @@
"subject",
"pattern",
"object",
- "path"
+ "optional(path)"
],
"mode": [
"?",
@@ -2483,7 +2435,7 @@
"node",
"pattern",
"node",
- "optional(path)"
+ "json"
]
}
},
@@ -2508,19 +2460,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "predicate"
- ],
- "mode": [
- "+"
- ],
- "types": [
- "optional(string)"
- ]
- }
- },
"@type": "Class",
"predicate": {
"@class": "xsd:string",
@@ -2539,19 +2478,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "predicate"
- ],
- "mode": [
- "+"
- ],
- "types": [
- "optional(string)"
- ]
- }
- },
"@type": "Class",
"predicate": {
"@class": "xsd:string",
@@ -2570,19 +2496,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "sequence"
- ],
- "mode": [
- "+"
- ],
- "types": [
- "list(path)"
- ]
- }
- },
"@type": "Class",
"sequence": {
"@class": "PathPattern",
@@ -2601,19 +2514,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "or"
- ],
- "mode": [
- "+"
- ],
- "types": [
- "list(path)"
- ]
- }
- },
"@type": "Class",
"or": {
"@class": "PathPattern",
@@ -2632,19 +2532,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "plus"
- ],
- "mode": [
- "+"
- ],
- "types": [
- "path"
- ]
- }
- },
"@type": "Class",
"plus": "PathPattern"
},
@@ -2660,19 +2547,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "star"
- ],
- "mode": [
- "+"
- ],
- "types": [
- "path"
- ]
- }
- },
"@type": "Class",
"star": "PathPattern"
},
@@ -2690,25 +2564,6 @@
"@key": {
"@type": "ValueHash"
},
- "@metadata": {
- "https://terminusdb.com": {
- "fields": [
- "times",
- "from",
- "to"
- ],
- "mode": [
- "+",
- "+",
- "+"
- ],
- "types": [
- "path",
- "integer",
- "integer"
- ]
- }
- },
"@type": "Class",
"from": "xsd:nonNegativeInteger",
"times": "PathPattern",
@@ -2765,6 +2620,22 @@
"@key": {
"@type": "ValueHash"
},
+ "@metadata": {
+ "https://terminusdb.com": {
+ "fields": [
+ "resource",
+ "size"
+ ],
+ "mode": [
+ "+",
+ "?"
+ ],
+ "types": [
+ "collection",
+ "decimal"
+ ]
+ }
+ },
"@type": "Class",
"resource": "xsd:string",
"size": "DataValue"
@@ -2782,6 +2653,22 @@
"@key": {
"@type": "ValueHash"
},
+ "@metadata": {
+ "https://terminusdb.com": {
+ "fields": [
+ "resource",
+ "count"
+ ],
+ "mode": [
+ "+",
+ "?"
+ ],
+ "types": [
+ "collection",
+ "decimal"
+ ]
+ }
+ },
"@type": "Class",
"count": "DataValue",
"resource": "xsd:string"
diff --git a/src/woql_local/index.ts b/src/woql_local/index.ts
new file mode 100644
index 0000000..2be6720
--- /dev/null
+++ b/src/woql_local/index.ts
@@ -0,0 +1,15 @@
+import type { Var } from '../syntax.js'
+import type * as W from '../woql_defs/woql.js'
+
+export function letvars(fn: (...x: Var[]) => W.Query): W.Query {
+ const func = fn.toString()
+ const args =
+ func.slice(func.indexOf('(') + 1, func.indexOf(')')).match(/([^\s,]+)/g) ??
+ []
+ const vs = args.map((v) => {
+ return {
+ variable: v,
+ }
+ })
+ return fn(...vs)
+}
diff --git a/tsconfig.json b/tsconfig.json
index 256a668..0e8b874 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,12 +1,12 @@
{
"extends": "@tsconfig/node18/tsconfig.json",
"baseUrl": "./",
- "include": [
- "src/**/*.ts"
- ],
+ "include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "dist",
"sourceMap": true,
- "module" : "node16"
+ "declaration": true,
+ "target": "ES2019",
+ "module": "Node16"
}
}