@routier/core 0.7.0 → 0.8.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.
Files changed (47) hide show
  1. package/dist/codegen/blocks.d.ts +17 -1
  2. package/dist/codegen/handlers/types.d.ts +13 -5
  3. package/dist/codegen/index.cjs +28 -0
  4. package/dist/codegen/index.cjs.map +1 -1
  5. package/dist/codegen/index.js +28 -0
  6. package/dist/codegen/index.js.map +1 -1
  7. package/dist/collections/MemoryDataCollection.d.ts +2 -4
  8. package/dist/collections/index.cjs +127 -15
  9. package/dist/collections/index.cjs.map +1 -1
  10. package/dist/collections/index.js +127 -15
  11. package/dist/collections/index.js.map +1 -1
  12. package/dist/expressions/index.cjs +226 -4
  13. package/dist/expressions/index.cjs.map +1 -1
  14. package/dist/expressions/index.js +228 -5
  15. package/dist/expressions/index.js.map +1 -1
  16. package/dist/expressions/parser.d.ts +42 -1
  17. package/dist/index.cjs +753 -345
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.js +756 -345
  20. package/dist/index.js.map +1 -1
  21. package/dist/plugins/EphemeralDataPlugin.d.ts +8 -0
  22. package/dist/plugins/index.cjs +566 -49
  23. package/dist/plugins/index.cjs.map +1 -1
  24. package/dist/plugins/index.js +566 -48
  25. package/dist/plugins/index.js.map +1 -1
  26. package/dist/plugins/query/QueryOptionsCollection.d.ts +15 -5
  27. package/dist/plugins/query/index.d.ts +1 -0
  28. package/dist/plugins/query/renames.d.ts +27 -0
  29. package/dist/plugins/query/types.d.ts +15 -1
  30. package/dist/plugins/translators/SqlTranslator.d.ts +15 -0
  31. package/dist/schema/SchemaDefinition.d.ts +8 -0
  32. package/dist/schema/changeTracker.d.ts +10 -0
  33. package/dist/schema/index.cjs +291 -274
  34. package/dist/schema/index.cjs.map +1 -1
  35. package/dist/schema/index.d.ts +1 -0
  36. package/dist/schema/index.js +294 -276
  37. package/dist/schema/index.js.map +1 -1
  38. package/dist/schema/types.d.ts +8 -7
  39. package/dist/schema/utils/storageDates.d.ts +25 -0
  40. package/dist/transfer/index.cjs.map +1 -1
  41. package/dist/transfer/index.js.map +1 -1
  42. package/dist/utilities/index.cjs +74 -29
  43. package/dist/utilities/index.cjs.map +1 -1
  44. package/dist/utilities/index.js +74 -29
  45. package/dist/utilities/index.js.map +1 -1
  46. package/package.json +2 -2
  47. package/dist/codegen/utils.d.ts +0 -22
@@ -1,4 +1,4 @@
1
- import { CompiledSchema } from "../schema";
1
+ import { CompiledSchema, PropertyInfo } from "../schema";
2
2
  import { Expression, Filter, ParamsFilter } from "./types";
3
3
  export declare const combineExpressions: (...expressions: Expression[]) => Expression;
4
4
  /**
@@ -21,3 +21,44 @@ export declare const combineExpressions: (...expressions: Expression[]) => Expre
21
21
  */
22
22
  export declare const parseFragment: (schema: CompiledSchema<any>, body: string, rootName: string) => Expression;
23
23
  export declare const toExpression: <T extends any, P extends any>(schema: CompiledSchema<any>, fn: Filter<T> | ParamsFilter<T, P>, params?: P) => Expression;
24
+ /** What one value a sort, map, group or `nearest` selector returns is read from. */
25
+ export type SelectedValue = {
26
+ /** The schema property the value is read from, when it reads exactly one. */
27
+ property: PropertyInfo<any> | null;
28
+ /** Every schema property the value is read from, at any depth of the schema. */
29
+ reads: PropertyInfo<any>[];
30
+ /**
31
+ * Whether the value is `property` itself. `false` for anything computed from it: a call, arithmetic,
32
+ * `.length`, or a member of a value that is not a property.
33
+ */
34
+ isDirectProperty: boolean;
35
+ };
36
+ export type ParsedSelector = {
37
+ kind: "value";
38
+ value: SelectedValue;
39
+ } | {
40
+ kind: "object";
41
+ fields: (SelectedValue & {
42
+ name: string;
43
+ })[];
44
+ } | {
45
+ kind: "not-parsable";
46
+ reason: string;
47
+ };
48
+ /**
49
+ * Reads a sort, map, group or `nearest` selector with the grammar filters use, for what its value is
50
+ * read from.
51
+ *
52
+ * Not for evaluating it: the caller's function stays the value, and nothing here renders one. A plugin
53
+ * decides from the result whether it can run the option. One that orders or projects by column cannot
54
+ * run a value that is not the property itself, and one that runs the function over stored rows cannot
55
+ * run it over a renamed property.
56
+ *
57
+ * So the grammar is wider here than for a filter. A call it has no node for, such as `getFullYear()`,
58
+ * is kept for the operands it reads rather than refused, since the function it came from still runs.
59
+ *
60
+ * `not-parsable` is not logged. The option runs as it did before the selector was parsed.
61
+ *
62
+ * Cached by function source per schema, like `toExpression`. The result is shared, so it is read-only.
63
+ */
64
+ export declare const parseSelector: (schema: CompiledSchema<any>, selector: (...args: any[]) => unknown) => ParsedSelector;