From ab52019e79955f81a57e2559a58076ac7647ef14 Mon Sep 17 00:00:00 2001 From: shaurya Date: Tue, 4 Aug 2026 19:51:00 +0530 Subject: [PATCH] docs: update importers README paths to packages/services/src/import (#2540) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The README still pointed at packages/api/src/service/import.ts, which no longer exists — that directory only holds telegram-updates.ts. The import service now lives in packages/services/src/import, and the router is a thin wrapper that re-exports previewImport/runImport from there. Repointed each reference at the file that actually holds it: the phase writers, createProvider(), and the importProviders enum in schemas.ts (the z.enum is built from that list, not declared in the router). Co-authored-by: shaurya <19599684+no-hup@users.noreply.github.com> --- packages/importers/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/importers/README.md b/packages/importers/README.md index c134725f..22332d62 100644 --- a/packages/importers/README.md +++ b/packages/importers/README.md @@ -51,7 +51,7 @@ type ImportProvider = { A `run()` call returns an `ImportSummary` containing sequential `PhaseResult` entries. Each phase (e.g. `"monitors"`, `"page"`, `"components"`, `"incidents"`) contains an array of `ResourceResult` items with a `status` of `"created"`, `"skipped"`, or `"failed"` and an opaque `data` payload that the service layer writes to the database. -The importers package is **read-only** -- it fetches data from external APIs and maps it into OpenStatus shapes. The actual database writes happen in `packages/api/src/service/import.ts`. +The importers package is **read-only** -- it fetches data from external APIs and maps it into OpenStatus shapes. The actual database writes happen in `packages/services/src/import/phase-writers.ts`. ## How the Import Pipeline Works @@ -64,7 +64,7 @@ API Router (packages/api/src/router/import.ts) | | Calls previewImport() or runImport() v -Service Layer (packages/api/src/service/import.ts) +Service Layer (packages/services/src/import/) | | 1. Creates provider via createProvider(name) | 2. Validates API key via provider.validate() @@ -170,15 +170,15 @@ Implement `ImportProvider`: Each phase produces `ResourceResult[]` with the mapped data in `data`. The service layer reads `data` to write to the database. -The `data` shape must match what the corresponding phase writer in `packages/api/src/service/import.ts` casts it to. For incidents, this means the mapper must return `{ report, updates, sourceComponentIds }` -- even if `sourceComponentIds` is empty. +The `data` shape must match what the corresponding phase writer in `packages/services/src/import/phase-writers.ts` casts it to. For incidents, this means the mapper must return `{ report, updates, sourceComponentIds }` -- even if `sourceComponentIds` is empty. ### 6. Register the provider 1. Create `index.ts` with barrel exports 2. Add to `IMPORT_PROVIDERS` in `src/index.ts` 3. Add export paths in `package.json` -4. Add a case in `createProvider()` in `packages/api/src/service/import.ts` -5. Add the provider name to the `z.enum` in `packages/api/src/router/import.ts` +4. Add a case in `createProvider()` in `packages/services/src/import/provider.ts` +5. Add the provider name to `importProviders` in `packages/services/src/import/schemas.ts` 6. Add a radio button in `apps/dashboard/src/components/forms/components/form-import.tsx` ### 7. Write tests -- 2.51.2