@sprucelabs/spruce-heartwood-utils 7.8.0 → 7.9.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/build/esm/index-module.d.ts +1 -0
- package/build/esm/index-module.js +1 -0
- package/build/esm/types/heartwood-module.types.d.ts +6 -0
- package/build/esm/types/heartwood-module.types.js +1 -0
- package/build/esm/viewControllers/CardRegistrar.js +16 -4
- package/build/index-module.d.ts +1 -0
- package/build/index-module.js +15 -0
- package/build/types/heartwood-module.types.d.ts +6 -0
- package/build/types/heartwood-module.types.js +3 -0
- package/build/viewControllers/CardRegistrar.js +16 -4
- package/package.json +6 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as RemoteViewControllerFactory } from './viewControllers/RemoteViewControllerFactory';
|
|
2
2
|
export { default as CardRegistrar } from './viewControllers/CardRegistrar';
|
|
3
3
|
export { default as remoteVcAssert } from './tests/remoteVcAssert';
|
|
4
|
+
export * from './types/heartwood-module.types';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as RemoteViewControllerFactory } from './viewControllers/RemoteViewControllerFactory.js';
|
|
2
2
|
export { default as CardRegistrar } from './viewControllers/CardRegistrar.js';
|
|
3
3
|
export { default as remoteVcAssert } from './tests/remoteVcAssert.js';
|
|
4
|
+
export * from './types/heartwood-module.types.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SkillViewControllerLoadOptions, SpruceSchemas, ViewController } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
declare type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
3
|
+
export interface RemoteDashboardCard extends ViewController<Card> {
|
|
4
|
+
load?(options: SkillViewControllerLoadOptions): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -38,12 +38,24 @@ export default class CardRegistrar {
|
|
|
38
38
|
try {
|
|
39
39
|
//@ts-ignore
|
|
40
40
|
const { each, controllerOptionsHandler, target, payload } = options !== null && options !== void 0 ? options : {};
|
|
41
|
-
|
|
41
|
+
let targetAndPayload;
|
|
42
|
+
if (target && payload) {
|
|
43
|
+
targetAndPayload = { target, payload };
|
|
44
|
+
}
|
|
45
|
+
else if (payload) {
|
|
46
|
+
targetAndPayload = { payload };
|
|
47
|
+
}
|
|
48
|
+
else if (target) {
|
|
49
|
+
targetAndPayload = { target };
|
|
50
|
+
}
|
|
42
51
|
const cards = [];
|
|
43
|
-
yield this.client.
|
|
52
|
+
yield this.client.emit(this.eventName, targetAndPayload, (targetAndPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
44
53
|
var _a;
|
|
45
|
-
const { payload } = targetAndPayload !== null && targetAndPayload !== void 0 ? targetAndPayload : {};
|
|
46
|
-
|
|
54
|
+
const { payload, errors } = targetAndPayload !== null && targetAndPayload !== void 0 ? targetAndPayload : {};
|
|
55
|
+
if (errors === null || errors === void 0 ? void 0 : errors[0]) {
|
|
56
|
+
throw errors === null || errors === void 0 ? void 0 : errors[0];
|
|
57
|
+
}
|
|
58
|
+
const vcIds = payload ? this.vcIdsTransformer(payload) : [];
|
|
47
59
|
if (!Array.isArray(vcIds)) {
|
|
48
60
|
throw 'Your vcIdsTransform MUST return an array!';
|
|
49
61
|
}
|
package/build/index-module.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as RemoteViewControllerFactory } from './viewControllers/RemoteViewControllerFactory';
|
|
2
2
|
export { default as CardRegistrar } from './viewControllers/CardRegistrar';
|
|
3
3
|
export { default as remoteVcAssert } from './tests/remoteVcAssert';
|
|
4
|
+
export * from './types/heartwood-module.types';
|
package/build/index-module.js
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
18
|
};
|
|
@@ -10,4 +24,5 @@ var CardRegistrar_1 = require("./viewControllers/CardRegistrar");
|
|
|
10
24
|
Object.defineProperty(exports, "CardRegistrar", { enumerable: true, get: function () { return __importDefault(CardRegistrar_1).default; } });
|
|
11
25
|
var remoteVcAssert_1 = require("./tests/remoteVcAssert");
|
|
12
26
|
Object.defineProperty(exports, "remoteVcAssert", { enumerable: true, get: function () { return __importDefault(remoteVcAssert_1).default; } });
|
|
27
|
+
__exportStar(require("./types/heartwood-module.types"), exports);
|
|
13
28
|
//# sourceMappingURL=index-module.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SkillViewControllerLoadOptions, SpruceSchemas, ViewController } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
declare type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
3
|
+
export interface RemoteDashboardCard extends ViewController<Card> {
|
|
4
|
+
load?(options: SkillViewControllerLoadOptions): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export {};
|
|
@@ -33,12 +33,24 @@ class CardRegistrar {
|
|
|
33
33
|
try {
|
|
34
34
|
//@ts-ignore
|
|
35
35
|
const { each, controllerOptionsHandler, target, payload } = options !== null && options !== void 0 ? options : {};
|
|
36
|
-
|
|
36
|
+
let targetAndPayload;
|
|
37
|
+
if (target && payload) {
|
|
38
|
+
targetAndPayload = { target, payload };
|
|
39
|
+
}
|
|
40
|
+
else if (payload) {
|
|
41
|
+
targetAndPayload = { payload };
|
|
42
|
+
}
|
|
43
|
+
else if (target) {
|
|
44
|
+
targetAndPayload = { target };
|
|
45
|
+
}
|
|
37
46
|
const cards = [];
|
|
38
|
-
await this.client.
|
|
47
|
+
await this.client.emit(this.eventName, targetAndPayload, async (targetAndPayload) => {
|
|
39
48
|
var _a;
|
|
40
|
-
const { payload } = targetAndPayload !== null && targetAndPayload !== void 0 ? targetAndPayload : {};
|
|
41
|
-
|
|
49
|
+
const { payload, errors } = targetAndPayload !== null && targetAndPayload !== void 0 ? targetAndPayload : {};
|
|
50
|
+
if (errors === null || errors === void 0 ? void 0 : errors[0]) {
|
|
51
|
+
throw errors === null || errors === void 0 ? void 0 : errors[0];
|
|
52
|
+
}
|
|
53
|
+
const vcIds = payload ? this.vcIdsTransformer(payload) : [];
|
|
42
54
|
if (!Array.isArray(vcIds)) {
|
|
43
55
|
throw 'Your vcIdsTransform MUST return an array!';
|
|
44
56
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sprucelabs/spruce-heartwood-utils",
|
|
3
3
|
"description": "Heartwood Utilities",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.9.1",
|
|
5
5
|
"skill": {
|
|
6
6
|
"namespace": "heartwood"
|
|
7
7
|
},
|
|
@@ -33,7 +33,11 @@
|
|
|
33
33
|
"build/tests/remoteVcAssert.js",
|
|
34
34
|
"build/tests/remoteVcAssert.d.ts",
|
|
35
35
|
"build/esm/tests/remoteVcAssert.js",
|
|
36
|
-
"build/esm/tests/remoteVcAssert.d.ts"
|
|
36
|
+
"build/esm/tests/remoteVcAssert.d.ts",
|
|
37
|
+
"build/types/heartwood-module.types.js",
|
|
38
|
+
"build/types/heartwood-module.types.d.ts",
|
|
39
|
+
"build/esm/types/heartwood-module.types.js",
|
|
40
|
+
"build/esm/types/heartwood-module.types.d.ts"
|
|
37
41
|
],
|
|
38
42
|
"keywords": [],
|
|
39
43
|
"scripts": {
|