UNPKG

@nullplatform/ingest

Version:

Client SDK for the nullplatform ingest API: push snapshots and delta events from a collector into the catalog and other targets, follow runs, replay and drift checks

575 lines • 50.6 kB
# @nullplatform/ingest — usage guide for code assistants

> Client SDK for the nullplatform ingest API: a collector pushes the full state
> of a system (snapshot runs) and its changes (delta events) into nullplatform
> (the catalog, core entities, any target the platform configures), then follows
> up (input log, replay, owned entities, drift). This
> file is optimized for an AI coding assistant writing **consumer** code. Every
> symbol and signature below is the **current** API — patterns marked ❌ are
> removed/renamed and MUST NOT be generated.

ESM + CJS. Zero runtime deps. Node ≥ 22, Bun, or any runtime with `fetch` and Web Crypto.

---

## Prime directives (read first — these prevent the common mistakes)

1. **Fields are camelCase; vocabularies are enums.** The SDK renames every field
   to and from the API's snake_case, so write and read camelCase only:
   `type` (a source's type slug, beside `typeId`; an input's; a run's and a replay's `types`),
   `recordType` (a mapping's, a destination's, an entity's), `slug`, `observedAt`,
   `target`, `targetId`, `endpoint`, `endpointId`, `backendId`, `origin`, `attributes`,
   `mappingId`, `mappingRevision`, `destinationId`, `onDelete`, `releasedAt`, a source's `runs`
   (`ttlSeconds`, `deletePolicy`, `maxDeleteRatio`, `rejectEmpty`, `unguardedTypes`), `dryRun`, `allowFailures`,
   `deletedAt`. Never snake_case a field, and never write `kind`. What you own is sent and
   answered exactly as it is: a record's `payload`, a source's `attributes`, mapped `data`,
   `links`. Every closed vocabulary is an exported enum: `Engine.JSONATA`, `OnConflict.ABORT`,
   `RunStatus.COMPLETED`, `InputStatus.REJECTED`, `OnDelete.SET_NULL`, `AssignedBy.BACKEND`,
   `DriftPolicy.REPORT`, `EventOp.DELETE`… Never write the
   string (`'jsonata'`, `'abort'`): use the enum.
2. **Ids are the API's; slugs are yours.** You name a source by `slug`
   (unique in the organization). The API mints every id (UUIDv7): a source's,
   a source type's, a mapping's, a destination's, a run's, a drift check's. Keep the `Source` that
   `sources.upsert` returns and pass `source.id` everywhere; read or act on a
   run, mapping, input or drift check by its own id alone
   (`runs.get(runId)`, `inputs.get(inputId)`, `driftChecks.get(checkId)`).
3. **Every input id is a UUIDv7, globally unique by construction; the API rejects its reuse within the organization.** Omit `id` and
   the SDK generates one; if you pass one it MUST be a UUIDv7 (`uuidv7()`), or
   the SDK throws a `TypeError` before sending. Never pass a UUIDv4, a hash or a
   business key as `id`. A resend to the same source is a duplicate (not
   applied twice); an id another source already used is a 409 for the batch.
4. **A snapshot is ONE run of the complete state** for its types: open → `add()`
   everything → `finalize()`. Records you did not add are deleted on finalize
   (behind guards). Never use a run for a partial update — send events instead.
5. **Events never delete by omission.** Only `events.delete(...)` deletes, and
   only an entity this source owns.
6. **Give `observedAt` the time the state was observed**, not the send time —
   one `observedAt` for a whole listing. The newest observation per entity wins.
7. **A failed batch is sticky.** After a batch fails for good, `add`/`flush`/
   `finalize` rethrow it. Do not catch and keep adding: `await run.abort()` and
   take a new snapshot.
8. **Lists return `Page<Item>`** `{ paging: { limit, offset }, results }` — never an
   array, never a `total`. Walk pages while `results.length === limit`.
9. **Request bodies are closed.** The API rejects undeclared properties (400).
   Pass exactly the documented spec fields.
10. **The SDK reads NO environment variables.** Read `process.env` yourself and
   pass values to `new IngestClient({...})`.
11. **One `IngestClient` per process**, injected where needed (it caches the token).
12. **A mapping is a definition; a destination says where it is written — never a URL.**
   A mapping (`recordType`, `engine`, `expression`) is owned by a source type (nullplatform's
   global ones, or the organization's: shared by every source of the type) or by one source.
   A destination binds it to a target and an endpoint, each named by slug (`target: "catalog"`,
   `endpoint: "k8s-deployment"`; see `targets.list()` and `endpoints.listForTarget()`), the same in
   every organization, or by id (`targetId`, `endpointId`), exactly one of each; the API keeps
   their ids. Everything the API names that has a slug takes the slug or the id this way (a
   mapping: `mapping` or `mappingId`; a type: `type` or `typeId`; a source: `source` or
   `sourceId`); a mapping's slug is its type's or its source's, and one both share is refused
   (name it by id). A destination is for every source of the type or for one source, and its
   owner is the route, never a spec field: `destinations.createForSourceType(sourceTypeId, specs)` /
   `upsertForSourceType`, or `createForSource(sourceId, specs)` / `upsertForSource`. A source's own
   shadows the organization's of the
   same record type and endpoint (`destinations.listForSource(src)`, what the source applies). A record type nothing is
   bound to is refused (400).
13. **Runs are for backfill and resync; events are the steady state.** Open a
   run for the first full load and for an occasional resync (a watch can miss
   deletes while it is down); between them, send each change as an event. A
   source's `runs` settings (TTL, delete policy, guards) apply to runs only: a
   delete event deletes at once.
14. **A collector of a global source type defines no mappings.** `kubernetes` is
   nullplatform's: its collector only upserts its source (`sources.upsert`) and sends runs and events;
   the organization binds the type's mappings to destinations ONCE
   (`destinations.upsertForSourceType`), not every collector on every start. Only a collector of the
   organization's own kind of system upserts mappings for its source (`mappings.upsertForSource`, then
   `destinations.upsertForSource`). A source names an existing type by slug (an unknown one is a 400:
   `sourceTypes.upsert` it first).
15. **Setup is upserts, one contract for all.** `sources.upsert`, `sourceTypes.upsert`,
   `mappings.upsertForSourceType` / `upsertForSource`, `destinations.upsertForSourceType` / `upsertForSource`:
   each takes an ARRAY of specs in the create format, finds each by its natural key (slug; a
   destination by `mappingId` + `target` + `endpoint`), creates what is missing, patches only the
   fields that differ (a field left out is left as it is), never deletes, and answers the resources
   in the order of the specs, each with `upserted` (`UpsertOutcome.CREATED` | `UPDATED` | `UNCHANGED`).
   It queries only the specs' keys. Never list then create by hand. A collector sends only what it owns: what
   it sends is set again on every start.
16. **Every `get` answers `null` when there is none** (`sources`, `sourceTypes`, `mappings`,
   `destinations`, `endpoints`, `runs`, `inputs`, `replays`, `entities`, `driftChecks`): check for
   `null`, never catch a 404. The wait helpers (`runs.waitApplied`, `inputs.wait`, `replays.wait`,
   `driftChecks.wait`…) throw an `IngestError` 404 for a resource that does not exist.
17. **A create is sent once.** The SDK retries 5xx and network failures for GET, PATCH, DELETE and the
   POSTs a resend cannot repeat (`inputs.create`, so run handles and event batchers;
   `mappingPreviews.create`; `replays.create` with an `idempotencyKey`). Any other POST is sent once;
   the upserts read again and continue when a create answers 409. Do not wrap calls in your own retry
   loop.

---

## Install & import

```js
const { IngestClient, IngestError, IngestErrorCode, OnConflict, RunStatus, Engine, uuidv7 } = require("@nullplatform/ingest");
```

ESM: `import { IngestClient, IngestError, IngestErrorCode, OnConflict, RunStatus, Engine, uuidv7, isUuidV7 } from "@nullplatform/ingest";`

Enums (runtime enums, exported): `Engine`, `OnConflict`, `RunStatus`, `InputStatus`, `Outcome`, `EventOp`,
`DeletePolicy`, `OnDelete`, `EntityOrigin`, `DriftPolicy`, `DriftCheckStatus`, `DriftType`,
`ReplayStatus`, `SourceTypeRevisionAction`, `SourceRevisionAction`, `MappingRevisionAction`, `DestinationRevisionAction`,
`UpsertOutcome`,
`IngestErrorCode`, and for the endpoint document `AssignedBy`, `PagingStyle`, `HttpMethod`, `OperationName`,
`OperationBody`, `EmptyLinkSet`, `FieldRule`, `FieldComparison`, `TargetDeletePolicy`, `ClearSemantics`,
`AdoptPolicy`, `TargetErrorOutcome`.

---

## Construct the client

```js
const ingest = new IngestClient({
  apiKey: process.env.NULLPLATFORM_API_KEY ?? process.env.NP_API_KEY, // exactly ONE of apiKey | token | getToken
  // baseURL: "https://api.nullplatform.com/catalog/ingest" (default: the public ingest API; set it only for another installation)
  // authBaseURL: "https://api.nullplatform.com" (default; where apiKey is exchanged)
  // timeoutMs 30000, maxRetries 4, retryBaseMs 250, retryMaxMs 10000, backpressureMs 900000
  // batching: { maxBatch: 500, maxBytes: 6 MiB, flushIntervalMs: 1000, concurrency: 2 }
  //   checked at construction: RangeError unless maxBatch 1–500, maxBytes above the request envelope,
  //   flushIntervalMs ≥ 0, concurrency ≥ 1 (the same for a batcher's own overrides)
});
```

- `apiKey`: exchanged at `POST {authBaseURL}/token`, cached, refreshed before expiry and once after a 401.
  A failed exchange is retried like a request and surfaces as an `IngestError`.
- `token`: a ready bearer (with or without `Bearer `); a 401 surfaces (not retried).
- `getToken: () => string | Promise<string>`: called once, again after a 401.

---

## Snapshot run (full state)

```js
// A collector of a global type: the source only; its organization's destinations say where records go.
const [source] = await ingest.sources.upsert([{ slug: "k8s-prod", name: "Production cluster", type: "kubernetes" }]);

const run = await ingest.runs.open(source.id, { types: ["deployment"], onConflict: OnConflict.ABORT });
const listedAt = new Date().toISOString();
items.forEach((item) => run.add({ type: "deployment", observedAt: listedAt, payload: item }));
try {
  const done = await run.finalize();             // flush + finalize + wait until closed
  // done.status: RunStatus.COMPLETED | RunStatus.GUARD_TRIPPED; done.reconciliation: { seen, stale, deleted, guardTripped, guardReason, dryRun }
} catch (err) {
  await run.abort();                              // close without deleting anything
  throw err;
}
```

- `run.finalize({ dryRun: true })` → reconciliation preview; the run stays open.
- `run.finalize({ maxDeleteRatio, allowFailures, allowRejections })` overrides the source's guards (`source.runs`) once (`maxDeleteRatio` needs `ingest:source:write`).
- `source.runs.unguardedTypes` (default `[]`): record types left out of the delete guards (`maxDeleteRatio`, `rejectEmpty`).
  Finalize still deletes their stale entities, uncounted: for types that expire by design, like Kubernetes events
  (`sources.upsert([{ slug, name, type, runs: { unguardedTypes: ["event"] } }])`).
- `runs.open(..., { onConflict: OnConflict.FAIL })` throws the 409 instead of aborting a stale open run.
- `types` omitted: every type the source maps. An empty `types` (`runs.open(src, { types: [] })`,
  `runs.create(src, [])`) is a `RangeError` before sending.

## Source types, mappings and destinations

```js
// The organization, once: bind the global type's mapping for every source of the type.
const k8s = await ingest.sourceTypes.find("kubernetes");                  // SourceType { id, slug, runs, … }
const [deployments] = (await ingest.mappings.listForSourceType(k8s.id, { recordType: "deployment" })).results;
await ingest.destinations.upsertForSourceType(k8s.id, [{ mappingId: deployments.id, target: "catalog", endpoint: "k8s-deployment" }]);

// The organization's own kind of system: its type, and a collector that keeps its source's mappings.
await ingest.sourceTypes.upsert([{ slug: "github", name: "GitHub org", runs: { maxDeleteRatio: 0.2 } }]);
const [repo] = await ingest.sources.upsert([{ slug: "acme", name: "Acme", type: "github", attributes: { env: "prod" } }]);
const [repository] = await ingest.mappings.upsertForSource(repo.id, [
  { recordType: "repository", engine: Engine.JSONATA,
    expression: '{ "id": $source.slug & "/" & name, "data": { "stars": stargazers_count } }' },
]);
await ingest.destinations.upsertForSource(repo.id, [{ mappingId: repository.id, target: "catalog", endpoint: "github-repository" }]);
await ingest.destinations.listForSource(repo.id); // what the source applies, after shadowing
```

- Every upsert sends a write only for what differs: re-run, it sends nothing. Another endpoint is
  another destination of the mapping, beside the first.
- A slug names ONE mapping of a type across nullplatform's and the organization's (creating the
  organization's under a slug nullplatform's holds is a 409). `mappings.upsertForSourceType` with the slug of
  one of nullplatform's answers it when the spec matches and is refused (403) when it differs: to
  customize it, upsert your own under another slug and bind that.
- An unknown target or endpoint in a destination is a 404. Batch refusals name
  their item: `data[i]: …`. A destination batch is all or none (1–100 items).
- `onDelete` (`OnDelete.RESTRICT` | `OnDelete.CASCADE` | `OnDelete.SET_NULL`, the default): what a deleted
  or disabled destination does to what it wrote. `OnDelete.SET_NULL` releases it
  (`entities.list(src, { released: true })`).
- A source's effective `runs` are its type's overlaid by its own; `sources.update(id, { runs: { maxDeleteRatio: null } })`
  goes back to the type's.
- A mapping shared by every source of a type keys entities with `$source.slug` (or the object's own
  id): one owner per entity. Mappings read `$source = { id, slug, type, nrn, attributes }`.

## Targets and their endpoints (read only)

```js
const catalog = await ingest.targets.find("catalog");             // TargetSummary | null: { id, slug, name, description }
const { results: [summary] } = await ingest.endpoints.listForTarget(catalog.id, { slug: "k8s-deployment" });
  // Page<EndpointSummary>: [{ id, targetId, slug, name, declared, backendId }] (also { id }; limit ≤ 100);
  // id is the organization's, backendId the backend's (an attribute)
const endpoint = await ingest.endpoints.get(catalog.id, summary.id);                      // Endpoint | null: as it runs
const written = await ingest.endpoints.get(catalog.id, summary.id, { effective: false }); // EndpointAsWritten | null
```

## Delta events

```js
const events = ingest.events.batcher(source.id);             // optional per-batcher batching overrides
const id = events.upsert("deployment", payload, { observedAt: event.time });
events.delete("deployment", payload, { observedAt: event.time });
await events.close();                                            // on shutdown (flush() to just send)
const settled = await ingest.inputs.wait([id]);                  // optional: wait for outcomes
```

## Collector runtime (let the SDK drive the runs)

```js
const { ClientIngest, IngestClient, runCollector, runSnapshot } = require("@nullplatform/ingest");
const { InMemoryIngest } = require("@nullplatform/ingest/testing");  // tests and local runs only

const collector = {
  source: { type: "kubernetes", name: "Production EU" },     // the source type's slug; runs?, attributes?
  recordTypes: ["deployment"],                                  // mapped by the type's shared mappings
  // mappings: { deployment: { engine: Engine.JSONATA, endpoint: "k8s-deployment", expression } }, // or its own
  async *snapshot(ctx) { yield { type: "deployment", payload: d }; },   // everything, as you list it
  async watch(ctx) { ctx.events.upsert("deployment", obj, { observedAt }); },  // optional: until ctx.signal aborts
};
const ingest = new ClientIngest(new IngestClient({ apiKey }));  // or new InMemoryIngest() in tests
await runSnapshot(collector, ingest, { source: { slug: "prod-eu" }, log });     // one snapshot
await runCollector(collector, ingest, { source: { slug: "prod-eu" }, log, signal, intervalSeconds: 86400 });
```
- Never hand-roll what these do: each snapshot upserts the source (by slug) and the collector's own mappings
  and destinations, sends only the types the source applies, aborts the run when the listing throws, yields an
  undeclared type or is cancelled (nothing deleted), flushes every 500 records, and closes a dry run once reported.
- `runCollector` never overlaps snapshots, restarts the watch with a backoff, and resolves once `signal` aborts.
  Its first snapshot is due by the source's last run (`IngestPort.lastRun`, any status): at once when there is
  none or it started more than `intervalSeconds` ago (or it cannot be read), else `intervalSeconds` after it
  started, so a restart or crash loop never backfills again; then every `intervalSeconds`. The watch starts at
  once. Never schedule the first snapshot yourself. A watch that failed and then stays up `retryMaxMs` makes a
  snapshot due at once (what vanished during the outage only a snapshot deletes); never add your own resync.
  Its fourth argument is every scheduled snapshot's `FinalizeOptions`, as `runSnapshot`'s (`{ dryRun: true }`:
  each is assessed and closed, nothing deleted).
- `ClientIngest.connect({ apiKey, …tuning })` takes the client's tuning (`timeoutMs`, `maxRetries`, `retryBaseMs`,
  `retryMaxMs`, `backpressureMs`, `batching`, `fetchImpl`) beside its credentials: never build the
  `IngestClient` by hand only to tune it.
