@quickql/server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +91 -0
- package/dist/core/src/client.d.ts +57 -0
- package/dist/core/src/client.d.ts.map +1 -0
- package/dist/core/src/client.js +164 -0
- package/dist/core/src/client.js.map +1 -0
- package/dist/core/src/index.d.ts +13 -0
- package/dist/core/src/index.d.ts.map +1 -0
- package/dist/core/src/index.js +13 -0
- package/dist/core/src/index.js.map +1 -0
- package/dist/core/src/types.d.ts +82 -0
- package/dist/core/src/types.d.ts.map +1 -0
- package/dist/core/src/types.js +12 -0
- package/dist/core/src/types.js.map +1 -0
- package/dist/server/src/engine.d.ts +55 -0
- package/dist/server/src/engine.d.ts.map +1 -0
- package/dist/server/src/engine.js +422 -0
- package/dist/server/src/engine.js.map +1 -0
- package/dist/server/src/errors.d.ts +31 -0
- package/dist/server/src/errors.d.ts.map +1 -0
- package/dist/server/src/errors.js +73 -0
- package/dist/server/src/errors.js.map +1 -0
- package/dist/server/src/executor.d.ts +25 -0
- package/dist/server/src/executor.d.ts.map +1 -0
- package/dist/server/src/executor.js +121 -0
- package/dist/server/src/executor.js.map +1 -0
- package/dist/server/src/filters.d.ts +10 -0
- package/dist/server/src/filters.d.ts.map +1 -0
- package/dist/server/src/filters.js +47 -0
- package/dist/server/src/filters.js.map +1 -0
- package/dist/server/src/handler.d.ts +12 -0
- package/dist/server/src/handler.d.ts.map +1 -0
- package/dist/server/src/handler.js +138 -0
- package/dist/server/src/handler.js.map +1 -0
- package/dist/server/src/index.d.ts +25 -0
- package/dist/server/src/index.d.ts.map +1 -0
- package/dist/server/src/index.js +26 -0
- package/dist/server/src/index.js.map +1 -0
- package/dist/server/src/parser/parser.d.ts +21 -0
- package/dist/server/src/parser/parser.d.ts.map +1 -0
- package/dist/server/src/parser/parser.js +99 -0
- package/dist/server/src/parser/parser.js.map +1 -0
- package/dist/server/src/parser/tokenizer.d.ts +18 -0
- package/dist/server/src/parser/tokenizer.d.ts.map +1 -0
- package/dist/server/src/parser/tokenizer.js +94 -0
- package/dist/server/src/parser/tokenizer.js.map +1 -0
- package/dist/server/src/parser/transformer.d.ts +24 -0
- package/dist/server/src/parser/transformer.d.ts.map +1 -0
- package/dist/server/src/parser/transformer.js +61 -0
- package/dist/server/src/parser/transformer.js.map +1 -0
- package/dist/server/src/parser/types.d.ts +21 -0
- package/dist/server/src/parser/types.d.ts.map +1 -0
- package/dist/server/src/parser/types.js +11 -0
- package/dist/server/src/parser/types.js.map +1 -0
- package/dist/server/src/playground/assets.d.ts +16 -0
- package/dist/server/src/playground/assets.d.ts.map +1 -0
- package/dist/server/src/playground/assets.js +1113 -0
- package/dist/server/src/playground/assets.js.map +1 -0
- package/dist/server/src/playground/docs.d.ts +15 -0
- package/dist/server/src/playground/docs.d.ts.map +1 -0
- package/dist/server/src/playground/docs.js +223 -0
- package/dist/server/src/playground/docs.js.map +1 -0
- package/dist/server/src/playground/html.d.ts +20 -0
- package/dist/server/src/playground/html.d.ts.map +1 -0
- package/dist/server/src/playground/html.js +50 -0
- package/dist/server/src/playground/html.js.map +1 -0
- package/dist/server/src/plugins/index.d.ts +21 -0
- package/dist/server/src/plugins/index.d.ts.map +1 -0
- package/dist/server/src/plugins/index.js +38 -0
- package/dist/server/src/plugins/index.js.map +1 -0
- package/dist/server/src/relations.d.ts +22 -0
- package/dist/server/src/relations.d.ts.map +1 -0
- package/dist/server/src/relations.js +98 -0
- package/dist/server/src/relations.js.map +1 -0
- package/dist/server/src/resolver/generator.d.ts +25 -0
- package/dist/server/src/resolver/generator.d.ts.map +1 -0
- package/dist/server/src/resolver/generator.js +65 -0
- package/dist/server/src/resolver/generator.js.map +1 -0
- package/dist/server/src/resolver/mapper.d.ts +23 -0
- package/dist/server/src/resolver/mapper.d.ts.map +1 -0
- package/dist/server/src/resolver/mapper.js +96 -0
- package/dist/server/src/resolver/mapper.js.map +1 -0
- package/dist/server/src/schema/builder.d.ts +21 -0
- package/dist/server/src/schema/builder.d.ts.map +1 -0
- package/dist/server/src/schema/builder.js +23 -0
- package/dist/server/src/schema/builder.js.map +1 -0
- package/dist/server/src/schema/types.d.ts +81 -0
- package/dist/server/src/schema/types.d.ts.map +1 -0
- package/dist/server/src/schema/types.js +11 -0
- package/dist/server/src/schema/types.js.map +1 -0
- package/dist/server/src/schema/utils.d.ts +16 -0
- package/dist/server/src/schema/utils.d.ts.map +1 -0
- package/dist/server/src/schema/utils.js +42 -0
- package/dist/server/src/schema/utils.js.map +1 -0
- package/dist/server/src/security.d.ts +46 -0
- package/dist/server/src/security.d.ts.map +1 -0
- package/dist/server/src/security.js +189 -0
- package/dist/server/src/security.js.map +1 -0
- package/dist/server/src/types.d.ts +158 -0
- package/dist/server/src/types.d.ts.map +1 -0
- package/dist/server/src/types.js +11 -0
- package/dist/server/src/types.js.map +1 -0
- package/dist/server/src/validator.d.ts +30 -0
- package/dist/server/src/validator.d.ts.map +1 -0
- package/dist/server/src/validator.js +171 -0
- package/dist/server/src/validator.js.map +1 -0
- package/package.json +25 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QuickQL Query Executor
|
|
3
|
+
*
|
|
4
|
+
* Handles the actual fetching, filtering, and field-level mapping
|
|
5
|
+
* between the schema and the raw data sources.
|
|
6
|
+
*
|
|
7
|
+
* (c) 2024-2026 Udinmo Inc. All rights reserved.
|
|
8
|
+
* Author: Udinmo Inc. <engineering@udinmo.com>
|
|
9
|
+
* License: MIT
|
|
10
|
+
*/
|
|
11
|
+
import { RelationEngine } from './relations';
|
|
12
|
+
import { FilterEngine } from './filters';
|
|
13
|
+
export class QueryExecutor {
|
|
14
|
+
schema;
|
|
15
|
+
features;
|
|
16
|
+
directives;
|
|
17
|
+
relationEngine;
|
|
18
|
+
constructor(schema, features = {
|
|
19
|
+
smartCollectionMatching: true,
|
|
20
|
+
superSelection: true,
|
|
21
|
+
smartRelationDiscovery: true
|
|
22
|
+
}, directives = []) {
|
|
23
|
+
this.schema = schema;
|
|
24
|
+
this.features = features;
|
|
25
|
+
this.directives = directives;
|
|
26
|
+
this.relationEngine = new RelationEngine(schema, this.execute.bind(this), features);
|
|
27
|
+
}
|
|
28
|
+
collectionCache = new Map();
|
|
29
|
+
resolveCollectionName(input) {
|
|
30
|
+
if (this.collectionCache.has(input))
|
|
31
|
+
return this.collectionCache.get(input);
|
|
32
|
+
if (this.schema[input])
|
|
33
|
+
return input;
|
|
34
|
+
if (this.features.smartCollectionMatching) {
|
|
35
|
+
const candidates = Object.keys(this.schema);
|
|
36
|
+
const exactMatch = candidates.find(c => c === input ||
|
|
37
|
+
c === `${input}s` ||
|
|
38
|
+
c === `${input}es` ||
|
|
39
|
+
c === input.replace(/s$/, ''));
|
|
40
|
+
if (exactMatch) {
|
|
41
|
+
this.collectionCache.set(input, exactMatch);
|
|
42
|
+
return exactMatch;
|
|
43
|
+
}
|
|
44
|
+
const suggestion = candidates.find(c => c.startsWith(input.substring(0, 3)) ||
|
|
45
|
+
input.startsWith(c.substring(0, 3)));
|
|
46
|
+
if (suggestion) {
|
|
47
|
+
console.warn(`[QuickQL] WARNING: Collection '${input}' not found. Using '${suggestion}' automatically.`);
|
|
48
|
+
this.collectionCache.set(input, suggestion);
|
|
49
|
+
return suggestion;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
this.collectionCache.set(input, null);
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
async execute(query, depth = 0, ctx) {
|
|
56
|
+
const resolvedName = this.resolveCollectionName(query.from);
|
|
57
|
+
if (!resolvedName)
|
|
58
|
+
return [];
|
|
59
|
+
query.from = resolvedName;
|
|
60
|
+
const collection = this.schema[resolvedName];
|
|
61
|
+
// 1. Fetch raw data from resolver - Now passing CTX for ORM access!
|
|
62
|
+
let results = await collection.resolver(query, ctx);
|
|
63
|
+
// 2. Apply filters (Standard WHERE engine logic)
|
|
64
|
+
results = FilterEngine.applyFilters(results, query.where);
|
|
65
|
+
// 3. Resolve relations (Nested included data)
|
|
66
|
+
if (query.include && collection.relations) {
|
|
67
|
+
results = await this.relationEngine.resolve(results, query.include, collection.relations, depth);
|
|
68
|
+
}
|
|
69
|
+
// Apply selection and field aliasing
|
|
70
|
+
if (query.select && query.select.length > 0) {
|
|
71
|
+
results = this.applySelection(results, query.select, query.include, query);
|
|
72
|
+
}
|
|
73
|
+
// Process @directives if defined
|
|
74
|
+
if (this.directives.length > 0 && query.directives) {
|
|
75
|
+
for (const [name, args] of Object.entries(query.directives)) {
|
|
76
|
+
const handler = this.directives.find(d => d.name === name)?.handler;
|
|
77
|
+
if (handler) {
|
|
78
|
+
results = await handler(results, args, ctx);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return results;
|
|
83
|
+
}
|
|
84
|
+
async executeMutation(mutation, ctx) {
|
|
85
|
+
const collection = this.schema[mutation.collection];
|
|
86
|
+
if (!collection || !collection.mutationResolver)
|
|
87
|
+
return null;
|
|
88
|
+
return collection.mutationResolver(mutation, ctx);
|
|
89
|
+
}
|
|
90
|
+
applySelection(results, select, include, query) {
|
|
91
|
+
if (results.length === 0)
|
|
92
|
+
return [];
|
|
93
|
+
// Pre-calculate selection logic once
|
|
94
|
+
const firstItem = results[0];
|
|
95
|
+
const realSelect = (select.includes('*') && this.features.superSelection)
|
|
96
|
+
? [...new Set([...select.filter(s => s !== '*'), ...Object.keys(firstItem)])]
|
|
97
|
+
: select;
|
|
98
|
+
const selections = realSelect.map(s => {
|
|
99
|
+
const parts = s.split(':');
|
|
100
|
+
return {
|
|
101
|
+
original: parts[0].trim(),
|
|
102
|
+
alias: (parts[1] || parts[0]).trim()
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
const includeKeys = include ? Object.keys(include) : [];
|
|
106
|
+
return results.map(item => {
|
|
107
|
+
const selected = {};
|
|
108
|
+
for (const { original, alias } of selections) {
|
|
109
|
+
const val = item[original];
|
|
110
|
+
selected[alias] = val !== undefined ? val : null;
|
|
111
|
+
}
|
|
112
|
+
for (const key of includeKeys) {
|
|
113
|
+
if (item[key] !== undefined) {
|
|
114
|
+
selected[key] = item[key];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return selected;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,aAAa;IAId;IACA;IAKA;IATF,cAAc,CAAiB;IAEvC,YACU,MAAoB,EACpB,WAA2B;QACjC,uBAAuB,EAAE,IAAI;QAC7B,cAAc,EAAE,IAAI;QACpB,sBAAsB,EAAE,IAAI;KAC7B,EACO,aAAgC,EAAE;QANlC,WAAM,GAAN,MAAM,CAAc;QACpB,aAAQ,GAAR,QAAQ,CAIf;QACO,eAAU,GAAV,UAAU,CAAwB;QAE1C,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;IACtF,CAAC;IAEO,eAAe,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEnD,qBAAqB,CAAC,KAAa;QACzC,IAAI,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;QAE7E,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAErC,IAAI,IAAI,CAAC,QAAQ,CAAC,uBAAuB,EAAE,CAAC;YAC1C,MAAM,UAAU,G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AE;aACrC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAExD,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACxB,MAAM,QAAQ,GAA4B,EAAE,CAAC;YAE7C,KAAK,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,UAAU,EAAE,CAAC;gBAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC3B,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;YACnD,CAAC;YAED,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;gBAC9B,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;oBAC5B,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WhereClause, LogicalCondition } from '@quickql/core';
|
|
2
|
+
export declare class FilterEngine {
|
|
3
|
+
/**
|
|
4
|
+
* Simple in-memory filtering helper for resolvers that don't support native filtering.
|
|
5
|
+
*/
|
|
6
|
+
static applyFilters(items: any[], where?: WhereClause | LogicalCondition): any[];
|
|
7
|
+
private static evaluate;
|
|
8
|
+
private static match;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../src/filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAA4B,MAAM,eAAe,CAAC;AAExF,qBAAa,YAAY;IACvB;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,gBAAgB,GAAG,GAAG,EAAE;IAKhF,OAAO,CAAC,MAAM,CAAC,QAAQ;IAmBvB,OAAO,CAAC,MAAM,CAAC,KAAK;CAoBrB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export class FilterEngine {
|
|
2
|
+
/**
|
|
3
|
+
* Simple in-memory filtering helper for resolvers that don't support native filtering.
|
|
4
|
+
*/
|
|
5
|
+
static applyFilters(items, where) {
|
|
6
|
+
if (!where)
|
|
7
|
+
return items;
|
|
8
|
+
return items.filter(item => this.evaluate(item, where));
|
|
9
|
+
}
|
|
10
|
+
static evaluate(item, condition) {
|
|
11
|
+
// Check for logical operators AND / OR
|
|
12
|
+
if ('AND' in condition && Array.isArray(condition.AND)) {
|
|
13
|
+
return condition.AND.every(sub => typeof sub === 'object' && this.evaluate(item, sub));
|
|
14
|
+
}
|
|
15
|
+
if ('OR' in condition && Array.isArray(condition.OR)) {
|
|
16
|
+
return condition.OR.some(sub => typeof sub === 'object' && this.evaluate(item, sub));
|
|
17
|
+
}
|
|
18
|
+
// Default: AND behavior for multiple fields in a WhereClause
|
|
19
|
+
return Object.entries(condition).every(([field, check]) => {
|
|
20
|
+
// Skip if it was actually AND/OR in a mixed object (not ideal but safe)
|
|
21
|
+
if (field === 'AND' || field === 'OR')
|
|
22
|
+
return true;
|
|
23
|
+
const value = item[field];
|
|
24
|
+
return this.match(value, check);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
static match(value, condition) {
|
|
28
|
+
if (typeof condition !== 'object' || condition === null || Array.isArray(condition)) {
|
|
29
|
+
return value === condition;
|
|
30
|
+
}
|
|
31
|
+
const checks = Object.entries(condition);
|
|
32
|
+
return checks.every(([operator, expected]) => {
|
|
33
|
+
switch (operator) {
|
|
34
|
+
case 'eq': return value === expected;
|
|
35
|
+
case 'ne': return value !== expected;
|
|
36
|
+
case 'gt': return value > expected;
|
|
37
|
+
case 'lt': return value < expected;
|
|
38
|
+
case 'in': return Array.isArray(expected) && expected.includes(value);
|
|
39
|
+
case 'contains': return typeof value === 'string' && value.includes(expected);
|
|
40
|
+
case 'startsWith': return typeof value === 'string' && value.startsWith(expected);
|
|
41
|
+
case 'endsWith': return typeof value === 'string' && value.endsWith(expected);
|
|
42
|
+
default: return false;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../src/filters.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IACvB;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,KAAY,EAAE,KAAsC;QACtE,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAC;QACzB,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IAC1D,CAAC;IAEO,MAAM,CAAC,QAAQ,CAAC,IAAS,EAAE,SAAyC;QAC1E,uCAAuC;QACvC,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;YACtD,OAAO,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAkB,CAAC,CAAC,CAAC;QACzG,CAAC;QACD,IAAI,IAAI,IAAI,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC;YACpD,OAAO,SAAS,CAAC,EAAE,C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O,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACtE,KAAK,UAAU,CAAC,CAAC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAC9E,KAAK,YAAY,CAAC,CAAC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;gBAClF,KAAK,UAAU,CAAC,CAAC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAC9E,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC;YACxB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QuickQLServer } from './engine';
|
|
2
|
+
export interface HandlerOptions {
|
|
3
|
+
server: QuickQLServer;
|
|
4
|
+
endpoint?: string;
|
|
5
|
+
version?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Creates a universal handler for QuickQL that manages both
|
|
9
|
+
* the Playground Shell (GET) and the Query Engine (POST).
|
|
10
|
+
*/
|
|
11
|
+
export declare function createQuickQLHandler(options: HandlerOptions): (req: any, res: any) => Promise<any>;
|
|
12
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AASzC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,cAAc,IAI5C,KAAK,GAAG,EAAE,KAAK,GAAG,kBA8HjC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { renderPlayground } from './playground/html';
|
|
2
|
+
import { formatError, getHttpStatusCode } from './errors';
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
// Global Event Hub for Real-time
|
|
5
|
+
const hub = new EventEmitter();
|
|
6
|
+
hub.setMaxListeners(100);
|
|
7
|
+
/**
|
|
8
|
+
* Creates a universal handler for QuickQL that manages both
|
|
9
|
+
* the Playground Shell (GET) and the Query Engine (POST).
|
|
10
|
+
*/
|
|
11
|
+
export function createQuickQLHandler(options) {
|
|
12
|
+
const { server, endpoint = '/quickql', version } = options;
|
|
13
|
+
const config = server.getOptions();
|
|
14
|
+
return async (req, res) => {
|
|
15
|
+
const method = req.method?.toUpperCase();
|
|
16
|
+
// 0. Handle CORS
|
|
17
|
+
if (config.cors) {
|
|
18
|
+
if (typeof res.setHeader === 'function') {
|
|
19
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
20
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
|
21
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, X-QuickQL-Key, Authorization');
|
|
22
|
+
res.setHeader('Access-Control-Expose-Headers', 'X-QuickQL-Version, X-QuickQL-Complexity');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (method === 'OPTIONS') {
|
|
26
|
+
if (typeof res.status === 'function')
|
|
27
|
+
res.status(204);
|
|
28
|
+
if (typeof res.end === 'function')
|
|
29
|
+
return res.end();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// 1. Handle GET: Playground UI or Schema
|
|
33
|
+
if (method === 'GET') {
|
|
34
|
+
const url = new URL(req.url || '', `http://${req.headers?.host || 'localhost'}`);
|
|
35
|
+
// Return schema metadata directly if requested
|
|
36
|
+
if (url.searchParams.get('schema') === 'true') {
|
|
37
|
+
const schema = server.getSchemaSummary();
|
|
38
|
+
if (typeof res.status === 'function')
|
|
39
|
+
res.status(200);
|
|
40
|
+
if (typeof res.json === 'function')
|
|
41
|
+
return res.json(schema);
|
|
42
|
+
if (typeof res.setHeader === 'function')
|
|
43
|
+
res.setHeader('Content-Type', 'application/json');
|
|
44
|
+
return JSON.stringify(schema);
|
|
45
|
+
}
|
|
46
|
+
// 3. New: Real-time SSE Stream
|
|
47
|
+
const isStream = url.searchParams.get('stream') === 'true' || req.url?.includes('/stream');
|
|
48
|
+
if (isStream) {
|
|
49
|
+
if (typeof res.setHeader === 'function') {
|
|
50
|
+
res.setHeader('Content-Type', 'text/event-stream');
|
|
51
|
+
res.setHeader('Cache-Control', 'no-cache');
|
|
52
|
+
res.setHeader('Connection', 'keep-alive');
|
|
53
|
+
}
|
|
54
|
+
const listener = (data) => {
|
|
55
|
+
res.write(`data: ${JSON.stringify(data)}\n\n`);
|
|
56
|
+
};
|
|
57
|
+
hub.on('mutation', listener);
|
|
58
|
+
req.on('close', () => hub.off('mutation', listener));
|
|
59
|
+
res.write('retry: 10000\n');
|
|
60
|
+
res.write('event: connected\ndata: {"status":"active"}\n\n');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (config.debug && config.playground) {
|
|
64
|
+
const playgroundConfig = typeof config.playground === 'object' ? config.playground : {};
|
|
65
|
+
const html = renderPlayground({
|
|
66
|
+
endpoint: playgroundConfig.endpoint || endpoint,
|
|
67
|
+
debug: playgroundConfig.debug ?? config.debug
|
|
68
|
+
});
|
|
69
|
+
if (typeof res.status === 'function')
|
|
70
|
+
res.status(200);
|
|
71
|
+
if (typeof res.setHeader === 'function')
|
|
72
|
+
res.setHeader('Content-Type', 'text/html');
|
|
73
|
+
if (typeof res.end === 'function')
|
|
74
|
+
return res.end(html);
|
|
75
|
+
return html;
|
|
76
|
+
}
|
|
77
|
+
// Security: Hidden in production
|
|
78
|
+
const errorMsg = 'QuickQL Playground is disabled in production.';
|
|
79
|
+
if (typeof res.status === 'function')
|
|
80
|
+
res.status(404);
|
|
81
|
+
if (typeof res.json === 'function')
|
|
82
|
+
return res.json({ error: errorMsg });
|
|
83
|
+
if (typeof res.end === 'function')
|
|
84
|
+
return res.end(errorMsg);
|
|
85
|
+
return { error: errorMsg };
|
|
86
|
+
}
|
|
87
|
+
// 2. Handle POST: Query Processing
|
|
88
|
+
if (method === 'POST') {
|
|
89
|
+
try {
|
|
90
|
+
const body = req.body || {};
|
|
91
|
+
const requestInput = body.query || body;
|
|
92
|
+
const response = await server.handleRequest(requestInput, req);
|
|
93
|
+
const statusCode = getHttpStatusCode(response);
|
|
94
|
+
// 4. New: Auto-Cache Metadata
|
|
95
|
+
if (config.debug && typeof res.setHeader === 'function') {
|
|
96
|
+
const cacheDirective = requestInput.directives?.cache || 0;
|
|
97
|
+
if (cacheDirective > 0) {
|
|
98
|
+
res.setHeader('Cache-Control', `public, max-age=${cacheDirective}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// Trigger real-time hub on successful mutations
|
|
102
|
+
if (requestInput.mutations || (requestInput.batch && requestInput.batch.some((b) => b.type))) {
|
|
103
|
+
hub.emit('mutation', {
|
|
104
|
+
timestamp: Date.now(),
|
|
105
|
+
collection: requestInput.mutations ? Object.keys(requestInput.mutations) : 'batch'
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (typeof res.status === 'function') {
|
|
109
|
+
res.status(statusCode);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
res.statusCode = statusCode;
|
|
113
|
+
}
|
|
114
|
+
if (typeof res.json === 'function')
|
|
115
|
+
return res.json(response);
|
|
116
|
+
return response;
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
const errorResponse = formatError(err, config.debug);
|
|
120
|
+
const statusCode = getHttpStatusCode(errorResponse);
|
|
121
|
+
if (typeof res.status === 'function') {
|
|
122
|
+
res.status(statusCode);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
res.statusCode = statusCode;
|
|
126
|
+
}
|
|
127
|
+
if (typeof res.json === 'function')
|
|
128
|
+
return res.json(errorResponse);
|
|
129
|
+
return errorResponse;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// 3. Method Not Allowed
|
|
133
|
+
if (typeof res.status === 'function')
|
|
134
|
+
res.status(405);
|
|
135
|
+
return { error: 'METHOD_NOT_ALLOWED' };
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,iCAAiC;AACjC,MAAM,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC;AAC/B,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AAQzB;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAuB;IAC1D,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,UAAU,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC3D,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IAEnC,OAAO,KAAK,EAAE,GAAQ,EAAE,GAAQ,EAAE,EAAE;QAClC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC;QAEzC,iBAAiB;QACjB,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,IAAI,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;gBACxC,GAAG,CAAC,SAAS,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;gBAClD,GAAG,CAAC,SAAS,CAAC,8BAA8B,EAAE,oBAAoB,C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,UAAU,EAAE,CAAC;oBACrC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBACzB,CAAC;qBAAM,CAAC;oBACN,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC;gBAC9B,CAAC;gBAED,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU;oBAAE,OAAO,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBACnE,OAAO,aAAa,CAAC;YACvB,CAAC;QACH,CAAC;QAED,wBAAwB;QACxB,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,UAAU;YAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACtD,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC;IACzC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QuickQL Server
|
|
3
|
+
*
|
|
4
|
+
* Performance-first, schema-driven API engine with native relational mapping.
|
|
5
|
+
*
|
|
6
|
+
* (c) 2024-2026 Udinmo Inc. All rights reserved.
|
|
7
|
+
* Author: Udinmo Inc. <engineering@udinmo.com>
|
|
8
|
+
* License: MIT
|
|
9
|
+
*/
|
|
10
|
+
export * from './engine';
|
|
11
|
+
export * from './types';
|
|
12
|
+
export * from './errors';
|
|
13
|
+
export * from './validator';
|
|
14
|
+
export * from './executor';
|
|
15
|
+
export * from './filters';
|
|
16
|
+
export * from './relations';
|
|
17
|
+
export * from './security';
|
|
18
|
+
export * from './handler';
|
|
19
|
+
export * from './parser/types';
|
|
20
|
+
export * from './parser/tokenizer';
|
|
21
|
+
export * from './parser/parser';
|
|
22
|
+
export * from './parser/transformer';
|
|
23
|
+
export * from './schema/builder';
|
|
24
|
+
export type { QuickQLSchema, SchemaOptions, CollectionDefinition, RelationDefinition, FieldDefinition, FieldType, CustomMutation } from './schema/types';
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAG1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,kBAAkB,CAAC;AACjC,YAAY,EACV,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,cAAc,EACf,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QuickQL Server
|
|
3
|
+
*
|
|
4
|
+
* Performance-first, schema-driven API engine with native relational mapping.
|
|
5
|
+
*
|
|
6
|
+
* (c) 2024-2026 Udinmo Inc. All rights reserved.
|
|
7
|
+
* Author: Udinmo Inc. <engineering@udinmo.com>
|
|
8
|
+
* License: MIT
|
|
9
|
+
*/
|
|
10
|
+
export * from './engine';
|
|
11
|
+
export * from './types';
|
|
12
|
+
export * from './errors';
|
|
13
|
+
export * from './validator';
|
|
14
|
+
export * from './executor';
|
|
15
|
+
export * from './filters';
|
|
16
|
+
export * from './relations';
|
|
17
|
+
export * from './security';
|
|
18
|
+
export * from './handler';
|
|
19
|
+
// Parser & Syntax
|
|
20
|
+
export * from './parser/types';
|
|
21
|
+
export * from './parser/tokenizer';
|
|
22
|
+
export * from './parser/parser';
|
|
23
|
+
export * from './parser/transformer';
|
|
24
|
+
// Schema & ORM
|
|
25
|
+
export * from './schema/builder';
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAE1B,kBAAkB;AAClB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AAErC,eAAe;AACf,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QuickQL Syntax Parser
|
|
3
|
+
*
|
|
4
|
+
* Recursive descent parser that transforms token streams into Abstract
|
|
5
|
+
* Syntax Trees (AST) representing QuickQL queries and mutations.
|
|
6
|
+
*
|
|
7
|
+
* (c) 2024-2026 Udinmo Inc. All rights reserved.
|
|
8
|
+
* Author: Udinmo Inc. <engineering@udinmo.com>
|
|
9
|
+
* License: MIT
|
|
10
|
+
*/
|
|
11
|
+
import { Token, ASTNode } from './types';
|
|
12
|
+
export declare class Parser {
|
|
13
|
+
private tokens;
|
|
14
|
+
private cursor;
|
|
15
|
+
constructor(tokens: Token[]);
|
|
16
|
+
private peek;
|
|
17
|
+
private consume;
|
|
18
|
+
parse(): Record<string, ASTNode>;
|
|
19
|
+
private parseNode;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../src/parser/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,EAAa,OAAO,EAAE,MAAM,SAAS,CAAC;AAEpD,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,MAAM,CAAK;gBAEP,MAAM,EAAE,KAAK,EAAE;IAI3B,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,OAAO;IASf,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAShC,OAAO,CAAC,SAAS;CAgElB"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QuickQL Syntax Parser
|
|
3
|
+
*
|
|
4
|
+
* Recursive descent parser that transforms token streams into Abstract
|
|
5
|
+
* Syntax Trees (AST) representing QuickQL queries and mutations.
|
|
6
|
+
*
|
|
7
|
+
* (c) 2024-2026 Udinmo Inc. All rights reserved.
|
|
8
|
+
* Author: Udinmo Inc. <engineering@udinmo.com>
|
|
9
|
+
* License: MIT
|
|
10
|
+
*/
|
|
11
|
+
export class Parser {
|
|
12
|
+
tokens;
|
|
13
|
+
cursor = 0;
|
|
14
|
+
constructor(tokens) {
|
|
15
|
+
this.tokens = tokens;
|
|
16
|
+
}
|
|
17
|
+
peek() {
|
|
18
|
+
return this.tokens[this.cursor];
|
|
19
|
+
}
|
|
20
|
+
consume(type) {
|
|
21
|
+
const token = this.peek();
|
|
22
|
+
if (token.type !== type) {
|
|
23
|
+
throw new Error(`Expected token ${type}, but got ${token.type} ('${token.value}') at position ${this.cursor}`);
|
|
24
|
+
}
|
|
25
|
+
this.cursor++;
|
|
26
|
+
return token;
|
|
27
|
+
}
|
|
28
|
+
parse() {
|
|
29
|
+
const nodes = {};
|
|
30
|
+
while (this.peek().type === 'NAME') {
|
|
31
|
+
const node = this.parseNode();
|
|
32
|
+
nodes[node.alias || node.name] = node;
|
|
33
|
+
}
|
|
34
|
+
return nodes;
|
|
35
|
+
}
|
|
36
|
+
parseNode() {
|
|
37
|
+
let name = this.consume('NAME').value;
|
|
38
|
+
let alias;
|
|
39
|
+
// Support alias: myAlias: myField
|
|
40
|
+
if (this.peek().type === 'COLON') {
|
|
41
|
+
this.consume('COLON');
|
|
42
|
+
alias = name;
|
|
43
|
+
name = this.consume('NAME').value;
|
|
44
|
+
}
|
|
45
|
+
const node = { name, alias };
|
|
46
|
+
// Support arguments: (id: "1", type: "post")
|
|
47
|
+
if (this.peek().type === 'LPAREN') {
|
|
48
|
+
this.consume('LPAREN');
|
|
49
|
+
const args = {};
|
|
50
|
+
while (this.peek().type !== 'RPAREN') {
|
|
51
|
+
const argName = this.consume('NAME').value;
|
|
52
|
+
this.consume('COLON');
|
|
53
|
+
const token = this.peek();
|
|
54
|
+
let value;
|
|
55
|
+
if (token.type === 'STRING') {
|
|
56
|
+
value = this.consume('STRING').value;
|
|
57
|
+
}
|
|
58
|
+
else if (token.type === 'NUMBER') {
|
|
59
|
+
value = Number(this.consume('NUMBER').value);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
throw new Error('Unsupported argument value type');
|
|
63
|
+
}
|
|
64
|
+
args[argName] = value;
|
|
65
|
+
if (this.peek().type === 'COMMA')
|
|
66
|
+
this.consume('COMMA'); // Optional commas
|
|
67
|
+
}
|
|
68
|
+
this.consume('RPAREN');
|
|
69
|
+
node.arguments = args;
|
|
70
|
+
}
|
|
71
|
+
// Support selection set: { id name posts { title } }
|
|
72
|
+
if (this.peek().type === 'LBRACE') {
|
|
73
|
+
this.consume('LBRACE');
|
|
74
|
+
const fields = [];
|
|
75
|
+
while (this.peek().type !== 'RBRACE') {
|
|
76
|
+
const fieldName = this.peek().value;
|
|
77
|
+
// Check if it has a selection set or arguments → it's a nested node
|
|
78
|
+
const nextToken = this.tokens[this.cursor + 1];
|
|
79
|
+
// Advanced lookahead for nested nodes or aliases
|
|
80
|
+
const isNested = nextToken && (nextToken.type === 'LBRACE' || nextToken.type === 'LPAREN' || nextToken.type === 'COLON');
|
|
81
|
+
if (isNested) {
|
|
82
|
+
fields.push(this.parseNode());
|
|
83
|
+
}
|
|
84
|
+
else if (this.peek().type === 'STAR') {
|
|
85
|
+
this.consume('STAR');
|
|
86
|
+
fields.push('*');
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
this.consume('NAME');
|
|
90
|
+
fields.push(this.tokens[this.cursor - 1].value);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
this.consume('RBRACE');
|
|
94
|
+
node.fields = fields;
|
|
95
|
+
}
|
|
96
|
+
return node;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../src/parser/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,OAAO,MAAM;IACT,MAAM,CAAU;IAChB,MAAM,GAAG,CAAC,CAAC;IAEnB,YAAY,MAAe;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEO,IAAI;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAEO,OAAO,CAAC,IAAe;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC1B,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,aAAa,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,KAAK,kBAAkB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACjH,CAAC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK;QACH,MAAM,KAAK,GAA4B,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACnC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;YAC9B,KA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;oBACvC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;oBACrB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACnB,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;oBACrB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;gBAClD,CAAC;YACH,CAAC;YACD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QuickQL Lexer (Tokenizer)
|
|
3
|
+
*
|
|
4
|
+
* Scans raw QuickQL string input and produces a stream of tokens
|
|
5
|
+
* for the syntax parser.
|
|
6
|
+
*
|
|
7
|
+
* (c) 2024-2026 Udinmo Inc. All rights reserved.
|
|
8
|
+
* Author: Udinmo Inc. <engineering@udinmo.com>
|
|
9
|
+
* License: MIT
|
|
10
|
+
*/
|
|
11
|
+
import { Token } from './types';
|
|
12
|
+
export declare class Tokenizer {
|
|
13
|
+
private input;
|
|
14
|
+
private cursor;
|
|
15
|
+
constructor(input: string);
|
|
16
|
+
tokenize(): Token[];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=tokenizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenizer.d.ts","sourceRoot":"","sources":["../../../../src/parser/tokenizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,EAAa,MAAM,SAAS,CAAC;AAE3C,qBAAa,SAAS;IACpB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAK;gBAEP,KAAK,EAAE,MAAM;IAIzB,QAAQ,IAAI,KAAK,EAAE;CAmFpB"}
|