Skip to content

Rewrite "Writing an app" for collections, typed migrations and app installs #412

Closed

Description

@cuibonobo

Problem

Decision

Rewrite "Writing an app" once, after the API in #405 has settled:

  • Startup: Stack.open(adapter, { migrations }) with typed migration(from, to, fn) values. The separate "register migrations on every start" layer goes.
  • Install: defineType(handle) for an owner-run app, and app installs for one the owner doesn't run: a manifest built from the handles (types: [Shelf, BookV1, Book, Review]), planInstall()/installApp(), pointing at docs/spec/apps.md.
  • Data layer: a class over StackClient holding one collection per Type, returning typed records from every verb, and handling misfits from a query.
  • Naming content types. Show interface BookContent extends ContentOf<typeof Book.schema> {}, since a type alias doesn't survive into editor hovers (ContentOf flattens its result) and an interface does. typescript-eslint's recommended no-empty-object-type rule rejects an empty interface, so mention its allowInterfaces: 'with-single-extends' option.

Actions

  • Root README.md and packages/core/README.md: "Writing an app" as above, replacing the "no way to install its own types yet" sentence.
  • Quick starts use a collection rather than handle-first overloads.
  • Changeset: patch for @haverstack/core (its README is published).

Order

Last in #405, so the READMEs are written once against #407, #409 and #410.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions