# 1. Required EDFS Directives directive @edfs__natsPublish(subject: String!, providerId: String! = "default") on FIELD_DEFINITION directive @edfs__natsRequest(subject: String!, providerId: String! = "default") on FIELD_DEFINITION directive @edfs__natsSubscribe(subjects: [String!]!, providerId: String! = "default") on FIELD_DEFINITION # 2. Result type ONLY for Mutations type edfs__PublishResult { success: Boolean! } scalar JSONB #input CreateRequestLogInput { # content_hash: String! # payload: JSONB! #} # 3. Mutation (Follows Rule #1: Must return edfs__PublishResult) type Mutation { createUser(id: ID!, username: String!, email: String!): edfs__PublishResult! @edfs__natsPublish(subject: "user.created", providerId: "my-nats") createRequestLog( content: String!, producer_timestamp: String!, source: String!): edfs__PublishResult! @edfs__natsPublish( subject: "input_request_logs", providerId: "my-nats" ) } # 4a. Reference the Entity from your Python subgraph #type User @key(fields: "id", resolvable: false) { # id: ID! @external #} # 4b. Faster then 4a without communicating with python subgraph container type User @key(fields: "id username email", resolvable: false) { id: ID! @external username: String! @external email: String! @external } type Query { # Root fields MUST have a directive. _natsHealthCheck: User! @edfs__natsRequest(subject: "health.check", providerId: "my-nats") } type Subscription { # FIX: Changed directive name to @edfs__natsSubscribe and used 'subjects' (plural/list) userCreatedStream: User! @edfs__natsSubscribe(subjects: ["user.created"], providerId: "my-nats") }