-
Notifications
You must be signed in to change notification settings - Fork 9
/
api.go
84 lines (71 loc) · 2.19 KB
/
api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright 2022 Namespace Labs Inc; All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
package shared
import (
"namespacelabs.dev/foundation/schema"
"namespacelabs.dev/foundation/std/pkggraph"
)
type ServerData struct {
Services []EmbeddedServiceData
ImportedInitializers []pkggraph.Location
}
type EmbeddedServiceData struct {
Location pkggraph.Location
HasDeps bool
}
type NodeData struct {
Kind schema.Node_Kind
PackageName string
Deps []DependencyData
Providers []ProviderData
ImportedInitializers []pkggraph.Location
Initializer *PackageInitializerData
}
type PackageInitializerData struct {
// List of packages that need to be initialized before this package. Enforced at runtime.
InitializeBefore []string
InitializeAfter []string
}
type ProtoTypeKind int32
const (
ProtoMessage ProtoTypeKind = iota
ProtoService
)
type ProtoTypeData struct {
Name string
SourceFileName string
Location pkggraph.Location
// Distinguishing between message and service types because they need to be imported from different files in node.js
Kind ProtoTypeKind
}
type ProviderData struct {
Name string
Location pkggraph.Location
InputType ProtoTypeData
ProviderType ProviderTypeData
ScopedDeps []DependencyData
}
// Only one of these two fields is set.
type ProviderTypeData struct {
// Regular case: the user specific the type of the provider in `availableIn`.
ParsedType *schema.Provides_AvailableIn
// std/grpc extension: the provider type `<service-name>Client` is generated at runtime.
// Only can happen within DependencyData.
Type *ProtoTypeData
// If true, the provider can return different types dependning on the usage context.\
// Used to implement gRPC client injection.
IsParameterized bool
}
type DependencyData struct {
Name string
ProviderName string
ProviderInputType ProtoTypeData
ProviderType ProviderTypeData
ProviderLocation pkggraph.Location
ProviderInput SerializedProto
}
type SerializedProto struct {
Content []byte
Comments []string
}