Skip to content

Neon

Neon serverless Postgres for Sanoma: a project as the company's database, which pauses and branches.

Package @sanoma-ai/connector-neon, version 0.11.24. Its README, with how to install and connect it, is on GitHub.

Resource types, which a data file under resources/ declares: neon.project.

project

import

neon.project.importreadsafe to retry

Find a project by its binding id and read it; gone when there is none

Input

  • idstringrequired

    at least 1 character

Output

  • idstringrequired

    at least 1 character

  • gonebooleanrequired
  • stateobject
    Fields
    • namestringrequired

      The project's name: Neon's id names it, so two may share one

      at least 1 character, at most 256 characters

    • regionstringrequired

      Where it runs, a Neon region id such as aws-us-east-1; it cannot move

      at least 1 character

    • sizestring

      Its compute's size in compute units (CU), such as 0.25 (the default), or min-max to autoscale between them

      matches ^\d+(\.\d+)?(-\d+(\.\d+)?)?$

    • pg_versioninteger

      The major Postgres version, Neon's default when unset

      at least 14

    • idstring

      The project's id at Neon

    • hoststring

      Its default compute's host, which the direct URL connects to

    • default_branch_idstring

      The id of its default branch, which holds the company's data

    • default_endpoint_idstring

      The id of the default branch's read-write compute

    • healthyboolean

      Whether its default compute has started once: active, or idle (paused)

  • handlestring

    The driver's data for the object, opaque: pass it back unchanged

read

neon.project.readreadsafe to retry

Read a project as it is now; gone when it no longer exists

Input

  • idstringrequired

    at least 1 character

  • staterecord of any
  • handlestring

    The driver's data for the object, opaque: pass it back unchanged

Output

  • idstringrequired

    at least 1 character

  • gonebooleanrequired
  • stateobject
    Fields
    • namestringrequired

      The project's name: Neon's id names it, so two may share one

      at least 1 character, at most 256 characters

    • regionstringrequired

      Where it runs, a Neon region id such as aws-us-east-1; it cannot move

      at least 1 character

    • sizestring

      Its compute's size in compute units (CU), such as 0.25 (the default), or min-max to autoscale between them

      matches ^\d+(\.\d+)?(-\d+(\.\d+)?)?$

    • pg_versioninteger

      The major Postgres version, Neon's default when unset

      at least 14

    • idstring

      The project's id at Neon

    • hoststring

      Its default compute's host, which the direct URL connects to

    • default_branch_idstring

      The id of its default branch, which holds the company's data

    • default_endpoint_idstring

      The id of the default branch's read-write compute

    • healthyboolean

      Whether its default compute has started once: active, or idle (paused)

  • handlestring

    The driver's data for the object, opaque: pass it back unchanged

plan

neon.project.planreadsafe to retry

Plan how apply would make a project match its declaration (or delete it, given none); nothing changes

Input

  • idstring

    at least 1 character

  • staterecord of any
  • handlestring

    The driver's data for the object, opaque: pass it back unchanged

  • desiredrecord of any

    The declared fields; a write-only one may hold a secret marker

Output

  • action"none" | "create" | "update" | "replace" | "delete"required
  • plannedrecord of any
  • unknownstring[]required
  • replacestring[]required

    The fields whose change replaces the object: not empty exactly when replace

create

neon.project.createwrite

Create a project as declared

Input

  • desiredrecord of anyrequired

    The declared fields; a write-only one may hold a secret marker

Output

  • idstringrequired

    at least 1 character

  • stateobjectrequired
    Fields
    • namestringrequired

      The project's name: Neon's id names it, so two may share one

      at least 1 character, at most 256 characters

    • regionstringrequired

      Where it runs, a Neon region id such as aws-us-east-1; it cannot move

      at least 1 character

    • sizestring

      Its compute's size in compute units (CU), such as 0.25 (the default), or min-max to autoscale between them

      matches ^\d+(\.\d+)?(-\d+(\.\d+)?)?$

    • pg_versioninteger

      The major Postgres version, Neon's default when unset

      at least 14

    • idstring

      The project's id at Neon

    • hoststring

      Its default compute's host, which the direct URL connects to

    • default_branch_idstring

      The id of its default branch, which holds the company's data

    • default_endpoint_idstring

      The id of the default branch's read-write compute

    • healthyboolean

      Whether its default compute has started once: active, or idle (paused)

  • handlestring

    The driver's data for the object, opaque: pass it back unchanged

update

neon.project.updatewrite

Change a project to match its declaration, replacing it where a field cannot change in place

Input

  • idstringrequired

    at least 1 character

  • staterecord of any
  • handlestring

    The driver's data for the object, opaque: pass it back unchanged

  • desiredrecord of anyrequired

    The declared fields; a write-only one may hold a secret marker

  • expectobject
    Fields
    • action"none" | "create" | "update" | "replace" | "delete"required
    • replacestring[]required

Output

  • idstringrequired

    at least 1 character

  • stateobjectrequired
    Fields
    • namestringrequired

      The project's name: Neon's id names it, so two may share one

      at least 1 character, at most 256 characters

    • regionstringrequired

      Where it runs, a Neon region id such as aws-us-east-1; it cannot move

      at least 1 character

    • sizestring

      Its compute's size in compute units (CU), such as 0.25 (the default), or min-max to autoscale between them

      matches ^\d+(\.\d+)?(-\d+(\.\d+)?)?$

    • pg_versioninteger

      The major Postgres version, Neon's default when unset

      at least 14

    • idstring

      The project's id at Neon

    • hoststring

      Its default compute's host, which the direct URL connects to

    • default_branch_idstring

      The id of its default branch, which holds the company's data

    • default_endpoint_idstring

      The id of the default branch's read-write compute

    • healthyboolean

      Whether its default compute has started once: active, or idle (paused)

  • handlestring

    The driver's data for the object, opaque: pass it back unchanged

delete

neon.project.deletewritesafe to retry

Delete a project; done already when it is gone

Input

  • idstringrequired

    at least 1 character

  • staterecord of any
  • handlestring

    The driver's data for the object, opaque: pass it back unchanged

Output

  • idstringrequired

    at least 1 character

  • gonetruerequired

list

neon.project.listreadsafe to retry

List one page of project metadata for the selected connection; search matches partial names or IDs, not unique identities

Input

  • searchstring

    at least 1 character, at most 256 characters

  • cursorstring

    The previous page's next cursor; keep the same search

    at least 1 character

  • limitinteger

    Page size, default 100

    at least 1, at most 400

Output

  • projectsobject[]required
    Each item
    • idstringrequired
    • namestringrequired
    • regionstringrequired
    • pg_versionintegerrequired
  • nextstring

    Continue with this cursor, even when this page has no matching project

health

neon.project.healthreadsafe to retry

Read whether a project's default compute has started: active, or idle (paused) after it ran

Input

  • idstringrequired

    The project's id at Neon

    at least 1 character

Output

  • healthybooleanrequired
  • statestringrequired

    The default compute's state: init, active or idle

storeUrl

neon.project.storeUrlwritesafe to retry

Store a project's direct (unpooled) database URL as the secret SANOMA_DATABASE_URL_<EXPORT>, never returned; refused when that secret holds another URL

Input

  • idstringrequired

    The project's id at Neon

    at least 1 character

  • exportstringrequired

    The data file's export that declares the project, such as store

    matches ^[A-Za-z_][A-Za-z0-9_]*$

Output

  • secretstringrequired

    The secret's name, SANOMA_DATABASE_URL_<EXPORT>

branch

create

neon.branch.createwrite

Create a copy-on-write branch of a project's default branch, with its data and a read-write compute; returns its direct URL, once

Input

  • projectstringrequired

    The project's id at Neon

    at least 1 character

  • namestringrequired

    The branch's name

    at least 1 character, at most 256 characters

  • expiresAtstring

    When Neon deletes the branch by itself, RFC 3339 to the second

    format date-time, matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$

Output

  • idstringrequired

    The branch's id (br-…)

  • urlstringrequired

    Its direct database URL, with the role's password: returned this once

delete

neon.branch.deletewritesafe to retry

Delete a branch of a project and its computes; done already when it is gone

Input

  • projectstringrequired

    The project's id at Neon

    at least 1 character

  • idstringrequired

    The branch's id (br-…)

    at least 1 character

Output

  • idstringrequired
  • gonetruerequired

endpoint

suspend

neon.endpoint.suspendwritesafe to retry

Suspend a compute now, dropping its connections; the next connection wakes it

Input

  • projectstringrequired

    The project's id at Neon

    at least 1 character

  • idstringrequired

    The compute's id (ep-…)

    at least 1 character

Output

  • statestringrequired

start

neon.endpoint.startwritesafe to retry

Start a suspended compute

Input

  • projectstringrequired

    The project's id at Neon

    at least 1 character

  • idstringrequired

    The compute's id (ep-…)

    at least 1 character

Output

  • statestringrequired

These pages describe sanoma 0.11.24.