@startinblox/core 0.19.6 → 0.19.7-beta.1
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.
|
@@ -1518,6 +1518,8 @@ const compare = {
|
|
|
1518
1518
|
return (range[0] == null || range[0] === "" || subject >= range[0]) && (range[1] == null || range[1] === "" || subject <= range[1]);
|
|
1519
1519
|
},
|
|
1520
1520
|
resource(subject, query) {
|
|
1521
|
+
if (!subject || !subject["@id"])
|
|
1522
|
+
return false;
|
|
1521
1523
|
if (query === "")
|
|
1522
1524
|
return true;
|
|
1523
1525
|
if (!query["@id"])
|
package/dist/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, m, n, c, A as A2, d, k, e, a, f, g, i, j, l, p, s, b, t, u } from "./helpers-
|
|
1
|
+
import { A, m, n, c, A as A2, d, k, e, a, f, g, i, j, l, p, s, b, t, u } from "./helpers-1iYMzEUk.js";
|
|
2
2
|
export {
|
|
3
3
|
A as AsyncIterableBuilder,
|
|
4
4
|
m as asyncQuerySelector,
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as defineComponent, u as uniqID, i as importInlineCSS, f as fuzzyCompare, p as parseFieldsString, a as findClosingBracketMatchIndex, c as compare, e as evalTemplateString, s as setDeepProperty, t as transformArrayToContainer } from "./helpers-
|
|
2
|
-
import { h } from "./helpers-
|
|
1
|
+
import { d as defineComponent, u as uniqID, i as importInlineCSS, f as fuzzyCompare, p as parseFieldsString, a as findClosingBracketMatchIndex, c as compare, e as evalTemplateString, s as setDeepProperty, t as transformArrayToContainer } from "./helpers-1iYMzEUk.js";
|
|
2
|
+
import { h } from "./helpers-1iYMzEUk.js";
|
|
3
3
|
import PubSub$1 from "https://cdn.skypack.dev/pubsub-js";
|
|
4
4
|
import L from "https://cdn.skypack.dev/leaflet";
|
|
5
5
|
import "https://cdn.skypack.dev/leaflet.markercluster";
|
|
@@ -11000,6 +11000,8 @@ class CustomGetter {
|
|
|
11000
11000
|
return value ? value : void 0;
|
|
11001
11001
|
}
|
|
11002
11002
|
} catch (e) {
|
|
11003
|
+
if (!path.split)
|
|
11004
|
+
return void 0;
|
|
11003
11005
|
const path1 = path.split(".");
|
|
11004
11006
|
const path2 = [];
|
|
11005
11007
|
let value;
|
|
@@ -11007,11 +11009,7 @@ class CustomGetter {
|
|
|
11007
11009
|
await this.getResource(this.resourceId, { ...this.clientContext, ...this.serverContext }, this.parentId);
|
|
11008
11010
|
}
|
|
11009
11011
|
while (true) {
|
|
11010
|
-
|
|
11011
|
-
value = this.resource[this.getExpandedPredicate(path1[0])];
|
|
11012
|
-
} catch (e2) {
|
|
11013
|
-
break;
|
|
11014
|
-
}
|
|
11012
|
+
value = await this.resource[this.getExpandedPredicate(path1[0])];
|
|
11015
11013
|
if (path1.length <= 1)
|
|
11016
11014
|
break;
|
|
11017
11015
|
const lastPath1El = path1.pop();
|
|
@@ -11023,7 +11021,7 @@ class CustomGetter {
|
|
|
11023
11021
|
return this.getLiteralValue(value);
|
|
11024
11022
|
return await this.getResource(value["@id"], { ...this.clientContext, ...this.serverContext }, this.parentId || this.resourceId);
|
|
11025
11023
|
}
|
|
11026
|
-
if (!value)
|
|
11024
|
+
if (!value || !value["@id"])
|
|
11027
11025
|
return void 0;
|
|
11028
11026
|
let resource = await this.getResource(value["@id"], { ...this.clientContext, ...this.serverContext }, this.parentId || this.resourceId);
|
|
11029
11027
|
store.subscribeResourceTo(this.resourceId, value["@id"]);
|
|
@@ -51700,6 +51698,15 @@ const matchValue = async (val, query, throwOn) => {
|
|
|
51700
51698
|
return orThrow(throwOn, true);
|
|
51701
51699
|
}
|
|
51702
51700
|
return orThrow(throwOn, await ret);
|
|
51701
|
+
} else if (Array.isArray(subject)) {
|
|
51702
|
+
let ret = Promise.resolve(query.value === "");
|
|
51703
|
+
for (const value of subject) {
|
|
51704
|
+
ret = await ret || await matchValue(value, query);
|
|
51705
|
+
if (ret) {
|
|
51706
|
+
return true;
|
|
51707
|
+
}
|
|
51708
|
+
}
|
|
51709
|
+
return orThrow(throwOn, await ret);
|
|
51703
51710
|
}
|
|
51704
51711
|
return orThrow(throwOn, compare[query.type](subject, query.value));
|
|
51705
51712
|
};
|
|
@@ -51711,6 +51718,47 @@ const cacheFieldsProps = (cacheKey, filter, fields, searchForm) => {
|
|
|
51711
51718
|
};
|
|
51712
51719
|
}
|
|
51713
51720
|
};
|
|
51721
|
+
const traversePath = async (resource, path, targetedType) => {
|
|
51722
|
+
var _a, _b;
|
|
51723
|
+
let result = [];
|
|
51724
|
+
let currentRes;
|
|
51725
|
+
let remainingPath = path;
|
|
51726
|
+
if (!path.length)
|
|
51727
|
+
return [];
|
|
51728
|
+
try {
|
|
51729
|
+
currentRes = await resource[path[0]];
|
|
51730
|
+
const lastPath1El = path.shift();
|
|
51731
|
+
if (lastPath1El)
|
|
51732
|
+
remainingPath = path;
|
|
51733
|
+
if (currentRes && ((_a = currentRes.isContainer) == null ? void 0 : _a.call(currentRes)) && remainingPath.length > 1) {
|
|
51734
|
+
result = await traversePath(currentRes, remainingPath, targetedType);
|
|
51735
|
+
} else if (currentRes && Array.isArray(currentRes)) {
|
|
51736
|
+
for (const res of currentRes) {
|
|
51737
|
+
if (remainingPath.length > 1) {
|
|
51738
|
+
result = await traversePath(res, remainingPath, targetedType);
|
|
51739
|
+
} else {
|
|
51740
|
+
let targetsRes = await res[remainingPath[0]];
|
|
51741
|
+
if (!targetsRes)
|
|
51742
|
+
return [];
|
|
51743
|
+
if ((_b = targetsRes.isContainer) == null ? void 0 : _b.call(targetsRes)) {
|
|
51744
|
+
targetsRes = targetsRes["ldp:contains"];
|
|
51745
|
+
}
|
|
51746
|
+
if (!Array.isArray(targetsRes))
|
|
51747
|
+
targetsRes = [targetsRes];
|
|
51748
|
+
for (const targetRes of targetsRes) {
|
|
51749
|
+
if (!result.some((item2) => item2["@id"] === targetRes["@id"])) {
|
|
51750
|
+
result.push({ "@id": targetRes["@id"] });
|
|
51751
|
+
}
|
|
51752
|
+
}
|
|
51753
|
+
}
|
|
51754
|
+
}
|
|
51755
|
+
}
|
|
51756
|
+
} catch (e) {
|
|
51757
|
+
console.error(e);
|
|
51758
|
+
return [];
|
|
51759
|
+
}
|
|
51760
|
+
return result;
|
|
51761
|
+
};
|
|
51714
51762
|
const matchFilter = async (resource, filter, query, fieldsAttr, searchForm, filterId, throwOn) => {
|
|
51715
51763
|
let fields = null;
|
|
51716
51764
|
const cacheKey = `${filter}_${filterId}`;
|
|
@@ -51720,6 +51768,16 @@ const matchFilter = async (resource, filter, query, fieldsAttr, searchForm, filt
|
|
|
51720
51768
|
} else if (window.cachePropsSearchFilter[cacheKey].setSearchFields !== null) {
|
|
51721
51769
|
fields = window.cachePropsSearchFilter[cacheKey].setSearchFields;
|
|
51722
51770
|
} else {
|
|
51771
|
+
if (!await resource[filter] && filter.includes("ldp:contains")) {
|
|
51772
|
+
const path1 = filter.split(".");
|
|
51773
|
+
const targetedType = path1[path1.length - 1];
|
|
51774
|
+
let targetIds = [];
|
|
51775
|
+
targetIds = await traversePath(resource, path1, targetedType);
|
|
51776
|
+
if (!Array.isArray(targetIds) || targetIds.length === 0 && query.value !== "") {
|
|
51777
|
+
throw throwOn ? false : true;
|
|
51778
|
+
}
|
|
51779
|
+
return await matchValue(targetIds, query, throwOn);
|
|
51780
|
+
}
|
|
51723
51781
|
return matchValue(resource[filter], query, throwOn);
|
|
51724
51782
|
}
|
|
51725
51783
|
try {
|
|
@@ -51742,8 +51800,8 @@ const matchFilter = async (resource, filter, query, fieldsAttr, searchForm, filt
|
|
|
51742
51800
|
};
|
|
51743
51801
|
const matchFilters = async (resource, filters, filterNames, fields, searchForm, filterId) => {
|
|
51744
51802
|
try {
|
|
51745
|
-
await Promise.all(filterNames.map(
|
|
51746
|
-
|
|
51803
|
+
await Promise.all(filterNames.map(async (filter) => {
|
|
51804
|
+
let match3 = await matchFilter(
|
|
51747
51805
|
resource,
|
|
51748
51806
|
filter,
|
|
51749
51807
|
filters[filter],
|
|
@@ -51752,8 +51810,9 @@ const matchFilters = async (resource, filters, filterNames, fields, searchForm,
|
|
|
51752
51810
|
filterId,
|
|
51753
51811
|
false
|
|
51754
51812
|
// stop searching when 1 filter is false (= AND)
|
|
51755
|
-
)
|
|
51756
|
-
|
|
51813
|
+
);
|
|
51814
|
+
return match3;
|
|
51815
|
+
}));
|
|
51757
51816
|
} catch (e) {
|
|
51758
51817
|
return false;
|
|
51759
51818
|
}
|
|
@@ -51763,16 +51822,17 @@ const searchInResources = async (resources, filters, fields, searchForm) => {
|
|
|
51763
51822
|
const filterNames = Object.keys(filters);
|
|
51764
51823
|
const filterId = uniqID();
|
|
51765
51824
|
window.cachePropsSearchFilter = {};
|
|
51766
|
-
return Promise.all(resources.map(
|
|
51767
|
-
|
|
51825
|
+
return Promise.all(resources.map(async (resource) => {
|
|
51826
|
+
let match3 = await matchFilters(
|
|
51768
51827
|
resource,
|
|
51769
51828
|
filters,
|
|
51770
51829
|
filterNames,
|
|
51771
51830
|
fields,
|
|
51772
51831
|
searchForm,
|
|
51773
51832
|
filterId
|
|
51774
|
-
)
|
|
51775
|
-
|
|
51833
|
+
);
|
|
51834
|
+
return match3;
|
|
51835
|
+
}));
|
|
51776
51836
|
};
|
|
51777
51837
|
const FilterMixin = {
|
|
51778
51838
|
name: "filter-mixin",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startinblox/core",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.7-beta.1",
|
|
4
4
|
"description": "This is a series of web component respecting both the web components standards and the Linked Data Platform convention.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|