@startinblox/components-ds4go 4.1.1 → 4.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/components-ds4go",
3
- "version": "4.1.1",
3
+ "version": "4.1.2",
4
4
  "description": "Startin'blox DS4GO",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -74,6 +74,8 @@ export class SolidFactList extends OrbitComponent {
74
74
  return Promise.resolve();
75
75
  }
76
76
 
77
+ assetData: Asset[] = [];
78
+
77
79
  _getResource = new Task(this, {
78
80
  task: async ([objSrc]) => {
79
81
  if (
@@ -118,16 +120,30 @@ export class SolidFactList extends OrbitComponent {
118
120
  },
119
121
  );
120
122
 
121
- const assets: Asset[] = [];
123
+ // Let's get dirty, my connector does not know the asset, so I'll call provider directly
124
+ const assets: Promise<Response>[] = [];
122
125
  for (const agreement of consumerAgreements) {
123
- const asset = this.dspConnector?.instance?.getAsset(
124
- agreement.assetId,
125
- );
126
- assets.push(asset);
126
+ if (
127
+ !this.assetData.find(
128
+ (asset) => asset["@id"] === agreement.assetId,
129
+ )
130
+ ) {
131
+ assets.push(
132
+ fetch(
133
+ `https://afp.connector-dev.startinblox.com/management/v3/assets/${agreement.assetId}`,
134
+ ),
135
+ );
136
+ }
127
137
  }
128
138
 
139
+ const assetResponses = await Promise.all(assets);
140
+ this.assetData = [
141
+ ...this.assetData,
142
+ ...(await Promise.all(assetResponses.map((r) => r.json()))),
143
+ ];
144
+
129
145
  const bundles = [];
130
- for (const asset of await Promise.all(assets)) {
146
+ for (const asset of this.assetData) {
131
147
  const bundleUrl = asset?.dataAddress?.baseUrl;
132
148
  if (bundleUrl) {
133
149
  bundles.push(this._getProxyValue(bundleUrl));