@devkong/cli-nx 0.0.32 → 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/README.md +2 -2
- package/src/generators/preset/files/kotlin/build.gradle.kts.template +2 -2
- package/src/generators/preset/files/kotlin/extension.http +4 -10
- 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/README.md +1 -3
- 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
|
@@ -11,6 +11,7 @@ Before you start, make sure you have the following installed depending on your O
|
|
|
11
11
|
[▶ Windows Setup](#windows-setup)
|
|
12
12
|
|
|
13
13
|
[▶ macOS Setup](#macos-setup)
|
|
14
|
+
|
|
14
15
|
- Mac M2 users, see [Troubleshooting](#Troubleshooting)
|
|
15
16
|
|
|
16
17
|
[▶ Ubuntu Linux Setup](#ubuntu-setup)
|
|
@@ -28,7 +29,7 @@ docker info
|
|
|
28
29
|
2. Run the following commands in your terminal:
|
|
29
30
|
|
|
30
31
|
```shell script
|
|
31
|
-
# configure the base Kong URL (e.g., https://
|
|
32
|
+
# configure the base Kong URL (e.g., https://sandbox.kong.dev.app-dts.net)
|
|
32
33
|
kong configure
|
|
33
34
|
```
|
|
34
35
|
|
|
@@ -80,7 +81,6 @@ To emulate a Linux platform, you need to install Rosetta:
|
|
|
80
81
|
softwareupdate --install-rosetta
|
|
81
82
|
```
|
|
82
83
|
|
|
83
|
-
|
|
84
84
|
<details id="windows-setup">
|
|
85
85
|
<summary><strong>Windows Setup</strong></summary>
|
|
86
86
|
|
|
@@ -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
|
-
"sessiontenant": "
|
|
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": "/
|
|
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
|
|
@@ -16,7 +16,6 @@ Before you start, make sure you have the following installed depending on your O
|
|
|
16
16
|
|
|
17
17
|
- Mac M2 users, see [Troubleshooting](#Troubleshooting)
|
|
18
18
|
|
|
19
|
-
|
|
20
19
|
To verify the installation and check the versions, run the following commands:
|
|
21
20
|
|
|
22
21
|
```shell script
|
|
@@ -30,7 +29,7 @@ docker info
|
|
|
30
29
|
2. Run the following commands in your terminal:
|
|
31
30
|
|
|
32
31
|
```shell script
|
|
33
|
-
# configure the base Kong URL (e.g., https://
|
|
32
|
+
# configure the base Kong URL (e.g., https://sandbox.kong.dev.app-dts.net)
|
|
34
33
|
kong configure
|
|
35
34
|
|
|
36
35
|
# install Python dependencies from requirements.txt
|
|
@@ -85,7 +84,6 @@ To emulate a Linux platform, you need to install Rosetta:
|
|
|
85
84
|
softwareupdate --install-rosetta
|
|
86
85
|
```
|
|
87
86
|
|
|
88
|
-
|
|
89
87
|
<details id="windows-setup">
|
|
90
88
|
<summary><strong>Windows Setup</strong></summary>
|
|
91
89
|
|
|
@@ -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(
|