flowquery 1.0.6 → 1.0.8

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.
Files changed (49) hide show
  1. package/README.md +30 -138
  2. package/dist/compute/runner.d.ts +1 -22
  3. package/dist/compute/runner.d.ts.map +1 -1
  4. package/dist/compute/runner.js.map +1 -1
  5. package/dist/extensibility.d.ts +28 -2
  6. package/dist/extensibility.d.ts.map +1 -1
  7. package/dist/extensibility.js +39 -15
  8. package/dist/extensibility.js.map +1 -1
  9. package/dist/flowquery.min.js +1 -1
  10. package/dist/index.browser.d.ts.map +1 -1
  11. package/dist/index.browser.js +0 -80
  12. package/dist/index.browser.js.map +1 -1
  13. package/dist/index.node.d.ts +3 -3
  14. package/dist/index.node.d.ts.map +1 -1
  15. package/dist/index.node.js +0 -80
  16. package/dist/index.node.js.map +1 -1
  17. package/dist/parsing/functions/function_factory.d.ts +3 -80
  18. package/dist/parsing/functions/function_factory.d.ts.map +1 -1
  19. package/dist/parsing/functions/function_factory.js +8 -127
  20. package/dist/parsing/functions/function_factory.js.map +1 -1
  21. package/dist/parsing/functions/function_metadata.d.ts +28 -35
  22. package/dist/parsing/functions/function_metadata.d.ts.map +1 -1
  23. package/dist/parsing/functions/function_metadata.js +88 -61
  24. package/dist/parsing/functions/function_metadata.js.map +1 -1
  25. package/docs/flowquery.min.js +1 -1
  26. package/flowquery-vscode/flowQueryEngine/flowquery.min.js +1 -1
  27. package/misc/apps/RAG/package.json +1 -1
  28. package/misc/apps/RAG/src/plugins/index.ts +29 -33
  29. package/misc/apps/RAG/src/plugins/loaders/CatFacts.ts +28 -32
  30. package/misc/apps/RAG/src/plugins/loaders/FetchJson.ts +29 -33
  31. package/misc/apps/RAG/src/plugins/loaders/Llm.ts +55 -59
  32. package/misc/apps/RAG/src/plugins/loaders/MockData.ts +61 -71
  33. package/misc/apps/RAG/src/prompts/FlowQuerySystemPrompt.ts +8 -8
  34. package/package.json +1 -1
  35. package/src/compute/runner.ts +1 -26
  36. package/src/extensibility.ts +38 -2
  37. package/src/index.browser.ts +2 -88
  38. package/src/index.node.ts +3 -92
  39. package/src/parsing/functions/function_factory.ts +13 -154
  40. package/src/parsing/functions/function_metadata.ts +96 -94
  41. package/tests/extensibility.test.ts +601 -0
  42. package/dist/parsing/functions/extensibility/index.d.ts +0 -37
  43. package/dist/parsing/functions/extensibility/index.d.ts.map +0 -1
  44. package/dist/parsing/functions/extensibility/index.js +0 -50
  45. package/dist/parsing/functions/extensibility/index.js.map +0 -1
  46. package/misc/apps/RAG/src/plugins/PluginRegistry.ts +0 -136
  47. package/misc/apps/RAG/src/plugins/types.ts +0 -52
  48. package/src/parsing/functions/extensibility/index.ts +0 -54
  49. package/tests/parsing/function_plugins.test.ts +0 -369
package/README.md CHANGED
@@ -145,68 +145,7 @@ return data
145
145
 
146
146
  ## Extending FlowQuery with Custom Functions
147
147
 
