-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API Migrate code and docs from other modules
- Loading branch information
1 parent
58efda3
commit ca71747
Showing
76 changed files
with
8,685 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
modelConfig: | ||
DataObject: | ||
plugins: | ||
versioning: | ||
before: inheritance | ||
operations: | ||
copyToStage: | ||
class: SilverStripe\Versioned\GraphQL\Operations\CopyToStageCreator | ||
publish: | ||
class: SilverStripe\Versioned\GraphQL\Operations\PublishCreator | ||
unpublish: | ||
class: SilverStripe\Versioned\GraphQL\Operations\UnpublishCreator | ||
rollback: | ||
class: SilverStripe\Versioned\GraphQL\Operations\RollbackCreator | ||
read: | ||
plugins: | ||
readVersion: | ||
before: paginateList | ||
readOne: | ||
plugins: | ||
readVersion: | ||
before: firstResult | ||
delete: | ||
plugins: | ||
unpublishOnDelete: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
VersionedStage: | ||
description: The stage to read from or write to | ||
values: | ||
DRAFT: | ||
value: Stage | ||
description: The draft stage | ||
LIVE: | ||
value: Live | ||
description: The live stage | ||
|
||
VersionedQueryMode: | ||
description: The versioned mode to use | ||
values: | ||
ARCHIVE: | ||
value: archive | ||
description: Read from a specific date of the archive | ||
LATEST: | ||
value: latest_versions | ||
description: Read the latest version | ||
ALL_VERSIONS: | ||
value: all_versions | ||
description: Reads all versionse | ||
DRAFT: | ||
value: Stage | ||
description: Read from the draft stage | ||
LIVE: | ||
value: Live | ||
description: Read from the live stage | ||
STATUS: | ||
value: status | ||
description: Read only records with a specific status | ||
VERSION: | ||
value: version | ||
description: Read a specific version | ||
|
||
VersionedStatus: | ||
description: The stage to read from or write to | ||
values: | ||
PUBLISHED: | ||
value: published | ||
description: Only published records | ||
DRAFT: | ||
value: draft | ||
description: Only draft records | ||
ARCHIVED: | ||
value: archived | ||
description: Only records that have been archived | ||
MODIFIED: | ||
value: modified | ||
description: Only records that have unpublished changes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
CopyToStageInputType: | ||
input: true | ||
fields: | ||
id: | ||
type: ID! | ||
description: The ID of the record to copy | ||
fromVersion: | ||
type: Int | ||
description: The source version number to copy | ||
fromStage: | ||
type: VersionedStage | ||
description: The source stage to copy | ||
toStage: | ||
type: VersionedStage | ||
description: The destination state to copy to | ||
|
||
VersionedInputType: | ||
input: true | ||
fields: | ||
mode: VersionedQueryMode = Stage | ||
archiveDate: | ||
type: String | ||
description: The date to use for archive | ||
status: | ||
type: '[VersionedStatus]' | ||
description: If mode is STATUS, specify which versioned statuses | ||
version: Int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
Name: graphql-versioned-schema | ||
Only: | ||
moduleexists: 'silverstripe/versioned' | ||
--- | ||
SilverStripe\GraphQL\Schema\Schema: | ||
schemas: | ||
'*': | ||
src: | ||
versionedSrc: 'silverstripe/graphql: _versioned' | ||
--- | ||
Name: graphql-versioned-plugins | ||
Only: | ||
moduleexists: 'silverstripe/versioned' | ||
--- | ||
SilverStripe\Core\Injector\Injector: | ||
SilverStripe\GraphQL\Schema\Registry\PluginRegistry: | ||
constructor: | ||
- 'SilverStripe\GraphQL\Modules\Versioned\Plugins\VersionedDataObject' | ||
- 'SilverStripe\GraphQL\Modules\Versioned\Plugins\UnpublishOnDelete' | ||
- 'SilverStripe\GraphQL\Modules\Versioned\Plugins\VersionedRead' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
title: Activating the default server | ||
summary: Open up the default server that comes pre-configured with the module | ||
icon: rocket | ||
--- | ||
|
||
# Getting started | ||
|
||
[CHILDREN asList] | ||
|
||
## Activating the default GraphQL server | ||
|
||
GraphQL is used through a single route, typically `/graphql`. You need | ||
to define *types* and *queries* to expose your data via this endpoint. | ||
|
||
These separate endpoints have their own identifiers. `default` refers to the GraphQL server | ||
in the user space (e.g. `/graphql`) - i.e. your custom schema. You can also [set up a new schema server](#setting-up-a-custom-graphql-server) | ||
if you wish. | ||
|
||
> [!NOTE] | ||
> The word "server" here refers to a route with its own isolated GraphQL schema. It does | ||
> not refer to a web server. | ||
By default, `silverstripe/graphql` does not route any GraphQL servers. To activate the default, | ||
public-facing GraphQL server that ships with the module, just add a rule to [`Director`](api:SilverStripe\Control\Director). | ||
|
||
```yml | ||
SilverStripe\Control\Director: | ||
rules: | ||
'graphql': '%$SilverStripe\GraphQL\Controller.default' | ||
``` | ||
## Setting up a custom GraphQL server | ||
In addition to the default `/graphql` endpoint provided by this module by default, | ||
you may want to set up another GraphQL server running on the same installation of Silverstripe CMS. | ||
|
||
Let's set up a new controller to handle the requests. | ||
|
||
```yml | ||
SilverStripe\Core\Injector\Injector: | ||
# ... | ||
SilverStripe\GraphQL\Controller.myNewSchema: | ||
class: SilverStripe\GraphQL\Controller | ||
constructor: | ||
schemaKey: myNewSchema | ||
``` | ||
|
||
We'll now need to route the controller. | ||
|
||
```yml | ||
SilverStripe\Control\Director: | ||
rules: | ||
'my-graphql': '%$SilverStripe\GraphQL\Controller.myNewSchema' | ||
``` | ||
|
||
Now, once you have [configured](configuring_your_schema) and [built](building_the_schema) your schema, you | ||
can access it at `/my-graphql`. | ||
|
||
### Further reading | ||
|
||
[CHILDREN] |
Oops, something went wrong.