installCoreInterfaces registers Dagger-specific interfaces. Like all dagql interfaces, these are matched structurally: any object whose fields line up automatically declares conformance, with no explicit implements declaration. Unlike Node (which lives in dagql and is pure GraphQL infrastructure),
(srv *dagql.Server)
| 9 | // Unlike Node (which lives in dagql and is pure GraphQL infrastructure), |
| 10 | // these interfaces encode Dagger-specific semantics. |
| 11 | func installCoreInterfaces(srv *dagql.Server) { |
| 12 | syncer := dagql.NewInterface("Syncer", dagql.FormatDescription( |
| 13 | `An object that can be force-evaluated.`, |
| 14 | `Calling sync ensures that the object's entire dependency DAG has been evaluated, returning the object's ID once complete.`, |
| 15 | )) |
| 16 | syncer.AddField(dagql.InterfaceFieldSpec{ |
| 17 | FieldSpec: dagql.FieldSpec{ |
| 18 | Name: "id", |
| 19 | Type: dagql.AnyID{}, |
| 20 | }, |
| 21 | }) |
| 22 | syncer.AddField(dagql.InterfaceFieldSpec{ |
| 23 | FieldSpec: dagql.FieldSpec{ |
| 24 | Name: "sync", |
| 25 | Type: dagql.AnyID{}, |
| 26 | }, |
| 27 | }) |
| 28 | srv.InstallInterface(syncer) |
| 29 | |
| 30 | exportable := dagql.NewInterface("Exportable", dagql.FormatDescription( |
| 31 | `An object that can be exported to the host.`, |
| 32 | `Calling export writes the object to a path on the host filesystem and returns the path that was written.`, |
| 33 | )) |
| 34 | exportable.AddField(dagql.InterfaceFieldSpec{ |
| 35 | FieldSpec: dagql.FieldSpec{ |
| 36 | Name: "id", |
| 37 | Type: dagql.AnyID{}, |
| 38 | }, |
| 39 | }) |
| 40 | exportable.AddField(dagql.InterfaceFieldSpec{ |
| 41 | FieldSpec: dagql.FieldSpec{ |
| 42 | Name: "export", |
| 43 | Type: dagql.String(""), |
| 44 | Args: dagql.NewInputSpecs( |
| 45 | dagql.InputSpec{Name: "path", Type: dagql.String("")}, |
| 46 | ), |
| 47 | }, |
| 48 | }) |
| 49 | srv.InstallInterface(exportable) |
| 50 | } |
no test coverage detected