@devkong/cli-nx 0.0.67-alpha.16 → 0.0.67-alpha.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devkong/cli-nx",
3
- "version": "0.0.67-alpha.16",
3
+ "version": "0.0.67-alpha.18",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./src/index.d.ts",
@@ -4,7 +4,7 @@ kotlin.code.style=official
4
4
  javaVersion=21
5
5
 
6
6
  # kong artifacts
7
- kongVersion=0.0.34-SNAPSHOT
7
+ kongVersion=0.0.40-SNAPSHOT
8
8
 
9
9
  # https://mvnrepository.com/artifact/org.jlleitschuh.gradle/ktlint-gradle
10
10
  jlleitschuhGradlePluginVersion=14.0.1
@@ -13,7 +13,7 @@ jlleitschuhGradlePluginVersion=14.0.1
13
13
  jsonSchemaValidatorVersion=1.5.8
14
14
 
15
15
  # https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib
16
- kotlinVersion=2.1.10
16
+ kotlinVersion=2.1.21
17
17
 
18
18
  # https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-test
19
19
  kotlinxCoroutinesTestVersion=1.10.2
@@ -22,4 +22,4 @@ kotlinxCoroutinesTestVersion=1.10.2
22
22
  nxGradleVersion=0.1.21
23
23
 
24
24
  # https://mvnrepository.com/artifact/io.quarkus/quarkus-core
25
- quarkusVersion=3.20.3
25
+ quarkusVersion=3.27.3
@@ -5,14 +5,6 @@ import io.kong.sdk.KongFunctionRequest
5
5
  import io.kong.sdk.function.template.Field
6
6
  import io.quarkus.runtime.annotations.RegisterForReflection
7
7
 
8
- // Define the structure of the input data that your extension will accept.
9
- // Be sure to include example values for each field. These examples help generate
10
- // sample objects in the UI, making it easier to work with the models.
11
- //
12
- // InputData implements KongFunctionContract: `request.operation` selects which
13
- // calculation Main.handle runs, and the operand payload for that operation
14
- // (`sum`, `sub`, `multiply` or `divide`) is the one it reads.
15
-
16
8
  @RegisterForReflection
17
9
  data class OperationData(
18
10
  @Field(description = "An integer number", examples = ["1"]) val a: Int,
@@ -7,9 +7,6 @@ import io.kong.sdk.KongFunctionContext
7
7
  import jakarta.inject.Inject
8
8
  import jakarta.inject.Singleton
9
9
 
10
- // This is the main entry point for developing an extension for Kong.
11
- // For more details, please refer to the README.md file.
12
-
13
10
  @Singleton
14
11
  class Main : KongFunction<InputData>(InputData::class.java) {
15
12
  private val logger = AppLogger(Main::class.simpleName)
@@ -21,8 +18,6 @@ class Main : KongFunction<InputData>(InputData::class.java) {
21
18
  data: InputData,
22
19
  context: KongFunctionContext,
23
20
  ): ByteArray? {
24
- // `request.operation` comes from the KongFunctionContract the input implements;
25
- // branch on it and read the matching operand payload.
26
21
  val operation = data.request.operation
27
22
 
28
23
  logger.info("handle operation") {
@@ -3,10 +3,8 @@ package io.kong.extension
3
3
  import io.kong.sdk.function.template.Field
4
4
  import io.quarkus.runtime.annotations.RegisterForReflection
5
5
 
6
- // Define the structure of the output data that your extension will return.
7
6
  @RegisterForReflection
8
7
  data class OutputData(
9
- // REPLACE BELLOW WITH YOUR FIELDS
10
8
  @Field(description = "Result of applying the operation to a and b", examples = ["3"])
11
9
  val result: Int,
12
10
  @Field(
@@ -8,7 +8,7 @@ import jakarta.inject.Inject
8
8
  import jakarta.inject.Singleton
9
9
 
10
10
  @Singleton
11
- class RegisterKongFrontend {
11
+ class RegisterFrontend {
12
12
  @Inject
13
13
  internal lateinit var jsonMapper: ObjectMapper
14
14
 
@@ -28,7 +28,7 @@ class Test {
28
28
  runTest {
29
29
  val input =
30
30
  InputData(
31
- request = KongFunctionRequest(operation = "sum", form = null),
31
+ request = KongFunctionRequest(operation = "sum"),
32
32
  sum = OperationData(a = 1, b = 2),
33
33
  )
34
34
 
@@ -37,19 +37,4 @@ class Test {
37
37
 
38
38
  assertEquals(3, output.result)
39
39
  }
40
-
41
- @Test
42
- fun `when operation is multiply then returns the product`() =
43
- runTest {
44
- val input =
45
- InputData(
46
- request = KongFunctionRequest(operation = "multiply", form = null),
47
- multiply = OperationData(a = 4, b = 5),
48
- )
49
-
50
- val bytes = extension.handle(input, testContext.create())
51
- val output = jsonMapper.readValue(bytes, OutputData::class.java)
52
-
53
- assertEquals(20, output.result)
54
- }
55
40
  }
@@ -2,13 +2,6 @@ from pydantic import BaseModel, Field
2
2
 
3
3
 
4
4
  class InputData(BaseModel):
5
- # Define the structure of the input data that your extension will accept.
6
- # Be sure to include example values for each field. These examples help generate
7
- # sample objects in the UI, making it easier to work with the models.
8
- # For more standard types, refer to: https://docs.pydantic.dev/latest/concepts/types/
9
-
10
- # REPLACE BELLOW WITH YOUR FIELDS
11
-
12
5
  a: int = Field(
13
6
  examples=[1],
14
7
  description="An integer number",
@@ -8,18 +8,9 @@ from frontend import frontend
8
8
  from input_data import InputData
9
9
  from output_data import OutputData
10
10
 
11
- # This script is for developing an extension for Kong.
12
- # For more details, please refer to the README.md file.
13
-
14
11
 
15
12
  class Main(KongFunction):
16
- # This is where you implement the logic to handle the input data
17
- # and produce the output.
18
-
19
- # OVERRIDE BELLOW TO CUSTOMIZE THE PROCESSING.
20
-
21
13
  async def handle(self, data: InputData, context: KongFunctionContext) -> OutputData:
22
- # `context.secret.get("<purpose>")` resolves secrets declared in frontend.py.
23
14
  return OutputData(
24
15
  sum_of=data.a + data.b,
25
16
  comment=f"sum of {data.a} and {data.b}",
@@ -5,13 +5,11 @@ from input_data import InputData
5
5
  from main import Main
6
6
 
7
7
 
8
- # The test function to validate the behavior of the extension
9
8
  async def test_should_return_value_from_string_field_when_input_is_provided(
10
9
  create_extension: ExtensionFixture,
11
10
  ):
12
11
  extension = create_extension(Main, InputData)
13
12
 
14
- # Prepare the input data
15
13
  input_data = InputData(
16
14
  a=1,
17
15
  b=2,
@@ -4,10 +4,6 @@ from pydantic import BaseModel, Field
4
4
 
5
5
 
6
6
  class OutputData(BaseModel):
7
- # Define the structure of the output data that your extension will return.
8
-
9
- # REPLACE BELLOW WITH YOUR FIELDS
10
-
11
7
  sum_of: int = Field(
12
8
  examples=[3],
13
9
  description="Result of a + b",