148
- FlowQuery provides a plugin system that allows you to register custom functions. You can create scalar functions for synchronous operations or async providers for data loading.
149
-
150
- ### Creating a Custom Scalar Function
151
-
152
- To create a custom function, extend the `Function` base class and register it with FlowQuery:
153
-
154
- ```javascript
155
- const FlowQuery = require('flowquery').default;
156
- const { Function } = require('flowquery');
157
-
158
- // Create a custom function class
159
- class UpperCase extends Function {
160
- constructor() {
161
- super("uppercase"); // Function name used in queries
162
- this._expectedParameterCount = 1; // Number of required parameters
163
- }
164
-
165
- // Implement the value() method to define the function's behavior
166
- value() {
167
- const input = this.getChildren()[0].value(); // Get first parameter
168
- return String(input).toUpperCase();
169
- }
170
- }
171
-
172
- // Register the function with FlowQuery
173
- FlowQuery.registerFunction("uppercase", () => new UpperCase());
174
-
175
- // Now use it in queries!
176
- async function main() {
177
- const query = new FlowQuery("WITH 'hello world' AS greeting RETURN uppercase(greeting)");
178
- await query.run();
179
- console.log(query.results); // [ { expr0: 'HELLO WORLD' } ]
180
- }
181
- ```
182
-
183
- ### Registering Functions with Metadata
184
-
185
- For better documentation and LLM integration, you can register functions with full metadata using the `@FunctionDef` decorator pattern:
186
-
187
- ```javascript
188
- FlowQuery.registerFunction("uppercase", {
189
- factory: () => new UpperCase(),
190
- metadata: {
191
- name: "uppercase",
192
- description: "Converts a string to uppercase",
193
- category: "string",
194
- parameters: [
195
- { name: "text", description: "String to convert", type: "string" }
196
- ],
197
- output: {
198
- description: "Uppercase string",
199
- type: "string",
200
- example: "HELLO WORLD"
201
- },
202
- examples: ["WITH 'hello' AS s RETURN uppercase(s)"]
203
- }
204
- });
205
- ```
206
-
207
- ### TypeScript: Using the @FunctionDef Decorator
208
-
209
- In TypeScript projects, you can use the `@FunctionDef` decorator directly on your function class. Import from the extensibility module for a clean API:
148
+ FlowQuery provides a plugin system that allows you to register custom functions using the `@FunctionDef` decorator. Import from the extensibility module for a clean API:
210
149
 
211
150
  ```typescript
212
151
  import { Function, FunctionDef } from "flowquery/extensibility";
@@ -226,8 +165,8 @@ import { Function, FunctionDef } from "flowquery/extensibility";
226
165
  })
227
166
  class UpperCase extends Function {
228
167
  constructor() {
229
- super("uppercase");
230
- this._expectedParameterCount = 1;
168
+ super("uppercase"); // Function name used in queries
169
+ this._expectedParameterCount = 1; // Number of required parameters
231
170
  }
232
171
 
233
172
  public value(): string {
@@ -239,91 +178,44 @@ class UpperCase extends Function {
239
178
 
240
179
  The decorator automatically registers the function with the FlowQuery function factory.
241
180
 
242
- The extensibility module (`flowquery/extensibility`) exports:
243
- - `Function` - Base class for scalar functions
244
- - `AggregateFunction` - Base class for aggregate functions (like `sum`, `avg`, `collect`)
245
- - `PredicateFunction` - Base class for predicate functions (like list comprehensions)
246
- - `FunctionDef` - Decorator for registering functions with metadata
247
- - `ReducerElement` - Helper class for aggregate function state
248
- - `FunctionFactory` - Direct access to the function factory for advanced usage
249
-
250
181
  ### Creating Async Data Providers
251
182
 
252
- For functions that fetch data asynchronously (used with `LOAD ... FROM`), register an async provider:
183
+ For functions that fetch data asynchronously (used with `LOAD JSON FROM`), use the `@FunctionDef` decorator with `category: "async"`. The class must have a `fetch` method that returns an async generator:
253
184
 
254
- ```javascript
255
- FlowQuery.registerAsyncProvider("fetchUsers", {
256
- provider: async function* (endpoint) {
257
- const response = await fetch(endpoint);
258
- const data = await response.json();
259
- for (const user of data) {
260
- yield user; // Yield each item individually
261
- }
262
- },
263
- metadata: {
264
- name: "fetchUsers",
265
- description: "Fetches user data from an API endpoint",
266
- category: "data",
267
- parameters: [
268
- { name: "endpoint", description: "API URL to fetch users from", type: "string" }
269
- ],
270
- output: {
271
- description: "User object",
272
- type: "object",
273
- properties: {
274
- id: { description: "User ID", type: "number" },
275
- name: { description: "User name", type: "string" }
276
- }
277
- },
278
- examples: ["LOAD JSON FROM fetchUsers('https://api.example.com/users') AS user"]
279
- }
280
- });
185
+ ```typescript
186
+ import { FunctionDef } from "flowquery/extensibility";
281
187
 
282
- // Use in a query
283
- const query = new FlowQuery(`
284
- LOAD JSON FROM fetchUsers('https://api.example.com/users') AS user
285
- RETURN user.name, user.id
286
- `);
287
- await query.run();
188
+ @FunctionDef({
189
+ description: "Provides example data for testing",
190
+ category: "async",
191
+ parameters: [],
192
+ output: { description: "Example data object", type: "object" }
193
+ })
194
+ class GetExampleDataLoader {
195
+ async *fetch(): AsyncGenerator<any> {
196
+ yield { id: 1, name: "Alice" };
197
+ yield { id: 2, name: "Bob" };
198
+ }
199
+ }
288
200
  ```
