@goplasmatic/datalogic-ui 5.1.1 → 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/components/logic-editor/config/categories.d.ts.map +1 -1
- package/dist/components/logic-editor/config/operators/array-manipulation.d.ts.map +1 -1
- package/dist/components/logic-editor/config/operators/index.d.ts +2 -1
- package/dist/components/logic-editor/config/operators/index.d.ts.map +1 -1
- package/dist/components/logic-editor/config/operators/object.d.ts +3 -0
- package/dist/components/logic-editor/config/operators/object.d.ts.map +1 -0
- package/dist/components/logic-editor/config/operators.types.d.ts +1 -1
- package/dist/components/logic-editor/config/operators.types.d.ts.map +1 -1
- package/dist/components/logic-editor/utils/menu-builder.d.ts.map +1 -1
- package/dist/datalogic_wasm-CQhNPxpU.js +1146 -0
- package/dist/datalogic_wasm-Da8EOl2Z.cjs +1149 -0
- package/dist/index.cjs +329 -1
- package/dist/index.js +329 -1
- package/package.json +2 -2
- package/dist/datalogic_wasm-CpFcFYs_.js +0 -1145
- package/dist/datalogic_wasm-gbHygpWU.cjs +0 -1148
package/dist/index.js
CHANGED
|
@@ -5593,6 +5593,179 @@ var arrayManipulationOperators = {
|
|
|
5593
5593
|
shortLabel: "slice",
|
|
5594
5594
|
nodeType: "operator"
|
|
5595
5595
|
}
|
|
5596
|
+
},
|
|
5597
|
+
group_by: {
|
|
5598
|
+
name: "group_by",
|
|
5599
|
+
label: "Group By",
|
|
5600
|
+
category: "array",
|
|
5601
|
+
description: "Group array elements by a computed key",
|
|
5602
|
+
arity: {
|
|
5603
|
+
type: "binary",
|
|
5604
|
+
args: [{
|
|
5605
|
+
name: "array",
|
|
5606
|
+
label: "Array",
|
|
5607
|
+
type: "array",
|
|
5608
|
+
required: true
|
|
5609
|
+
}, {
|
|
5610
|
+
name: "expression",
|
|
5611
|
+
label: "Group Key",
|
|
5612
|
+
type: "expression",
|
|
5613
|
+
required: true,
|
|
5614
|
+
description: "Expression producing each element’s group key"
|
|
5615
|
+
}]
|
|
5616
|
+
},
|
|
5617
|
+
help: {
|
|
5618
|
+
summary: "Collapse an array into {key, items} groups on a computed key",
|
|
5619
|
+
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.",
|
|
5620
|
+
returnType: "array",
|
|
5621
|
+
examples: [{
|
|
5622
|
+
title: "Group by field",
|
|
5623
|
+
rule: { group_by: [{ var: "tasks" }, { var: "status" }] },
|
|
5624
|
+
data: { tasks: [
|
|
5625
|
+
{
|
|
5626
|
+
id: 1,
|
|
5627
|
+
status: "open"
|
|
5628
|
+
},
|
|
5629
|
+
{
|
|
5630
|
+
id: 2,
|
|
5631
|
+
status: "done"
|
|
5632
|
+
},
|
|
5633
|
+
{
|
|
5634
|
+
id: 3,
|
|
5635
|
+
status: "open"
|
|
5636
|
+
}
|
|
5637
|
+
] },
|
|
5638
|
+
result: [{
|
|
5639
|
+
key: "open",
|
|
5640
|
+
items: [{
|
|
5641
|
+
id: 1,
|
|
5642
|
+
status: "open"
|
|
5643
|
+
}, {
|
|
5644
|
+
id: 3,
|
|
5645
|
+
status: "open"
|
|
5646
|
+
}]
|
|
5647
|
+
}, {
|
|
5648
|
+
key: "done",
|
|
5649
|
+
items: [{
|
|
5650
|
+
id: 2,
|
|
5651
|
+
status: "done"
|
|
5652
|
+
}]
|
|
5653
|
+
}]
|
|
5654
|
+
}, {
|
|
5655
|
+
title: "Group by computed key",
|
|
5656
|
+
rule: { group_by: [[
|
|
5657
|
+
1,
|
|
5658
|
+
2,
|
|
5659
|
+
3,
|
|
5660
|
+
4,
|
|
5661
|
+
5
|
|
5662
|
+
], { "%": [{ var: "" }, 2] }] },
|
|
5663
|
+
result: [{
|
|
5664
|
+
key: 1,
|
|
5665
|
+
items: [
|
|
5666
|
+
1,
|
|
5667
|
+
3,
|
|
5668
|
+
5
|
|
5669
|
+
]
|
|
5670
|
+
}, {
|
|
5671
|
+
key: 0,
|
|
5672
|
+
items: [2, 4]
|
|
5673
|
+
}]
|
|
5674
|
+
}],
|
|
5675
|
+
notes: [
|
|
5676
|
+
"Keys keep their evaluated type — numbers, booleans, and objects group by deep equality",
|
|
5677
|
+
"Groups are ordered by first key occurrence (deterministic output)",
|
|
5678
|
+
"Null or empty input yields []"
|
|
5679
|
+
],
|
|
5680
|
+
seeAlso: [
|
|
5681
|
+
"distinct",
|
|
5682
|
+
"map",
|
|
5683
|
+
"sort"
|
|
5684
|
+
]
|
|
5685
|
+
},
|
|
5686
|
+
ui: {
|
|
5687
|
+
icon: "group",
|
|
5688
|
+
shortLabel: "group",
|
|
5689
|
+
nodeType: "operator"
|
|
5690
|
+
}
|
|
5691
|
+
},
|
|
5692
|
+
distinct: {
|
|
5693
|
+
name: "distinct",
|
|
5694
|
+
label: "Distinct",
|
|
5695
|
+
category: "array",
|
|
5696
|
+
description: "Remove duplicate elements",
|
|
5697
|
+
arity: {
|
|
5698
|
+
type: "range",
|
|
5699
|
+
min: 1,
|
|
5700
|
+
max: 2,
|
|
5701
|
+
args: [{
|
|
5702
|
+
name: "array",
|
|
5703
|
+
label: "Array",
|
|
5704
|
+
type: "array",
|
|
5705
|
+
required: true
|
|
5706
|
+
}, {
|
|
5707
|
+
name: "expression",
|
|
5708
|
+
label: "Key",
|
|
5709
|
+
type: "expression",
|
|
5710
|
+
required: false,
|
|
5711
|
+
description: "Optional expression to deduplicate by a computed key"
|
|
5712
|
+
}]
|
|
5713
|
+
},
|
|
5714
|
+
help: {
|
|
5715
|
+
summary: "Drop duplicate elements, by value or by a computed key",
|
|
5716
|
+
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.",
|
|
5717
|
+
returnType: "array",
|
|
5718
|
+
examples: [{
|
|
5719
|
+
title: "Dedup by value",
|
|
5720
|
+
rule: { distinct: [[
|
|
5721
|
+
3,
|
|
5722
|
+
1,
|
|
5723
|
+
3,
|
|
5724
|
+
2,
|
|
5725
|
+
1
|
|
5726
|
+
]] },
|
|
5727
|
+
result: [
|
|
5728
|
+
3,
|
|
5729
|
+
1,
|
|
5730
|
+
2
|
|
5731
|
+
]
|
|
5732
|
+
}, {
|
|
5733
|
+
title: "Dedup by key",
|
|
5734
|
+
rule: { distinct: [{ var: "rows" }, { var: "id" }] },
|
|
5735
|
+
data: { rows: [
|
|
5736
|
+
{
|
|
5737
|
+
id: 1,
|
|
5738
|
+
rev: "a"
|
|
5739
|
+
},
|
|
5740
|
+
{
|
|
5741
|
+
id: 2,
|
|
5742
|
+
rev: "b"
|
|
5743
|
+
},
|
|
5744
|
+
{
|
|
5745
|
+
id: 1,
|
|
5746
|
+
rev: "c"
|
|
5747
|
+
}
|
|
5748
|
+
] },
|
|
5749
|
+
result: [{
|
|
5750
|
+
id: 1,
|
|
5751
|
+
rev: "a"
|
|
5752
|
+
}, {
|
|
5753
|
+
id: 2,
|
|
5754
|
+
rev: "b"
|
|
5755
|
+
}]
|
|
5756
|
+
}],
|
|
5757
|
+
notes: [
|
|
5758
|
+
"Uses strict deep equality — 1 and \"1\" stay distinct",
|
|
5759
|
+
"First occurrence wins; order is preserved",
|
|
5760
|
+
"Null or empty input yields []"
|
|
5761
|
+
],
|
|
5762
|
+
seeAlso: ["group_by", "filter"]
|
|
5763
|
+
},
|
|
5764
|
+
ui: {
|
|
5765
|
+
icon: "list-filter",
|
|
5766
|
+
shortLabel: "distinct",
|
|
5767
|
+
nodeType: "operator"
|
|
5768
|
+
}
|
|
5596
5769
|
}
|
|
5597
5770
|
};
|
|
5598
5771
|
//#endregion
|
|
@@ -5609,6 +5782,152 @@ var arrayOperators = {
|
|
|
5609
5782
|
...arrayManipulationOperators
|
|
5610
5783
|
};
|
|
5611
5784
|
//#endregion
|
|
5785
|
+
//#region src/components/logic-editor/config/operators/object.ts
|
|
5786
|
+
var objectOperators = {
|
|
5787
|
+
keys: {
|
|
5788
|
+
name: "keys",
|
|
5789
|
+
label: "Keys",
|
|
5790
|
+
category: "object",
|
|
5791
|
+
description: "List an object's keys",
|
|
5792
|
+
arity: {
|
|
5793
|
+
type: "unary",
|
|
5794
|
+
args: [{
|
|
5795
|
+
name: "object",
|
|
5796
|
+
label: "Object",
|
|
5797
|
+
type: "any",
|
|
5798
|
+
required: true
|
|
5799
|
+
}]
|
|
5800
|
+
},
|
|
5801
|
+
help: {
|
|
5802
|
+
summary: "List an object's keys as an array of strings",
|
|
5803
|
+
details: "Returns the keys of the object in stored order. Null input yields an empty array; any other non-object input is an error.",
|
|
5804
|
+
returnType: "array",
|
|
5805
|
+
examples: [{
|
|
5806
|
+
title: "Keys of an object",
|
|
5807
|
+
rule: { keys: [{ var: "scores" }] },
|
|
5808
|
+
data: { scores: {
|
|
5809
|
+
alice: 10,
|
|
5810
|
+
bob: 7
|
|
5811
|
+
} },
|
|
5812
|
+
result: ["alice", "bob"]
|
|
5813
|
+
}],
|
|
5814
|
+
notes: ["Keys come out in stored order", "Null input yields []"],
|
|
5815
|
+
seeAlso: ["values", "entries"]
|
|
5816
|
+
},
|
|
5817
|
+
ui: {
|
|
5818
|
+
icon: "key-round",
|
|
5819
|
+
shortLabel: "keys",
|
|
5820
|
+
nodeType: "operator"
|
|
5821
|
+
}
|
|
5822
|
+
},
|
|
5823
|
+
values: {
|
|
5824
|
+
name: "values",
|
|
5825
|
+
label: "Values",
|
|
5826
|
+
category: "object",
|
|
5827
|
+
description: "List an object's values",
|
|
5828
|
+
arity: {
|
|
5829
|
+
type: "unary",
|
|
5830
|
+
args: [{
|
|
5831
|
+
name: "object",
|
|
5832
|
+
label: "Object",
|
|
5833
|
+
type: "any",
|
|
5834
|
+
required: true
|
|
5835
|
+
}]
|
|
5836
|
+
},
|
|
5837
|
+
help: {
|
|
5838
|
+
summary: "List an object's values as an array",
|
|
5839
|
+
details: "Returns the values of the object in stored order. Null input yields an empty array; any other non-object input is an error.",
|
|
5840
|
+
returnType: "array",
|
|
5841
|
+
examples: [{
|
|
5842
|
+
title: "Values of an object",
|
|
5843
|
+
rule: { values: [{ var: "scores" }] },
|
|
5844
|
+
data: { scores: {
|
|
5845
|
+
alice: 10,
|
|
5846
|
+
bob: 7
|
|
5847
|
+
} },
|
|
5848
|
+
result: [10, 7]
|
|
5849
|
+
}, {
|
|
5850
|
+
title: "Sum values",
|
|
5851
|
+
rule: { reduce: [
|
|
5852
|
+
{ values: [{ var: "scores" }] },
|
|
5853
|
+
{ "+": [{ var: "accumulator" }, { var: "current" }] },
|
|
5854
|
+
0
|
|
5855
|
+
] },
|
|
5856
|
+
data: { scores: {
|
|
5857
|
+
alice: 10,
|
|
5858
|
+
bob: 7
|
|
5859
|
+
} },
|
|
5860
|
+
result: 17
|
|
5861
|
+
}],
|
|
5862
|
+
notes: ["Values come out in stored order", "Null input yields []"],
|
|
5863
|
+
seeAlso: ["keys", "entries"]
|
|
5864
|
+
},
|
|
5865
|
+
ui: {
|
|
5866
|
+
icon: "list",
|
|
5867
|
+
shortLabel: "values",
|
|
5868
|
+
nodeType: "operator"
|
|
5869
|
+
}
|
|
5870
|
+
},
|
|
5871
|
+
entries: {
|
|
5872
|
+
name: "entries",
|
|
5873
|
+
label: "Entries",
|
|
5874
|
+
category: "object",
|
|
5875
|
+
description: "Turn an object into {key, value} rows",
|
|
5876
|
+
arity: {
|
|
5877
|
+
type: "unary",
|
|
5878
|
+
args: [{
|
|
5879
|
+
name: "object",
|
|
5880
|
+
label: "Object",
|
|
5881
|
+
type: "any",
|
|
5882
|
+
required: true
|
|
5883
|
+
}]
|
|
5884
|
+
},
|
|
5885
|
+
help: {
|
|
5886
|
+
summary: "Turn an object into an array of {key, value} rows",
|
|
5887
|
+
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.",
|
|
5888
|
+
returnType: "array",
|
|
5889
|
+
examples: [{
|
|
5890
|
+
title: "Entries of an object",
|
|
5891
|
+
rule: { entries: [{ var: "scores" }] },
|
|
5892
|
+
data: { scores: {
|
|
5893
|
+
alice: 10,
|
|
5894
|
+
bob: 7
|
|
5895
|
+
} },
|
|
5896
|
+
result: [{
|
|
5897
|
+
key: "alice",
|
|
5898
|
+
value: 10
|
|
5899
|
+
}, {
|
|
5900
|
+
key: "bob",
|
|
5901
|
+
value: 7
|
|
5902
|
+
}]
|
|
5903
|
+
}, {
|
|
5904
|
+
title: "Iterate with map",
|
|
5905
|
+
rule: { map: [{ entries: [{ var: "scores" }] }, { cat: [
|
|
5906
|
+
{ var: "key" },
|
|
5907
|
+
": ",
|
|
5908
|
+
{ var: "value" }
|
|
5909
|
+
] }] },
|
|
5910
|
+
data: { scores: {
|
|
5911
|
+
alice: 10,
|
|
5912
|
+
bob: 7
|
|
5913
|
+
} },
|
|
5914
|
+
result: ["alice: 10", "bob: 7"]
|
|
5915
|
+
}],
|
|
5916
|
+
notes: ["Rows come out in stored order", "Null input yields []"],
|
|
5917
|
+
seeAlso: [
|
|
5918
|
+
"keys",
|
|
5919
|
+
"values",
|
|
5920
|
+
"map"
|
|
5921
|
+
]
|
|
5922
|
+
},
|
|
5923
|
+
ui: {
|
|
5924
|
+
icon: "braces",
|
|
5925
|
+
shortLabel: "entries",
|
|
5926
|
+
nodeType: "operator"
|
|
5927
|
+
}
|
|
5928
|
+
}
|
|
5929
|
+
};
|
|
5930
|
+
//#endregion
|
|
5612
5931
|
//#region src/components/logic-editor/config/operators/datetime.ts
|
|
5613
5932
|
var datetimeOperators = {
|
|
5614
5933
|
datetime: {
|
|
@@ -6441,6 +6760,7 @@ var operators = {
|
|
|
6441
6760
|
...controlOperators,
|
|
6442
6761
|
...stringOperators,
|
|
6443
6762
|
...arrayOperators,
|
|
6763
|
+
...objectOperators,
|
|
6444
6764
|
...datetimeOperators,
|
|
6445
6765
|
...validationOperators,
|
|
6446
6766
|
...errorOperators,
|
|
@@ -7357,6 +7677,13 @@ var categories = {
|
|
|
7357
7677
|
color: "#7c3aed",
|
|
7358
7678
|
icon: "layers"
|
|
7359
7679
|
},
|
|
7680
|
+
object: {
|
|
7681
|
+
name: "object",
|
|
7682
|
+
label: "Object",
|
|
7683
|
+
description: "Object take-apart: keys, values, entries",
|
|
7684
|
+
color: "#a855f7",
|
|
7685
|
+
icon: "braces"
|
|
7686
|
+
},
|
|
7360
7687
|
datetime: {
|
|
7361
7688
|
name: "datetime",
|
|
7362
7689
|
label: "Date & Time",
|
|
@@ -13775,7 +14102,7 @@ function useWasmEvaluator(options = {}) {
|
|
|
13775
14102
|
try {
|
|
13776
14103
|
setLoading(true);
|
|
13777
14104
|
setError(null);
|
|
13778
|
-
const wasm = await import("./datalogic_wasm-
|
|
14105
|
+
const wasm = await import("./datalogic_wasm-CQhNPxpU.js");
|
|
13779
14106
|
await wasm.default();
|
|
13780
14107
|
if (!cancelled) {
|
|
13781
14108
|
moduleRef.current = {
|
|
@@ -17628,6 +17955,7 @@ var OPERATOR_CATEGORY_ORDER = [
|
|
|
17628
17955
|
"logical",
|
|
17629
17956
|
"string",
|
|
17630
17957
|
"array",
|
|
17958
|
+
"object",
|
|
17631
17959
|
"control",
|
|
17632
17960
|
"datetime",
|
|
17633
17961
|
"validation",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goplasmatic/datalogic-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "React rule builder, visual debugger, and editor for JSONLogic (json-logic) — flow-diagram view and live execution tracing, powered by the datalogic-rs WASM engine.",
|
|
7
7
|
"keywords": [
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@dagrejs/dagre": "^3.0.0",
|
|
75
75
|
"@fontsource/jetbrains-mono": "^5.2.8",
|
|
76
76
|
"@fontsource/space-grotesk": "^5.2.10",
|
|
77
|
-
"@goplasmatic/datalogic-wasm": "5.
|
|
77
|
+
"@goplasmatic/datalogic-wasm": "5.2.0",
|
|
78
78
|
"@msgpack/msgpack": "^3.1.3",
|
|
79
79
|
"fflate": "^0.8.3",
|
|
80
80
|
"lucide-react": "^1.23.0",
|