Setu-TS
    Preparing search index...

    Function parsePublishOptions

    • Reads and validates caller PublishOptions into a frozen copy — the ONE implementation every publish entry uses, in messaging-plugin and cloudflare-plugin alike, neither of which may import the other.

      The caller's object is read exactly once (each member, each header value), so a getter or Proxy cannot answer the check one value and the transport another; only the returned copy is read afterwards. A refusal names the field and the rule and never quotes the refused value.

      Throws SYNCHRONOUSLY: a publish method calls it inside an async body, which turns the throw into the rejected promise its contract requires.

      Parameters

      • options: unknown

        The caller's options, or undefined

      Returns ParsedPublishOptions

      The frozen validated copy

      When options is not a plain object, cannot be read, or any member breaks the publish id or header rules

      import { parsePublishOptions } from '@setu-ts/common';

      const parsed = parsePublishOptions({ orderingKey: 'order-7', headers: { 'x-tenant': 'acme' } });
      // parsed.headers → { 'x-tenant': 'acme' }

      0.9.0