/ src / Adapter.res
Adapter.res
 1  // SPDX-License-Identifier: MIT
 2  // SPDX-FileCopyrightText: 2025 Jonathan D.A. Jewell
 3  
 4  /// Adapter interface types for IaC tools
 5  
 6  type paramDef = {
 7    @as("type") type_: string,
 8    description: string,
 9  }
10  
11  type toolDef = {
12    description: string,
13    params: dict<paramDef>,
14    handler: dict<JSON.t> => promise<JSON.t>,
15  }
16  
17  module type Adapter = {
18    let name: string
19    let description: string
20    let connect: unit => promise<unit>
21    let disconnect: unit => promise<unit>
22    let isConnected: unit => promise<bool>
23    let tools: dict<toolDef>
24  }
25  
26  let makeParam = (~type_: string, ~description: string): paramDef => {
27    {type_, description}
28  }
29  
30  let stringParam = (~description: string): paramDef => {
31    makeParam(~type_="string", ~description)
32  }
33  
34  let boolParam = (~description: string): paramDef => {
35    makeParam(~type_="boolean", ~description)
36  }
37  
38  let numberParam = (~description: string): paramDef => {
39    makeParam(~type_="number", ~description)
40  }