@devkong/cli-nx 0.0.67-3 → 0.0.67-alpha.1

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.
Files changed (45) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +1 -0
  3. package/src/generators/preset/files/kotlin/.dockerignore +0 -6
  4. package/src/generators/preset/files/kotlin/.editorconfig +0 -24
  5. package/src/generators/preset/files/kotlin/.vscode/extensions.json +0 -18
  6. package/src/generators/preset/files/kotlin/.vscode/launch.json +0 -16
  7. package/src/generators/preset/files/kotlin/.vscode/settings.json +0 -7
  8. package/src/generators/preset/files/kotlin/.vscode/tasks.json +0 -81
  9. package/src/generators/preset/files/kotlin/Dockerfile +0 -54
  10. package/src/generators/preset/files/kotlin/README.md +0 -165
  11. package/src/generators/preset/files/kotlin/build.gradle.kts.template +0 -64
  12. package/src/generators/preset/files/kotlin/gradle/wrapper/gradle-wrapper.jar +0 -0
  13. package/src/generators/preset/files/kotlin/gradle/wrapper/gradle-wrapper.properties +0 -6
  14. package/src/generators/preset/files/kotlin/gradle.properties +0 -25
  15. package/src/generators/preset/files/kotlin/gradlew +0 -245
  16. package/src/generators/preset/files/kotlin/gradlew.bat +0 -92
  17. package/src/generators/preset/files/kotlin/kong.json.template +0 -6
  18. package/src/generators/preset/files/kotlin/project.json.template +0 -48
  19. package/src/generators/preset/files/kotlin/settings.gradle.kts +0 -14
  20. package/src/generators/preset/files/kotlin/src/main/kotlin/io/kong/extension/Main.kt +0 -61
  21. package/src/generators/preset/files/kotlin/src/main/resources/META-INF/resources/index.html +0 -362
  22. package/src/generators/preset/files/kotlin/src/main/resources/application.properties.template +0 -3
  23. package/src/generators/preset/files/kotlin/src/main/resources/reflect-config.json.template +0 -1
  24. package/src/generators/preset/files/kotlin/src/test/kotlin/io/kong/extension/Test.kt +0 -31
  25. package/src/generators/preset/files/python/.dockerignore +0 -5
  26. package/src/generators/preset/files/python/.editorconfig +0 -16
  27. package/src/generators/preset/files/python/.gitattributes +0 -25
  28. package/src/generators/preset/files/python/.gitignore.template +0 -69
  29. package/src/generators/preset/files/python/.idea/inspectionProfiles/Project_Default.xml +0 -7
  30. package/src/generators/preset/files/python/.idea/inspectionProfiles/profiles_settings.xml +0 -6
  31. package/src/generators/preset/files/python/.idea/kong-cli-python-template.iml +0 -10
  32. package/src/generators/preset/files/python/.pylintrc +0 -547
  33. package/src/generators/preset/files/python/.vscode/extensions.json +0 -14
  34. package/src/generators/preset/files/python/.vscode/launch.json +0 -19
  35. package/src/generators/preset/files/python/.vscode/settings.json +0 -62
  36. package/src/generators/preset/files/python/Dockerfile +0 -13
  37. package/src/generators/preset/files/python/README.md +0 -257
  38. package/src/generators/preset/files/python/kong.json.template +0 -6
  39. package/src/generators/preset/files/python/project.json.template +0 -8
  40. package/src/generators/preset/files/python/pyproject.toml +0 -3
  41. package/src/generators/preset/files/python/requirements-dev.txt +0 -10
  42. package/src/generators/preset/files/python/requirements.txt +0 -2
  43. package/src/generators/preset/files/python/src/__init__.py +0 -0
  44. package/src/generators/preset/files/python/src/main.py +0 -67
  45. package/src/generators/preset/files/python/src/main_test.py +0 -19
