Dollie Editor SDK guide

HTTP Transport

Connect to the standard page-store endpoint shape.

createHttpTransport implements TransportClient over fetch.

import {
  createHttpTransport,
  validatePageConfig,
} from "@dollie_ai/editor";

const transport = createHttpTransport({
  baseUrl: "/api",
  headers: {
    "X-CSRF-TOKEN": csrfToken,
  },
  validate: (definition) =>
    validatePageConfig(definition, catalog, {
      sections: sectionDefinitions,
    }),
});

Endpoint shape

With baseUrl: "/api", the transport calls:

Method Endpoint Purpose
GET /api/pages/{id} Load a BuilderDocument
PUT /api/pages/{id} Save { definition, revision?, label?, trail? }
POST /api/pages/{id}/publish Publish the page
GET /api/pages/{id}/revisions List revisions
POST /api/pages/{id}/revisions/{revisionId}/restore Restore a revision

Your backend must return JSON using the SDK document and error shapes.

trail is the list of edits made since the previous successful save. Store it on the new revision and return it from the revision-list endpoint. See Show and Save the Edit Trail.

Conflict errors

A stale write should return HTTP 409 with error: "revision_conflict". The transport converts that response into RevisionConflictError.

Missing pages and revisions are similarly converted into PageNotFoundError and RevisionNotFoundError.

Authentication

Use the headers option or supply a wrapped fetch implementation when your application needs credentials, CSRF handling, request tracing, or a shared API client.

The SDK does not acquire authentication tokens for you.

Custom endpoints

If your API does not match this shape, implement TransportClient directly. An adapter is usually clearer than bending existing product endpoints around the SDK.