@devkong/cli-nx 0.0.33 → 0.0.34
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 +1 -1
- package/src/generators/preset/files/kotlin/build.gradle.kts.template +2 -2
- package/src/generators/preset/files/kotlin/extension.http +3 -9
- package/src/generators/preset/files/kotlin/src/main/kotlin/io/kong/extension/Main.kt +4 -5
- package/src/generators/preset/files/python/Dockerfile +2 -1
- package/src/generators/preset/files/python/requirements.txt +1 -1
- package/src/generators/preset/files/python/src/main.py +2 -2
- package/src/generators/preset/files/python/src/main_test.py +2 -2
package/package.json
CHANGED
|
@@ -20,8 +20,8 @@ repositories {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
dependencies {
|
|
23
|
-
implementation("io.kong:kong-common:0.0.
|
|
24
|
-
implementation("io.kong:kong-sdk-kotlin:0.0.
|
|
23
|
+
implementation("io.kong:kong-common:0.0.7-SNAPSHOT")
|
|
24
|
+
implementation("io.kong:kong-sdk-kotlin:0.0.31-SNAPSHOT")
|
|
25
25
|
|
|
26
26
|
implementation(enforcedPlatform("io.quarkus.platform:quarkus-bom:$quarkusVersion"))
|
|
27
27
|
implementation("io.quarkus:quarkus-arc")
|
|
@@ -17,13 +17,14 @@ Content-Type: application/cloudevents+json
|
|
|
17
17
|
"datacontenttype": "application/json",
|
|
18
18
|
"sessionagent": "JOB",
|
|
19
19
|
"sessionid": "1",
|
|
20
|
+
"sessionrootid": null,
|
|
20
21
|
"sessionparentid": null,
|
|
21
22
|
"sessiontenant": "sanb",
|
|
23
|
+
"sessionrootcreated": "2024-01-01T12:00:00Z",
|
|
22
24
|
"sessioncreated": "2024-01-01T12:00:00Z",
|
|
23
25
|
"sessionbusinesskey": "ABC123",
|
|
24
26
|
"sessionsource": "/idea/http",
|
|
25
|
-
"sessiontopic": "/sandbox/test",
|
|
26
|
-
"sessionpartition": 0,
|
|
27
|
+
"sessiontopic": "/sandbox/test-events",
|
|
27
28
|
"sessionpriority": "MAIN",
|
|
28
29
|
"sessionexecutionmode": "SYNC",
|
|
29
30
|
"sessiondeadline": "2024-12-31T23:59:59Z",
|
|
@@ -40,13 +41,6 @@ Content-Type: application/cloudevents+json
|
|
|
40
41
|
}
|
|
41
42
|
},
|
|
42
43
|
"output": {
|
|
43
|
-
"ack": {
|
|
44
|
-
"producer": {
|
|
45
|
-
"id": "PROCESS_EVENT_ID_001",
|
|
46
|
-
"type": "KongProcessEvent"
|
|
47
|
-
},
|
|
48
|
-
"seqNum": 42
|
|
49
|
-
},
|
|
50
44
|
"type": "kong-process-events",
|
|
51
45
|
"filter": ".output",
|
|
52
46
|
"returns": []
|
|
@@ -34,10 +34,9 @@ data class OutputData(
|
|
|
34
34
|
val objectMapper = ObjectMapper()
|
|
35
35
|
|
|
36
36
|
@Singleton
|
|
37
|
-
class
|
|
38
|
-
private val logger = AppLogger(
|
|
37
|
+
class Main : KongFunction<InputData>(InputData::class.java) {
|
|
38
|
+
private val logger = AppLogger(Main::class.simpleName)
|
|
39
39
|
|
|
40
|
-
override suspend fun handle(data: InputData): JsonNode?
|
|
41
|
-
|
|
42
|
-
}
|
|
40
|
+
override suspend fun handle(data: InputData): JsonNode? =
|
|
41
|
+
objectMapper.valueToTree(OutputData(sum_of = data.a + data.b))
|
|
43
42
|
}
|
|
@@ -5,7 +5,8 @@ FROM --platform=linux/amd64 python:3.13.1-slim-bullseye
|
|
|
5
5
|
ENV APP_DIR=/deployments/app
|
|
6
6
|
|
|
7
7
|
COPY ./requirements.txt $APP_DIR/requirements.txt
|
|
8
|
-
|
|
8
|
+
COPY ./requirements-lock.txt $APP_DIR/requirements-lock.txt
|
|
9
|
+
RUN pip install -r $APP_DIR/requirements-lock.txt -r $APP_DIR/requirements.txt
|
|
9
10
|
|
|
10
11
|
COPY ./src $APP_DIR/src
|
|
11
12
|
WORKDIR $APP_DIR
|
|
@@ -44,7 +44,7 @@ class OutputData(BaseModel):
|
|
|
44
44
|
)
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
class
|
|
47
|
+
class Main(KongFunction):
|
|
48
48
|
# This is where you implement the logic to handle the input data
|
|
49
49
|
# and produce the output.
|
|
50
50
|
|
|
@@ -60,7 +60,7 @@ class MyExtension(KongFunction):
|
|
|
60
60
|
app = App(
|
|
61
61
|
InputData,
|
|
62
62
|
OutputData,
|
|
63
|
-
|
|
63
|
+
Main,
|
|
64
64
|
)
|
|
65
65
|
|
|
66
66
|
if __name__ == "__main__":
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from kong.sdk.conftest import ExtensionFixture
|
|
2
|
-
from src.main import InputData,
|
|
2
|
+
from src.main import InputData, Main
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
# The test function to validate the behavior of the extension
|
|
6
6
|
async def test_should_return_value_from_string_field_when_input_is_provided(
|
|
7
7
|
create_extension: ExtensionFixture,
|
|
8
8
|
):
|
|
9
|
-
extension = create_extension(
|
|
9
|
+
extension = create_extension(Main, InputData)
|
|
10
10
|
|
|
11
11
|
# Prepare the input data
|
|
12
12
|
input_data = InputData(
|