GenCaster Base#

In this module we will find all things concerning connection and.

As it is difficult to split GraphQL endpoints across apps we also define them here as reusability of the apps is probably not a concern for now and is more used to split different parts for testing purposes.

Schema#

Here we define all the endpoints for GraphQL.

For a specific details of the types consider the GraphiQL page available under the /graphql endpoint of the running backend.

Any subscription updates are messaged via Redis and is handled via channels and has an abstraction layer GenCasterChannel.

class gencaster.schema.AuthStrawberryDjangoField(*args, only=None, select_related=None, prefetch_related=None, disable_optimization=False, **kwargs)[source]#

Allows us to restrict certain actions to logged in users.

class gencaster.schema.IsAuthenticated[source]#
class gencaster.schema.LoginError(*, error_message=None)[source]#
__init__(*, error_message=None)#
class gencaster.schema.Mutation[source]#

Mutations for Gencaster via GraphQL.

__init__()#
async add_edge(info, new_edge)[source]#

Creates a Edge for a given Graph. It returns the created edge.

Return type:

Edge

async add_node(info, new_node)[source]#

Creates a new Node in a given ~class:~story_graph.models.Graph. Although it creates a new node with UUID we don’t hand it back yet.

Return type:

None

async create_script_cells(info, script_cell_inputs, node_uuid)[source]#

Creates or updates a given ScriptCell to change its content.

Return type:

List[ScriptCell]

async delete_edge(info, edge_uuid)[source]#

Deletes a given Edge.

Return type:

None

async delete_node(info, node_uuid)[source]#

Deletes a given Node.

Return type:

None

async delete_node_door(info, node_door_uuid)[source]#

Allows to delete a non-default NodeDoor. If a node door was deleted it will return True, otherwise False.

Return type:

bool

async delete_script_cell(info, script_cell_uuid)[source]#

Deletes a given ScriptCell.

Return type:

None

async update_audio_file(info, uuid, update_audio_file)[source]#

Update metadata of an AudioFile via a UUID

Return type:

AudioFile

async update_node(info, node_update)[source]#

Updates a given Node which can be used for renaming or moving it across the canvas.

Return type:

None

class gencaster.schema.Query(*, stream_point, stream_points, graphs, graph, nodes, node, audio_files, audio_file, stream_variable)[source]#

Queries for Gencaster.

__init__(*, stream_point, stream_points, graphs, graph, nodes, node, audio_files, audio_file, stream_variable)#
class gencaster.schema.Subscription[source]#
__init__()#
async graph(info, graph_uuid)[source]#

Used within the editor to synchronize any updates of the graph such as movement of a Node.

Return type:

AsyncGenerator[Graph, None]

async node(info, node_uuid)[source]#

Used within the editor to synchronize any updates on a node such as updates on a ScriptCell.

Return type:

AsyncGenerator[Node, None]

async stream_info(info, graph_uuid)[source]#

Used within the frontend to attach a user to a stream. Engine contains the specifics of how the iteration over a graph is handled.

Upon visit the num_of_listeners of the associated :class:~stream.models.Stream` will be incremented which indicates if a given stream is free or used. Upon connection stop this will be decremented again.

Return type:

AsyncGenerator[StrawberryUnion, None]

class gencaster.schema.User(*, username, is_staff, is_active, first_name, last_name, email)[source]#
__init__(*, username, is_staff, is_active, first_name, last_name, email)#
async gencaster.schema.graphql_check_authenticated(info)[source]#

Helper function to determine if we are loggin in an async manner.

This would be better a decorator but strawberry is not nice in these regards, see Stack Overflow.

async gencaster.schema.update_or_create_audio_cell(audio_cell_input)[source]#

Async function to update audio cells

Return type:

Optional[AudioCell]

Distributor#

A collection of async messaging tools which is used by our GraphQL schema.

class gencaster.distributor.GenCasterChannel[source]#

Abstraction layer for channels.

Publish and subscribe to specific updates or more general ones as well.

__init__()[source]#
class gencaster.distributor.GraphQLWSConsumerInjector(*args, **kwargs)[source]#

Allows us to inject callbacks on e.g. a disconnect.

Todo

This can be made obsolete via strawberry-graphql/strawberry#2430

__init__(*args, **kwargs)[source]#
async receive(*args, **kwargs)[source]#

Called with a decoded WebSocket frame.

Return type:

None

async websocket_disconnect(message)[source]#

Called when a WebSocket connection is closed. Base level so you don’t need to call super() all the time.

class gencaster.distributor.GraphUpdateMessage(uuid, type='graph.update', additional_channels=<factory>)[source]#
__init__(uuid, type='graph.update', additional_channels=<factory>)#
exception gencaster.distributor.MissingChannelLayer[source]#
class gencaster.distributor.NodeUpdateMessage(uuid, type='node.update', additional_channels=<factory>)[source]#
__init__(uuid, type='node.update', additional_channels=<factory>)#
class gencaster.distributor.StreamLogUpdateMessage(uuid, stream_point_uuid, stream_uuid, type='stream_log.update', additional_channels=<factory>)[source]#
__init__(uuid, stream_point_uuid, stream_uuid, type='stream_log.update', additional_channels=<factory>)#
class gencaster.distributor.StreamsUpdateMessage(uuid, type='streams.update', additional_channels=<factory>)[source]#
__init__(uuid, type='streams.update', additional_channels=<factory>)#
gencaster.distributor.uuid_to_group(u)[source]#

Channel group names are not allow to have -, so we replace them with _.

Return type:

str

Settings#

Configure environment for Gencaster backend.

Base settings#

Configures plugins, database, logging and media assets configuration.

Test#

Settings to run tests in by using local sqlite database.

Development#

Development#

Configures settings to allow access from local node environments.

Local development#

Switch to local sqlite database.

Deployment#

Deploy Dev#

Settings for deploying “production” dev environment on the server via Docker.

ASGI config for gencaster project.