@startinblox/components-ds4go 3.3.0 → 3.3.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.
package/dist/index.js CHANGED
@@ -8972,24 +8972,18 @@ let Ce = class extends re {
8972
8972
  constructor() {
8973
8973
  super(), this.header = "DSP Catalog", this.search = [], this.resultCount = this.objects?.length || 0, this._getResource = new be(this, {
8974
8974
  task: async ([t]) => {
8975
- if (!this.orbit || !this.noRouter && this.route && this.currentRoute && !this.route.startsWith(this.currentRoute))
8976
- return;
8977
- (!this.providers || this.providers.length === 0) && this.component?.parameters?.providers && (this.providers = this.component.parameters.providers);
8978
- let e;
8979
- if (this.dspConnector?.instance)
8980
- await this.dspConnector.instance.loadAll(), e = this.dspConnector.instance.datas;
8981
- else {
8982
- const i = () => {
8983
- this.caching++, this.requestUpdate(), document.removeEventListener("dsp-connector-ready", i);
8984
- };
8985
- document.addEventListener("dsp-connector-ready", i);
8986
- return;
8975
+ if (!(!this.orbit || !this.noRouter && this.route && this.currentRoute && !this.route.startsWith(this.currentRoute))) {
8976
+ if (this.dspConnector?.instance)
8977
+ await this.dspConnector.instance.loadAll(), this.datas = this.dspConnector.instance.datas, this.providers = this.dspConnector.instance.providers;
8978
+ else {
8979
+ const e = () => {
8980
+ this.caching++, this.requestUpdate(), document.removeEventListener("dsp-connector-ready", e);
8981
+ };
8982
+ document.addEventListener("dsp-connector-ready", e);
8983
+ return;
8984
+ }
8985
+ return t ? this.object = this.datas.find((e) => e["@id"] === t) : this.object = void 0, this.datas;
8987
8986
  }
8988
- return e !== void 0 && Array.isArray(e) && (this.datas = await Promise.all(
8989
- e.map(
8990
- async (i) => await this._responseAdaptator(i)
8991
- )
8992
- )), t ? this.object = this.datas.find((i) => i["@id"] === t) : this.object = void 0, this.datas;
8993
8987
  },
8994
8988
  args: () => [this.dataSrc, this.caching, this.currentRoute]
8995
8989
  }), di(this, {
@@ -9001,19 +8995,6 @@ let Ce = class extends re {
9001
8995
  (t) => t.type === "dsp-connector"
9002
8996
  ), Promise.resolve();
9003
8997
  }
9004
- async _responseAdaptator(t) {
9005
- return t.images && (Array.isArray(t.images) || (t.images = t.images["ldp:contains"]?.filter(
9006
- (e) => e
9007
- ) || [t.images])), t.providers ? Array.isArray(t.providers) || (t.providers = [t.providers].filter((e) => e)) : t.provider && (t.providers = [t.provider].filter((e) => e)), t._provider && (t.providers = [
9008
- {
9009
- name: t._provider,
9010
- "@id": t._providerAddress,
9011
- color: t._providerColor
9012
- }
9013
- ]), t.categories && (Array.isArray(t.categories) || (t.categories = t.categories["ldp:contains"]?.filter(
9014
- (e) => e
9015
- ) || [t.categories])), t["dcterms:title"] && !t.name && (t.name = t["dcterms:title"]), t["dcterms:description"] && !t.description && (t.description = t["dcterms:description"]), t;
9016
- }
9017
8998
  _search(t) {
9018
8999
  t.preventDefault(), this.search = t.detail, this.filterCount = this.search.filter((e) => e.name !== "search").length;
9019
9000
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/components-ds4go",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "Startin'blox DS4GO",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -64,53 +64,6 @@ export class DSPCatalog extends OrbitDSPComponent {
64
64
  return Promise.resolve();
65
65
  }
66
66
 
67
- async _responseAdaptator(response: Resource): Promise<Resource> {
68
- if (response.images) {
69
- if (!Array.isArray(response.images)) {
70
- response.images = response.images["ldp:contains"]?.filter(
71
- (i: any) => i,
72
- ) || [response.images];
73
- }
74
- }
75
-
76
- if (response.providers) {
77
- if (!Array.isArray(response.providers)) {
78
- response.providers = [response.providers].filter((i: any) => i);
79
- }
80
- } else if (response.provider) {
81
- response.providers = [response.provider].filter((i: any) => i);
82
- }
83
-
84
- // Map DSP provider metadata to standard format
85
- if (response._provider) {
86
- response.providers = [
87
- {
88
- name: response._provider,
89
- "@id": response._providerAddress,
90
- color: response._providerColor,
91
- },
92
- ];
93
- }
94
-
95
- if (response.categories) {
96
- if (!Array.isArray(response.categories)) {
97
- response.categories = response.categories["ldp:contains"]?.filter(
98
- (i: any) => i,
99
- ) || [response.categories];
100
- }
101
- }
102
-
103
- // Map DSP dataset fields to TEMS format
104
- if (response["dcterms:title"] && !response.name) {
105
- response.name = response["dcterms:title"];
106
- }
107
- if (response["dcterms:description"] && !response.description) {
108
- response.description = response["dcterms:description"];
109
- }
110
-
111
- return response;
112
- }
113
-
114
67
  _getResource = new Task(this, {
115
68
  task: async ([objSrc]) => {
116
69
  if (
@@ -122,18 +75,10 @@ export class DSPCatalog extends OrbitDSPComponent {
122
75
  )
123
76
  return;
124
77
 
125
- // Initialize providers from component parameters if not already set
126
- if (
127
- (!this.providers || this.providers.length === 0) &&
128
- this.component?.parameters?.providers
129
- ) {
130
- this.providers = this.component.parameters.providers;
131
- }
132
-
133
- let datasets: Resource[] | undefined;
134
78
  if (this.dspConnector?.instance) {
135
79
  await this.dspConnector.instance.loadAll();
136
- datasets = this.dspConnector.instance.datas;
80
+ this.datas = this.dspConnector.instance.datas;
81
+ this.providers = this.dspConnector.instance.providers;
137
82
  } else {
138
83
  const listener = () => {
139
84
  this.caching++;
@@ -144,15 +89,6 @@ export class DSPCatalog extends OrbitDSPComponent {
144
89
  return;
145
90
  }
146
91
 
147
- if (datasets !== undefined && Array.isArray(datasets)) {
148
- // Process each dataset through the response adaptator
149
- this.datas = await Promise.all(
150
- datasets.map(
151
- async (dataset) => await this._responseAdaptator(dataset),
152
- ),
153
- );
154
- }
155
-
156
92
  if (objSrc) {
157
93
  this.object = this.datas.find((obj: Resource) => obj["@id"] === objSrc);
158
94
  } else {