@sprucelabs/heartwood-view-controllers 111.1.32 → 111.1.33

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.
Files changed (32) hide show
  1. package/build/.spruce/errors/errors.types.d.ts +20 -0
  2. package/build/.spruce/errors/heartwoodViewControllers/invalidAppController.schema.d.ts +3 -0
  3. package/build/.spruce/errors/heartwoodViewControllers/invalidAppController.schema.js +19 -0
  4. package/build/.spruce/errors/options.types.d.ts +4 -1
  5. package/build/errors/SpruceError.js +3 -0
  6. package/build/errors/invalidAppController.builder.d.ts +11 -0
  7. package/build/errors/invalidAppController.builder.js +13 -0
  8. package/build/esm/.spruce/errors/errors.types.d.ts +20 -0
  9. package/build/esm/.spruce/errors/options.types.d.ts +4 -1
  10. package/build/esm/errors/SpruceError.js +3 -0
  11. package/build/esm/errors/invalidAppController.builder.d.ts +11 -0
  12. package/build/esm/errors/invalidAppController.builder.js +11 -0
  13. package/build/esm/index.d.ts +1 -1
  14. package/build/esm/index.js +1 -1
  15. package/build/esm/types/heartwood.types.d.ts +10 -4
  16. package/build/esm/viewControllers/Abstract.ac.d.ts +5 -0
  17. package/build/esm/viewControllers/Abstract.ac.js +3 -0
  18. package/build/esm/viewControllers/ViewControllerFactory.d.ts +8 -4
  19. package/build/esm/viewControllers/ViewControllerFactory.js +14 -2
  20. package/build/esm/viewControllers/ViewControllerImporter.d.ts +2 -2
  21. package/build/index.d.ts +1 -1
  22. package/build/index.js +3 -3
  23. package/build/types/heartwood.types.d.ts +10 -4
  24. package/build/viewControllers/Abstract.ac.d.ts +5 -0
  25. package/build/viewControllers/{Abstract.avc.js → Abstract.ac.js} +2 -2
  26. package/build/viewControllers/ViewControllerFactory.d.ts +8 -4
  27. package/build/viewControllers/ViewControllerFactory.js +14 -2
  28. package/build/viewControllers/ViewControllerImporter.d.ts +2 -2
  29. package/package.json +1 -1
  30. package/build/esm/viewControllers/Abstract.avc.d.ts +0 -5
  31. package/build/esm/viewControllers/Abstract.avc.js +0 -3
  32. package/build/viewControllers/Abstract.avc.d.ts +0 -5
@@ -215,6 +215,26 @@ export declare namespace SpruceErrors.HeartwoodViewControllers {
215
215
  }
216
216
  type InvalidSkillViewControllerEntity = SchemaEntity<SpruceErrors.HeartwoodViewControllers.InvalidSkillViewControllerSchema>;
217
217
  }
