@sprucelabs/spruce-test-fixtures 62.4.31 → 62.4.33

Sign up to get free protection for your applications and to get access to all the features.
@@ -79,9 +79,11 @@ class ViewFixture {
79
79
  const { namespace, controllerMap: map, vcDir, connectToApi } = options;
80
80
  let controllerMap;
81
81
  let pluginsByName = {};
82
+ let App;
82
83
  try {
83
- const { map: loadedControllerMap, pluginsByName: plugins } = vcDiskUtil.loadViewControllersAndBuildMap(namespace, vcDir);
84
+ const { map: loadedControllerMap, pluginsByName: plugins, App: loadedApp, } = vcDiskUtil.loadViewControllersAndBuildMap(namespace, vcDir);
84
85
  controllerMap = Object.assign(Object.assign({}, loadedControllerMap), map);
86
+ App = loadedApp;
85
87
  pluginsByName = plugins;
86
88
  }
87
89
  catch (err) {
@@ -120,6 +122,9 @@ class ViewFixture {
120
122
  vcAssert._setVcFactory(this.vcFactory);
121
123
  //@ts-ignore
122
124
  formAssert._setVcFactory(this.vcFactory);
125
+ if (App) {
126
+ this.vcFactory.importControllers([], undefined, App);
127
+ }
123
128
  const oldFactory = this.vcFactory.Controller.bind(this.vcFactory);
124
129
  this.vcFactory.Controller = (...args) => {
125
130
  //@ts-ignore
@@ -1,4 +1,4 @@
1
- import { ViewController, SkillViewController, ViewControllerMap, SpruceSchemas, ViewControllerPluginsByName } from '@sprucelabs/heartwood-view-controllers';
1
+ import { ViewController, SkillViewController, ViewControllerMap, SpruceSchemas, ViewControllerPluginsByName, AppControllerConstructor } 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,11 +12,13 @@ declare const vcDiskUtil: {
12
12
  } & HealthCheckView)[];
13
13
  ids: string[];
14
14
  theme: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Theme | undefined;
15
+ App: AppControllerConstructor | undefined;
15
16
  pluginsByName: ViewControllerPluginsByName;
16
17
  };
17
18
  loadViewControllersAndBuildMap(namespace: string, vcDir: string): {
18
19
  map: Partial<ViewControllerMap>;
19
20
  pluginsByName: ViewControllerPluginsByName;
21
+ App: AppControllerConstructor | undefined;
20
22
  };
21
23
  resolveCombinedViewsPath(activeDir: string): string | false;
22
24
  resolveThemeFile(activeDir: string): string | false;
@@ -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 { default: controllerMap, pluginsByName } = require(path);
13
+ const { default: controllerMap, pluginsByName, App } = require(path);
14
14
  const controllers = Object.values(controllerMap);
15
15
  const vcs = [];
16
16
  const svcs = [];
@@ -75,11 +75,12 @@ const vcDiskUtil = {
75
75
  vcs,
76
76
  ids,
77
77
  theme,
78
+ App: App,
78
79
  pluginsByName: pluginsByName,
79
80
  };
80
81
  },
81
82
  loadViewControllersAndBuildMap(namespace, vcDir) {
82
- const { vcs, svcs, pluginsByName } = this.loadViewControllers(vcDir);
83
+ const { vcs, svcs, pluginsByName, App } = this.loadViewControllers(vcDir);
83
84
  const map = {};
84
85
  const all = [...vcs, ...svcs];
85
86
  for (const item of all) {
@@ -88,9 +89,13 @@ const vcDiskUtil = {
88
89
  map[`${namespace}.${item.id}`] = item.Class;
89
90
  }
90
91
  }
92
+ if (App) {
93
+ App.id = `${namespace}`;
94
+ }
91
95
  return {
92
96
  map,
93
97
  pluginsByName,
98
+ App,
94
99
  };
95
100
  },
96
101
  resolveCombinedViewsPath(activeDir) {
@@ -75,12 +75,14 @@ class ViewFixture {
75
75
  const { namespace, controllerMap: map, vcDir, connectToApi } = options;
76
76
  let controllerMap;
77
77
  let pluginsByName = {};
78
+ let App;
78
79
  try {
79
- const { map: loadedControllerMap, pluginsByName: plugins } = vcDisk_utility_1.default.loadViewControllersAndBuildMap(namespace, vcDir);
80
+ const { map: loadedControllerMap, pluginsByName: plugins, App: loadedApp, } = vcDisk_utility_1.default.loadViewControllersAndBuildMap(namespace, vcDir);
80
81
  controllerMap = {
81
82
  ...loadedControllerMap,
82
83
  ...map,
83
84
  };
85
+ App = loadedApp;
84
86
  pluginsByName = plugins;
85
87
  }
86
88
  catch (err) {
@@ -118,6 +120,9 @@ class ViewFixture {
118
120
  heartwood_view_controllers_1.vcAssert._setVcFactory(this.vcFactory);
119
121
  //@ts-ignore
120
122
  heartwood_view_controllers_1.formAssert._setVcFactory(this.vcFactory);
123
+ if (App) {
124
+ this.vcFactory.importControllers([], undefined, App);
125
+ }
121
126
  const oldFactory = this.vcFactory.Controller.bind(this.vcFactory);
122
127
  this.vcFactory.Controller = (...args) => {
123
128
  //@ts-ignore
@@ -1,4 +1,4 @@
1
- import { ViewController, SkillViewController, ViewControllerMap, SpruceSchemas, ViewControllerPluginsByName } from '@sprucelabs/heartwood-view-controllers';
1
+ import { ViewController, SkillViewController, ViewControllerMap, SpruceSchemas, ViewControllerPluginsByName, AppControllerConstructor } 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,11 +12,13 @@ declare const vcDiskUtil: {
12
12
  } & HealthCheckView)[];
13
13
  ids: string[];
14
14
  theme: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Theme | undefined;
15
+ App: AppControllerConstructor | undefined;
15
16
  pluginsByName: ViewControllerPluginsByName;
16
17
  };
17
18
  loadViewControllersAndBuildMap(namespace: string, vcDir: string): {
18
19
  map: Partial<ViewControllerMap>;
19
20
  pluginsByName: ViewControllerPluginsByName;
21
+ App: AppControllerConstructor | undefined;
20
22
  };
21
23
  resolveCombinedViewsPath(activeDir: string): string | false;
22
24
  resolveThemeFile(activeDir: string): string | false;
@@ -14,7 +14,7 @@ const vcDiskUtil = {
14
14
  if (!path) {
15
15
  throw new Error(`Could not find path to skill views. Running \`spruce sync.views\` may help.`);
16
16
  }
17
- const { default: controllerMap, pluginsByName } = require(path);
17
+ const { default: controllerMap, pluginsByName, App } = require(path);
18
18
  const controllers = Object.values(controllerMap);
19
19
  const vcs = [];
20
20
  const svcs = [];
@@ -79,11 +79,12 @@ const vcDiskUtil = {
79
79
  vcs,
80
80
  ids,
81
81
  theme,
82
+ App: App,
82
83
  pluginsByName: pluginsByName,
83
84
  };
84
85
  },
85
86
  loadViewControllersAndBuildMap(namespace, vcDir) {
86
- const { vcs, svcs, pluginsByName } = this.loadViewControllers(vcDir);
87
+ const { vcs, svcs, pluginsByName, App } = this.loadViewControllers(vcDir);
87
88
  const map = {};
88
89
  const all = [...vcs, ...svcs];
89
90
  for (const item of all) {
@@ -92,9 +93,13 @@ const vcDiskUtil = {
92
93
  map[`${namespace}.${item.id}`] = item.Class;
93
94
  }
94
95
  }
96
+ if (App) {
97
+ App.id = `${namespace}`;
98
+ }
95
99
  return {
96
100
  map,
97
101
  pluginsByName,
102
+ App,
98
103
  };
99
104
  },
100
105
  resolveCombinedViewsPath(activeDir) {
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "@sprucelabs/spruce-test-fixtures"
14
14
  ]
15
15
  },
16
- "version": "62.4.31",
16
+ "version": "62.4.33",
17
17
  "files": [
18
18
  "build/**/*",
19
19
  "!build/__tests__",
@@ -71,7 +71,7 @@
71
71
  "@sprucelabs/spruce-core-schemas": "^40.1.550",
72
72
  "@sprucelabs/spruce-event-utils": "^40.1.326",
73
73
  "@sprucelabs/spruce-permission-utils": "^8.1.29",
74
- "@sprucelabs/spruce-skill-booter": "^62.4.31",
74
+ "@sprucelabs/spruce-skill-booter": "^62.4.33",
75
75
  "@sprucelabs/spruce-skill-utils": "^31.0.627",
76
76
  "@sprucelabs/test-utils": "^5.1.504",
77
77
  "dotenv": "^16.4.5",
@@ -114,5 +114,5 @@
114
114
  "^#spruce/(.*)$": "<rootDir>/build/.spruce/$1"
115
115
  }
116
116
  },
117
- "gitHead": "46ab3b5cfdf4a4c4454a4d00e30db3395ee0b7ba"
117
+ "gitHead": "45da67459db52df56b3893a2b7370d6466c374e2"
118
118
  }
package/tsconfig.json CHANGED
@@ -33,7 +33,7 @@
33
33
  "./src/.spruce/**/*",
34
34
  "./src/__tests__/**/.spruce/**/*.ts",
35
35
  "./src/__tests__/**/build/**/*.ts"
36
- ],
36
+ , "src/__tests__/testDirsAndFiles/app1/build/App.ac.ts" ],
37
37
  "exclude": [
38
38
  "build",
39
39
  "esm"