├── .eslintignore ├── .eslintrc.js ├── .flowconfig ├── .github ├── FUNDING.yml └── workflows │ ├── ci.yml │ └── ci │ └── docker-entrypoint-initdb.d │ ├── 010-enable_wal.sh │ ├── 020-wal2json.sh │ └── 030-setup.sh ├── .gitignore ├── .jest-wrapper.js ├── .prettierignore ├── .prettierrc.js ├── .yarnrc ├── CHANGELOG.md ├── CONTRIBUTING.md ├── README.md ├── SPONSORS.md ├── babel.config.js ├── lerna.json ├── next2latest ├── package.json ├── packages ├── graphile-build-pg │ ├── .gitignore │ ├── .npmignore │ ├── LICENSE.md │ ├── README.md │ ├── SPONSORS.md │ ├── __tests__ │ │ └── tags.test.js │ ├── jest.config.js │ ├── package.json │ ├── res │ │ └── watch-fixtures.sql │ └── src │ │ ├── GraphQLJSON.js │ │ ├── PgLiveProvider.js │ │ ├── QueryBuilder.d.ts │ │ ├── QueryBuilder.js │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── inflections.js │ │ ├── omit.js │ │ ├── parseIdentifier.js │ │ ├── pgPrepareAndRun.js │ │ ├── plugins │ │ ├── PageInfoStartEndCursor.js │ │ ├── PgAllRows.js │ │ ├── PgBackwardRelationPlugin.js │ │ ├── PgBasicsPlugin.js │ │ ├── PgColumnDeprecationPlugin.js │ │ ├── PgColumnsPlugin.js │ │ ├── PgComputedColumnsPlugin.js │ │ ├── PgConditionComputedColumnPlugin.js │ │ ├── PgConnectionArgCondition.js │ │ ├── PgConnectionArgFirstLastBeforeAfter.js │ │ ├── PgConnectionArgOrderBy.js │ │ ├── PgConnectionArgOrderByDefaultValue.js │ │ ├── PgConnectionTotalCount.js │ │ ├── PgForwardRelationPlugin.js │ │ ├── PgIntrospectionPlugin.d.ts │ │ ├── PgIntrospectionPlugin.js │ │ ├── PgJWTPlugin.js │ │ ├── PgMutationCreatePlugin.js │ │ ├── PgMutationPayloadEdgePlugin.js │ │ ├── PgMutationProceduresPlugin.js │ │ ├── PgMutationUpdateDeletePlugin.js │ │ ├── PgNodeAliasPostGraphile.js │ │ ├── PgOrderAllColumnsPlugin.js │ │ ├── PgOrderByPrimaryKeyPlugin.js │ │ ├── PgOrderComputedColumnsPlugin.js │ │ ├── PgQueryProceduresPlugin.js │ │ ├── PgRecordFunctionConnectionPlugin.js │ │ ├── PgRecordReturnTypesPlugin.js │ │ ├── PgRowByUniqueConstraint.js │ │ ├── PgRowNode.js │ │ ├── PgScalarFunctionConnectionPlugin.js │ │ ├── PgTablesPlugin.js │ │ ├── PgTypesPlugin.js │ │ ├── addStartEndCursor.js │ │ ├── debugSql.js │ │ ├── introspectionQuery.js │ │ ├── makeProcField.d.ts │ │ ├── makeProcField.js │ │ ├── pgField.d.ts │ │ ├── pgField.js │ │ └── viaTemporaryTable.js │ │ ├── postgresInterval.js │ │ ├── queryFromResolveDataFactory.js │ │ ├── utils.js │ │ └── withPgClient.js ├── graphile-build │ ├── .gitignore │ ├── .npmignore │ ├── LICENSE.md │ ├── README.md │ ├── SPONSORS.md │ ├── __tests__ │ │ ├── Live.test.js │ │ ├── __snapshots__ │ │ │ ├── emptyMutation.test.js.snap │ │ │ ├── enum.test.js.snap │ │ │ ├── fieldData.test.js.snap │ │ │ └── watch.test.js.snap │ │ ├── emptyMutation.test.js │ │ ├── enum.test.js │ │ ├── fieldData.test.js │ │ ├── hasVersion.test.js │ │ ├── invalid.test.js │ │ └── watch.test.js │ ├── examples │ │ └── README-1.js │ ├── jest.config.js │ ├── package.json │ └── src │ │ ├── Live.d.ts │ │ ├── Live.js │ │ ├── SchemaBuilder.d.ts │ │ ├── SchemaBuilder.js │ │ ├── callbackToAsyncIterator.js │ │ ├── extend.js │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── makeNewBuild.js │ │ ├── plugins │ │ ├── AddQueriesToSubscriptionsPlugin.js │ │ ├── ClientMutationIdDescriptionPlugin.js │ │ ├── MutationPayloadQueryPlugin.js │ │ ├── MutationPlugin.js │ │ ├── NodePlugin.js │ │ ├── QueryPlugin.js │ │ ├── StandardTypesPlugin.js │ │ ├── SubscriptionPlugin.js │ │ ├── SwallowErrorsPlugin.js │ │ ├── TrimEmptyDescriptionsPlugin.js │ │ └── index.js │ │ ├── resolveNode.js │ │ ├── swallowError.js │ │ └── utils.js ├── graphile-utils │ ├── .gitignore │ ├── LICENSE.md │ ├── README.md │ ├── SPONSORS.md │ ├── __tests__ │ │ ├── ExtendSchemaPlugin-pg.test.js │ │ ├── ExtendSchemaPlugin.test.js │ │ ├── __snapshots__ │ │ │ ├── ExtendSchemaPlugin-pg.test.js.snap │ │ │ ├── ExtendSchemaPlugin.test.js.snap │ │ │ └── makeAddPgTableConditionPlugin.test.js.snap │ │ ├── makeAddPgTableConditionPlugin.test.js │ │ ├── makeAddPgTableOrderByPlugin.test.js │ │ ├── makePgSmartTagsPlugin.test.js │ │ ├── makeProcessSchemaPlugin.test.js │ │ ├── makeWrapResolversPlugin-pg.test.js │ │ ├── makeWrapResolversPlugin.test.js │ │ └── utils-schema.sql │ ├── jest.config.js │ ├── package.json │ ├── scripts │ │ └── test │ ├── src │ │ ├── fieldHelpers.ts │ │ ├── gql.ts │ │ ├── index.ts │ │ ├── introspectionHelpers.ts │ │ ├── makeAddInflectorsPlugin.ts │ │ ├── makeAddPgTableConditionPlugin.ts │ │ ├── makeAddPgTableOrderByPlugin.ts │ │ ├── makeChangeNullabilityPlugin.ts │ │ ├── makeExtendSchemaPlugin.ts │ │ ├── makePgSmartTagsPlugin.ts │ │ ├── makePluginByCombiningPlugins.ts │ │ ├── makeProcessSchemaPlugin.ts │ │ ├── makeWrapResolversPlugin.ts │ │ └── parseIdentifierParts.ts │ └── tsconfig.json ├── graphile │ ├── index.js │ └── package.json ├── graphql-parse-resolve-info │ ├── .gitignore │ ├── .npmignore │ ├── LICENSE.md │ ├── README.md │ ├── SPONSORS.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── test.test.js.snap │ │ └── test.test.js │ ├── index.js │ ├── jest.config.js │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── jest-serializer-graphql-schema │ ├── .gitignore │ ├── LICENSE.md │ ├── README.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── schema.test.ts.snap │ │ └── schema.test.ts │ ├── jest.config.js │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── lds │ ├── .gitignore │ ├── LICENSE.md │ ├── README.md │ ├── SPONSORS.md │ ├── __tests__ │ │ ├── drop_replication_slot.sql │ │ ├── helpers.ts │ │ ├── index.test.ts │ │ ├── pg-logical-decoding.test.ts │ │ ├── schema.sql │ │ └── test.sql │ ├── jest.config.js │ ├── package.json │ ├── src │ │ ├── cli.ts │ │ ├── fatal-error.ts │ │ ├── index.ts │ │ └── pg-logical-decoding.ts │ └── tsconfig.json ├── lru │ ├── .gitignore │ ├── LICENSE.md │ ├── README.md │ ├── __tests__ │ │ └── index.test.js │ ├── jest.config.js │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── pg-pubsub │ ├── .gitignore │ ├── LICENSE.md │ ├── README.md │ ├── SPONSORS.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── subs.test.ts.snap │ │ ├── runQuery.ts │ │ ├── schema.sql │ │ └── subs.test.ts │ ├── jest.config.js │ ├── package.json │ ├── src │ │ ├── PgGenericSubscriptionPlugin.ts │ │ ├── PgSubscriptionResolverPlugin.ts │ │ └── index.ts │ ├── test.sh │ └── tsconfig.json ├── pg-sql2 │ ├── .eslintignore │ ├── .flowconfig │ ├── .gitignore │ ├── .markdown-doctest-setup.js │ ├── .npmignore │ ├── LICENSE.md │ ├── README.md │ ├── SPONSORS.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── general.test.js.snap │ │ └── general.test.js │ ├── examples │ │ └── README-1.js │ ├── jest.config.js │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── postgraphile-core │ ├── .gitignore │ ├── .npmignore │ ├── LICENSE.md │ ├── README.md │ ├── SPONSORS.md │ ├── __tests__ │ │ ├── fixtures │ │ │ ├── mutations │ │ │ │ ├── d.createPerson.graphql │ │ │ │ ├── d.deletePerson.graphql │ │ │ │ ├── d.updatePerson.graphql │ │ │ │ ├── enum_tables.mutations.graphql │ │ │ │ ├── enum_tables.mutations2.graphql │ │ │ │ ├── geometry.mutations.graphql │ │ │ │ ├── inheritence.createUserFile.graphql │ │ │ │ ├── mutation-create.graphql │ │ │ │ ├── mutation-delete-error.graphql │ │ │ │ ├── mutation-delete.graphql │ │ │ │ ├── mutation-return-types.graphql │ │ │ │ ├── mutation-update.graphql │ │ │ │ ├── network_types.createNetwork.graphql │ │ │ │ ├── pg11.identity.graphql │ │ │ │ ├── pg11.network_types.createNetwork.graphql │ │ │ │ ├── pg11.types.graphql │ │ │ │ ├── procedure-mutation.graphql │ │ │ │ ├── rbac.createLeftArm.graphql │ │ │ │ ├── rbac.createPerson.graphql │ │ │ │ ├── rbac.deletePerson.graphql │ │ │ │ ├── rbac.leftArmIdentity.graphql │ │ │ │ ├── rbac.updateLeftArm.graphql │ │ │ │ ├── rbac.updatePerson.graphql │ │ │ │ └── types.graphql │ │ │ └── queries │ │ │ │ ├── badlyBehavedFunction.graphql │ │ │ │ ├── classic-ids.graphql │ │ │ │ ├── connections-blankcursor.graphql │ │ │ │ ├── connections-condition-computed-column.graphql │ │ │ │ ├── connections-order-computed-column.graphql │ │ │ │ ├── connections-totalCount.graphql │ │ │ │ ├── connections.graphql │ │ │ │ ├── d.filter.graphql │ │ │ │ ├── d.order.graphql │ │ │ │ ├── directives.graphql │ │ │ │ ├── dynamic-json.condition-json-field-variable.graphql │ │ │ │ ├── dynamic-json.graphql │ │ │ │ ├── empty-array.graphql │ │ │ │ ├── enum_tables.queries.graphql │ │ │ │ ├── enum_tables.queries2.graphql │ │ │ │ ├── function-return-types.graphql │ │ │ │ ├── geometry.queries.graphql │ │ │ │ ├── json-overflow.graphql │ │ │ │ ├── large_bigint.issue491.graphql │ │ │ │ ├── longAliases.graphql │ │ │ │ ├── named_query_builder.toys.graphql │ │ │ │ ├── network_types.graphql │ │ │ │ ├── node.graphql │ │ │ │ ├── nonexistant-record-from-function.graphql │ │ │ │ ├── one-to-one-backward.graphql │ │ │ │ ├── orderByNullsLast.graphql │ │ │ │ ├── pg11.network_types.graphql │ │ │ │ ├── pg11.types.graphql │ │ │ │ ├── posts.graphql │ │ │ │ ├── procedure-computed-fields.graphql │ │ │ │ ├── procedure-query.graphql │ │ │ │ ├── query.graphql │ │ │ │ ├── rbac.basic.graphql │ │ │ │ ├── relation-head-tail.graphql │ │ │ │ ├── relation-tail-head.graphql │ │ │ │ ├── simple-collections.graphql │ │ │ │ ├── simple-procedure-computed-fields.graphql │ │ │ │ ├── simple-procedure-query.graphql │ │ │ │ ├── simple-relations-head-tail.graphql │ │ │ │ ├── simple-relations-tail-head.graphql │ │ │ │ ├── smart_comment_relations.houses.graphql │ │ │ │ ├── types.graphql │ │ │ │ ├── unique-constraints.graphql │ │ │ │ ├── unique-foreign-keys.graphql │ │ │ │ └── view.graphql │ │ ├── helpers-v5.js │ │ ├── helpers.js │ │ ├── integration │ │ │ ├── ToyCategoriesPlugin.js │ │ │ ├── __snapshots__ │ │ │ │ ├── extend-errors.test.js.snap │ │ │ │ ├── mutations.test.js.snap │ │ │ │ ├── queries-jwt.test.js.snap │ │ │ │ └── queries.test.js.snap │ │ │ ├── extend-errors.test.js │ │ │ ├── live │ │ │ │ ├── collections.test.js │ │ │ │ └── records.test.js │ │ │ ├── live_helpers.js │ │ │ ├── mutations.test.js │ │ │ ├── queries-jwt.test.js │ │ │ ├── queries-ranges.test.js │ │ │ ├── queries.test.js │ │ │ └── schema │ │ │ │ ├── __snapshots__ │ │ │ │ └── invalidSkipPlugins.test.js.snap │ │ │ │ ├── core.js │ │ │ │ ├── defaultOptions.1.graphql │ │ │ │ ├── defaultOptions.inheritence.1.graphql │ │ │ │ ├── defaultOptions.inheritence.test.js │ │ │ │ ├── defaultOptions.subscriptions.1.graphql │ │ │ │ ├── defaultOptions.subscriptions.test.js │ │ │ │ ├── defaultOptions.test.js │ │ │ │ ├── disabledTagsNoLegacyRelations.1.graphql │ │ │ │ ├── disabledTagsNoLegacyRelations.test.js │ │ │ │ ├── enum_tables.1.graphql │ │ │ │ ├── enum_tables.test.js │ │ │ │ ├── function-clash.1.graphql │ │ │ │ ├── function-clash.test.js │ │ │ │ ├── geometry.1.graphql │ │ │ │ ├── geometry.test.js │ │ │ │ ├── indexes.1.graphql │ │ │ │ ├── indexes.index_expressions.1.graphql │ │ │ │ ├── indexes.index_expressions.test.js │ │ │ │ ├── indexes.index_type_checker_plugin.1.graphql │ │ │ │ ├── indexes.index_type_checker_plugin.test.js │ │ │ │ ├── indexes.test.js │ │ │ │ ├── inflect-core.1.graphql │ │ │ │ ├── inflect-core.test.js │ │ │ │ ├── invalidSkipPlugins.test.js │ │ │ │ ├── jwt.1.graphql │ │ │ │ ├── jwt.test.js │ │ │ │ ├── legacyFunctionsOnly.1.graphql │ │ │ │ ├── legacyFunctionsOnly.test.js │ │ │ │ ├── legacyRelationsOnlyLegacyJsonNoTags.1.graphql │ │ │ │ ├── legacyRelationsOnlyLegacyJsonNoTags.test.js │ │ │ │ ├── network_types.1.graphql │ │ │ │ ├── network_types.custom.1.graphql │ │ │ │ ├── network_types.custom.test.js │ │ │ │ ├── network_types.test.js │ │ │ │ ├── noDefaultMutations.1.graphql │ │ │ │ ├── noDefaultMutations.test.js │ │ │ │ ├── omit-rename.1.graphql │ │ │ │ ├── omit-rename.omitcolumns.1.graphql │ │ │ │ ├── omit-rename.omitcolumns.execute.1.graphql │ │ │ │ ├── omit-rename.omitcolumns.execute.test.js │ │ │ │ ├── omit-rename.omitcolumns.loads-title.1.graphql │ │ │ │ ├── omit-rename.omitcolumns.loads-title.test.js │ │ │ │ ├── omit-rename.omitcolumns.shows-title-asterisk.1.graphql │ │ │ │ ├── omit-rename.omitcolumns.shows-title-asterisk.test.js │ │ │ │ ├── omit-rename.omitcolumns.test.js │ │ │ │ ├── omit-rename.omitcolumns.title-order.1.graphql │ │ │ │ ├── omit-rename.omitcolumns.title-order.test.js │ │ │ │ ├── omit-rename.omitcolumns.update-title.1.graphql │ │ │ │ ├── omit-rename.omitcolumns.update-title.test.js │ │ │ │ ├── omit-rename.omitstuff.1.graphql │ │ │ │ ├── omit-rename.omitstuff.constraints.1.graphql │ │ │ │ ├── omit-rename.omitstuff.constraints.test.js │ │ │ │ ├── omit-rename.omitstuff.films-asterisk.1.graphql │ │ │ │ ├── omit-rename.omitstuff.films-asterisk.test.js │ │ │ │ ├── omit-rename.omitstuff.films-create.1.graphql │ │ │ │ ├── omit-rename.omitstuff.films-create.test.js │ │ │ │ ├── omit-rename.omitstuff.films-delete.1.graphql │ │ │ │ ├── omit-rename.omitstuff.films-delete.test.js │ │ │ │ ├── omit-rename.omitstuff.films-loads.1.graphql │ │ │ │ ├── omit-rename.omitstuff.films-loads.test.js │ │ │ │ ├── omit-rename.omitstuff.films-update.1.graphql │ │ │ │ ├── omit-rename.omitstuff.films-update.test.js │ │ │ │ ├── omit-rename.omitstuff.shows-order.1.graphql │ │ │ │ ├── omit-rename.omitstuff.shows-order.test.js │ │ │ │ ├── omit-rename.omitstuff.test.js │ │ │ │ ├── omit-rename.test.js │ │ │ │ ├── partitioned.1.graphql │ │ │ │ ├── partitioned.2.graphql │ │ │ │ ├── partitioned.test.js │ │ │ │ ├── pg11.1.graphql │ │ │ │ ├── pg11.custom.1.graphql │ │ │ │ ├── pg11.custom.test.js │ │ │ │ ├── pg11.test.js │ │ │ │ ├── pgColumnFilter.1.graphql │ │ │ │ ├── pgColumnFilter.test.js │ │ │ │ ├── rbac.1.graphql │ │ │ │ ├── rbac.ignore.1.graphql │ │ │ │ ├── rbac.ignore.test.js │ │ │ │ ├── rbac.test.js │ │ │ │ ├── relay1.1.graphql │ │ │ │ ├── relay1.test.js │ │ │ │ ├── simple-collections.1.graphql │ │ │ │ ├── simple-collections.omit-pets-simple.1.graphql │ │ │ │ ├── simple-collections.omit-pets-simple.test.js │ │ │ │ ├── simple-collections.only-people-omit.1.graphql │ │ │ │ ├── simple-collections.only-people-omit.test.js │ │ │ │ ├── simple-collections.only.1.graphql │ │ │ │ ├── simple-collections.only.test.js │ │ │ │ ├── simple-collections.pets-simple.1.graphql │ │ │ │ ├── simple-collections.pets-simple.test.js │ │ │ │ ├── simple-collections.test.js │ │ │ │ ├── simplePrint.graphql │ │ │ │ ├── simplePrint.test.js │ │ │ │ ├── skipNodePlugin.1.graphql │ │ │ │ ├── skipNodePlugin.test.js │ │ │ │ ├── smart_comment_relations.1.graphql │ │ │ │ ├── smart_comment_relations.nx.test.js │ │ │ │ ├── smart_comment_relations.post.1.graphql │ │ │ │ ├── smart_comment_relations.post.test.js │ │ │ │ ├── smart_comment_relations.post_view.1.graphql │ │ │ │ ├── smart_comment_relations.post_view.test.js │ │ │ │ ├── smart_comment_relations.post_view_no_pk.1.graphql │ │ │ │ ├── smart_comment_relations.post_view_no_pk.test.js │ │ │ │ ├── smart_comment_relations.test.js │ │ │ │ ├── smart_comment_relations.view_fake_unique.1.graphql │ │ │ │ ├── smart_comment_relations.view_fake_unique.test.js │ │ │ │ ├── smart_comment_relations.view_fake_unique_pk.1.graphql │ │ │ │ └── smart_comment_relations.view_fake_unique_pk.test.js │ │ ├── kitchen-sink-d-schema-comments.sql │ │ ├── kitchen-sink-data.sql │ │ ├── kitchen-sink-permissions.sql │ │ ├── kitchen-sink-schema.sql │ │ ├── mutations │ │ │ ├── _test.js │ │ │ ├── jwt │ │ │ │ ├── authenticateFail.json5 │ │ │ │ ├── authenticateFail.sql │ │ │ │ ├── authenticateFail.test.graphql │ │ │ │ ├── normal.json5 │ │ │ │ ├── normal.sql │ │ │ │ ├── normal.test.graphql │ │ │ │ ├── pgJwtTypeIdentifier-bigNumbers.json5 │ │ │ │ ├── pgJwtTypeIdentifier-bigNumbers.sql │ │ │ │ ├── pgJwtTypeIdentifier-bigNumbers.test.graphql │ │ │ │ ├── pgJwtTypeIdentifier-withPayload.json5 │ │ │ │ ├── pgJwtTypeIdentifier-withPayload.sql │ │ │ │ ├── pgJwtTypeIdentifier-withPayload.test.graphql │ │ │ │ ├── pgJwtTypeIdentifier.json5 │ │ │ │ ├── pgJwtTypeIdentifier.sql │ │ │ │ └── pgJwtTypeIdentifier.test.graphql │ │ │ └── v4-base │ │ │ │ ├── d.createPerson.json5 │ │ │ │ ├── d.createPerson.sql │ │ │ │ ├── d.createPerson.test.graphql │ │ │ │ ├── d.deletePerson.json5 │ │ │ │ ├── d.deletePerson.sql │ │ │ │ ├── d.deletePerson.test.graphql │ │ │ │ ├── d.updatePerson.json5 │ │ │ │ ├── d.updatePerson.sql │ │ │ │ ├── d.updatePerson.test.graphql │ │ │ │ ├── enum_tables.mutations.json5 │ │ │ │ ├── enum_tables.mutations.sql │ │ │ │ ├── enum_tables.mutations.test.graphql │ │ │ │ ├── enum_tables.mutations2.json5 │ │ │ │ ├── enum_tables.mutations2.sql │ │ │ │ ├── enum_tables.mutations2.test.graphql │ │ │ │ ├── geometry.mutations.json5 │ │ │ │ ├── geometry.mutations.sql │ │ │ │ ├── geometry.mutations.test.graphql │ │ │ │ ├── inheritence.createUserFile.json5 │ │ │ │ ├── inheritence.createUserFile.sql │ │ │ │ ├── inheritence.createUserFile.test.graphql │ │ │ │ ├── mutation-create.json5 │ │ │ │ ├── mutation-create.sql │ │ │ │ ├── mutation-create.test.graphql │ │ │ │ ├── mutation-delete.errors.json5 │ │ │ │ ├── mutation-delete.json5 │ │ │ │ ├── mutation-delete.sql │ │ │ │ ├── mutation-delete.test.graphql │ │ │ │ ├── mutation-return-types.json5 │ │ │ │ ├── mutation-return-types.sql │ │ │ │ ├── mutation-return-types.test.graphql │ │ │ │ ├── mutation-update.json5 │ │ │ │ ├── mutation-update.sql │ │ │ │ ├── mutation-update.test.graphql │ │ │ │ ├── network_types.createNetwork.json5 │ │ │ │ ├── network_types.createNetwork.sql │ │ │ │ ├── network_types.createNetwork.test.graphql │ │ │ │ ├── partitioned.use-partitioned-children.mutations.json5 │ │ │ │ ├── partitioned.use-partitioned-children.mutations.sql │ │ │ │ ├── partitioned.use-partitioned-children.mutations.test.graphql │ │ │ │ ├── partitioned.use-partitioned-parent.mutations.json5 │ │ │ │ ├── partitioned.use-partitioned-parent.mutations.sql │ │ │ │ ├── partitioned.use-partitioned-parent.mutations.test.graphql │ │ │ │ ├── pg11.identity.json5 │ │ │ │ ├── pg11.identity.sql │ │ │ │ ├── pg11.identity.test.graphql │ │ │ │ ├── pg11.network_types.createNetwork.json5 │ │ │ │ ├── pg11.network_types.createNetwork.sql │ │ │ │ ├── pg11.network_types.createNetwork.test.graphql │ │ │ │ ├── pg11.types.json5 │ │ │ │ ├── pg11.types.sql │ │ │ │ ├── pg11.types.test.graphql │ │ │ │ ├── procedure-mutation.errors.json5 │ │ │ │ ├── procedure-mutation.json5 │ │ │ │ ├── procedure-mutation.sql │ │ │ │ ├── procedure-mutation.test.graphql │ │ │ │ ├── rbac.createLeftArm.json5 │ │ │ │ ├── rbac.createLeftArm.sql │ │ │ │ ├── rbac.createLeftArm.test.graphql │ │ │ │ ├── rbac.createPerson.json5 │ │ │ │ ├── rbac.createPerson.sql │ │ │ │ ├── rbac.createPerson.test.graphql │ │ │ │ ├── rbac.deletePerson.json5 │ │ │ │ ├── rbac.deletePerson.sql │ │ │ │ ├── rbac.deletePerson.test.graphql │ │ │ │ ├── rbac.leftArmIdentity.json5 │ │ │ │ ├── rbac.leftArmIdentity.sql │ │ │ │ ├── rbac.leftArmIdentity.test.graphql │ │ │ │ ├── rbac.updateLeftArm.json5 │ │ │ │ ├── rbac.updateLeftArm.sql │ │ │ │ ├── rbac.updateLeftArm.test.graphql │ │ │ │ ├── rbac.updatePerson.json5 │ │ │ │ ├── rbac.updatePerson.sql │ │ │ │ ├── rbac.updatePerson.test.graphql │ │ │ │ ├── types.json5 │ │ │ │ ├── types.sql │ │ │ │ └── types.test.graphql │ │ ├── partitioned-data.sql │ │ ├── partitioned-schema.sql │ │ ├── pg11-data.sql │ │ ├── pg11-schema.sql │ │ ├── queries │ │ │ ├── _test.js │ │ │ ├── base │ │ │ │ ├── badlyBehavedFunction.json5 │ │ │ │ ├── badlyBehavedFunction.sql │ │ │ │ ├── badlyBehavedFunction.test.graphql │ │ │ │ ├── classic-ids.json5 │ │ │ │ ├── classic-ids.sql │ │ │ │ ├── classic-ids.test.graphql │ │ │ │ ├── connections-blankcursor.errors.json5 │ │ │ │ ├── connections-blankcursor.json5 │ │ │ │ ├── connections-blankcursor.sql │ │ │ │ ├── connections-blankcursor.test.graphql │ │ │ │ ├── connections-condition-computed-column.json5 │ │ │ │ ├── connections-condition-computed-column.sql │ │ │ │ ├── connections-condition-computed-column.test.graphql │ │ │ │ ├── connections-order-computed-column.json5 │ │ │ │ ├── connections-order-computed-column.sql │ │ │ │ ├── connections-order-computed-column.test.graphql │ │ │ │ ├── connections-totalCount.json5 │ │ │ │ ├── connections-totalCount.sql │ │ │ │ ├── connections-totalCount.test.graphql │ │ │ │ ├── connections.json5 │ │ │ │ ├── connections.sql │ │ │ │ ├── connections.test.graphql │ │ │ │ ├── d.filter.json5 │ │ │ │ ├── d.filter.sql │ │ │ │ ├── d.filter.test.graphql │ │ │ │ ├── d.order.json5 │ │ │ │ ├── d.order.sql │ │ │ │ ├── d.order.test.graphql │ │ │ │ ├── directives.json5 │ │ │ │ ├── directives.sql │ │ │ │ ├── directives.test.graphql │ │ │ │ ├── dynamic-json.condition-json-field-variable.json5 │ │ │ │ ├── dynamic-json.condition-json-field-variable.sql │ │ │ │ ├── dynamic-json.condition-json-field-variable.test.graphql │ │ │ │ ├── dynamic-json.json5 │ │ │ │ ├── dynamic-json.sql │ │ │ │ ├── dynamic-json.test.graphql │ │ │ │ ├── empty-array.json5 │ │ │ │ ├── empty-array.sql │ │ │ │ ├── empty-array.test.graphql │ │ │ │ ├── enum_tables.queries.json5 │ │ │ │ ├── enum_tables.queries.sql │ │ │ │ ├── enum_tables.queries.test.graphql │ │ │ │ ├── enum_tables.queries2.json5 │ │ │ │ ├── enum_tables.queries2.sql │ │ │ │ ├── enum_tables.queries2.test.graphql │ │ │ │ ├── function-return-types.json5 │ │ │ │ ├── function-return-types.sql │ │ │ │ ├── function-return-types.test.graphql │ │ │ │ ├── function-returning-enum.json5 │ │ │ │ ├── function-returning-enum.sql │ │ │ │ ├── function-returning-enum.test.graphql │ │ │ │ ├── geometry.queries.json5 │ │ │ │ ├── geometry.queries.sql │ │ │ │ ├── geometry.queries.test.graphql │ │ │ │ ├── json-overflow.json5 │ │ │ │ ├── json-overflow.sql │ │ │ │ ├── json-overflow.test.graphql │ │ │ │ ├── large_bigint.issue491.json5 │ │ │ │ ├── large_bigint.issue491.sql │ │ │ │ ├── large_bigint.issue491.test.graphql │ │ │ │ ├── longAliases.json5 │ │ │ │ ├── longAliases.sql │ │ │ │ ├── longAliases.test.graphql │ │ │ │ ├── named_query_builder.toys.json5 │ │ │ │ ├── named_query_builder.toys.sql │ │ │ │ ├── named_query_builder.toys.test.graphql │ │ │ │ ├── network_types.json5 │ │ │ │ ├── network_types.sql │ │ │ │ ├── network_types.test.graphql │ │ │ │ ├── node.json5 │ │ │ │ ├── node.sql │ │ │ │ ├── node.test.graphql │ │ │ │ ├── nonexistant-record-from-function.json5 │ │ │ │ ├── nonexistant-record-from-function.sql │ │ │ │ ├── nonexistant-record-from-function.test.graphql │ │ │ │ ├── one-to-one-backward.json5 │ │ │ │ ├── one-to-one-backward.sql │ │ │ │ ├── one-to-one-backward.test.graphql │ │ │ │ ├── orderByNullsLast.json5 │ │ │ │ ├── orderByNullsLast.sql │ │ │ │ ├── orderByNullsLast.test.graphql │ │ │ │ ├── partitioned.use-partitioned-children.json5 │ │ │ │ ├── partitioned.use-partitioned-children.sql │ │ │ │ ├── partitioned.use-partitioned-children.test.graphql │ │ │ │ ├── partitioned.use-partitioned-parent.json5 │ │ │ │ ├── partitioned.use-partitioned-parent.sql │ │ │ │ ├── partitioned.use-partitioned-parent.test.graphql │ │ │ │ ├── pg11.network_types.json5 │ │ │ │ ├── pg11.network_types.sql │ │ │ │ ├── pg11.network_types.test.graphql │ │ │ │ ├── pg11.types.json5 │ │ │ │ ├── pg11.types.sql │ │ │ │ ├── pg11.types.test.graphql │ │ │ │ ├── posts.json5 │ │ │ │ ├── posts.sql │ │ │ │ ├── posts.test.graphql │ │ │ │ ├── procedure-computed-fields.json5 │ │ │ │ ├── procedure-computed-fields.sql │ │ │ │ ├── procedure-computed-fields.test.graphql │ │ │ │ ├── procedure-query.json5 │ │ │ │ ├── procedure-query.sql │ │ │ │ ├── procedure-query.test.graphql │ │ │ │ ├── query.json5 │ │ │ │ ├── query.sql │ │ │ │ ├── query.test.graphql │ │ │ │ ├── rbac.basic.json5 │ │ │ │ ├── rbac.basic.sql │ │ │ │ ├── rbac.basic.test.graphql │ │ │ │ ├── relation-head-tail.json5 │ │ │ │ ├── relation-head-tail.sql │ │ │ │ ├── relation-head-tail.test.graphql │ │ │ │ ├── relation-tail-head.json5 │ │ │ │ ├── relation-tail-head.sql │ │ │ │ ├── relation-tail-head.test.graphql │ │ │ │ ├── simple-collections.json5 │ │ │ │ ├── simple-collections.sql │ │ │ │ ├── simple-collections.test.graphql │ │ │ │ ├── simple-procedure-computed-fields.json5 │ │ │ │ ├── simple-procedure-computed-fields.sql │ │ │ │ ├── simple-procedure-computed-fields.test.graphql │ │ │ │ ├── simple-procedure-query.json5 │ │ │ │ ├── simple-procedure-query.sql │ │ │ │ ├── simple-procedure-query.test.graphql │ │ │ │ ├── simple-relations-head-tail.json5 │ │ │ │ ├── simple-relations-head-tail.sql │ │ │ │ ├── simple-relations-head-tail.test.graphql │ │ │ │ ├── simple-relations-tail-head.json5 │ │ │ │ ├── simple-relations-tail-head.sql │ │ │ │ ├── simple-relations-tail-head.test.graphql │ │ │ │ ├── smart_comment_relations.houses.json5 │ │ │ │ ├── smart_comment_relations.houses.sql │ │ │ │ ├── smart_comment_relations.houses.test.graphql │ │ │ │ ├── types.json5 │ │ │ │ ├── types.sql │ │ │ │ ├── types.test.graphql │ │ │ │ ├── unique-constraints.json5 │ │ │ │ ├── unique-constraints.sql │ │ │ │ ├── unique-constraints.test.graphql │ │ │ │ ├── unique-foreign-keys.json5 │ │ │ │ ├── unique-foreign-keys.sql │ │ │ │ ├── unique-foreign-keys.test.graphql │ │ │ │ ├── view.json5 │ │ │ │ ├── view.sql │ │ │ │ └── view.test.graphql │ │ │ └── ranges │ │ │ │ ├── bigint.json5 │ │ │ │ ├── bigint.sql │ │ │ │ ├── bigint.test.graphql │ │ │ │ ├── numeric.json5 │ │ │ │ ├── numeric.sql │ │ │ │ ├── numeric.test.graphql │ │ │ │ ├── ts.json5 │ │ │ │ ├── ts.sql │ │ │ │ ├── ts.test.graphql │ │ │ │ ├── tstz.json5 │ │ │ │ ├── tstz.sql │ │ │ │ └── tstz.test.graphql │ │ ├── schemas │ │ │ ├── defaults.schema.graphql │ │ │ ├── defaults.test.js │ │ │ ├── mutation-no-fields.schema.graphql │ │ │ └── mutation-no-fields.test.js │ │ ├── transform-graphql.js │ │ └── unit │ │ │ ├── __snapshots__ │ │ │ └── read-cache.test.js.snap │ │ │ └── read-cache.test.js │ ├── jest.config.js │ ├── package.json │ ├── scripts │ │ └── test │ ├── src │ │ └── index.ts │ └── tsconfig.json └── subscriptions-lds │ ├── .gitignore │ ├── LICENSE.md │ ├── README.md │ ├── SPONSORS.md │ ├── __tests__ │ ├── helpers.ts │ ├── main.test.ts │ └── schema.sql │ ├── jest.config.js │ ├── package.json │ ├── src │ ├── PgLDSSourcePlugin.ts │ └── index.ts │ └── tsconfig.json ├── release ├── scripts ├── CHANGELOG_HEADER.md ├── ci ├── prepack-all ├── pretest └── sponsors ├── tsconfig.json └── yarn.lock /.eslintignore: -------------------------------------------------------------------------------- 1 | /_LOCAL 2 | /packages/pg-sql2/examples 3 | /packages/pg-sql2/lib 4 | /postgraphile 5 | /wal2json 6 | node_modules 7 | node7minus 8 | node8plus 9 | build-turbo 10 | examples 11 | dist 12 | CHANGELOG.md 13 | package.json 14 | lerna.json 15 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | /node_modules/conventional-changelog-core/test 3 | /node_modules/@microsoft/tsdoc-config 4 | /_LOCAL 5 | /packages/.*/index\.js\.flow 6 | /packages/.*/node8plus/.*\.flow 7 | /postgraphile 8 | /packages 9 | 10 | [include] 11 | 12 | [libs] 13 | 14 | [options] 15 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: Benjie 2 | -------------------------------------------------------------------------------- /.github/workflows/ci/docker-entrypoint-initdb.d/010-enable_wal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | echo -e 'wal_level = logical\nmax_replication_slots = 10\nmax_wal_senders = 10' >> /var/lib/postgresql/data/postgresql.conf 5 | -------------------------------------------------------------------------------- /.github/workflows/ci/docker-entrypoint-initdb.d/020-wal2json.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | # This setup script is heavily inspired by 5 | # https://github.com/debezium/docker-images/blob/master/postgres/11/Dockerfile 6 | 7 | PROTOC_VERSION=1.3 8 | WAL2JSON_COMMIT_ID=c54d89649c3fe5e0aa79c3a87493935232e962a7 9 | USE_PGXS=1 10 | export PGUSER=postgres 11 | export PGPASSWORD=postgres 12 | createuser --superuser root 13 | 14 | apt-get update 15 | apt-get install -f -y --no-install-recommends \ 16 | software-properties-common \ 17 | build-essential \ 18 | pkg-config \ 19 | git \ 20 | postgresql-server-dev-$PG_MAJOR 21 | add-apt-repository "deb http://ftp.debian.org/debian testing main contrib" 22 | apt-get update 23 | rm -rf /var/lib/apt/lists/* 24 | 25 | cd / 26 | git clone https://github.com/eulerto/wal2json -b master --single-branch 27 | cd wal2json 28 | git checkout $WAL2JSON_COMMIT_ID 29 | make 30 | make install 31 | cd .. 32 | rm -rf wal2json 33 | -------------------------------------------------------------------------------- /.github/workflows/ci/docker-entrypoint-initdb.d/030-setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | createdb graphileengine_test 5 | createdb postgraphile_test 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | /postgraphile/ 3 | /pg-omit-archived/ 4 | /pg-simplify-inflector/ 5 | /operation-hooks/ 6 | /.vscode 7 | *.tgz 8 | yarn-error.log 9 | tsconfig.tsbuildinfo 10 | .env 11 | -------------------------------------------------------------------------------- /.jest-wrapper.js: -------------------------------------------------------------------------------- 1 | module.exports = require("babel-jest").createTransformer({ 2 | rootMode: "upward", 3 | }); 4 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | /packages/pg-sql2/lib 2 | /postgraphile 3 | node_modules 4 | node7minus 5 | node8plus 6 | build-turbo 7 | examples 8 | dist 9 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | trailingComma: "es5", 3 | // TODO:v5: remove this (was added to minimize a diff) 4 | arrowParens: "avoid", 5 | }; 6 | -------------------------------------------------------------------------------- /.yarnrc: -------------------------------------------------------------------------------- 1 | workspaces-experimental true 2 | -------------------------------------------------------------------------------- /SPONSORS.md: -------------------------------------------------------------------------------- 1 | # Sponsors 2 | 3 | These individuals and companies sponsor ongoing development of projects in 4 | the Graphile ecosystem. Find out [how you can become a 5 | sponsor](https://graphile.org/sponsor/). 6 | 7 | ## Featured 8 | 9 | - The Guild 10 | - Steelhead 11 | 12 | ## Leaders 13 | 14 | - Robert Claypool 15 | - Principia Mentis 16 | - nigelrmtaylor 17 | - Trigger.dev 18 | - Axinom 19 | - Taiste 20 | - BairesDev 21 | - Cintra 22 | - Two Bit Solutions 23 | - Dimply 24 | - Ndustrial 25 | - Apollo 26 | - Beacon 27 | - deliver.media 28 | - Ravio 29 | - prodready 30 | - Locomote 31 | 32 | ## Supporters 33 | 34 | - HR-ON 35 | - stlbucket 36 | - Simon Elliott 37 | - Matt Bretl 38 | - Alvin Ali Khaled 39 | - Paul Melnikow 40 | - Keith Layne 41 | - nullachtvierzehn 42 | - Zymego 43 | - garpulon 44 | - Ether 45 | - Nate Smith 46 | - The Outbound Collective 47 | - Charlie Hadden 48 | - Vizcom 49 | - Kiron Open Higher Education 50 | - Andrew Joseph 51 | - SIED 70 - TE 70 52 | - Peter C. Romano 53 | - mateo 54 | - Dialo 55 | - kontakto-fi 56 | - Tailos, Inc. 57 | - sheilamosaik 58 | - Jody Hoon-Starr 59 | - Justin Carrus 60 | - WorkOS 61 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | "@babel/plugin-transform-modules-commonjs", 4 | "@babel/plugin-syntax-object-rest-spread", 5 | ], 6 | presets: [ 7 | [ 8 | "@babel/env", 9 | { 10 | targets: { 11 | node: "8.6", 12 | }, 13 | }, 14 | ], 15 | "@babel/flow", 16 | ], 17 | env: { 18 | test: { 19 | presets: [ 20 | [ 21 | "@babel/env", 22 | { 23 | targets: { 24 | node: "current", 25 | }, 26 | }, 27 | ], 28 | "@babel/flow", 29 | ], 30 | }, 31 | }, 32 | }; 33 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "useWorkspaces": true, 3 | "npmClient": "yarn", 4 | "packages": [ 5 | "packages/*" 6 | ], 7 | "version": "4.14.1", 8 | "command": { 9 | "publish": { 10 | "allowBranch": [ 11 | "master", 12 | "v4", 13 | "canary/*" 14 | ] 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /next2latest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Enter OTP code:" 3 | read otp 4 | export NPM_CONFIG_OTP=$otp 5 | function next2latest { 6 | echo $1 7 | npm info $1 dist-tags.latest 8 | V=$(npm info $1 dist-tags.next | xargs) 9 | npm dist-tags add $1@$V latest 10 | } 11 | next2latest pg-sql2 12 | next2latest jest-serializer-graphql-schema 13 | next2latest @graphile/lru 14 | next2latest graphql-parse-resolve-info 15 | next2latest graphile-build 16 | next2latest graphile-build-pg 17 | next2latest postgraphile-core 18 | next2latest graphile-utils 19 | next2latest @graphile/pg-pubsub 20 | next2latest @graphile/lds 21 | next2latest @graphile/subscriptions-lds 22 | next2latest postgraphile 23 | 24 | echo "DON'T FORGET - you need to push the latest tag to the v4 branch on PostGraphile for Docker to build" 25 | -------------------------------------------------------------------------------- /packages/graphile-build-pg/.gitignore: -------------------------------------------------------------------------------- 1 | node8plus 2 | node7minus 3 | -------------------------------------------------------------------------------- /packages/graphile-build-pg/.npmignore: -------------------------------------------------------------------------------- 1 | yarn.lock 2 | .npmignore 3 | -------------------------------------------------------------------------------- /packages/graphile-build-pg/LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright © `2018` Benjie Gillam 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the “Software”), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /packages/graphile-build-pg/SPONSORS.md: -------------------------------------------------------------------------------- 1 | # Sponsors 2 | 3 | These individuals and companies sponsor ongoing development of projects in 4 | the Graphile ecosystem. Find out [how you can become a 5 | sponsor](https://graphile.org/sponsor/). 6 | 7 | ## Featured 8 | 9 | - The Guild 10 | - Steelhead 11 | 12 | ## Leaders 13 | 14 | - Robert Claypool 15 | - Principia Mentis 16 | - nigelrmtaylor 17 | - Trigger.dev 18 | - Axinom 19 | - Taiste 20 | - BairesDev 21 | - Cintra 22 | - Two Bit Solutions 23 | - Dimply 24 | - Ndustrial 25 | - Apollo 26 | - Beacon 27 | - deliver.media 28 | - Ravio 29 | - prodready 30 | - Locomote 31 | 32 | ## Supporters 33 | 34 | - HR-ON 35 | - stlbucket 36 | - Simon Elliott 37 | - Matt Bretl 38 | - Alvin Ali Khaled 39 | - Paul Melnikow 40 | - Keith Layne 41 | - nullachtvierzehn 42 | - Zymego 43 | - garpulon 44 | - Ether 45 | - Nate Smith 46 | - The Outbound Collective 47 | - Charlie Hadden 48 | - Vizcom 49 | - Kiron Open Higher Education 50 | - Andrew Joseph 51 | - SIED 70 - TE 70 52 | - Peter C. Romano 53 | - mateo 54 | - Dialo 55 | - kontakto-fi 56 | - Tailos, Inc. 57 | - sheilamosaik 58 | - Jody Hoon-Starr 59 | - Justin Carrus 60 | - WorkOS 61 | -------------------------------------------------------------------------------- /packages/graphile-build-pg/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | snapshotSerializers: ["jest-serializer-graphql-schema"], 3 | transform: { 4 | "^.+\\.jsx?$": "../../.jest-wrapper.js", 5 | }, 6 | testRegex: "__tests__/.*\\.test\\.js$", 7 | }; 8 | -------------------------------------------------------------------------------- /packages/graphile-build-pg/src/PgLiveProvider.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import { LiveProvider } from "graphile-build"; 3 | import type { PgClass } from "./plugins/PgIntrospectionPlugin"; 4 | 5 | export default class PgLiveProvider extends LiveProvider { 6 | // eslint-disable-next-line flowtype/no-weak-types 7 | constructor(...args: any[]) { 8 | super(...args); 9 | this.namespace = "pg"; 10 | } 11 | 12 | collectionIdentifierIsValid(collectionIdentifier: PgClass) { 13 | return collectionIdentifier && collectionIdentifier.kind === "class"; 14 | } 15 | 16 | recordIdentifierIsValid( 17 | collectionIdentifier: PgClass, 18 | // eslint-disable-next-line flowtype/no-weak-types 19 | recordIdentifier: Array 20 | ) { 21 | if (!Array.isArray(recordIdentifier)) return false; 22 | if (!collectionIdentifier.primaryKeyConstraint) return false; 23 | if ( 24 | recordIdentifier.length !== 25 | collectionIdentifier.primaryKeyConstraint.keyAttributes.length 26 | ) { 27 | return false; 28 | } 29 | // TODO: more validation would not go amiss 30 | return true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /packages/graphile-build-pg/src/parseIdentifier.js: -------------------------------------------------------------------------------- 1 | export default function parseIdentifier(typeIdentifier) { 2 | const match = typeIdentifier.match( 3 | /^(?:([a-zA-Z0-9_]+)|"([^"]*)")\.(?:([a-zA-Z0-9_]+)|"([^"]*)")$/ 4 | ); 5 | 6 | if (!match) 7 | throw new Error( 8 | `Type identifier '${typeIdentifier}' is of the incorrect form.` 9 | ); 10 | 11 | return { 12 | namespaceName: match[1] || match[2], 13 | entityName: match[3] || match[4], 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /packages/graphile-build-pg/src/plugins/PgColumnDeprecationPlugin.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import type { Plugin } from "graphile-build"; 3 | 4 | export default (function PgColumnDeprecationPlugin(builder) { 5 | builder.hook( 6 | "GraphQLObjectType:fields:field", 7 | (field, build, context) => { 8 | const { 9 | scope: { pgFieldIntrospection }, 10 | } = context; 11 | if ( 12 | !pgFieldIntrospection || 13 | !pgFieldIntrospection.tags || 14 | !pgFieldIntrospection.tags.deprecated 15 | ) { 16 | return field; 17 | } 18 | return { 19 | ...field, 20 | deprecationReason: Array.isArray(pgFieldIntrospection.tags.deprecated) 21 | ? pgFieldIntrospection.tags.deprecated.join("\n") 22 | : pgFieldIntrospection.tags.deprecated, 23 | }; 24 | }, 25 | ["PgColumnDeprecation"] 26 | ); 27 | }: Plugin); 28 | -------------------------------------------------------------------------------- /packages/graphile-build-pg/src/plugins/PgNodeAliasPostGraphile.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import type { Plugin } from "graphile-build"; 3 | 4 | export default (async function PgNodeAliasPostGraphile(builder) { 5 | builder.hook( 6 | "GraphQLObjectType", 7 | (object, build, context) => { 8 | const { 9 | setNodeAlias, 10 | inflection: { pluralize }, 11 | } = build; 12 | if (!setNodeAlias) { 13 | // Node plugin must be disabled. 14 | return object; 15 | } 16 | const { 17 | scope: { isPgRowType, isPgCompoundType, pgIntrospection: table }, 18 | } = context; 19 | if (isPgRowType || isPgCompoundType) { 20 | setNodeAlias(object.name, pluralize(table.name)); 21 | } 22 | return object; 23 | }, 24 | ["PgNodeAliasPostGraphile"] 25 | ); 26 | }: Plugin); 27 | -------------------------------------------------------------------------------- /packages/graphile-build-pg/src/plugins/addStartEndCursor.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import type { Plugin } from "graphile-build"; 3 | const base64 = str => Buffer.from(String(str)).toString("base64"); 4 | 5 | function cursorify(val) { 6 | return val && val.__cursor ? base64(JSON.stringify(val.__cursor)) : null; 7 | } 8 | 9 | export default (function addStartEndCursor(value) { 10 | const data = value && value.data && value.data.length ? value.data : null; 11 | const startCursor = cursorify(data && data[0]); 12 | const endCursor = cursorify(data && data[value.data.length - 1]); 13 | return { 14 | ...value, 15 | startCursor, 16 | endCursor, 17 | }; 18 | }: Plugin); 19 | -------------------------------------------------------------------------------- /packages/graphile-build-pg/src/plugins/makeProcField.d.ts: -------------------------------------------------------------------------------- 1 | import { PgType, PgProc } from "./PgIntrospectionPlugin"; 2 | import { GraphQLInputType } from "graphql"; 3 | import { Build } from "graphile-build"; 4 | import { SQL } from "../QueryBuilder"; 5 | 6 | export function procFieldDetails( 7 | proc: PgProc, 8 | build: Build, 9 | options: { 10 | computed?: boolean; 11 | isMutation?: boolean; 12 | } 13 | ): { 14 | inputs: { 15 | [name: string]: { 16 | type: GraphQLInputType; 17 | description?: string; 18 | }; 19 | }; 20 | makeSqlFunctionCall: ( 21 | args: any, 22 | options: { implicitArgs?: any[]; unnest?: boolean } 23 | ) => SQL; 24 | outputArgNames: string[]; 25 | outputArgTypes: PgType[]; 26 | }; 27 | -------------------------------------------------------------------------------- /packages/graphile-build-pg/src/plugins/pgField.d.ts: -------------------------------------------------------------------------------- 1 | import { ResolveTree } from "graphql-parse-resolve-info"; 2 | import { Build, Scope } from "graphile-build"; 3 | import { SQL } from "pg-sql2"; 4 | import QueryBuilder from "../QueryBuilder"; 5 | 6 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 7 | type FieldContext = any; 8 | type FieldWithHooksFunction = any; 9 | 10 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 11 | interface PgFieldOptions { 12 | hoistCursor?: boolean; 13 | withQueryBuilder?: ( 14 | queryBuilder: QueryBuilder, 15 | args: { parsedResolveInfoFragment: ResolveTree } 16 | ) => void; 17 | } 18 | 19 | export default function pgField( 20 | build: Build, 21 | fieldWithHooks: FieldWithHooksFunction, 22 | fieldName: string, 23 | fieldSpecGenerator: T | ((fieldContext: FieldContext) => T), 24 | fieldScope: Scope, 25 | whereFrom?: false | ((queryBuilder: QueryBuilder) => SQL), 26 | options?: PgFieldOptions 27 | ): T; 28 | -------------------------------------------------------------------------------- /packages/graphile-build-pg/src/utils.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | export const parseTags = (str: string) => { 3 | return str.split(/\r?\n/).reduce( 4 | (prev, curr) => { 5 | if (prev.text !== "") { 6 | return { ...prev, text: `${prev.text}\n${curr}` }; 7 | } 8 | const match = curr.match(/^@[a-zA-Z][a-zA-Z0-9_]*($|\s)/); 9 | if (!match) { 10 | return { ...prev, text: curr }; 11 | } 12 | const key = match[0].slice(1).trim(); 13 | const value = match[0] === curr ? true : curr.replace(match[0], ""); 14 | return { 15 | ...prev, 16 | tags: { 17 | ...prev.tags, 18 | [key]: !Object.prototype.hasOwnProperty.call(prev.tags, key) 19 | ? value 20 | : Array.isArray(prev.tags[key]) 21 | ? [...prev.tags[key], value] 22 | : [prev.tags[key], value], 23 | }, 24 | }; 25 | }, 26 | { 27 | tags: {}, 28 | text: "", 29 | } 30 | ); 31 | }; 32 | -------------------------------------------------------------------------------- /packages/graphile-build/.gitignore: -------------------------------------------------------------------------------- 1 | node8plus 2 | node7minus 3 | -------------------------------------------------------------------------------- /packages/graphile-build/.npmignore: -------------------------------------------------------------------------------- 1 | __tests__ 2 | examples 3 | yarn.lock 4 | .npmignore 5 | -------------------------------------------------------------------------------- /packages/graphile-build/LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright © `2018` Benjie Gillam 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the “Software”), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /packages/graphile-build/SPONSORS.md: -------------------------------------------------------------------------------- 1 | # Sponsors 2 | 3 | These individuals and companies sponsor ongoing development of projects in 4 | the Graphile ecosystem. Find out [how you can become a 5 | sponsor](https://graphile.org/sponsor/). 6 | 7 | ## Featured 8 | 9 | - The Guild 10 | - Steelhead 11 | 12 | ## Leaders 13 | 14 | - Robert Claypool 15 | - Principia Mentis 16 | - nigelrmtaylor 17 | - Trigger.dev 18 | - Axinom 19 | - Taiste 20 | - BairesDev 21 | - Cintra 22 | - Two Bit Solutions 23 | - Dimply 24 | - Ndustrial 25 | - Apollo 26 | - Beacon 27 | - deliver.media 28 | - Ravio 29 | - prodready 30 | - Locomote 31 | 32 | ## Supporters 33 | 34 | - HR-ON 35 | - stlbucket 36 | - Simon Elliott 37 | - Matt Bretl 38 | - Alvin Ali Khaled 39 | - Paul Melnikow 40 | - Keith Layne 41 | - nullachtvierzehn 42 | - Zymego 43 | - garpulon 44 | - Ether 45 | - Nate Smith 46 | - The Outbound Collective 47 | - Charlie Hadden 48 | - Vizcom 49 | - Kiron Open Higher Education 50 | - Andrew Joseph 51 | - SIED 70 - TE 70 52 | - Peter C. Romano 53 | - mateo 54 | - Dialo 55 | - kontakto-fi 56 | - Tailos, Inc. 57 | - sheilamosaik 58 | - Jody Hoon-Starr 59 | - Justin Carrus 60 | - WorkOS 61 | -------------------------------------------------------------------------------- /packages/graphile-build/__tests__/__snapshots__/emptyMutation.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`generates empty schema (with no Mutation type) 1`] = ` 4 | """The root query type which gives access points into the data universe.""" 5 | type Query implements Node { 6 | """ 7 | Exposes the root query type nested one level down. This is helpful for Relay 1 8 | which can only query top level fields if they are in a particular form. 9 | """ 10 | query: Query! 11 | 12 | """ 13 | The root query type must be a \`Node\` to work well with Relay 1 mutations. This just resolves to \`query\`. 14 | """ 15 | id: ID! 16 | 17 | """Fetches an object given its globally unique \`ID\`.""" 18 | node( 19 | """The globally unique \`ID\`.""" 20 | id: ID! 21 | ): Node 22 | } 23 | 24 | """An object with a globally unique \`ID\`.""" 25 | interface Node { 26 | """ 27 | A globally unique identifier. Can be used in various places throughout the system to identify this single value. 28 | """ 29 | id: ID! 30 | } 31 | 32 | `; 33 | -------------------------------------------------------------------------------- /packages/graphile-build/__tests__/emptyMutation.test.js: -------------------------------------------------------------------------------- 1 | const { buildSchema, defaultPlugins } = require("../"); 2 | 3 | test("generates empty schema (with no Mutation type)", async () => { 4 | const schema = await buildSchema([...defaultPlugins]); 5 | expect(schema).toMatchSnapshot(); 6 | }); 7 | -------------------------------------------------------------------------------- /packages/graphile-build/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | snapshotSerializers: ["jest-serializer-graphql-schema"], 3 | transform: { 4 | "^.+\\.jsx?$": "../../.jest-wrapper.js", 5 | }, 6 | testRegex: "__tests__/.*\\.test\\.js$", 7 | }; 8 | -------------------------------------------------------------------------------- /packages/graphile-build/src/plugins/SwallowErrorsPlugin.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import type { Plugin, Build } from "../SchemaBuilder"; 3 | 4 | export default (function SwallowErrorsPlugin( 5 | builder, 6 | { dontSwallowErrors = false } 7 | ) { 8 | builder.hook( 9 | "build", 10 | (build: Build): Build => { 11 | if (dontSwallowErrors) { 12 | // This plugin is a bit of a misnomer - to better maintain backwards 13 | // compatibility, `swallowError` still exists on `makeNewBuild`; and 14 | // thus this plugin is really `dontSwallowErrors`. 15 | return Object.assign(build, { 16 | swallowError(e) { 17 | // $FlowFixMe 18 | e.recoverable = true; 19 | throw e; 20 | }, 21 | }); 22 | } else { 23 | return build; 24 | } 25 | }, 26 | ["SwallowErrors"] 27 | ); 28 | }: Plugin); 29 | -------------------------------------------------------------------------------- /packages/graphile-build/src/plugins/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import ClientMutationIdDescriptionPlugin from "./ClientMutationIdDescriptionPlugin"; 4 | import MutationPayloadQueryPlugin from "./MutationPayloadQueryPlugin"; 5 | import MutationPlugin from "./MutationPlugin"; 6 | import SubscriptionPlugin from "./SubscriptionPlugin"; 7 | import NodePlugin from "./NodePlugin"; 8 | import QueryPlugin from "./QueryPlugin"; 9 | import StandardTypesPlugin from "./StandardTypesPlugin"; 10 | import SwallowErrorsPlugin from "./SwallowErrorsPlugin"; 11 | import AddQueriesToSubscriptionsPlugin from "./AddQueriesToSubscriptionsPlugin"; 12 | import TrimEmptyDescriptionsPlugin from "./TrimEmptyDescriptionsPlugin"; 13 | 14 | export { 15 | ClientMutationIdDescriptionPlugin, 16 | MutationPayloadQueryPlugin, 17 | MutationPlugin, 18 | SubscriptionPlugin, 19 | NodePlugin, 20 | QueryPlugin, 21 | StandardTypesPlugin, 22 | SwallowErrorsPlugin, 23 | AddQueriesToSubscriptionsPlugin, 24 | TrimEmptyDescriptionsPlugin, 25 | }; 26 | -------------------------------------------------------------------------------- /packages/graphile-build/src/swallowError.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import debugFactory from "debug"; 3 | 4 | const debugWarn = debugFactory("graphile-build:warn"); 5 | 6 | export default function swallowError(e: Error): void { 7 | // BE VERY CAREFUL NOT TO THROW! 8 | // XXX: Improve this 9 | if (debugWarn.enabled) { 10 | // eslint-disable-next-line no-console 11 | console.warn(`Recoverable error occurred:`); 12 | debugWarn(e); 13 | } else { 14 | const errorSnippet = 15 | e && typeof e.toString === "function" 16 | ? String(e).replace(/\n.*/g, "").slice(0, 320).trim() 17 | : null; 18 | if (errorSnippet) { 19 | // eslint-disable-next-line no-console 20 | console.warn( 21 | `Recoverable error occurred; use envvar 'DEBUG="graphile-build:warn"' for full error (see: https://graphile.org/postgraphile/debugging )\n> ${errorSnippet}…` 22 | ); 23 | } else { 24 | // eslint-disable-next-line no-console 25 | console.warn( 26 | `Recoverable error occurred; use envvar 'DEBUG="graphile-build:warn"' for error (see: https://graphile.org/postgraphile/debugging )` 27 | ); 28 | } 29 | debugWarn(e); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/graphile-utils/.gitignore: -------------------------------------------------------------------------------- 1 | node8plus 2 | -------------------------------------------------------------------------------- /packages/graphile-utils/LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright © `2019` Benjie Gillam 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the “Software”), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /packages/graphile-utils/SPONSORS.md: -------------------------------------------------------------------------------- 1 | # Sponsors 2 | 3 | These individuals and companies sponsor ongoing development of projects in 4 | the Graphile ecosystem. Find out [how you can become a 5 | sponsor](https://graphile.org/sponsor/). 6 | 7 | ## Featured 8 | 9 | - The Guild 10 | - Steelhead 11 | 12 | ## Leaders 13 | 14 | - Robert Claypool 15 | - Principia Mentis 16 | - nigelrmtaylor 17 | - Trigger.dev 18 | - Axinom 19 | - Taiste 20 | - BairesDev 21 | - Cintra 22 | - Two Bit Solutions 23 | - Dimply 24 | - Ndustrial 25 | - Apollo 26 | - Beacon 27 | - deliver.media 28 | - Ravio 29 | - prodready 30 | - Locomote 31 | 32 | ## Supporters 33 | 34 | - HR-ON 35 | - stlbucket 36 | - Simon Elliott 37 | - Matt Bretl 38 | - Alvin Ali Khaled 39 | - Paul Melnikow 40 | - Keith Layne 41 | - nullachtvierzehn 42 | - Zymego 43 | - garpulon 44 | - Ether 45 | - Nate Smith 46 | - The Outbound Collective 47 | - Charlie Hadden 48 | - Vizcom 49 | - Kiron Open Higher Education 50 | - Andrew Joseph 51 | - SIED 70 - TE 70 52 | - Peter C. Romano 53 | - mateo 54 | - Dialo 55 | - kontakto-fi 56 | - Tailos, Inc. 57 | - sheilamosaik 58 | - Jody Hoon-Starr 59 | - Justin Carrus 60 | - WorkOS 61 | -------------------------------------------------------------------------------- /packages/graphile-utils/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | snapshotSerializers: ["jest-serializer-graphql-schema"], 3 | transform: { 4 | "^.+\\.jsx?$": "../../.jest-wrapper.js", 5 | }, 6 | testRegex: "__tests__/.*\\.test\\.js$", 7 | }; 8 | -------------------------------------------------------------------------------- /packages/graphile-utils/scripts/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | if [ -x ".env" ]; then 5 | set -a 6 | . ./.env 7 | set +a 8 | fi; 9 | 10 | if [ "$TEST_DATABASE_URL" == "" ]; then 11 | echo "ERROR: No test database configured; aborting" 12 | echo 13 | echo "To resolve this, ensure environmental variable TEST_DATABASE_URL is set" 14 | exit 1; 15 | fi; 16 | 17 | # Import latest schema (throw on error) 18 | psql -Xqv ON_ERROR_STOP=1 "$TEST_DATABASE_URL" < 5 | ): Plugin { 6 | return async (builder, options) => { 7 | for (const plugin of plugins) { 8 | await plugin(builder, options); 9 | } 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /packages/graphile-utils/src/makeProcessSchemaPlugin.ts: -------------------------------------------------------------------------------- 1 | import type { GraphQLSchema } from "graphql"; 2 | import type { SchemaBuilder } from "graphile-build"; 3 | 4 | type ProcessSchemaFunction = (schema: GraphQLSchema) => GraphQLSchema; 5 | export default function makeProcessSchemaPlugin( 6 | schemaCallback: ProcessSchemaFunction 7 | ) { 8 | return (builder: SchemaBuilder) => { 9 | builder.hook("finalize", schemaCallback); 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /packages/graphile-utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "declarationDir": "./node8plus", 6 | "outDir": "./node8plus" 7 | }, 8 | "include": ["src/**/*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/graphile/index.js: -------------------------------------------------------------------------------- 1 | throw new Error( 2 | "This package is a placeholder, you probably want graphile-build or postgraphile currently" 3 | ); 4 | -------------------------------------------------------------------------------- /packages/graphile/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "graphile", 3 | "version": "4.11.0", 4 | "scripts": { 5 | "watch": "sleep 1000000000", 6 | "test": "true", 7 | "prepack": "true" 8 | }, 9 | "description": "You probably want postgraphile or graphile-build", 10 | "main": "index.js", 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/graphile/graphile-engine.git" 14 | }, 15 | "author": "Benjie Gillam ", 16 | "bugs": { 17 | "url": "https://github.com/graphile/graphile-engine/issues" 18 | }, 19 | "homepage": "https://www.graphile.org", 20 | "files": [ 21 | "index.js" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /packages/graphql-parse-resolve-info/.gitignore: -------------------------------------------------------------------------------- 1 | node8plus 2 | node7minus 3 | build-turbo 4 | -------------------------------------------------------------------------------- /packages/graphql-parse-resolve-info/.npmignore: -------------------------------------------------------------------------------- 1 | yarn.lock 2 | .npmignore 3 | -------------------------------------------------------------------------------- /packages/graphql-parse-resolve-info/LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright © `2018` Benjie Gillam 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the “Software”), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /packages/graphql-parse-resolve-info/SPONSORS.md: -------------------------------------------------------------------------------- 1 | # Sponsors 2 | 3 | These individuals and companies sponsor ongoing development of projects in 4 | the Graphile ecosystem. Find out [how you can become a 5 | sponsor](https://graphile.org/sponsor/). 6 | 7 | ## Featured 8 | 9 | - The Guild 10 | - Steelhead 11 | 12 | ## Leaders 13 | 14 | - Robert Claypool 15 | - Principia Mentis 16 | - nigelrmtaylor 17 | - Trigger.dev 18 | - Axinom 19 | - Taiste 20 | - BairesDev 21 | - Cintra 22 | - Two Bit Solutions 23 | - Dimply 24 | - Ndustrial 25 | - Apollo 26 | - Beacon 27 | - deliver.media 28 | - Ravio 29 | - prodready 30 | - Locomote 31 | 32 | ## Supporters 33 | 34 | - HR-ON 35 | - stlbucket 36 | - Simon Elliott 37 | - Matt Bretl 38 | - Alvin Ali Khaled 39 | - Paul Melnikow 40 | - Keith Layne 41 | - nullachtvierzehn 42 | - Zymego 43 | - garpulon 44 | - Ether 45 | - Nate Smith 46 | - The Outbound Collective 47 | - Charlie Hadden 48 | - Vizcom 49 | - Kiron Open Higher Education 50 | - Andrew Joseph 51 | - SIED 70 - TE 70 52 | - Peter C. Romano 53 | - mateo 54 | - Dialo 55 | - kontakto-fi 56 | - Tailos, Inc. 57 | - sheilamosaik 58 | - Jody Hoon-Starr 59 | - Justin Carrus 60 | - WorkOS 61 | -------------------------------------------------------------------------------- /packages/graphql-parse-resolve-info/index.js: -------------------------------------------------------------------------------- 1 | if (process.env.GRAPHILE_TURBO === "1") { 2 | const major = parseInt(process.version.replace(/\..*$/, ""), 10); 3 | if (major < 12) { 4 | throw new Error("Turbo mode requires Node v12 or higher"); 5 | } 6 | module.exports = require("./build-turbo/index.js"); 7 | } else { 8 | module.exports = require("./node8plus/index.js"); 9 | } 10 | -------------------------------------------------------------------------------- /packages/graphql-parse-resolve-info/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | roots: ["/src", "/__tests__"], 3 | transform: { 4 | "^.+\\.tsx?$": "ts-jest", 5 | }, 6 | testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.[tj]sx?$", 7 | moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], 8 | }; 9 | -------------------------------------------------------------------------------- /packages/graphql-parse-resolve-info/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "declarationDir": "./node8plus", 6 | "outDir": "./node8plus" 7 | }, 8 | "include": ["src/**/*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/jest-serializer-graphql-schema/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /packages/jest-serializer-graphql-schema/LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright © `2019` Benjie Gillam 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the “Software”), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /packages/jest-serializer-graphql-schema/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: "ts-jest", 3 | testEnvironment: "node", 4 | }; 5 | -------------------------------------------------------------------------------- /packages/jest-serializer-graphql-schema/src/index.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLSchema, isSchema, printSchema } from "graphql"; 2 | import { NewPlugin } from "pretty-format"; 3 | 4 | const GraphQLSchemaSnapshotSerializer: NewPlugin = { 5 | test(val: any) { 6 | return isSchema(val); 7 | }, 8 | serialize(schema: GraphQLSchema) { 9 | return printSchema(schema); 10 | }, 11 | }; 12 | 13 | module.exports = GraphQLSchemaSnapshotSerializer; 14 | -------------------------------------------------------------------------------- /packages/jest-serializer-graphql-schema/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "declarationDir": "./dist", 6 | "outDir": "./dist" 7 | }, 8 | "include": ["src/**/*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/lds/.gitignore: -------------------------------------------------------------------------------- 1 | /dist/ 2 | -------------------------------------------------------------------------------- /packages/lds/LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright © `2019` Benjie Gillam 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the “Software”), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /packages/lds/SPONSORS.md: -------------------------------------------------------------------------------- 1 | # Sponsors 2 | 3 | These individuals and companies sponsor ongoing development of projects in 4 | the Graphile ecosystem. Find out [how you can become a 5 | sponsor](https://graphile.org/sponsor/). 6 | 7 | ## Featured 8 | 9 | - The Guild 10 | - Steelhead 11 | 12 | ## Leaders 13 | 14 | - Robert Claypool 15 | - Principia Mentis 16 | - nigelrmtaylor 17 | - Trigger.dev 18 | - Axinom 19 | - Taiste 20 | - BairesDev 21 | - Cintra 22 | - Two Bit Solutions 23 | - Dimply 24 | - Ndustrial 25 | - Apollo 26 | - Beacon 27 | - deliver.media 28 | - Ravio 29 | - prodready 30 | - Locomote 31 | 32 | ## Supporters 33 | 34 | - HR-ON 35 | - stlbucket 36 | - Simon Elliott 37 | - Matt Bretl 38 | - Alvin Ali Khaled 39 | - Paul Melnikow 40 | - Keith Layne 41 | - nullachtvierzehn 42 | - Zymego 43 | - garpulon 44 | - Ether 45 | - Nate Smith 46 | - The Outbound Collective 47 | - Charlie Hadden 48 | - Vizcom 49 | - Kiron Open Higher Education 50 | - Andrew Joseph 51 | - SIED 70 - TE 70 52 | - Peter C. Romano 53 | - mateo 54 | - Dialo 55 | - kontakto-fi 56 | - Tailos, Inc. 57 | - sheilamosaik 58 | - Jody Hoon-Starr 59 | - Justin Carrus 60 | - WorkOS 61 | -------------------------------------------------------------------------------- /packages/lds/__tests__/drop_replication_slot.sql: -------------------------------------------------------------------------------- 1 | DO $$ 2 | BEGIN 3 | if current_setting('wal_level') is distinct from 'logical' then 4 | raise exception 'wal_level must be set to ''logical'', your database has it set to ''%''. Please edit your `%` file and restart PostgreSQL.', current_setting('wal_level'), current_setting('config_file'); 5 | end if; 6 | if (current_setting('max_replication_slots')::int >= 1) is not true then 7 | raise exception 'Your max_replication_slots setting is too low, it must be greater than 1. Please edit your `%` file and restart PostgreSQL.', current_setting('config_file'); 8 | end if; 9 | if (current_setting('max_wal_senders')::int >= 1) is not true then 10 | raise exception 'Your max_wal_senders setting is too low, it must be greater than 1. Please edit your `%` file and restart PostgreSQL.', current_setting('config_file'); 11 | end if; 12 | 13 | PERFORM pg_drop_replication_slot('postgraphile'); 14 | EXCEPTION 15 | WHEN undefined_object THEN 16 | -- NO ACTION 17 | PERFORM 1; 18 | END; 19 | $$ language plpgsql; 20 | 21 | 22 | -------------------------------------------------------------------------------- /packages/lds/__tests__/test.sql: -------------------------------------------------------------------------------- 1 | set search_path to app_public, public; 2 | 3 | update foo set name = 'David' where id = 4; 4 | select pg_sleep(3); 5 | insert into bar (foo_id, name) values (6, 'Francine''s dog'); 6 | select pg_sleep(3); 7 | insert into bar (foo_id, name) values (6, 'Francine''s handbag'); 8 | select pg_sleep(3); 9 | insert into foo (name) values ('George'); 10 | 11 | -------------------------------------------------------------------------------- /packages/lds/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | roots: ["/src", "/__tests__"], 3 | transform: { 4 | "^.+\\.tsx?$": "ts-jest", 5 | }, 6 | testRegex: "(/__tests__/.*\\.(test|spec))\\.[tj]sx?$", 7 | moduleFileExtensions: ["ts", "js", "json"], 8 | }; 9 | -------------------------------------------------------------------------------- /packages/lds/src/fatal-error.ts: -------------------------------------------------------------------------------- 1 | export default class FatalError extends Error { 2 | public fatal = true; 3 | public originalError?: Error; 4 | 5 | constructor(message: string, originalError?: Error) { 6 | super(message); 7 | Object.setPrototypeOf(this, new.target.prototype); 8 | this.originalError = originalError; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/lds/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "declarationDir": "./dist", 6 | "outDir": "./dist" 7 | }, 8 | "include": ["src/**/*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/lru/.gitignore: -------------------------------------------------------------------------------- 1 | node8plus 2 | -------------------------------------------------------------------------------- /packages/lru/LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright © `2019` Benjie Gillam 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the “Software”), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /packages/lru/README.md: -------------------------------------------------------------------------------- 1 | # @graphile/lru 2 | 3 | You probably want [lru-cache](https://github.com/isaacs/node-lru-cache) instead. 4 | -------------------------------------------------------------------------------- /packages/lru/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | transform: { 3 | "^.+\\.jsx?$": "../../.jest-wrapper.js", 4 | }, 5 | testRegex: "__tests__/.*\\.test\\.js$", 6 | }; 7 | -------------------------------------------------------------------------------- /packages/lru/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@graphile/lru", 3 | "version": "4.11.0", 4 | "description": "Extremely simple zero-dependencies ES6 LRU (you probably want lru-cache instead)", 5 | "main": "node8plus/index.js", 6 | "types": "node8plus/index.d.ts", 7 | "scripts": { 8 | "test": "jest", 9 | "prepack": "mkdir -p node8plus && tsc", 10 | "watch": "mkdir -p node8plus && tsc --watch" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/graphile/graphile-engine.git" 15 | }, 16 | "keywords": [ 17 | "lru" 18 | ], 19 | "author": "Benjie Gillam ", 20 | "license": "MIT", 21 | "bugs": { 22 | "url": "https://github.com/graphile/graphile-engine/issues" 23 | }, 24 | "homepage": "https://github.com/graphile/graphile-engine/tree/master/packages/lru", 25 | "engines": { 26 | "node": ">=8.6" 27 | }, 28 | "devDependencies": { 29 | "jest": "25.x", 30 | "ts-node": "^9.0.0", 31 | "typescript": "^4.0.2" 32 | }, 33 | "files": [ 34 | "node8plus" 35 | ], 36 | "dependencies": { 37 | "tslib": "^2.0.1" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/lru/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "declarationDir": "./node8plus", 6 | "outDir": "./node8plus" 7 | }, 8 | "include": ["src/**/*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/pg-pubsub/.gitignore: -------------------------------------------------------------------------------- 1 | /dist/ 2 | -------------------------------------------------------------------------------- /packages/pg-pubsub/LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright © `2019` Benjie Gillam 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the “Software”), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /packages/pg-pubsub/SPONSORS.md: -------------------------------------------------------------------------------- 1 | # Sponsors 2 | 3 | These individuals and companies sponsor ongoing development of projects in 4 | the Graphile ecosystem. Find out [how you can become a 5 | sponsor](https://graphile.org/sponsor/). 6 | 7 | ## Featured 8 | 9 | - The Guild 10 | - Steelhead 11 | 12 | ## Leaders 13 | 14 | - Robert Claypool 15 | - Principia Mentis 16 | - nigelrmtaylor 17 | - Trigger.dev 18 | - Axinom 19 | - Taiste 20 | - BairesDev 21 | - Cintra 22 | - Two Bit Solutions 23 | - Dimply 24 | - Ndustrial 25 | - Apollo 26 | - Beacon 27 | - deliver.media 28 | - Ravio 29 | - prodready 30 | - Locomote 31 | 32 | ## Supporters 33 | 34 | - HR-ON 35 | - stlbucket 36 | - Simon Elliott 37 | - Matt Bretl 38 | - Alvin Ali Khaled 39 | - Paul Melnikow 40 | - Keith Layne 41 | - nullachtvierzehn 42 | - Zymego 43 | - garpulon 44 | - Ether 45 | - Nate Smith 46 | - The Outbound Collective 47 | - Charlie Hadden 48 | - Vizcom 49 | - Kiron Open Higher Education 50 | - Andrew Joseph 51 | - SIED 70 - TE 70 52 | - Peter C. Romano 53 | - mateo 54 | - Dialo 55 | - kontakto-fi 56 | - Tailos, Inc. 57 | - sheilamosaik 58 | - Jody Hoon-Starr 59 | - Justin Carrus 60 | - WorkOS 61 | -------------------------------------------------------------------------------- /packages/pg-pubsub/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: "ts-jest", 3 | testEnvironment: "node", 4 | snapshotSerializers: ["jest-serializer-graphql-schema"], 5 | testRegex: "(/__tests__/.*\\.(test|spec))\\.[tj]sx?$", 6 | }; 7 | -------------------------------------------------------------------------------- /packages/pg-pubsub/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "declarationDir": "./dist", 6 | "outDir": "./dist" 7 | }, 8 | "include": ["src/**/*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/pg-sql2/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | node8plus 3 | __tests__ 4 | examples 5 | -------------------------------------------------------------------------------- /packages/pg-sql2/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | /node_modules/conventional-changelog-core/test 3 | 4 | [include] 5 | 6 | [libs] 7 | 8 | [options] 9 | -------------------------------------------------------------------------------- /packages/pg-sql2/.gitignore: -------------------------------------------------------------------------------- 1 | node8plus 2 | node_modules 3 | -------------------------------------------------------------------------------- /packages/pg-sql2/.markdown-doctest-setup.js: -------------------------------------------------------------------------------- 1 | const sql = require("."); 2 | module.exports = { 3 | require: { 4 | "pg-sql2": sql, 5 | }, 6 | globals: { 7 | sql, 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/pg-sql2/.npmignore: -------------------------------------------------------------------------------- 1 | yarn.lock 2 | .markdown-doctest-setup.js 3 | examples 4 | .npmignore 5 | -------------------------------------------------------------------------------- /packages/pg-sql2/LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright © `2019` Benjie Gillam 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the “Software”), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /packages/pg-sql2/SPONSORS.md: -------------------------------------------------------------------------------- 1 | # Sponsors 2 | 3 | These individuals and companies sponsor ongoing development of projects in 4 | the Graphile ecosystem. Find out [how you can become a 5 | sponsor](https://graphile.org/sponsor/). 6 | 7 | ## Featured 8 | 9 | - The Guild 10 | - Steelhead 11 | 12 | ## Leaders 13 | 14 | - Robert Claypool 15 | - Principia Mentis 16 | - nigelrmtaylor 17 | - Trigger.dev 18 | - Axinom 19 | - Taiste 20 | - BairesDev 21 | - Cintra 22 | - Two Bit Solutions 23 | - Dimply 24 | - Ndustrial 25 | - Apollo 26 | - Beacon 27 | - deliver.media 28 | - Ravio 29 | - prodready 30 | - Locomote 31 | 32 | ## Supporters 33 | 34 | - HR-ON 35 | - stlbucket 36 | - Simon Elliott 37 | - Matt Bretl 38 | - Alvin Ali Khaled 39 | - Paul Melnikow 40 | - Keith Layne 41 | - nullachtvierzehn 42 | - Zymego 43 | - garpulon 44 | - Ether 45 | - Nate Smith 46 | - The Outbound Collective 47 | - Charlie Hadden 48 | - Vizcom 49 | - Kiron Open Higher Education 50 | - Andrew Joseph 51 | - SIED 70 - TE 70 52 | - Peter C. Romano 53 | - mateo 54 | - Dialo 55 | - kontakto-fi 56 | - Tailos, Inc. 57 | - sheilamosaik 58 | - Jody Hoon-Starr 59 | - Justin Carrus 60 | - WorkOS 61 | -------------------------------------------------------------------------------- /packages/pg-sql2/__tests__/__snapshots__/general.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`sqli including a join 1`] = `"Expected SQL item, instead received '3'."`; 4 | 5 | exports[`sqli subbing an object of similar layout 1`] = `"Expected SQL item, instead received '[object Object]'."`; 6 | -------------------------------------------------------------------------------- /packages/pg-sql2/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | roots: ["/src", "/__tests__"], 3 | transform: { 4 | "^.+\\.tsx?$": "ts-jest", 5 | }, 6 | testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.[tj]sx?$", 7 | moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], 8 | }; 9 | -------------------------------------------------------------------------------- /packages/pg-sql2/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "declarationDir": "./node8plus", 6 | "outDir": "./node8plus" 7 | }, 8 | "include": ["src/**/*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/.gitignore: -------------------------------------------------------------------------------- 1 | node8plus 2 | node7minus 3 | -------------------------------------------------------------------------------- /packages/postgraphile-core/.npmignore: -------------------------------------------------------------------------------- 1 | examples 2 | yarn.lock 3 | __tests__ 4 | scripts 5 | .npmignore 6 | -------------------------------------------------------------------------------- /packages/postgraphile-core/LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright © `2018` Benjie Gillam 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the “Software”), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /packages/postgraphile-core/SPONSORS.md: -------------------------------------------------------------------------------- 1 | # Sponsors 2 | 3 | These individuals and companies sponsor ongoing development of projects in 4 | the Graphile ecosystem. Find out [how you can become a 5 | sponsor](https://graphile.org/sponsor/). 6 | 7 | ## Featured 8 | 9 | - The Guild 10 | - Steelhead 11 | 12 | ## Leaders 13 | 14 | - Robert Claypool 15 | - Principia Mentis 16 | - nigelrmtaylor 17 | - Trigger.dev 18 | - Axinom 19 | - Taiste 20 | - BairesDev 21 | - Cintra 22 | - Two Bit Solutions 23 | - Dimply 24 | - Ndustrial 25 | - Apollo 26 | - Beacon 27 | - deliver.media 28 | - Ravio 29 | - prodready 30 | - Locomote 31 | 32 | ## Supporters 33 | 34 | - HR-ON 35 | - stlbucket 36 | - Simon Elliott 37 | - Matt Bretl 38 | - Alvin Ali Khaled 39 | - Paul Melnikow 40 | - Keith Layne 41 | - nullachtvierzehn 42 | - Zymego 43 | - garpulon 44 | - Ether 45 | - Nate Smith 46 | - The Outbound Collective 47 | - Charlie Hadden 48 | - Vizcom 49 | - Kiron Open Higher Education 50 | - Andrew Joseph 51 | - SIED 70 - TE 70 52 | - Peter C. Romano 53 | - mateo 54 | - Dialo 55 | - kontakto-fi 56 | - Tailos, Inc. 57 | - sheilamosaik 58 | - Jody Hoon-Starr 59 | - Justin Carrus 60 | - WorkOS 61 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/d.createPerson.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | createPerson(input:{ 3 | person:{ 4 | lastName:"Doe" 5 | colNoOrder:"create1" 6 | colNoUpdate:"create2" 7 | colNoFilter:"create3" 8 | } 9 | }) { 10 | person{ 11 | id 12 | firstName 13 | lastName 14 | colNoCreate 15 | colNoUpdate 16 | colNoOrder 17 | colNoFilter 18 | colNoCreateUpdate 19 | colNoCreateUpdateOrderFilter 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/d.deletePerson.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | deletePersonById(input:{ 3 | id: 1 4 | }) { 5 | person{ 6 | id 7 | firstName 8 | lastName 9 | colNoCreate 10 | colNoUpdate 11 | colNoOrder 12 | colNoFilter 13 | colNoCreateUpdate 14 | colNoCreateUpdateOrderFilter 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/d.updatePerson.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | updatePersonById(input:{ 3 | id:1 4 | personPatch:{ 5 | lastName:"Doe" 6 | colNoOrder:"update1" 7 | colNoCreate:"update2" 8 | colNoFilter:"update3" 9 | } 10 | }) { 11 | person{ 12 | id 13 | firstName 14 | lastName 15 | colNoCreate 16 | colNoUpdate 17 | colNoOrder 18 | colNoFilter 19 | colNoCreateUpdate 20 | colNoCreateUpdateOrderFilter 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/enum_tables.mutations.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | deleteLetterDescriptionByLetter(input: { letter: C }) { 3 | letterDescription { 4 | id 5 | letter 6 | letterViaView 7 | } 8 | } 9 | createLetterDescription( 10 | input: { 11 | letterDescription: { 12 | letter: C 13 | letterViaView: C 14 | description: "One does like to see the letter C" 15 | } 16 | } 17 | ) { 18 | letterDescription { 19 | id 20 | letter 21 | letterViaView 22 | description 23 | } 24 | } 25 | 26 | referencingTableMutation(input: { t: { enum1: A1, enum2: B2, enum3: C4 } }) { 27 | integer 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/enum_tables.mutations2.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | createReferencingTable( 3 | input: { referencingTable: { enum1: A3, enum2: B4 } } 4 | ) { 5 | referencingTable { 6 | id 7 | enum1 8 | enum2 9 | enum3 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/inheritence.createUserFile.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | createUser(input: { 3 | user: { 4 | id: 1 5 | name: "Bobby Tables" 6 | } 7 | }) { 8 | user { 9 | nodeId 10 | id 11 | name 12 | } 13 | } 14 | createUserFile(input: {userFile: {filename: "foo.txt", userId: 1}}) { 15 | userFile { 16 | id 17 | filename 18 | userByUserId { 19 | id 20 | name 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/mutation-delete-error.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | deleteTypeById(input: { id: 11 }) { 3 | clientMutationId 4 | deletedTypeId 5 | type { 6 | nodeId 7 | id 8 | } 9 | query { 10 | nodeId 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/network_types.createNetwork.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | createNetwork(input: { 3 | network: { 4 | inet: "10.0.0.0" 5 | cidr: "10.0.0.0/8" 6 | macaddr: "000000000000" 7 | } 8 | }) { 9 | network { 10 | nodeId 11 | id 12 | inet 13 | cidr 14 | macaddr 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/pg11.identity.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | a: createAlwaysAsIdentity(input:{ 3 | alwaysAsIdentity: { 4 | t: "test" 5 | } 6 | }) { 7 | alwaysAsIdentity { 8 | id 9 | t 10 | } 11 | } 12 | b: createByDefaultAsIdentity(input:{ 13 | byDefaultAsIdentity: { 14 | t: "test" 15 | } 16 | }) { 17 | byDefaultAsIdentity { 18 | id 19 | t 20 | } 21 | } 22 | c: createByDefaultAsIdentity(input:{ 23 | byDefaultAsIdentity: { 24 | id: 100 25 | t: "test" 26 | } 27 | }) { 28 | byDefaultAsIdentity { 29 | id 30 | t 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/pg11.network_types.createNetwork.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | createNetwork(input: { 3 | network: { 4 | inet: "10.0.0.0" 5 | cidr: "10.0.0.0/8" 6 | macaddr: "000000000000" 7 | macaddr8: "0000000000000000" 8 | } 9 | }) { 10 | network { 11 | nodeId 12 | id 13 | inet 14 | cidr 15 | macaddr 16 | macaddr8 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/rbac.createLeftArm.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | createLeftArm(input:{ 3 | leftArm:{ 4 | lengthInMetres: 0.66 5 | } 6 | }) { 7 | leftArm { 8 | nodeId 9 | id 10 | personId 11 | lengthInMetres 12 | mood 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/rbac.createPerson.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | createPerson(input:{ 3 | person:{ 4 | name:"Jane Doe" 5 | aliases: ["Jay Doe", "JD"] 6 | about: "Unknown" 7 | email: "jane.doe@example.com" 8 | site: { 9 | url: "http://example.com" 10 | } 11 | } 12 | }) { 13 | person{ 14 | id 15 | name 16 | aliases 17 | about 18 | email 19 | site { 20 | url 21 | } 22 | #createdAt # Can't include - it changes 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/rbac.deletePerson.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | deletePersonById(input:{ 3 | id: 3 4 | }) { 5 | deletedPersonId 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/rbac.leftArmIdentity.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | leftArmIdentity(input:{ 3 | leftArm:{ 4 | # Note we can specify all the fields here because it uses the base type 5 | id: 9001 # it's over 9000! 6 | personId: 99 7 | lengthInMetres: 77 8 | mood: "jubilant" 9 | } 10 | }) { 11 | leftArm { 12 | nodeId 13 | id 14 | personId 15 | lengthInMetres 16 | mood 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/rbac.updateLeftArm.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | updateLeftArmById(input:{ 3 | id: 47 4 | leftArmPatch:{ 5 | mood: "jovial" 6 | } 7 | }) { 8 | leftArm { 9 | nodeId 10 | id 11 | personId 12 | lengthInMetres 13 | mood 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/mutations/rbac.updatePerson.graphql: -------------------------------------------------------------------------------- 1 | mutation { 2 | updatePersonById(input:{ 3 | id: 3 4 | personPatch:{ 5 | name:"Budd Daay" 6 | aliases: ["BD", "Buddy"] 7 | about: null 8 | email: "buddy@example.com" 9 | site: { 10 | url: "http://buddy.com" 11 | } 12 | } 13 | }) { 14 | person{ 15 | id 16 | name 17 | aliases 18 | about 19 | email 20 | site { 21 | url 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/badlyBehavedFunction.graphql: -------------------------------------------------------------------------------- 1 | { 2 | badlyBehavedFunction { 3 | nodes { 4 | ...PersonFragment 5 | } 6 | edges { 7 | cursor 8 | node { 9 | ...PersonFragment 10 | } 11 | } 12 | } 13 | } 14 | 15 | fragment PersonFragment on Person { 16 | nodeId 17 | id 18 | firstName 19 | } 20 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/classic-ids.graphql: -------------------------------------------------------------------------------- 1 | { 2 | allPosts(condition: { rowId: 1 }) { 3 | nodes { 4 | id 5 | rowId 6 | headline 7 | } 8 | } 9 | allEdgeCases(condition: { rowId: 2 }) { 10 | nodes { 11 | rowId 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/connections-blankcursor.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | blankCursor: allPeople(first: 2, after: "") { ...personConnection } 3 | invalidCursor: allPeople(first: 2, after: "27") { ...personConnection } 4 | } 5 | 6 | fragment personConnection on PeopleConnection { 7 | pageInfo { 8 | startCursor 9 | endCursor 10 | hasNextPage 11 | hasPreviousPage 12 | } 13 | totalCount 14 | edges { 15 | cursor 16 | node { 17 | id 18 | name 19 | email 20 | config 21 | lastLoginFromIp 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/connections-condition-computed-column.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | allPeople(condition: { 3 | computedOut: "o1 Budd Deey" 4 | }) { 5 | nodes { 6 | id 7 | name 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/connections-order-computed-column.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | asc: allPeople(orderBy: [COMPUTED_OUT_ASC]) { 3 | nodes { 4 | id 5 | name 6 | } 7 | } 8 | desc: allPeople(orderBy: [COMPUTED_OUT_DESC]) { 9 | nodes { 10 | id 11 | name 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/connections-totalCount.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | a: allPeople { 3 | totalCount 4 | } 5 | b: allPeople { 6 | nodes { 7 | friends { 8 | totalCount 9 | } 10 | } 11 | } 12 | c: tableSetQuery { 13 | totalCount 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/d.filter.graphql: -------------------------------------------------------------------------------- 1 | { 2 | allPeople(condition:{colNoCreate:"col_no_create1"}) { 3 | nodes { 4 | id 5 | firstName 6 | lastName 7 | colNoCreate 8 | colNoUpdate 9 | colNoOrder 10 | colNoFilter 11 | colNoCreateUpdate 12 | colNoCreateUpdateOrderFilter 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/d.order.graphql: -------------------------------------------------------------------------------- 1 | { 2 | allPeople(orderBy: COL_NO_CREATE_UPDATE_DESC) { 3 | nodes { 4 | id 5 | firstName 6 | lastName 7 | colNoCreate 8 | colNoUpdate 9 | colNoOrder 10 | colNoFilter 11 | colNoCreateUpdate 12 | colNoCreateUpdateOrderFilter 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/directives.graphql: -------------------------------------------------------------------------------- 1 | query TestDirectives($true: Boolean = true, $false: Boolean = false) { 2 | a: nodeId @include(if: $true) 3 | b: nodeId @include(if: $false) 4 | c: nodeId @skip(if: $true) 5 | d: nodeId @skip(if: $false) 6 | } 7 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/dynamic-json.condition-json-field-variable.graphql: -------------------------------------------------------------------------------- 1 | query myQuery($myVal: String = "test", $myVal2: JSON = {stringField: "test"}) { 2 | # All three of these should result in the same value 3 | a: allMyTables(condition: {jsonData: {stringField: $myVal}}) { 4 | nodes { 5 | id 6 | jsonData 7 | } 8 | } 9 | b: allMyTables(condition: {jsonData: {stringField: "test"}}) { 10 | nodes { 11 | id 12 | jsonData 13 | } 14 | } 15 | c: allMyTables(condition: {jsonData: $myVal2}) { 16 | nodes { 17 | id 18 | jsonData 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/dynamic-json.graphql: -------------------------------------------------------------------------------- 1 | # This test file is configured with `dynamicJSON` set to `true`. This is a 2 | # special case. Every other file has `dynamicJSON` set to `false`. 3 | 4 | query { 5 | a: jsonIdentity(json: true) 6 | b: jsonIdentity(json: false) 7 | c: jsonIdentity(json: 42) 8 | d: jsonIdentity(json: 3.1415) 9 | e: jsonIdentity(json: "hello, world!") 10 | f: jsonIdentity(json: { a: 1, b: 2, c: 3 }) 11 | g: jsonIdentity(json: [1, 2, 3, 4]) 12 | h: jsonIdentity(json: { boolean: true, integer: 42, float: 3.1415, object: { a: 1, b: 2, c: 3 }, array: [1, 2, 3, 4] }) 13 | i: jsonIdentity(json: [true, 42, 3.1415, { a: 1, b: 2, c: 3 }, [1, 2, 3, 4]]) 14 | j: jsonIdentity(json: [true, null, 42, 3.1415, { a: 1, b: null, c: 3 }, [1, 2, null, 3, 4]]) 15 | k: jsonbIdentity(json: { a: 1, b: 2, c: 3 }) 16 | l: jsonbIdentity(json: [true, 42, 3.1415, { a: 1, b: 2, c: 3 }, [1, 2, 3, 4]]) 17 | allTypes { 18 | nodes { 19 | json 20 | jsonb 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/empty-array.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | allPeople(first: 1) { 3 | nodes { 4 | id 5 | name 6 | aliases 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/enum_tables.queries2.graphql: -------------------------------------------------------------------------------- 1 | { 2 | all: allReferencingTables { 3 | nodes { 4 | id 5 | enum1 6 | enum2 7 | enum3 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/geometry.queries.graphql: -------------------------------------------------------------------------------- 1 | { 2 | allGeoms { 3 | nodes { 4 | id 5 | point { 6 | x 7 | y 8 | } 9 | line { 10 | a { 11 | x 12 | y 13 | } 14 | b { 15 | x 16 | y 17 | } 18 | } 19 | lseg { 20 | a { 21 | x 22 | y 23 | } 24 | b { 25 | x 26 | y 27 | } 28 | } 29 | box { 30 | a { 31 | x 32 | y 33 | } 34 | b { 35 | x 36 | y 37 | } 38 | } 39 | openPath { 40 | isOpen 41 | points { 42 | x 43 | y 44 | } 45 | } 46 | closedPath { 47 | isOpen 48 | points { 49 | x 50 | y 51 | } 52 | } 53 | polygon { 54 | points { 55 | x 56 | y 57 | } 58 | } 59 | circle { 60 | center { 61 | x 62 | y 63 | } 64 | radius 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/large_bigint.issue491.graphql: -------------------------------------------------------------------------------- 1 | { 2 | allLargeNodeIds { 3 | nodes { 4 | nodeId 5 | id 6 | text 7 | } 8 | } 9 | safeInt: largeNodeId(nodeId: "WyJsYXJnZV9ub2RlX2lkcyIsOTAwNzE5OTI1NDc0MDk5MF0=") { 10 | nodeId 11 | id 12 | text 13 | } 14 | largeInt: largeNodeId(nodeId: "WyJsYXJnZV9ub2RlX2lkcyIsIjIwOTgyODg2NjkyMTg1NzE3NjAiXQ==") { 15 | nodeId 16 | id 17 | text 18 | } 19 | } -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/longAliases.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | person: personByEmail(email: "sara.smith@email.com") { 3 | nodeId 4 | email 5 | 6 | # safe alias: @@25fa9871b4d4d16ffd41359c88e7e851739819c6 7 | aVeryLongAliasInOrderToTestThatThingsGoThroughPostgresJustFineAndWeDontGetAnyIssuesDueToAliasLength: friends { 8 | totalCount 9 | } 10 | 11 | # safe alias: @@e82261e340b3c5fc784bd0d54ec53541f5a4e2fe 12 | anotherLongAliasInOrderToTestThatThingsGoThroughPostgresJustFineAndWeDontGetAnyIssuesDueToAliasLength: friends { 13 | totalCount 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/named_query_builder.toys.graphql: -------------------------------------------------------------------------------- 1 | { 2 | t1: toyById(id: 1) { 3 | categories { 4 | name 5 | } 6 | } 7 | t2: toyById(id: 1) { 8 | categories(approved: true) { 9 | name 10 | } 11 | } 12 | t3: toyById(id: 1) { 13 | categories(approved: false) { 14 | name 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/network_types.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | inetTest: allNetworks(condition: { inet: "192.168.0.0" }) { ...networkConnection } 3 | cidrTest: allNetworks(condition: { cidr: "192.168.0.0/16" }) { ...networkConnection } 4 | macaddrTest: allNetworks(condition: { macaddr: "08:00:2b:01:02:03" }) { ...networkConnection } 5 | } 6 | 7 | fragment networkConnection on NetworksConnection { 8 | pageInfo { 9 | startCursor 10 | endCursor 11 | hasNextPage 12 | hasPreviousPage 13 | } 14 | totalCount 15 | edges { 16 | cursor 17 | node { 18 | id 19 | inet 20 | cidr 21 | macaddr 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/nonexistant-record-from-function.graphql: -------------------------------------------------------------------------------- 1 | { 2 | tableQuery(id: 13373475) { 3 | id 4 | headline 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/one-to-one-backward.graphql: -------------------------------------------------------------------------------- 1 | { 2 | allPeople { 3 | edges { 4 | cursor 5 | node { 6 | ...PersonDetails 7 | leftArm: leftArmByPersonId { 8 | nodeId 9 | id 10 | personId 11 | personByPersonId { 12 | ...PersonDetails 13 | } 14 | lengthInMetres 15 | } 16 | secret: personSecretByPersonId { 17 | nodeId 18 | personId 19 | personByPersonId { 20 | ...PersonDetails 21 | } 22 | secret 23 | } 24 | } 25 | } 26 | } 27 | } 28 | 29 | fragment PersonDetails on Person { 30 | id 31 | name 32 | firstName 33 | } 34 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/orderByNullsLast.graphql: -------------------------------------------------------------------------------- 1 | { 2 | asc: allSimilarTable1S(orderBy: COL2_ASC) { 3 | nodes { 4 | nodeId 5 | col2 6 | } 7 | } 8 | desc: allSimilarTable1S(orderBy: COL2_DESC) { 9 | nodes { 10 | nodeId 11 | col2 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/pg11.network_types.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | inetTest: allNetworks(condition: { inet: "192.168.0.0" }) { ...networkConnection } 3 | cidrTest: allNetworks(condition: { cidr: "192.168.0.0/16" }) { ...networkConnection } 4 | macaddrTest: allNetworks(condition: { macaddr: "08:00:2b:01:02:03" }) { ...networkConnection } 5 | macaddr8Test: allNetworks(condition: { macaddr8: "08:00:2b:01:02:03:04:05" }) { ...networkConnection } 6 | } 7 | 8 | fragment networkConnection on NetworksConnection { 9 | pageInfo { 10 | startCursor 11 | endCursor 12 | hasNextPage 13 | hasPreviousPage 14 | } 15 | totalCount 16 | edges { 17 | cursor 18 | node { 19 | id 20 | inet 21 | cidr 22 | macaddr 23 | macaddr8 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/pg11.types.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | allTypes { 3 | ...typesConnection 4 | } 5 | } 6 | 7 | fragment type on Type { 8 | id 9 | regrole 10 | regnamespace 11 | bigintDomainArrayDomain 12 | domainConstrainedCompoundType { 13 | ...domainConstrainedCompoundType 14 | } 15 | } 16 | 17 | fragment domainConstrainedCompoundType on DomainConstrainedCompoundType { 18 | a 19 | b 20 | c 21 | d 22 | e 23 | f 24 | fooBar 25 | } 26 | 27 | fragment typesConnection on TypesConnection { 28 | nodes { 29 | ...type 30 | } 31 | edges { 32 | node { 33 | ...type 34 | } 35 | } 36 | totalCount 37 | pageInfo { 38 | hasNextPage 39 | hasPreviousPage 40 | startCursor 41 | endCursor 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/posts.graphql: -------------------------------------------------------------------------------- 1 | { 2 | allPosts { 3 | edges { 4 | cursor 5 | node { 6 | ...PostDetails 7 | author: personByAuthorId { 8 | firstPost { 9 | ...PostDetails 10 | } 11 | friends { 12 | nodes { 13 | ...PersonDetails 14 | } 15 | totalCount 16 | pageInfo { 17 | startCursor 18 | } 19 | } 20 | } 21 | } 22 | } 23 | } 24 | } 25 | 26 | fragment PersonDetails on Person { 27 | id 28 | name 29 | firstName 30 | } 31 | 32 | fragment PostDetails on Post { 33 | id 34 | headline 35 | headlineTrimmed 36 | author: personByAuthorId { 37 | ...PersonDetails 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/query.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | ...query 3 | query { 4 | ...query 5 | query { 6 | ...query 7 | query { 8 | ...query 9 | } 10 | } 11 | } 12 | a: node(nodeId: "hello") { 13 | __typename 14 | nodeId 15 | ...query 16 | } 17 | b: node(nodeId: "query") { 18 | __typename 19 | nodeId 20 | ...query 21 | } 22 | } 23 | 24 | fragment query on Query { 25 | nodeId 26 | a: node(nodeId: "hello") { 27 | __typename 28 | nodeId 29 | } 30 | b: node(nodeId: "query") { 31 | __typename 32 | nodeId 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/rbac.basic.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | personSecretByPersonId(personId: 3) { nodeId personId secret } 3 | allPersonSecrets { nodes { nodeId personId secret } } 4 | personForSecret: personById(id: 1) { nodeId personSecretByPersonId { nodeId personId secret } } 5 | 6 | leftArmById(id: 42) { nodeId id personId lengthInMetres mood } 7 | allLeftArms { nodes { nodeId id personId lengthInMetres mood } } 8 | personForLeftArm: personById(id: 2) { nodeId leftArmByPersonId { nodeId id personId lengthInMetres mood } } 9 | 10 | postById(id:7) { nodeId id headline body authorId } 11 | allPosts { nodes { nodeId id headline body authorId } } 12 | personForPosts: personById(id: 3) { nodeId postsByAuthorId { nodes { nodeId id headline body authorId } } } 13 | 14 | # https://github.com/graphile/postgraphile/issues/812 15 | returnTableWithoutGrants { nodeId personId1 personId2 } 16 | } 17 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/relation-head-tail.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | allPeople { 3 | nodes { 4 | id 5 | name 6 | postsByAuthorId(last: 2) { 7 | nodes { 8 | headline 9 | authorId 10 | } 11 | } 12 | roundOnePost: postsByAuthorId(condition: { headline: "Large bet on myself in round one." }) { 13 | nodes { 14 | headline 15 | authorId 16 | } 17 | } 18 | compoundKeysByPersonId1 { 19 | nodes { 20 | personId1 21 | personId2 22 | } 23 | } 24 | compoundKeysByPersonId2 { 25 | nodes { 26 | personId1 27 | personId2 28 | } 29 | } 30 | } 31 | } 32 | allCompoundKeys { 33 | nodes { 34 | personId1 35 | personId2 36 | foreignKeysByCompoundKey1AndCompoundKey2 { 37 | nodes { 38 | personId 39 | compoundKey1 40 | compoundKey2 41 | } 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/relation-tail-head.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | allCompoundKeys { 3 | nodes { 4 | personId1 5 | personId2 6 | extra 7 | personByPersonId1 { 8 | name 9 | email 10 | } 11 | personByPersonId2 { 12 | name 13 | email 14 | } 15 | } 16 | } 17 | allForeignKeys { 18 | nodes { 19 | personId 20 | compoundKey1 21 | compoundKey2 22 | personByPersonId { 23 | name 24 | email 25 | } 26 | compoundKeyByCompoundKey1AndCompoundKey2 { 27 | personId1 28 | personId2 29 | extra 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/simple-collections.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | a: allPeopleList { ...personFragment } 3 | b: allPeopleList(first: 2) { ...personFragment } 4 | c: allPeopleList(orderBy: NAME_ASC) { ...personFragment } 5 | d: allPeopleList(orderBy: NAME_DESC) { ...personFragment } 6 | e: allPostsList(condition: { authorId: 2 }) { ...postFragment } 7 | f: allPostsList(first: 2, condition: { authorId: 2 }) { ...postFragment } 8 | g: allPeopleList(first: 3, offset: 1) { ...personFragment } 9 | h: allPeopleList(first: 0) { ...personFragment } 10 | i: allPeopleList(orderBy: PRIMARY_KEY_ASC) { ...personFragment } 11 | j: allPeopleList(condition: { about: null }) { ...personFragment } 12 | k: allPostsList(orderBy: [AUTHOR_ID_DESC, HEADLINE_DESC], first: 3) { ...postFragment } 13 | 14 | } 15 | 16 | fragment personFragment on Person { 17 | id 18 | name 19 | email 20 | } 21 | 22 | fragment postFragment on Post { 23 | headline 24 | authorId 25 | } 26 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/simple-procedure-query.graphql: -------------------------------------------------------------------------------- 1 | { 2 | compoundTypeSetQueryList(first: 5) { 3 | a 4 | b 5 | c 6 | d 7 | e 8 | f 9 | f 10 | g { 11 | hours 12 | minutes 13 | seconds 14 | } 15 | } 16 | tableSetQueryList { 17 | name 18 | } 19 | tableSetQueryWithOffset6: tableSetQueryList(first: 2, offset: 2) { 20 | name 21 | } 22 | intSetQueryList(x: 5, z: 6) 23 | staticBigIntegerList 24 | queryIntervalSetList { 25 | seconds 26 | minutes 27 | hours 28 | days 29 | months 30 | years 31 | } 32 | allPostsList(first: 1) { 33 | id 34 | computedIntervalSetList { 35 | seconds 36 | minutes 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/simple-relations-head-tail.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | allPeopleList { 3 | id 4 | name 5 | postsByAuthorIdList(first: 2) { 6 | headline 7 | authorId 8 | } 9 | roundOnePost: postsByAuthorIdList(condition: {headline: "Large bet on myself in round one."}) { 10 | headline 11 | authorId 12 | } 13 | compoundKeysByPersonId1List { 14 | personId1 15 | personId2 16 | } 17 | compoundKeysByPersonId2List { 18 | personId1 19 | personId2 20 | } 21 | } 22 | allCompoundKeysList { 23 | personId1 24 | personId2 25 | } 26 | } -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/simple-relations-tail-head.graphql: -------------------------------------------------------------------------------- 1 | query{ 2 | allCompoundKeysList { 3 | personId1 4 | personId2 5 | extra 6 | personByPersonId1 { 7 | name 8 | email 9 | } 10 | personByPersonId2 { 11 | name 12 | email 13 | } 14 | } 15 | allForeignKeysList { 16 | personId 17 | compoundKey1 18 | compoundKey2 19 | personByPersonId { 20 | name 21 | email 22 | } 23 | compoundKeyByCompoundKey1AndCompoundKey2 { 24 | personId1 25 | personId2 26 | extra 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/unique-constraints.graphql: -------------------------------------------------------------------------------- 1 | query { 2 | a: personByEmail(email: "sara.smith@email.com") { 3 | name 4 | email 5 | } 6 | b: personByEmail(email: "does.not.exist@email.com") { 7 | name 8 | email 9 | } 10 | c: compoundKeyByPersonId1AndPersonId2(personId1: 1, personId2: 2) { 11 | personId1 12 | personId2 13 | } 14 | d: compoundKeyByPersonId1AndPersonId2(personId1: 4, personId2: 4) { 15 | personId1 16 | personId2 17 | } 18 | e: compoundKeyByPersonId1AndPersonId2(personId1: 1, personId2: 100) { 19 | personId1 20 | personId2 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/unique-foreign-keys.graphql: -------------------------------------------------------------------------------- 1 | { 2 | allCompoundKeys { 3 | nodes { 4 | personId1 5 | personId2 6 | uniqueForeignKeyByCompoundKey1AndCompoundKey2 { 7 | compoundKey1 8 | compoundKey2 9 | compoundKeyByCompoundKey1AndCompoundKey2 { 10 | personId1 11 | personId2 12 | uniqueForeignKeyByCompoundKey1AndCompoundKey2 { 13 | compoundKey1 14 | compoundKey2 15 | } 16 | } 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/fixtures/queries/view.graphql: -------------------------------------------------------------------------------- 1 | { 2 | a: allTestviews { edges { cursor node { testviewid col1 col2 } } } 3 | b: allTestviews(orderBy: COL1_DESC) { edges { cursor node { testviewid col1 col2 } } } 4 | } -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/__snapshots__/invalidSkipPlugins.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`throws error when skipPlugins is passed a plugin that would not have loaded 1`] = `[Error: You tried to skip plugins that would never have been loaded anyway. Perhaps you've made a mistake in your skipPlugins list, or have sourced the plugin from a duplicate plugin module - check for duplicate modules in your 'node_modules' folder. The plugins that you requested to skip were: PluginThatWouldNotHaveLoadedAnyway]`; 4 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/core.js: -------------------------------------------------------------------------------- 1 | const { lexicographicSortSchema, printSchema } = require("graphql"); 2 | const { withPgClient } = require("../../helpers"); 3 | const { createPostGraphileSchema } = require("../../.."); 4 | const { snapshot } = require("../../helpers-v5"); 5 | 6 | let countByPath = Object.create(null); 7 | 8 | exports.test = 9 | (testPath, schemas, options, setup, finalCheck = async () => {}) => 10 | () => 11 | withPgClient(async client => { 12 | if (setup) { 13 | if (typeof setup === "function") { 14 | await setup(client); 15 | } else { 16 | await client.query(setup); 17 | } 18 | } 19 | const schema = await createPostGraphileSchema(client, schemas, options); 20 | const i = testPath in countByPath ? countByPath[testPath] + 1 : 1; 21 | countByPath[testPath] = i; 22 | const sorted = lexicographicSortSchema(schema); 23 | const printed = printSchema(sorted); 24 | const filePath = `${testPath.replace(/\.test\.[jt]s$/, "")}.${i}.graphql`; 25 | await snapshot(printed, filePath); 26 | await finalCheck(schema); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/defaultOptions.inheritence.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema with the default options against inheritence schema", 5 | core.test(__filename, ["inheritence"]) 6 | ); 7 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/defaultOptions.subscriptions.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "should be same with subscriptions option set", 5 | core.test(__filename, ["a", "b", "c"], { 6 | subscriptions: true, 7 | }) 8 | ); 9 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/defaultOptions.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema with the default options", 5 | core.test(__filename, ["a", "b", "c"]) 6 | ); 7 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/disabledTagsNoLegacyRelations.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema without parsing tags and with legacy relations omitted", 5 | core.test(__filename, "c", { 6 | enableTags: false, 7 | legacyRelations: "omit", 8 | setofFunctionsContainNulls: false, 9 | }) 10 | ); 11 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/enum_tables.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema for enum_tables", 5 | core.test(__filename, ["enum_tables"], {}) 6 | ); 7 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/function-clash.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | let consoleWarnSpy; 4 | beforeAll(() => { 5 | consoleWarnSpy = jest.spyOn(global.console, "warn"); 6 | }); 7 | afterAll(() => { 8 | if (consoleWarnSpy) { 9 | consoleWarnSpy.mockRestore(); 10 | } 11 | }); 12 | 13 | test( 14 | "raises an error when a function tries to overwrite a CRUD mutation", 15 | core.test( 16 | __filename, 17 | ["a", "b", "c"], 18 | {}, 19 | pgClient => { 20 | return pgClient.query( 21 | "create function a.create_post(t text) returns a.post as $$ select null::a.post; $$ language sql volatile;" 22 | ); 23 | }, 24 | () => { 25 | expect(consoleWarnSpy).toHaveBeenCalled(); 26 | } 27 | ) 28 | ); 29 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/geometry.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema for geometry", 5 | core.test(__filename, ["geometry"], { 6 | graphileBuildOptions: { 7 | pgGeometricTypes: true, 8 | }, 9 | }) 10 | ); 11 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/indexes.index_expressions.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema for index_expressions", 5 | core.test(__filename, ["index_expressions"], { 6 | disableDefaultMutations: true, 7 | }) 8 | ); 9 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/indexes.index_type_checker_plugin.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | const IndexTypeCheckerPlugin = builder => { 4 | builder.hook("build", build => { 5 | const { pgIntrospectionResultsByKind } = build; 6 | if ( 7 | !pgIntrospectionResultsByKind.index.every(idx => idx.indexType != null) 8 | ) { 9 | throw new Error("indexType missing"); 10 | } 11 | return build; 12 | }); 13 | }; 14 | 15 | test( 16 | "index types are present on introspection", 17 | core.test(__filename, ["index_expressions"], { 18 | appendPlugins: [IndexTypeCheckerPlugin], 19 | }) 20 | ); 21 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/indexes.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema respecting indexes for conditions and order by", 5 | core.test(__filename, ["a", "b", "c"], { 6 | ignoreIndexes: false, 7 | }) 8 | ); 9 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/inflect-core.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | const { makeAddInflectorsPlugin } = require("graphile-utils"); 3 | 4 | test( 5 | "prints a schema with the core types inflected", 6 | core.test(__filename, ["a", "b", "c"], { 7 | appendPlugins: [ 8 | makeAddInflectorsPlugin( 9 | ({ builtin, inputType }) => ({ 10 | builtin(name) { 11 | if (name === "Query") return "Q"; 12 | if (name === "Mutation") return "M"; 13 | if (name === "Subscription") return "S"; 14 | if (name === "Node") return "N"; 15 | if (name === "PageInfo") return "PI"; 16 | 17 | if (name === "Interval") return "I"; 18 | if (name === "Point") return "P"; 19 | return builtin.call(this, name); 20 | }, 21 | inputType(name) { 22 | if (name === "I") return "II"; 23 | if (name === "P") return "PP"; 24 | return inputType.call(this, name); 25 | }, 26 | }), 27 | true 28 | ), 29 | ], 30 | }) 31 | ); 32 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/invalidSkipPlugins.test.js: -------------------------------------------------------------------------------- 1 | const { withPgClient } = require("../../helpers"); 2 | const { createPostGraphileSchema } = require("../../.."); 3 | 4 | const PluginThatWouldNotHaveLoadedAnyway = () => {}; 5 | 6 | test("throws error when skipPlugins is passed a plugin that would not have loaded", () => 7 | withPgClient(async client => { 8 | let err; 9 | try { 10 | await createPostGraphileSchema(client, "a", { 11 | skipPlugins: [PluginThatWouldNotHaveLoadedAnyway], 12 | }); 13 | } catch (_e) { 14 | err = _e; 15 | } 16 | expect(err).toBeTruthy(); 17 | expect(err).toMatchSnapshot(); 18 | })); 19 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/jwt.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema with a JWT generating mutation", 5 | core.test(__filename, "b", { 6 | jwtSecret: "secret", 7 | jwtPgTypeIdentifier: "b.jwt_token", 8 | }) 9 | ); 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/legacyFunctionsOnly.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema with only legacy functions", 5 | core.test(__filename, ["c"], { 6 | legacyFunctionsOnly: true, 7 | }) 8 | ); 9 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/legacyRelationsOnlyLegacyJsonNoTags.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema without new relations and with legacy type names", 5 | core.test(__filename, "c", { 6 | legacyRelations: "only", 7 | enableTags: false, 8 | legacyJsonUuid: true, 9 | setofFunctionsContainNulls: false, 10 | }) 11 | ); 12 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/network_types.custom.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema to test network scalars using custom network scalar types", 5 | core.test(__filename, ["network_types"], { 6 | graphileBuildOptions: { 7 | pgUseCustomNetworkScalars: true, 8 | }, 9 | }) 10 | ); 11 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/network_types.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema to test network scalars without using custom network scalar types", 5 | core.test(__filename, ["network_types"], { 6 | graphileBuildOptions: { 7 | pgUseCustomNetworkScalars: false, 8 | }, 9 | }) 10 | ); 11 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/noDefaultMutations.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema without default mutations", 5 | core.test(__filename, "c", { 6 | disableDefaultMutations: true, 7 | setofFunctionsContainNulls: false, 8 | }) 9 | ); 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitcolumns.execute.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit execute on computed column", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on function d.person_full_name(d.person) is E'@omit execute'; 11 | ` 12 | ) 13 | ); 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitcolumns.loads-title.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit read on column", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on column d.tv_shows.title is E'@omit read,create,update,delete,all,many'; 11 | ` 12 | ) 13 | ); 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitcolumns.shows-title-asterisk.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit on column", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on column d.tv_shows.title is E'@omit *'; 11 | comment on column d.tv_episodes.title is E'@omit'; 12 | ` 13 | ) 14 | ); 15 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitcolumns.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit create on column", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on column d.tv_shows.title is E'@omit create'; 11 | ` 12 | ) 13 | ); 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitcolumns.title-order.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit order on column", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on column d.tv_episodes.title is E'@omit order'; 11 | ` 12 | ) 13 | ); 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitcolumns.update-title.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit update on column", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on column d.tv_shows.title is E'@omit update'; 11 | ` 12 | ) 13 | ); 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitstuff.constraints.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit many on constraint and table", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on constraint post_author_id_fkey on d.post is E'@omit many\n@fieldName author'; 11 | comment on constraint tv_shows_studio_id_fkey on d.tv_shows is E'@omit many'; 12 | comment on table d.tv_episodes is E'@omit many'; 13 | ` 14 | ) 15 | ); 16 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitstuff.films-asterisk.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit and omit everything on table", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on table d.films is E'@omit *'; 11 | comment on table d.tv_shows is E'@omit'; 12 | ` 13 | ) 14 | ); 15 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitstuff.films-create.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit create on table", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on table d.films is E'@omit create'; 11 | ` 12 | ) 13 | ); 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitstuff.films-delete.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit delete on table", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on table d.films is E'@omit delete'; 11 | ` 12 | ) 13 | ); 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitstuff.films-loads.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit read on table", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on table d.films is E'@omit read,all,update,create,delete,many'; 11 | ` 12 | ) 13 | ); 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitstuff.films-update.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit update on table", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on table d.films is E'@omit update'; 11 | ` 12 | ) 13 | ); 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitstuff.shows-order.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit order on table", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on table d.tv_shows is E'@omit order'; 11 | ` 12 | ) 13 | ); 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.omitstuff.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "omit create, update and delete on table", 5 | core.test( 6 | __filename, 7 | ["d"], 8 | {}, 9 | ` 10 | comment on table d.films is E'@omit create,update,delete'; 11 | ` 12 | ) 13 | ); 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/omit-rename.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test("prints a schema with the default options", core.test(__filename, ["d"])); 4 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/partitioned.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema to test partitioned table-specific features ignoring partition parents and using partitions", 5 | core.test(__filename, ["partitioned"], { 6 | usePartitionedParent: false, 7 | }) 8 | ); 9 | test( 10 | "prints a schema to test partitioned table-specific features using partition parents and ignoring partitions", 11 | core.test(__filename, ["partitioned"], { 12 | usePartitionedParent: true, 13 | }) 14 | ); 15 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/pg11.custom.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema to test PG11-specific features with custom network scalars", 5 | core.test(__filename, ["pg11"], { 6 | graphileBuildOptions: { 7 | pgUseCustomNetworkScalars: true, 8 | }, 9 | }) 10 | ); 11 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/pg11.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema to test PG11-specific features with default options", 5 | core.test(__filename, ["pg11"]) 6 | ); 7 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/pgColumnFilter.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema without posts headlines", 5 | core.test(__filename, "a", { 6 | pgColumnFilter: attr => attr.name !== "headline", 7 | setofFunctionsContainNulls: false, 8 | }) 9 | ); 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/rbac.ignore.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema from non-root role, with RBAC ignored", 5 | core.test(__filename, ["a", "b", "c"], { ignoreRBAC: true }, client => 6 | client.query("set role postgraphile_test_authenticator") 7 | ) 8 | ); 9 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/rbac.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema from non-root role, using RBAC permissions", 5 | core.test(__filename, ["a", "b", "c"], { ignoreRBAC: false }, client => 6 | client.query("set role postgraphile_test_authenticator") 7 | ) 8 | ); 9 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/relay1.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema with Relay 1 style ids", 5 | core.test(__filename, "c", { 6 | classicIds: true, 7 | setofFunctionsContainNulls: false, 8 | }) 9 | ); 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/simple-collections.omit-pets-simple.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "simple collection for computed column", 5 | core.test( 6 | __filename, 7 | "simple_collections", 8 | { 9 | simpleCollections: "omit", 10 | setofFunctionsContainNulls: false, 11 | }, 12 | pgClient => 13 | pgClient.query(` 14 | comment on function simple_collections.people_odd_pets(simple_collections.people) is E'@simpleCollections only'; 15 | `) 16 | ) 17 | ); 18 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/simple-collections.only-people-omit.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "schema with simple collections by default, but relay for people", 5 | core.test( 6 | __filename, 7 | "simple_collections", 8 | { 9 | simpleCollections: "only", 10 | setofFunctionsContainNulls: false, 11 | }, 12 | pgClient => 13 | pgClient.query(` 14 | comment on table simple_collections.people is E'@simpleCollections omit'; 15 | `) 16 | ) 17 | ); 18 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/simple-collections.only.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema with only simple collections", 5 | core.test(__filename, "c", { 6 | simpleCollections: "only", 7 | setofFunctionsContainNulls: false, 8 | }) 9 | ); 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/simple-collections.pets-simple.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "simple collection for relation", 5 | core.test( 6 | __filename, 7 | "simple_collections", 8 | { 9 | simpleCollections: "omit", 10 | setofFunctionsContainNulls: false, 11 | }, 12 | pgClient => 13 | pgClient.query(` 14 | comment on constraint pets_owner_id_fkey on simple_collections.pets is E'@simpleCollections only'; 15 | `) 16 | ) 17 | ); 18 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/simple-collections.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema with both simple collections and relay connections", 5 | core.test(__filename, "c", { 6 | simpleCollections: "both", 7 | setofFunctionsContainNulls: false, 8 | }) 9 | ); 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/simplePrint.test.js: -------------------------------------------------------------------------------- 1 | const { printSchema } = require("graphql"); 2 | const { withPgClient } = require("../../helpers"); 3 | const { createPostGraphileSchema } = require("../../.."); 4 | const { snapshot } = require("../../helpers-v5"); 5 | 6 | test("Simple schema print (no ordering)", () => 7 | withPgClient(async client => { 8 | const schema = await createPostGraphileSchema(client, ["a", "b", "c"], { 9 | subscriptions: true, 10 | }); 11 | const filePath = `${__filename.replace(/\.test\.[jt]s$/, "")}.graphql`; 12 | return snapshot(printSchema(schema), filePath); 13 | })); 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/skipNodePlugin.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | const { NodePlugin } = require("graphile-build"); 3 | 4 | test( 5 | "prints a schema with the NodePlugin skipped", 6 | core.test(__filename, ["a", "b", "c"], { 7 | skipPlugins: [NodePlugin], 8 | }) 9 | ); 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/smart_comment_relations.nx.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | // WARNING: this function is not guaranteed to be SQL injection safe. 4 | const offerViewComment = comment => pgClient => 5 | pgClient.query( 6 | `comment on view smart_comment_relations.offer_view is E'${comment.replace( 7 | /'/g, 8 | "''" 9 | )}';` 10 | ); 11 | 12 | test("referencing non-existent table (throws error)", async () => { 13 | let error; 14 | try { 15 | await core.test( 16 | __filename, 17 | ["smart_comment_relations"], 18 | {}, 19 | offerViewComment(`@name offers 20 | @primaryKey id 21 | @foreignKey (post_id) references posts`) 22 | )(); 23 | } catch (e) { 24 | error = e; 25 | } 26 | expect(error).toBeTruthy(); 27 | expect(error).toMatchInlineSnapshot( 28 | `[Error: @foreignKey smart comment referenced non-existant table/view 'smart_comment_relations'.'posts'. Note that this reference must use *database names* (i.e. it does not respect @name). ((post_id) references posts)]` 29 | ); 30 | }); 31 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/smart_comment_relations.post.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | // WARNING: this function is not guaranteed to be SQL injection safe. 4 | const offerViewComment = comment => pgClient => 5 | pgClient.query( 6 | `comment on view smart_comment_relations.offer_view is E'${comment.replace( 7 | /'/g, 8 | "''" 9 | )}';` 10 | ); 11 | 12 | test( 13 | "referencing hidden table (ignored)", 14 | core.test( 15 | __filename, 16 | ["smart_comment_relations"], 17 | {}, 18 | offerViewComment(`@name offers 19 | @primaryKey id 20 | @foreignKey (post_id) references post`), 21 | schema => { 22 | const Offer = schema.getType("Offer"); 23 | const fields = Offer.getFields(); 24 | expect(fields.nodeId).toBeTruthy(); 25 | expect(fields.postsByPostId).toBeFalsy(); 26 | expect(Object.keys(fields)).toMatchInlineSnapshot(` 27 | Array [ 28 | "nodeId", 29 | "id", 30 | "postId", 31 | ] 32 | `); 33 | } 34 | ) 35 | ); 36 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/smart_comment_relations.post_view.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | // WARNING: this function is not guaranteed to be SQL injection safe. 4 | const offerViewComment = comment => pgClient => 5 | pgClient.query( 6 | `comment on view smart_comment_relations.offer_view is E'${comment.replace( 7 | /'/g, 8 | "''" 9 | )}';` 10 | ); 11 | 12 | test( 13 | "referencing other view (no columns)", 14 | core.test( 15 | __filename, 16 | ["smart_comment_relations"], 17 | {}, 18 | offerViewComment( 19 | `@name offers 20 | @primaryKey id 21 | @foreignKey (post_id) references post_view` 22 | ), 23 | schema => { 24 | const Offer = schema.getType("Offer"); 25 | const fields = Offer.getFields(); 26 | expect(fields.nodeId).toBeTruthy(); 27 | expect(fields.postByPostId).toBeTruthy(); 28 | } 29 | ) 30 | ); 31 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/smart_comment_relations.post_view_no_pk.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "referencing other view (specifying columns, no PK)", 5 | core.test( 6 | __filename, 7 | ["smart_comment_relations"], 8 | {}, 9 | pgClient => 10 | pgClient.query( 11 | ` 12 | comment on view smart_comment_relations.post_view is E'@name posts 13 | @uniqueKey id'; -- NOT primary key! 14 | 15 | comment on view smart_comment_relations.offer_view is E'@name offers 16 | @primaryKey id 17 | @foreignKey (post_id) references post_view(id)';` 18 | ), 19 | schema => { 20 | const Offer = schema.getType("Offer"); 21 | const fields = Offer.getFields(); 22 | expect(fields.nodeId).toBeTruthy(); 23 | expect(fields.postByPostId).toBeTruthy(); 24 | const Query = schema.getType("Query"); 25 | const queryFields = Query.getFields(); 26 | // `@uniqueKey` does not add root level fields; use `@unique` for that. 27 | expect(queryFields.postById).toBeFalsy(); 28 | } 29 | ) 30 | ); 31 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/smart_comment_relations.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "prints a schema for smart_comment_relations", 5 | core.test(__filename, ["smart_comment_relations"], {}) 6 | ); 7 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/smart_comment_relations.view_fake_unique.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "view with fake unique constraint", 5 | core.test( 6 | __filename, 7 | ["smart_comment_relations"], 8 | {}, 9 | pgClient => 10 | pgClient.query( 11 | ` 12 | comment on view smart_comment_relations.post_view is E'@name posts 13 | @unique id'; -- NOT primary key! 14 | 15 | comment on view smart_comment_relations.offer_view is E'@name offers 16 | @primaryKey id 17 | @foreignKey (post_id) references post_view(id)';` 18 | ), 19 | schema => { 20 | const Offer = schema.getType("Offer"); 21 | const fields = Offer.getFields(); 22 | expect(fields.nodeId).toBeTruthy(); 23 | expect(fields.postByPostId).toBeTruthy(); 24 | const Query = schema.getType("Query"); 25 | const queryFields = Query.getFields(); 26 | expect(queryFields.postById).toBeTruthy(); 27 | } 28 | ) 29 | ); 30 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/integration/schema/smart_comment_relations.view_fake_unique_pk.test.js: -------------------------------------------------------------------------------- 1 | const core = require("./core"); 2 | 3 | test( 4 | "view with fake unique constraints and primary key", 5 | core.test( 6 | __filename, 7 | ["smart_comment_relations"], 8 | {}, 9 | pgClient => 10 | pgClient.query( 11 | ` 12 | comment on view smart_comment_relations.houses is E'@name houses 13 | @primaryKey street_id,property_id 14 | @unique street_name,property_id 15 | @unique street_id,property_name_or_number 16 | @unique street_name,building_name';` 17 | ), 18 | schema => { 19 | const Query = schema.getType("Query"); 20 | const queryFields = Query.getFields(); 21 | expect(queryFields.houseByStreetIdAndPropertyId).toBeTruthy(); 22 | expect(queryFields.houseByStreetNameAndPropertyId).toBeTruthy(); 23 | expect(queryFields.houseByStreetIdAndPropertyNameOrNumber).toBeTruthy(); 24 | expect(queryFields.houseByStreetNameAndBuildingName).toBeTruthy(); 25 | expect(queryFields.nonsense).toBeFalsy(); 26 | } 27 | ) 28 | ); 29 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/_test.js: -------------------------------------------------------------------------------- 1 | module.exports = require("../queries/_test"); 2 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/jwt/authenticateFail.json5: -------------------------------------------------------------------------------- 1 | { 2 | authenticateFail: { 3 | jwtToken: null, 4 | }, 5 | } 6 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/jwt/authenticateFail.sql: -------------------------------------------------------------------------------- 1 | SAVEPOINT graphql_mutation 2 | 3 | with __local_0__ as ( 4 | select __local_1__.* 5 | from "b"."authenticate_fail"( ) __local_1__ 6 | ) 7 | select ( 8 | ( 9 | case when __local_0__ is null then null else __local_0__ end 10 | ) 11 | )::text 12 | from __local_0__ 13 | 14 | RELEASE SAVEPOINT graphql_mutation -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/jwt/authenticateFail.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | ## expect(data.authenticateFail.jwtToken).toBe(null); 3 | #> jwtPgTypeIdentifier: '"b"."jwt_token"' 4 | #> jwtSecret: true 5 | mutation { 6 | authenticateFail(input: {}) { 7 | jwtToken 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/jwt/normal.json5: -------------------------------------------------------------------------------- 1 | { 2 | authenticate: { 3 | jwtToken: { 4 | role: "yay", 5 | exp: "2130969600", 6 | a: 1, 7 | b: "2", 8 | c: "3", 9 | }, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/jwt/normal.sql: -------------------------------------------------------------------------------- 1 | SAVEPOINT graphql_mutation 2 | 3 | with __local_0__ as ( 4 | select __local_1__.* 5 | from "b"."authenticate"( 6 | $1, 7 | $2, 8 | $3 9 | ) __local_1__ 10 | ) 11 | select ( 12 | ( 13 | case when __local_0__ is null then null else __local_0__ end 14 | ) 15 | )::text 16 | from __local_0__ 17 | 18 | with __local_0__ as ( 19 | select ( 20 | str::"b"."jwt_token" 21 | ).* 22 | from unnest( 23 | ( 24 | $1 25 | )::text[] 26 | ) str 27 | ) 28 | select to_json( 29 | ( 30 | json_build_object( 31 | 'role'::text, 32 | (__local_0__."role"), 33 | 'exp'::text, 34 | ((__local_0__."exp"))::text, 35 | 'a'::text, 36 | (__local_0__."a"), 37 | 'b'::text, 38 | ((__local_0__."b"))::text, 39 | 'c'::text, 40 | ((__local_0__."c"))::text 41 | ) 42 | ) 43 | ) as "@jwtToken" 44 | from __local_0__ as __local_0__ 45 | where ( 46 | not (__local_0__ is null) 47 | ) and (TRUE) and (TRUE) 48 | 49 | RELEASE SAVEPOINT graphql_mutation -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/jwt/normal.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | mutation { 3 | authenticate(input: {a: 1, b: "2", c: "3"}) { 4 | jwtToken { 5 | role 6 | exp 7 | a 8 | b 9 | c 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/jwt/pgJwtTypeIdentifier-bigNumbers.json5: -------------------------------------------------------------------------------- 1 | { 2 | authenticate: { 3 | jwtToken: "JWT<{role:'yay',exp:2130969600,a:1,b:'1234567890123456789.123456789',c:'987654321098765432',iat:'',aud:'postgraphile',iss:'postgraphile'} (unverified)>", 4 | }, 5 | } 6 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/jwt/pgJwtTypeIdentifier-bigNumbers.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> jwtPgTypeIdentifier: '"b"."jwt_token"' 3 | #> jwtSecret: true 4 | mutation { 5 | authenticate(input: {a: 1, b: "1234567890123456789.123456789", c: "987654321098765432"}) { 6 | jwtToken 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/jwt/pgJwtTypeIdentifier-withPayload.json5: -------------------------------------------------------------------------------- 1 | { 2 | authenticatePayload: { 3 | authPayload: { 4 | jwt: "JWT<{role:'yay',exp:2130969600,a:1,b:2,c:3,iat:'',aud:'postgraphile',iss:'postgraphile'} (unverified)>", 5 | id: 1, 6 | admin: true, 7 | personById: { 8 | id: 1, 9 | name: "John Smith", 10 | }, 11 | }, 12 | personById: { 13 | id: 1, 14 | name: "John Smith", 15 | }, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/jwt/pgJwtTypeIdentifier-withPayload.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> jwtPgTypeIdentifier: '"b"."jwt_token"' 3 | #> jwtSecret: true 4 | mutation { 5 | authenticatePayload(input: {a: 1, b: "2", c: "3"}) { 6 | authPayload { 7 | jwt 8 | id 9 | admin 10 | personById { 11 | id 12 | name 13 | } 14 | } 15 | personById { 16 | id 17 | name 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/jwt/pgJwtTypeIdentifier.json5: -------------------------------------------------------------------------------- 1 | { 2 | authenticate: { 3 | jwtToken: "JWT<{role:'yay',exp:2130969600,a:1,b:'2',c:'3',iat:'',aud:'postgraphile',iss:'postgraphile'} (unverified)>", 4 | }, 5 | } 6 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/jwt/pgJwtTypeIdentifier.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> jwtPgTypeIdentifier: '"b"."jwt_token"' 3 | #> jwtSecret: true 4 | mutation { 5 | authenticate(input: {a: 1, b: "2", c: "3"}) { 6 | jwtToken 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/d.createPerson.json5: -------------------------------------------------------------------------------- 1 | { 2 | createPerson: { 3 | person: { 4 | id: 10, 5 | firstName: null, 6 | lastName: "Doe", 7 | colNoCreate: "col_no_create", 8 | colNoUpdate: "create2", 9 | colNoOrder: "create1", 10 | colNoFilter: "create3", 11 | colNoCreateUpdate: "col_no_create_update", 12 | colNoCreateUpdateOrderFilter: "col_no_create_update_order_filter", 13 | }, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/d.createPerson.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["d"] 3 | mutation { 4 | createPerson(input:{ 5 | person:{ 6 | lastName:"Doe" 7 | colNoOrder:"create1" 8 | colNoUpdate:"create2" 9 | colNoFilter:"create3" 10 | } 11 | }) { 12 | person{ 13 | id 14 | firstName 15 | lastName 16 | colNoCreate 17 | colNoUpdate 18 | colNoOrder 19 | colNoFilter 20 | colNoCreateUpdate 21 | colNoCreateUpdateOrderFilter 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/d.deletePerson.json5: -------------------------------------------------------------------------------- 1 | { 2 | deletePersonById: { 3 | person: { 4 | id: 1, 5 | firstName: "John", 6 | lastName: "Smith", 7 | colNoCreate: "col_no_create1", 8 | colNoUpdate: "col_no_update1", 9 | colNoOrder: "col_no_order1", 10 | colNoFilter: "col_no_filter1", 11 | colNoCreateUpdate: "col_no_create_update1", 12 | colNoCreateUpdateOrderFilter: "col_no_create_update_order_filter1", 13 | }, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/d.deletePerson.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["d"] 3 | mutation { 4 | deletePersonById(input:{ 5 | id: 1 6 | }) { 7 | person{ 8 | id 9 | firstName 10 | lastName 11 | colNoCreate 12 | colNoUpdate 13 | colNoOrder 14 | colNoFilter 15 | colNoCreateUpdate 16 | colNoCreateUpdateOrderFilter 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/d.updatePerson.json5: -------------------------------------------------------------------------------- 1 | { 2 | updatePersonById: { 3 | person: { 4 | id: 1, 5 | firstName: "John", 6 | lastName: "Doe", 7 | colNoCreate: "update2", 8 | colNoUpdate: "col_no_update1", 9 | colNoOrder: "update1", 10 | colNoFilter: "update3", 11 | colNoCreateUpdate: "col_no_create_update1", 12 | colNoCreateUpdateOrderFilter: "col_no_create_update_order_filter1", 13 | }, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/d.updatePerson.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["d"] 3 | mutation { 4 | updatePersonById(input:{ 5 | id:1 6 | personPatch:{ 7 | lastName:"Doe" 8 | colNoOrder:"update1" 9 | colNoCreate:"update2" 10 | colNoFilter:"update3" 11 | } 12 | }) { 13 | person{ 14 | id 15 | firstName 16 | lastName 17 | colNoCreate 18 | colNoUpdate 19 | colNoOrder 20 | colNoFilter 21 | colNoCreateUpdate 22 | colNoCreateUpdateOrderFilter 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/enum_tables.mutations.json5: -------------------------------------------------------------------------------- 1 | { 2 | deleteLetterDescriptionByLetter: { 3 | letterDescription: { 4 | id: 103, 5 | letter: "C", 6 | letterViaView: "C", 7 | }, 8 | }, 9 | createLetterDescription: { 10 | letterDescription: { 11 | id: 105, 12 | letter: "C", 13 | letterViaView: "C", 14 | description: "One does like to see the letter C", 15 | }, 16 | }, 17 | referencingTableMutation: { 18 | integer: 435, 19 | }, 20 | } 21 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/enum_tables.mutations.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["enum_tables"] 3 | mutation { 4 | deleteLetterDescriptionByLetter(input: { letter: C }) { 5 | letterDescription { 6 | id 7 | letter 8 | letterViaView 9 | } 10 | } 11 | createLetterDescription( 12 | input: { 13 | letterDescription: { 14 | letter: C 15 | letterViaView: C 16 | description: "One does like to see the letter C" 17 | } 18 | } 19 | ) { 20 | letterDescription { 21 | id 22 | letter 23 | letterViaView 24 | description 25 | } 26 | } 27 | 28 | referencingTableMutation(input: { t: { enum1: A1, enum2: B2, enum3: C4 } }) { 29 | integer 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/enum_tables.mutations2.json5: -------------------------------------------------------------------------------- 1 | { 2 | createReferencingTable: { 3 | referencingTable: { 4 | id: 435, 5 | enum1: "A3", 6 | enum2: "B4", 7 | enum3: null, 8 | }, 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/enum_tables.mutations2.sql: -------------------------------------------------------------------------------- 1 | SAVEPOINT graphql_mutation 2 | 3 | with __local_0__ as ( 4 | insert into "enum_tables"."referencing_table" ( 5 | "enum_1", 6 | "enum_2" 7 | ) values( 8 | $1, 9 | $2 10 | ) returning * 11 | ) 12 | select ( 13 | ( 14 | case when __local_0__ is null then null else __local_0__ end 15 | ) 16 | )::text 17 | from __local_0__ 18 | 19 | with __local_0__ as ( 20 | select ( 21 | str::"enum_tables"."referencing_table" 22 | ).* 23 | from unnest( 24 | ( 25 | $1 26 | )::text[] 27 | ) str 28 | ) 29 | select to_json( 30 | ( 31 | json_build_object( 32 | 'id'::text, 33 | (__local_0__."id"), 34 | 'enum1'::text, 35 | (__local_0__."enum_1"), 36 | 'enum2'::text, 37 | (__local_0__."enum_2"), 38 | 'enum3'::text, 39 | (__local_0__."enum_3") 40 | ) 41 | ) 42 | ) as "@referencingTable" 43 | from __local_0__ as __local_0__ 44 | where (TRUE) and (TRUE) 45 | 46 | RELEASE SAVEPOINT graphql_mutation -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/enum_tables.mutations2.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["enum_tables"] 3 | mutation { 4 | createReferencingTable( 5 | input: { referencingTable: { enum1: A3, enum2: B4 } } 6 | ) { 7 | referencingTable { 8 | id 9 | enum1 10 | enum2 11 | enum3 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/inheritence.createUserFile.json5: -------------------------------------------------------------------------------- 1 | { 2 | createUser: { 3 | user: { 4 | nodeId: "WyJ1c2VycyIsMV0=", 5 | id: 1, 6 | name: "Bobby Tables", 7 | }, 8 | }, 9 | createUserFile: { 10 | userFile: { 11 | id: 1, 12 | filename: "foo.txt", 13 | userByUserId: { 14 | id: 1, 15 | name: "Bobby Tables", 16 | }, 17 | }, 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/inheritence.createUserFile.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["inheritence"] 3 | mutation { 4 | createUser(input: { 5 | user: { 6 | id: 1 7 | name: "Bobby Tables" 8 | } 9 | }) { 10 | user { 11 | nodeId 12 | id 13 | name 14 | } 15 | } 16 | createUserFile(input: {userFile: {filename: "foo.txt", userId: 1}}) { 17 | userFile { 18 | id 19 | filename 20 | userByUserId { 21 | id 22 | name 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/mutation-delete.errors.json5: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | message: "No values were deleted in collection 'posts' because no values you can delete were found matching these criteria.", 4 | locations: [ 5 | { 6 | line: 4, 7 | column: 3, 8 | }, 9 | ], 10 | path: [ 11 | 'c', 12 | ], 13 | }, 14 | { 15 | message: 'Nope.', 16 | locations: [ 17 | { 18 | line: 6, 19 | column: 3, 20 | }, 21 | ], 22 | path: [ 23 | 'd2', 24 | ], 25 | }, 26 | { 27 | message: "No values were deleted in collection 'posts' because no values you can delete were found matching these criteria.", 28 | locations: [ 29 | { 30 | line: 9, 31 | column: 3, 32 | }, 33 | ], 34 | path: [ 35 | 'g', 36 | ], 37 | }, 38 | ] -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/network_types.createNetwork.json5: -------------------------------------------------------------------------------- 1 | { 2 | createNetwork: { 3 | network: { 4 | nodeId: "WyJuZXR3b3JrcyIsN10=", 5 | id: 7, 6 | inet: "10.0.0.0", 7 | cidr: "10.0.0.0/8", 8 | macaddr: "00:00:00:00:00:00", 9 | }, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/network_types.createNetwork.sql: -------------------------------------------------------------------------------- 1 | SAVEPOINT graphql_mutation 2 | 3 | with __local_0__ as ( 4 | insert into "network_types"."network" ( 5 | "inet", 6 | "cidr", 7 | "macaddr" 8 | ) values( 9 | $1, 10 | $2, 11 | $3 12 | ) returning * 13 | ) 14 | select ( 15 | ( 16 | case when __local_0__ is null then null else __local_0__ end 17 | ) 18 | )::text 19 | from __local_0__ 20 | 21 | with __local_0__ as ( 22 | select ( 23 | str::"network_types"."network" 24 | ).* 25 | from unnest( 26 | ( 27 | $1 28 | )::text[] 29 | ) str 30 | ) 31 | select to_json( 32 | ( 33 | json_build_object( 34 | '__identifiers'::text, 35 | json_build_array(__local_0__."id"), 36 | 'id'::text, 37 | (__local_0__."id"), 38 | 'inet'::text, 39 | (__local_0__."inet"), 40 | 'cidr'::text, 41 | (__local_0__."cidr"), 42 | 'macaddr'::text, 43 | (__local_0__."macaddr") 44 | ) 45 | ) 46 | ) as "@network" 47 | from __local_0__ as __local_0__ 48 | where (TRUE) and (TRUE) 49 | 50 | RELEASE SAVEPOINT graphql_mutation -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/network_types.createNetwork.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["network_types"] 3 | # graphileBuildOptions: { pgUseCustomNetworkScalars: true, } 4 | mutation { 5 | createNetwork(input: { 6 | network: { 7 | inet: "10.0.0.0" 8 | cidr: "10.0.0.0/8" 9 | macaddr: "000000000000" 10 | } 11 | }) { 12 | network { 13 | nodeId 14 | id 15 | inet 16 | cidr 17 | macaddr 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/pg11.identity.json5: -------------------------------------------------------------------------------- 1 | { 2 | a: { 3 | alwaysAsIdentity: { 4 | id: 1, 5 | t: "test", 6 | }, 7 | }, 8 | b: { 9 | byDefaultAsIdentity: { 10 | id: 1, 11 | t: "test", 12 | }, 13 | }, 14 | c: { 15 | byDefaultAsIdentity: { 16 | id: 100, 17 | t: "test", 18 | }, 19 | }, 20 | } 21 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/pg11.identity.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["pg11"] 3 | #> requiresPg: 110000 4 | mutation { 5 | a: createAlwaysAsIdentity(input:{ 6 | alwaysAsIdentity: { 7 | t: "test" 8 | } 9 | }) { 10 | alwaysAsIdentity { 11 | id 12 | t 13 | } 14 | } 15 | b: createByDefaultAsIdentity(input:{ 16 | byDefaultAsIdentity: { 17 | t: "test" 18 | } 19 | }) { 20 | byDefaultAsIdentity { 21 | id 22 | t 23 | } 24 | } 25 | c: createByDefaultAsIdentity(input:{ 26 | byDefaultAsIdentity: { 27 | id: 100 28 | t: "test" 29 | } 30 | }) { 31 | byDefaultAsIdentity { 32 | id 33 | t 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/pg11.network_types.createNetwork.json5: -------------------------------------------------------------------------------- 1 | { 2 | createNetwork: { 3 | network: { 4 | nodeId: "WyJuZXR3b3JrcyIsOV0=", 5 | id: 9, 6 | inet: "10.0.0.0", 7 | cidr: "10.0.0.0/8", 8 | macaddr: "00:00:00:00:00:00", 9 | macaddr8: "00:00:00:00:00:00:00:00", 10 | }, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/pg11.network_types.createNetwork.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["pg11"] 3 | #> requiresPg: 110000 4 | #> graphileBuildOptions: { pgUseCustomNetworkScalars: true } 5 | mutation { 6 | createNetwork(input: { 7 | network: { 8 | inet: "10.0.0.0" 9 | cidr: "10.0.0.0/8" 10 | macaddr: "000000000000" 11 | macaddr8: "0000000000000000" 12 | } 13 | }) { 14 | network { 15 | nodeId 16 | id 17 | inet 18 | cidr 19 | macaddr 20 | macaddr8 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/pg11.types.json5: -------------------------------------------------------------------------------- 1 | { 2 | updateTypeById: { 3 | type: { 4 | id: 12, 5 | regrole: "postgraphile_test_authenticator", 6 | regnamespace: "pg11", 7 | bigintDomainArrayDomain: [ 8 | "2098288669218571759", 9 | "2098288669218571760", 10 | "2098288669218571761", 11 | ], 12 | domainConstrainedCompoundType: { 13 | a: 1, 14 | b: null, 15 | c: null, 16 | d: null, 17 | e: null, 18 | f: null, 19 | fooBar: null, 20 | }, 21 | }, 22 | }, 23 | createType: { 24 | type: { 25 | id: 15, 26 | regrole: "postgraphile_test_visitor", 27 | regnamespace: "c", 28 | bigintDomainArrayDomain: [ 29 | "2098288669218571759", 30 | "2098288669218571760", 31 | "2098288669218571761", 32 | ], 33 | domainConstrainedCompoundType: { 34 | a: 1, 35 | b: null, 36 | c: null, 37 | d: null, 38 | e: null, 39 | f: null, 40 | fooBar: null, 41 | }, 42 | }, 43 | }, 44 | } 45 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/procedure-mutation.errors.json5: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | message: 'Deliberate error', 4 | locations: [ 5 | { 6 | line: 13, 7 | column: 3, 8 | }, 9 | ], 10 | path: [ 11 | 'add4MutationError', 12 | ], 13 | }, 14 | ] -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.createLeftArm.json5: -------------------------------------------------------------------------------- 1 | { 2 | createLeftArm: { 3 | leftArm: { 4 | nodeId: "WyJsZWZ0X2FybXMiLDEwMF0=", 5 | id: 100, 6 | personId: 3, 7 | lengthInMetres: 0.66, 8 | mood: "neutral", 9 | }, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.createLeftArm.sql: -------------------------------------------------------------------------------- 1 | SAVEPOINT graphql_mutation 2 | 3 | with __local_0__ as ( 4 | insert into "c"."left_arm" ("length_in_metres") values( 5 | $1 6 | ) returning * 7 | ) 8 | select ( 9 | ( 10 | case when __local_0__ is null then null else __local_0__ end 11 | ) 12 | )::text 13 | from __local_0__ 14 | 15 | with __local_0__ as ( 16 | select ( 17 | str::"c"."left_arm" 18 | ).* 19 | from unnest( 20 | ( 21 | $1 22 | )::text[] 23 | ) str 24 | ) 25 | select to_json( 26 | ( 27 | json_build_object( 28 | '__identifiers'::text, 29 | json_build_array(__local_0__."id"), 30 | 'id'::text, 31 | (__local_0__."id"), 32 | 'personId'::text, 33 | (__local_0__."person_id"), 34 | 'lengthInMetres'::text, 35 | (__local_0__."length_in_metres"), 36 | 'mood'::text, 37 | (__local_0__."mood") 38 | ) 39 | ) 40 | ) as "@leftArm" 41 | from __local_0__ as __local_0__ 42 | where (TRUE) and (TRUE) 43 | 44 | RELEASE SAVEPOINT graphql_mutation -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.createLeftArm.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> ignoreRBAC: false 4 | mutation { 5 | createLeftArm(input:{ 6 | leftArm:{ 7 | lengthInMetres: 0.66 8 | } 9 | }) { 10 | leftArm { 11 | nodeId 12 | id 13 | personId 14 | lengthInMetres 15 | mood 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.createPerson.json5: -------------------------------------------------------------------------------- 1 | { 2 | createPerson: { 3 | person: { 4 | id: 10, 5 | name: "Jane Doe", 6 | aliases: [ 7 | "Jay Doe", 8 | "JD", 9 | ], 10 | about: "Unknown", 11 | email: "jane.doe@example.com", 12 | site: { 13 | url: "http://example.com", 14 | }, 15 | }, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.createPerson.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> ignoreRBAC: false 4 | mutation { 5 | createPerson(input:{ 6 | person:{ 7 | name:"Jane Doe" 8 | aliases: ["Jay Doe", "JD"] 9 | about: "Unknown" 10 | email: "jane.doe@example.com" 11 | site: { 12 | url: "http://example.com" 13 | } 14 | } 15 | }) { 16 | person{ 17 | id 18 | name 19 | aliases 20 | about 21 | email 22 | site { 23 | url 24 | } 25 | #createdAt # Can't include - it changes 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.deletePerson.json5: -------------------------------------------------------------------------------- 1 | { 2 | deletePersonById: { 3 | deletedPersonId: "WyJwZW9wbGUiLDNd", 4 | }, 5 | } 6 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.deletePerson.sql: -------------------------------------------------------------------------------- 1 | SAVEPOINT graphql_mutation 2 | 3 | with __local_0__ as ( 4 | delete 5 | from "c"."person" 6 | where ( 7 | "id" = $1 8 | ) returning * 9 | ) 10 | select ( 11 | ( 12 | case when __local_0__ is null then null else __local_0__ end 13 | ) 14 | )::text 15 | from __local_0__ 16 | 17 | with __local_0__ as ( 18 | select ( 19 | str::"c"."person" 20 | ).* 21 | from unnest( 22 | ( 23 | $1 24 | )::text[] 25 | ) str 26 | ) 27 | select to_json( 28 | json_build_array(__local_0__."id") 29 | ) as "__identifiers" 30 | from __local_0__ as __local_0__ 31 | where (TRUE) and (TRUE) 32 | 33 | RELEASE SAVEPOINT graphql_mutation -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.deletePerson.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> ignoreRBAC: false 4 | mutation { 5 | deletePersonById(input:{ 6 | id: 3 7 | }) { 8 | deletedPersonId 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.leftArmIdentity.json5: -------------------------------------------------------------------------------- 1 | { 2 | leftArmIdentity: { 3 | leftArm: { 4 | nodeId: "WyJsZWZ0X2FybXMiLDkwMDFd", 5 | id: 9001, 6 | personId: 99, 7 | lengthInMetres: 77, 8 | mood: "jubilant", 9 | }, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.leftArmIdentity.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> ignoreRBAC: false 4 | mutation { 5 | leftArmIdentity(input:{ 6 | leftArm:{ 7 | # Note we can specify all the fields here because it uses the base type 8 | id: 9001 # it's over 9000! 9 | personId: 99 10 | lengthInMetres: 77 11 | mood: "jubilant" 12 | } 13 | }) { 14 | leftArm { 15 | nodeId 16 | id 17 | personId 18 | lengthInMetres 19 | mood 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.updateLeftArm.json5: -------------------------------------------------------------------------------- 1 | { 2 | updateLeftArmById: { 3 | leftArm: { 4 | nodeId: "WyJsZWZ0X2FybXMiLDQ3XQ==", 5 | id: 47, 6 | personId: 5, 7 | lengthInMetres: 0.65, 8 | mood: "jovial", 9 | }, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.updateLeftArm.sql: -------------------------------------------------------------------------------- 1 | SAVEPOINT graphql_mutation 2 | 3 | with __local_0__ as ( 4 | update "c"."left_arm" set "mood" = $1 5 | where ( 6 | "id" = $2 7 | ) returning * 8 | ) 9 | select ( 10 | ( 11 | case when __local_0__ is null then null else __local_0__ end 12 | ) 13 | )::text 14 | from __local_0__ 15 | 16 | with __local_0__ as ( 17 | select ( 18 | str::"c"."left_arm" 19 | ).* 20 | from unnest( 21 | ( 22 | $1 23 | )::text[] 24 | ) str 25 | ) 26 | select to_json( 27 | ( 28 | json_build_object( 29 | '__identifiers'::text, 30 | json_build_array(__local_0__."id"), 31 | 'id'::text, 32 | (__local_0__."id"), 33 | 'personId'::text, 34 | (__local_0__."person_id"), 35 | 'lengthInMetres'::text, 36 | (__local_0__."length_in_metres"), 37 | 'mood'::text, 38 | (__local_0__."mood") 39 | ) 40 | ) 41 | ) as "@leftArm" 42 | from __local_0__ as __local_0__ 43 | where (TRUE) and (TRUE) 44 | 45 | RELEASE SAVEPOINT graphql_mutation -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.updateLeftArm.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> ignoreRBAC: false 4 | mutation { 5 | updateLeftArmById(input:{ 6 | id: 47 7 | leftArmPatch:{ 8 | mood: "jovial" 9 | } 10 | }) { 11 | leftArm { 12 | nodeId 13 | id 14 | personId 15 | lengthInMetres 16 | mood 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.updatePerson.json5: -------------------------------------------------------------------------------- 1 | { 2 | updatePersonById: { 3 | person: { 4 | id: 3, 5 | name: "Budd Daay", 6 | aliases: [ 7 | "BD", 8 | "Buddy", 9 | ], 10 | about: null, 11 | email: "buddy@example.com", 12 | site: { 13 | url: "http://buddy.com", 14 | }, 15 | }, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/mutations/v4-base/rbac.updatePerson.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> ignoreRBAC: false 4 | mutation { 5 | updatePersonById(input:{ 6 | id: 3 7 | personPatch:{ 8 | name:"Budd Daay" 9 | aliases: ["BD", "Buddy"] 10 | about: null 11 | email: "buddy@example.com" 12 | site: { 13 | url: "http://buddy.com" 14 | } 15 | } 16 | }) { 17 | person{ 18 | id 19 | name 20 | aliases 21 | about 22 | email 23 | site { 24 | url 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/partitioned-data.sql: -------------------------------------------------------------------------------- 1 | insert into partitioned.item (id, description) values 2 | (1, 'Hair dryer'), 3 | (2, 'Capacitor'), 4 | (3, 'Wagon'), 5 | (4, 'Fan'); 6 | 7 | insert into partitioned.warehouse (id, location) values 8 | (1, 'Carmel, IN'), 9 | (2, 'Cincinnati, OH'), 10 | (3, 'Chicago, IL'); 11 | 12 | insert into partitioned.stock (item_id, warehouse_id, amount) values 13 | (1, 1, 50), 14 | (1, 2, 3), 15 | (1, 3, 92), 16 | (2, 1, 20), 17 | (2, 2, 7), 18 | (2, 3, 9), 19 | (3, 1, 2), 20 | (3, 2, 9), 21 | (3, 3, 0), 22 | (4, 1, 56), 23 | (4, 2, 30), 24 | (4, 3, 101); 25 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/pg11-schema.sql: -------------------------------------------------------------------------------- 1 | drop schema if exists pg11 cascade; 2 | create schema pg11; 3 | 4 | create table pg11.always_as_identity ( 5 | id int primary key generated always as identity, 6 | t text 7 | ); 8 | 9 | create table pg11.by_default_as_identity ( 10 | id int primary key generated by default as identity, 11 | t text 12 | ); 13 | 14 | create table pg11.network ( 15 | id serial primary key, 16 | inet inet, 17 | cidr cidr, 18 | macaddr macaddr, 19 | macaddr8 macaddr8 20 | ); 21 | 22 | create domain c.bigint_domain as int8; 23 | -- PG9.6 doesn't support array of domain scalars 24 | create domain c.bigint_domain_array_domain as c.bigint_domain[]; 25 | 26 | create domain pg11.domain_constrained_compound_type as 27 | c.compound_type check (value is null or (value).a is not null); 28 | 29 | create table pg11.types ( 30 | id serial primary key, 31 | "regrole" regrole, 32 | "regnamespace" regnamespace, 33 | "bigint_domain_array_domain" c.bigint_domain_array_domain, 34 | "domain_constrained_compound_type" pg11.domain_constrained_compound_type 35 | ); 36 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/badlyBehavedFunction.json5: -------------------------------------------------------------------------------- 1 | { 2 | badlyBehavedFunction: { 3 | nodes: [ 4 | { 5 | nodeId: "WyJwZW9wbGUiLDFd", 6 | id: 1, 7 | firstName: "John", 8 | }, 9 | null, 10 | { 11 | nodeId: "WyJwZW9wbGUiLDZd", 12 | id: 6, 13 | firstName: "Twenty", 14 | }, 15 | ], 16 | edges: [ 17 | { 18 | cursor: "WyJuYXR1cmFsIiwxXQ==", 19 | node: { 20 | nodeId: "WyJwZW9wbGUiLDFd", 21 | id: 1, 22 | firstName: "John", 23 | }, 24 | }, 25 | { 26 | cursor: "WyJuYXR1cmFsIiwyXQ==", 27 | node: null, 28 | }, 29 | { 30 | cursor: "WyJuYXR1cmFsIiwzXQ==", 31 | node: { 32 | nodeId: "WyJwZW9wbGUiLDZd", 33 | id: 6, 34 | firstName: "Twenty", 35 | }, 36 | }, 37 | ], 38 | }, 39 | } 40 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/badlyBehavedFunction.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | #> viewUniqueKey: "testviewid" 5 | #> setofFunctionsContainNulls: true 6 | { 7 | badlyBehavedFunction { 8 | nodes { 9 | ...PersonFragment 10 | } 11 | edges { 12 | cursor 13 | node { 14 | ...PersonFragment 15 | } 16 | } 17 | } 18 | } 19 | 20 | fragment PersonFragment on Person { 21 | nodeId 22 | id 23 | firstName 24 | } 25 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/classic-ids.json5: -------------------------------------------------------------------------------- 1 | { 2 | allPosts: { 3 | nodes: [ 4 | { 5 | id: "WyJwb3N0cyIsMV0=", 6 | rowId: 1, 7 | headline: "No… It’s a thing; it’s like a plan, but with more greatness.", 8 | }, 9 | ], 10 | }, 11 | allEdgeCases: { 12 | nodes: [ 13 | { 14 | rowId: 2, 15 | }, 16 | ], 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/classic-ids.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | #> classicIds: true 5 | { 6 | allPosts(condition: { rowId: 1 }) { 7 | nodes { 8 | id 9 | rowId 10 | headline 11 | } 12 | } 13 | allEdgeCases(condition: { rowId: 2 }) { 14 | nodes { 15 | rowId 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/connections-blankcursor.errors.json5: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | message: 'Invalid cursor, please enter a cursor from a previous request, or null.', 4 | locations: [ 5 | { 6 | line: 2, 7 | column: 3, 8 | }, 9 | ], 10 | path: [ 11 | 'blankCursor', 12 | ], 13 | }, 14 | { 15 | message: 'Invalid cursor, please enter a cursor from a previous request, or null.', 16 | locations: [ 17 | { 18 | line: 3, 19 | column: 3, 20 | }, 21 | ], 22 | path: [ 23 | 'invalidCursor', 24 | ], 25 | }, 26 | ] -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/connections-blankcursor.json5: -------------------------------------------------------------------------------- 1 | { 2 | blankCursor: null, 3 | invalidCursor: null, 4 | } 5 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/connections-blankcursor.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphile/graphile-engine/603bf8f3b048c86ac9dd68e79662119d1ffaa89f/packages/postgraphile-core/__tests__/queries/base/connections-blankcursor.sql -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/connections-blankcursor.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toHaveLength(2); 2 | query { 3 | blankCursor: allPeople(first: 2, after: "") { ...personConnection } 4 | invalidCursor: allPeople(first: 2, after: "27") { ...personConnection } 5 | } 6 | 7 | fragment personConnection on PeopleConnection { 8 | pageInfo { 9 | startCursor 10 | endCursor 11 | hasNextPage 12 | hasPreviousPage 13 | } 14 | totalCount 15 | edges { 16 | cursor 17 | node { 18 | id 19 | name 20 | email 21 | config 22 | lastLoginFromIp 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/connections-condition-computed-column.json5: -------------------------------------------------------------------------------- 1 | { 2 | allPeople: { 3 | nodes: [ 4 | { 5 | id: 3, 6 | name: "Budd Deey", 7 | }, 8 | ], 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/connections-condition-computed-column.sql: -------------------------------------------------------------------------------- 1 | with __local_0__ as ( 2 | select to_json( 3 | ( 4 | json_build_object( 5 | '__identifiers'::text, 6 | json_build_array(__local_1__."id"), 7 | 'id'::text, 8 | (__local_1__."id"), 9 | 'name'::text, 10 | (__local_1__."person_full_name") 11 | ) 12 | ) 13 | ) as "@nodes" 14 | from ( 15 | select __local_1__.* 16 | from "c"."person" as __local_1__ 17 | where ( 18 | "c"."person_computed_out"(__local_1__) = $1 19 | ) and (TRUE) and (TRUE) 20 | order by __local_1__."id" ASC 21 | ) __local_1__ 22 | ), 23 | __local_2__ as ( 24 | select json_agg( 25 | to_json(__local_0__) 26 | ) as data 27 | from __local_0__ 28 | ) 29 | select coalesce( 30 | ( 31 | select __local_2__.data 32 | from __local_2__ 33 | ), 34 | '[]'::json 35 | ) as "data" -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/connections-condition-computed-column.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> subscriptions: true 3 | query { 4 | allPeople(condition: { 5 | computedOut: "o1 Budd Deey" 6 | }) { 7 | nodes { 8 | id 9 | name 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/connections-order-computed-column.json5: -------------------------------------------------------------------------------- 1 | { 2 | asc: { 3 | nodes: [ 4 | { 5 | id: 3, 6 | name: "Budd Deey", 7 | }, 8 | { 9 | id: 5, 10 | name: "Joe Tucker", 11 | }, 12 | { 13 | id: 1, 14 | name: "John Smith", 15 | }, 16 | { 17 | id: 4, 18 | name: "Kathryn Ramirez", 19 | }, 20 | { 21 | id: 2, 22 | name: "Sara Smith", 23 | }, 24 | { 25 | id: 6, 26 | name: "Twenty Seventwo", 27 | }, 28 | ], 29 | }, 30 | desc: { 31 | nodes: [ 32 | { 33 | id: 6, 34 | name: "Twenty Seventwo", 35 | }, 36 | { 37 | id: 2, 38 | name: "Sara Smith", 39 | }, 40 | { 41 | id: 4, 42 | name: "Kathryn Ramirez", 43 | }, 44 | { 45 | id: 1, 46 | name: "John Smith", 47 | }, 48 | { 49 | id: 5, 50 | name: "Joe Tucker", 51 | }, 52 | { 53 | id: 3, 54 | name: "Budd Deey", 55 | }, 56 | ], 57 | }, 58 | } 59 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/connections-order-computed-column.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | query { 5 | asc: allPeople(orderBy: [COMPUTED_OUT_ASC]) { 6 | nodes { 7 | id 8 | name 9 | } 10 | } 11 | desc: allPeople(orderBy: [COMPUTED_OUT_DESC]) { 12 | nodes { 13 | id 14 | name 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/connections-totalCount.json5: -------------------------------------------------------------------------------- 1 | { 2 | a: { 3 | totalCount: 6, 4 | }, 5 | b: { 6 | nodes: [ 7 | { 8 | friends: { 9 | totalCount: 2, 10 | }, 11 | }, 12 | { 13 | friends: { 14 | totalCount: 2, 15 | }, 16 | }, 17 | { 18 | friends: { 19 | totalCount: 2, 20 | }, 21 | }, 22 | { 23 | friends: { 24 | totalCount: 2, 25 | }, 26 | }, 27 | { 28 | friends: { 29 | totalCount: 1, 30 | }, 31 | }, 32 | { 33 | friends: { 34 | totalCount: 0, 35 | }, 36 | }, 37 | ], 38 | }, 39 | c: { 40 | totalCount: 6, 41 | }, 42 | } 43 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/connections-totalCount.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | query { 5 | a: allPeople { 6 | totalCount 7 | } 8 | b: allPeople { 9 | nodes { 10 | friends { 11 | totalCount 12 | } 13 | } 14 | } 15 | c: tableSetQuery { 16 | totalCount 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/d.filter.json5: -------------------------------------------------------------------------------- 1 | { 2 | allPeople: { 3 | nodes: [ 4 | { 5 | id: 1, 6 | firstName: "John", 7 | lastName: "Smith", 8 | colNoCreate: "col_no_create1", 9 | colNoUpdate: "col_no_update1", 10 | colNoOrder: "col_no_order1", 11 | colNoFilter: "col_no_filter1", 12 | colNoCreateUpdate: "col_no_create_update1", 13 | colNoCreateUpdateOrderFilter: "col_no_create_update_order_filter1", 14 | }, 15 | ], 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/d.filter.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["d"] 3 | { 4 | allPeople(condition:{colNoCreate:"col_no_create1"}) { 5 | nodes { 6 | id 7 | firstName 8 | lastName 9 | colNoCreate 10 | colNoUpdate 11 | colNoOrder 12 | colNoFilter 13 | colNoCreateUpdate 14 | colNoCreateUpdateOrderFilter 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/d.order.json5: -------------------------------------------------------------------------------- 1 | { 2 | allPeople: { 3 | nodes: [ 4 | { 5 | id: 2, 6 | firstName: "Sara", 7 | lastName: "Smith", 8 | colNoCreate: "col_no_create2", 9 | colNoUpdate: "col_no_update2", 10 | colNoOrder: "col_no_order2", 11 | colNoFilter: "col_no_filter2", 12 | colNoCreateUpdate: "col_no_create_update2", 13 | colNoCreateUpdateOrderFilter: "col_no_create_update_order_filter2", 14 | }, 15 | { 16 | id: 1, 17 | firstName: "John", 18 | lastName: "Smith", 19 | colNoCreate: "col_no_create1", 20 | colNoUpdate: "col_no_update1", 21 | colNoOrder: "col_no_order1", 22 | colNoFilter: "col_no_filter1", 23 | colNoCreateUpdate: "col_no_create_update1", 24 | colNoCreateUpdateOrderFilter: "col_no_create_update_order_filter1", 25 | }, 26 | ], 27 | }, 28 | } 29 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/d.order.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["d"] 3 | { 4 | allPeople(orderBy: COL_NO_CREATE_UPDATE_DESC) { 5 | nodes { 6 | id 7 | firstName 8 | lastName 9 | colNoCreate 10 | colNoUpdate 11 | colNoOrder 12 | colNoFilter 13 | colNoCreateUpdate 14 | colNoCreateUpdateOrderFilter 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/directives.json5: -------------------------------------------------------------------------------- 1 | { 2 | a: "query", 3 | d: "query", 4 | } 5 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/directives.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphile/graphile-engine/603bf8f3b048c86ac9dd68e79662119d1ffaa89f/packages/postgraphile-core/__tests__/queries/base/directives.sql -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/directives.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | query TestDirectives($true: Boolean = true, $false: Boolean = false) { 5 | a: nodeId @include(if: $true) 6 | b: nodeId @include(if: $false) 7 | c: nodeId @skip(if: $true) 8 | d: nodeId @skip(if: $false) 9 | } 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/dynamic-json.condition-json-field-variable.json5: -------------------------------------------------------------------------------- 1 | { 2 | a: { 3 | nodes: [ 4 | { 5 | id: 1, 6 | jsonData: { 7 | stringField: "test", 8 | }, 9 | }, 10 | ], 11 | }, 12 | b: { 13 | nodes: [ 14 | { 15 | id: 1, 16 | jsonData: { 17 | stringField: "test", 18 | }, 19 | }, 20 | ], 21 | }, 22 | c: { 23 | nodes: [ 24 | { 25 | id: 1, 26 | jsonData: { 27 | stringField: "test", 28 | }, 29 | }, 30 | ], 31 | }, 32 | } 33 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/dynamic-json.condition-json-field-variable.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | #> dynamicJson: true 5 | #> setofFunctionsContainNulls: null 6 | query myQuery($myVal: String = "test", $myVal2: JSON = {stringField: "test"}) { 7 | # All three of these should result in the same value 8 | a: allMyTables(condition: {jsonData: {stringField: $myVal}}) { 9 | nodes { 10 | id 11 | jsonData 12 | } 13 | } 14 | b: allMyTables(condition: {jsonData: {stringField: "test"}}) { 15 | nodes { 16 | id 17 | jsonData 18 | } 19 | } 20 | c: allMyTables(condition: {jsonData: $myVal2}) { 21 | nodes { 22 | id 23 | jsonData 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/dynamic-json.test.graphql: -------------------------------------------------------------------------------- 1 | # This test file is configured with `dynamicJSON` set to `true`. This is a 2 | # special case. Every other file has `dynamicJSON` set to `false`. 3 | 4 | ## expect(errors).toBeFalsy(); 5 | #> schema: ["a", "b", "c"] 6 | #> subscriptions: true 7 | #> dynamicJson: true 8 | #> setofFunctionsContainNulls: null 9 | query { 10 | a: jsonIdentity(json: true) 11 | b: jsonIdentity(json: false) 12 | c: jsonIdentity(json: 42) 13 | d: jsonIdentity(json: 3.1415) 14 | e: jsonIdentity(json: "hello, world!") 15 | f: jsonIdentity(json: { a: 1, b: 2, c: 3 }) 16 | g: jsonIdentity(json: [1, 2, 3, 4]) 17 | h: jsonIdentity(json: { boolean: true, integer: 42, float: 3.1415, object: { a: 1, b: 2, c: 3 }, array: [1, 2, 3, 4] }) 18 | i: jsonIdentity(json: [true, 42, 3.1415, { a: 1, b: 2, c: 3 }, [1, 2, 3, 4]]) 19 | j: jsonIdentity(json: [true, null, 42, 3.1415, { a: 1, b: null, c: 3 }, [1, 2, null, 3, 4]]) 20 | k: jsonbIdentity(json: { a: 1, b: 2, c: 3 }) 21 | l: jsonbIdentity(json: [true, 42, 3.1415, { a: 1, b: 2, c: 3 }, [1, 2, 3, 4]]) 22 | allTypes { 23 | nodes { 24 | json 25 | jsonb 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/empty-array.json5: -------------------------------------------------------------------------------- 1 | { 2 | allPeople: { 3 | nodes: [ 4 | { 5 | id: 1, 6 | name: "John Smith", 7 | aliases: [], 8 | }, 9 | ], 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/empty-array.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | query { 5 | allPeople(first: 1) { 6 | nodes { 7 | id 8 | name 9 | aliases 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/enum_tables.queries2.json5: -------------------------------------------------------------------------------- 1 | { 2 | all: { 3 | nodes: [ 4 | { 5 | id: 432, 6 | enum1: "A1", 7 | enum2: null, 8 | enum3: null, 9 | }, 10 | { 11 | id: 433, 12 | enum1: "A3", 13 | enum2: "B2", 14 | enum3: "C1", 15 | }, 16 | { 17 | id: 434, 18 | enum1: null, 19 | enum2: null, 20 | enum3: "C3", 21 | }, 22 | ], 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/enum_tables.queries2.sql: -------------------------------------------------------------------------------- 1 | with __local_0__ as ( 2 | select to_json( 3 | ( 4 | json_build_object( 5 | '__identifiers'::text, 6 | json_build_array(__local_1__."id"), 7 | 'id'::text, 8 | (__local_1__."id"), 9 | 'enum1'::text, 10 | (__local_1__."enum_1"), 11 | 'enum2'::text, 12 | (__local_1__."enum_2"), 13 | 'enum3'::text, 14 | (__local_1__."enum_3") 15 | ) 16 | ) 17 | ) as "@nodes" 18 | from ( 19 | select __local_1__.* 20 | from "enum_tables"."referencing_table" as __local_1__ 21 | where (TRUE) and (TRUE) 22 | order by __local_1__."id" ASC 23 | ) __local_1__ 24 | ), 25 | __local_2__ as ( 26 | select json_agg( 27 | to_json(__local_0__) 28 | ) as data 29 | from __local_0__ 30 | ) 31 | select coalesce( 32 | ( 33 | select __local_2__.data 34 | from __local_2__ 35 | ), 36 | '[]'::json 37 | ) as "data" -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/enum_tables.queries2.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["enum_tables"] 3 | #> subscriptions: true 4 | { 5 | all: allReferencingTables { 6 | nodes { 7 | id 8 | enum1 9 | enum2 10 | enum3 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/large_bigint.issue491.json5: -------------------------------------------------------------------------------- 1 | { 2 | allLargeNodeIds: { 3 | nodes: [ 4 | { 5 | nodeId: "WyJsYXJnZV9ub2RlX2lkcyIsOTAwNzE5OTI1NDc0MDk5MF0=", 6 | id: "9007199254740990", 7 | text: "Should be fine", 8 | }, 9 | { 10 | nodeId: "WyJsYXJnZV9ub2RlX2lkcyIsIjIwOTgyODg2NjkyMTg1NzE3NjAiXQ==", 11 | id: "2098288669218571760", 12 | text: "Graphile Engine issue #491", 13 | }, 14 | ], 15 | }, 16 | safeInt: { 17 | nodeId: "WyJsYXJnZV9ub2RlX2lkcyIsOTAwNzE5OTI1NDc0MDk5MF0=", 18 | id: "9007199254740990", 19 | text: "Should be fine", 20 | }, 21 | largeInt: { 22 | nodeId: "WyJsYXJnZV9ub2RlX2lkcyIsIjIwOTgyODg2NjkyMTg1NzE3NjAiXQ==", 23 | id: "2098288669218571760", 24 | text: "Graphile Engine issue #491", 25 | }, 26 | } 27 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/large_bigint.issue491.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["large_bigint"] 3 | { 4 | allLargeNodeIds { 5 | nodes { 6 | nodeId 7 | id 8 | text 9 | } 10 | } 11 | safeInt: largeNodeId(nodeId: "WyJsYXJnZV9ub2RlX2lkcyIsOTAwNzE5OTI1NDc0MDk5MF0=") { 12 | nodeId 13 | id 14 | text 15 | } 16 | largeInt: largeNodeId(nodeId: "WyJsYXJnZV9ub2RlX2lkcyIsIjIwOTgyODg2NjkyMTg1NzE3NjAiXQ==") { 17 | nodeId 18 | id 19 | text 20 | } 21 | } -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/longAliases.json5: -------------------------------------------------------------------------------- 1 | { 2 | person: { 3 | nodeId: "WyJwZW9wbGUiLDJd", 4 | email: "sara.smith@email.com", 5 | aVeryLongAliasInOrderToTestThatThingsGoThroughPostgresJustFineAndWeDontGetAnyIssuesDueToAliasLength: { 6 | totalCount: 2, 7 | }, 8 | anotherLongAliasInOrderToTestThatThingsGoThroughPostgresJustFineAndWeDontGetAnyIssuesDueToAliasLength: { 9 | totalCount: 2, 10 | }, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/longAliases.sql: -------------------------------------------------------------------------------- 1 | select to_json( 2 | json_build_array(__local_0__."id") 3 | ) as "__identifiers", 4 | to_json((__local_0__."email")) as "email", 5 | to_json( 6 | ( 7 | select json_build_object( 8 | 'aggregates'::text, 9 | ( 10 | select json_build_object( 11 | 'totalCount'::text, 12 | count(1) 13 | ) 14 | from "c"."person_friends"(__local_0__) as __local_1__ 15 | where 1 = 1 16 | ) 17 | ) 18 | ) 19 | ) as "@@25fa9871b4d4d16ffd41359c88e7e851739819c6", 20 | to_json( 21 | ( 22 | select json_build_object( 23 | 'aggregates'::text, 24 | ( 25 | select json_build_object( 26 | 'totalCount'::text, 27 | count(1) 28 | ) 29 | from "c"."person_friends"(__local_0__) as __local_2__ 30 | where 1 = 1 31 | ) 32 | ) 33 | ) 34 | ) as "@@e82261e340b3c5fc784bd0d54ec53541f5a4e2fe" 35 | from "c"."person" as __local_0__ 36 | where ( 37 | __local_0__."email" = $1 38 | ) and (TRUE) and (TRUE) -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/longAliases.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | query { 5 | person: personByEmail(email: "sara.smith@email.com") { 6 | nodeId 7 | email 8 | 9 | # safe alias: @@25fa9871b4d4d16ffd41359c88e7e851739819c6 10 | aVeryLongAliasInOrderToTestThatThingsGoThroughPostgresJustFineAndWeDontGetAnyIssuesDueToAliasLength: friends { 11 | totalCount 12 | } 13 | 14 | # safe alias: @@e82261e340b3c5fc784bd0d54ec53541f5a4e2fe 15 | anotherLongAliasInOrderToTestThatThingsGoThroughPostgresJustFineAndWeDontGetAnyIssuesDueToAliasLength: friends { 16 | totalCount 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/named_query_builder.toys.json5: -------------------------------------------------------------------------------- 1 | { 2 | t1: { 3 | categories: [ 4 | { 5 | name: "Dinosaurs", 6 | }, 7 | { 8 | name: "Military", 9 | }, 10 | ], 11 | }, 12 | t2: { 13 | categories: [ 14 | { 15 | name: "Dinosaurs", 16 | }, 17 | ], 18 | }, 19 | t3: { 20 | categories: [ 21 | { 22 | name: "Military", 23 | }, 24 | ], 25 | }, 26 | } 27 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/named_query_builder.toys.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["named_query_builder"] 3 | #> subscriptions: true 4 | #> ToyCategoriesPlugin: true 5 | { 6 | t1: toyById(id: 1) { 7 | categories { 8 | name 9 | } 10 | } 11 | t2: toyById(id: 1) { 12 | categories(approved: true) { 13 | name 14 | } 15 | } 16 | t3: toyById(id: 1) { 17 | categories(approved: false) { 18 | name 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/network_types.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["network_types"] 3 | #> graphileBuildOptions: { pgUseCustomNetworkScalars: true } 4 | query { 5 | inetTest: allNetworks(condition: { inet: "192.168.0.0" }) { ...networkConnection } 6 | cidrTest: allNetworks(condition: { cidr: "192.168.0.0/16" }) { ...networkConnection } 7 | macaddrTest: allNetworks(condition: { macaddr: "08:00:2b:01:02:03" }) { ...networkConnection } 8 | } 9 | 10 | fragment networkConnection on NetworksConnection { 11 | pageInfo { 12 | startCursor 13 | endCursor 14 | hasNextPage 15 | hasPreviousPage 16 | } 17 | totalCount 18 | edges { 19 | cursor 20 | node { 21 | id 22 | inet 23 | cidr 24 | macaddr 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/nonexistant-record-from-function.json5: -------------------------------------------------------------------------------- 1 | { 2 | tableQuery: null, 3 | } 4 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/nonexistant-record-from-function.sql: -------------------------------------------------------------------------------- 1 | select to_json( 2 | json_build_array(__local_0__."id") 3 | ) as "__identifiers", 4 | to_json((__local_0__."id")) as "id", 5 | to_json((__local_0__."headline")) as "headline" 6 | from "c"."table_query"( 7 | $1 8 | ) as __local_0__ 9 | where ( 10 | not (__local_0__ is null) 11 | ) and (TRUE) and (TRUE) -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/nonexistant-record-from-function.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | { 5 | tableQuery(id: 13373475) { 6 | id 7 | headline 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/one-to-one-backward.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | { 5 | allPeople { 6 | edges { 7 | cursor 8 | node { 9 | ...PersonDetails 10 | leftArm: leftArmByPersonId { 11 | nodeId 12 | id 13 | personId 14 | personByPersonId { 15 | ...PersonDetails 16 | } 17 | lengthInMetres 18 | } 19 | secret: personSecretByPersonId { 20 | nodeId 21 | personId 22 | personByPersonId { 23 | ...PersonDetails 24 | } 25 | secret 26 | } 27 | } 28 | } 29 | } 30 | } 31 | 32 | fragment PersonDetails on Person { 33 | id 34 | name 35 | firstName 36 | } 37 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/orderByNullsLast.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a"] 3 | #> subscriptions: true 4 | #> graphileBuildOptions: { orderByNullsLast: true } 5 | { 6 | asc: allSimilarTable1S(orderBy: COL2_ASC) { 7 | nodes { 8 | nodeId 9 | col2 10 | } 11 | } 12 | desc: allSimilarTable1S(orderBy: COL2_DESC) { 13 | nodes { 14 | nodeId 15 | col2 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/partitioned.use-partitioned-parent.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["partitioned"] 3 | #> usePartitionedParent: true 4 | { 5 | allItems { 6 | nodes { 7 | id 8 | description 9 | stocksByItemId { 10 | nodes { 11 | amount 12 | warehouseByWarehouseId { 13 | id 14 | location 15 | } 16 | } 17 | } 18 | } 19 | } 20 | allStocks { 21 | nodes { 22 | amount 23 | itemByItemId { 24 | id 25 | description 26 | } 27 | warehouseByWarehouseId { 28 | id 29 | location 30 | } 31 | } 32 | } 33 | allWarehouses { 34 | nodes { 35 | id 36 | location 37 | stocksByWarehouseId { 38 | nodes { 39 | amount 40 | itemByItemId { 41 | id 42 | description 43 | } 44 | } 45 | } 46 | } 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/pg11.network_types.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["pg11"] 3 | #> requiresPg: 110000 4 | #> graphileBuildOptions: { pgUseCustomNetworkScalars: true } 5 | query { 6 | inetTest: allNetworks(condition: { inet: "192.168.0.0" }) { ...networkConnection } 7 | cidrTest: allNetworks(condition: { cidr: "192.168.0.0/16" }) { ...networkConnection } 8 | macaddrTest: allNetworks(condition: { macaddr: "08:00:2b:01:02:03" }) { ...networkConnection } 9 | macaddr8Test: allNetworks(condition: { macaddr8: "08:00:2b:01:02:03:04:05" }) { ...networkConnection } 10 | } 11 | 12 | fragment networkConnection on NetworksConnection { 13 | pageInfo { 14 | startCursor 15 | endCursor 16 | hasNextPage 17 | hasPreviousPage 18 | } 19 | totalCount 20 | edges { 21 | cursor 22 | node { 23 | id 24 | inet 25 | cidr 26 | macaddr 27 | macaddr8 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/pg11.types.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["pg11"] 3 | #> requiresPg: 110000 4 | #> graphileBuildOptions: { pgUseCustomNetworkScalars: true } 5 | query { 6 | allTypes { 7 | ...typesConnection 8 | } 9 | } 10 | 11 | fragment type on Type { 12 | id 13 | regrole 14 | regnamespace 15 | bigintDomainArrayDomain 16 | domainConstrainedCompoundType { 17 | ...domainConstrainedCompoundType 18 | } 19 | } 20 | 21 | fragment domainConstrainedCompoundType on DomainConstrainedCompoundType { 22 | a 23 | b 24 | c 25 | d 26 | e 27 | f 28 | fooBar 29 | } 30 | 31 | fragment typesConnection on TypesConnection { 32 | nodes { 33 | ...type 34 | } 35 | edges { 36 | node { 37 | ...type 38 | } 39 | } 40 | totalCount 41 | pageInfo { 42 | hasNextPage 43 | hasPreviousPage 44 | startCursor 45 | endCursor 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/posts.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | { 5 | allPosts { 6 | edges { 7 | cursor 8 | node { 9 | ...PostDetails 10 | author: personByAuthorId { 11 | firstPost { 12 | ...PostDetails 13 | } 14 | friends { 15 | nodes { 16 | ...PersonDetails 17 | } 18 | totalCount 19 | pageInfo { 20 | startCursor 21 | } 22 | } 23 | } 24 | } 25 | } 26 | } 27 | } 28 | 29 | fragment PersonDetails on Person { 30 | id 31 | name 32 | firstName 33 | } 34 | 35 | fragment PostDetails on Post { 36 | id 37 | headline 38 | headlineTrimmed 39 | author: personByAuthorId { 40 | ...PersonDetails 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/query.json5: -------------------------------------------------------------------------------- 1 | { 2 | nodeId: "query", 3 | a: null, 4 | b: { 5 | __typename: "Query", 6 | nodeId: "query", 7 | a: null, 8 | b: { 9 | __typename: "Query", 10 | nodeId: "query", 11 | }, 12 | }, 13 | query: { 14 | nodeId: "query", 15 | a: null, 16 | b: { 17 | __typename: "Query", 18 | nodeId: "query", 19 | }, 20 | query: { 21 | nodeId: "query", 22 | a: null, 23 | b: { 24 | __typename: "Query", 25 | nodeId: "query", 26 | }, 27 | query: { 28 | nodeId: "query", 29 | a: null, 30 | b: { 31 | __typename: "Query", 32 | nodeId: "query", 33 | }, 34 | }, 35 | }, 36 | }, 37 | } 38 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/query.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphile/graphile-engine/603bf8f3b048c86ac9dd68e79662119d1ffaa89f/packages/postgraphile-core/__tests__/queries/base/query.sql -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/query.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | query { 3 | ...query 4 | query { 5 | ...query 6 | query { 7 | ...query 8 | query { 9 | ...query 10 | } 11 | } 12 | } 13 | a: node(nodeId: "hello") { 14 | __typename 15 | nodeId 16 | ...query 17 | } 18 | b: node(nodeId: "query") { 19 | __typename 20 | nodeId 21 | ...query 22 | } 23 | } 24 | 25 | fragment query on Query { 26 | nodeId 27 | a: node(nodeId: "hello") { 28 | __typename 29 | nodeId 30 | } 31 | b: node(nodeId: "query") { 32 | __typename 33 | nodeId 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/rbac.basic.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> ignoreRBAC: false 4 | 5 | query { 6 | personSecretByPersonId(personId: 3) { nodeId personId secret } 7 | allPersonSecrets { nodes { nodeId personId secret } } 8 | personForSecret: personById(id: 1) { nodeId personSecretByPersonId { nodeId personId secret } } 9 | 10 | leftArmById(id: 42) { nodeId id personId lengthInMetres mood } 11 | allLeftArms { nodes { nodeId id personId lengthInMetres mood } } 12 | personForLeftArm: personById(id: 2) { nodeId leftArmByPersonId { nodeId id personId lengthInMetres mood } } 13 | 14 | postById(id:7) { nodeId id headline body authorId } 15 | allPosts { nodes { nodeId id headline body authorId } } 16 | personForPosts: personById(id: 3) { nodeId postsByAuthorId { nodes { nodeId id headline body authorId } } } 17 | 18 | # https://github.com/graphile/postgraphile/issues/812 19 | returnTableWithoutGrants { nodeId personId1 personId2 } 20 | } 21 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/relation-head-tail.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | query { 5 | allPeople { 6 | nodes { 7 | id 8 | name 9 | postsByAuthorId(last: 2) { 10 | nodes { 11 | headline 12 | authorId 13 | } 14 | } 15 | roundOnePost: postsByAuthorId(condition: { headline: "Large bet on myself in round one." }) { 16 | nodes { 17 | headline 18 | authorId 19 | } 20 | } 21 | compoundKeysByPersonId1 { 22 | nodes { 23 | personId1 24 | personId2 25 | } 26 | } 27 | compoundKeysByPersonId2 { 28 | nodes { 29 | personId1 30 | personId2 31 | } 32 | } 33 | } 34 | } 35 | allCompoundKeys { 36 | nodes { 37 | personId1 38 | personId2 39 | foreignKeysByCompoundKey1AndCompoundKey2 { 40 | nodes { 41 | personId 42 | compoundKey1 43 | compoundKey2 44 | } 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/relation-tail-head.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | query { 5 | allCompoundKeys { 6 | nodes { 7 | personId1 8 | personId2 9 | extra 10 | personByPersonId1 { 11 | name 12 | email 13 | } 14 | personByPersonId2 { 15 | name 16 | email 17 | } 18 | } 19 | } 20 | allForeignKeys { 21 | nodes { 22 | personId 23 | compoundKey1 24 | compoundKey2 25 | personByPersonId { 26 | name 27 | email 28 | } 29 | compoundKeyByCompoundKey1AndCompoundKey2 { 30 | personId1 31 | personId2 32 | extra 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/simple-collections.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | #> simpleCollections: "both" 5 | 6 | query { 7 | a: allPeopleList { ...personFragment } 8 | b: allPeopleList(first: 2) { ...personFragment } 9 | c: allPeopleList(orderBy: NAME_ASC) { ...personFragment } 10 | d: allPeopleList(orderBy: NAME_DESC) { ...personFragment } 11 | e: allPostsList(condition: { authorId: 2 }) { ...postFragment } 12 | f: allPostsList(first: 2, condition: { authorId: 2 }) { ...postFragment } 13 | g: allPeopleList(first: 3, offset: 1) { ...personFragment } 14 | h: allPeopleList(first: 0) { ...personFragment } 15 | i: allPeopleList(orderBy: PRIMARY_KEY_ASC) { ...personFragment } 16 | j: allPeopleList(condition: { about: null }) { ...personFragment } 17 | k: allPostsList(orderBy: [AUTHOR_ID_DESC, HEADLINE_DESC], first: 3) { ...postFragment } 18 | 19 | } 20 | 21 | fragment personFragment on Person { 22 | id 23 | name 24 | email 25 | } 26 | 27 | fragment postFragment on Post { 28 | headline 29 | authorId 30 | } 31 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/simple-procedure-query.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | #> simpleCollections: "both" 5 | { 6 | compoundTypeSetQueryList(first: 5) { 7 | a 8 | b 9 | c 10 | d 11 | e 12 | f 13 | f 14 | g { 15 | hours 16 | minutes 17 | seconds 18 | } 19 | } 20 | tableSetQueryList { 21 | name 22 | } 23 | tableSetQueryWithOffset6: tableSetQueryList(first: 2, offset: 2) { 24 | name 25 | } 26 | intSetQueryList(x: 5, z: 6) 27 | staticBigIntegerList 28 | queryIntervalSetList { 29 | seconds 30 | minutes 31 | hours 32 | days 33 | months 34 | years 35 | } 36 | allPostsList(first: 1) { 37 | id 38 | computedIntervalSetList { 39 | seconds 40 | minutes 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/simple-relations-head-tail.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | #> simpleCollections: "both" 5 | query { 6 | allPeopleList { 7 | id 8 | name 9 | postsByAuthorIdList(first: 2) { 10 | headline 11 | authorId 12 | } 13 | roundOnePost: postsByAuthorIdList(condition: {headline: "Large bet on myself in round one."}) { 14 | headline 15 | authorId 16 | } 17 | compoundKeysByPersonId1List { 18 | personId1 19 | personId2 20 | } 21 | compoundKeysByPersonId2List { 22 | personId1 23 | personId2 24 | } 25 | } 26 | allCompoundKeysList { 27 | personId1 28 | personId2 29 | } 30 | } -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/simple-relations-tail-head.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | #> simpleCollections: "both" 5 | query{ 6 | allCompoundKeysList { 7 | personId1 8 | personId2 9 | extra 10 | personByPersonId1 { 11 | name 12 | email 13 | } 14 | personByPersonId2 { 15 | name 16 | email 17 | } 18 | } 19 | allForeignKeysList { 20 | personId 21 | compoundKey1 22 | compoundKey2 23 | personByPersonId { 24 | name 25 | email 26 | } 27 | compoundKeyByCompoundKey1AndCompoundKey2 { 28 | personId1 29 | personId2 30 | extra 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/unique-constraints.json5: -------------------------------------------------------------------------------- 1 | { 2 | a: { 3 | name: "Sara Smith", 4 | email: "sara.smith@email.com", 5 | }, 6 | b: null, 7 | c: { 8 | personId1: 1, 9 | personId2: 2, 10 | }, 11 | d: { 12 | personId1: 4, 13 | personId2: 4, 14 | }, 15 | e: null, 16 | } 17 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/unique-constraints.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | query { 5 | a: personByEmail(email: "sara.smith@email.com") { 6 | name 7 | email 8 | } 9 | b: personByEmail(email: "does.not.exist@email.com") { 10 | name 11 | email 12 | } 13 | c: compoundKeyByPersonId1AndPersonId2(personId1: 1, personId2: 2) { 14 | personId1 15 | personId2 16 | } 17 | d: compoundKeyByPersonId1AndPersonId2(personId1: 4, personId2: 4) { 18 | personId1 19 | personId2 20 | } 21 | e: compoundKeyByPersonId1AndPersonId2(personId1: 1, personId2: 100) { 22 | personId1 23 | personId2 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/unique-foreign-keys.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | { 5 | allCompoundKeys { 6 | nodes { 7 | personId1 8 | personId2 9 | uniqueForeignKeyByCompoundKey1AndCompoundKey2 { 10 | compoundKey1 11 | compoundKey2 12 | compoundKeyByCompoundKey1AndCompoundKey2 { 13 | personId1 14 | personId2 15 | uniqueForeignKeyByCompoundKey1AndCompoundKey2 { 16 | compoundKey1 17 | compoundKey2 18 | } 19 | } 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/base/view.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | #> schema: ["a", "b", "c"] 3 | #> subscriptions: true 4 | #> viewUniqueKey: "testviewid" 5 | #> setofFunctionsContainNulls: true 6 | { 7 | a: allTestviews { edges { cursor node { testviewid col1 col2 } } } 8 | b: allTestviews(orderBy: COL1_DESC) { edges { cursor node { testviewid col1 col2 } } } 9 | } -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/ranges/bigint.json5: -------------------------------------------------------------------------------- 1 | { 2 | rangeTestById: { 3 | int8: { 4 | start: { 5 | value: "-98765432109876543", 6 | inclusive: true, 7 | }, 8 | end: { 9 | value: "22222222222222222", 10 | inclusive: false, 11 | }, 12 | }, 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/ranges/bigint.sql: -------------------------------------------------------------------------------- 1 | select to_json( 2 | case when ((__local_0__."int8")) is null then null else json_build_object( 3 | 'start', 4 | case when lower((__local_0__."int8")) is null then null else json_build_object( 5 | 'value', 6 | ( 7 | lower((__local_0__."int8")) 8 | )::text, 9 | 'inclusive', 10 | lower_inc((__local_0__."int8")) 11 | ) end, 12 | 'end', 13 | case when upper((__local_0__."int8")) is null then null else json_build_object( 14 | 'value', 15 | ( 16 | upper((__local_0__."int8")) 17 | )::text, 18 | 'inclusive', 19 | upper_inc((__local_0__."int8")) 20 | ) end 21 | ) end 22 | ) as "int8" 23 | from "ranges"."range_test" as __local_0__ 24 | where ( 25 | __local_0__."id" = $1 26 | ) and (TRUE) and (TRUE) -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/ranges/bigint.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | ## expect(data.rangeTestById.int8).toEqual({ start: { value: "-98765432109876543", inclusive: true }, end: { value: "22222222222222222", inclusive: false } }) 3 | #> schema: ['ranges'] 4 | {rangeTestById(id:934) {int8{start {value inclusive} end { value inclusive } }}} 5 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/ranges/numeric.json5: -------------------------------------------------------------------------------- 1 | { 2 | rangeTestById: { 3 | num: { 4 | start: { 5 | value: "-1234567890123456789.123456789012", 6 | inclusive: true, 7 | }, 8 | end: { 9 | value: "1111111111111111111.111111111111", 10 | inclusive: false, 11 | }, 12 | }, 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/ranges/numeric.sql: -------------------------------------------------------------------------------- 1 | select to_json( 2 | case when ((__local_0__."num")) is null then null else json_build_object( 3 | 'start', 4 | case when lower((__local_0__."num")) is null then null else json_build_object( 5 | 'value', 6 | ( 7 | lower((__local_0__."num")) 8 | )::text, 9 | 'inclusive', 10 | lower_inc((__local_0__."num")) 11 | ) end, 12 | 'end', 13 | case when upper((__local_0__."num")) is null then null else json_build_object( 14 | 'value', 15 | ( 16 | upper((__local_0__."num")) 17 | )::text, 18 | 'inclusive', 19 | upper_inc((__local_0__."num")) 20 | ) end 21 | ) end 22 | ) as "num" 23 | from "ranges"."range_test" as __local_0__ 24 | where ( 25 | __local_0__."id" = $1 26 | ) and (TRUE) and (TRUE) -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/ranges/numeric.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | ## expect(data.rangeTestById.num).toEqual({ start: { value: "-1234567890123456789.123456789012", inclusive: true }, end: { value: "1111111111111111111.111111111111", inclusive: false } }) 3 | #> schema: ['ranges'] 4 | {rangeTestById(id: 934) {num{start {value inclusive} end { value inclusive } }}} 5 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/ranges/ts.json5: -------------------------------------------------------------------------------- 1 | { 2 | rangeTestById: { 3 | ts: { 4 | start: { 5 | value: "2019-01-10T21:45:56.356022", 6 | inclusive: true, 7 | }, 8 | }, 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/ranges/ts.sql: -------------------------------------------------------------------------------- 1 | select to_json( 2 | case when ((__local_0__."ts")) is null then null else json_build_object( 3 | 'start', 4 | case when lower((__local_0__."ts")) is null then null else json_build_object( 5 | 'value', 6 | lower((__local_0__."ts")), 7 | 'inclusive', 8 | lower_inc((__local_0__."ts")) 9 | ) end, 10 | 'end', 11 | case when upper((__local_0__."ts")) is null then null else json_build_object( 12 | 'value', 13 | upper((__local_0__."ts")), 14 | 'inclusive', 15 | upper_inc((__local_0__."ts")) 16 | ) end 17 | ) end 18 | ) as "ts" 19 | from "ranges"."range_test" as __local_0__ 20 | where ( 21 | __local_0__."id" = $1 22 | ) and (TRUE) and (TRUE) -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/ranges/ts.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | ## expect(data.rangeTestById.ts).toEqual({ start: { value: "2019-01-10T21:45:56.356022", inclusive: true } }) 3 | #> schema: ['ranges'] 4 | {rangeTestById(id:934) {ts{start {value inclusive} }}} 5 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/ranges/tstz.json5: -------------------------------------------------------------------------------- 1 | { 2 | rangeTestById: { 3 | tstz: { 4 | start: { 5 | value: "2019-01-10T17:45:56.356022-04:00", 6 | inclusive: true, 7 | }, 8 | }, 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/ranges/tstz.sql: -------------------------------------------------------------------------------- 1 | select to_json( 2 | case when ((__local_0__."tstz")) is null then null else json_build_object( 3 | 'start', 4 | case when lower((__local_0__."tstz")) is null then null else json_build_object( 5 | 'value', 6 | lower((__local_0__."tstz")), 7 | 'inclusive', 8 | lower_inc((__local_0__."tstz")) 9 | ) end, 10 | 'end', 11 | case when upper((__local_0__."tstz")) is null then null else json_build_object( 12 | 'value', 13 | upper((__local_0__."tstz")), 14 | 'inclusive', 15 | upper_inc((__local_0__."tstz")) 16 | ) end 17 | ) end 18 | ) as "tstz" 19 | from "ranges"."range_test" as __local_0__ 20 | where ( 21 | __local_0__."id" = $1 22 | ) and (TRUE) and (TRUE) -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/queries/ranges/tstz.test.graphql: -------------------------------------------------------------------------------- 1 | ## expect(errors).toBeFalsy(); 2 | ## expect(data.rangeTestById.tstz).toEqual({ start: { value: "2019-01-10T17:45:56.356022-04:00", inclusive: true } }) 3 | #> schema: ['ranges'] 4 | {rangeTestById(id:934) {tstz{start {value inclusive} }}} 5 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/schemas/defaults.test.js: -------------------------------------------------------------------------------- 1 | import { testSchema } from "../helpers-v5"; 2 | 3 | it("schema", () => testSchema(__filename, {})); 4 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/schemas/mutation-no-fields.test.js: -------------------------------------------------------------------------------- 1 | import { testSchema } from "../helpers-v5"; 2 | 3 | it("prints a schema from a table with no mutable fields", () => 4 | testSchema(__filename, { 5 | schema: "no_fields", 6 | })); 7 | -------------------------------------------------------------------------------- /packages/postgraphile-core/__tests__/unit/__snapshots__/read-cache.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`When readCache is String if cache file has invalid content, getPostGraphileBuilder should error 1`] = `[Error: Failed to parse cache file 'path/to/cache', perhaps it is corrupted? SyntaxError: Unexpected token h in JSON at position 1]`; 4 | 5 | exports[`when readCache is not String or Object, getPostGraphileBuilder should error when its Array 1`] = `[Error: 'readCache' not understood; expected string or object, but received 'array']`; 6 | 7 | exports[`when readCache is not String or Object, getPostGraphileBuilder should error when its Boolean 1`] = `[Error: 'readCache' not understood; expected string or object, but received 'boolean']`; 8 | 9 | exports[`when readCache is not String or Object, getPostGraphileBuilder should error when its Number 1`] = `[Error: 'readCache' not understood; expected string or object, but received 'number']`; 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | snapshotSerializers: ["jest-serializer-graphql-schema"], 3 | transform: { 4 | "^.+\\.jsx?$": "../../.jest-wrapper.js", 5 | "^.+\\.graphql$": "/__tests__/transform-graphql.js", 6 | }, 7 | testRegex: "__tests__/.*\\.test\\.(?:js|ts|graphql)$", 8 | moduleFileExtensions: ["js", "ts", "graphql"], 9 | }; 10 | -------------------------------------------------------------------------------- /packages/postgraphile-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "declarationDir": "./node8plus", 6 | "outDir": "./node8plus" 7 | }, 8 | "include": ["src/**/*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/subscriptions-lds/.gitignore: -------------------------------------------------------------------------------- 1 | /dist/ 2 | -------------------------------------------------------------------------------- /packages/subscriptions-lds/LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright © `2019` Benjie Gillam 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the “Software”), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /packages/subscriptions-lds/SPONSORS.md: -------------------------------------------------------------------------------- 1 | # Sponsors 2 | 3 | These individuals and companies sponsor ongoing development of projects in 4 | the Graphile ecosystem. Find out [how you can become a 5 | sponsor](https://graphile.org/sponsor/). 6 | 7 | ## Featured 8 | 9 | - The Guild 10 | - Steelhead 11 | 12 | ## Leaders 13 | 14 | - Robert Claypool 15 | - Principia Mentis 16 | - nigelrmtaylor 17 | - Trigger.dev 18 | - Axinom 19 | - Taiste 20 | - BairesDev 21 | - Cintra 22 | - Two Bit Solutions 23 | - Dimply 24 | - Ndustrial 25 | - Apollo 26 | - Beacon 27 | - deliver.media 28 | - Ravio 29 | - prodready 30 | - Locomote 31 | 32 | ## Supporters 33 | 34 | - HR-ON 35 | - stlbucket 36 | - Simon Elliott 37 | - Matt Bretl 38 | - Alvin Ali Khaled 39 | - Paul Melnikow 40 | - Keith Layne 41 | - nullachtvierzehn 42 | - Zymego 43 | - garpulon 44 | - Ether 45 | - Nate Smith 46 | - The Outbound Collective 47 | - Charlie Hadden 48 | - Vizcom 49 | - Kiron Open Higher Education 50 | - Andrew Joseph 51 | - SIED 70 - TE 70 52 | - Peter C. Romano 53 | - mateo 54 | - Dialo 55 | - kontakto-fi 56 | - Tailos, Inc. 57 | - sheilamosaik 58 | - Jody Hoon-Starr 59 | - Justin Carrus 60 | - WorkOS 61 | -------------------------------------------------------------------------------- /packages/subscriptions-lds/__tests__/schema.sql: -------------------------------------------------------------------------------- 1 | \ir ../../lds/__tests__/schema.sql -------------------------------------------------------------------------------- /packages/subscriptions-lds/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | roots: ["/src", "/__tests__"], 3 | transform: { 4 | "^.+\\.tsx?$": "ts-jest", 5 | }, 6 | testRegex: "(/__tests__/.*\\.(test|spec))\\.[tj]sx?$", 7 | moduleFileExtensions: ["ts", "js", "json"], 8 | }; 9 | -------------------------------------------------------------------------------- /packages/subscriptions-lds/src/index.ts: -------------------------------------------------------------------------------- 1 | import PgLDSSourcePlugin from "./PgLDSSourcePlugin"; 2 | 3 | /* 4 | * Create subscription fields for query fields (and instant-trigger). 5 | * When subscription fields resolve, track the records that go out. 6 | * Subscribe to LDS for these records/collections. 7 | * When LDS announces change to relevant record/collection, re-run subscription. 8 | */ 9 | const SubscriptionsLdsPlugin = PgLDSSourcePlugin; 10 | 11 | export default SubscriptionsLdsPlugin; 12 | -------------------------------------------------------------------------------- /packages/subscriptions-lds/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "declarationDir": "./dist", 6 | "outDir": "./dist" 7 | }, 8 | "include": ["src/**/*"] 9 | } 10 | -------------------------------------------------------------------------------- /release: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | echo "BOOTSTRAP" 4 | yarn lerna bootstrap 5 | echo "CLEANING BUILT FILES" 6 | yarn clean 7 | echo "PREPACKING" 8 | yarn prepack:all 9 | echo "TEST" 10 | yarn test 11 | 12 | TAG="${1:-next}" 13 | 14 | # Only shift if there's something to shift 15 | if [ "x$1" != "x" ]; then shift; fi; 16 | 17 | npx lerna publish --exact --dist-tag="$TAG" "$@" 18 | yarn run changelog 19 | git add CHANGELOG.md 20 | git commit -m"chore: update CHANGELOG" 21 | git push && git push --tags 22 | -------------------------------------------------------------------------------- /scripts/CHANGELOG_HEADER.md: -------------------------------------------------------------------------------- 1 | # [SEE POSTGRAPHILE RELEASES INSTEAD](https://github.com/graphile/postgraphile/releases) 2 | 3 | We use PostGraphile's GitHub releases tab to log our changes in detail, but 4 | this auto-generated changelog helps us to produce that list, and it may be 5 | helpful to you also. 6 | -------------------------------------------------------------------------------- /scripts/ci: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PATH="$PATH:`pwd`/node_modules/.bin" 4 | 5 | set -e 6 | for I in packages/*/; do 7 | if [[ "$PGVERSION" != "9.4" || ( "$I" != "packages/lds/" && "$I" != "packages/subscriptions-lds/" ) ]]; then 8 | cd $I 9 | npm run test 10 | cd - 11 | fi; 12 | done 13 | -------------------------------------------------------------------------------- /scripts/prepack-all: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | cd packages; 4 | # Do not run this in parallel; build order matters due to TypeScript. 5 | for PACKAGE in jest-serializer-graphql-schema graphile lru pg-sql2 graphile-build graphile-build-pg graphql-parse-resolve-info graphile-utils postgraphile-core lds subscriptions-lds pg-pubsub; do 6 | cd $PACKAGE; 7 | npm run prepack; 8 | cd -; 9 | done; 10 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "allowJs": false, 5 | "target": "es2017", 6 | "module": "commonjs", 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "pretty": true, 10 | "importHelpers": true, 11 | "experimentalDecorators": true, 12 | "noImplicitAny": true, 13 | "suppressImplicitAnyIndexErrors": true, 14 | "strictNullChecks": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "noUnusedParameters": true, 17 | "noUnusedLocals": true, 18 | "preserveWatchOutput": true, 19 | "lib": ["es2018", "esnext.asynciterable"] 20 | }, 21 | "exclude": ["node_modules", "node8plus", "build-turbo"] 22 | } 23 | --------------------------------------------------------------------------------