@goplasmatic/datalogic-ui 5.1.0 → 5.2.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.
package/dist/index.cjs CHANGED
@@ -5617,6 +5617,179 @@ var arrayManipulationOperators = {
5617
5617
  shortLabel: "slice",
5618
5618
  nodeType: "operator"
5619
5619
  }
5620
+ },
5621
+ group_by: {
5622
+ name: "group_by",
5623
+ label: "Group By",
5624
+ category: "array",
5625
+ description: "Group array elements by a computed key",
5626
+ arity: {
5627
+ type: "binary",
5628
+ args: [{
5629
+ name: "array",
5630
+ label: "Array",
5631
+ type: "array",
5632
+ required: true
5633
+ }, {
5634
+ name: "expression",
5635
+ label: "Group Key",
5636
+ type: "expression",
5637
+ required: true,
5638
+ description: "Expression producing each element’s group key"
5639
+ }]
5640
+ },
5641
+ help: {
5642
+ summary: "Collapse an array into {key, items} groups on a computed key",
5643
+ details: "Evaluates the key expression once per element and collects elements sharing a key. Returns an array of {key, items} rows ordered by first key occurrence, so the result composes with map, filter, and sort.",
5644
+ returnType: "array",
5645
+ examples: [{
5646
+ title: "Group by field",
5647
+ rule: { group_by: [{ var: "tasks" }, { var: "status" }] },
5648
+ data: { tasks: [
5649
+ {
5650
+ id: 1,
5651
+ status: "open"
5652
+ },
5653
+ {
5654
+ id: 2,
5655
+ status: "done"
5656
+ },
5657
+ {
5658
+ id: 3,
5659
+ status: "open"
5660
+ }
5661
+ ] },
5662
+ result: [{
5663
+ key: "open",
5664
+ items: [{
5665
+ id: 1,
5666
+ status: "open"
5667
+ }, {
5668
+ id: 3,
5669
+ status: "open"
5670
+ }]
5671
+ }, {
5672
+ key: "done",
5673
+ items: [{
5674
+ id: 2,
5675
+ status: "done"
5676
+ }]
5677
+ }]
5678
+ }, {
5679
+ title: "Group by computed key",
5680
+ rule: { group_by: [[
5681
+ 1,
5682
+ 2,
5683
+ 3,
5684
+ 4,
5685
+ 5
5686
+ ], { "%": [{ var: "" }, 2] }] },
5687
+ result: [{
5688
+ key: 1,
5689
+ items: [
5690
+ 1,
5691
+ 3,
5692
+ 5
5693
+ ]
5694
+ }, {
5695
+ key: 0,
5696
+ items: [2, 4]
5697
+ }]
5698
+ }],
5699
+ notes: [
5700
+ "Keys keep their evaluated type — numbers, booleans, and objects group by deep equality",
5701
+ "Groups are ordered by first key occurrence (deterministic output)",
5702
+ "Null or empty input yields []"
5703
+ ],
5704
+ seeAlso: [
5705
+ "distinct",
5706
+ "map",
5707
+ "sort"
5708
+ ]
5709
+ },
5710
+ ui: {
5711
+ icon: "group",
5712
+ shortLabel: "group",
5713
+ nodeType: "operator"
5714
+ }
5715
+ },
5716
+ distinct: {
5717
+ name: "distinct",
5718
+ label: "Distinct",
5719
+ category: "array",
5720
+ description: "Remove duplicate elements",
5721
+ arity: {
5722
+ type: "range",
5723
+ min: 1,
5724
+ max: 2,
5725
+ args: [{
5726
+ name: "array",
5727
+ label: "Array",
5728
+ type: "array",
5729
+ required: true
5730
+ }, {
5731
+ name: "expression",
5732
+ label: "Key",
5733
+ type: "expression",
5734
+ required: false,
5735
+ description: "Optional expression to deduplicate by a computed key"
5736
+ }]
5737
+ },
5738
+ help: {
5739
+ summary: "Drop duplicate elements, by value or by a computed key",
5740
+ details: "Without a key expression, removes elements that strictly deep-equal an earlier one. With a key expression, keeps the first element per distinct key. First occurrence wins, so input order is preserved.",
5741
+ returnType: "array",
5742
+ examples: [{
5743
+ title: "Dedup by value",
5744
+ rule: { distinct: [[
5745
+ 3,
5746
+ 1,
5747
+ 3,
5748
+ 2,
5749
+ 1
5750
+ ]] },
5751
+ result: [
5752
+ 3,
5753
+ 1,
5754
+ 2
5755
+ ]
5756
+ }, {
5757
+ title: "Dedup by key",
5758
+ rule: { distinct: [{ var: "rows" }, { var: "id" }] },
5759
+ data: { rows: [
5760
+ {
5761
+ id: 1,
5762
+ rev: "a"
5763
+ },
5764
+ {
5765
+ id: 2,
5766
+ rev: "b"
5767
+ },
5768
+ {
5769
+ id: 1,
5770
+ rev: "c"
5771
+ }
5772
+ ] },
5773
+ result: [{
5774
+ id: 1,
5775
+ rev: "a"
5776
+ }, {
5777
+ id: 2,
5778
+ rev: "b"
5779
+ }]
5780
+ }],
5781
+ notes: [
5782
+ "Uses strict deep equality — 1 and \"1\" stay distinct",
5783
+ "First occurrence wins; order is preserved",
5784
+ "Null or empty input yields []"
5785
+ ],
5786
+ seeAlso: ["group_by", "filter"]
5787
+ },
5788
+ ui: {
5789
+ icon: "list-filter",
5790
+ shortLabel: "distinct",
5791
+ nodeType: "operator"
5792
+ }
5620
5793
  }