- `log` is a `Logger` (`debug`, `info`, `warn`, `error`: `console` fits); `ctx.log` is the same object. `ctx.source`
  is the source fed: `id` (what its calls take) and `slug`.

## Mapping output: relations

`data` is the entity for each endpoint a destination binds the mapping to, validated against its model (for the catalog, its specification).
- `belongs_to` / `has_one`: the target's external id under the foreign-key alias.
- `many_to_many`: the WHOLE set of target external ids, `string[]`, under the
  relation's `alias` (declare `alias: "<relation>_ids"` and `strict: false`).
  `null` / `[]` / missing key = no links (unlinks what was linked). Never send
  `[{ id }]` objects, a single string, or only the added ids.
- `Entity.links`: `{ [relationKey]: string[] }`, the links in place (not in `data`).

---

## Follow-up

```js
const src = source.id;                                         // the API's id, never the slug
await ingest.inputs.list(src, { status: InputStatus.REJECTED, runId, type, since, limit, offset }); // Page<InputSummary> (no payloads)
await ingest.inputs.get(inputId);                              // Input (payload included) | null
const mapping = await ingest.mappings.findForSource(src, "repository"); // Mapping | null: the source's own, by slug
await ingest.mappingPreviews.create({ mappingId: mapping.id, sourceId: src, sample: { payload: sample } }); // MappingPreview ({ inputId } for a stored input)
await ingest.mappingPreviews.create({ mappingId: mapping.id, definition: { engine, expression }, sample: { payload: sample } }); // a change, before storing it
await ingest.mappings.update(mapping.id, { expression });      // or mappings.upsertForSource(src, [{ recordType: "repository", engine, expression }])
await ingest.mappings.revisions(mapping.id, { limit: 20 });    // Page<MappingRevision>: { id, revision, action, changedBy, changedAt, snapshot: { id, engine, expression } }
const replay = await ingest.replays.create(src, { types: ["repository"] }, { idempotencyKey }); // after changing a mapping
await ingest.replays.wait(replay.id);                           // queued in the background: status, progress { entities, scanned, queued }
await ingest.inputs.waitIdle(src);
await ingest.entities.list(src, { drifted: true, deleted: false, recordType, target, endpoint, externalId, limit, offset });
await ingest.entities.get(entity.id);                          // Entity | null: one entity by its id, with the raw record behind it
await ingest.driftChecks.createAndWait(src, DriftPolicy.REPORT);                // or DriftPolicy.RESTORE
```