218
+ export declare namespace SpruceErrors.HeartwoodViewControllers {
219
+ interface InvalidAppController {
220
+ 'id': string;
221
+ }
222
+ interface InvalidAppControllerSchema extends SpruceSchema.Schema {
223
+ id: 'invalidAppController';
224
+ namespace: 'HeartwoodViewControllers';
225
+ name: 'Invalid app controller';
226
+ moduleToImportFromWhenRemote: '@sprucelabs/heartwood-view-controllers';
227
+ fields: {
228
+ /** . */
229
+ 'id': {
230
+ type: 'id';
231
+ isRequired: true;
232
+ options: undefined;
233
+ };
234
+ };
235
+ }
236
+ type InvalidAppControllerEntity = SchemaEntity<SpruceErrors.HeartwoodViewControllers.InvalidAppControllerSchema>;
237
+ }
218
238
  export declare namespace SpruceErrors.HeartwoodViewControllers {
219
239
  interface ExportFailed {
220
240
  }
@@ -0,0 +1,3 @@
1
+ import { SpruceErrors } from '../errors.types';
2
+ declare const invalidAppControllerSchema: SpruceErrors.HeartwoodViewControllers.InvalidAppControllerSchema;
3
+ export default invalidAppControllerSchema;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schema_1 = require("@sprucelabs/schema");
4
+ const invalidAppControllerSchema = {
5
+ id: 'invalidAppController',
6
+ namespace: 'HeartwoodViewControllers',
7
+ name: 'Invalid app controller',
8
+ moduleToImportFromWhenRemote: '@sprucelabs/heartwood-view-controllers',
9
+ fields: {
10
+ /** . */
11
+ 'id': {
12
+ type: 'id',
13
+ isRequired: true,
14
+ options: undefined
15
+ },
16
+ }
17
+ };
18
+ schema_1.SchemaRegistry.getInstance().trackSchema(invalidAppControllerSchema);
19
+ exports.default = invalidAppControllerSchema;
@@ -33,6 +33,9 @@ export interface InvalidViewControllerNameErrorOptions extends SpruceErrors.Hear
33
33
  export interface InvalidSkillViewControllerErrorOptions extends SpruceErrors.HeartwoodViewControllers.InvalidSkillViewController, ISpruceErrorOptions {
34
34
  code: 'INVALID_SKILL_VIEW_CONTROLLER';
35
35
  }
36
+ export interface InvalidAppControllerErrorOptions extends SpruceErrors.HeartwoodViewControllers.InvalidAppController, ISpruceErrorOptions {
37
+ code: 'INVALID_APP_CONTROLLER';
38
+ }
36
39
  export interface ExportFailedErrorOptions extends SpruceErrors.HeartwoodViewControllers.ExportFailed, ISpruceErrorOptions {
37
40
  code: 'EXPORT_FAILED';
38
41
  }
@@ -60,5 +63,5 @@ export interface CellDeletedErrorOptions extends SpruceErrors.HeartwoodViewContr
60
63
  export interface AppNotFoundErrorOptions extends SpruceErrors.HeartwoodViewControllers.AppNotFound, ISpruceErrorOptions {
61
64
  code: 'APP_NOT_FOUND';
62
65
  }
63
- type ErrorOptions = ViewAlreadyDestroyedErrorOptions | ToolNotFoundErrorOptions | StepNotCompleteErrorOptions | SlideNotFoundErrorOptions | RowDeletedErrorOptions | PersonNotFoundErrorOptions | NoFieldVcSetErrorOptions | MissingStorageErrorOptions | InvalidViewControllerSourceErrorOptions | InvalidViewControllerNameErrorOptions | InvalidSkillViewControllerErrorOptions | ExportFailedErrorOptions | EventNotFoundErrorOptions | DuplicateToolIdErrorOptions | DuplicateRowIdErrorOptions | DuplicateEventIdErrorOptions | DateNotSelectedErrorOptions | DateAlreadySelectedErrorOptions | CellDeletedErrorOptions | AppNotFoundErrorOptions;
66
+ type ErrorOptions = ViewAlreadyDestroyedErrorOptions | ToolNotFoundErrorOptions | StepNotCompleteErrorOptions | SlideNotFoundErrorOptions | RowDeletedErrorOptions | PersonNotFoundErrorOptions | NoFieldVcSetErrorOptions | MissingStorageErrorOptions | InvalidViewControllerSourceErrorOptions | InvalidViewControllerNameErrorOptions | InvalidSkillViewControllerErrorOptions | InvalidAppControllerErrorOptions | ExportFailedErrorOptions | EventNotFoundErrorOptions | DuplicateToolIdErrorOptions | DuplicateRowIdErrorOptions | DuplicateEventIdErrorOptions | DateNotSelectedErrorOptions | DateAlreadySelectedErrorOptions | CellDeletedErrorOptions | AppNotFoundErrorOptions;
64
67
  export default ErrorOptions;
@@ -77,6 +77,9 @@ class SpruceError extends error_1.default {
77
77
  case 'APP_NOT_FOUND':
78
78
  message = `I could not find an App with the namespace '${options.namespace}'!`;
79
79
  break;
80
+ case 'INVALID_APP_CONTROLLER':
81
+ message = 'A Invalid app controller just happened!';
82
+ break;
80
83
  default:
81
84
  message = super.friendlyMessage();
82
85
  }
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ id: string;
3
+ name: string;
4
+ fields: {
5
+ id: {
6
+ type: "id";
7
+ isRequired: true;
8
+ };
9
+ };
10
+ };
11
+ export default _default;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schema_1 = require("@sprucelabs/schema");
4
+ exports.default = (0, schema_1.buildErrorSchema)({
5
+ id: 'invalidAppController',
6
+ name: 'Invalid app controller',
7
+ fields: {
8
+ id: {
9
+ type: 'id',
10
+ isRequired: true,
11
+ },
12
+ },
13
+ });
@@ -215,6 +215,26 @@ export declare namespace SpruceErrors.HeartwoodViewControllers {
215
215
  }
216
216
  type InvalidSkillViewControllerEntity = SchemaEntity<SpruceErrors.HeartwoodViewControllers.InvalidSkillViewControllerSchema>;
217
217
  }