5621
5794
  };
5622
5795
  //#endregion
@@ -5633,6 +5806,152 @@ var arrayOperators = {
5633
5806
  ...arrayManipulationOperators
5634
5807
  };
5635
5808
  //#endregion
5809
+ //#region src/components/logic-editor/config/operators/object.ts
5810
+ var objectOperators = {
5811
+ keys: {
5812
+ name: "keys",
5813
+ label: "Keys",
5814
+ category: "object",
5815
+ description: "List an object's keys",
5816
+ arity: {
5817
+ type: "unary",
5818
+ args: [{
5819
+ name: "object",
5820
+ label: "Object",
5821
+ type: "any",
5822
+ required: true
5823
+ }]
5824
+ },
5825
+ help: {
5826
+ summary: "List an object's keys as an array of strings",
5827
+ details: "Returns the keys of the object in stored order. Null input yields an empty array; any other non-object input is an error.",
5828
+ returnType: "array",
5829
+ examples: [{
5830
+ title: "Keys of an object",
5831
+ rule: { keys: [{ var: "scores" }] },
5832
+ data: { scores: {
5833
+ alice: 10,
5834
+ bob: 7
5835
+ } },
5836
+ result: ["alice", "bob"]
5837
+ }],
5838
+ notes: ["Keys come out in stored order", "Null input yields []"],
5839
+ seeAlso: ["values", "entries"]
5840
+ },
5841
+ ui: {
5842
+ icon: "key-round",
5843
+ shortLabel: "keys",
5844
+ nodeType: "operator"
5845
+ }
5846
+ },
5847
+ values: {
5848
+ name: "values",
5849
+ label: "Values",
5850
+ category: "object",
5851
+ description: "List an object's values",
5852
+ arity: {
5853
+ type: "unary",
5854
+ args: [{
5855
+ name: "object",
5856
+ label: "Object",
5857
+ type: "any",
5858
+ required: true
5859
+ }]
5860
+ },
5861
+ help: {
5862
+ summary: "List an object's values as an array",
5863
+ details: "Returns the values of the object in stored order. Null input yields an empty array; any other non-object input is an error.",
5864
+ returnType: "array",
5865
+ examples: [{
5866
+ title: "Values of an object",
5867
+ rule: { values: [{ var: "scores" }] },
5868
+ data: { scores: {
5869
+ alice: 10,
5870
+ bob: 7
5871
+ } },
5872
+ result: [10, 7]
5873
+ }, {
5874
+ title: "Sum values",
5875
+ rule: { reduce: [
5876
+ { values: [{ var: "scores" }] },
5877
+ { "+": [{ var: "accumulator" }, { var: "current" }] },
5878
+ 0
5879
+ ] },
5880
+ data: { scores: {
5881
+ alice: 10,
5882
+ bob: 7
5883
+ } },
5884
+ result: 17
5885
+ }],
5886
+ notes: ["Values come out in stored order", "Null input yields []"],
5887
+ seeAlso: ["keys", "entries"]
5888
+ },
5889
+ ui: {
5890
+ icon: "list",
5891
+ shortLabel: "values",
5892
+ nodeType: "operator"
5893
+ }
5894
+ },
5895
+ entries: {
5896
+ name: "entries",
5897
+ label: "Entries",
5898
+ category: "object",
5899
+ description: "Turn an object into {key, value} rows",
5900
+ arity: {
5901
+ type: "unary",
5902
+ args: [{
5903
+ name: "object",
5904
+ label: "Object",
5905
+ type: "any",
5906
+ required: true
5907
+ }]
5908
+ },
5909
+ help: {
5910
+ summary: "Turn an object into an array of {key, value} rows",
5911
+ details: "Returns one {key, value} object per entry, in stored order — rows the array vocabulary (map, filter, group_by) can iterate. Null input yields an empty array; any other non-object input is an error.",
5912
+ returnType: "array",
5913
+ examples: [{
5914
+ title: "Entries of an object",
5915
+ rule: { entries: [{ var: "scores" }] },
5916
+ data: { scores: {
5917
+ alice: 10,
5918
+ bob: 7
5919
+ } },
5920
+ result: [{
5921
+ key: "alice",
5922
+ value: 10
5923
+ }, {
5924
+ key: "bob",
5925
+ value: 7
5926
+ }]
5927
+ }, {
5928
+ title: "Iterate with map",
5929
+ rule: { map: [{ entries: [{ var: "scores" }] }, { cat: [
5930
+ { var: "key" },
5931
+ ": ",
5932
+ { var: "value" }
5933
+ ] }] },
5934
+ data: { scores: {
5935
+ alice: 10,
5936
+ bob: 7
5937
+ } },
5938
+ result: ["alice: 10", "bob: 7"]
5939
+ }],
5940
+ notes: ["Rows come out in stored order", "Null input yields []"],
5941
+ seeAlso: [
5942
+ "keys",
5943
+ "values",
5944
+ "map"
5945
+ ]
5946
+ },
5947
+ ui: {
5948
+ icon: "braces",
5949
+ shortLabel: "entries",
5950
+ nodeType: "operator"
5951
+ }
5952
+ }
5953
+ };
5954
+ //#endregion
5636
5955
  //#region src/components/logic-editor/config/operators/datetime.ts
