@fibery/expression-utils 15.0.0 → 16.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.
@@ -0,0 +1,6 @@
1
+ import { Select } from "./types.js";
2
+ //#region src/select.test-d.d.ts
3
+ declare const nestedProjection: Select;
4
+ declare const invalidProjection: Select;
5
+ //#endregion
6
+ export { invalidProjection, nestedProjection };
@@ -0,0 +1,15 @@
1
+ //#region src/select.test-d.ts
2
+ const nestedProjection = { tasks: {
3
+ "q/from": ["tasks"],
4
+ "q/limit": 10,
5
+ "q/select": { owner: {
6
+ "fibery/id": ["owner", "fibery/id"],
7
+ avatar: {
8
+ "q/from": ["owner", "avatar"],
9
+ "q/select": { name: ["name"] }
10
+ }
11
+ } }
12
+ } };
13
+ const invalidProjection = { invalid: true };
14
+ //#endregion
15
+ export { invalidProjection, nestedProjection };
package/lib/types.d.ts CHANGED
@@ -15,7 +15,13 @@ type FromRootExpression = ["q/from-root", ...FieldExpression[]];
15
15
  type Expression = string | Expression[] | FieldExpression | FunctionCallExpression | FromRootExpression;
16
16
  type OrderBy = Array<[Expression, string] | [Expression, string, string]>;
17
17
  type QueryLimit = number | "q/no-limit";
18
- type Select = Record<string, Expression | Record<string, Expression>>;
18
+ type Select = {
19
+ [field: string]: Expression | SubQuery | Select;
20
+ };
21
+ declare const projected: unique symbol;
22
+ type Projection<T extends FiberyObject = FiberyObject> = Select & {
23
+ readonly [projected]?: T;
24
+ };
19
25
  type Query = {
20
26
  "q/from": string;
21
27
  "q/select"?: Expression | Select;
@@ -55,12 +61,10 @@ type FiberyAutocompletes = {
55
61
  "fibery/public-id"?: PublicId;
56
62
  "fibery/rank"?: number;
57
63
  __NOTHING_INTERESTING__TitleField__?: string;
64
+ "icon/icon"?: string | null;
58
65
  };
59
66
  type FiberyObject = FiberyIdentity & FiberyAutocompletes & {
60
67
  [field: string]: unknown;
61
68
  };
62
- type FiberyObjectYOLO = FiberyIdentity & FiberyAutocompletes & {
63
- [field: string]: any;
64
- };
65
69
  //#endregion
66
- export { Expression, ExpressionVisitor, ExpressionVisitorWithDefault, FiberyObject, FiberyObjectYOLO, FieldExpression, FromRootExpression, FunctionCallExpression, FunctionsMeta, MultiFieldAccess, OrderBy, Query, QueryLimit, Select, SubQuery };
70
+ export { Expression, ExpressionVisitor, ExpressionVisitorWithDefault, FiberyObject, FieldExpression, FromRootExpression, FunctionCallExpression, FunctionsMeta, MultiFieldAccess, OrderBy, Projection, Query, QueryLimit, Select, SubQuery };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/expression-utils",
3
- "version": "15.0.0",
3
+ "version": "16.0.0",
4
4
  "description": "utils for working with fibery api expressions",
5
5
  "license": "UNLICENSED",
6
6
  "files": [
@@ -26,11 +26,11 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "lodash": "4.17.21",
29
- "moment": "2.29.4",
29
+ "moment": "2.31.0",
30
30
  "uuid": "11.1.0",
31
- "@fibery/helpers": "4.0.0"
31
+ "@fibery/helpers": "4.1.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "@fibery/schema": "12.0.0"
34
+ "@fibery/schema": "12.0.1"
35
35
  }
36
36
  }