Page walk (no total — stop on a short page):

```js
async function allPages(read, limit = 100, offset = 0) {
  const page = await read({ limit, offset });
  return page.results.length < limit ? page.results : page.results.concat(await allPages(read, limit, offset + limit));
}
const rejected = await allPages((page) => ingest.inputs.list(src, { status: InputStatus.REJECTED, ...page }));
```

---

## Errors

```js
try { await ingest.runs.open(src); }
catch (err) {
  if (err instanceof IngestError) {
    err.status;     // HTTP status, 0 = unreachable
    err.code;       // IngestErrorCode.* e.g. "FST_ERR_AUTHORIZATION"
    err.retryable;  // true for 0 / 429 / 5xx — the SDK ALREADY retried those (a non-idempotent POST: sent once)
    err.body;       // { statusCode, code, error, message }
  }
}
```

| status | IngestErrorCode | SDK behaviour |
|---|---|---|
| 400 | VALIDATION | thrown at once (bad body, undeclared property, an id that is not a UUID, an unknown source type, no destination bound for a record type, an unknown target in a destination) |
| 401 | AUTHENTICATION | token refreshed + retried once, then thrown |
| 403 | AUTHORIZATION | thrown at once, NOT retryable |
| 404 | NOT_FOUND | thrown at once (also `endpoints.listForTarget` of an unknown target, an unknown endpoint in a destination); every `get` (`sources`, `sourceTypes`, `mappings`, `destinations`, `endpoints`, `runs`, `inputs`, `replays`, `entities`, `driftChecks`) answers `null` instead; the wait helpers throw it for a missing resource |
| 409 | CONFLICT | thrown at once (a live slug or record type on create; an input id another source used); `runs.open` aborts a stale open run unless `onConflict: OnConflict.FAIL`; the upserts read again and continue when one of their creates answers it |
| 429 | TOO_MANY_REQUESTS | waits per `Retry-After` (no retry spent) up to `backpressureMs` |
| 502 | TARGET_REJECTED | a target refused what the API asked it on the call's behalf; retryable like any 5xx |
| 503 / 5xx | SERVICE_UNAVAILABLE / — | retried with full-jitter backoff up to `maxRetries` for GET / PATCH / DELETE and the idempotent POSTs (`inputs.create`, `mappingPreviews.create`, `replays.create` with an `idempotencyKey`); any other POST is sent once |