218
+ export declare namespace SpruceErrors.HeartwoodViewControllers {
219
+ interface InvalidAppController {
220
+ 'id': string;
221
+ }
222
+ interface InvalidAppControllerSchema extends SpruceSchema.Schema {
223
+ id: 'invalidAppController';
224
+ namespace: 'HeartwoodViewControllers';
225
+ name: 'Invalid app controller';
226
+ moduleToImportFromWhenRemote: '@sprucelabs/heartwood-view-controllers';
227
+ fields: {
228
+ /** . */
229
+ 'id': {
230
+ type: 'id';
231
+ isRequired: true;
232
+ options: undefined;
233
+ };
234
+ };
235
+ }
236
+ type InvalidAppControllerEntity = SchemaEntity<SpruceErrors.HeartwoodViewControllers.InvalidAppControllerSchema>;
237
+ }
218
238
  export declare namespace SpruceErrors.HeartwoodViewControllers {
219
239
  interface ExportFailed {
220
240
  }
@@ -33,6 +33,9 @@ export interface InvalidViewControllerNameErrorOptions extends SpruceErrors.Hear
33
33
  export interface InvalidSkillViewControllerErrorOptions extends SpruceErrors.HeartwoodViewControllers.InvalidSkillViewController, ISpruceErrorOptions {
34
34
  code: 'INVALID_SKILL_VIEW_CONTROLLER';
35
35
  }
36
+ export interface InvalidAppControllerErrorOptions extends SpruceErrors.HeartwoodViewControllers.InvalidAppController, ISpruceErrorOptions {
37
+ code: 'INVALID_APP_CONTROLLER';
38
+ }
36
39
  export interface ExportFailedErrorOptions extends SpruceErrors.HeartwoodViewControllers.ExportFailed, ISpruceErrorOptions {
37
40
  code: 'EXPORT_FAILED';
38
41
  }
@@ -60,5 +63,5 @@ export interface CellDeletedErrorOptions extends SpruceErrors.HeartwoodViewContr
60
63
  export interface AppNotFoundErrorOptions extends SpruceErrors.HeartwoodViewControllers.AppNotFound, ISpruceErrorOptions {
61
64
  code: 'APP_NOT_FOUND';
62
65
  }
63
- type ErrorOptions = ViewAlreadyDestroyedErrorOptions | ToolNotFoundErrorOptions | StepNotCompleteErrorOptions | SlideNotFoundErrorOptions | RowDeletedErrorOptions | PersonNotFoundErrorOptions | NoFieldVcSetErrorOptions | MissingStorageErrorOptions | InvalidViewControllerSourceErrorOptions | InvalidViewControllerNameErrorOptions | InvalidSkillViewControllerErrorOptions | ExportFailedErrorOptions | EventNotFoundErrorOptions | DuplicateToolIdErrorOptions | DuplicateRowIdErrorOptions | DuplicateEventIdErrorOptions | DateNotSelectedErrorOptions | DateAlreadySelectedErrorOptions | CellDeletedErrorOptions | AppNotFoundErrorOptions;
66
+ type ErrorOptions = ViewAlreadyDestroyedErrorOptions | ToolNotFoundErrorOptions | StepNotCompleteErrorOptions | SlideNotFoundErrorOptions | RowDeletedErrorOptions | PersonNotFoundErrorOptions | NoFieldVcSetErrorOptions | MissingStorageErrorOptions | InvalidViewControllerSourceErrorOptions | InvalidViewControllerNameErrorOptions | InvalidSkillViewControllerErrorOptions | InvalidAppControllerErrorOptions | ExportFailedErrorOptions | EventNotFoundErrorOptions | DuplicateToolIdErrorOptions | DuplicateRowIdErrorOptions | DuplicateEventIdErrorOptions | DateNotSelectedErrorOptions | DateAlreadySelectedErrorOptions | CellDeletedErrorOptions | AppNotFoundErrorOptions;
64
67
  export default ErrorOptions;
@@ -73,6 +73,9 @@ export default class SpruceError extends AbstractSpruceError {
73
73
  case 'APP_NOT_FOUND':
74
74
  message = `I could not find an App with the namespace '${options.namespace}'!`;
75
75
  break;
76
+ case 'INVALID_APP_CONTROLLER':
77
+ message = 'A Invalid app controller just happened!';
78
+ break;
76
79
  default:
77
80
  message = super.friendlyMessage();
78
81
  }
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ id: string;
3
+ name: string;
4
+ fields: {
5
+ id: {
6
+ type: "id";
7
+ isRequired: true;
8
+ };
9
+ };
10
+ };
11
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { buildErrorSchema } from '@sprucelabs/schema';
2
+ export default buildErrorSchema({
3
+ id: 'invalidAppController',
4
+ name: 'Invalid app controller',
5
+ fields: {
6
+ id: {
7
+ type: 'id',
8
+ isRequired: true,
9
+ },
10
+ },
11
+ });
@@ -4,7 +4,7 @@ export * from './utilities/removeUniversalViewOptions';
4
4
  export * from './.spruce/schemas/schemas.types';
5
5
  export { default as AbstractSkillViewController } from './skillViewControllers/Abstract.svc';
6
6
  export { default as AbstractViewController } from './viewControllers/Abstract.vc';
7
- export { default as AbstractAppViewController } from './viewControllers/Abstract.avc';
7
+ export { default as AbstractAppController } from './viewControllers/Abstract.ac';
8
8
  export * from './viewControllers/BigForm.vc';
9
9
  export { default as ButtonGroupViewController } from './viewControllers/ButtonGroup.vc';
10
10
  export * from './viewControllers/ButtonGroup.vc';
@@ -4,7 +4,7 @@ export * from './utilities/removeUniversalViewOptions.js';
4
4
  export * from './.spruce/schemas/schemas.types.js';
5
5
  export { default as AbstractSkillViewController } from './skillViewControllers/Abstract.svc.js';
6
6
  export { default as AbstractViewController } from './viewControllers/Abstract.vc.js';
7
- export { default as AbstractAppViewController } from './viewControllers/Abstract.avc.js';
7
+ export { default as AbstractAppController } from './viewControllers/Abstract.ac.js';
8
8
  export * from './viewControllers/BigForm.vc.js';
9
9
  export { default as ButtonGroupViewController } from './viewControllers/ButtonGroup.vc.js';
10
10
  export * from './viewControllers/ButtonGroup.vc.js';
@@ -210,6 +210,7 @@ export type ImportedViewController = (new (options: ViewControllerOptions) => Vi
210
210
  };
