Zwing Docs

Public apps and default connectors

How tenant apps, events, connectors, mappings, and task trees are provisioned from public templates

Overview

GIP separates catalog definitions (public apps, public events, default connectors, default connector–event mappings) from tenant data (apps, events, connectors, connector–event mappings, event tasks). Provisioning copies catalog rows into the enterprise scope and wires refPublicAppId / refPublicEventId so upgrades and drift can be reasoned about later.

The DIP UI flows (configure public app, create connector from default template) call into the App Connector Service (ACS) tasks described below.

Public catalog models

Public app (PublicAppModel)

Global template for an integration product: name, description, inboundEnabled, outboundEnabled, isEnabled, isDefault (seed for new enterprises), logoSrc, refId, and configureVia (how the console may configure the app).

Public event (PublicEventModel)

Events attached to a public app: eventCode, direction (inbound/outbound), publishConfig / listenerConfig (including optional Kafka topic and endpoint metadata), refDocPath, etc. There is no ssoEnterpriseId; events are cloned per tenant.

Default connector (DefaultConnectorModel)

A named pairing of public outbound and inbound app IDs (outboundAppId, inboundAppId), isEnabled. Used to know which connector lines to instantiate once both enterprise apps exist.

Default connector–event mapping (DefaultConnectorMappingModel)

For a given public app pair, maps public outbound and inbound event IDs, optional template, isEnabled, toggleAllowed, and embeds a full tasks array (subdocuments matching event task shape: name, type, parentId, config, etc.). This is the source for preconfigured task trees when mappings are cloned.

Configure a public app into the tenant (ConfigurePublicAppTask)

Triggered with a public app id and enterprise context (ConfigurePublicAppTask.handle).

  1. Idempotency: If an app already exists with the same ssoEnterpriseId and refPublicAppId, ACS returns 400 — App is already configured for this enterprise.
  2. App row: Creates AppModel with fields copied from the public app (name, description, flags, logoSrc, refId, refPublicAppId), accessType: private, isEnabled: true, and audit fields.
  3. Events: Loads all PublicEvent rows for that public app and bulk inserts tenant EventsModel rows with the same codes, configs, and refPublicEventId pointing at the public event.

Result: appId plus eventsInserted count (zero if the public app had no events).

Default apps at enterprise onboarding (DefaultAppCreationTask)

Runs with { ssoEnterpriseId } (typically after enterprise creation).

  • Finds all PublicApp with isDefault: true.
  • For each not already materialized for that enterprise, creates an app and clones all public events the same way as above (per-event create in a loop).

Use this to understand why a fresh tenant may already see apps and events before anyone opens the DIP UI.

Default connectors and mappings (DefaultConnectorCreationTask)

Runs with { ssoEnterpriseId } after enterprise apps exist.

  1. Loads enabled DefaultConnector rows.
  2. Resolves enterprise outboundAppId / inboundAppId by matching refPublicAppId on tenant apps to the default connector’s public app ids. Skips if either side is missing.
  3. Creates ConnectorModel rows for pairs that do not already exist (same outbound/inbound for that enterprise).
  4. For new connectors only, loads DefaultConnectorMapping rows whose public (outboundAppId, inboundAppId) match, resolves enterprise events via refPublicEventId, creates EventTask documents from each embedded default task, then bulk inserts ConnectorEventMapping with tasks set to the new task ids.

So connectors, mappings, and task definitions can all appear without manual UI work when defaults are maintained in Mongo.

Configure a default connector from the UI (ConfigureDefaultConnectorTask)

User-driven flow: pick a default connector id and optional default connector–event mapping ids.

  1. Loads the DefaultConnector; 404 if missing.
  2. ensureEnterpriseApps: Ensures both public apps exist as tenant apps. Missing sides are created via ConfigurePublicAppTask (counts appsAutoConfigured / eventsAutoConfigured).
  3. Validates outbound/inbound apps: must be enabled, outbound/inbound flags set, and AppConfiguration enabled when present.
  4. Find or create the ConnectorModel for the enterprise and app pair.
  5. Mapping selection: Union of
    • Mandatory default mappings (toggleAllowed: false) for that default connector, and
    • User-provided mapping ids (dto.connectorEventMappingIds).
  6. ensureEnterpriseEvents: Ensures every public event referenced by selected mappings exists as a tenant event (creates or links by eventCode + direction + app).
  7. createConnectorEventMappings: For each selected default mapping not already present for this connector (same outbound/inbound event pair), creates ConnectorEventMapping, then cloneDefaultTasks:
    • Walks embedded defaultMapping.tasks in two passes: allocates new ObjectIds, remaps parentId to new ids, sets connectorEventMappingId, bulkInsert event tasks, then updates the mapping’s tasks array with the inserted ids.

Mandatory-only mappings: If the user selects nothing but mandatory mappings exist, those are still applied. If there are no selected mappings at all, the API returns counts of zero and still reports connector id.

DIP UI alignment

  • Apps list / create from public: Corresponds to configuring a public app and viewing tenant apps (refPublicAppId visible in data model — see Data model reference).
  • Create connector wizard (select apps, map events): Aligns with manual connector + mapping creation; default connector path uses the same data shapes but seeds from DefaultConnector* collections.
  • Configure default connector sidebars: Drive ConfigureDefaultConnectorTask with connectorId and optional mapping id list.
Edit on GitHub