@sprucelabs/spruce-heartwood-utils 10.2.49 → 10.3.0
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.
|
@@ -18,6 +18,7 @@ Name extends EventNames<Contract> = EventNames<Contract>> {
|
|
|
18
18
|
fetch(
|
|
19
19
|
/** @ts-ignore */
|
|
20
20
|
options?: CardFetchOptions<Contract, Name>): Promise<AbstractViewController<Card>[]>;
|
|
21
|
+
private ErrorCardVc;
|
|
21
22
|
}
|
|
22
23
|
declare type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
23
24
|
declare type ResponsePayload<Contract extends EventContract, Name extends EventNames<Contract>> = Contract['eventSignatures'][Name]['responsePayloadSchema'] extends Schema ? SchemaValues<Contract['eventSignatures'][Name]['responsePayloadSchema']> : never;
|
|
@@ -52,8 +52,11 @@ export default class CardRegistrar {
|
|
|
52
52
|
yield this.client.emit(this.eventName, targetAndPayload, (targetAndPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
53
53
|
var _a;
|
|
54
54
|
const { payload, errors } = targetAndPayload !== null && targetAndPayload !== void 0 ? targetAndPayload : {};
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const err = errors === null || errors === void 0 ? void 0 : errors[0];
|
|
56
|
+
if (err) {
|
|
57
|
+
console.error('Remote card error', err);
|
|
58
|
+
cards.push(this.ErrorCardVc(err));
|
|
59
|
+
return;
|
|
57
60
|
}
|
|
58
61
|
const vcIds = payload ? this.vcIdsTransformer(payload) : [];
|
|
59
62
|
if (!Array.isArray(vcIds)) {
|
|
@@ -78,12 +81,13 @@ export default class CardRegistrar {
|
|
|
78
81
|
}
|
|
79
82
|
catch (err) {
|
|
80
83
|
console.error(err);
|
|
81
|
-
return [
|
|
82
|
-
this.remoteVcFactory.Controller('heartwood.error-card', {
|
|
83
|
-
error: err,
|
|
84
|
-
}),
|
|
85
|
-
];
|
|
84
|
+
return [this.ErrorCardVc(err)];
|
|
86
85
|
}
|
|
87
86
|
});
|
|
88
87
|
}
|
|
88
|
+
ErrorCardVc(err) {
|
|
89
|
+
return this.remoteVcFactory.Controller('heartwood.error-card', {
|
|
90
|
+
error: err,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
89
93
|
}
|
|
@@ -18,6 +18,7 @@ Name extends EventNames<Contract> = EventNames<Contract>> {
|
|
|
18
18
|
fetch(
|
|
19
19
|
/** @ts-ignore */
|
|
20
20
|
options?: CardFetchOptions<Contract, Name>): Promise<AbstractViewController<Card>[]>;
|
|
21
|
+
private ErrorCardVc;
|
|
21
22
|
}
|
|
22
23
|
declare type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
23
24
|
declare type ResponsePayload<Contract extends EventContract, Name extends EventNames<Contract>> = Contract['eventSignatures'][Name]['responsePayloadSchema'] extends Schema ? SchemaValues<Contract['eventSignatures'][Name]['responsePayloadSchema']> : never;
|
|
@@ -47,8 +47,11 @@ class CardRegistrar {
|
|
|
47
47
|
await this.client.emit(this.eventName, targetAndPayload, async (targetAndPayload) => {
|
|
48
48
|
var _a;
|
|
49
49
|
const { payload, errors } = targetAndPayload !== null && targetAndPayload !== void 0 ? targetAndPayload : {};
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const err = errors === null || errors === void 0 ? void 0 : errors[0];
|
|
51
|
+
if (err) {
|
|
52
|
+
console.error('Remote card error', err);
|
|
53
|
+
cards.push(this.ErrorCardVc(err));
|
|
54
|
+
return;
|
|
52
55
|
}
|
|
53
56
|
const vcIds = payload ? this.vcIdsTransformer(payload) : [];
|
|
54
57
|
if (!Array.isArray(vcIds)) {
|
|
@@ -73,13 +76,14 @@ class CardRegistrar {
|
|
|
73
76
|
}
|
|
74
77
|
catch (err) {
|
|
75
78
|
console.error(err);
|
|
76
|
-
return [
|
|
77
|
-
this.remoteVcFactory.Controller('heartwood.error-card', {
|
|
78
|
-
error: err,
|
|
79
|
-
}),
|
|
80
|
-
];
|
|
79
|
+
return [this.ErrorCardVc(err)];
|
|
81
80
|
}
|
|
82
81
|
}
|
|
82
|
+
ErrorCardVc(err) {
|
|
83
|
+
return this.remoteVcFactory.Controller('heartwood.error-card', {
|
|
84
|
+
error: err,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
83
87
|
}
|
|
84
88
|
exports.default = CardRegistrar;
|
|
85
89
|
//# sourceMappingURL=CardRegistrar.js.map
|