Skip to content

How can I add this filter when running the 'npx postgraphile' ? #218

Open
@duncangroenewald

Description

@duncangroenewald

How can I include this filter when running using the basic 'npx postgraphile' client example using a graphile.config.mjs file with a preset defined.

This does not seem to work

npx postgraphile --append-plugins postgraphile-plugin-connection-filter
Is it possible to include this in the graphile.config.mjs file and if so how ?

This doesn't seem to work.

import { PostGraphileAmberPreset } from "postgraphile/presets/amber";
import { makePgService } from "postgraphile/adaptors/pg";
import ConnectionFilterPlugin  from "postgraphile-plugin-connection-filter";

/** @type {GraphileConfig.Preset} */
const preset = {
  extends: [PostGraphileAmberPreset],
  plugins: [
    /* Add plugins here, e.g.: */
    ConnectionFilterPlugin,
  ],
  pgServices: [makePgService({ connectionString: "postgresql://user:pwd@localhost:5432/dbname",
                               schemas: "dbschemaname",
                               port: 5679,
                               superuserConnectionString: "postgresql://user:pwd@localhost:5432/dbname"
   })],
  grafserv: { watch: false },
  schema: {
    /* options for the schema build phase, e.g.: */
    retryOnInitFail: true,
    exportSchemaSDLPath: `${process.cwd()}/latestSchema-dbname.graphql`,
    exportSchemaIntrospectionResultPath: `${process.cwd()}/latestSchema-dbname.json`,
    sortExport: true,
  }
};

export default preset

Errors:

postgraphile/node_modules/graphile-config/dist/resolvePresets.js:180
        throw new Error(`Error occurred when resolving preset:\n  ${String(e).replace(/\n/g, "\n  ")}\nPreset: ${inspect(preset)}`);
              ^

Error: Error occurred when resolving preset:
  Error: Expected plugin, but found '[Function: PostGraphileConnectionFilterPlugin]'
Preset: {
  extends: [ { extends: [Array], plugins: [Array] } ],
  plugins: [ [Function: PostGraphileConnectionFilterPlugin] ],
  pgServices: [

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions