@digitalculture/ochre-sdk 0.18.4 → 0.18.5
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.d.mts +1 -0
- package/dist/index.mjs +12 -16
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -3708,14 +3708,15 @@ const propertyValueQueryItemSchema = z.object({
|
|
|
3708
3708
|
z.boolean()
|
|
3709
3709
|
]).optional().transform((val) => val ?? null)
|
|
3710
3710
|
}).transform((val) => {
|
|
3711
|
-
|
|
3711
|
+
const { identification, ...rest } = val;
|
|
3712
|
+
let value = { ...rest };
|
|
3712
3713
|
switch (val.dataType) {
|
|
3713
3714
|
case "IDREF":
|
|
3714
3715
|
case "string":
|
|
3715
3716
|
case "date":
|
|
3716
3717
|
case "dateTime":
|
|
3717
3718
|
value = {
|
|
3718
|
-
...
|
|
3719
|
+
...value,
|
|
3719
3720
|
content: val.content?.toString() ?? null
|
|
3720
3721
|
};
|
|
3721
3722
|
break;
|
|
@@ -3723,27 +3724,22 @@ const propertyValueQueryItemSchema = z.object({
|
|
|
3723
3724
|
case "decimal":
|
|
3724
3725
|
case "time":
|
|
3725
3726
|
value = {
|
|
3726
|
-
...
|
|
3727
|
+
...value,
|
|
3727
3728
|
content: val.content !== null ? Number(val.content) : null
|
|
3728
3729
|
};
|
|
3729
3730
|
break;
|
|
3730
3731
|
case "boolean":
|
|
3731
3732
|
value = {
|
|
3732
|
-
...
|
|
3733
|
+
...value,
|
|
3733
3734
|
content: val.content !== null ? Boolean(val.content) : null
|
|
3734
3735
|
};
|
|
3735
3736
|
break;
|
|
3736
|
-
default:
|
|
3737
|
-
value = val;
|
|
3738
|
-
break;
|
|
3739
|
-
}
|
|
3740
|
-
if ("identification" in value && value.identification != null) {
|
|
3741
|
-
const { identification, ...rest } = value;
|
|
3742
|
-
value = {
|
|
3743
|
-
...rest,
|
|
3744
|
-
content: parseStringContent({ content: identification.label.content })
|
|
3745
|
-
};
|
|
3737
|
+
default: break;
|
|
3746
3738
|
}
|
|
3739
|
+
if ("identification" in value && value.identification != null) value = {
|
|
3740
|
+
...value,
|
|
3741
|
+
content: identification?.label.content != null ? parseStringContent({ content: identification.label.content }) : null
|
|
3742
|
+
};
|
|
3747
3743
|
return value;
|
|
3748
3744
|
});
|
|
3749
3745
|
/**
|
|
@@ -3780,7 +3776,7 @@ function buildXQuery(params, options) {
|
|
|
3780
3776
|
let $matching-prop := ($props[value/@uuid = $val])[1]
|
|
3781
3777
|
let $count := count($uuid-values[@uuid = $val])
|
|
3782
3778
|
let $identification := $matching-prop/ancestor::*[parent::ochre]/identification
|
|
3783
|
-
let $label := $identification/label/content/string/text())
|
|
3779
|
+
let $label := string($identification/label/content/string/text())
|
|
3784
3780
|
order by $count descending, $label ascending
|
|
3785
3781
|
return <item count="{$count}" uuid="{$val}" dataType="{$uuid-dataType}">{$identification}</item>
|
|
3786
3782
|
|
|
@@ -3833,7 +3829,7 @@ async function fetchPropertyValuesByPropertyVariables(params, options) {
|
|
|
3833
3829
|
const parsedResultRaw = responseSchema.parse(data);
|
|
3834
3830
|
if (Array.isArray(parsedResultRaw.result)) throw new TypeError("No items found");
|
|
3835
3831
|
return {
|
|
3836
|
-
items: (Array.isArray(parsedResultRaw.result.ochre.item) ? parsedResultRaw.result.ochre.item : [parsedResultRaw.result.ochre.item]).filter((item) =>
|
|
3832
|
+
items: (Array.isArray(parsedResultRaw.result.ochre.item) ? parsedResultRaw.result.ochre.item : [parsedResultRaw.result.ochre.item]).filter((item) => item.content?.toString().trim() !== ""),
|
|
3837
3833
|
error: null
|
|
3838
3834
|
};
|
|
3839
3835
|
} catch (error) {
|
package/package.json
CHANGED