flowquery 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +141 -37
- package/dist/flowquery.min.js +1 -1
- package/dist/parsing/functions/function_metadata.d.ts +3 -3
- package/dist/parsing/functions/function_metadata.d.ts.map +1 -1
- package/dist/parsing/functions/function_metadata.js +6 -12
- package/dist/parsing/functions/function_metadata.js.map +1 -1
- package/docs/flowquery.min.js +1 -1
- package/flowquery-vscode/flowQueryEngine/flowquery.min.js +1 -1
- package/misc/apps/RAG/README.md +0 -12
- package/misc/apps/RAG/package.json +1 -1
- package/package.json +1 -1
- package/src/parsing/functions/function_metadata.ts +6 -13
- package/tests/extensibility.test.ts +42 -4
|
@@ -216,7 +216,7 @@ describe("FunctionDef Decorator", () => {
|
|
|
216
216
|
],
|
|
217
217
|
output: { description: "Data object", type: "object" }
|
|
218
218
|
})
|
|
219
|
-
class
|
|
219
|
+
class Simple {
|
|
220
220
|
async *fetch(count: number = 1): AsyncGenerator<any> {
|
|
221
221
|
for (let i = 0; i < count; i++) {
|
|
222
222
|
yield { id: i, data: `item${i}` };
|
|
@@ -225,7 +225,7 @@ describe("FunctionDef Decorator", () => {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
// Verify the decorated class still works correctly
|
|
228
|
-
const loader = new
|
|
228
|
+
const loader = new Simple();
|
|
229
229
|
const results: any[] = [];
|
|
230
230
|
for await (const item of loader.fetch(2)) {
|
|
231
231
|
results.push(item);
|
|
@@ -242,7 +242,7 @@ describe("FunctionDef Decorator", () => {
|
|
|
242
242
|
// Verify the metadata was registered
|
|
243
243
|
const metadata = getFunctionMetadata("simple");
|
|
244
244
|
expect(metadata).toBeDefined();
|
|
245
|
-
expect(metadata?.name).toBe("
|
|
245
|
+
expect(metadata?.name).toBe("Simple");
|
|
246
246
|
expect(metadata?.category).toBe("async");
|
|
247
247
|
expect(metadata?.description).toBe("Test async provider for extensibility");
|
|
248
248
|
});
|
|
@@ -542,7 +542,7 @@ describe("Plugin Functions Integration with FlowQuery", () => {
|
|
|
542
542
|
parameters: [],
|
|
543
543
|
output: { description: "Example data object", type: "object" }
|
|
544
544
|
})
|
|
545
|
-
class
|
|
545
|
+
class GetExampleData {
|
|
546
546
|
async *fetch(): AsyncGenerator<any> {
|
|
547
547
|
yield { id: 1, name: "Alice" };
|
|
548
548
|
yield { id: 2, name: "Bob" };
|
|
@@ -561,6 +561,44 @@ describe("Plugin Functions Integration with FlowQuery", () => {
|
|
|
561
561
|
expect(runner.results[1]).toEqual({ id: 2, name: "Bob" });
|
|
562
562
|
});
|
|
563
563
|
|
|
564
|
+
test("Function names are case-insensitive", async () => {
|
|
565
|
+
@FunctionDef({
|
|
566
|
+
description: "Test function for case insensitivity",
|
|
567
|
+
category: "async",
|
|
568
|
+
parameters: [],
|
|
569
|
+
output: { description: "Test data", type: "object" }
|
|
570
|
+
})
|
|
571
|
+
class MixedCaseFunc {
|
|
572
|
+
async *fetch(): AsyncGenerator<any> {
|
|
573
|
+
yield { value: 42 };
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// Verify registration works with different casings
|
|
578
|
+
expect(getRegisteredAsyncProvider("MixedCaseFunc")).toBeDefined();
|
|
579
|
+
expect(getRegisteredAsyncProvider("mixedcasefunc")).toBeDefined();
|
|
580
|
+
expect(getRegisteredAsyncProvider("MIXEDCASEFUNC")).toBeDefined();
|
|
581
|
+
expect(getRegisteredAsyncProvider("mIxEdCaSeFuNc")).toBeDefined();
|
|
582
|
+
|
|
583
|
+
// Verify metadata lookup is case-insensitive
|
|
584
|
+
expect(getFunctionMetadata("MixedCaseFunc")).toBeDefined();
|
|
585
|
+
expect(getFunctionMetadata("mixedcasefunc")).toBeDefined();
|
|
586
|
+
expect(getFunctionMetadata("MIXEDCASEFUNC")).toBeDefined();
|
|
587
|
+
|
|
588
|
+
// Test using different casings in FlowQuery statements
|
|
589
|
+
const runner1 = new Runner("LOAD JSON FROM mixedcasefunc() AS d RETURN d.value AS v");
|
|
590
|
+
await runner1.run();
|
|
591
|
+
expect(runner1.results[0]).toEqual({ v: 42 });
|
|
592
|
+
|
|
593
|
+
const runner2 = new Runner("LOAD JSON FROM MIXEDCASEFUNC() AS d RETURN d.value AS v");
|
|
594
|
+
await runner2.run();
|
|
595
|
+
expect(runner2.results[0]).toEqual({ v: 42 });
|
|
596
|
+
|
|
597
|
+
const runner3 = new Runner("LOAD JSON FROM MixedCaseFunc() AS d RETURN d.value AS v");
|
|
598
|
+
await runner3.run();
|
|
599
|
+
expect(runner3.results[0]).toEqual({ v: 42 });
|
|
600
|
+
});
|
|
601
|
+
|
|
564
602
|
test("Custom function can be retrieved via functions() in a FlowQuery statement", async () => {
|
|
565
603
|
@FunctionDef({
|
|
566
604
|
description: "A unique test function for introspection",
|