@revenexx/cover 0.2.5 → 0.2.7

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.
@@ -0,0 +1,25 @@
1
+ import type { H3Event } from "h3";
2
+
3
+ import type { IOrganizationService } from "../interfaces/organization";
4
+ import { ApiOrganizationService } from "../services/ApiOrganizationService";
5
+ import { MockOrganizationService } from "../services/MockOrganizationService";
6
+
7
+ /**
8
+ * Registry of organization (company) service implementations. The active one
9
+ * is selected by the `organizationService` key in app.config.ts:
10
+ * - "mock" — bundled demo company (account/organization.json)
11
+ * - "api" — the contact's organization in the customers app (public revenexx API)
12
+ */
13
+ const serviceRegistry: Record<string, IOrganizationService> = {
14
+ mock: new MockOrganizationService(),
15
+ api: new ApiOrganizationService(),
16
+ };
17
+
18
+ export function getOrganizationService(event?: H3Event): IOrganizationService {
19
+ const key = resolveServiceKey(event, {
20
+ domain: "organizationService",
21
+ mockKey: "mock",
22
+ liveKey: "api",
23
+ });
24
+ return serviceRegistry[key] ?? serviceRegistry["mock"]!;
25
+ }
@@ -0,0 +1,25 @@
1
+ import type { H3Event } from "h3";
2
+
3
+ import type { ITeamService } from "../interfaces/team";
4
+ import { ApiTeamService } from "../services/ApiTeamService";
5
+ import { MockTeamService } from "../services/MockTeamService";
6
+
7
+ /**
8
+ * Registry of team (company contacts) service implementations. The active one
9
+ * is selected by the `contactsService` key in app.config.ts:
10
+ * - "mock" — bundled demo members (kept in-memory for the process lifetime)
11
+ * - "api" — the organization's contacts in the customers app (public revenexx API)
12
+ */
13
+ const serviceRegistry: Record<string, ITeamService> = {
14
+ mock: new MockTeamService(),
15
+ api: new ApiTeamService(),
16
+ };
17
+
18
+ export function getTeamService(event?: H3Event): ITeamService {
19
+ const key = resolveServiceKey(event, {
20
+ domain: "contactsService",
21
+ mockKey: "mock",
22
+ liveKey: "api",
23
+ });
24
+ return serviceRegistry[key] ?? serviceRegistry["mock"]!;
25
+ }