• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bpatrik / pigallery2 / 8179020003

06 Mar 2024 09:29PM UTC coverage: 64.618% (+0.2%) from 64.464%
8179020003

push

github

web-flow
Merge pull request #845 from grasdk/feature/timestamp_rework_test_fix

fix leap year searching and tests. small metadatabuffer size optimization

1486 of 2627 branches covered (56.57%)

Branch coverage included in aggregate %.

259 of 319 new or added lines in 3 files covered. (81.19%)

216 existing lines in 13 files now uncovered.

4329 of 6372 relevant lines covered (67.94%)

13519.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

39.47
/src/backend/model/extension/ExtensionConfigWrapper.ts
1
import {IConfigClass} from 'typeconfig/common';
2
import {Config, PrivateConfigClass} from '../../../common/config/private/Config';
1✔
3
import {ConfigClassBuilder} from 'typeconfig/node';
1✔
4
import {IExtensionConfig} from './IExtension';
5
import {ObjectManagers} from '../ObjectManagers';
1✔
6
import {ServerExtensionsEntryConfig} from '../../../common/config/private/subconfigs/ServerExtensionsConfig';
1✔
7

8
/**
9
 * Wraps to original config and makes sure all extension related config is loaded
10
 */
11
export class ExtensionConfigWrapper {
1✔
12
  static async original(): Promise<PrivateConfigClass & IConfigClass> {
13
    const pc = ConfigClassBuilder.attachPrivateInterface(new PrivateConfigClass());
7✔
14
    try {
7✔
15
      await pc.load(); // loading the basic configs but we do not know the extension config hierarchy yet
7✔
16
      if (ObjectManagers.isReady()) {
7✔
17
        for (const ext of Object.values(ObjectManagers.getInstance().ExtensionManager.extObjects)) {
6✔
18
          ext.config.loadToConfig(ConfigClassBuilder.attachPrivateInterface(pc));
×
19
        }
20
      }
21
      await pc.load(); // loading the extension related configs
7✔
22
    } catch (e) {
23
      console.error('Error during loading original config. Reverting to defaults.');
×
UNCOV
24
      console.error(e);
×
25
    }
26
    return pc;
7✔
27
  }
28
}
29

30
export class ExtensionConfig<C> implements IExtensionConfig<C> {
1✔
31
  public template: new() => C;
32

UNCOV
33
  constructor(private readonly extensionFolder: string) {
×
34
  }
35

36
  private findConfig(config: PrivateConfigClass): ServerExtensionsEntryConfig {
UNCOV
37
      let c = (config.Extensions.extensions || []).find(e => e.path === this.extensionFolder);
×
UNCOV
38
      if (!c) {
×
UNCOV
39
        c = new ServerExtensionsEntryConfig(this.extensionFolder);
×
40
        config.Extensions.extensions.push(c);
×
41
      }
UNCOV
42
      return c;
×
43

44
  }
45

46
  public getConfig(): C {
UNCOV
47
    return this.findConfig(Config).configs as C;
×
48
  }
49

50
  public setTemplate(template: new() => C): void {
UNCOV
51
    this.template = template;
×
UNCOV
52
    this.loadToConfig(Config);
×
53
  }
54

55
  loadToConfig(config: PrivateConfigClass) {
UNCOV
56
    if (!this.template) {
×
UNCOV
57
      return;
×
58
    }
59

UNCOV
60
    const confTemplate = ConfigClassBuilder.attachPrivateInterface(new this.template());
×
UNCOV
61
    const extConf = this.findConfig(config);
×
UNCOV
62
    extConf.configs = confTemplate;
×
63
  }
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc