@cfxlabsinc/b2b-services
    Preparing search index...

    Class PdfTemplateAdminService

    Authoring for PDF templates: saves are drafts, publish makes the draft live only when it and every live template that imports it still compile. The audit row is the calling action's (rules/admin-activity.md), never this service's.

    Hierarchy (View Summary)

    Index
    db: B2bDatabase
    • Clears the draft pointer; the version row stays as history.

      Parameters

      • __namedParameters: {
            key:
                | "account-statement"
                | "bank-letter"
                | "deposit-instruction-ach"
                | "deposit-instruction-fedwire"
                | "deposit-instruction-rtp"
                | "deposit-instruction-swift"
                | "routefusion-kyc"
                | "letterhead";
        }

      Returns Promise<{ error: NotFound; ok: false } | { ok: true; value: PdfTemplate }>

    • Parameters

      • __namedParameters: {
            key:
                | "account-statement"
                | "bank-letter"
                | "deposit-instruction-ach"
                | "deposit-instruction-fedwire"
                | "deposit-instruction-rtp"
                | "deposit-instruction-swift"
                | "routefusion-kyc"
                | "letterhead";
        }

      Returns Promise<PdfTemplate | null>

    • Renders an unsaved edit and persists nothing. A library template (no data schema) previews through its first live dependent, with that one's sample.

      Parameters

      • __namedParameters: {
            body: string;
            key:
                | "account-statement"
                | "bank-letter"
                | "deposit-instruction-ach"
                | "deposit-instruction-fedwire"
                | "deposit-instruction-rtp"
                | "deposit-instruction-swift"
                | "routefusion-kyc"
                | "letterhead";
            sampleData: Record<string, unknown>;
        }

      Returns Promise<
          | { ok: true; value: ReadableStream }
          | {
              error:
                  | NotFound
                  | DoesNotCompile
                  | ServiceError<"PDF_TEMPLATE_NO_PREVIEW_SUBJECT">;
              ok: false;
          },
      >

    • Makes the draft live, once it and every live importer of it compile. Only the draft the operator saw: any other draft is PDF_TEMPLATE_DRAFT_CHANGED.

      Parameters

      • __namedParameters: {
            expectedDraftVersionId: number;
            key:
                | "account-statement"
                | "bank-letter"
                | "deposit-instruction-ach"
                | "deposit-instruction-fedwire"
                | "deposit-instruction-rtp"
                | "deposit-instruction-swift"
                | "routefusion-kyc"
                | "letterhead";
        }

      Returns Promise<
          | { ok: true; value: PdfTemplate }
          | {
              error:
                  | NotFound
                  | DoesNotCompile
                  | ServiceError<"PDF_TEMPLATE_NO_DRAFT">
                  | DraftChanged;
              ok: false;
          },
      >

    • Repoints live at an older version of the same template.

      Parameters

      • __namedParameters: {
            key:
                | "account-statement"
                | "bank-letter"
                | "deposit-instruction-ach"
                | "deposit-instruction-fedwire"
                | "deposit-instruction-rtp"
                | "deposit-instruction-swift"
                | "routefusion-kyc"
                | "letterhead";
            versionId: number;
        }

      Returns Promise<
          | { ok: true; value: PdfTemplate }
          | {
              error:
                  | NotFound
                  | DraftChanged
                  | ServiceError<"PDF_TEMPLATE_VERSION_NOT_FOUND">;
              ok: false;
          },
      >

    • Inserts a version; the trigger numbers it and points the draft at it.

      Parameters

      • __namedParameters: {
            actorId: string;
            body: string;
            key:
                | "account-statement"
                | "bank-letter"
                | "deposit-instruction-ach"
                | "deposit-instruction-fedwire"
                | "deposit-instruction-rtp"
                | "deposit-instruction-swift"
                | "routefusion-kyc"
                | "letterhead";
            sampleData: Record<string, unknown>;
        }
        • actorId: string

          The acting admin, adusr_….

        • body: string
        • key:
              | "account-statement"
              | "bank-letter"
              | "deposit-instruction-ach"
              | "deposit-instruction-fedwire"
              | "deposit-instruction-rtp"
              | "deposit-instruction-swift"
              | "routefusion-kyc"
              | "letterhead"
        • sampleData: Record<string, unknown>

      Returns Promise<{ error: NotFound; ok: false } | { ok: true; value: PdfTemplate }>

    • Parameters

      • __namedParameters: {
            keys?: readonly (
                | "account-statement"
                | "bank-letter"
                | "deposit-instruction-ach"
                | "deposit-instruction-fedwire"
                | "deposit-instruction-rtp"
                | "deposit-instruction-swift"
                | "routefusion-kyc"
                | "letterhead"
            )[];
        } = {}

      Returns Promise<{ ok: true; value: { items: PdfTemplate[] } }>

    • The key's full authoring history, newest first.

      Parameters

      • __namedParameters: {
            key:
                | "account-statement"
                | "bank-letter"
                | "deposit-instruction-ach"
                | "deposit-instruction-fedwire"
                | "deposit-instruction-rtp"
                | "deposit-instruction-swift"
                | "routefusion-kyc"
                | "letterhead";
        }

      Returns Promise<
          | { ok: true; value: { items: PdfTemplateVersion[] } }
          | { error: NotFound; ok: false },
      >