convention_builder 1.2.1 → 1.2.2
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/module/index.js +25 -3
- package/dist/node/index.js +25 -3
- package/package.json +1 -1
package/dist/module/index.js
CHANGED
|
@@ -8825,16 +8825,16 @@ var require_schema_utilities = __commonJS({
|
|
|
8825
8825
|
let secondToLastAttr = attributes[attributes.length - 2];
|
|
8826
8826
|
return secondToLastAttr == "properties";
|
|
8827
8827
|
});
|
|
8828
|
-
let
|
|
8828
|
+
let attributesTable = dataAttributes.map((attr) => {
|
|
8829
8829
|
let isRequired = checkRequiredInSchema(attr, schema);
|
|
8830
8830
|
let entry = {
|
|
8831
8831
|
path: attr,
|
|
8832
8832
|
path_simplified: attr.replace(/\.properties/g, "").replace(/properties\./, ""),
|
|
8833
|
-
name: attr.match(/[a-zA-
|
|
8833
|
+
name: attr.match(/[a-zA-Z_]*$/)[0],
|
|
8834
8834
|
required: isRequired
|
|
8835
8835
|
};
|
|
8836
8836
|
if (isConvention) {
|
|
8837
|
-
entry.overlay = entry.path_simplified.match(/[a-zA-Z-]*/)[0];
|
|
8837
|
+
entry.overlay = entry.path_simplified.match(/[a-zA-Z-_]*/)[0];
|
|
8838
8838
|
}
|
|
8839
8839
|
;
|
|
8840
8840
|
allFlattenedPaths.filter((d) => d.path.includes(`${attr}.`)).forEach((d) => {
|
|
@@ -8844,6 +8844,28 @@ var require_schema_utilities = __commonJS({
|
|
|
8844
8844
|
});
|
|
8845
8845
|
return entry;
|
|
8846
8846
|
});
|
|
8847
|
+
let relationshipPaths = allFlattenedPaths.filter((d) => d.path.includes(".relationships.")).map((d) => d.path).filter((d) => /\.data.type$/.test(d)).map((d) => d.replace(/\.properties.data.type$/, ""));
|
|
8848
|
+
let relationshipsTable = relationshipPaths.map((rel) => {
|
|
8849
|
+
let entry = {
|
|
8850
|
+
path: rel,
|
|
8851
|
+
path_simplified: rel.replace(/\.properties/g, "").replace(/properties\./, ""),
|
|
8852
|
+
name: rel.match(/[a-zA-Z]*$/)[0]
|
|
8853
|
+
};
|
|
8854
|
+
if (isConvention) {
|
|
8855
|
+
entry.overlay = entry.path_simplified.match(/[a-zA-Z-_]*/)[0];
|
|
8856
|
+
let relatedDataPaths = dig(
|
|
8857
|
+
schema,
|
|
8858
|
+
`${rel}.properties.data.contains.anyOf`
|
|
8859
|
+
);
|
|
8860
|
+
entry.convention_data_targets = relatedDataPaths ? relatedDataPaths.map((d) => d.properties.id.const.$data) : [];
|
|
8861
|
+
}
|
|
8862
|
+
;
|
|
8863
|
+
return entry;
|
|
8864
|
+
});
|
|
8865
|
+
let table = [
|
|
8866
|
+
...attributesTable,
|
|
8867
|
+
...relationshipsTable
|
|
8868
|
+
];
|
|
8847
8869
|
return table;
|
|
8848
8870
|
}
|
|
8849
8871
|
__name(flattenJSONSchema, "flattenJSONSchema");
|
package/dist/node/index.js
CHANGED
|
@@ -8818,16 +8818,16 @@ var require_schema_utilities = __commonJS({
|
|
|
8818
8818
|
let secondToLastAttr = attributes[attributes.length - 2];
|
|
8819
8819
|
return secondToLastAttr == "properties";
|
|
8820
8820
|
});
|
|
8821
|
-
let
|
|
8821
|
+
let attributesTable = dataAttributes.map((attr) => {
|
|
8822
8822
|
let isRequired = checkRequiredInSchema(attr, schema);
|
|
8823
8823
|
let entry = {
|
|
8824
8824
|
path: attr,
|
|
8825
8825
|
path_simplified: attr.replace(/\.properties/g, "").replace(/properties\./, ""),
|
|
8826
|
-
name: attr.match(/[a-zA-
|
|
8826
|
+
name: attr.match(/[a-zA-Z_]*$/)[0],
|
|
8827
8827
|
required: isRequired
|
|
8828
8828
|
};
|
|
8829
8829
|
if (isConvention) {
|
|
8830
|
-
entry.overlay = entry.path_simplified.match(/[a-zA-Z-]*/)[0];
|
|
8830
|
+
entry.overlay = entry.path_simplified.match(/[a-zA-Z-_]*/)[0];
|
|
8831
8831
|
}
|
|
8832
8832
|
;
|
|
8833
8833
|
allFlattenedPaths.filter((d) => d.path.includes(`${attr}.`)).forEach((d) => {
|
|
@@ -8837,6 +8837,28 @@ var require_schema_utilities = __commonJS({
|
|
|
8837
8837
|
});
|
|
8838
8838
|
return entry;
|
|
8839
8839
|
});
|
|
8840
|
+
let relationshipPaths = allFlattenedPaths.filter((d) => d.path.includes(".relationships.")).map((d) => d.path).filter((d) => /\.data.type$/.test(d)).map((d) => d.replace(/\.properties.data.type$/, ""));
|
|
8841
|
+
let relationshipsTable = relationshipPaths.map((rel) => {
|
|
8842
|
+
let entry = {
|
|
8843
|
+
path: rel,
|
|
8844
|
+
path_simplified: rel.replace(/\.properties/g, "").replace(/properties\./, ""),
|
|
8845
|
+
name: rel.match(/[a-zA-Z]*$/)[0]
|
|
8846
|
+
};
|
|
8847
|
+
if (isConvention) {
|
|
8848
|
+
entry.overlay = entry.path_simplified.match(/[a-zA-Z-_]*/)[0];
|
|
8849
|
+
let relatedDataPaths = dig(
|
|
8850
|
+
schema,
|
|
8851
|
+
`${rel}.properties.data.contains.anyOf`
|
|
8852
|
+
);
|
|
8853
|
+
entry.convention_data_targets = relatedDataPaths ? relatedDataPaths.map((d) => d.properties.id.const.$data) : [];
|
|
8854
|
+
}
|
|
8855
|
+
;
|
|
8856
|
+
return entry;
|
|
8857
|
+
});
|
|
8858
|
+
let table = [
|
|
8859
|
+
...attributesTable,
|
|
8860
|
+
...relationshipsTable
|
|
8861
|
+
];
|
|
8840
8862
|
return table;
|
|
8841
8863
|
}
|
|
8842
8864
|
__name(flattenJSONSchema, "flattenJSONSchema");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "convention_builder",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Helper tools that offer a high level interface that transforms a convention description into it's json schema.",
|
|
5
5
|
"main": "./dist/node/index.js",
|
|
6
6
|
"browser": "./dist/browser/index.js",
|