@narrative.io/data-collaboration-sdk-ts 2.95.0-beta.3 → 2.95.0-beta.4
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.
|
@@ -33,13 +33,9 @@ function collectFiltersForAttributes(requiredAttrs, propertyDefs) {
|
|
|
33
33
|
* the required data subfields that should generate IS NOT NULL WHERE clauses.
|
|
34
34
|
*
|
|
35
35
|
* Only object-type `$defs` (where `properties.type.const === "object"`) have
|
|
36
|
-
* data subfields.
|
|
37
|
-
* `properties.
|
|
38
|
-
*
|
|
39
|
-
* Note: the top-level `required` array on an object-type $def (typically
|
|
40
|
-
* `["type", "properties"]`) describes the schema's structural envelope —
|
|
41
|
-
* `"type"` there is the meta-schema discriminator (`{const: "object"}`),
|
|
42
|
-
* not a Rosetta Stone data column — so it must not be emitted as a subfield.
|
|
36
|
+
* data subfields. For these:
|
|
37
|
+
* - Top-level `required` entries (excluding "properties") map to data subfields (e.g., "type")
|
|
38
|
+
* - Inner `properties.properties.required` entries map to nested data subfields (e.g., "value")
|
|
43
39
|
*
|
|
44
40
|
* Primitive types (like `string_value_type`) return no subfields.
|
|
45
41
|
*
|
|
@@ -61,11 +57,25 @@ function resolveRefRequiredSubfields(propDef, defs) {
|
|
|
61
57
|
const typeProperty = defProperties.type;
|
|
62
58
|
if (typeProperty?.const !== "object")
|
|
63
59
|
return [];
|
|
60
|
+
const subfields = [];
|
|
61
|
+
// Top-level required, minus "properties" (structural wrapper)
|
|
62
|
+
const topRequired = def.required;
|
|
63
|
+
if (topRequired) {
|
|
64
|
+
for (const field of topRequired) {
|
|
65
|
+
if (field !== "properties")
|
|
66
|
+
subfields.push(field);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Inner properties.properties.required
|
|
64
70
|
const innerProps = defProperties.properties;
|
|
65
71
|
const innerRequired = innerProps?.required;
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
if (innerRequired) {
|
|
73
|
+
for (const field of innerRequired) {
|
|
74
|
+
if (!subfields.includes(field))
|
|
75
|
+
subfields.push(field);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return subfields;
|
|
69
79
|
}
|
|
70
80
|
/**
|
|
71
81
|
* Collect required data subfields for a list of attribute names by resolving
|