From 2414439a56b2308c1e79ca8cefda38e969703ec3 Mon Sep 17 00:00:00 2001 From: Aschen Date: Mon, 21 Feb 2022 09:11:32 +0100 Subject: [PATCH] ConfigManager: detect app --- lib/config/ConfigManager.js | 2 +- lib/config/ConfigManager.js.map | 2 +- lib/config/ConfigManager.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/config/ConfigManager.js b/lib/config/ConfigManager.js index eaa476f..36b0132 100644 --- a/lib/config/ConfigManager.js +++ b/lib/config/ConfigManager.js @@ -62,7 +62,7 @@ class ConfigManager { return this.appOrPlugin; } get isApp() { - return this.appOrPlugin.constructor.name === 'Backend'; + return this.appOrPlugin instanceof kuzzle_1.Backend; } /** * Register a new config document type diff --git a/lib/config/ConfigManager.js.map b/lib/config/ConfigManager.js.map index 6a0fd5a..e14e030 100644 --- a/lib/config/ConfigManager.js.map +++ b/lib/config/ConfigManager.js.map @@ -1 +1 @@ -{"version":3,"file":"ConfigManager.js","sourceRoot":"","sources":["ConfigManager.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,mCAAiJ;AAyCjJ;;;;;GAKG;AACH,MAAa,aAAa;IAyDxB,YAAa,WAA6B,EAAE,UAAgC,EAAE;QAxD9E;;;;WAIG;QACa,eAAU,GAAW,QAAQ,CAAC;QAE9C;;WAEG;QACI,iBAAY,GAAe;YAChC,OAAO,EAAE,QAAQ;YACjB,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gBAEzB,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;aAC3B;SACF,CAAC;QAEF;;WAEG;QACI,iBAAY,GAAe,EAAE,CAAC;QAE7B,gBAAW,GAAoC,OAAO,CAAC,EAAE,CAAC,kBAAS,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAE5F,mBAAc,GAAG,IAAI,GAAG,EAAsB,CAAC;QA+BrD,IAAI,CAAC,WAAW,GAAG,WAAW,CA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C;aAClI;SACF;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,YAAY;QAClB,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,8BAA8B,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAEnF,OAAO;SACR;QAED,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAmB,CAAC;QAE7F,IAAI,CAAE,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC,EAAE;YAClE,MAAM,IAAI,kCAAyB,CAAC,4DAA4D,CAAC,CAAC;SACnG;QAED,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,CAAC;CACF;AA/JD,sCA+JC"} \ No newline at end of file diff --git a/lib/config/ConfigManager.ts b/lib/config/ConfigManager.ts index a1666b8..bc8ae3f 100644 --- a/lib/config/ConfigManager.ts +++ b/lib/config/ConfigManager.ts @@ -100,7 +100,7 @@ export class ConfigManager { } private get isApp () { - return this.appOrPlugin.constructor.name === 'Backend'; + return this.appOrPlugin instanceof Backend; } constructor (appOrPlugin: Backend | Plugin, options: ConfigManagerOptions = {}) {