@sprucelabs/spruce-heartwood-utils 6.7.11 → 6.8.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.
|
@@ -17,7 +17,7 @@ Name extends EventNames<Contract>> {
|
|
|
17
17
|
export declare type EachCardHandler = (vcs: AbstractViewController<any>[]) => Promise<void> | void;
|
|
18
18
|
export declare type CardFetchOptions<Contract extends EventContract, Name extends EventNames<Contract>> = {
|
|
19
19
|
each: EachCardHandler;
|
|
20
|
-
|
|
20
|
+
controllerOptionsHandler?: (vcId: string) => Record<string, any>;
|
|
21
21
|
} & EmitPayload<Contract, Name>;
|
|
22
22
|
export default class CardRegistrar<Contract = SkillEventContract,
|
|
23
23
|
/** @ts-ignore */
|
|
@@ -37,15 +37,16 @@ export default class CardRegistrar {
|
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
38
|
try {
|
|
39
39
|
//@ts-ignore
|
|
40
|
-
const { each,
|
|
40
|
+
const { each, controllerOptionsHandler, target, payload } = options !== null && options !== void 0 ? options : {};
|
|
41
41
|
const targetAndPayload = target || payload ? { target, payload } : undefined;
|
|
42
42
|
const cards = [];
|
|
43
43
|
yield this.client.emitAndFlattenResponses(this.eventName, targetAndPayload, ({ payload }) => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
var _a;
|
|
44
45
|
const vcIds = this.vcIdsTransformer(payload);
|
|
45
46
|
const responseCards = [];
|
|
46
47
|
for (const id of vcIds) {
|
|
47
48
|
try {
|
|
48
|
-
const vc = yield this.remoteVcFactory.RemoteController(id,
|
|
49
|
+
const vc = yield this.remoteVcFactory.RemoteController(id, (_a = controllerOptionsHandler === null || controllerOptionsHandler === void 0 ? void 0 : controllerOptionsHandler(id)) !== null && _a !== void 0 ? _a : {});
|
|
49
50
|
responseCards.push(vc);
|
|
50
51
|
}
|
|
51
52
|
catch (err) {
|
|
@@ -17,7 +17,7 @@ Name extends EventNames<Contract>> {
|
|
|
17
17
|
export declare type EachCardHandler = (vcs: AbstractViewController<any>[]) => Promise<void> | void;
|
|
18
18
|
export declare type CardFetchOptions<Contract extends EventContract, Name extends EventNames<Contract>> = {
|
|
19
19
|
each: EachCardHandler;
|
|
20
|
-
|
|
20
|
+
controllerOptionsHandler?: (vcId: string) => Record<string, any>;
|
|
21
21
|
} & EmitPayload<Contract, Name>;
|
|
22
22
|
export default class CardRegistrar<Contract = SkillEventContract,
|
|
23
23
|
/** @ts-ignore */
|
|
@@ -32,15 +32,16 @@ class CardRegistrar {
|
|
|
32
32
|
options) {
|
|
33
33
|
try {
|
|
34
34
|
//@ts-ignore
|
|
35
|
-
const { each,
|
|
35
|
+
const { each, controllerOptionsHandler, target, payload } = options !== null && options !== void 0 ? options : {};
|
|
36
36
|
const targetAndPayload = target || payload ? { target, payload } : undefined;
|
|
37
37
|
const cards = [];
|
|
38
38
|
await this.client.emitAndFlattenResponses(this.eventName, targetAndPayload, async ({ payload }) => {
|
|
39
|
+
var _a;
|
|
39
40
|
const vcIds = this.vcIdsTransformer(payload);
|
|
40
41
|
const responseCards = [];
|
|
41
42
|
for (const id of vcIds) {
|
|
42
43
|
try {
|
|
43
|
-
const vc = await this.remoteVcFactory.RemoteController(id,
|
|
44
|
+
const vc = await this.remoteVcFactory.RemoteController(id, (_a = controllerOptionsHandler === null || controllerOptionsHandler === void 0 ? void 0 : controllerOptionsHandler(id)) !== null && _a !== void 0 ? _a : {});
|
|
44
45
|
responseCards.push(vc);
|
|
45
46
|
}
|
|
46
47
|
catch (err) {
|