@visactor/vbi 0.4.15 → 0.4.16

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 (44) hide show
  1. package/dist/builder/{sub-builders → features}/chart-type/chart-type-builder.d.ts +1 -1
  2. package/dist/builder/{sub-builders → features}/dimensions/dim-builder.d.ts +1 -1
  3. package/dist/builder/{sub-builders → features}/dimensions/dim-node-builder.d.ts +1 -1
  4. package/dist/builder/{sub-builders/havingFilters → features/havingFilter}/having-builder.d.ts +13 -13
  5. package/dist/builder/{sub-builders/havingFilters → features/havingFilter}/having-group-builder.d.ts +4 -3
  6. package/dist/builder/{sub-builders/havingFilters → features/havingFilter}/having-node-builder.d.ts +2 -2
  7. package/dist/builder/features/havingFilter/having-utils.d.ts +9 -0
  8. package/dist/builder/features/havingFilter/index.d.ts +3 -0
  9. package/dist/builder/features/index.d.ts +9 -0
  10. package/dist/builder/features/limit/index.d.ts +1 -0
  11. package/dist/builder/features/limit/limit-builder.d.ts +31 -0
  12. package/dist/builder/features/locale/index.d.ts +1 -0
  13. package/dist/builder/features/locale/locale-builder.d.ts +31 -0
  14. package/dist/builder/{sub-builders → features}/measures/mea-builder.d.ts +1 -1
  15. package/dist/builder/{sub-builders → features}/measures/mea-node-builder.d.ts +1 -1
  16. package/dist/builder/features/theme/index.d.ts +1 -0
  17. package/dist/builder/features/theme/theme-builder.d.ts +31 -0
  18. package/dist/builder/features/undo-manager/index.d.ts +1 -0
  19. package/dist/builder/{sub-builders/whereFilters → features/whereFilter}/index.d.ts +1 -1
  20. package/dist/builder/{sub-builders/whereFilters → features/whereFilter}/where-builder.d.ts +11 -11
  21. package/dist/builder/{sub-builders/whereFilters → features/whereFilter}/where-group-builder.d.ts +2 -1
  22. package/dist/builder/{sub-builders/whereFilters → features/whereFilter}/where-node-builder.d.ts +6 -1
  23. package/dist/builder/features/whereFilter/where-utils.d.ts +9 -0
  24. package/dist/builder/index.d.ts +1 -2
  25. package/dist/builder/vbi-builder.d.ts +6 -11
  26. package/dist/builder/vbi.d.ts +2 -2
  27. package/dist/index.cjs +521 -334
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +498 -329
  30. package/dist/types/builder/VBIInterface.d.ts +6 -5
  31. package/dist/types/dsl/{havingFilters → havingFilter}/having.d.ts +10 -6
  32. package/dist/types/dsl/index.d.ts +4 -5
  33. package/dist/types/dsl/measures/measures.d.ts +16 -2
  34. package/dist/types/dsl/vbi/vbi.d.ts +40 -4
  35. package/dist/types/dsl/{whereFilters → whereFilter}/filters.d.ts +10 -6
  36. package/dist/utils/filter-guards.d.ts +5 -0
  37. package/dist/utils/index.d.ts +1 -0
  38. package/package.json +5 -5
  39. package/dist/builder/sub-builders/havingFilters/index.d.ts +0 -3
  40. package/dist/builder/sub-builders/index.d.ts +0 -5
  41. /package/dist/builder/{sub-builders → features}/chart-type/index.d.ts +0 -0
  42. /package/dist/builder/{sub-builders → features}/dimensions/index.d.ts +0 -0
  43. /package/dist/builder/{sub-builders → features}/measures/index.d.ts +0 -0
  44. /package/dist/builder/{undo-manager.d.ts → features/undo-manager/undo-manager.d.ts} +0 -0
@@ -1,9 +1,8 @@
1
1
  import type { VQueryDSL } from '@visactor/vquery';
2
2
  import type { VBIDSL } from '../dsl';
3
3
  import type { VSeedDSL } from '@visactor/vseed';
4
- import type { MeasuresBuilder, DimensionsBuilder, ChartTypeBuilder, HavingFiltersBuilder, WhereFiltersBuilder } from '../../builder/sub-builders';
4
+ import type { MeasuresBuilder, DimensionsBuilder, ChartTypeBuilder, HavingFilterBuilder, WhereFilterBuilder, ThemeBuilder, LocaleBuilder, LimitBuilder, UndoManager } from '../../builder/features';
5
5
  import type { Map, Doc } from 'yjs';
