Skip to content

[Feature] Refactor integration config #760

@lukasz-hycom

Description

@lukasz-hycom

Is your feature request related to a problem? Please describe.
packages/configs/integrations/src/models/ contains 18 files that all follow the same pattern. To swap tickets from mocked to Zendesk, you change line 1. The actual swap is elegant (one-line change), but the pattern creates:

  • 18 files that are 95% identical boilerplate
  • Config.tickets! — non-null assertion (!) hides type errors. If the integration doesn't provide tickets, this crashes at runtime, not at compile time
  • export import syntax is obscure TypeScript that many developers don't understand

Describe the solution you'd like
Replace the 18 individual model files with a single typed config file:

// packages/configs/integrations/src/config.ts
import { createIntegrationConfig } from '@o2s/framework/config';
import * as Mocked from '@o2s/integrations.mocked/integration';
import * as Zendesk from '@o2s/integrations.zendesk/integration';

export const integrations = createIntegrationConfig({
    // Each line is a swap point — change Mocked → Zendesk per domain
    cms:           Mocked,
    tickets:       Mocked,
    articles:      Mocked,
    notifications: Mocked,
    users:         Mocked,
    auth:          Mocked,
});

// createIntegrationConfig validates at compile time:
// - Each integration actually provides the domain it's assigned to
// - No ! assertions needed — type error if Zendesk doesn't export `cms`
// - Service/Request/Model types derived automatically

Bonus: This single file makes it immediately visible which integration backs each domain — instead of opening 18 separate files.

Additional context (if applicable)
N/A


This repo is using Opire - what does it mean? 👇
💵 Everyone can add rewards for this issue commenting /reward 100 (replace 100 with the amount).
🕵️‍♂️ If someone starts working on this issue to earn the rewards, they can comment /try to let everyone know!
🙌 And when they open the PR, they can comment /claim #760 either in the PR description or in a PR's comment.

🪙 Also, everyone can tip any user commenting /tip 20 @lukasz-hycom (replace 20 with the amount, and @lukasz-hycom with the user to tip).

📖 If you want to learn more, check out our documentation.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions