Skip to content

@lastshotlabs/slingshot-postgres

npm install @lastshotlabs/slingshot-postgres

A connected Postgres handle bundling a raw pg.Pool and a Drizzle ORM client.

  • pool — passed to plugin adapters that accept a raw pg.Pool (permissions, push, webhooks).
  • db — passed to Drizzle-based adapters such as createPostgresAdapter (auth).
async function connectPostgres(connectionString: string, options: PostgresConnectionOptions = {},): Promise<DrizzlePostgresDb>

Source: packages/slingshot-postgres/src/connection.ts

Internal cursor payload encoded in opaque pagination cursors. Carries both the createdAt ISO string and the record id so that the (createdAt, id) compound index can be used for stable keyset pagination.

Remarks: Cursors are transmitted as base64-encoded JSON strings. The JSON object is stringified, then passed through btoa() to produce the opaque cursor that clients receive. decodeCursor reverses this with atob() + JSON.parse.

async function createPostgresAdapter(opts: PostgresAdapterOptions): Promise<AuthAdapter>

Source: packages/slingshot-postgres/src/adapter.ts

Internal cursor payload encoded in opaque pagination cursors. Carries both the createdAt ISO string and the record id so that the (createdAt, id) compound index can be used for stable keyset pagination.

Remarks: Cursors are transmitted as base64-encoded JSON strings. The JSON object is stringified, then passed through btoa() to produce the opaque cursor that clients receive. decodeCursor reverses this with atob() + JSON.parse.

function parseMigrationVersion(raw: unknown, maxVersion: number): number

Source: packages/slingshot-postgres/src/adapter.ts

A connected Postgres handle bundling a raw pg.Pool and a Drizzle ORM client.

  • pool — passed to plugin adapters that accept a raw pg.Pool (permissions, push, webhooks).
  • db — passed to Drizzle-based adapters such as createPostgresAdapter (auth).

Source: packages/slingshot-postgres/src/connection.ts

Internal cursor payload encoded in opaque pagination cursors. Carries both the createdAt ISO string and the record id so that the (createdAt, id) compound index can be used for stable keyset pagination.

Remarks: Cursors are transmitted as base64-encoded JSON strings. The JSON object is stringified, then passed through btoa() to produce the opaque cursor that clients receive. decodeCursor reverses this with atob() + JSON.parse.

Source: packages/slingshot-postgres/src/adapter.ts

A connected Postgres handle bundling a raw pg.Pool and a Drizzle ORM client.

  • pool — passed to plugin adapters that accept a raw pg.Pool (permissions, push, webhooks).
  • db — passed to Drizzle-based adapters such as createPostgresAdapter (auth).

Source: packages/slingshot-postgres/src/connection.ts

A connected Postgres handle bundling a raw pg.Pool and a Drizzle ORM client.

  • pool — passed to plugin adapters that accept a raw pg.Pool (permissions, push, webhooks).
  • db — passed to Drizzle-based adapters such as createPostgresAdapter (auth).

Source: packages/slingshot-postgres/src/connection.ts