@devkong/cli-nx 0.0.67-alpha.3 → 0.0.67-alpha.30
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/.dockerignore +6 -0
- package/src/generators/preset/files/kotlin/.editorconfig +24 -0
- package/src/generators/preset/files/kotlin/.vscode/extensions.json +18 -0
- package/src/generators/preset/files/kotlin/.vscode/launch.json +16 -0
- package/src/generators/preset/files/kotlin/.vscode/settings.json +7 -0
- package/src/generators/preset/files/kotlin/.vscode/tasks.json +81 -0
- package/src/generators/preset/files/kotlin/Dockerfile +58 -0
- package/src/generators/preset/files/kotlin/README.md +172 -0
- package/src/generators/preset/files/kotlin/build.gradle.kts.template +64 -0
- package/src/generators/preset/files/kotlin/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/src/generators/preset/files/kotlin/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/src/generators/preset/files/kotlin/gradle.properties +25 -0
- package/src/generators/preset/files/kotlin/gradlew +245 -0
- package/src/generators/preset/files/kotlin/gradlew.bat +92 -0
- package/src/generators/preset/files/kotlin/kong.json.template +6 -0
- package/src/generators/preset/files/kotlin/project.json.template +29 -0
- package/src/generators/preset/files/kotlin/settings.gradle.kts +14 -0
- package/src/generators/preset/files/kotlin/src/main/kotlin/io/kong/extension/InputData.kt +26 -0
- package/src/generators/preset/files/kotlin/src/main/kotlin/io/kong/extension/Main.kt +83 -0
- package/src/generators/preset/files/kotlin/src/main/kotlin/io/kong/extension/OutputData.kt +15 -0
- package/src/generators/preset/files/kotlin/src/main/kotlin/io/kong/extension/RegisterFrontend.kt +28 -0
- package/src/generators/preset/files/kotlin/src/main/resources/META-INF/resources/index.html +362 -0
- package/src/generators/preset/files/kotlin/src/main/resources/application.properties.template +3 -0
- package/src/generators/preset/files/kotlin/src/main/resources/reflect-config.json.template +1 -0
- package/src/generators/preset/files/kotlin/src/test/kotlin/io/kong/extension/Test.kt +58 -0
- package/src/generators/preset/files/python/.dockerignore +5 -0
- package/src/generators/preset/files/python/.editorconfig +16 -0
- package/src/generators/preset/files/python/.gitattributes +25 -0
- package/src/generators/preset/files/python/.gitignore.template +69 -0
- package/src/generators/preset/files/python/.idea/inspectionProfiles/Project_Default.xml +7 -0
- package/src/generators/preset/files/python/.idea/inspectionProfiles/profiles_settings.xml +6 -0
- package/src/generators/preset/files/python/.idea/kong-cli-python-template.iml +10 -0
- package/src/generators/preset/files/python/.pylintrc +543 -0
- package/src/generators/preset/files/python/.vscode/extensions.json +14 -0
- package/src/generators/preset/files/python/.vscode/launch.json +19 -0
- package/src/generators/preset/files/python/.vscode/settings.json +65 -0
- package/src/generators/preset/files/python/Dockerfile +30 -0
- package/src/generators/preset/files/python/README.md +262 -0
- package/src/generators/preset/files/python/kong.json.template +6 -0
- package/src/generators/preset/files/python/project.json.template +8 -0
- package/src/generators/preset/files/python/pyproject.toml +3 -0
- package/src/generators/preset/files/python/requirements-dev.txt +10 -0
- package/src/generators/preset/files/python/requirements.txt +5 -0
- package/src/generators/preset/files/python/src/__init__.py +0 -0
- package/src/generators/preset/files/python/src/frontend.py +3 -0
- package/src/generators/preset/files/python/src/input_data.py +13 -0
- package/src/generators/preset/files/python/src/main.py +28 -0
- package/src/generators/preset/files/python/src/main_test.py +19 -0
- package/src/generators/preset/files/python/src/output_data.py +15 -0
- package/src/generators/preset/files/python-with-s3/src/frontend.py +6 -0
- package/src/generators/preset/files/python-with-s3/src/input_data.py +17 -0
- package/src/generators/preset/files/python-with-s3/src/main.py +45 -0
- package/src/generators/preset/files/python-with-s3/src/main_test.py +36 -0
- package/src/generators/preset/files/python-with-s3/src/output_data.py +8 -0
- package/src/generators/preset/files/python-with-s3/src/s3.py +27 -0
- package/src/generators/preset/files/python-with-secret/src/frontend.py +17 -0
- package/src/generators/preset/files/python-with-secret/src/input_data.py +40 -0
- package/src/generators/preset/files/python-with-secret/src/main.py +51 -0
- package/src/generators/preset/files/python-with-secret/src/main_test.py +39 -0
- package/src/generators/preset/files/python-with-secret/src/output_data.py +16 -0
- package/src/generators/preset/generator.js +10 -0
- package/src/generators/preset/generator.js.map +1 -1
- package/src/generators/preset/schema.d.ts +6 -1
- package/src/generators/preset/schema.json +32 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
package io.kong.extension
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.databind.ObjectMapper
|
|
4
|
+
import io.kong.sdk.KongFunctionRequest
|
|
5
|
+
import io.kong.sdk.function.template.ExtensionTestContext
|
|
6
|
+
import io.kong.sdk.function.template.ExtensionTestProfile
|
|
7
|
+
import io.quarkus.test.junit.QuarkusTest
|
|
8
|
+
import io.quarkus.test.junit.TestProfile
|
|
9
|
+
import jakarta.inject.Inject
|
|
10
|
+
import kotlinx.coroutines.test.runTest
|
|
11
|
+
import org.junit.jupiter.api.Assertions.assertEquals
|
|
12
|
+
import org.junit.jupiter.api.Test
|
|
13
|
+
|
|
14
|
+
@QuarkusTest
|
|
15
|
+
@TestProfile(ExtensionTestProfile::class)
|
|
16
|
+
class Test {
|
|
17
|
+
@Inject
|
|
18
|
+
lateinit var extension: Main
|
|
19
|
+
|
|
20
|
+
@Inject
|
|
21
|
+
lateinit var jsonMapper: ObjectMapper
|
|
22
|
+
|
|
23
|
+
@Inject
|
|
24
|
+
lateinit var testContext: ExtensionTestContext
|
|
25
|
+
|
|
26
|
+
@Test
|
|
27
|
+
fun `when operation is sum then adds the operands`() =
|
|
28
|
+
runTest {
|
|
29
|
+
val input =
|
|
30
|
+
InputData(
|
|
31
|
+
request = KongFunctionRequest(operation = "sum"),
|
|
32
|
+
sum = OperationData(a = 1, b = 2),
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
val bytes = extension.handle(input, testContext.create())
|
|
36
|
+
val output = jsonMapper.readValue(bytes, OutputData::class.java)
|
|
37
|
+
|
|
38
|
+
assertEquals(3, output.result)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Test
|
|
42
|
+
fun `when a secret is provided then notes authentication`() =
|
|
43
|
+
runTest {
|
|
44
|
+
val input =
|
|
45
|
+
InputData(
|
|
46
|
+
request = KongFunctionRequest(operation = "sum"),
|
|
47
|
+
sum = OperationData(a = 1, b = 2),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
val context =
|
|
51
|
+
testContext.create(secrets = mapOf("primary" to MySecret(myKey = "example-0123456789")))
|
|
52
|
+
val bytes = extension.handle(input, context)
|
|
53
|
+
val output = jsonMapper.readValue(bytes, OutputData::class.java)
|
|
54
|
+
|
|
55
|
+
assertEquals(3, output.result)
|
|
56
|
+
assertEquals("sum result is 3 (authenticated)", output.comment)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Editor configuration, see http://editorconfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
end_of_line = lf
|
|
6
|
+
insert_final_newline = true
|
|
7
|
+
trim_trailing_whitespace = true
|
|
8
|
+
|
|
9
|
+
[*.py]
|
|
10
|
+
charset = utf-8
|
|
11
|
+
indent_style = space
|
|
12
|
+
indent_size = 2
|
|
13
|
+
|
|
14
|
+
[*.md]
|
|
15
|
+
insert_final_newline = false
|
|
16
|
+
trim_trailing_whitespace = false
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Autodetect text files
|
|
2
|
+
* text=auto
|
|
3
|
+
|
|
4
|
+
# Force the following filetypes to have unix eols, so Windows does not break them
|
|
5
|
+
*.* text eol=lf
|
|
6
|
+
|
|
7
|
+
# Force images/fonts to be handled as binaries
|
|
8
|
+
*.jpg binary
|
|
9
|
+
*.jpeg binary
|
|
10
|
+
*.gif binary
|
|
11
|
+
*.png binary
|
|
12
|
+
*.t3x binary
|
|
13
|
+
*.t3d binary
|
|
14
|
+
*.exe binary
|
|
15
|
+
*.data binary
|
|
16
|
+
*.ttf binary
|
|
17
|
+
*.eof binary
|
|
18
|
+
*.eot binary
|
|
19
|
+
*.swf binary
|
|
20
|
+
*.mov binary
|
|
21
|
+
*.mp4 binary
|
|
22
|
+
*.mp3 binary
|
|
23
|
+
*.ogg binary
|
|
24
|
+
*.flv binary
|
|
25
|
+
*.xlsx binary
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
# compiled output
|
|
4
|
+
dist
|
|
5
|
+
bin
|
|
6
|
+
tmp
|
|
7
|
+
/out-tsc
|
|
8
|
+
**/target
|
|
9
|
+
|
|
10
|
+
# dependencies
|
|
11
|
+
node_modules
|
|
12
|
+
.nx
|
|
13
|
+
.poetry
|
|
14
|
+
.venv
|
|
15
|
+
|
|
16
|
+
# IDEs and editors
|
|
17
|
+
.project
|
|
18
|
+
.classpath
|
|
19
|
+
.c9/
|
|
20
|
+
*.launch
|
|
21
|
+
.settings/
|
|
22
|
+
*.sublime-workspace
|
|
23
|
+
|
|
24
|
+
# misc
|
|
25
|
+
/.sass-cache
|
|
26
|
+
/connect.lock
|
|
27
|
+
/coverage
|
|
28
|
+
/libpeerconnection.log
|
|
29
|
+
npm-debug.log
|
|
30
|
+
yarn-error.log
|
|
31
|
+
testem.log
|
|
32
|
+
/typings
|
|
33
|
+
.kotlin
|
|
34
|
+
**/pylint.txt
|
|
35
|
+
.pytest_cache
|
|
36
|
+
__pycache__
|
|
37
|
+
|
|
38
|
+
# System Files
|
|
39
|
+
.DS_Store
|
|
40
|
+
Thumbs.db
|
|
41
|
+
|
|
42
|
+
# Gradle
|
|
43
|
+
.gradle
|
|
44
|
+
build
|
|
45
|
+
|
|
46
|
+
# Maven
|
|
47
|
+
**/.mvn/repository
|
|
48
|
+
|
|
49
|
+
# Idea
|
|
50
|
+
**/.idea/aws.xml
|
|
51
|
+
**/.idea/dataSources
|
|
52
|
+
**/.idea/dataSources.local.xml
|
|
53
|
+
**/.idea/dataSources.xml
|
|
54
|
+
**/.idea/httpRequests
|
|
55
|
+
**/.idea/jarRepositories.xml
|
|
56
|
+
**/.idea/jsLibraryMappings.xml
|
|
57
|
+
**/.idea/kotlinScripting.xml
|
|
58
|
+
**/.idea/modules
|
|
59
|
+
**/.idea/modules.xml
|
|
60
|
+
**/.idea/protoeditor.xml
|
|
61
|
+
**/.idea/protoeditor.xml
|
|
62
|
+
**/.idea/shelf
|
|
63
|
+
**/.idea/tasks.xml
|
|
64
|
+
**/.idea/workspace.xml
|
|
65
|
+
|
|
66
|
+
# tests
|
|
67
|
+
**/.coverage
|
|
68
|
+
**/coverage.xml
|
|
69
|
+
**/reports/**/unittests
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
5
|
+
<inspection_tool class="Stylelint" enabled="true" level="ERROR" enabled_by_default="true" />
|
|
6
|
+
</profile>
|
|
7
|
+
</component>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="PYTHON_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
6
|
+
</content>
|
|
7
|
+
<orderEntry type="jdk" jdkName="Pipenv (kong-cli-python-template)" jdkType="Python SDK" />
|
|
8
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
9
|
+
</component>
|
|
10
|
+
</module>
|