Skip to content
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
331197c
wording tweak on example gallery
jemgillam Jan 10, 2025
55e5971
fix autogenerated mailto link
jemgillam Jan 10, 2025
5ff4d15
update links to Graphile Build docs
jemgillam Jan 10, 2025
9518fc1
update links to Graphile Build docs
jemgillam Jan 10, 2025
92ea458
fix headings and front matter down to usage section
jemgillam Jan 14, 2025
f300b2c
Adjust links, headings, front matter, down to Aggregates
jemgillam Jan 14, 2025
91a7690
headings links etc down to subscriptions
jemgillam Jan 15, 2025
db2f34c
images work on live queries pages
jemgillam Jan 15, 2025
df0f057
updated up to GUIDES
jemgillam Jan 16, 2025
cd550fc
autogenerated table of contents
jemgillam Jan 16, 2025
12e9ff4
synced down to Production Considerations
jemgillam Jan 16, 2025
ba6998b
Fix tailing slash in Spon and Pro components
jemgillam Jan 16, 2025
a720c6f
sync down to graphile-pub-sub-migration
jemgillam Jan 16, 2025
a55bf11
Finish first pass sync
jemgillam Jan 17, 2025
4be747c
second pass
jemgillam Jan 17, 2025
4a63ced
center figures
jemgillam Jan 20, 2025
caa0d71
implement an intro style
jemgillam Jan 20, 2025
c723337
get images working on v5 docs
jemgillam Jan 21, 2025
f76a53a
Title tidy for v5 docs
jemgillam Jan 21, 2025
8bc1a6e
add function gallery
jemgillam Jan 23, 2025
0a3fbc3
fix v5 frontmatter and both versions file types
jemgillam Jan 23, 2025
b2be65f
lint fix
jemgillam Jan 23, 2025
2026c55
fix some v5 links
jemgillam Jan 23, 2025
e8340d9
sync over select changes from v4 to v5
jemgillam Jan 23, 2025
38ff3df
fix link
jemgillam Jan 24, 2025
e885862
fix links
jemgillam Jan 24, 2025
92bd529
border on code highlighting
jemgillam Jan 24, 2025
2a62388
first editorial pass
jemgillam Jan 24, 2025
0f26645
Add spon badge to config page
jemgillam Jan 24, 2025
92ee5af
editorial down to muliple-schemas
jemgillam Jan 28, 2025
4133c30
Merge branch 'main' into postgraphile-sync
benjie Feb 5, 2025
7c27182
checking graphile build links
jemgillam Feb 5, 2025
7825123
Merge branch 'main' into postgraphile-sync
benjie Feb 5, 2025
cf3253f
Fix community pages
jemgillam Feb 5, 2025
5cc1043
fix broken link
jemgillam Feb 6, 2025
28e0866
Merge branch 'main' into postgraphile-sync
benjie Feb 7, 2025
fcd380b
Update postgraphile/website/postgraphile/filtering.md
jemgillam Feb 7, 2025
6d41bf7
Update postgraphile/website/postgraphile/filtering.md
jemgillam Feb 7, 2025
331fdfb
Update postgraphile/website/postgraphile/function-gallery.md
jemgillam Feb 7, 2025
df74999
Update postgraphile/website/postgraphile/make-extend-schema-plugin.md
jemgillam Feb 7, 2025
8168e54
Update postgraphile/website/postgraphile/running-postgraphile-in-dock…
jemgillam Feb 7, 2025
989e641
Update postgraphile/website/postgraphile/running-postgraphile-in-dock…
jemgillam Feb 7, 2025
d5b51f3
Update postgraphile/website/postgraphile/running-postgraphile-in-dock…
jemgillam Feb 7, 2025
e6981b3
Update postgraphile/website/postgraphile/running-postgraphile-in-dock…
jemgillam Feb 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion postgraphile/website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ const config = {
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ["json5"],
additionalLanguages: ["docker", "ini", "json5", "plsql"],
},
algolia: {
// The application ID provided by Algolia
Expand Down
8 changes: 3 additions & 5 deletions postgraphile/website/postgraphile/aggregates.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
---
layout: page
path: /postgraphile/aggregates/
title: Aggregates
---

PostGraphile's engine has support for powerful aggregates. The
PostGraphiles engine has support for powerful aggregates. The
[@graphile/pg-aggregates](https://github.com/graphile/pg-aggregates) module
adds various aggregates to the schema, and gives you the ability to add more
via plugins. Aggregates are located under connection fields.

### Aggregates ignore pagination info

Aggregates are performed over the **entire collection** represented by the
field and its filters - not just the data that would be returned if you were to
field and its filters not just the data that would be returned if you were to
query the nodes. This means they ignore the `first`, `last`, `before`, `after`
and `offset` arguments. This is deliberate (if you only need aggregates over
the data that matches your pagination information then you could calculate
Expand All @@ -21,7 +19,7 @@ these on the client).
### Aggregates only work on Relay connection

Thanks to their expansibility, relay [connections](./connections) were the
perfect place to add aggregates support. If you're using a behavior
perfect place to add aggregates support. If youre using a behavior
configuration that prefers lists over connections (e.g. `-connection +list`)
then you can override it on a per-collection basis with the [`@behavior
+connection` smart tag](./smart-tags/#behavior).
16 changes: 8 additions & 8 deletions postgraphile/website/postgraphile/background-tasks.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
layout: page
path: /postgraphile/background-tasks/
title: Background Tasks in PostGraphile
title: Background Tasks
---

# Background Tasks in PostGraphile

In your GraphQL server typically most processing will be done in the
"foreground", as part of the request-response cycle. However, since clients
typically wait for this request cycle to complete before allowing the user to
Expand Down Expand Up @@ -32,10 +32,10 @@ workers and handle errors and re-tries.

### Tasks queues and workers for Postgres

There are several exisiting solutions that can integrate with a PostgreSQL
There are several existing solutions that can integrate with a PostgreSQL
database or expose a Node.js-friendly API.

- [Graphile Worker](https://github.com/graphile/worker)
- [Graphile Worker](https://worker.graphile.org)
- [GCP Cloud Tasks](https://cloud.google.com/tasks/) (via Graphile Worker)
- [Faktory](http://contribsys.com/faktory/) (via Graphile Worker)
- [RabbitMQ](https://www.rabbitmq.com/)
Expand All @@ -56,7 +56,7 @@ Other important considerations when choosing a task queue would be:
- Complexity
- Throughput requirements
- DevOps complexity
- Tracability
- Traceability
- Privacy

### Graphile Worker
Expand Down Expand Up @@ -86,13 +86,13 @@ module.exports = async (payload, helpers) => {
};
```

Check the [Graphile Worker docs](https://github.com/graphile/worker) for details
Check the [Graphile Worker docs](https://worker.graphile.org) for details
on how to set up and use it.

#### Limitations

Despite all the benefits, Graphile Worker stills lacks some features provided by
other more mature tasks queues

- Currently Graphile Worker doesn't expose a GUI to monitor or manage tasks.
- Currently Graphile Worker doesnt expose a GUI to monitor or manage tasks.
- ??
94 changes: 47 additions & 47 deletions postgraphile/website/postgraphile/behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

For all but the simplest APIs you will want to control which parts of your data
sources are exposed and how they are exposed. New to PostGraphile version 5 is
the "behavior" system that gives you granular control over these topics.
the behavior system that gives you granular control over these topics.

## Terminology

A "behavior string" is a text-based string with a relatively simple syntax; here
A behavior string is a text-based string with a relatively simple syntax; here
are some examples:

- `insert`
- `+list -connection -list:filter`
- `-insert -update -delete query:*:filter +connection -list`

A behavior string is made of a list of "behavior fragments" separated by spaces.
A behavior string is made of a list of behavior fragments separated by spaces.
Each behavior fragment optionally starts with a `+` or `-` symbol (if neither is
specified then `+` is inferred) followed by a "scope string." A scope string is
one or more "scope phrases" joined by colons (`:`). A scope phrase is either a
specified then `+` is inferred) followed by a scope string. A scope string is
one or more scope phrases joined by colons (`:`). A scope phrase is either a
simple alphanumeric word (in camelCase), or an asterisk (`*`).

## Determining entity behavior
Expand All @@ -25,7 +25,7 @@ Many entities that PostGraphile processes when generating a schema (for example:
tables, columns, functions, types, etc.) have associated behaviors which
influence whether and how that entity is exposed. You may influence their
resulting behaviors by adding your own behavior strings to the entity, either
directly or via smart tags/smart comments. For example, if you don't want users
directly or via smart tags/smart comments. For example, if you dont want users
to be able to modify entries in the `forums` table, you might add a database
comment such as `comment on table forums is '@behavior -insert -update
-delete';` (this is just one of many ways of attaching behaviors).
Expand All @@ -44,16 +44,16 @@ strings from various sources; typically this follows the following pattern:
The highest precedence behaviors are at the end the behavior string, and the
lowest priority behaviors are at the start.

When determining if an entity possesses a given "filter" behavior, the system
will scan backwards through the entity's behavior string for the first fragment
When determining if an entity possesses a given filter behavior, the system
will scan backwards through the entitys behavior string for the first fragment
that matches the filter; if the matching fragment has a `-` modifier then the
entity does not possess that behavior (even if a positive fragment existed
earlier in the behavior string) otherwise it does.

## Global default behavior

If you want to make wide-sweeping changes to behaviors, you can add "default
behaviors" via the `preset.schema.defaultBehavior` setting. For example if you
If you want to make wide-sweeping changes to behaviors, you can add default
behaviors via the `preset.schema.defaultBehavior` setting. For example if you
want your schema to use lists by default, eschewing the more verbose (but
typically superior) connections pattern, you might have a configuration
something like this:
Expand All @@ -72,23 +72,23 @@ const preset = {
export default preset;
```

These global defaults can still be overridden by each entity, so they're a
good way of making wide ranging "default" behaviors without locking yourself in
These global defaults can still be overridden by each entity, so theyre a
good way of making wide ranging default behaviors without locking yourself in
too hard.

:::info
:::info Global behavior in presets

If you're authoring a preset that is not the final configuration for a schema
If youre authoring a preset that is not the final configuration for a schema
then this default behavior setting is likely to be overridden (replaced) by the
user's configuration. Instead, preset authors should add a plugin that has a
users configuration. Instead, preset authors should add a plugin that has a
`schema.globalBehavior` entry. If this entry is a string, the behavior will be
prepended. If it's a callback, then it should return an array of behavior
prepended. If its a callback, then it should return an array of behavior
strings to be joined, one of which should be the current (passed in) behavior.
Typically you want a tuple where the first entry is your new behaviors and the
second entry is the current (passed-in) behavior (this way the user's
second entry is the current (passed-in) behavior (this way the users
`defaultBehavior` will have higher precedence to your `globalBehavior`).

A similar "lists by default" plugin might look like this:
A similar lists by default plugin might look like this:

```js
const FavourListsPlugin = {
Expand Down Expand Up @@ -130,11 +130,11 @@ is narrower than `update`; `constraint:resource:update` is narrower still).
:::

The following are behaviors that the core
PostGraphile/graphile-build/graphile-build-pg plugins utilise:
PostGraphile/graphile-build/graphile-build-pg plugins utilize:

- `select` - can select this resource/column/etc. Note this does not necessarily
mean you can do `select * from users` but it might mean that it's possible to
see details about a `users` when it's returned by a function or similar. (In
mean you can do `select * from users` but it might mean that its possible to
see details about a `users` when its returned by a function or similar. (In
this case the `codec` has `select` but the `resource` has `-select`.)
- `resource:select` - can select rows from this resource
- `insert:resource:select` - can select the row that was inserted (on the mutation payload)
Expand All @@ -144,47 +144,47 @@ PostGraphile/graphile-build/graphile-build-pg plugins utilise:
- `resource:insert` - can insert into this resource
- `resource:update` - can update a record in this resource
- `resource:delete` - can delete a record in this resource
- `resource:list` - "list" field for a resource at any level
- `resource:connection` - "connection" field for a resource at any level
- `resource:list:filter` - can we filter this resource's results (when represented as a list)?
- `resource:list:order` - can we order this resource's results (when represented as a list)?
- `resource:connection:filter` - can we filter this resource's results (when represented as a connection)?
- `resource:connection:order`- can we order this resource's results (when represented as a connection)?
- `resource:connection:backwards` - can we paginate backwards through this resource's results (when represented as a connection)?
- `resource:list` - list field for a resource at any level
- `resource:connection` - connection field for a resource at any level
- `resource:list:filter` - can we filter this resources results (when represented as a list)?
- `resource:list:order` - can we order this resources results (when represented as a list)?
- `resource:connection:filter` - can we filter this resources results (when represented as a connection)?
- `resource:connection:order`- can we order this resources results (when represented as a connection)?
- `resource:connection:backwards` - can we paginate backwards through this resources results (when represented as a connection)?
- `resource:aggregates` - does this resource support aggregates across its attributes (i.e. does the `aggregates` field get added to connections)
- `resource:groupedAggregates` - does this resource support grouped aggregates across its attributes (i.e. does the `groupedAggregates` field get added to connections)
- `resource:groupedAggregates:having` - can groupedAggregates on this resource have a 'having' clause?
- `sum:resource:groupedAggregates:having` - can groupedAggregates on this resource have a 'having' clause that uses the 'sum' aggregate?
- `sum:resource:aggregates` - does this resource support 'sum' aggregates across its attributes (replace 'sum' with the aggregate id you care about) (i.e. does the `sum` field get added within the `aggregates` field on connections?)
- `resource:groupedAggregates:having` - can groupedAggregates on this resource have a having clause?
- `sum:resource:groupedAggregates:having` - can groupedAggregates on this resource have a having clause that uses the sum aggregate?
- `sum:resource:aggregates` - does this resource support sum aggregates across its attributes (replace sum with the aggregate id you care about) (i.e. does the `sum` field get added within the `aggregates` field on connections?)
- `constraint:resource:update` - can update a record by this constraint
- `constraint:resource:delete` - can delete a record by this constraint
- `nodeId:resource:update` - can update a record by its NodeID
- `nodeId:resource:delete` - can delete a record by its NodeID
- `attribute:select` - can this attribute be selected?
- `attribute:insert` - can this attribute be inserted into?
- `attribute:update` - can this attribute be updated?
- `attribute:base` - should we add this attribute to the "base" input type?
- `attribute:base` - should we add this attribute to the base input type?
- `attribute:aggregate` - can we aggregate on this attribute?
- `sum:attribute:aggregate` - can we perform the 'sum' aggregate on this attribute? (replace 'sum' with the aggregate id you care about) (i.e. does this attribute get added to the `sum` field on the `aggregates` field on connections?)
- `sum:resource:aggregate` - does this computed-column-like resource support the 'sum' aggregate when acting as an attribute (replace 'sum' with the aggregate id you care about)
- `sum:attribute:aggregate` - can we perform the sum aggregate on this attribute? (replace sum with the aggregate id you care about) (i.e. does this attribute get added to the `sum` field on the `aggregates` field on connections?)
- `sum:resource:aggregate` - does this computed-column-like resource support the sum aggregate when acting as an attribute (replace sum with the aggregate id you care about)
- `attribute:groupBy` - can we group by this attribute when performing grouped aggregates?
- `attribute:havingBy` - can this attribute be used in the 'having' clause of a grouped aggregate?
- `sum:attribute:havingBy` - can the sum of this attribute be used in the 'having' clause of a grouped aggregate?
- `resource:havingBy` - can this computed-column-like resource be used in the 'having' clause of a grouped aggregate?
- `sum:resource:havingBy` - can the sum of this computed-column-like resource be be used in the 'having' clause of a grouped aggregate?
- `attribute:havingBy` - can this attribute be used in the having clause of a grouped aggregate?
- `sum:attribute:havingBy` - can the sum of this attribute be used in the having clause of a grouped aggregate?
- `resource:havingBy` - can this computed-column-like resource be used in the having clause of a grouped aggregate?
- `sum:resource:havingBy` - can the sum of this computed-column-like resource be be used in the having clause of a grouped aggregate?
- `nodeId:insert` - can we insert to the columns represented by this nodeId which represents a table related via foreign key constraint?
- `nodeId:update` - can we update the columns represented by this nodeId which represents a table related via foreign key constraint?
- `nodeId:base` - should we add a nodeId input representing this foreign key constraint to the "base" input type?
- `nodeId:base` - should we add a nodeId input representing this foreign key constraint to the base input type?
- `type:node` - should the GraphQLObjectType (`type`) this codec represents
implement the GraphQL Global Object Identification specification
- `interface:node` - should the GraphQLInterfaceType (`interface`) this codec
represents implement the GraphQL Global Object Identification specification
- `list` - list (simple collection)
- `connection` - connection (GraphQL Cursor Pagination Spec)
- `query:resource:list` - "list" field for a resource at the root Query level
- `query:resource:connection` - "connection" field for a resource at the root Query level
- `query:interface:list` - "list" field for a interface at the root Query level
- `query:interface:connection` - "connection" field for a interface at the root Query level
- `query:resource:list` - list field for a resource at the root Query level
- `query:resource:connection` - connection field for a resource at the root Query level
- `query:interface:list` - list field for a interface at the root Query level
- `query:interface:connection` - connection field for a interface at the root Query level
- `queryField` - for procedures: should it become a field on the `Query` type?
- `typeField` - for procedures: should it become a field on a non-operation
type?
Expand All @@ -202,15 +202,15 @@ PostGraphile/graphile-build/graphile-build-pg plugins utilise:
- `proc:orderBy` - can we order by the result of this proc (function resource)?
- `attribute:orderBy` - can we order by this attribute (column, property)?
- `attribute:aggregate:orderBy` - can we order by aggregates of this attribute (column, property)?
- `sum:attribute:aggregate:orderBy` - can we order by 'sum' aggregates of this attribute (column, property)?
- `sum:attribute:aggregate:orderBy` - can we order by sum aggregates of this attribute (column, property)?
- `filterBy` - can we filter by this thing (e.g. column, table, etc)?
- `proc:filterBy` - can we filter by the result of this proc (function resource)
- `attribute:filterBy` - can we filter by this attribute (column, property)?
- `condition:attribute:filterBy` - can we filter by this attribute (column, property) in the `condition` argument?
- `attribute:aggregate:filterBy` - can we filter by the aggregate of this attribute (column, property)?
- `sum:attribute:aggregate:filterBy` - can we filter by the 'sum' aggregate of this attribute (column, property)?
- `sum:attribute:aggregate:filterBy` - can we filter by the sum aggregate of this attribute (column, property)?
- `resource:aggregates:filterBy` - can we filter (a different resource) by this resource's aggregates?
- `sum:resource:aggregates:filterBy` - can we filter (a different resource) by this resource's 'sum' aggregates?
- `sum:resource:aggregates:filterBy` - can we filter (a different resource) by this resource's sum aggregates?
- `single` - can we get just one?
- `query:resource:single` - can we get a single one of these (resource) at the root?
- `singularRelation:resource:single` - can we get a single one of these (resource) from a
Expand All @@ -222,7 +222,7 @@ PostGraphile/graphile-build/graphile-build-pg plugins utilise:
- `manyRelation:resource:list`
- `manyRelation:resource:connection`
- `manyRelation:aggregates:orderBy` - can we order by aggregates of this manyRelation?
- `sum:manyRelation:aggregates:orderBy` - can we order by 'sum' aggregates of this manyRelation?
- `sum:manyRelation:aggregates:orderBy` - can we order by sum aggregates of this manyRelation?
- `jwt` - should the given codec behave as if it were a JWT?
- `insert:input:record` - input to the 'insert' mutation
- `totalCount` - on a codec, should we add the `totalCount` field?
Expand Down
Loading