@startinblox/components-ds4go 4.1.0 → 4.1.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
|
@@ -8343,6 +8343,17 @@ let Et = class extends X {
|
|
|
8343
8343
|
console.error("Failed to load assets:", e);
|
|
8344
8344
|
}
|
|
8345
8345
|
}
|
|
8346
|
+
async getAsset(e) {
|
|
8347
|
+
if (!this.storeService) {
|
|
8348
|
+
console.error("Store not initialized. Check connector configuration.");
|
|
8349
|
+
return;
|
|
8350
|
+
}
|
|
8351
|
+
try {
|
|
8352
|
+
return await this.storeService.getAsset(e);
|
|
8353
|
+
} catch (t) {
|
|
8354
|
+
console.error("Failed to get asset:", t);
|
|
8355
|
+
}
|
|
8356
|
+
}
|
|
8346
8357
|
async createAsset(e) {
|
|
8347
8358
|
if (!this.storeService) return !1;
|
|
8348
8359
|
try {
|
|
@@ -9223,23 +9234,28 @@ let nt = class extends k {
|
|
|
9223
9234
|
await this.dspConnector.instance.loadAll();
|
|
9224
9235
|
const t = this.dspConnector.parameters["participant-id"];
|
|
9225
9236
|
if (t) {
|
|
9226
|
-
const i = this.dspConnector.instance.negotiations || [], r =
|
|
9237
|
+
const i = this.dspConnector.instance.negotiations || [], r = [];
|
|
9227
9238
|
await Promise.all(
|
|
9228
9239
|
i.map(async (c) => {
|
|
9229
9240
|
if (c.contractAgreementId) {
|
|
9230
9241
|
const u = await this.dspConnector?.instance?.loadAgreement(c["@id"]);
|
|
9231
|
-
u &&
|
|
9242
|
+
u && r.push(u);
|
|
9232
9243
|
}
|
|
9233
9244
|
})
|
|
9234
9245
|
);
|
|
9235
|
-
const
|
|
9246
|
+
const s = r.filter(
|
|
9236
9247
|
(c) => c.consumerId ? c.consumerId.split("/").pop()?.startsWith(t) : !1
|
|
9237
|
-
),
|
|
9238
|
-
for (const c of
|
|
9239
|
-
const
|
|
9240
|
-
|
|
9241
|
-
)
|
|
9242
|
-
|
|
9248
|
+
), o = [];
|
|
9249
|
+
for (const c of s) {
|
|
9250
|
+
const u = this.dspConnector?.instance?.getAsset(
|
|
9251
|
+
c.assetId
|
|
9252
|
+
);
|
|
9253
|
+
o.push(u);
|
|
9254
|
+
}
|
|
9255
|
+
const a = [];
|
|
9256
|
+
for (const c of await Promise.all(o)) {
|
|
9257
|
+
const u = c?.dataAddress?.baseUrl;
|
|
9258
|
+
u && a.push(this._getProxyValue(u));
|
|
9243
9259
|
}
|
|
9244
9260
|
const n = Array.from(
|
|
9245
9261
|
new Set(
|
|
@@ -9261,7 +9277,10 @@ let nt = class extends k {
|
|
|
9261
9277
|
expand: !0,
|
|
9262
9278
|
cast: async (u) => await Promise.all(
|
|
9263
9279
|
(await u._originalResource?.["ldp:contains"]).map(
|
|
9264
|
-
async (m) => ({
|
|
9280
|
+
async (m) => ({
|
|
9281
|
+
"@id": m["@id"],
|
|
9282
|
+
name: pt(await m.name || "")
|
|
9283
|
+
})
|
|
9265
9284
|
)
|
|
9266
9285
|
)
|
|
9267
9286
|
},
|
package/package.json
CHANGED
|
@@ -77,6 +77,19 @@ export class SolidDspConnector extends OrbitDSPComponent {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
public async getAsset(assetId: string): Promise<Asset | undefined> {
|
|
81
|
+
if (!this.storeService) {
|
|
82
|
+
console.error("Store not initialized. Check connector configuration.");
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
return await this.storeService.getAsset(assetId);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
console.error("Failed to get asset:", e);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
80
93
|
public async createAsset(assetData: AssetInput) {
|
|
81
94
|
if (!this.storeService) return false;
|
|
82
95
|
|
|
@@ -95,10 +95,6 @@ export class SolidFactList extends OrbitComponent {
|
|
|
95
95
|
if (participantId) {
|
|
96
96
|
// Load agreements for all negotiations to find consumer/provider relationships
|
|
97
97
|
const allNegotiations = this.dspConnector.instance.negotiations || [];
|
|
98
|
-
const negotiationToAgreementMap = new Map<
|
|
99
|
-
string,
|
|
100
|
-
ContractAgreement
|
|
101
|
-
>();
|
|
102
98
|
|
|
103
99
|
const allAgreements: ContractAgreement[] = [];
|
|
104
100
|
|
|
@@ -109,7 +105,6 @@ export class SolidFactList extends OrbitComponent {
|
|
|
109
105
|
await this.dspConnector?.instance?.loadAgreement(n["@id"]);
|
|
110
106
|
if (agreement) {
|
|
111
107
|
allAgreements.push(agreement);
|
|
112
|
-
negotiationToAgreementMap.set(n["@id"], agreement);
|
|
113
108
|
}
|
|
114
109
|
}
|
|
115
110
|
}),
|
|
@@ -123,16 +118,22 @@ export class SolidFactList extends OrbitComponent {
|
|
|
123
118
|
},
|
|
124
119
|
);
|
|
125
120
|
|
|
126
|
-
const
|
|
121
|
+
const assets: Asset[] = [];
|
|
127
122
|
for (const agreement of consumerAgreements) {
|
|
128
|
-
const asset = this.dspConnector?.instance?.
|
|
129
|
-
|
|
123
|
+
const asset = this.dspConnector?.instance?.getAsset(
|
|
124
|
+
agreement.assetId,
|
|
130
125
|
);
|
|
126
|
+
assets.push(asset);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const bundles = [];
|
|
130
|
+
for (const asset of await Promise.all(assets)) {
|
|
131
131
|
const bundleUrl = asset?.dataAddress?.baseUrl;
|
|
132
132
|
if (bundleUrl) {
|
|
133
133
|
bundles.push(this._getProxyValue(bundleUrl));
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
+
|
|
136
137
|
const facts = Array.from(
|
|
137
138
|
new Set(
|
|
138
139
|
(await Promise.all(bundles))
|
|
@@ -158,7 +159,10 @@ export class SolidFactList extends OrbitComponent {
|
|
|
158
159
|
cast: async (c: Resource) =>
|
|
159
160
|
await Promise.all(
|
|
160
161
|
(await c._originalResource?.["ldp:contains"]).map(
|
|
161
|
-
async (c: Category) => ({
|
|
162
|
+
async (c: Category) => ({
|
|
163
|
+
"@id": c["@id"],
|
|
164
|
+
name: formatCase((await c["name"]) || ""),
|
|
165
|
+
}),
|
|
162
166
|
),
|
|
163
167
|
),
|
|
164
168
|
},
|