create AposConstructor Type, add beforeConstruct in ModuleOptions (#29445)

* create AposConstructor Type, add beforeConstruct in ModuleOptions

* Add all options to AposConstructor
This commit is contained in:
afholderman
2018-10-11 13:52:57 -06:00
committed by Wesley Wigham
parent 52a012c362
commit 8baf389b69

View File

@@ -7,7 +7,10 @@
export = apostrophe;
export as namespace apos;
declare function apostrophe(options: any, ...args: any[]): any;
declare function apostrophe(
options: apostrophe.AposConstructor,
...args: any[]
): any;
declare namespace apostrophe {
const moogBundle: {
@@ -15,6 +18,20 @@ declare namespace apostrophe {
modules: string[];
};
// Pass in custom modules as first argument
// second argument is additional custom options e.g. restApi exposed by apostrophe-headless
interface AposConstructor<M = {}, O = {}> {
afterInit?: () => void;
afterListen?: () => void;
initFailed?: (error: any) => void;
baseUrl?: string;
modules: { [K in AposCoreModules & M]?: AposModuleOptions | O };
prefix?: string;
root?: string;
rootDir?: string;
shortName: string;
}
const ui: {
globalBusy: (state: any) => any;
link: (
@@ -297,6 +314,7 @@ declare namespace apostrophe {
label: string;
fields: string[];
}[];
beforeConstruct?: (self: any, options: any) => any;
defer?: boolean;
filters?: {
projection?: {