289
201
 
290
- ### Listing and Querying Functions
291
-
292
- You can discover available functions programmatically:
202
+ The function name is derived from the class name by removing the `Loader` suffix (if present) and converting to camelCase. In this example, `GetExampleDataLoader` becomes `getExampleData`.
293
203
 
294
- ```javascript
295
- // List all functions
296
- const allFunctions = FlowQuery.listFunctions();
297
-
298
- // Filter by category
299
- const stringFunctions = FlowQuery.listFunctions({ category: "string" });
300
- const asyncFunctions = FlowQuery.listFunctions({ asyncOnly: true });
301
-
302
- // Get metadata for a specific function
303
- const sumMetadata = FlowQuery.getFunctionMetadata("sum");
304
- console.log(sumMetadata.description); // "Calculates the sum of numeric values..."
305
- ```
306
-
307
- You can also query functions from within FlowQuery itself:
204
+ Use the async provider in a FlowQuery statement:
308
205
 
309
206
  ```cypher
310
- // List all available functions
311
- WITH functions() AS funcs
312
- UNWIND funcs AS f
313
- RETURN f.name, f.description, f.category
207
+ LOAD JSON FROM getExampleData() AS data
208
+ RETURN data.id AS id, data.name AS name
314
209
  ```
315
210
 
316
- ### Unregistering Functions
317
-
318
- To remove a registered function:
319
-
320
- ```javascript
321
- // Unregister a sync function
322
- FlowQuery.unregisterFunction("uppercase");
323
-
324
- // Unregister an async provider
325
- FlowQuery.unregisterAsyncProvider("fetchUsers");
326
- ```
211
+ The extensibility module (`flowquery/extensibility`) exports:
212
+ - `Function` - Base class for scalar functions
213
+ - `AggregateFunction` - Base class for aggregate functions (like `sum`, `avg`, `collect`)
214
+ - `AsyncFunction` - Base class for async function calls
215
+ - `PredicateFunction` - Base class for predicate functions (like list comprehensions)
216
+ - `ReducerElement` - Helper class for aggregate function state
217
+ - `FunctionDef` - Decorator for registering functions with metadata
218
+ - `FunctionMetadata`, `FunctionDefOptions`, `ParameterSchema`, `OutputSchema`, `FunctionCategory` - TypeScript types for metadata definitions
327
219
 
328
220
  ## Contributing
329
221
 
@@ -1,5 +1,4 @@
1
- import { FunctionCreator, AsyncDataProvider } from "../parsing/functions/function_factory";
2
- import { FunctionMetadata, RegisterFunctionOptions, RegisterAsyncProviderOptions } from "../parsing/functions/function_metadata";
1
+ import { FunctionMetadata } from "../parsing/functions/function_metadata";
3
2
  import Function from "../parsing/functions/function";
