Skip to content

Instantly share code, notes, and snippets.

View jsmnbom's full-sized avatar
💭
I may be slow to respond.

Jas jsmnbom

💭
I may be slow to respond.
View GitHub Profile
/**
* Plugin(s) to add typedPgRegistry to the build input.
* TypedPgRegistryPlugin adds the typedPgRegistry to the build input, and should always be used.
* ExportPgRegistryTypesPlugin exports types for the PgRegistry, and should only be used in development.
* The exported .d.ts file should be added to the tsconfig.json `include` array.
* The plugin only exports if the `exportPgRegistryTypesPath` option is set in the schema options.
*/
import type { PgCodec, PgEnumCodec, PgResource } from '@dataplan/pg'
import { mkdir, readFile, writeFile } from 'node:fs/promises'
import { EXPORTABLE } from 'graphile-utils'
export default {
name: 'ULIDPlugin',
description: 'Adds support for ULID type (specifically https://github.com/pksunkara/pgx_ulid).',
version: '0.0.0',
gather: {
hooks: {
pgCodecs_findPgCodec(info, event) {
if (event.pgType.typname === 'ulid') {
import 'graphile-config'
declare global {
// eslint-disable-next-line ts/no-namespace
namespace GraphileBuild {
interface PgResourceTags {
idPrefix?: string
}
interface PgCodecTags {