Network failures (status 0) are retried like a 5xx. A failed token exchange is retried like a request
and surfaces as an `IngestError`. A `StaticToken` (`token`) 401 is not retried.

Client-side (thrown before sending): `TypeError` (non-UUIDv7 input id), `RangeError`
(input above `maxBytes`; `limit` not a positive integer; `offset` not a non-negative
integer; batching options out of range; an empty `types` for `runs.create` / `runs.open`).
Wait helpers throw `TimeoutError`, and an `IngestError` 404 for a resource that does not exist.

---

## API reference (every public export)

```
IngestClient(options: IngestClientOptions)
  (src = a source's id, from sources.upsert/find/create — never its slug)
  (every upsert: specs[] in the create format → Upserted<Resource>[] in the specs' order (each with
   upserted: UpsertOutcome); each found by its natural key (only those keys asked for), created when missing,
   patched only where it differs, never deleted; two specs of one key throw before sending)
  (a key filter takes one value or several: recordType?: string | string[], slug?, mapping? | mappingId?;
   any of them matching, at most MAX_FILTER_VALUES (100) per request: more is a 400)
  .sources   create(SourceSpec { slug? (derived from the name when left out: 'Prod EU' → prod_eu), name, type (a source type's slug) | typeId (its id: exactly one of the two), nrn?, description?, attributes?,
               runs?: { ttlSeconds?, deletePolicy?, maxDeleteRatio?, rejectEmpty?, unguardedTypes? } (the rest are its type's) })
             (a revival keeps the NRN and the type: 409 otherwise; an unknown type: 400)
             get(id)→Source|null (a deleted one too: deletedAt set; null when there is none) find(slug, { nrn? }?)→Source|null
             list(SourceFilter { slug?, nrn?, deleted?, limit?, offset? }?)→Page<Source>
             update(id, SourcePatch { name?, description?, attributes?, runs? (a setting null: its type's) })
             delete(id)→Source (soft; deletedAt set) upsert(SourceUpsertSpec[] (slug required: the key))→Source[] (by slug at spec.nrn; patches name,
             description, attributes (whole), the runs named (unguardedTypes as a set: another order is no change);
             another type or NRN throws)
             stats(id, { since? }?)→SourceStats
             revisions(id, page?)→Page<SourceRevision> (every write: who, when, its own settings then; Source.revision counts them)
             (Source.runs: what applies, its type's overlaid by its own; a write sets some, null puts one
              back on its type's; which it sets itself: a diff with sourceTypes.get(source.typeId).runs)
  .sourceTypes list(SourceTypeFilter { slug?, limit?, offset? }?)→Page<SourceType> (global ones and the organization's)
             get(id)→SourceType|null find(slug)→SourceType|null
             create(SourceTypeSpec { slug? (derived from the name), name, description?, runs?, global? })→SourceType (a deleted slug revives)
             update(id, SourceTypePatch { name?, description?, runs? }) delete(id)→SourceType (409 while in use)
             revisions(id, page?)→Page<SourceTypeRevision> (every write; SourceType.revision counts them)
             upsert(SourceTypeUpsertSpec[] (slug required: the key; no global))→SourceType[] (by slug; patches name, description, the runs named, unguardedTypes as a set)
  .mappings  createForSourceType(sourceTypeId, TypeMappingCreate { slug?, recordType, engine, expression, global? })→Mapping
               (shared by the type's sources)
             createForSource(src, MappingCreate { slug?, recordType, engine, expression })→Mapping (the source's own)
             listForSourceType(sourceTypeId, MappingFilter?)→Page<Mapping> (the global ones and the organization's)
             listForSource(src, MappingFilter { recordType? (one or several), slug? (one or several), sort?, limit?, offset? }?)→Page<Mapping>
             get(mappingId)→Mapping|null findForSource(src, slug)→Mapping|null (the source's own; slug = record type)
             findForSourceType(sourceTypeId, slug)→Mapping|null (nullplatform's or the organization's: a slug names one)
             update(mappingId, MappingPatch { engine?, expression? })→Mapping (a no-op writes nothing)
             delete(mappingId)→Mapping (soft; 409 while a destination binds it)
             revisions(mappingId, page?)→Page<MappingRevision> (each with its own id, and its revision: the count a destination pins)
             upsertForSourceType(sourceTypeId, MappingCreate[]) / upsertForSource(src, MappingCreate[])→Mapping[] (by slug, the
               record type by default; patches engine, expression; nullplatform's that differs: 403; a slug of
               another record type throws). Where they are written: destinations.upsertFor…
             createFor… / update(..., MappingWriteOptions { dryRun? }?) (a dry run: checked as the write would be,
               answers the mapping as it would be, nothing written)
  .mappingPreviews create(MappingPreviewSpec { mapping? | mappingId?, definition? { recordType?, engine, expression },
               type? | typeId?, source? | sourceId?, sample: { payload } | { inputId } })→MappingPreview (nothing stored: what was
               evaluated as it was asked for, mappingId, typeId, sourceId, definition, sample, then output,
               entities, errors, validation per destination, warnings)
  .destinations createForSourceType(sourceTypeId, DestinationSpec[]) / createForSource(src, DestinationSpec[])
               DestinationSpec { mapping | mappingId, target | targetId, endpoint | endpointId, mappingRevision?, enabled?, onDelete? }
               →Destination[] (all or none, 1–100; the owner is the route) get(id)→Destination|null
             listForSourceType(sourceTypeId, DestinationFilter { mapping? | mappingId? (one or several), recordType? (one or several), target? | targetId?, endpoint? | endpointId? }?)→Page<Destination>
               (the organization's, for every source of the type)
             listForSource(src, SourceDestinationFilter { effective?, mapping? | mappingId? (one or several), recordType? (one or several), target? | targetId?, endpoint? | endpointId? }?)
               →Page<Destination> (what the source applies, after shadowing; effective: false, its own only)
             update(id, DestinationPatch { endpoint? | endpointId?, mappingRevision?, enabled?, onDelete? })→Destination
             delete(id)→Destination (soft; its onDelete applies) revisions(id, page?)→Page<DestinationRevision>
             upsertForSourceType(sourceTypeId, DestinationSpec[]) / upsertForSource(src, DestinationSpec[])→Destination[] (each by
               mapping + target + endpoint: created (one batch), updated where pin / enabled / onDelete differ, or
               unchanged; never deletes one left out)
  .targets   list(TargetFilter { slug?, limit?, offset? }?)→Page<TargetSummary> find(slug)→TargetSummary|null
  .endpoints listForTarget(targetId, EndpointFilter { id?, slug?, limit? (≤ 100), offset? }?)→Page<EndpointSummary>
             get(targetId, endpointId)→Endpoint|null (as it runs: model { schema, parents, relations },
               parents and relations { endpoint, endpoint_id } (endpoint_id null for a discovered one),
               identity { assignedBy: AssignedBy.SOURCE | AssignedBy.BACKEND, key, naturalKey },
               calls { the calls it has (upsert…unlink: EndpointCall { method: HttpMethod, path, query?,
               body?: OperationBody | template }; link adds emptySet: EmptyLinkSet), answers, paging: EndpointPaging
               { style: PagingStyle, … } }, fields { [f]: { write: FieldRule, drift: FieldComparison } },
               behavior { delete: TargetDeletePolicy, clear: ClearSemantics, adopt: AdoptPolicy, gone: EndpointGone },
               errors: EndpointErrorRule[] { status, operation?: OperationName, match?, outcome: TargetErrorOutcome };
               every key present (null where nothing applies) but calls, which are the ones it has; one shape for
               every kind; a discovered one's model from the backend; JSON Schema keys as written)
             get(targetId, endpointId, { effective: false } (EndpointReadOptions))→EndpointAsWritten|null
               (as it was written: a declared endpoint's own sections and keys only)
  .runs      open(src, OpenRunOptions { types?, onConflict? }?)→RunHandle create(src, types?)→Run
               (types omitted: every type the source maps; an empty array: RangeError) get(runId)→Run|null
             list(src, RunFilter { status?, sort?, limit?, offset? }?)→Page<Run> (newest first) findOpen(src)→Run|null
             sendRecords(sourceId, runId, InputSpec[])→Accepted finalize(runId, FinalizeOptions?) abort(runId)
               (PATCH /runs/{id}: status finalizing with the options under `finalize`, as the run answers them; dryRun in the query · status aborted)
             waitApplied / waitClosed / waitDryRun(runId, WaitOptions?)
  .events    send(src, EventSpec[])→Accepted batcher(src, Partial<BatcherOptions>?)→EventBatcher
  .inputs    create(src, InputSpec[] (runId names a record's run; none: an event))→Accepted { accepted, duplicates, data }
               (each sent as an InputCreate: id generated when omitted)
             list(src, InputFilter { ..., sort?: 'receivedAt:desc', after?: inputId }?)→Page<InputSummary> (no payloads)
             get(inputId)→Input|null (with its payload) wait(inputIds, WaitOptions?)→Input[]
             waitIdle(src, WaitOptions?)
  .replays   create(src, ReplayRequest { types?, since?, until? }?, { idempotencyKey? }?)→Replay get(replayId)→Replay|null
             list(src, ReplayFilter { status?, sort?, limit?, offset? }?)→Page<Replay> wait(replayId, WaitOptions?)→Replay
  .entities  list(src, EntityFilter { ..., released?, destinationId? }?)→Page<EntitySummary> (no payloads; ≤ 200 a page)
             get(entityId)→Entity|null (with its payload: ingest:input:read)
             (an entity carries destinationId, mappingId, mappingRevision, releasedAt, origin: EntityOrigin)
  .driftChecks create(src, policy?)→DriftCheck get(checkId)→DriftCheck|null
             list(src, DriftCheckFilter { status?, sort?, limit?, offset? }?)→Page<DriftCheck>
             wait(checkId, WaitOptions?)→DriftCheck createAndWait(src, policy?, WaitOptions?)→DriftCheck
  .tokens    TokenProvider
RunHandle:    id sourceId run stats add(record)→id flush() refresh() waitApplied() finalize(opts?, wait?) abort()
EventBatcher: stats upsert(type, payload, { id?, observedAt? })→id delete(...)→id flush() close()
Batcher:      the generic count+bytes batcher behind both (add/flush/close/failure/stats)
Errors:       IngestError, IngestErrorCode, TimeoutError
Tokens:       ApiKeyToken, StaticToken, CallbackToken, type TokenProvider
Ids:          uuidv7(now?)→string, isUuidV7(value)→boolean
Constants:    DEFAULT_BASE_URL ("https://api.nullplatform.com/catalog/ingest"), DEFAULT_AUTH_BASE_URL ("https://api.nullplatform.com")
Enums:        (runtime enums, values are the wire's) DeletePolicy RunStatus InputStatus Outcome EntityOrigin EventOp Engine
              DriftPolicy DriftCheckStatus DriftType ReplayStatus SourceTypeRevisionAction SourceRevisionAction
              MappingRevisionAction DestinationRevisionAction OnDelete OnConflict AssignedBy PagingStyle HttpMethod
              OperationName OperationBody EmptyLinkSet FieldRule FieldComparison TargetDeletePolicy ClearSemantics
              AdoptPolicy TargetErrorOutcome IngestErrorCode UpsertOutcome (what an upsert did; not the wire's)
Wire types:   Page Paging PageOptions Sort Revision NamedBy MaybeNamedBy Upserted<Resource> MAX_FILTER_VALUES
              Source SourceSpec SourceUpsertSpec SourceFields SourcePatch SourceFilter SourceStats SourceRevision
              RunSettings OwnRunSettings
              SourceType SourceTypeRevision SourceTypeSpec SourceTypePatch SourceTypeUpsertSpec SourceTypeFilter
              Mapping MappingCreate TypeMappingCreate MappingPatch MappingFilter MappingRevision MappingSample
              MappingWriteOptions MappingPreviewSpec MappingPreview
              Destination DestinationSpec DestinationPatch DestinationFilter SourceDestinationFilter DestinationRevision
              RunCounters RunReconciliation FinalizeOptions RunFilter Run
              InputCreate InputSpec EventSpec Accepted EntityResult InputSummary Input InputFilter
              ReplayRequest Replay ReplayFilter
              TargetSummary TargetFilter EndpointSummary EndpointCall EndpointErrorRule EndpointGone EndpointPaging
              EndpointReference Endpoint EndpointAsWritten EndpointReadOptions EndpointFilter
              EntitySummary Entity EntityFilter DriftCheckFilter DriftCheck ApiError
Options:      IngestClientOptions OpenRunOptions WaitOptions BatcherOptions BatcherStats EventOptions
              RunOperations ApiKeyTokenOptions PreparedInput

Collector runtime:
  runSnapshot(definition: CollectorDefinition, port: IngestPort, RunSnapshotOptions { source: RunSource { slug, nrn?, name? },
              log: Logger, signal?, applied? }, FinalizeOptions?)→SnapshotResult { runId, status, records,
              counters, reconciliation } (throws after aborting the run)
  runCollector(definition, port, RunCollectorOptions { …RunSnapshotOptions, signal, intervalSeconds (0: one snapshot;
              else the first when due by the source's last run),
              retryMinMs? (1000), retryMaxMs? (60000) }, FinalizeOptions? (every scheduled snapshot's))→void
              (resolves once signal aborts)
  prepareSource(definition, port, options)→PreparedSource { id, slug, types } declaredTypes(definition)→string[]
  validateDefinition(definition) (throws) pause(ms, signal?) FLUSH_EVERY (500) DEFAULT_MAPPING_TARGET ("catalog")
  ClientIngest.connect(ConnectOptions { authBaseURL? (api.nullplatform.com), baseURL? (default: <authBaseURL>/catalog/ingest), apiKey?, token?,
              …IngestClientOptions' { fetchImpl?, timeoutMs?, maxRetries?, retryBaseMs?, retryMaxMs?, backpressureMs?, batching? } })
              →ClientIngest (throws without a key or a token)
  ClientIngest(client: IngestClient)
  @nullplatform/ingest/testing: InMemoryIngest(InMemoryIngestOptions { applied?, log?: Logger }?)
              (.sources .mappings .destinations .runs: RecordedRun[] .emitted: RecordedEvent[]; deletes nothing)
  IngestPort { upsertSource, upsertMappings, appliedTypes, lastRun→LastRun { id, createdAt } | null, openRun→RunPort,
              events→EventPort }
  RunPort { id, add, flush, finalize, abort } EventPort { upsert, delete, flush, close }
Collector types: CollectorDefinition { source: CollectorSource, recordTypes?, mappings?: Record<string, CollectorMapping>,
              snapshot(SnapshotContext)→SnapshotRecords, watch?(WatchContext) } CollectorSource { type, name, description?,
              attributes?, runs?: CollectorRunSettings } CollectorMapping { engine, expression, target?, endpoint, enabled? }
              CollectedRecord { type, payload, observedAt?, id? } CollectedEventOptions CollectorEvents CollectorContext
              { source: UpsertedSource { id, slug }, log, signal } Logger { debug, info, warn, error } (console fits) SourceSpec RunSource ObservedRecord
              RecordedMapping RecordedDestination
```