211
211
  export type ViewControllerId = keyof ViewControllerMap;
212
212
  export type SkillViewControllerId = keyof SkillViewControllerMap;
213
+ export type AppControllerId = keyof AppControllerMap;
213
214
  export interface RedirectOptions {
214
215
  shouldTrackHistory?: boolean;
215
216
  }
@@ -349,6 +350,8 @@ export interface SkillViewControllerMap {
349
350
  }
350
351
  export interface SkillViewControllerArgsMap {
351
352
  }
353
+ export interface AppControllerMap {
354
+ }
352
355
  export type ControllerOptions<N extends ViewControllerId, O extends ViewControllerOptionsMap = ViewControllerOptionsMap> = Omit<N extends keyof O ? O[N] : Record<string, never>, UniversalViewOptionFields>;
353
356
  export type MapUtil = typeof mapUtil;
354
357
  export interface OpenNavigationOptions {
@@ -511,15 +514,18 @@ export interface ActiveRecordSearchOptions {
511
514
  shouldSearchClientSide?: boolean;
512
515
  placeholder?: string;
513
516
  }
514
- export interface AppViewController {
517
+ export interface AppController {
515
518
  renderNavigation?(): Navigation | null | undefined;
516
519
  renderToolBelt?(): ToolBelt | null | undefined;
517
- load?(options: AppViewControllerLoadOptions): Promise<void>;
520
+ load?(options: AppControllerLoadOptions): Promise<void>;
518
521
  }
519
- export type AppViewControllerConstructor = (new (options: ViewControllerOptions) => AppViewController) & {
522
+ export type BuiltAppController = AppController & {
523
+ id: string;
524
+ };
525
+ export type AppControllerConstructor = (new (options: ViewControllerOptions) => AppController) & {
520
526
  id: string;
521
527
  };
522
- export interface AppViewControllerLoadOptions {
528
+ export interface AppControllerLoadOptions {
523
529
  router: Router;
524
530
  authenticator: Authenticator;
525
531
  authorizer: Authorizer;
@@ -0,0 +1,5 @@
1
+ import { AppController, ViewControllerOptions } from '../types/heartwood.types';
2
+ export default abstract class AbstractAppController implements AppController {
3
+ static id: string;
4
+ constructor(_options: ViewControllerOptions);
5
+ }
@@ -0,0 +1,3 @@
1
+ export default class AbstractAppController {
2
+ constructor(_options) { }
3
+ }
@@ -1,6 +1,6 @@
1
1
  import { DateUtil } from '@sprucelabs/calendar-utils';
2
2
  import { Log } from '@sprucelabs/spruce-skill-utils';
3
- import { ConfirmHandler, ControllerOptions, ImportedViewController, RenderInDialogHandler, ViewController, ViewControllerMap, ViewControllerId, VoteHandler, Device, MapUtil, ViewControllerConstructor, ToastHandler, ViewControllerPlugins, ViewControllerPluginsByName, ConnectToApi, ViewControllerPlugin, ViewControllerPluginOptions, ViewControllerOptions, AppViewController, AppViewControllerConstructor } from '../types/heartwood.types';
3
+ import { ConfirmHandler, ControllerOptions, ImportedViewController, RenderInDialogHandler, ViewController, ViewControllerMap, ViewControllerId, VoteHandler, Device, MapUtil, ViewControllerConstructor, ToastHandler, ViewControllerPlugins, ViewControllerPluginsByName, ConnectToApi, ViewControllerPlugin, ViewControllerPluginOptions, ViewControllerOptions, AppController, AppControllerConstructor, AppControllerId, AppControllerMap } from '../types/heartwood.types';
4
4
  export default class ViewControllerFactory {
5
5
  static Class?: typeof ViewControllerFactory;
6
6
  private controllerMap;
@@ -22,16 +22,20 @@ export default class ViewControllerFactory {
22
22
  static Factory(options: ViewControllerFactoryOptions): ViewControllerFactory;
23
23
  setController<Vc extends ViewController<any>>(name: string, Class: ViewControllerConstructor<Vc>): void;
24
24
  mixinControllers(map: Record<string, ViewControllerConstructor<ViewController<any>>>): void;
25
- importControllers<Vc extends ImportedViewController>(Vcs: Vc[], plugins?: ViewControllerPluginsByName, App?: AppViewControllerConstructor): void;
25
+ importControllers<Vc extends ImportedViewController>(Vcs: Vc[], plugins?: ViewControllerPluginsByName, App?: AppControllerConstructor): void;
26
26
  private importPlugins;
27
27
  BuildPlugin<P extends ViewControllerPlugin>(Plugin: new (options: ViewControllerPluginOptions) => P): P;
28
- BuildApp<A extends AppViewController>(App: new (options: ViewControllerOptions) => A): A;
28
+ BuildApp<A extends AppController>(App: new (options: ViewControllerOptions) => A): A & {
29
+ id: string;
30
+ };
29
31
  hasController(name: string): boolean;
30
32
  hasApp(namespace: string): boolean;
31
33
  getController<N extends ViewControllerId>(name: N): any;
32
34
  setDates(dates: DateUtil): void;
33
35
  addPlugin(named: string, plugin: ViewControllerPlugin): void;
34
- App(namespace: string): AppViewController;
36
+ App<Id extends AppControllerId>(namespace: Id): AppControllerMap[Id] & {
37
+ id: Id;
38
+ };
35
39
  Controller<N extends ViewControllerId, O extends ControllerOptions<N>>(id: N, options: O): ViewControllerMap[N];
36
40
  protected buildViewContructorOptions(name: string, options?: Record<string, any>): ViewControllerOptions;
37
41
  private sharedConstructorOptions;
@@ -84,7 +84,19 @@ export default class ViewControllerFactory {
84
84
  return new Plugin(this.sharedConstructorOptions());
85
85
  }
86
86
  BuildApp(App) {
87
- return new App(this.buildViewContructorOptions('App'));
87
+ const app = new App(this.buildViewContructorOptions('App'));
88
+ //@ts-ignore
89
+ if (app.id) {
90
+ throw new SpruceError({
91
+ code: 'INVALID_APP_CONTROLLER',
92
+ friendlyMessage: `Property \`id\` is reserved in your AppController. Please rename it to \`_id\`.`,
93
+ //@ts-ignore
94
+ id: App.id,
95
+ });
96
+ }
97
+ //@ts-ignore
98
+ app.id = App.id;
99
+ return app;
88
100
  }
89
101
  hasController(name) {
90
102
  //@ts-ignore
@@ -131,7 +143,7 @@ export default class ViewControllerFactory {
131
143
  if (instance.id) {
132
144
  throw new SpruceError({
133
145
  code: 'INVALID_SKILL_VIEW_CONTROLLER',
134
- friendlyMessage: `Property \`id\` is reserved. Please rename it to \`_id\`.`,
146
+ friendlyMessage: `Property \`id\` is reserved in your ViewController. Please rename it to \`_id\`.`,
135
147
  id,
136
148
  });
137
149
  }
@@ -1,4 +1,4 @@
1
- import { AppViewControllerConstructor, ImportedViewController, ViewControllerPluginsByName } from '../types/heartwood.types';
1
+ import { AppControllerConstructor, ImportedViewController, ViewControllerPluginsByName } from '../types/heartwood.types';
2
2
  export default class ViewControllerImporter {
3
3
  static Class?: typeof ViewControllerImporter;
4
4
  protected constructor();
@@ -9,7 +9,7 @@ export default class ViewControllerImporter {
9
9
  }
10
10
  interface ImportResults {
11
11
  controllers: ImportedViewController[];
12
- App?: AppViewControllerConstructor;
12
+ App?: AppControllerConstructor;
13
13
  plugins: ViewControllerPluginsByName;
14
14
  }
15
15
  export {};
package/build/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export * from './utilities/removeUniversalViewOptions';
4
4
  export * from './.spruce/schemas/schemas.types';
5
5
  export { default as AbstractSkillViewController } from './skillViewControllers/Abstract.svc';
6
6
  export { default as AbstractViewController } from './viewControllers/Abstract.vc';
7
- export { default as AbstractAppViewController } from './viewControllers/Abstract.avc';
7
+ export { default as AbstractAppController } from './viewControllers/Abstract.ac';
8
8
  export * from './viewControllers/BigForm.vc';
9
9
  export { default as ButtonGroupViewController } from './viewControllers/ButtonGroup.vc';
10
10
  export * from './viewControllers/ButtonGroup.vc';
package/build/index.js CHANGED
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.dialogSchema = exports.buttonSchema = exports.lineIconSchema = exports.fancyIconSchema = exports.selectInputSchema = exports.skillViewSchema = exports.bigFormSchema = exports.calendarEventColorsSchema = exports.buildSkillView = exports.buildForm = exports.buildBigForm = exports.AuthenticatorImpl = exports.PolarAreaViewController = exports.MockActiveRecordCard = exports.activeRecordCardAssert = exports.buildActiveRecordList = exports.buildActiveRecordCard = exports.AbstractInputViewController = exports.AutocompleteInputViewController = exports.AbstractCalendarEventViewController = exports.RatingsViewController = exports.ProgressViewController = exports.StatsViewController = exports.FeedViewController = exports.ActiveRecordListViewController = exports.ActiveRecordCardViewController = exports.TalkingSprucebotViewController = exports.ButtonBarViewController = exports.CalendarViewController = exports.SwipeCardViewControllerImpl = exports.SwipeViewControllerImpl = exports.PagerViewController = exports.ProgressNavigatorViewController = exports.CountdownTimerViewController = exports.FormBuilderCardViewControllerImpl = exports.LoginViewController = exports.BarChartViewController = exports.ToolBeltViewController = exports.FormViewControllerImpl = exports.ListCellViewController = exports.ListRowViewController = exports.ListViewController = exports.NavigationViewController = exports.DialogViewController = exports.ConfirmViewController = exports.CardViewControllerImpl = exports.ButtonGroupViewController = exports.AbstractAppViewController = exports.AbstractViewController = exports.AbstractSkillViewController = void 0;
20
+ exports.dialogSchema = exports.buttonSchema = exports.lineIconSchema = exports.fancyIconSchema = exports.selectInputSchema = exports.skillViewSchema = exports.bigFormSchema = exports.calendarEventColorsSchema = exports.buildSkillView = exports.buildForm = exports.buildBigForm = exports.AuthenticatorImpl = exports.PolarAreaViewController = exports.MockActiveRecordCard = exports.activeRecordCardAssert = exports.buildActiveRecordList = exports.buildActiveRecordCard = exports.AbstractInputViewController = exports.AutocompleteInputViewController = exports.AbstractCalendarEventViewController = exports.RatingsViewController = exports.ProgressViewController = exports.StatsViewController = exports.FeedViewController = exports.ActiveRecordListViewController = exports.ActiveRecordCardViewController = exports.TalkingSprucebotViewController = exports.ButtonBarViewController = exports.CalendarViewController = exports.SwipeCardViewControllerImpl = exports.SwipeViewControllerImpl = exports.PagerViewController = exports.ProgressNavigatorViewController = exports.CountdownTimerViewController = exports.FormBuilderCardViewControllerImpl = exports.LoginViewController = exports.BarChartViewController = exports.ToolBeltViewController = exports.FormViewControllerImpl = exports.ListCellViewController = exports.ListRowViewController = exports.ListViewController = exports.NavigationViewController = exports.DialogViewController = exports.ConfirmViewController = exports.CardViewControllerImpl = exports.ButtonGroupViewController = exports.AbstractAppController = exports.AbstractViewController = exports.AbstractSkillViewController = void 0;
21
21
  exports.ratingsInputSchema = exports.listRatingsInputSchema = exports.ratingsSchema = exports.progressSchema = exports.statsStatSchema = exports.statsSchema = exports.toggleInputSchema = exports.listToggleInputSchema = exports.addressInputSchema = exports.buttonBarButtonSchema = exports.buttonBarSchema = exports.toolBeltToolSchema = exports.toolBeltSchema = exports.calendarTimeSchema = exports.calendarPersonSchema = exports.calendarSchema = exports.themePropsSchema = exports.themeSchema = exports.cardFooterButtonSchema = exports.criticalErrorSchema = exports.sprucebotTypedMessageSentenceSchema = exports.sprucebotTypedMessageAvatarSchema = exports.selectInputChoiceSchema = exports.calendarEventColorOverrideSchema = exports.portalSchema = exports.listTextInputSchema = exports.listSelectInputSchema = exports.listCellButtonSchema = exports.dropdownButtonSchema = exports.bigFormSectionSchema = exports.textInputSchema = exports.phoneInputSchema = exports.inputSchema = exports.dropdownSchema = exports.sprucebotTypedMessageSchema = exports.talkingSprucebotSchema = exports.sprucebotAvatarSchema = exports.formBuilderImportExportObjectSchema = exports.listCellSchema = exports.listRowSchema = exports.listSchema = exports.layoutSchema = exports.cardSectionSchema = exports.cardHeaderSchema = exports.cardFooterSchema = exports.cardBodySchema = exports.cardSchema = exports.formSectionSchema = exports.formSchema = exports.textSchema = void 0;
22
22
  exports.barChartAssert = exports.progressNavigatorAssert = exports.countdownTimerInteractor = exports.countdownTimerAssert = exports.calendarInteractor = exports.interactor = exports.normalizeScopeFromVc = exports.autocompleteInteractor = exports.formAssert = exports.autocompleteAssert = exports.listAssert = exports.buttonAssert = exports.deviceAssert = exports.navigationAssert = exports.toolBeltAssert = exports.toastAssert = exports.vcPluginAssert = exports.vcDurationAssert = exports.pagerAssert = exports.vcAssert = exports.vcAssertUtil = exports.feedAssert = exports.feedInteractor = exports.normalizeFormSectionFieldNamesUtil = exports.ViewControllerError = exports.SpyDevice = exports.StubStorage = exports.ViewControllerFactory = exports.ViewControllerImporter = exports.ViewControllerExporter = exports.pagerSchema = exports.polarAreaDataItemSchema = exports.polarAreaSchema = exports.inputButtonSchema = exports.mapPinSchema = exports.mapSchema = exports.latLngSchema = exports.formBuilderImportExportPageSchema = exports.autocompleteSuggestionSchema = exports.autocompleteInputSchema = exports.feedSchema = exports.calendarShiftSchema = exports.receiptTotalSchema = exports.receiptSectionSchema = exports.receiptLineItemSchema = exports.receiptHeaderSchema = exports.receiptSchema = exports.listDateInputSchema = exports.calendarSelectedDateSchema = exports.calendarEventSchema = void 0;
23
23
  exports.barChartDataSetSchema = exports.barChartDataPointSchema = exports.barChartSchema = exports.progressDetailsSchema = exports.progressNavigatorStepSchema = exports.progressNavigatorSchema = exports.countdownTimerSchema = exports.destinationSkillViewControllerSchema = exports.permissionContractReferenceSchema = exports.navigationButtonSchema = exports.navigationSchema = exports.ToolBeltStateMachine = exports.removeUniversalViewOptions = exports.buildSkillViewLayout = exports.splitCardsIntoLayouts = exports.listUtil = exports.mapInteractor = exports.mapAssert = exports.renderUtil = exports.routerTestPatcher = exports.dialogTestPatcher = exports.confirmTestPatcher = exports.calendarSeeder = exports.interactionUtil = void 0;
@@ -29,8 +29,8 @@ var Abstract_svc_1 = require("./skillViewControllers/Abstract.svc");
29
29
  Object.defineProperty(exports, "AbstractSkillViewController", { enumerable: true, get: function () { return __importDefault(Abstract_svc_1).default; } });
30
30
  var Abstract_vc_1 = require("./viewControllers/Abstract.vc");
31
31
  Object.defineProperty(exports, "AbstractViewController", { enumerable: true, get: function () { return __importDefault(Abstract_vc_1).default; } });
32
- var Abstract_avc_1 = require("./viewControllers/Abstract.avc");
33
- Object.defineProperty(exports, "AbstractAppViewController", { enumerable: true, get: function () { return __importDefault(Abstract_avc_1).default; } });
32
+ var Abstract_ac_1 = require("./viewControllers/Abstract.ac");
33
+ Object.defineProperty(exports, "AbstractAppController", { enumerable: true, get: function () { return __importDefault(Abstract_ac_1).default; } });
34
34
  __exportStar(require("./viewControllers/BigForm.vc"), exports);
35
35
  var ButtonGroup_vc_1 = require("./viewControllers/ButtonGroup.vc");
36
36
  Object.defineProperty(exports, "ButtonGroupViewController", { enumerable: true, get: function () { return __importDefault(ButtonGroup_vc_1).default; } });
@@ -210,6 +210,7 @@ export type ImportedViewController = (new (options: ViewControllerOptions) => Vi
210
210
  };
211
211
  export type ViewControllerId = keyof ViewControllerMap;
212
212
  export type SkillViewControllerId = keyof SkillViewControllerMap;
213
+ export type AppControllerId = keyof AppControllerMap;
213
214
  export interface RedirectOptions {
214
215
  shouldTrackHistory?: boolean;
215
216
  }
@@ -349,6 +350,8 @@ export interface SkillViewControllerMap {
349
350
  }
350
351
  export interface SkillViewControllerArgsMap {
351
352
  }
353
+ export interface AppControllerMap {
354
+ }
352
355
  export type ControllerOptions<N extends ViewControllerId, O extends ViewControllerOptionsMap = ViewControllerOptionsMap> = Omit<N extends keyof O ? O[N] : Record<string, never>, UniversalViewOptionFields>;
353
356
  export type MapUtil = typeof mapUtil;
354
357
  export interface OpenNavigationOptions {
@@ -511,15 +514,18 @@ export interface ActiveRecordSearchOptions {
511
514
  shouldSearchClientSide?: boolean;
512
515
  placeholder?: string;
513
516
  }
514
- export interface AppViewController {
517
+ export interface AppController {
515
518
  renderNavigation?(): Navigation | null | undefined;
516
519
  renderToolBelt?(): ToolBelt | null | undefined;
517
- load?(options: AppViewControllerLoadOptions): Promise<void>;
520
+ load?(options: AppControllerLoadOptions): Promise<void>;
518
521
  }
519
- export type AppViewControllerConstructor = (new (options: ViewControllerOptions) => AppViewController) & {
522
+ export type BuiltAppController = AppController & {
523
+ id: string;
524
+ };
525
+ export type AppControllerConstructor = (new (options: ViewControllerOptions) => AppController) & {
520
526
  id: string;
521
527
  };
522
- export interface AppViewControllerLoadOptions {
528
+ export interface AppControllerLoadOptions {
523
529
  router: Router;
524
530
  authenticator: Authenticator;
525
531
  authorizer: Authorizer;
@@ -0,0 +1,5 @@
1
+ import { AppController, ViewControllerOptions } from '../types/heartwood.types';
2
+ export default abstract class AbstractAppController implements AppController {
3
+ static id: string;
4
+ constructor(_options: ViewControllerOptions);
5
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- class AbstractAppViewController {
3
+ class AbstractAppController {
4
4
  constructor(_options) { }
5
5
  }
6
- exports.default = AbstractAppViewController;
6
+ exports.default = AbstractAppController;
@@ -1,6 +1,6 @@
1
1
  import { DateUtil } from '@sprucelabs/calendar-utils';
2
2
  import { Log } from '@sprucelabs/spruce-skill-utils';
3
- import { ConfirmHandler, ControllerOptions, ImportedViewController, RenderInDialogHandler, ViewController, ViewControllerMap, ViewControllerId, VoteHandler, Device, MapUtil, ViewControllerConstructor, ToastHandler, ViewControllerPlugins, ViewControllerPluginsByName, ConnectToApi, ViewControllerPlugin, ViewControllerPluginOptions, ViewControllerOptions, AppViewController, AppViewControllerConstructor } from '../types/heartwood.types';
3
+ import { ConfirmHandler, ControllerOptions, ImportedViewController, RenderInDialogHandler, ViewController, ViewControllerMap, ViewControllerId, VoteHandler, Device, MapUtil, ViewControllerConstructor, ToastHandler, ViewControllerPlugins, ViewControllerPluginsByName, ConnectToApi, ViewControllerPlugin, ViewControllerPluginOptions, ViewControllerOptions, AppController, AppControllerConstructor, AppControllerId, AppControllerMap } from '../types/heartwood.types';
4
4
  export default class ViewControllerFactory {
5
5
  static Class?: typeof ViewControllerFactory;
6
6
  private controllerMap;
@@ -22,16 +22,20 @@ export default class ViewControllerFactory {
22
22
  static Factory(options: ViewControllerFactoryOptions): ViewControllerFactory;
23
23
  setController<Vc extends ViewController<any>>(name: string, Class: ViewControllerConstructor<Vc>): void;
24
24
  mixinControllers(map: Record<string, ViewControllerConstructor<ViewController<any>>>): void;
25
- importControllers<Vc extends ImportedViewController>(Vcs: Vc[], plugins?: ViewControllerPluginsByName, App?: AppViewControllerConstructor): void;
25
+ importControllers<Vc extends ImportedViewController>(Vcs: Vc[], plugins?: ViewControllerPluginsByName, App?: AppControllerConstructor): void;
26
26
  private importPlugins;
27
27
  BuildPlugin<P extends ViewControllerPlugin>(Plugin: new (options: ViewControllerPluginOptions) => P): P;
28
- BuildApp<A extends AppViewController>(App: new (options: ViewControllerOptions) => A): A;
28
+ BuildApp<A extends AppController>(App: new (options: ViewControllerOptions) => A): A & {
29
+ id: string;
30
+ };
29
31
  hasController(name: string): boolean;
30
32
  hasApp(namespace: string): boolean;
31
33
  getController<N extends ViewControllerId>(name: N): any;
32
34
  setDates(dates: DateUtil): void;
33
35
  addPlugin(named: string, plugin: ViewControllerPlugin): void;
34
- App(namespace: string): AppViewController;
36
+ App<Id extends AppControllerId>(namespace: Id): AppControllerMap[Id] & {
37
+ id: Id;
38
+ };
35
39
  Controller<N extends ViewControllerId, O extends ControllerOptions<N>>(id: N, options: O): ViewControllerMap[N];
36
40
  protected buildViewContructorOptions(name: string, options?: Record<string, any>): ViewControllerOptions;
37
41
  private sharedConstructorOptions;
@@ -82,7 +82,19 @@ class ViewControllerFactory {
82
82
  return new Plugin(this.sharedConstructorOptions());
83
83
  }
84
84
  BuildApp(App) {
85
- return new App(this.buildViewContructorOptions('App'));
85
+ const app = new App(this.buildViewContructorOptions('App'));
86
+ //@ts-ignore
87
+ if (app.id) {
88
+ throw new SpruceError_1.default({
89
+ code: 'INVALID_APP_CONTROLLER',
90
+ friendlyMessage: `Property \`id\` is reserved in your AppController. Please rename it to \`_id\`.`,
91
+ //@ts-ignore
92
+ id: App.id,
93
+ });
94
+ }
95
+ //@ts-ignore
96
+ app.id = App.id;
97
+ return app;
86
98
  }
87
99
  hasController(name) {
88
100
  //@ts-ignore
@@ -129,7 +141,7 @@ class ViewControllerFactory {
129
141
  if (instance.id) {
130
142
  throw new SpruceError_1.default({
131
143
  code: 'INVALID_SKILL_VIEW_CONTROLLER',
132
- friendlyMessage: `Property \`id\` is reserved. Please rename it to \`_id\`.`,
144
+ friendlyMessage: `Property \`id\` is reserved in your ViewController. Please rename it to \`_id\`.`,
133
145
  id,
134
146
  });
135
147
  }
@@ -1,4 +1,4 @@
1
- import { AppViewControllerConstructor, ImportedViewController, ViewControllerPluginsByName } from '../types/heartwood.types';
1
+ import { AppControllerConstructor, ImportedViewController, ViewControllerPluginsByName } from '../types/heartwood.types';
2
2
  export default class ViewControllerImporter {
3
3
  static Class?: typeof ViewControllerImporter;
4
4
  protected constructor();
@@ -9,7 +9,7 @@ export default class ViewControllerImporter {
9
9
  }
10
10
  interface ImportResults {
11
11
  controllers: ImportedViewController[];
12
- App?: AppViewControllerConstructor;
12
+ App?: AppControllerConstructor;
13
13
  plugins: ViewControllerPluginsByName;
14
14
  }
15
15
  export {};
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "sideEffects": false,
14
14
  "license": "MIT",
15
15
  "description": "All the power of Heartwood in one, convenient package.",
16
- "version": "111.1.32",
16
+ "version": "111.1.33",
17
17
  "skill": {
18
18
  "namespace": "HeartwoodViewControllers",
19
19
  "commandOverrides": {
@@ -1,5 +0,0 @@
1
- import { AppViewController, ViewControllerOptions } from '../types/heartwood.types';
2
- export default abstract class AbstractAppViewController implements AppViewController {
3
- static id: string;
4
- constructor(_options: ViewControllerOptions);
5
- }
@@ -1,3 +0,0 @@
1
- export default class AbstractAppViewController {
2
- constructor(_options) { }
3
- }
@@ -1,5 +0,0 @@
1
- import { AppViewController, ViewControllerOptions } from '../types/heartwood.types';
2
- export default abstract class AbstractAppViewController implements AppViewController {
3
- static id: string;
4
- constructor(_options: ViewControllerOptions);
5
- }