4
3
  /**
5
4
  * Executes a FlowQuery statement and retrieves the results.
@@ -17,26 +16,6 @@ import Function from "../parsing/functions/function";
17
16
  declare class Runner {
18
17
  private first;
19
18
  private last;
20
- /**
21
- * Register a synchronous plugin function.
22
- * Added dynamically in index.browser.ts / index.node.ts
23
- */
24
- static registerFunction: (name: string, factoryOrOptions: FunctionCreator | RegisterFunctionOptions) => void;
25
- /**
26
- * Unregister a synchronous plugin function.
27
- * Added dynamically in index.browser.ts / index.node.ts
28
- */
29
- static unregisterFunction: (name: string) => void;
30
- /**
31
- * Register an async data provider function for use in LOAD operations.
32
- * Added dynamically in index.browser.ts / index.node.ts
33
- */
34
- static registerAsyncProvider: (name: string, providerOrOptions: AsyncDataProvider | RegisterAsyncProviderOptions) => void;
35
- /**
36
- * Unregister an async data provider function.
37
- * Added dynamically in index.browser.ts / index.node.ts
38
- */
39
- static unregisterAsyncProvider: (name: string) => void;
40
19
  /**
41
20
  * List all registered functions with their metadata.
42
21
  * Added dynamically in index.browser.ts / index.node.ts
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/compute/runner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACjI,OAAO,QAAQ,MAAM,+BAA+B,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,cAAM,MAAM;IACR,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,IAAI,CAAY;IAExB;;;OAGG;IACH,MAAM,CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,eAAe,GAAG,uBAAuB,KAAK,IAAI,CAAC;IAE7G;;;OAGG;IACH,MAAM,CAAC,kBAAkB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAElD;;;OAGG;IACH,MAAM,CAAC,qBAAqB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,4BAA4B,KAAK,IAAI,CAAC;IAE1H;;;OAGG;IACH,MAAM,CAAC,uBAAuB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEvD;;;OAGG;IACH,MAAM,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,gBAAgB,EAAE,CAAC;IAEvH;;;OAGG;IACH,MAAM,CAAC,mBAAmB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,gBAAgB,GAAG,SAAS,CAAC;IAE3E;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAEjC;;;;;OAKG;gBACS,SAAS,GAAE,MAAM,GAAG,IAAW;IAU3C;;;;;OAKG;IACU,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAYjC;;;;OAIG;IACH,IAAW,OAAO,IAAI,GAAG,CAExB;CACJ;AAED,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/compute/runner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,QAAQ,MAAM,+BAA+B,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,cAAM,MAAM;IACR,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,IAAI,CAAY;IAExB;;;OAGG;IACH,MAAM,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,gBAAgB,EAAE,CAAC;IAEvH;;;OAGG;IACH,MAAM,CAAC,mBAAmB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,gBAAgB,GAAG,SAAS,CAAC;IAE3E;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAEjC;;;;;OAKG;gBACS,SAAS,GAAE,MAAM,GAAG,IAAW;IAU3C;;;;;OAKG;IACU,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAYjC;;;;OAIG;IACH,IAAW,OAAO,IAAI,GAAG,CAExB;CACJ;AAED,eAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/compute/runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,+DAAuC;AAKvC;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM;IA8CR;;;;;OAKG;IACH,YAAY,YAA2B,IAAI;QACvC,IAAG,SAAS,KAAK,IAAI,IAAI,SAAS,KAAK,EAAE,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,gBAAM,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,UAAU,EAAe,CAAC;QAC3C,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,SAAS,EAAe,CAAC;IAC7C,CAAC;IAED;;;;;OAKG;IACU,GAAG;;YACZ,OAAO,IAAI,OAAO,CAAO,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC/C,IAAI,CAAC;oBACD,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;oBACvB,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;oBAC1B,OAAO,EAAE,CAAC;gBACd,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACT,MAAM,CAAC,CAAC,CAAC,CAAC;gBACd,CAAC;YACL,CAAC,CAAA,CAAC,CAAC;QACP,CAAC;KAAA;IAED;;;;OAIG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IAC7B,CAAC;CACJ;AAED,kBAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/compute/runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,+DAAuC;AAIvC;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM;IAsBR;;;;;OAKG;IACH,YAAY,YAA2B,IAAI;QACvC,IAAG,SAAS,KAAK,IAAI,IAAI,SAAS,KAAK,EAAE,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,gBAAM,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,UAAU,EAAe,CAAC;QAC3C,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,SAAS,EAAe,CAAC;IAC7C,CAAC;IAED;;;;;OAKG;IACU,GAAG;;YACZ,OAAO,IAAI,OAAO,CAAO,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC/C,IAAI,CAAC;oBACD,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;oBACvB,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;oBAC1B,OAAO,EAAE,CAAC;gBACd,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACT,MAAM,CAAC,CAAC,CAAC,CAAC;gBACd,CAAC;YACL,CAAC,CAAA,CAAC,CAAC;QACP,CAAC;KAAA;IAED;;;;OAIG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IAC7B,CAAC;CACJ;AAED,kBAAe,MAAM,CAAC"}
@@ -1,9 +1,35 @@
1
1
  /**
2
2
  * FlowQuery Extensibility API
3
3
  *
4
- * This module re-exports the extensibility API from the parsing/functions/extensibility module.
4
+ * This module provides all the exports needed to create custom FlowQuery functions.
5
5
  *
6
6
  * @packageDocumentation
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { Function, FunctionDef } from 'flowquery/extensibility';
11
+ *
12
+ * @FunctionDef({
13
+ * description: "Converts a string to uppercase",
14
+ * category: "string",
15
+ * parameters: [{ name: "text", description: "String to convert", type: "string" }],
16
+ * output: { description: "Uppercase string", type: "string" }
17
+ * })
18
+ * class UpperCase extends Function {
19
+ * constructor() {
20
+ * super("uppercase");
21
+ * this._expectedParameterCount = 1;
22
+ * }
23
+ * public value(): string {
24
+ * return String(this.getChildren()[0].value()).toUpperCase();
25
+ * }
26
+ * }
27
+ * ```
7
28
  */