---

## ❌ Anti-patterns — removed/renamed; never generate these

| ❌ Do NOT write | ✅ Current |
|---|---|
| `mappings.createForType` / `listForType` / `findForType` / `upsertForType` | `mappings.createForSourceType` / `listForSourceType` / `findForSourceType` / `upsertForSourceType` |
| `destinations.createForType` / `listForType` / `upsertForType` | `destinations.createForSourceType` / `listForSourceType` / `upsertForSourceType` |
| an owner parameter `typeId` (`createForSourceType(typeId, …)`) / `/source_types/{type_id}/…` | `sourceTypeId` / `/source_types/{source_type_id}/…` (the field `typeId`, wire `type_id`, stays) |
| `ingest.ledger.list(src)` / `ingest.ledger.get(id)` | `ingest.entities.list(src)` / `ingest.entities.get(id)` |
| `LedgerEntry` / `LedgerFilter` / `LedgerOrigin` | `EntitySummary` (list) and `Entity` (`entities.get`, with its payload) / `EntityFilter` / `EntityOrigin` |
| `ingest.drift.start(src)` / `drift.run(src)` / `drift.get` / `drift.list` / `drift.wait` | `ingest.driftChecks.create(src)` / `driftChecks.createAndWait(src)` / `driftChecks.get` / `list` / `wait` |
| `ingest.driftChecks.run(src)` / `driftChecks.start(src)` | `ingest.driftChecks.createAndWait(src)` / `driftChecks.create(src)` |
| `ingest.inputs.send(src, inputs)` | `ingest.inputs.create(src, inputs)` |
| `ingest.replays.start(src, request)` | `ingest.replays.create(src, request)` |
| `ingest.targets.endpoints(targetId)` / `ingest.targets.endpoint(targetId, endpointId)` | `ingest.endpoints.listForTarget(targetId)` / `ingest.endpoints.get(targetId, endpointId)` |
| `ingest.health()` (removed: the public API has no health route) | nothing: make the call you need; an unreachable API is an `IngestError` with status 0 |
| `InputRecord` | `InputSummary` (`inputs.list`, no payload) / `Input` (`inputs.get`, payload included) |
| `EndpointDetail` | `Endpoint` (`endpoints.get`, as it runs; `EndpointAsWritten` with `{ effective: false }`) |
| `Endpoint` as a list item of a target's endpoints | `EndpointSummary` (`endpoints.listForTarget`) |
| `Target` | `TargetSummary` (`targets.list` / `find`) |
| `inputs.list(src, { sort: "received_at:desc" })` | `{ sort: "receivedAt:desc" }` (camelCase; the SDK renames it) |
| `try { await ingest.sources.get(id) } catch (e) { if (e.status === 404) … }` | `const source = await ingest.sources.get(id); if (source === null) …`: every `get` answers `null` |
| `destinations.upsertForSourceType(typeId, [{ sourceId, ... }])` / a spec's `sourceId` | the owner is the route: `upsertForSource(sourceId, [...])` or `upsertForSourceType(sourceTypeId, [...])` |
| `runs.open(src, { types: [] })` / `runs.create(src, [])` (RangeError) | omit `types` for every type the source maps |
| `const sources = await ingest.sources.list(); sources.map(...)` | `(await ingest.sources.list()).results.map(...)` |
| `page.items` / `page.total` | `page.results` / no total: stop when `results.length < paging.limit` |
| `ingest.runs.list(src, 20)` / `ingest.driftChecks.list(src, 20)` | `ingest.runs.list(src, { limit: 20 })` (a `RunFilter`) |
| `await ingest.sources.delete(id); // void` | resolves to the soft-deleted `Source` (`deletedAt` set) |
| `source.tenant_id` | removed from every response |
| `runSnapshot(c, port, { source, settings: {}, log })` / `ctx.settings` / `CollectorDefinition<Settings>` (gone) | `runSnapshot(c, port, { source, log })`: a collector's configuration is its own code's; read it where the collector is defined |
| `run.add({ id: crypto.randomUUID(), ... })` (v4) | omit `id`, or `id: uuidv7()` |
| `run.add({ id: "order-42", ... })` | ids are UUIDv7 only; business keys go in the payload |
| `events.upsert(type, payload, { observed_at })` / `{ record_type }` / `source.source_id` | camelCase: `{ observedAt }` / `{ recordType }` / `source.sourceId` (the SDK renames to the wire) |
| `engine: "jsonata"` / `onConflict: "abort"` / `onConflict: "fail"` / `run.status === "completed"` / `"guard_tripped"` | `Engine.JSONATA` / `OnConflict.ABORT` / `OnConflict.FAIL` / `run.status === RunStatus.COMPLETED` / `RunStatus.GUARD_TRIPPED` |
| `onDelete: "restrict"` / `"cascade"` / `"set_null"` / `assignedBy === "backend"` / `"source"` | `OnDelete.RESTRICT` / `OnDelete.CASCADE` / `OnDelete.SET_NULL` / `AssignedBy.BACKEND` / `AssignedBy.SOURCE` |
| `new IngestClient({ baseURL: "https://api.nullplatform.com/catalog/ingest", apiKey })` | `new IngestClient({ apiKey })`: the public API is the default |
| `events.upsert(type, payload, extra)` / `EventExtra` | `events.upsert(type, payload, { observedAt, id })`: `EventOptions` |
| `sources.ensure(spec)` / `sources.findOrCreate(spec)` / `mappings.ensure(src, specs)` | `const [source] = await sources.upsert([spec])` / `mappings.upsertForSource(src, [spec])` |
| `mappings.upsertForSource(src, { [recordType]: { target, endpoint, engine, expression } })` (gone) | `mappings.upsertForSource(src, [{ recordType, engine, expression }])` → `Mapping[]`, then `destinations.upsertForSource(src, [{ mappingId, target, endpoint }])` |
| `sourceTypes.upsert(spec)` / `sources.upsert(spec)` (one object) | an array: `upsert([spec])` → `[resource]` |
| `listForSourceType` + `createForSourceType` by hand to bind once / `find` then `create` | the upsert of the resource: re-run safe |
| `mappings.createForSourceType(sourceTypeId, { recordType: "deployment", ... })` on kubernetes (409: nullplatform's slug) | `{ slug: "deployment-team", recordType: "deployment", ... }`, then bind it |
| `ingest.destinations.effective(src)` / `destinations.list({ sourceId })` / `destinations.create([...])` (gone) | `destinations.listForSource(src)` (what it applies; `{ effective: false }`: its own) / `listForSourceType(sourceTypeId)` / `createForSourceType(sourceTypeId, [...])` / `createForSource(src, [...])` |
| `mappings.create(src, ...)` / `mappings.list(src)` / `mappings.find(src, slug)` | `mappings.createForSource` / `listForSource` / `findForSource` |
| `sources.upsert([{ id: "k8s-prod", kind: "kubernetes", ... }])` | `sources.upsert([{ slug: "k8s-prod", type: "kubernetes", ... }])` → keep `source.id` |
| `ingest.runs.open("k8s-prod")` (a slug where an id goes) | `ingest.runs.open(source.id)` — every call but `sources.find`/`upsert` takes the API's id |
| `run.add({ kind: "deployment", ... })` / `runs.open(src, { kinds })` / `replays.create(src, { kinds })` | `{ type: "deployment" }` / `{ types }` / `{ types }` |
| `ingest.inputs.replay(src, ...)` (gone) | `ingest.replays.create(src, ...)`: the API queues it in the background; `replays.wait(id)` |
| `record_kind` (mapping, preview, entity filter) / `drift.kind` | `recordType` / `drift.type` |
| `mappings.preview(id, sample)` / `mappings.update(id, patch, { dryRun: true, sample })` → `.preview` (gone) | `mappingPreviews.create({ mappingId, definition?, sourceId?, sample })`: a preview is its own resource |
| `mappings.put(src, kind, spec)` | `mappings.upsertForSource(src, [{ recordType, engine, expression }])`, or `mappings.createForSource` / `mappings.update(mapping.id, patch)` |
| `mappings.get(src, kind)` / `mappings.delete(src, kind)` / `mappings.revisions(src, kind)` | `mappings.findForSource(src, slug)` → then `get` / `delete` / `revisions(mapping.id)` |
| a Kubernetes (global type) collector calling `mappings.upsertForSource` / `mappings.createForSource` / `destinations.createForSourceType` on every start | the collector only upserts its source; its organization binds the type's mappings to destinations once |
| `mappings.create(src, { recordType, target, endpoint, ... })` / `mapping.target` / `mapping.enabled` | the mapping is the definition: `{ recordType, engine, expression }`; target, endpoint and `enabled` are a destination's (`destinations.upsertForSource`) |
| `mappings.update(mapping.id, { endpoint: "other" })` / `{ enabled: false }` | `destinations.update(destination.id, { endpoint })` / `{ enabled: false }` |
| `mappings.find(src, recordType, { target, endpoint })` | `mappings.findForSource(src, slug)`; where it goes: `destinations.listForSource(src, { mappingId })` |
| deleting a mapping a destination binds (409) | delete its destinations first (`onDelete` says what becomes of what they wrote) |
| `sources.upsert([{ type: "aws", ... }])` for a type nobody created (400) | `sourceTypes.upsert([{ slug: "aws", name }])` first, then the source |
| one source for two clusters, or a shared mapping keyed by `name` alone | one source per cluster; a shared mapping keys with `$source.slug & "/" & …` |
| a per-source override pointer to "customize" a global mapping | bind another mapping (the organization's or the source's own) to the same endpoint: it shadows |
| `runs.get(src, runId)` / `finalize(src, runId)` / `abort(src, runId)` | `runs.get(runId)` / `finalize(runId)` / `abort(runId)`; `sendRecords(src, runId, …)` keeps the source: records are inputs of it |
| `inputs.get(src, id)` / `inputs.wait(src, ids)` / `driftChecks.get(src, checkId)` / `driftChecks.wait(src, checkId)` | `inputs.get(id)` / `inputs.wait(ids)` / `driftChecks.get(checkId)` / `driftChecks.wait(checkId)` |
| `/drift-checks` | `/drift_checks` (underscores in every path) |
| `source.effectiveRuns` / `source.runs.maxDeleteRatio ?? type.runs.maxDeleteRatio` | `source.runs`: what applies (its type's, overlaid by its own) |
| `revision.name` / `revision.typeId` / `revision.sourceId` / `revision.engine` (flat revision) | `revision.snapshot.name` / `revision.snapshot.id` / `revision.snapshot.engine`: a `Revision<Action, Snapshot>` keeps the write's fields (`id` is the revision's) beside the resource under `snapshot` |
| `runSnapshot(collector, port, { sourceSlug, sourceNrn, sourceName })` / `ctx.sourceSlug` / `ctx.sourceId` (flat source) | `{ source: { slug, nrn?, name? } }` / `ctx.source.slug` / `ctx.source.id` |
| reusing one input id across sources | an input id is never reused: another source's is a 409 (a resend to the same source is a duplicate) |
| catching a batch error and continuing to `add()` | `await run.abort()`; start a new run |
| retrying an `IngestError` with `retryable === true` in a tight loop | the SDK already retried; back off or alert |
| retrying a 403 | 403 is deterministic: fix the API key's permissions |
| reading `process.env` inside SDK options defaults | pass values explicitly |
| `{ ...spec, extra: 1 }` in a create/patch body | the API rejects undeclared properties (400) |
| `target_slug: "k8s-deployment"`, `type_slug`, `type_id` (destination, entity filter) | `target: "catalog", endpoint: "k8s-deployment"` |
| `specification_id` / `catalog_entity_id` | `endpointId` (the organization's; the specification's id is the endpoint's `backendId`) / `backendId` |
| a URL in a destination: `target: "https://catalog.example.com/…"`, `endpoint: "https://…"` | `target: "catalog"` and `endpoint: "k8s-deployment"`, by slug — never a URL or host |
| a hard-coded `endpointId` in a collector that runs in many organizations | the endpoint's slug — each organization has its own id for it |
| `destinations.update(id, { target: "other" })` / `mappings.update(id, { recordType })` | neither changes: bind a new destination on the other target; a new record type is a new mapping |
| `endpoints.listForTarget(catalog.id, { limit: 1000 })` | `limit` ≤ 100 for a target's endpoints |
| `maxDeleteRatio` / `rejectEmpty` / `run_ttl_seconds` at a source's top level | under `runs`: `{ runs: { maxDeleteRatio: 0.5 } }` |
| `maxDeleteRatio: 1` so a type that expires by design (Kubernetes events) can be deleted | `runs: { unguardedTypes: ["event"] }`: its stale entities deleted uncounted, the guards kept for the rest |
| a full run every few minutes to keep a source current | events for every change; a run for the backfill and an occasional resync |
| `targets.create(...)` / a target per organization | targets are the platform's, defined by its operators (`PUT /targets/{id}`, not an SDK call); a collector reads them |
| `"configmap_ids": [{ "id": "shop/app" }]` or only the newly added ids | the full set as strings: `"configmap_ids": ["shop/app", ...]` |
| on `core_entities`, a parent's platform id copied into a mapping (`"namespace_id": 123`) | its key in the same source (`"namespace_id": "team-a"`), or `{ "backend_id": 123 }` for one the source does not write |
| treating a `waiting` input as stuck and resending it | it is tried again until its parent is written: send the parent |