Liking cljdoc? Tell your friends :D

boundary.reports.shell.service

Public convenience API for report generation.

Provides generate (sync) and generate-async (queued via boundary-jobs). These functions live in the shell layer — not core — because they instantiate adapter records and call :data-source, both of which are side effects (FC/IS: Core → Shell is forbidden).

Typical HTTP handler usage:

(require '[boundary.reports.shell.service :as reports])

(defn export-handler [request] (let [output (reports/generate invoice-report {:invoice-id 42})] {:status 200 :headers {"Content-Type" "application/pdf" "Content-Disposition" (str "attachment; filename="" (:filename output) """)} :body (java.io.ByteArrayInputStream. (:bytes output))}))

Public convenience API for report generation.

Provides `generate` (sync) and `generate-async` (queued via boundary-jobs).
These functions live in the shell layer — not core — because they
instantiate adapter records and call :data-source, both of which are
side effects (FC/IS: Core → Shell is forbidden).

Typical HTTP handler usage:

  (require '[boundary.reports.shell.service :as reports])

  (defn export-handler [request]
    (let [output (reports/generate invoice-report {:invoice-id 42})]
      {:status  200
       :headers {"Content-Type"        "application/pdf"
                 "Content-Disposition" (str "attachment; filename=\""
                                            (:filename output) "\"")}
       :body    (java.io.ByteArrayInputStream. (:bytes output))}))
raw docstring

generateclj

(generate report-def opts)

Generate a report synchronously.

Selects the appropriate backend based on (:type report-def): :pdf → OpenHTMLtoPDF adapter :excel → docjure adapter :word → Apache POI XWPF adapter

Calls :data-source with opts if present; passes nil otherwise.

Args: report-def - ReportDefinition map (from defreport or plain map) opts - Arbitrary options forwarded to :data-source and the adapter Recognised keys: :css - Additional CSS string appended to default.css (PDF only)

Returns ReportOutput map: {:bytes byte-array :type :pdf|:excel|:word :filename "..."}

Throws on schema validation failure or adapter error.

Generate a report synchronously.

Selects the appropriate backend based on (:type report-def):
  :pdf   → OpenHTMLtoPDF adapter
  :excel → docjure adapter
  :word  → Apache POI XWPF adapter

Calls :data-source with opts if present; passes nil otherwise.

Args:
  report-def - ReportDefinition map (from defreport or plain map)
  opts       - Arbitrary options forwarded to :data-source and the adapter
               Recognised keys:
                 :css  - Additional CSS string appended to default.css (PDF only)

Returns ReportOutput map: {:bytes byte-array :type :pdf|:excel|:word :filename "..."}

Throws on schema validation failure or adapter error.
sourceraw docstring

generate-asyncclj

(generate-async report-def opts)

Queue report generation as a background job (requires boundary-jobs).

The job will call generate and optionally notify via email when done.

Args: report-def - ReportDefinition map opts - Same options as generate, plus: :notify-email - Address to email the download link when ready :storage-key - Object storage key to save the output bytes

Returns job-id (UUID string).

Throws ex-info with :type :missing-dependency if boundary-jobs is not available.

Queue report generation as a background job (requires boundary-jobs).

The job will call generate and optionally notify via email when done.

Args:
  report-def   - ReportDefinition map
  opts         - Same options as generate, plus:
                 :notify-email - Address to email the download link when ready
                 :storage-key  - Object storage key to save the output bytes

Returns job-id (UUID string).

Throws ex-info with :type :missing-dependency if boundary-jobs is not available.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close