6
- import type { UndoManager } from '../../builder/undo-manager';
7
6
  export interface VBIBuilderInterface {
8
7
  doc: Doc;
9
8
  dsl: Map<any>;
@@ -11,12 +10,14 @@ export interface VBIBuilderInterface {
11
10
  chartType: ChartTypeBuilder;
12
11
  measures: MeasuresBuilder;
13
12
  dimensions: DimensionsBuilder;
14
- havingFilters: HavingFiltersBuilder;
15
- whereFilters: WhereFiltersBuilder;
13
+ havingFilter: HavingFilterBuilder;
14
+ whereFilter: WhereFilterBuilder;
15
+ theme: ThemeBuilder;
16
+ locale: LocaleBuilder;
17
+ limit: LimitBuilder;
16
18
  applyUpdate: (update: Uint8Array, origin?: any) => void;
17
19
  encodeStateAsUpdate: (targetStateVector?: Uint8Array) => Uint8Array;
18
20
  buildVSeed: () => Promise<VSeedDSL>;
19
21
  buildVQuery: () => VQueryDSL;
20
22
  build: () => VBIDSL;
21
- setLimit: (limit: number) => this;
22
23
  }
@@ -1,4 +1,8 @@
1
1
  import { z } from 'zod';
2
+ declare const zHavingLogicalOperator: z.ZodEnum<{
3
+ and: "and";
4
+ or: "or";
5
+ }>;
2
6
  export declare const zVBIHavingFilter: z.ZodObject<{
3
7
  id: z.ZodString;
4
8
  field: z.ZodString;
@@ -6,13 +10,13 @@ export declare const zVBIHavingFilter: z.ZodObject<{
6
10
  value: z.ZodOptional<z.ZodAny>;
7
11
  }, z.core.$strip>;
8
12
  export type VBIHavingFilter = z.infer<typeof zVBIHavingFilter>;
9
- export declare const zVBIHavingGroup: z.ZodType<VBIHavingGroup>;
10
- export declare const zVBIHavingClause: z.ZodType<VBIHavingClause>;
11
- export type VBIHavingGroup = {
13
+ type VBIHavingBranch = {
12
14
  id: string;
13
- op: 'and' | 'or';
15
+ op: z.infer<typeof zHavingLogicalOperator>;
14
16
  conditions: VBIHavingClause[];
15
17
  };
18
+ export type VBIHavingGroup = VBIHavingBranch;
16
19
  export type VBIHavingClause = VBIHavingFilter | VBIHavingGroup;
17
- export declare function isVBIHavingFilter(clause: VBIHavingClause): clause is VBIHavingFilter;
18
- export declare function isVBIHavingGroup(clause: VBIHavingClause): clause is VBIHavingGroup;
20
+ export declare const zVBIHavingGroup: z.ZodType<VBIHavingGroup>;
21
+ export declare const zVBIHavingClause: z.ZodType<VBIHavingClause>;
22
+ export {};
@@ -1,8 +1,7 @@
1
1
  export type { VBIDimensionTree, VBIDimensionGroup, VBIDimension } from './dimensions/dimensions';
2
2
  export type { VBIMeasureTree, VBIMeasureGroup, VBIMeasure } from './measures/measures';
3
- export type { VBIFilter, VBIWhereGroup, VBIWhereClause } from './whereFilters/filters';
4
- export { isVBIFilter, isVBIWhereGroup } from './whereFilters/filters';
5
- export type { VBIHavingFilter, VBIHavingGroup, VBIHavingClause } from './havingFilters/having';
6
- export { isVBIHavingFilter, isVBIHavingGroup } from './havingFilters/having';
3
+ export type { VBIFilter, VBIWhereGroup, VBIWhereClause } from './whereFilter/filters';
4
+ export type { VBIHavingFilter, VBIHavingGroup, VBIHavingClause } from './havingFilter/having';
7
5
  export type { VBIDSLTheme } from './theme/theme';
8
- export type { VBIDSL } from './vbi/vbi';
6
+ export type { VBIDSLLocale } from './locale/locale';
7
+ export type { VBIDSL, VBIDSLInput } from './vbi/vbi';
@@ -2,7 +2,14 @@ import { z } from 'zod';
2
2
  export declare const zVBIMeasure: z.ZodObject<{
3
3
  field: z.ZodString;
4
4
  alias: z.ZodString;
5
- encoding: z.ZodLiteral<"yAxis" | "xAxis" | "color" | "label" | "tooltip" | "size">;
5
+ encoding: z.ZodEnum<{
6
+ yAxis: "yAxis";
7
+ xAxis: "xAxis";
8
+ color: "color";
9
+ label: "label";
10
+ tooltip: "tooltip";
11
+ size: "size";
12
+ }>;
6
13
  aggregate: z.ZodDiscriminatedUnion<[z.ZodObject<{
7
14
  func: z.ZodLiteral<"sum" | "count" | "avg" | "min" | "max">;
8
15
  }, z.core.$strip>, z.ZodObject<{
@@ -14,7 +21,14 @@ export declare const zVBIMeasureGroup: z.ZodType<VBIMeasureGroup>;
14
21
  export declare const zVBIMeasureTree: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
15
22
  field: z.ZodString;
16
23
  alias: z.ZodString;
17
- encoding: z.ZodLiteral<"yAxis" | "xAxis" | "color" | "label" | "tooltip" | "size">;
24
+ encoding: z.ZodEnum<{
25
+ yAxis: "yAxis";
26
+ xAxis: "xAxis";
27
+ color: "color";
28
+ label: "label";
29
+ tooltip: "tooltip";
30
+ size: "size";
31
+ }>;
18
32
  aggregate: z.ZodDiscriminatedUnion<[z.ZodObject<{
19
33
  func: z.ZodLiteral<"sum" | "count" | "avg" | "min" | "max">;
20
34
  }, z.core.$strip>, z.ZodObject<{
@@ -9,7 +9,14 @@ export declare const zVBIDSL: z.ZodObject<{
9
9
  measures: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
10
10
  field: z.ZodString;
11
11
  alias: z.ZodString;
12
- encoding: z.ZodLiteral<"yAxis" | "xAxis" | "color" | "label" | "tooltip" | "size">;
12
+ encoding: z.ZodEnum<{
13
+ yAxis: "yAxis";
14
+ xAxis: "xAxis";
15
+ color: "color";
16
+ label: "label";
17
+ tooltip: "tooltip";
18
+ size: "size";
19
+ }>;
13
20
  aggregate: z.ZodDiscriminatedUnion<[z.ZodObject<{
14
21
  func: z.ZodLiteral<"sum" | "count" | "avg" | "min" | "max">;
15
22
  }, z.core.$strip>, z.ZodObject<{
@@ -17,8 +24,36 @@ export declare const zVBIDSL: z.ZodObject<{
17
24
  quantile: z.ZodNumber;
18
25
  }, z.core.$strip>], "func">;
19
26
  }, z.core.$strip>, z.ZodType<import("..").VBIMeasureGroup, unknown, z.core.$ZodTypeInternals<import("..").VBIMeasureGroup, unknown>>]>>;
20
- havingFilters: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodType<import("..").VBIHavingClause, unknown, z.core.$ZodTypeInternals<import("..").VBIHavingClause, unknown>>>>>;
21
- whereFilters: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodType<import("..").VBIWhereClause, unknown, z.core.$ZodTypeInternals<import("..").VBIWhereClause, unknown>>>>>;
27
+ havingFilter: z.ZodDefault<z.ZodOptional<z.ZodType<{
28
+ id: string;
29
+ op: z.infer<z.ZodEnum<{
30
+ and: "and";
31
+ or: "or";
32
+ }>>;
33
+ conditions: import("..").VBIHavingClause[];
34
+ }, unknown, z.core.$ZodTypeInternals<{
35
+ id: string;
36
+ op: z.infer<z.ZodEnum<{
37
+ and: "and";
38
+ or: "or";
39
+ }>>;
40
+ conditions: import("..").VBIHavingClause[];
41
+ }, unknown>>>>;
42
+ whereFilter: z.ZodDefault<z.ZodOptional<z.ZodType<{
43
+ id: string;
44
+ op: z.infer<z.ZodEnum<{
45
+ and: "and";
46
+ or: "or";
47
+ }>>;
48
+ conditions: import("..").VBIWhereClause[];
49
+ }, unknown, z.core.$ZodTypeInternals<{
50
+ id: string;
51
+ op: z.infer<z.ZodEnum<{
52
+ and: "and";
53
+ or: "or";
54
+ }>>;
55
+ conditions: import("..").VBIWhereClause[];
56
+ }, unknown>>>>;
22
57
  theme: z.ZodEnum<{
23
58
  light: "light";
24
59
  dark: "dark";
@@ -30,4 +65,5 @@ export declare const zVBIDSL: z.ZodObject<{
30
65
  limit: z.ZodOptional<z.ZodNumber>;
31
66
  version: z.ZodNumber;
32
67
  }, z.core.$strip>;
33
- export type VBIDSL = z.infer<typeof zVBIDSL>;
68
+ export type VBIDSLInput = z.input<typeof zVBIDSL>;
69
+ export type VBIDSL = z.output<typeof zVBIDSL>;
@@ -1,4 +1,8 @@
1
1
  import { z } from 'zod';
2
+ declare const zWhereLogicalOperator: z.ZodEnum<{
3
+ and: "and";
4
+ or: "or";
5
+ }>;
2
6
  export declare const zVBIFilter: z.ZodObject<{
3
7
  id: z.ZodString;
4
8
  field: z.ZodString;
@@ -6,13 +10,13 @@ export declare const zVBIFilter: z.ZodObject<{
6
10
  value: z.ZodOptional<z.ZodAny>;
7
11
  }, z.core.$strip>;
8
12
  export type VBIFilter = z.infer<typeof zVBIFilter>;
9
- export declare const zVBIWhereGroup: z.ZodType<VBIWhereGroup>;
10
- export declare const zVBIWhereClause: z.ZodType<VBIWhereClause>;
11
- export type VBIWhereGroup = {
13
+ type VBIWhereBranch = {
12
14
  id: string;
13
- op: 'and' | 'or';
15
+ op: z.infer<typeof zWhereLogicalOperator>;
14
16
  conditions: VBIWhereClause[];
15
17
  };
18
+ export type VBIWhereGroup = VBIWhereBranch;
16
19
  export type VBIWhereClause = VBIFilter | VBIWhereGroup;
17
- export declare function isVBIFilter(clause: VBIWhereClause): clause is VBIFilter;
18
- export declare function isVBIWhereGroup(clause: VBIWhereClause): clause is VBIWhereGroup;
20
+ export declare const zVBIWhereGroup: z.ZodType<VBIWhereGroup>;
21
+ export declare const zVBIWhereClause: z.ZodType<VBIWhereClause>;
22
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { VBIFilter, VBIWhereClause, VBIWhereGroup, VBIHavingClause, VBIHavingFilter, VBIHavingGroup } from '../types/dsl';
2
+ export declare function isVBIFilter(clause: VBIWhereClause): clause is VBIFilter;
3
+ export declare function isVBIWhereGroup(clause: VBIWhereClause): clause is VBIWhereGroup;
4
+ export declare function isVBIHavingFilter(clause: VBIHavingClause): clause is VBIHavingFilter;
5
+ export declare function isVBIHavingGroup(clause: VBIHavingClause): clause is VBIHavingGroup;
@@ -1,2 +1,3 @@
1
1
  export * from './tree';
2
2
  export { id } from './id';
3
+ export * from './filter-guards';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vbi",
3
- "version": "0.4.15",
3
+ "version": "0.4.16",
4
4
  "license": "MIT",
5
5
  "homepage": "https://visactor.github.io/VBI",
6
6
  "bugs": "https://github.com/VisActor/VBI/issues",
@@ -33,11 +33,11 @@
33
33
  "uuid": "13.0.0",
34
34
  "yjs": "13.6.28",
35
35
  "zod": "4.0.17",
36
- "@visactor/vseed": "0.4.15"
36
+ "@visactor/vseed": "0.4.16"
37
37
  },
38
38
  "optionalDependencies": {
39
- "@visactor/vseed": "0.4.15",
40
- "@visactor/vquery": "0.4.15"
39
+ "@visactor/vseed": "0.4.16",
40
+ "@visactor/vquery": "0.4.16"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@eslint/js": "9.39.0",
@@ -51,7 +51,7 @@
51
51
  "ts-morph": "26.0.0",
52
52
  "typescript": "5.9.3",
53
53
  "typescript-eslint": "8.48.0",
54
- "@visactor/vquery": "0.4.15"
54
+ "@visactor/vquery": "0.4.16"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "rslib build",
@@ -1,3 +0,0 @@
1
- export { HavingFiltersBuilder } from './having-builder';
2
- export { HavingFiltersNodeBuilder } from './having-node-builder';
3
- export { HavingGroupBuilder } from './having-group-builder';
@@ -1,5 +0,0 @@
1
- export { MeasuresBuilder } from './measures';
2
- export { DimensionsBuilder } from './dimensions';
3
- export { ChartTypeBuilder } from './chart-type';
4
- export { WhereFiltersBuilder, WhereGroupBuilder } from './whereFilters';
5
- export { HavingFiltersBuilder } from './havingFilters';