@sprucelabs/spruce-test-fixtures 60.1.308 → 61.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/build/__tests__/behavioral/views/ViewPlugins.test.d.ts +12 -0
- package/build/__tests__/behavioral/views/ViewPlugins.test.js +83 -0
- package/build/__tests__/support/RandomViewPlugin.d.ts +2 -0
- package/build/__tests__/support/RandomViewPlugin.js +5 -0
- package/build/__tests__/support/RandomViewPlugin2.d.ts +2 -0
- package/build/__tests__/support/RandomViewPlugin2.js +5 -0
- package/build/__tests__/testDirsAndFiles/plugins1/build/.spruce/views/views.d.ts +6 -0
- package/build/__tests__/testDirsAndFiles/plugins1/build/.spruce/views/views.js +11 -0
- package/build/__tests__/testDirsAndFiles/plugins2/build/.spruce/views/views.d.ts +6 -0
- package/build/__tests__/testDirsAndFiles/plugins2/build/.spruce/views/views.js +11 -0
- package/build/esm/__tests__/behavioral/views/ViewPlugins.test.d.ts +12 -0
- package/build/esm/__tests__/behavioral/views/ViewPlugins.test.js +103 -0
- package/build/esm/__tests__/support/RandomViewPlugin.d.ts +2 -0
- package/build/esm/__tests__/support/RandomViewPlugin.js +2 -0
- package/build/esm/__tests__/support/RandomViewPlugin2.d.ts +2 -0
- package/build/esm/__tests__/support/RandomViewPlugin2.js +2 -0
- package/build/esm/tests/fixtures/ViewFixture.js +4 -1
- package/build/esm/utilities/vcDisk.utility.d.ts +6 -2
- package/build/esm/utilities/vcDisk.utility.js +13 -4
- package/build/tests/fixtures/ViewFixture.js +4 -1
- package/build/utilities/vcDisk.utility.d.ts +6 -2
- package/build/utilities/vcDisk.utility.js +13 -4
- package/package.json +5 -5
@@ -0,0 +1,12 @@
|
|
1
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest';
|
2
|
+
export default class ViewPluginsTest extends AbstractSpruceFixtureTest {
|
3
|
+
protected static beforeEach(): Promise<void>;
|
4
|
+
protected static vcAssertLoadsControllersAndMapWithPlugnsByName(): Promise<void>;
|
5
|
+
protected static getsPluginWithExpectedClassReference(dirName: string, key: string, Expected: any): Promise<void>;
|
6
|
+
protected static doesNotIncludePluginsNotExported(): Promise<void>;
|
7
|
+
protected static passesPluginsToTheViewFactory(): Promise<void>;
|
8
|
+
protected static loadsPluginsFromDifferentDirectory(): Promise<void>;
|
9
|
+
private static VcWithPlugins;
|
10
|
+
private static loadControllersAndMap;
|
11
|
+
private static resolvePathToTestSkill;
|
12
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
|
13
|
+
const test_utils_1 = require("@sprucelabs/test-utils");
|
14
|
+
const AbstractSpruceFixtureTest_1 = __importDefault(require("../../../tests/AbstractSpruceFixtureTest"));
|
15
|
+
const FixtureFactory_1 = __importDefault(require("../../../tests/fixtures/FixtureFactory"));
|
16
|
+
const vcDisk_utility_1 = __importDefault(require("../../../utilities/vcDisk.utility"));
|
17
|
+
const RandomViewPlugin_1 = __importDefault(require("../../support/RandomViewPlugin"));
|
18
|
+
const RandomViewPlugin2_1 = __importDefault(require("../../support/RandomViewPlugin2"));
|
19
|
+
class ViewPluginsTest extends AbstractSpruceFixtureTest_1.default {
|
20
|
+
static async beforeEach() {
|
21
|
+
await super.beforeEach();
|
22
|
+
process.env.RANDOM_VALUE = (0, test_utils_1.generateId)();
|
23
|
+
}
|
24
|
+
static async vcAssertLoadsControllersAndMapWithPlugnsByName() {
|
25
|
+
const pluginsByName = await this.loadControllersAndMap('plugins1');
|
26
|
+
test_utils_1.assert.isTruthy(pluginsByName);
|
27
|
+
test_utils_1.assert.isTruthy(pluginsByName.test1);
|
28
|
+
}
|
29
|
+
static async getsPluginWithExpectedClassReference(dirName, key, Expected) {
|
30
|
+
const pluginsByName = await this.loadControllersAndMap(dirName);
|
31
|
+
//@ts-ignore
|
32
|
+
test_utils_1.assert.isEqual(pluginsByName[key], Expected);
|
33
|
+
}
|
34
|
+
static async doesNotIncludePluginsNotExported() {
|
35
|
+
const pluginsByName = await this.loadControllersAndMap('plugins1');
|
36
|
+
test_utils_1.assert.isFalsy(pluginsByName.test2);
|
37
|
+
}
|
38
|
+
static async passesPluginsToTheViewFactory() {
|
39
|
+
const vc = this.VcWithPlugins('plugins1');
|
40
|
+
heartwood_view_controllers_1.vcPluginAssert.pluginIsInstalled(vc, 'test1', RandomViewPlugin_1.default);
|
41
|
+
test_utils_1.assert.doesThrow(() => heartwood_view_controllers_1.vcPluginAssert.pluginIsInstalled(vc, 'test2'));
|
42
|
+
}
|
43
|
+
static async loadsPluginsFromDifferentDirectory() {
|
44
|
+
const vc = this.VcWithPlugins('plugins2');
|
45
|
+
heartwood_view_controllers_1.vcPluginAssert.pluginIsInstalled(vc, 'test2', RandomViewPlugin2_1.default);
|
46
|
+
test_utils_1.assert.doesThrow(() => heartwood_view_controllers_1.vcPluginAssert.pluginIsInstalled(vc, 'test1'));
|
47
|
+
}
|
48
|
+
static VcWithPlugins(dirName) {
|
49
|
+
const fixture = new FixtureFactory_1.default({
|
50
|
+
cwd: this.resolvePath(this.resolvePathToTestSkill(dirName), '..'),
|
51
|
+
namespace: (0, test_utils_1.generateId)(),
|
52
|
+
});
|
53
|
+
const views = fixture.Fixture('view');
|
54
|
+
const factory = views.getFactory();
|
55
|
+
const vc = factory.Controller('card', {});
|
56
|
+
return vc;
|
57
|
+
}
|
58
|
+
static async loadControllersAndMap(dirName) {
|
59
|
+
const toLoad = this.resolvePathToTestSkill(dirName);
|
60
|
+
const { pluginsByName } = vcDisk_utility_1.default.loadViewControllersAndBuildMap('test', toLoad);
|
61
|
+
return pluginsByName;
|
62
|
+
}
|
63
|
+
static resolvePathToTestSkill(dirName) {
|
64
|
+
return this.resolvePath('build', '__tests__', 'testDirsAndFiles', dirName, 'build');
|
65
|
+
}
|
66
|
+
}
|
67
|
+
exports.default = ViewPluginsTest;
|
68
|
+
__decorate([
|
69
|
+
(0, test_utils_1.test)()
|
70
|
+
], ViewPluginsTest, "vcAssertLoadsControllersAndMapWithPlugnsByName", null);
|
71
|
+
__decorate([
|
72
|
+
(0, test_utils_1.test)('can load test1 plugin from plugins1', 'plugins1', 'test1', RandomViewPlugin_1.default),
|
73
|
+
(0, test_utils_1.test)('can load test2 plugin from plugins2', 'plugins2', 'test2', RandomViewPlugin2_1.default)
|
74
|
+
], ViewPluginsTest, "getsPluginWithExpectedClassReference", null);
|
75
|
+
__decorate([
|
76
|
+
(0, test_utils_1.test)()
|
77
|
+
], ViewPluginsTest, "doesNotIncludePluginsNotExported", null);
|
78
|
+
__decorate([
|
79
|
+
(0, test_utils_1.test)()
|
80
|
+
], ViewPluginsTest, "passesPluginsToTheViewFactory", null);
|
81
|
+
__decorate([
|
82
|
+
(0, test_utils_1.test)()
|
83
|
+
], ViewPluginsTest, "loadsPluginsFromDifferentDirectory", null);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.pluginsByName = void 0;
|
7
|
+
const RandomViewPlugin_1 = __importDefault(require("../../../../../support/RandomViewPlugin"));
|
8
|
+
exports.pluginsByName = {
|
9
|
+
test1: RandomViewPlugin_1.default,
|
10
|
+
};
|
11
|
+
exports.default = {};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.pluginsByName = void 0;
|
7
|
+
const RandomViewPlugin2_1 = __importDefault(require("../../../../../support/RandomViewPlugin2"));
|
8
|
+
exports.pluginsByName = {
|
9
|
+
test2: RandomViewPlugin2_1.default,
|
10
|
+
};
|
11
|
+
exports.default = {};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest';
|
2
|
+
export default class ViewPluginsTest extends AbstractSpruceFixtureTest {
|
3
|
+
protected static beforeEach(): Promise<void>;
|
4
|
+
protected static vcAssertLoadsControllersAndMapWithPlugnsByName(): Promise<void>;
|
5
|
+
protected static getsPluginWithExpectedClassReference(dirName: string, key: string, Expected: any): Promise<void>;
|
6
|
+
protected static doesNotIncludePluginsNotExported(): Promise<void>;
|
7
|
+
protected static passesPluginsToTheViewFactory(): Promise<void>;
|
8
|
+
protected static loadsPluginsFromDifferentDirectory(): Promise<void>;
|
9
|
+
private static VcWithPlugins;
|
10
|
+
private static loadControllersAndMap;
|
11
|
+
private static resolvePathToTestSkill;
|
12
|
+
}
|
@@ -0,0 +1,103 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
14
|
+
});
|
15
|
+
};
|
16
|
+
import { vcPluginAssert } from '@sprucelabs/heartwood-view-controllers';
|
17
|
+
import { test, assert, generateId } from '@sprucelabs/test-utils';
|
18
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest.js';
|
19
|
+
import FixtureFactory from '../../../tests/fixtures/FixtureFactory.js';
|
20
|
+
import vcDiskUtil from '../../../utilities/vcDisk.utility.js';
|
21
|
+
import RandomViewPlugin from '../../support/RandomViewPlugin.js';
|
22
|
+
import RandomViewPlugin2 from '../../support/RandomViewPlugin2.js';
|
23
|
+
export default class ViewPluginsTest extends AbstractSpruceFixtureTest {
|
24
|
+
static beforeEach() {
|
25
|
+
const _super = Object.create(null, {
|
26
|
+
beforeEach: { get: () => super.beforeEach }
|
27
|
+
});
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
29
|
+
yield _super.beforeEach.call(this);
|
30
|
+
process.env.RANDOM_VALUE = generateId();
|
31
|
+
});
|
32
|
+
}
|
33
|
+
static vcAssertLoadsControllersAndMapWithPlugnsByName() {
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
35
|
+
const pluginsByName = yield this.loadControllersAndMap('plugins1');
|
36
|
+
assert.isTruthy(pluginsByName);
|
37
|
+
assert.isTruthy(pluginsByName.test1);
|
38
|
+
});
|
39
|
+
}
|
40
|
+
static getsPluginWithExpectedClassReference(dirName, key, Expected) {
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
42
|
+
const pluginsByName = yield this.loadControllersAndMap(dirName);
|
43
|
+
//@ts-ignore
|
44
|
+
assert.isEqual(pluginsByName[key], Expected);
|
45
|
+
});
|
46
|
+
}
|
47
|
+
static doesNotIncludePluginsNotExported() {
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
49
|
+
const pluginsByName = yield this.loadControllersAndMap('plugins1');
|
50
|
+
assert.isFalsy(pluginsByName.test2);
|
51
|
+
});
|
52
|
+
}
|
53
|
+
static passesPluginsToTheViewFactory() {
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
55
|
+
const vc = this.VcWithPlugins('plugins1');
|
56
|
+
vcPluginAssert.pluginIsInstalled(vc, 'test1', RandomViewPlugin);
|
57
|
+
assert.doesThrow(() => vcPluginAssert.pluginIsInstalled(vc, 'test2'));
|
58
|
+
});
|
59
|
+
}
|
60
|
+
static loadsPluginsFromDifferentDirectory() {
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
62
|
+
const vc = this.VcWithPlugins('plugins2');
|
63
|
+
vcPluginAssert.pluginIsInstalled(vc, 'test2', RandomViewPlugin2);
|
64
|
+
assert.doesThrow(() => vcPluginAssert.pluginIsInstalled(vc, 'test1'));
|
65
|
+
});
|
66
|
+
}
|
67
|
+
static VcWithPlugins(dirName) {
|
68
|
+
const fixture = new FixtureFactory({
|
69
|
+
cwd: this.resolvePath(this.resolvePathToTestSkill(dirName), '..'),
|
70
|
+
namespace: generateId(),
|
71
|
+
});
|
72
|
+
const views = fixture.Fixture('view');
|
73
|
+
const factory = views.getFactory();
|
74
|
+
const vc = factory.Controller('card', {});
|
75
|
+
return vc;
|
76
|
+
}
|
77
|
+
static loadControllersAndMap(dirName) {
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
79
|
+
const toLoad = this.resolvePathToTestSkill(dirName);
|
80
|
+
const { pluginsByName } = vcDiskUtil.loadViewControllersAndBuildMap('test', toLoad);
|
81
|
+
return pluginsByName;
|
82
|
+
});
|
83
|
+
}
|
84
|
+
static resolvePathToTestSkill(dirName) {
|
85
|
+
return this.resolvePath('build', '__tests__', 'testDirsAndFiles', dirName, 'build');
|
86
|
+
}
|
87
|
+
}
|
88
|
+
__decorate([
|
89
|
+
test()
|
90
|
+
], ViewPluginsTest, "vcAssertLoadsControllersAndMapWithPlugnsByName", null);
|
91
|
+
__decorate([
|
92
|
+
test('can load test1 plugin from plugins1', 'plugins1', 'test1', RandomViewPlugin),
|
93
|
+
test('can load test2 plugin from plugins2', 'plugins2', 'test2', RandomViewPlugin2)
|
94
|
+
], ViewPluginsTest, "getsPluginWithExpectedClassReference", null);
|
95
|
+
__decorate([
|
96
|
+
test()
|
97
|
+
], ViewPluginsTest, "doesNotIncludePluginsNotExported", null);
|
98
|
+
__decorate([
|
99
|
+
test()
|
100
|
+
], ViewPluginsTest, "passesPluginsToTheViewFactory", null);
|
101
|
+
__decorate([
|
102
|
+
test()
|
103
|
+
], ViewPluginsTest, "loadsPluginsFromDifferentDirectory", null);
|
@@ -70,9 +70,11 @@ class ViewFixture {
|
|
70
70
|
}
|
71
71
|
const { namespace, controllerMap: map, vcDir, connectToApi } = options;
|
72
72
|
let controllerMap;
|
73
|
+
let pluginsByName = {};
|
73
74
|
try {
|
74
|
-
const loadedControllerMap = vcDiskUtil.loadViewControllersAndBuildMap(namespace, vcDir);
|
75
|
+
const { map: loadedControllerMap, pluginsByName: plugins } = vcDiskUtil.loadViewControllersAndBuildMap(namespace, vcDir);
|
75
76
|
controllerMap = Object.assign(Object.assign({}, loadedControllerMap), map);
|
77
|
+
pluginsByName = plugins;
|
76
78
|
}
|
77
79
|
catch (err) {
|
78
80
|
if (!map) {
|
@@ -93,6 +95,7 @@ class ViewFixture {
|
|
93
95
|
this.vcFactory = ViewControllerFactory.Factory({
|
94
96
|
controllerMap,
|
95
97
|
device: this.device,
|
98
|
+
pluginsByName,
|
96
99
|
connectToApi: (options) => __awaiter(this, void 0, void 0, function* () {
|
97
100
|
var _a;
|
98
101
|
return (_a = this.viewClient) !== null && _a !== void 0 ? _a : connectToApi(options);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ViewController, SkillViewController, ViewControllerMap, SpruceSchemas } from '@sprucelabs/heartwood-view-controllers';
|
1
|
+
import { ViewController, SkillViewController, ViewControllerMap, SpruceSchemas, ViewControllerPluginsByName } from '@sprucelabs/heartwood-view-controllers';
|
2
2
|
import { HealthCheckView } from '../types/view.types';
|
3
3
|
declare const vcDiskUtil: {
|
4
4
|
loadViewControllers(activeDir: string, options?: {
|
@@ -12,8 +12,12 @@ declare const vcDiskUtil: {
|
|
12
12
|
} & HealthCheckView)[];
|
13
13
|
ids: string[];
|
14
14
|
theme: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Theme | undefined;
|
15
|
+
pluginsByName: ViewControllerPluginsByName;
|
16
|
+
};
|
17
|
+
loadViewControllersAndBuildMap(namespace: string, vcDir: string): {
|
18
|
+
map: Partial<ViewControllerMap>;
|
19
|
+
pluginsByName: ViewControllerPluginsByName;
|
15
20
|
};
|
16
|
-
loadViewControllersAndBuildMap(namespace: string, vcDir: string): Partial<ViewControllerMap>;
|
17
21
|
resolveCombinedViewsPath(activeDir: string): string | false;
|
18
22
|
resolveThemeFile(activeDir: string): string | false;
|
19
23
|
};
|
@@ -10,7 +10,7 @@ const vcDiskUtil = {
|
|
10
10
|
if (!path) {
|
11
11
|
throw new Error(`Could not find path to skill views. Running \`spruce sync.views\` may help.`);
|
12
12
|
}
|
13
|
-
const controllerMap = require(path)
|
13
|
+
const { default: controllerMap, pluginsByName } = require(path);
|
14
14
|
const controllers = Object.values(controllerMap);
|
15
15
|
const vcs = [];
|
16
16
|
const svcs = [];
|
@@ -70,10 +70,16 @@ const vcDiskUtil = {
|
|
70
70
|
props,
|
71
71
|
};
|
72
72
|
}
|
73
|
-
return {
|
73
|
+
return {
|
74
|
+
svcs,
|
75
|
+
vcs,
|
76
|
+
ids,
|
77
|
+
theme,
|
78
|
+
pluginsByName: pluginsByName,
|
79
|
+
};
|
74
80
|
},
|
75
81
|
loadViewControllersAndBuildMap(namespace, vcDir) {
|
76
|
-
const { vcs, svcs } = this.loadViewControllers(vcDir);
|
82
|
+
const { vcs, svcs, pluginsByName } = this.loadViewControllers(vcDir);
|
77
83
|
const map = {};
|
78
84
|
const all = [...vcs, ...svcs];
|
79
85
|
for (const item of all) {
|
@@ -82,7 +88,10 @@ const vcDiskUtil = {
|
|
82
88
|
map[`${namespace}.${item.id}`] = item.Class;
|
83
89
|
}
|
84
90
|
}
|
85
|
-
return
|
91
|
+
return {
|
92
|
+
map,
|
93
|
+
pluginsByName,
|
94
|
+
};
|
86
95
|
},
|
87
96
|
resolveCombinedViewsPath(activeDir) {
|
88
97
|
return diskUtil.resolveFile(activeDir, HASH_SPRUCE_DIR_NAME, 'views', 'views');
|
@@ -66,9 +66,11 @@ class ViewFixture {
|
|
66
66
|
}
|
67
67
|
const { namespace, controllerMap: map, vcDir, connectToApi } = options;
|
68
68
|
let controllerMap;
|
69
|
+
let pluginsByName = {};
|
69
70
|
try {
|
70
|
-
const loadedControllerMap = vcDisk_utility_1.default.loadViewControllersAndBuildMap(namespace, vcDir);
|
71
|
+
const { map: loadedControllerMap, pluginsByName: plugins } = vcDisk_utility_1.default.loadViewControllersAndBuildMap(namespace, vcDir);
|
71
72
|
controllerMap = Object.assign(Object.assign({}, loadedControllerMap), map);
|
73
|
+
pluginsByName = plugins;
|
72
74
|
}
|
73
75
|
catch (err) {
|
74
76
|
if (!map) {
|
@@ -89,6 +91,7 @@ class ViewFixture {
|
|
89
91
|
this.vcFactory = heartwood_view_controllers_1.ViewControllerFactory.Factory({
|
90
92
|
controllerMap,
|
91
93
|
device: this.device,
|
94
|
+
pluginsByName,
|
92
95
|
connectToApi: async (options) => {
|
93
96
|
var _a;
|
94
97
|
return (_a = this.viewClient) !== null && _a !== void 0 ? _a : connectToApi(options);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ViewController, SkillViewController, ViewControllerMap, SpruceSchemas } from '@sprucelabs/heartwood-view-controllers';
|
1
|
+
import { ViewController, SkillViewController, ViewControllerMap, SpruceSchemas, ViewControllerPluginsByName } from '@sprucelabs/heartwood-view-controllers';
|
2
2
|
import { HealthCheckView } from '../types/view.types';
|
3
3
|
declare const vcDiskUtil: {
|
4
4
|
loadViewControllers(activeDir: string, options?: {
|
@@ -12,8 +12,12 @@ declare const vcDiskUtil: {
|
|
12
12
|
} & HealthCheckView)[];
|
13
13
|
ids: string[];
|
14
14
|
theme: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Theme | undefined;
|
15
|
+
pluginsByName: ViewControllerPluginsByName;
|
16
|
+
};
|
17
|
+
loadViewControllersAndBuildMap(namespace: string, vcDir: string): {
|
18
|
+
map: Partial<ViewControllerMap>;
|
19
|
+
pluginsByName: ViewControllerPluginsByName;
|
15
20
|
};
|
16
|
-
loadViewControllersAndBuildMap(namespace: string, vcDir: string): Partial<ViewControllerMap>;
|
17
21
|
resolveCombinedViewsPath(activeDir: string): string | false;
|
18
22
|
resolveThemeFile(activeDir: string): string | false;
|
19
23
|
};
|
@@ -15,7 +15,7 @@ const vcDiskUtil = {
|
|
15
15
|
if (!path) {
|
16
16
|
throw new Error(`Could not find path to skill views. Running \`spruce sync.views\` may help.`);
|
17
17
|
}
|
18
|
-
const controllerMap = require(path)
|
18
|
+
const { default: controllerMap, pluginsByName } = require(path);
|
19
19
|
const controllers = Object.values(controllerMap);
|
20
20
|
const vcs = [];
|
21
21
|
const svcs = [];
|
@@ -75,10 +75,16 @@ const vcDiskUtil = {
|
|
75
75
|
props,
|
76
76
|
};
|
77
77
|
}
|
78
|
-
return {
|
78
|
+
return {
|
79
|
+
svcs,
|
80
|
+
vcs,
|
81
|
+
ids,
|
82
|
+
theme,
|
83
|
+
pluginsByName: pluginsByName,
|
84
|
+
};
|
79
85
|
},
|
80
86
|
loadViewControllersAndBuildMap(namespace, vcDir) {
|
81
|
-
const { vcs, svcs } = this.loadViewControllers(vcDir);
|
87
|
+
const { vcs, svcs, pluginsByName } = this.loadViewControllers(vcDir);
|
82
88
|
const map = {};
|
83
89
|
const all = [...vcs, ...svcs];
|
84
90
|
for (const item of all) {
|
@@ -87,7 +93,10 @@ const vcDiskUtil = {
|
|
87
93
|
map[`${namespace}.${item.id}`] = item.Class;
|
88
94
|
}
|
89
95
|
}
|
90
|
-
return
|
96
|
+
return {
|
97
|
+
map,
|
98
|
+
pluginsByName,
|
99
|
+
};
|
91
100
|
},
|
92
101
|
resolveCombinedViewsPath(activeDir) {
|
93
102
|
return spruce_skill_utils_1.diskUtil.resolveFile(activeDir, spruce_skill_utils_1.HASH_SPRUCE_DIR_NAME, 'views', 'views');
|
package/package.json
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
"@sprucelabs/spruce-test-fixtures"
|
14
14
|
]
|
15
15
|
},
|
16
|
-
"version": "
|
16
|
+
"version": "61.0.1",
|
17
17
|
"files": [
|
18
18
|
"build/**/*",
|
19
19
|
"!build/__tests__",
|
@@ -64,15 +64,15 @@
|
|
64
64
|
"dependencies": {
|
65
65
|
"@sprucelabs/data-stores": "^26.4.58",
|
66
66
|
"@sprucelabs/error": "^5.1.82",
|
67
|
-
"@sprucelabs/heartwood-view-controllers": "^109.7.
|
67
|
+
"@sprucelabs/heartwood-view-controllers": "^109.7.1",
|
68
68
|
"@sprucelabs/mercury-client": "^41.0.351",
|
69
69
|
"@sprucelabs/mercury-core-events": "^22.2.54",
|
70
70
|
"@sprucelabs/mercury-event-emitter": "^41.0.351",
|
71
71
|
"@sprucelabs/schema": "^29.4.31",
|
72
72
|
"@sprucelabs/spruce-core-schemas": "^39.0.265",
|
73
73
|
"@sprucelabs/spruce-event-utils": "^38.1.10",
|
74
|
-
"@sprucelabs/spruce-permission-utils": "^7.0.
|
75
|
-
"@sprucelabs/spruce-skill-booter": "^
|
74
|
+
"@sprucelabs/spruce-permission-utils": "^7.0.541",
|
75
|
+
"@sprucelabs/spruce-skill-booter": "^61.0.1",
|
76
76
|
"@sprucelabs/spruce-skill-utils": "^30.3.27",
|
77
77
|
"@sprucelabs/test-utils": "^4.0.129",
|
78
78
|
"dotenv": "^16.4.5",
|
@@ -132,5 +132,5 @@
|
|
132
132
|
]
|
133
133
|
]
|
134
134
|
},
|
135
|
-
"gitHead": "
|
135
|
+
"gitHead": "344a8883a393c22a48dd841ed31d13593de18807"
|
136
136
|
}
|