8
- export * from "./parsing/functions/extensibility";
29
+ export { default as Function } from "./parsing/functions/function";
30
+ export { default as AggregateFunction } from "./parsing/functions/aggregate_function";
31
+ export { default as AsyncFunction } from "./parsing/functions/async_function";
32
+ export { default as PredicateFunction } from "./parsing/functions/predicate_function";
33
+ export { default as ReducerElement } from "./parsing/functions/reducer_element";
34
+ export { FunctionDef, FunctionMetadata, FunctionDefOptions, ParameterSchema, OutputSchema, FunctionCategory } from "./parsing/functions/function_metadata";
9
35
  //# sourceMappingURL=extensibility.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extensibility.d.ts","sourceRoot":"","sources":["../src/extensibility.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,mCAAmC,CAAC"}
1
+ {"version":3,"file":"extensibility.d.ts","sourceRoot":"","sources":["../src/extensibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAGhF,OAAO,EACH,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,gBAAgB,EACnB,MAAM,uCAAuC,CAAC"}
@@ -2,24 +2,48 @@
2
2
  /**
3
3
  * FlowQuery Extensibility API
4
4
  *
5
- * This module re-exports the extensibility API from the parsing/functions/extensibility module.
5
+ * This module provides all the exports needed to create custom FlowQuery functions.
6
6
  *
7
7
  * @packageDocumentation
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { Function, FunctionDef } from 'flowquery/extensibility';
12
+ *
13
+ * @FunctionDef({
14
+ * description: "Converts a string to uppercase",
15
+ * category: "string",
16
+ * parameters: [{ name: "text", description: "String to convert", type: "string" }],
17
+ * output: { description: "Uppercase string", type: "string" }
18
+ * })
19
+ * class UpperCase extends Function {
20
+ * constructor() {
21
+ * super("uppercase");
22
+ * this._expectedParameterCount = 1;
23
+ * }
24
+ * public value(): string {
25
+ * return String(this.getChildren()[0].value()).toUpperCase();
26
+ * }
27
+ * }
28
+ * ```
8
29
  */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
32
  };
23
33
  Object.defineProperty(exports, "__esModule", { value: true });
24
- __exportStar(require("./parsing/functions/extensibility"), exports);
34
+ exports.FunctionDef = exports.ReducerElement = exports.PredicateFunction = exports.AsyncFunction = exports.AggregateFunction = exports.Function = void 0;
35
+ // Base function classes for creating custom functions
36
+ var function_1 = require("./parsing/functions/function");
37
+ Object.defineProperty(exports, "Function", { enumerable: true, get: function () { return __importDefault(function_1).default; } });
38
+ var aggregate_function_1 = require("./parsing/functions/aggregate_function");
39
+ Object.defineProperty(exports, "AggregateFunction", { enumerable: true, get: function () { return __importDefault(aggregate_function_1).default; } });
40
+ var async_function_1 = require("./parsing/functions/async_function");
41
+ Object.defineProperty(exports, "AsyncFunction", { enumerable: true, get: function () { return __importDefault(async_function_1).default; } });
42
+ var predicate_function_1 = require("./parsing/functions/predicate_function");
43
+ Object.defineProperty(exports, "PredicateFunction", { enumerable: true, get: function () { return __importDefault(predicate_function_1).default; } });
44
+ var reducer_element_1 = require("./parsing/functions/reducer_element");
45
+ Object.defineProperty(exports, "ReducerElement", { enumerable: true, get: function () { return __importDefault(reducer_element_1).default; } });
46
+ // Decorator and metadata types for function registration
47
+ var function_metadata_1 = require("./parsing/functions/function_metadata");
48
+ Object.defineProperty(exports, "FunctionDef", { enumerable: true, get: function () { return function_metadata_1.FunctionDef; } });
25
49
  //# sourceMappingURL=extensibility.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"extensibility.js","sourceRoot":"","sources":["../src/extensibility.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;AAEH,oEAAkD"}
1
+ {"version":3,"file":"extensibility.js","sourceRoot":"","sources":["../src/extensibility.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;;;;AAEH,sDAAsD;AACtD,yDAAmE;AAA1D,qHAAA,OAAO,OAAY;AAC5B,6EAAsF;AAA7E,wIAAA,OAAO,OAAqB;AACrC,qEAA8E;AAArE,gIAAA,OAAO,OAAiB;AACjC,6EAAsF;AAA7E,wIAAA,OAAO,OAAqB;AACrC,uEAAgF;AAAvE,kIAAA,OAAO,OAAkB;AAElC,yDAAyD;AACzD,2EAO+C;AAN3C,gHAAA,WAAW,OAAA"}