@@ -1,257 +0,0 @@
1
- # Kong Extension
2
-
3
- Welcome to the Kong extension development workspace!
4
-
5
- To have a better experience, open this file in preview mode of your IDE.
6
-
7
- ### Prerequisites
8
-
9
- Before you start, make sure you have the following installed depending on your OS:
10
-
11
- [▶ Windows](#windows-setup)
12
-
13
- [▶ Ubuntu](#ubuntu-setup)
14
-
15
- [▶ macOS](#macos-setup)
16
-
17
- To verify the installation and check the versions, run the following commands:
18
-
19
- ```shell script
20
- node --version
21
- docker info
22
- ```
23
-
24
- ### Getting Started
25
-
26
- 1. Make sure you're in the terminal and inside the extension folder you generated
27
- 2. Run the following commands in your terminal:
28
-
29
- ```shell script
30
- # configure the base Kong URL (e.g., https://sandbox.kong.dev.app-dts.net)
31
- kong configure
32
-
33
- # install Python dependencies from requirements.txt
34
- kong install --verbose
35
- ```
36
-
37
- That's it! Now, modify [main.kt](./src/main/kotlin/io/kong/extension/Main.kt), tag it by publishing a new version, and assign aliases for use in the workflow.
38
-
39
- ### Publish a New Version
40
-
41
- To automatically tag your code with an incremented version number (e.g., 1, 2, 3), run:
42
-
43
- ```shell script
44
- kong publish-version --verbose
45
- ```
46
-
47
- ### List Available Versions
48
-
49
- To see all available versions of your extension, run:
50
-
51
- ```shell script
52
- kong list-versions
53
- ```
54
-
55
- ### Assign an Alias to a Version
56
-
57
- You can assign an alias (e.g., stable, beta) to a specific version. This alias will appear in the UI as a separate step in the workflow. For example, to assign the alias stable to version 1, use:
58
-
59
- ```shell script
60
- kong set-alias stable 1
61
- ```
62
-
63
- ### Using a Custom Profile
64
-
65
- If you're developing an extension that will be used in different regions (or need to work with a specific profile), you can create a new profile using `kong configure`. Then, include the `--profile <name>` parameter when running the publish-version and set-alias commands to use the desired profile.
66
-
67
- ### Update CLI
68
-
69
- To install the latest version of the CLI, run:
70
-
71
- ```shell script
72
- npm i -g @devkong/cli@latest
73
- ```
74
-
75
- ### Setup
76
-
77
- <details id="windows-setup">
78
- <summary><strong>Windows</strong></summary>
79
-
80
- ### Install Windows Subsystem for Linux (WSL2)
81
-
82
- 1. Open PowerShell as Administrator.
83
- 2. Run the following command to install WSL and set WSL2 as the default version:
84
- ```powershell
85
- wsl --install
86
- ```
87
- 3. Restart your computer if prompted.
88
- 4. After restarting, install a preferred Linux distribution (e.g., Ubuntu) by running:
89
- ```powershell
90
- wsl --install -d Ubuntu
91
- ```
92
-
93
- ### Install Docker within WSL2
94
-
95
- 1. Download Docker Desktop for Windows from [Docker's official website](https://www.docker.com/products/docker-desktop).
96
- 2. Run the installer and follow the setup instructions.
97
- 3. During installation, ensure the "Use the WSL 2 based engine" option is selected.
98
- 4. Once installed, open Docker Desktop, go to Settings > General, and enable "Use WSL 2 based engine" if it isn't already enabled.
99
- 5. Confirm Docker is working in your WSL2 distribution (e.g., Ubuntu) by running:
100
- ```bash
101
- docker --version
102
- ```
103
-
104
- ### Install Node.js and npm on Windows Host
105
-
106
- 1. Download the Node.js installer for Windows from the [official Node.js website](https://nodejs.org/).
107
- 2. Run the installer, making sure to include the npm package manager during installation.
108
- 3. Verify installation by opening a new Command Prompt and running:
109
- ```cmd
110
- node -v
111
- npm -v
112
- ```
113
-
114
- ### Install Python on Windows Host
115
-
116
- 1. Download the Python installer (version >= 3.10) for Windows from the [official Python website](https://www.python.org/downloads/windows/).
117
- 2. Run the installer, making sure to check "Add Python to PATH" during setup.
118
- 3. Verify installation by running:
119
- ```cmd
120
- python --version
121
- pip --version
122
- ```
123
-
124
- ### Install Poetry on Windows Host
125
-
126
- 1. Open Command Prompt or PowerShell.
127
- 2. Run the following command:
128
- ```powershell
129
- (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
130
- ```
131
- 3. Add Poetry to your PATH:
132
- ```powershell
133
- $env:Path += ";$env:USERPROFILE\.poetry\bin"
134
- ```
135
- 4. Verify installation:
136
- ```powershell
137
- poetry --version
138
- ```
139
-
140
- </details>
141
-
142
- <details id="ubuntu-setup">
143
- <summary><strong>Ubuntu</strong></summary>
144
-
145
- ### Install Docker
146
-
147
- 1. Follow the installation instructions on [Docker's official website](https://docs.docker.com/engine/install/ubuntu/).
148
- 2. Start Docker and enable it to start on boot:
149
- ```bash
150
- sudo systemctl start docker
151
- sudo systemctl enable docker
152
- ```
153
-
154
- ### Install Node.js and npm
155
-
156
- 1. Run the following commands:
157
- ```bash
158
- sudo apt update
159
- sudo apt install -y nodejs npm
160
- ```
161
- 2. Verify installation:
162
- ```bash
163
- node -v
164
- npm -v
165
- ```
166
-
167
- ### Install Python
168
-
169
- 1. Run the following commands:
170
- ```bash
171
- sudo apt update
172
- sudo apt install -y python3 python3-pip
173
- ```
174
- 2. Verify installation:
175
- ```bash
176
- python3 --version
177
- pip3 --version
178
- ```
179
-
180
- ### Install Poetry
181
-
182
- 1. Run the following command:
183
- ```bash
184
- curl -sSL https://install.python-poetry.org | python3 -
185
- ```
186
- 2. Add Poetry to your PATH:
187
- ```bash
188
- export PATH="$HOME/.local/bin:$PATH"
189
- ```
190
- 3. Reload the shell:
191
- ```bash
192
- source ~/.bashrc
193
- ```
194
- 4. Verify installation:
195
- ```bash
196
- poetry --version
197
- ```
198
-
199
- </details>
200
-
201
- <details id="macos-setup">
202
- <summary><strong>macOS</strong></summary>
203
-
204
- To emulate a Linux platform, you need to install Rosetta:
205
-
206
- ```shell script
207
- softwareupdate --install-rosetta
208
- ```
209
-
210
- ### Install Docker
211
-
212
- 1. Download and install Docker Desktop for Mac from [Docker's official website](https://www.docker.com/products/docker-desktop).
213
-
214
- ### Install Node.js and npm
215
-
216
- 1. Use Homebrew to install:
217
- ```bash
218
- brew install node
219
- ```
220
- 2. Verify installation:
221
- ```bash
222
- node -v
223
- npm -v
224
- ```
225
-
226
- ### Install Python
227
-
228
- 1. Use Homebrew to install:
229
- ```bash
230
- brew install python
231
- ```
232
- 2. Verify installation:
233
- ```bash
234
- python3 --version
235
- pip3 --version
236
- ```
237
-
238
- ### Install Poetry
239
-
240
- 1. Run the following command:
241
- ```bash
242
- curl -sSL https://install.python-poetry.org | python3 -
243
- ```
244
- 2. Add Poetry to your PATH:
245
- ```bash
246
- export PATH="$HOME/.local/bin:$PATH"
247
- ```
248
- 3. Reload the shell:
249
- ```bash
250
- source ~/.bashrc
251
- ```
252
- 4. Verify installation:
253
- ```bash
254
- poetry --version
255
- ```
256
-
257
- </details>
@@ -1,6 +0,0 @@
1
- {
2
- "id": "<%=id%>",
3
- "name": "<%=name%>",
4
- "sdk": "<%=platform%>",
5
- "category": "unknown"
6
- }
@@ -1,8 +0,0 @@
1
- {
2
- "name": "<%=name%>",
3
- "$schema": "./node_modules/nx/schemas/project-schema.json",
4
- "projectType": "application",
5
- "sourceRoot": "./src",
6
- "targets": {},
7
- "tags": []
8
- }
@@ -1,3 +0,0 @@
1
- [tool.pytest.ini_options]
2
- asyncio_mode = "auto"
3
- asyncio_default_fixture_loop_scope = "function"
@@ -1,10 +0,0 @@
1
- black==25.1.0
2
- flake8==7.3.0
3
- isort==6.0.1
4
- pylint==3.3.8
5
- pylint-pydantic==0.3.5
6
- pytest==8.4.2
7
- pytest-asyncio==1.2.0
8
- pytest-cov==7.0.0
9
- pytest-html==4.1.1
10
- pytest-sugar==1.1.1
@@ -1,2 +0,0 @@
1
- pydantic==2.11.9
2
- kong-sdk==0.0.43
@@ -1,67 +0,0 @@
1
- import sys
2
- from typing import Optional
3
-
4
- from kong.sdk.app import App
5
- from kong.sdk.kong_function import KongFunction
6
- from pydantic import BaseModel, Field
7
-
8
- # This script is for developing an extension for Kong.
9
- # For more details, please refer to the README.md file.
10
-
11
-
12
- class InputData(BaseModel):
13
- # Define the structure of the input data that your extension will accept.
14
- # Be sure to include example values for each field. These examples help generate
15
- # sample objects in the UI, making it easier to work with the models.
16
- # For more standard types, refer to: https://docs.pydantic.dev/latest/concepts/types/
17
-
18
- # REPLACE BELLOW WITH YOUR FIELDS
19
-
20
- a: int = Field(
21
- examples=[1],
22
- description="An integer number",
23
- )
24
-
25
- b: int = Field(
26
- examples=[2],
27
- description="An integer number",
28
- )
29
-
30
-
31
- class OutputData(BaseModel):
32
- # Define the structure of the output data that your extension will return.
33
-
34
- # REPLACE BELLOW WITH YOUR FIELDS
35
-
36
- sum_of: int = Field(
37
- examples=[3],
38
- description="Result of a + b",
39
- )
40
-
41
- comment: Optional[str] = Field(
42
- examples=["This example extension returns sum of a and b"],
43
- description="A string field",
44
- )
45
-
46
-
47
- class Main(KongFunction):
48
- # This is where you implement the logic to handle the input data
49
- # and produce the output.
50
-
51
- # OVERRIDE BELLOW TO CUSTOMIZE THE PROCESSING.
52
-
53
- async def handle(self, data: InputData) -> OutputData:
54
- return OutputData(
55
- sum_of=data.a + data.b,
56
- comment=f"sum of {data.a} and {data.b}",
57
- )
58
-
59
-
60
- app = App(
61
- InputData,
62
- OutputData,
63
- Main,
64
- )
65
-
66
- if __name__ == "__main__":
67
- app.run(sys.argv)
@@ -1,19 +0,0 @@
1
- from kong.sdk.conftest import ExtensionFixture
2
-
3
- from main import InputData, Main
4
-
5
-
6
- # The test function to validate the behavior of the extension
7
- async def test_should_return_value_from_string_field_when_input_is_provided(
8
- create_extension: ExtensionFixture,
9
- ):
10
- extension = create_extension(Main, InputData)
11
-
12
- # Prepare the input data
13
- input_data = InputData(
14
- a=1,
15
- b=2,
16
- )
17
-
18
- output = await extension.handle(input_data)
19
- assert output.sum_of == 3