MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / main

Function main

tools/generate_allowed_field_mask_paths.go:29–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27var exceptions = make(map[string]func([]string) []string, 0)
28
29func main() {
30 messagesFile := "sdk/js/generated/allowed-field-mask-paths.json"
31 if len(os.Args) == 2 {
32 messagesFile = os.Args[1]
33 }
34
35 data, err := json.MarshalIndent(func() map[string][]string {
36 ret := make(map[string][]string, len(ttnpb.RPCFieldMaskPaths))
37 for rpc, v := range ttnpb.RPCFieldMaskPaths {
38 f, ok := exceptions[rpc]
39 if ok {
40 ret[rpc] = f(v.Allowed)
41 } else {
42 ret[rpc] = v.Allowed
43 }
44 }
45 return ret
46 }(), "", " ")
47 if err != nil {
48 panic(err)
49 }
50
51 if err = os.WriteFile(messagesFile, data, 0o644); err != nil {
52 panic(err)
53 }
54}
55
56func init() {
57 // This prevents the console from accessing the JS for CAC related operations.

Callers

nothing calls this directly

Calls 1

WriteFileMethod · 0.80

Tested by

no test coverage detected