5637
5956
  var datetimeOperators = {
5638
5957
  datetime: {
@@ -6465,6 +6784,7 @@ var operators = {
6465
6784
  ...controlOperators,
6466
6785
  ...stringOperators,
6467
6786
  ...arrayOperators,
6787
+ ...objectOperators,
6468
6788
  ...datetimeOperators,
6469
6789
  ...validationOperators,
6470
6790
  ...errorOperators,
@@ -7381,6 +7701,13 @@ var categories = {
7381
7701
  color: "#7c3aed",
7382
7702
  icon: "layers"
7383
7703
  },
7704
+ object: {
7705
+ name: "object",
7706
+ label: "Object",
7707
+ description: "Object take-apart: keys, values, entries",
7708
+ color: "#a855f7",
7709
+ icon: "braces"
7710
+ },
7384
7711
  datetime: {
7385
7712
  name: "datetime",
7386
7713
  label: "Date & Time",
@@ -13811,7 +14138,7 @@ function useWasmEvaluator(options = {}) {
13811
14138
  try {
13812
14139
  setLoading(true);
13813
14140
  setError(null);
13814
- const wasm = await Promise.resolve().then(() => require("./datalogic_wasm-dTo8Zxxv.cjs"));
14141
+ const wasm = await Promise.resolve().then(() => require("./datalogic_wasm-Da8EOl2Z.cjs"));
13815
14142
  await wasm.default();
13816
14143
  if (!cancelled) {
13817
14144
  moduleRef.current = {
@@ -17664,6 +17991,7 @@ var OPERATOR_CATEGORY_ORDER = [
17664
17991
  "logical",
17665
17992
  "string",
17666
17993
  "array",
17994
+ "object",
17667
17995
  "control",
17668
17996
  "datetime",
17669
17997
  "validation",