Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
063b0516d7 | ||
|
|
7faf08f0d5 | ||
|
|
6f554226cb | ||
|
|
5ec0df9cb5 | ||
|
|
6aa1a77d4c | ||
|
|
e55f5be9f1 | ||
|
|
06fe5231f2 | ||
|
|
25903033b3 | ||
|
|
ddc91de4a7 | ||
|
|
3af6d23885 | ||
|
|
c2f4eeaa78 | ||
|
|
fac2f8c500 | ||
|
|
70dff2aed7 | ||
|
|
b2fc484c0d | ||
|
|
2c0562e98f | ||
|
|
cf9a24f424 | ||
|
|
8a385435c8 | ||
|
|
c798437dc5 | ||
|
|
958e40c1b5 | ||
|
|
24cdc01cdf | ||
|
|
61ca241bed | ||
|
|
1d2a13bb2c | ||
|
|
eeedd1e1ba | ||
|
|
3f1414006f | ||
|
|
408e1cf762 | ||
|
|
439e830f67 | ||
|
|
245372451b | ||
|
|
064e0aedbc | ||
|
|
4a74b91e41 | ||
|
|
db6fa9aab6 | ||
|
|
7c5b843698 | ||
|
|
7360134d01 | ||
|
|
410c38cbe1 | ||
|
|
1d6b6ada06 | ||
|
|
cdf59f6e8e | ||
|
|
5ffb6f51f7 | ||
|
|
f6faebb83b | ||
|
|
8d1641f5f1 | ||
|
|
310b5b533e | ||
|
|
7eacbe2de8 | ||
|
|
cbe07c49dd | ||
|
|
78552235fe | ||
|
|
9946163ee7 | ||
|
|
7b6749c9be | ||
|
|
aa8f411b95 | ||
|
|
8af19a3e0d | ||
|
|
76b9b7774e | ||
|
|
40c8fb88cc | ||
|
|
f62f6bb4e6 | ||
|
|
00763dc8d0 | ||
|
|
92943009b1 | ||
|
|
1b87824eaf | ||
|
|
44300c0d25 | ||
|
|
cacd109b07 | ||
|
|
6e5e04ddfa | ||
|
|
84697f703f | ||
|
|
3c484905ad | ||
|
|
0efd7b247b | ||
|
|
93f7922373 | ||
|
|
69ed8054bc | ||
|
|
49bbf79074 | ||
|
|
7182ebc899 | ||
|
|
1a0e6cf3fc | ||
|
|
a2f9ad7e19 | ||
|
|
166529138f | ||
|
|
4f14ea38e1 | ||
|
|
6d064d5e02 | ||
|
|
a5b9f05d05 | ||
|
|
ff3dbca538 | ||
|
|
f8ebd710d6 | ||
|
|
8d1e859eac | ||
|
|
970fddf11c | ||
|
|
6e91a0f4da | ||
|
|
df4fb851aa | ||
|
|
3501be7ebb | ||
|
|
fb1deb0bc9 | ||
|
|
411a676a97 | ||
|
|
41b49a1d70 | ||
|
|
aeb96013dd | ||
|
|
6bd382aec6 | ||
|
|
e8cc55b7ff | ||
|
|
24d03b5dbe | ||
|
|
abd54bf180 | ||
|
|
9092acc8bf | ||
|
|
24d35e0505 | ||
|
|
9ccc1c1728 | ||
|
|
68e1f0d094 | ||
|
|
983474cdb7 | ||
|
|
e52217a99b | ||
|
|
96be761078 | ||
|
|
27c178998c | ||
|
|
242dca2daf | ||
|
|
86862c3e68 | ||
|
|
1a48bd90f2 | ||
|
|
65b26769fe | ||
|
|
0776ff643c | ||
|
|
6c28448cfc | ||
|
|
3aca9b638c | ||
|
|
77bcc2858a |
No files matched your search
+30
-20
@@ -1,41 +1,48 @@
|
|||||||
|
|
||||||
# Created by .ignore support plugin (hsz.mobi)
|
# Created by .ignore support plugin (hsz.mobi)
|
||||||
### JetBrains template
|
### JetBrains template
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
# User-specific stuff:
|
# User-specific stuff
|
||||||
/.idea/
|
*.iml
|
||||||
.idea/**/workspace.xml
|
.idea/**/workspace.xml
|
||||||
.idea/**/tasks.xml
|
.idea/**/tasks.xml
|
||||||
.idea/dictionaries
|
.idea/**/usage.statistics.xml
|
||||||
*.iml
|
.idea/**/dictionaries
|
||||||
mongo_backend_service
|
.idea/**/shelf
|
||||||
mongo-backend-service
|
.idea
|
||||||
|
|
||||||
# Sensitive or high-churn files:
|
# Sensitive or high-churn files
|
||||||
.idea/**/dataSources/
|
.idea/**/dataSources/
|
||||||
.idea/**/dataSources.ids
|
.idea/**/dataSources.ids
|
||||||
.idea/**/dataSources.local.xml
|
.idea/**/dataSources.local.xml
|
||||||
.idea/**/sqlDataSources.xml
|
.idea/**/sqlDataSources.xml
|
||||||
.idea/**/dynamic.xml
|
.idea/**/dynamic.xml
|
||||||
.idea/**/uiDesigner.xml
|
.idea/**/uiDesigner.xml
|
||||||
|
.idea/**/dbnavigator.xml
|
||||||
|
|
||||||
# Gradle:
|
# Gradle
|
||||||
.idea/**/gradle.xml
|
.idea/**/gradle.xml
|
||||||
.idea/**/libraries
|
.idea/**/libraries
|
||||||
|
|
||||||
# CMake
|
# Gradle and Maven with auto-import
|
||||||
cmake-build-debug/
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
cmake-build-release/
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
|
# auto-import.
|
||||||
|
# .idea/modules.xml
|
||||||
|
# .idea/*.iml
|
||||||
|
# .idea/modules
|
||||||
|
|
||||||
# Mongo Explorer plugin:
|
# CMake
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
.idea/**/mongoSettings.xml
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
## File-based project format:
|
# File-based project format
|
||||||
*.iws
|
*.iws
|
||||||
|
|
||||||
## Plugin-specific files:
|
|
||||||
|
|
||||||
# IntelliJ
|
# IntelliJ
|
||||||
out/
|
out/
|
||||||
|
|
||||||
@@ -53,6 +60,9 @@ com_crashlytics_export_strings.xml
|
|||||||
crashlytics.properties
|
crashlytics.properties
|
||||||
crashlytics-build.properties
|
crashlytics-build.properties
|
||||||
fabric.properties
|
fabric.properties
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
.idea/httpRequests
|
||||||
### Go template
|
### Go template
|
||||||
# Binaries for programs and plugins
|
# Binaries for programs and plugins
|
||||||
*.exe
|
*.exe
|
||||||
@@ -60,6 +70,7 @@ fabric.properties
|
|||||||
*.dll
|
*.dll
|
||||||
*.so
|
*.so
|
||||||
*.dylib
|
*.dylib
|
||||||
|
vendor
|
||||||
|
|
||||||
# Test binary, build with `go test -c`
|
# Test binary, build with `go test -c`
|
||||||
*.test
|
*.test
|
||||||
@@ -67,8 +78,7 @@ fabric.properties
|
|||||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
*.out
|
*.out
|
||||||
|
|
||||||
/node_modules/
|
docker-compose.yml
|
||||||
/vendor/
|
node_modules
|
||||||
google/
|
|
||||||
package.json
|
conf/config_dev.yml
|
||||||
yarn.lock
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
include:
|
||||||
|
- project: '$CI_PROJECT_PATH'
|
||||||
|
file: '/ci-isp-go-service.yml'
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
version: "2"
|
||||||
|
run:
|
||||||
|
allow-parallel-runners: true
|
||||||
|
linters:
|
||||||
|
default: all
|
||||||
|
disable:
|
||||||
|
- contextcheck # не имеет смысла
|
||||||
|
- depguard # не всегда имеет смысл
|
||||||
|
- dupword # не имеет смысла
|
||||||
|
- exhaustruct # не имеет смысла
|
||||||
|
- godot # не актуально для swagger
|
||||||
|
- godox # не позволяет оставлять todo
|
||||||
|
- musttag # у нас собственное правило: не используем теги, если работаем с пакетом isp-kit/json и с внутренними структурами(между нашими сервисами), при этом теги обязательный для всех внешних для нас структур
|
||||||
|
- nlreturn # не всегда имеет смысл
|
||||||
|
- nolintlint # Goland все равно форматирует с отступом
|
||||||
|
- perfsprint # мнимая производительность в угоду читаемости
|
||||||
|
- tagalign # не всегда имеет смысл
|
||||||
|
- varnamelen # очень индивидуально (db)
|
||||||
|
- wsl # расставление пробелов очень индивидуально
|
||||||
|
settings:
|
||||||
|
cyclop:
|
||||||
|
max-complexity: 15 # по умолчанию 10 мало
|
||||||
|
funlen:
|
||||||
|
lines: 80
|
||||||
|
lll:
|
||||||
|
line-length: 150
|
||||||
|
revive:
|
||||||
|
rules:
|
||||||
|
- name: var-naming # отключаем Id -> ID
|
||||||
|
disabled: true
|
||||||
|
staticcheck:
|
||||||
|
checks: # отключаем Id -> ID
|
||||||
|
- -ST1000
|
||||||
|
- -ST1016
|
||||||
|
- -ST1020
|
||||||
|
- -ST1021
|
||||||
|
- -ST1022
|
||||||
|
testifylint:
|
||||||
|
disable:
|
||||||
|
- compares
|
||||||
|
- equal-values
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
presets:
|
||||||
|
- comments
|
||||||
|
- common-false-positives
|
||||||
|
- legacy
|
||||||
|
- std-error-handling
|
||||||
|
rules:
|
||||||
|
- linters:
|
||||||
|
- wrapcheck
|
||||||
|
path: controller # достаточное кол-во контекста на уровне контроллеров
|
||||||
|
- linters:
|
||||||
|
- wrapcheck
|
||||||
|
path: transaction # транзакции прозрачны
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
formatters:
|
||||||
|
enable:
|
||||||
|
- gofmt
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
Generated
-2
@@ -1,2 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/workspace.xml
|
|
||||||
@@ -1,2 +1,68 @@
|
|||||||
|
### v3.2.0
|
||||||
|
* обновлены зависимости
|
||||||
|
### v3.1.5
|
||||||
|
* обновлены зависимости
|
||||||
|
### v3.1.4
|
||||||
|
* обновлены зависимости
|
||||||
|
### v3.1.3
|
||||||
|
* Замена в конфигурации одного массива скриптов на кастомные и остальные
|
||||||
|
* Добавлена новая ошибка с дупликатами id
|
||||||
|
### v3.1.1
|
||||||
|
* Обновлены зависимости
|
||||||
|
* Замена `integration-system` на `txix-open`
|
||||||
|
* Обновление линтера
|
||||||
|
* Добавлено логирование запросов
|
||||||
|
### v3.1.0
|
||||||
|
* обновлены зависимости
|
||||||
|
### v3.0.2
|
||||||
|
* обновлены зависимости
|
||||||
|
* исправлен вызов внутренних методов через `external.invoke`
|
||||||
|
### v3.0.1
|
||||||
|
* Название ручек сервиса изменены для обеспечения обратной совместимости
|
||||||
|
### v3.0.0
|
||||||
|
* миграция сервиса на isp-kit
|
||||||
|
* миграция на версию GO 1.19.1
|
||||||
|
* обновлен формат логов в json
|
||||||
|
* обновлена библиотека goja, добавлена поддержка ES6 синтаксиса
|
||||||
|
### v2.5.8
|
||||||
|
* updated dependencies
|
||||||
|
* migrated to common local config
|
||||||
|
### v2.5.7
|
||||||
|
* fix receiving new configuration
|
||||||
|
### v2.5.6
|
||||||
|
* updated dependencies
|
||||||
|
### v2.5.5
|
||||||
|
* add new functions for scripts: sha256, sha512, generate UUIDv4
|
||||||
|
### v2.5.4
|
||||||
|
* fix: added missing "invoke" function to scripts
|
||||||
|
### v2.5.3
|
||||||
|
* added "invalid script configuration" error instead of "404:Not Found" error when invalid script was requested.
|
||||||
|
### v2.5.2
|
||||||
|
* updated isp-lib
|
||||||
|
### v2.5.1
|
||||||
|
* updated isp-lib
|
||||||
|
* updated isp-lib-test
|
||||||
|
### v2.5.0
|
||||||
|
* migrate from inbuilt wrapping of goja to new isp-lib/scripts package
|
||||||
|
### v2.4.1
|
||||||
|
* updated isp-lib
|
||||||
|
* updated isp-event-lib
|
||||||
|
### V2.4.0
|
||||||
|
* added swagger docs
|
||||||
|
* updated to new isp-lib (v2.6.1)
|
||||||
|
* added golanci support
|
||||||
|
### V2.3.0
|
||||||
|
* additional batch method
|
||||||
|
### V2.2.0
|
||||||
|
* add batch execution
|
||||||
|
### V2.1.1
|
||||||
|
* update script engine
|
||||||
|
### v2.1.0
|
||||||
|
* update to go mod
|
||||||
|
### v2.0.3
|
||||||
|
* up script engine version and others dependencies
|
||||||
|
### v2.0.2
|
||||||
|
* add metrics
|
||||||
### v2.0.0
|
### v2.0.0
|
||||||
* update to new isp-lib & config service
|
* update to new isp-lib & config service
|
||||||
|
* fix max body request/response sizing
|
||||||
Generated
-629
@@ -1,629 +0,0 @@
|
|||||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
|
||||||
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:320e7ead93de9fd2b0e59b50fd92a4d50c1f8ab455d96bc2eb083267453a9709"
|
|
||||||
name = "github.com/asaskevich/govalidator"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "ccb8e960c48f04d6935e72476ae4a51028f9e22f"
|
|
||||||
version = "v9"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:652880afc6b57ce0a67173f552cb35ccda816493a1da6ca20e5074a66bcd083f"
|
|
||||||
name = "github.com/buaazp/fasthttprouter"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "ade4e2031af3aed7fffd241084aad80a58faf421"
|
|
||||||
version = "v0.1.1"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:c1100fc71e23b6a32b2c68a5202a848fd13811d5a10b12edb8019c3667d1cd9a"
|
|
||||||
name = "github.com/cenkalti/backoff"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "4b4cebaf850ec58f1bb1fec5bdebdf8501c2bc3f"
|
|
||||||
version = "v3.0.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
|
|
||||||
name = "github.com/davecgh/go-spew"
|
|
||||||
packages = ["spew"]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
|
|
||||||
version = "v1.1.1"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:26d73f0911e537e89d04011f7a65a5cd2d28113d551d4366480b4706b2833e3a"
|
|
||||||
name = "github.com/dlclark/regexp2"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"syntax",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "92c702aa5812963ef9193a9624191932d44073d7"
|
|
||||||
version = "v1.2.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:8b8b34694b7203d3953b903e34d4b99d753e71da8dc0b5570539fc0cd42eb5ee"
|
|
||||||
name = "github.com/dop251/goja"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"ast",
|
|
||||||
"file",
|
|
||||||
"parser",
|
|
||||||
"token",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "aa89e6a4c7339be720f99bae0a56a8f6055b5b3e"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:abeb38ade3f32a92943e5be54f55ed6d6e3b6602761d74b4aab4c9dd45c18abd"
|
|
||||||
name = "github.com/fsnotify/fsnotify"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
|
|
||||||
version = "v1.4.7"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:3e658acf1e5e75c289ba64c08c6006382980f6cbcf3b17505adc95f4dafa40f6"
|
|
||||||
name = "github.com/go-sourcemap/sourcemap"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"internal/base64vlq",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "b019cc30c1eaa584753491b0d8f8c1534bf1eb44"
|
|
||||||
version = "v2.1.2"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:07f4fafe81587b642166199f41c3edcca12929fcfcc0261b00be5dea2f968f44"
|
|
||||||
name = "github.com/golang/protobuf"
|
|
||||||
packages = [
|
|
||||||
"proto",
|
|
||||||
"ptypes",
|
|
||||||
"ptypes/any",
|
|
||||||
"ptypes/duration",
|
|
||||||
"ptypes/struct",
|
|
||||||
"ptypes/timestamp",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "6c65a5562fc06764971b7c5d05c76c75e84bdbf7"
|
|
||||||
version = "v1.3.2"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:c0d19ab64b32ce9fe5cf4ddceba78d5bc9807f0016db6b1183599da3dcc24d10"
|
|
||||||
name = "github.com/hashicorp/hcl"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"hcl/ast",
|
|
||||||
"hcl/parser",
|
|
||||||
"hcl/printer",
|
|
||||||
"hcl/scanner",
|
|
||||||
"hcl/strconv",
|
|
||||||
"hcl/token",
|
|
||||||
"json/parser",
|
|
||||||
"json/scanner",
|
|
||||||
"json/token",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "8cb6e5b959231cc1119e43259c4a608f9c51a241"
|
|
||||||
version = "v1.0.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:2cf4ff28b309c93a52b3329c7a22d5375b137249d4ed63c9d40707a1b253f7df"
|
|
||||||
name = "github.com/integration-system/bellows"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "244325e8836c364c86f308e3aef7e979cb007114"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:c4f3970d1f30f5e9bc1751b62b7ea6127256e59fd63a3d36e166fe1121250c57"
|
|
||||||
name = "github.com/integration-system/go-cmp"
|
|
||||||
packages = [
|
|
||||||
"cmp",
|
|
||||||
"cmp/internal/diff",
|
|
||||||
"cmp/internal/function",
|
|
||||||
"cmp/internal/value",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "ac5582987a2f25e8743e0ebb7259312adda05c23"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:143c6b11b882aae2896e07caad401ec0be62c330a85526b954a2cc5bdb3f75d7"
|
|
||||||
name = "github.com/integration-system/isp-etp-go"
|
|
||||||
packages = [
|
|
||||||
"ack",
|
|
||||||
"bpool",
|
|
||||||
"client",
|
|
||||||
"gen",
|
|
||||||
"parser",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "6e92a3dda2cf7c6ec82fc1a1ae922248754e49d9"
|
|
||||||
version = "v2.0.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:3712790069e6855700e86d0b7b0b80276fa66b73e1aacd085bcd1a57a947e991"
|
|
||||||
name = "github.com/integration-system/isp-lib"
|
|
||||||
packages = [
|
|
||||||
"backend",
|
|
||||||
"bootstrap",
|
|
||||||
"config",
|
|
||||||
"config/schema",
|
|
||||||
"logger",
|
|
||||||
"metric",
|
|
||||||
"modules",
|
|
||||||
"proto/stubs",
|
|
||||||
"streaming",
|
|
||||||
"structure",
|
|
||||||
"utils",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "9ecfa413468d829dce66fe95562b4366b0dfb2a0"
|
|
||||||
version = "v2.0.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:1789fb6e57949a6e4cacb74023cd30efb04b09dc6111d6ef3718241ebb23ebe9"
|
|
||||||
name = "github.com/integration-system/isp-log"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"stdcodes",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "a22bf2e0b56a9ef47db4a98756e39f700a99b688"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:48f3a739fabefebf152d0196277ee89136c1fa6d88fc67fa486fc765a05b1caa"
|
|
||||||
name = "github.com/integration-system/jsonschema"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "5475a8b08e62e41fa886641861ac225e7f91e4e5"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:438016f7d4af8e5a7010b6d0705b267a7607ddc0decad051e83a9458c6b9a523"
|
|
||||||
name = "github.com/jmoiron/jsonq"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "e874b168d07ecc7808bc950a17998a8aa3141d82"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:ac7f1061abc812a5d0de6df7e3f477cef942aef503848f436da0f0eb2603bfbf"
|
|
||||||
name = "github.com/json-iterator/go"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"extra",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "27518f6661eba504be5a7a9a9f6d9460d892ade3"
|
|
||||||
version = "v1.1.7"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:caa1da085cc12cd39d3ddb267434902f621050e1b46f7e9477b2b933df680193"
|
|
||||||
name = "github.com/klauspost/compress"
|
|
||||||
packages = [
|
|
||||||
"flate",
|
|
||||||
"gzip",
|
|
||||||
"zlib",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "da9470192e5d0ad619defde5ded583e5e907d3e8"
|
|
||||||
version = "v1.8.6"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:923c4d7194b42e054b2eb8a6c62824ac55e23ececc1c7e48d4da69c971c55954"
|
|
||||||
name = "github.com/klauspost/cpuid"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "05a8198c0f5a27739aec358908d7e12c64ce6eb7"
|
|
||||||
version = "v1.2.1"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:31e761d97c76151dde79e9d28964a812c46efc5baee4085b86f68f0c654450de"
|
|
||||||
name = "github.com/konsorten/go-windows-terminal-sequences"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "f55edac94c9bbba5d6182a4be46d86a2c9b5b50e"
|
|
||||||
version = "v1.0.2"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:5a0ef768465592efca0412f7e838cdc0826712f8447e70e6ccc52eb441e9ab13"
|
|
||||||
name = "github.com/magiconair/properties"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "de8848e004dd33dc07a2947b3d76f618a7fc7ef1"
|
|
||||||
version = "v1.8.1"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:4a29eeb25603debe8f2098a9902c4d3851034cf70d33be428826e86e8c30a1b0"
|
|
||||||
name = "github.com/mattn/go-colorable"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "98ec13f34aabf44cc914c65a1cfb7b9bc815aef1"
|
|
||||||
version = "v0.1.4"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:d62282425ffb75047679d7e2c3b980eea7f82c05ef5fb9142ee617ebac6e7432"
|
|
||||||
name = "github.com/mattn/go-isatty"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "88ba11cfdc67c7588b30042edf244b2875f892b6"
|
|
||||||
version = "v0.0.10"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:2b32af4d2a529083275afc192d1067d8126b578c7a9613b26600e4df9c735155"
|
|
||||||
name = "github.com/mgutz/ansi"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "9520e82c474b0a04dd04f8a40959027271bab992"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:53bc4cd4914cd7cd52139990d5170d6dc99067ae31c56530621b18b35fc30318"
|
|
||||||
name = "github.com/mitchellh/mapstructure"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "3536a929edddb9a5b34bd6861dc4a9647cb459fe"
|
|
||||||
version = "v1.1.2"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:33422d238f147d247752996a26574ac48dcf472976eda7f5134015f06bf16563"
|
|
||||||
name = "github.com/modern-go/concurrent"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94"
|
|
||||||
version = "1.0.3"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:e32bdbdb7c377a07a9a46378290059822efdce5c8d96fe71940d87cb4f918855"
|
|
||||||
name = "github.com/modern-go/reflect2"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd"
|
|
||||||
version = "1.0.1"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:84bd7f8a2e0bcd53ddc33c3b47c34c1fe340c8632cbe928f7f8ae10ec6ecdd62"
|
|
||||||
name = "github.com/mohae/deepcopy"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "c48cc78d482608239f6c4c92a4abd87eb8761c90"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:bbd3997f0121200f72b64d7a3826eb8a0b910d6a4c19894c9fe2852b9e5eaf3b"
|
|
||||||
name = "github.com/pelletier/go-toml"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "8fe62057ea2d46ce44254c98e84e810044dbe197"
|
|
||||||
version = "v1.5.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
|
|
||||||
name = "github.com/pmezard/go-difflib"
|
|
||||||
packages = ["difflib"]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
|
||||||
version = "v1.0.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:5bbebe8ac19ecb6c87790a89faa20566e38ed0d6494a1d14c4f5b05d9ce2436c"
|
|
||||||
name = "github.com/rcrowley/go-metrics"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "cac0b30c2563378d434b5af411844adff8e32960"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:dbfe572cc258e5bcf54cb650a06d90edd0da04e42ca1ed909cc1d49f00011c63"
|
|
||||||
name = "github.com/robertkrimen/otto"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"ast",
|
|
||||||
"dbg",
|
|
||||||
"file",
|
|
||||||
"parser",
|
|
||||||
"registry",
|
|
||||||
"token",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "15f95af6e78dcd2030d8195a138bd88d4f403546"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:04457f9f6f3ffc5fea48e71d62f2ca256637dee0a04d710288e27e05c8b41976"
|
|
||||||
name = "github.com/sirupsen/logrus"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "839c75faf7f98a33d445d181f3018b5c3409a45e"
|
|
||||||
version = "v1.4.2"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:bb495ec276ab82d3dd08504bbc0594a65de8c3b22c6f2aaa92d05b73fbf3a82e"
|
|
||||||
name = "github.com/spf13/afero"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"mem",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "588a75ec4f32903aa5e39a2619ba6a4631e28424"
|
|
||||||
version = "v1.2.2"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:08d65904057412fc0270fc4812a1c90c594186819243160dc779a402d4b6d0bc"
|
|
||||||
name = "github.com/spf13/cast"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "8c9545af88b134710ab1cd196795e7f2388358d7"
|
|
||||||
version = "v1.3.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:1b753ec16506f5864d26a28b43703c58831255059644351bbcb019b843950900"
|
|
||||||
name = "github.com/spf13/jwalterweatherman"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "94f6ae3ed3bceceafa716478c5fbf8d29ca601a1"
|
|
||||||
version = "v1.1.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:524b71991fc7d9246cc7dc2d9e0886ccb97648091c63e30eef619e6862c955dd"
|
|
||||||
name = "github.com/spf13/pflag"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "2e9d26c8c37aae03e3f9d4e90b7116f5accb7cab"
|
|
||||||
version = "v1.0.5"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:11118bd196646c6515fea3d6c43f66162833c6ae4939bfb229b9956d91c6cf17"
|
|
||||||
name = "github.com/spf13/viper"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "b5bf975e5823809fb22c7644d008757f78a4259e"
|
|
||||||
version = "v1.4.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:8548c309c65a85933a625be5e7d52b6ac927ca30c56869fae58123b8a77a75e1"
|
|
||||||
name = "github.com/stretchr/testify"
|
|
||||||
packages = ["assert"]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "221dbe5ed46703ee255b1da0dec05086f5035f62"
|
|
||||||
version = "v1.4.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:d32b64a7a82dd36b674fb73ff767e949eb7155b6b574ff276f49d4edc8af105f"
|
|
||||||
name = "github.com/thecodeteam/goodbye"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "a83968bda2d37294a3541b7d2207fb6f5a3559a3"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:c468422f334a6b46a19448ad59aaffdfc0a36b08fdcc1c749a0b29b6453d7e59"
|
|
||||||
name = "github.com/valyala/bytebufferpool"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "e746df99fe4a3986f4d4f79e13c1e0117ce9c2f7"
|
|
||||||
version = "v1.0.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:7ea372c9f52b7a8b69ac4533e030b1175839cd3216cc333e50917b06a87e8260"
|
|
||||||
name = "github.com/valyala/fasthttp"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"fasthttputil",
|
|
||||||
"stackless",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "ffcdb753b1212a4f3531dd6a7d665a24c57e55bd"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:39a425f98fb19427061a693fe6bf0683c9bddec4b25b17067e34fdb465e39cb9"
|
|
||||||
name = "github.com/x-cray/logrus-prefixed-formatter"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "bb2702d423886830dee131692131d35648c382e2"
|
|
||||||
version = "v0.5.2"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:f680304b19a1f055b5df0ef87918d7f0920ef117c194ea25a8189e13ccb6ad52"
|
|
||||||
name = "github.com/yuin/gopher-lua"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"ast",
|
|
||||||
"parse",
|
|
||||||
"pm",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "1cd887cd7036fd4be7a0cb180dd508cb8e2e689a"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:bbe51412d9915d64ffaa96b51d409e070665efc5194fcf145c4a27d4133107a4"
|
|
||||||
name = "golang.org/x/crypto"
|
|
||||||
packages = ["ssh/terminal"]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "87dc89f01550277dc22b74ffcf4cd89fa2f40f4c"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:c124e945335a9c62ede3a565f3198c5ae9a5ecc39fddd85871138362d128fb74"
|
|
||||||
name = "golang.org/x/net"
|
|
||||||
packages = [
|
|
||||||
"context",
|
|
||||||
"http/httpguts",
|
|
||||||
"http2",
|
|
||||||
"http2/hpack",
|
|
||||||
"idna",
|
|
||||||
"internal/timeseries",
|
|
||||||
"trace",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "da9a3fd4c5820e74b24a6cb7fb438dc9b0dd377c"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:9f5be1dbb5091bb62d83fbb6db8e794adb8f0e05424679d6f15a17b670e38b4c"
|
|
||||||
name = "golang.org/x/sys"
|
|
||||||
packages = [
|
|
||||||
"unix",
|
|
||||||
"windows",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "b09406accb4736d857a32bf9444cd7edae2ffa79"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:899611736f6c2bec18cdb819e0b6b7b4fcf8dd955fa90d39741100dfd719f938"
|
|
||||||
name = "golang.org/x/text"
|
|
||||||
packages = [
|
|
||||||
"cases",
|
|
||||||
"collate",
|
|
||||||
"collate/build",
|
|
||||||
"internal",
|
|
||||||
"internal/colltab",
|
|
||||||
"internal/gen",
|
|
||||||
"internal/language",
|
|
||||||
"internal/language/compact",
|
|
||||||
"internal/tag",
|
|
||||||
"internal/triegen",
|
|
||||||
"internal/ucd",
|
|
||||||
"language",
|
|
||||||
"secure/bidirule",
|
|
||||||
"transform",
|
|
||||||
"unicode/bidi",
|
|
||||||
"unicode/cldr",
|
|
||||||
"unicode/norm",
|
|
||||||
"unicode/rangetable",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "342b2e1fbaa52c93f31447ad2c6abc048c63e475"
|
|
||||||
version = "v0.3.2"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:a910255c3b706b4d8f2b185ed6b40c8f31b805111be240def2bdf2c62b87591b"
|
|
||||||
name = "google.golang.org/genproto"
|
|
||||||
packages = [
|
|
||||||
"googleapis/rpc/errdetails",
|
|
||||||
"googleapis/rpc/status",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "548a555dbc03994223efbaba0090152849259498"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:6cd77d0b616d2dcebd363dfecba593f27b0151fc82cdb5fbfb96c5a7cfbc95b5"
|
|
||||||
name = "google.golang.org/grpc"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"balancer",
|
|
||||||
"balancer/base",
|
|
||||||
"balancer/roundrobin",
|
|
||||||
"binarylog/grpc_binarylog_v1",
|
|
||||||
"codes",
|
|
||||||
"connectivity",
|
|
||||||
"credentials",
|
|
||||||
"credentials/internal",
|
|
||||||
"encoding",
|
|
||||||
"encoding/proto",
|
|
||||||
"grpclog",
|
|
||||||
"internal",
|
|
||||||
"internal/backoff",
|
|
||||||
"internal/balancerload",
|
|
||||||
"internal/binarylog",
|
|
||||||
"internal/channelz",
|
|
||||||
"internal/envconfig",
|
|
||||||
"internal/grpcrand",
|
|
||||||
"internal/grpcsync",
|
|
||||||
"internal/syscall",
|
|
||||||
"internal/transport",
|
|
||||||
"keepalive",
|
|
||||||
"metadata",
|
|
||||||
"naming",
|
|
||||||
"peer",
|
|
||||||
"resolver",
|
|
||||||
"resolver/dns",
|
|
||||||
"resolver/passthrough",
|
|
||||||
"serviceconfig",
|
|
||||||
"stats",
|
|
||||||
"status",
|
|
||||||
"tap",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "f6d0f9ee430895e87ef1ceb5ac8f39725bafceef"
|
|
||||||
version = "v1.24.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:9935525a8c49b8434a0b0a54e1980e94a6fae73aaff45c5d33ba8dff69de123e"
|
|
||||||
name = "gopkg.in/sourcemap.v1"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"base64vlq",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "6e83acea0053641eff084973fee085f0c193c61a"
|
|
||||||
version = "v1.0.5"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:59f10c1537d2199d9115d946927fe31165959a95190849c82ff11e05803528b0"
|
|
||||||
name = "gopkg.in/yaml.v2"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "f221b8435cfb71e54062f6c6e99e9ade30b124d5"
|
|
||||||
version = "v2.2.4"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:2f72e66c05f8b43dbe2120fa4c53e25f45f73b2fbf5b8c191a20453fb2fb61fb"
|
|
||||||
name = "layeh.com/gopher-json"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "97fed8db84274c421dbfffbb28ec859901556b97"
|
|
||||||
source = "https://github.com/layeh/gopher-json.git"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
digest = "1:25ea8c84118bb09a6ea1fe5d8a2e72d7ead40af714b74d1e849af821f3502414"
|
|
||||||
name = "nhooyr.io/websocket"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"internal/bpool",
|
|
||||||
"internal/wsjs",
|
|
||||||
]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "edda9c633d5c78c7d38fcc952b4105dd4ccfb619"
|
|
||||||
version = "v1.7.4"
|
|
||||||
|
|
||||||
[solve-meta]
|
|
||||||
analyzer-name = "dep"
|
|
||||||
analyzer-version = 1
|
|
||||||
input-imports = [
|
|
||||||
"github.com/dop251/goja",
|
|
||||||
"github.com/integration-system/isp-lib/backend",
|
|
||||||
"github.com/integration-system/isp-lib/bootstrap",
|
|
||||||
"github.com/integration-system/isp-lib/config",
|
|
||||||
"github.com/integration-system/isp-lib/config/schema",
|
|
||||||
"github.com/integration-system/isp-lib/logger",
|
|
||||||
"github.com/integration-system/isp-lib/modules",
|
|
||||||
"github.com/integration-system/isp-lib/structure",
|
|
||||||
"github.com/integration-system/isp-log",
|
|
||||||
"github.com/jmoiron/jsonq",
|
|
||||||
"github.com/json-iterator/go",
|
|
||||||
"github.com/robertkrimen/otto",
|
|
||||||
"github.com/robertkrimen/otto/parser",
|
|
||||||
"github.com/stretchr/testify/assert",
|
|
||||||
"github.com/yuin/gopher-lua",
|
|
||||||
"github.com/yuin/gopher-lua/parse",
|
|
||||||
"google.golang.org/grpc",
|
|
||||||
"google.golang.org/grpc/codes",
|
|
||||||
"google.golang.org/grpc/metadata",
|
|
||||||
"google.golang.org/grpc/status",
|
|
||||||
"layeh.com/gopher-json",
|
|
||||||
]
|
|
||||||
solver-name = "gps-cdcl"
|
|
||||||
solver-version = 1
|
|
||||||
-37
@@ -1,37 +0,0 @@
|
|||||||
# Gopkg.toml example
|
|
||||||
#
|
|
||||||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
|
|
||||||
# for detailed Gopkg.toml documentation.
|
|
||||||
#
|
|
||||||
# required = ["github.com/user/thing/cmd/thing"]
|
|
||||||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
|
||||||
#
|
|
||||||
# [[constraint]]
|
|
||||||
# name = "github.com/user/project"
|
|
||||||
# version = "1.0.0"
|
|
||||||
#
|
|
||||||
# [[constraint]]
|
|
||||||
# name = "github.com/user/project2"
|
|
||||||
# branch = "dev"
|
|
||||||
# source = "github.com/myfork/project2"
|
|
||||||
#
|
|
||||||
# [[override]]
|
|
||||||
# name = "github.com/x/y"
|
|
||||||
# version = "2.4.0"
|
|
||||||
#
|
|
||||||
# [prune]
|
|
||||||
# non-go = false
|
|
||||||
# go-tests = true
|
|
||||||
# unused-packages = true
|
|
||||||
|
|
||||||
[[override]]
|
|
||||||
name = "layeh.com/gopher-json"
|
|
||||||
source = "https://github.com/layeh/gopher-json.git"
|
|
||||||
|
|
||||||
[[override]]
|
|
||||||
name = "github.com/valyala/fasthttp"
|
|
||||||
branch = "master"
|
|
||||||
|
|
||||||
[prune]
|
|
||||||
go-tests = true
|
|
||||||
unused-packages = true
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
package adapter
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/jmoiron/jsonq"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
mdmId = "mdm_id"
|
|
||||||
mdmVersion = "mdm_version"
|
|
||||||
mdmDocuments = "documents"
|
|
||||||
mdmRelatives = "citizen_relatives"
|
|
||||||
mdmContacts = "contacts"
|
|
||||||
mdmUsers = "users"
|
|
||||||
mdmEsCreds = "escredentials"
|
|
||||||
mdmAddresses = "addresses"
|
|
||||||
|
|
||||||
documentsPath = "documents"
|
|
||||||
docTypePath = "id_tp_cd"
|
|
||||||
|
|
||||||
relativesPath = "citizen_relatives"
|
|
||||||
relativesTypePath = "rel_tp_cd"
|
|
||||||
|
|
||||||
contactPath = "contacts"
|
|
||||||
contactsTypePath = "cont_meth_cat_cd"
|
|
||||||
|
|
||||||
usersPath = "users"
|
|
||||||
usersTypePath = "id_type"
|
|
||||||
|
|
||||||
esCredsPath = "escredentials"
|
|
||||||
esCredsTypePath = "escred_tp_cd"
|
|
||||||
|
|
||||||
addressesPath = "addresses"
|
|
||||||
addressesTypePath = "addr_usage_tp_cd"
|
|
||||||
|
|
||||||
allOtherValues = "*"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
usersTypeMapping = map[string]string{
|
|
||||||
"SSO": "SSO",
|
|
||||||
"ЕРЛ": "ERL",
|
|
||||||
"МФЦ": "MFC",
|
|
||||||
allOtherValues: "NOT_SSO",
|
|
||||||
}
|
|
||||||
relativesTypeMapping = map[string]string{
|
|
||||||
"1000003": "1000003",
|
|
||||||
"1000004": "1000004",
|
|
||||||
allOtherValues: "OTHERS",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func getCustomData(data map[string]interface{}, id string, version int64) map[string]interface{} {
|
|
||||||
jq := jsonq.NewQuery(data)
|
|
||||||
|
|
||||||
m := make(map[string]interface{}, 6)
|
|
||||||
m[mdmId] = id
|
|
||||||
m[mdmVersion] = version
|
|
||||||
|
|
||||||
expandArray(jq, m, documentsPath, docTypePath, mdmDocuments)
|
|
||||||
expandArray(jq, m, contactPath, contactsTypePath, mdmContacts)
|
|
||||||
expandArray(jq, m, esCredsPath, esCredsTypePath, mdmEsCreds)
|
|
||||||
expandArray(jq, m, addressesPath, addressesTypePath, mdmAddresses)
|
|
||||||
|
|
||||||
// Custom transform fields
|
|
||||||
expandArrayWithMapping(jq, m, usersPath, usersTypePath, mdmUsers, usersTypeMapping)
|
|
||||||
expandArrayWithMapping(jq, m, relativesPath, relativesTypePath, mdmRelatives, relativesTypeMapping)
|
|
||||||
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
|
|
||||||
func expandArray(src *jsonq.JsonQuery, dst map[string]interface{}, arrayPath, typeFieldPath, dstKey string) {
|
|
||||||
docs, err := src.ArrayOfObjects(arrayPath)
|
|
||||||
l := len(docs)
|
|
||||||
if err == nil && l > 0 {
|
|
||||||
documents := make(map[string][]interface{}, l)
|
|
||||||
for _, d := range docs {
|
|
||||||
if docType, ok := d[typeFieldPath]; ok {
|
|
||||||
if docTypeStr, ok := docType.(string); ok {
|
|
||||||
putDoc(documents, docTypeStr, d)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(documents) > 0 {
|
|
||||||
dst[dstKey] = documents
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func expandArrayWithMapping(
|
|
||||||
src *jsonq.JsonQuery,
|
|
||||||
dst map[string]interface{},
|
|
||||||
arrayPath, typeFieldPath, dstKey string,
|
|
||||||
mapping map[string]string,
|
|
||||||
) {
|
|
||||||
docs, err := src.ArrayOfObjects(arrayPath)
|
|
||||||
l := len(docs)
|
|
||||||
if err == nil && l > 0 {
|
|
||||||
documents := make(map[string][]interface{}, l)
|
|
||||||
for _, d := range docs {
|
|
||||||
if docType, ok := d[typeFieldPath]; ok {
|
|
||||||
if docTypeStr, ok := docType.(string); ok {
|
|
||||||
if v, ok := mapping[docTypeStr]; ok {
|
|
||||||
putDoc(documents, v, d)
|
|
||||||
} else if v, ok := mapping[allOtherValues]; ok {
|
|
||||||
putDoc(documents, v, d)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(documents) > 0 {
|
|
||||||
dst[dstKey] = documents
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func putDoc(dst map[string][]interface{}, key string, value interface{}) {
|
|
||||||
if arr, ok := dst[key]; ok {
|
|
||||||
dst[key] = append(arr, value)
|
|
||||||
} else {
|
|
||||||
dst[key] = []interface{}{value}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
var mdmId = "mdm_id";
|
|
||||||
var mdmVersion = "mdm_version";
|
|
||||||
|
|
||||||
var documentsPath = "documents";
|
|
||||||
var docTypePath = "id_tp_cd";
|
|
||||||
|
|
||||||
var relativesPath = "citizen_relatives";
|
|
||||||
var relativesTypePath = "rel_tp_cd";
|
|
||||||
|
|
||||||
var contactPath = "contacts";
|
|
||||||
var contactsTypePath = "cont_meth_cat_cd";
|
|
||||||
|
|
||||||
var usersPath = "users";
|
|
||||||
var usersTypePath = "id_type";
|
|
||||||
|
|
||||||
var esCredsPath = "escredentials";
|
|
||||||
var esCredsTypePath = "escred_tp_cd";
|
|
||||||
|
|
||||||
var addressesPath = "addresses";
|
|
||||||
var addressesTypePath = "addr_usage_tp_cd";
|
|
||||||
|
|
||||||
var allOtherValues = "*";
|
|
||||||
|
|
||||||
var userTypeMapping = {};
|
|
||||||
userTypeMapping["SSO"] = "SSO";
|
|
||||||
userTypeMapping["ЕРЛ"] = "ERL";
|
|
||||||
userTypeMapping["МФЦ"] = "MFC";
|
|
||||||
userTypeMapping[allOtherValues] = "NOT_SSO";
|
|
||||||
|
|
||||||
var relativesTypeMappng = {};
|
|
||||||
relativesTypeMappng["1000003"] = "1000003";
|
|
||||||
relativesTypeMappng["1000004"] = "1000004";
|
|
||||||
relativesTypeMappng[allOtherValues] = "OTHERS";
|
|
||||||
|
|
||||||
var id = arg["id"];
|
|
||||||
var version = arg["version"];
|
|
||||||
var data = arg["data"];
|
|
||||||
|
|
||||||
function expandArray(oldData, typeFieldPath) {
|
|
||||||
var newData = {};
|
|
||||||
for (var i = 0; i < oldData.length; i++) {
|
|
||||||
var oldDataElement = oldData[i];
|
|
||||||
var key = oldDataElement[typeFieldPath];
|
|
||||||
var newDataElement = newData[key];
|
|
||||||
if (newDataElement) {
|
|
||||||
newDataElement.push(oldDataElement)
|
|
||||||
} else {
|
|
||||||
newData[key] = [oldDataElement]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return newData;
|
|
||||||
}
|
|
||||||
|
|
||||||
function expandArrayWithMapping(oldData, typeFieldPath, mapping) {
|
|
||||||
var newData = {};
|
|
||||||
for (var i = 0; i < oldData.length; i++) {
|
|
||||||
var oldDataElement = oldData[i];
|
|
||||||
var key = oldData[i][typeFieldPath];
|
|
||||||
if (!mapping[key]) {
|
|
||||||
key = mapping[allOtherValues]
|
|
||||||
}
|
|
||||||
var newDataElement = newData[key];
|
|
||||||
if (newDataElement) {
|
|
||||||
newDataElement.push(oldDataElement)
|
|
||||||
} else {
|
|
||||||
newData[key] = [oldDataElement]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return newData;
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = {};
|
|
||||||
response[mdmId] = id;
|
|
||||||
response[mdmVersion] = version;
|
|
||||||
|
|
||||||
response[documentsPath] = expandArray(data[documentsPath], docTypePath);
|
|
||||||
response[contactPath] = expandArray(data[contactPath], contactsTypePath);
|
|
||||||
response[esCredsPath] = expandArray(data[esCredsPath], esCredsTypePath);
|
|
||||||
response[addressesPath] = expandArray(data[addressesPath], addressesTypePath);
|
|
||||||
|
|
||||||
response[usersPath] = expandArrayWithMapping(data[usersPath], usersTypePath, userTypeMapping);
|
|
||||||
response[relativesPath] = expandArrayWithMapping(data[relativesPath], relativesTypePath, relativesTypeMappng);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
package adapter
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"github.com/integration-system/isp-lib/config"
|
|
||||||
jsoniter "github.com/json-iterator/go"
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"io/ioutil"
|
|
||||||
"isp-script-service/compile"
|
|
||||||
"isp-script-service/conf"
|
|
||||||
"isp-script-service/controller"
|
|
||||||
"isp-script-service/domain"
|
|
||||||
"isp-script-service/script"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
remoteConf = `{
|
|
||||||
"scriptExecutionTimeoutMs": 200
|
|
||||||
}`
|
|
||||||
|
|
||||||
id = "123"
|
|
||||||
version = 10
|
|
||||||
|
|
||||||
objectFile = "obj.json"
|
|
||||||
scriptFile = "custom_date.js"
|
|
||||||
)
|
|
||||||
|
|
||||||
var data map[string]interface{}
|
|
||||||
var request = domain.ExecuteRequest{}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
config.InitRemoteConfig(&conf.RemoteConfig{}, []byte(remoteConf))
|
|
||||||
|
|
||||||
obj, err := readFile(objectFile)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err = json.Unmarshal(obj, &data); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
obj, err = readFile(scriptFile)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
script := string(obj)
|
|
||||||
arg := map[string]interface{}{
|
|
||||||
"id": id,
|
|
||||||
"version": version,
|
|
||||||
"data": data,
|
|
||||||
}
|
|
||||||
request = domain.ExecuteRequest{
|
|
||||||
Script: script,
|
|
||||||
Arg: arg,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCustomDate(t *testing.T) {
|
|
||||||
a := assert.New(t)
|
|
||||||
|
|
||||||
execute := controller.Script.Execute(request)
|
|
||||||
if !a.Zero(execute.Error) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
executeResult, _ := json.Marshal(execute.Result)
|
|
||||||
|
|
||||||
customDate := getCustomData(data, id, version)
|
|
||||||
customDateResult, _ := json.Marshal(customDate)
|
|
||||||
|
|
||||||
if !a.Equal(string(customDateResult), string(executeResult)) {
|
|
||||||
log.Println("not equal")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func BenchmarkGoCustomData(b *testing.B) {
|
|
||||||
for i := 0; i < b.N; i++ {
|
|
||||||
_ = getCustomData(data, id, version)
|
|
||||||
//json.Marshal(customDate)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func BenchmarkJsCustomData(b *testing.B) {
|
|
||||||
scr, err := compile.Script.Create(request.Script)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
for i := 0; i < b.N; i++ {
|
|
||||||
_, _ = script.Default().Execute(scr, request.Arg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func BenchmarkInlineJson(b *testing.B) {
|
|
||||||
c, err := compile.Script.Create("var b = JSON.parse(arg); return JSON.stringify(b)")
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
data, err := readFile(objectFile)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
for i := 0; i < b.N; i++ {
|
|
||||||
_, err := script.Default().Execute(c, string(data))
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func BenchmarkJsoniterJson(b *testing.B) {
|
|
||||||
c, err := compile.Script.Create("var b = arg; return b")
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
data, err := readFile(objectFile)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
json := jsoniter.ConfigFastest
|
|
||||||
for i := 0; i < b.N; i++ {
|
|
||||||
m := make(map[string]interface{})
|
|
||||||
if err := json.Unmarshal(data, &m); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
res, err := script.Default().Execute(c, m)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
if _, err = json.Marshal(res); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func readFile(name string) ([]byte, error) {
|
|
||||||
file, err := os.Open(name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer func() { _ = file.Close() }()
|
|
||||||
|
|
||||||
obj, err := ioutil.ReadAll(file)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj, nil
|
|
||||||
}
|
|
||||||
@@ -1,447 +0,0 @@
|
|||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"enabled": false,
|
|
||||||
"id_type": "xren",
|
|
||||||
"del_sign": true,
|
|
||||||
"id_value": "irure ut ullamco consectetur",
|
|
||||||
"etalon_id": "veniam",
|
|
||||||
"ext_upd_date": "1942-07-30T22:46:01.334Z",
|
|
||||||
"temporary_id": "aliquip est veniam laborum reprehenderit",
|
|
||||||
"last_update_dt": "1986-12-27T04:43:03.290Z",
|
|
||||||
"is_confirmed_offline": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"enabled": true,
|
|
||||||
"id_type": "sso_id",
|
|
||||||
"del_sign": true,
|
|
||||||
"id_value": "aute",
|
|
||||||
"etalon_id": "dolore",
|
|
||||||
"ext_upd_date": "1990-12-01T04:37:49.084Z",
|
|
||||||
"temporary_id": "exercitation veniam ut occaec",
|
|
||||||
"last_update_dt": "1955-12-12T16:48:38.628Z",
|
|
||||||
"is_confirmed_offline": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"enabled": false,
|
|
||||||
"id_type": "sso",
|
|
||||||
"del_sign": true,
|
|
||||||
"id_value": "eu nulla labore minim",
|
|
||||||
"etalon_id": "eiusmod est",
|
|
||||||
"ext_upd_date": "1964-04-10T08:54:11.408Z",
|
|
||||||
"temporary_id": "proident qui",
|
|
||||||
"last_update_dt": "2008-12-18T04:19:19.341Z",
|
|
||||||
"is_confirmed_offline": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"enabled": true,
|
|
||||||
"id_type": "SSO",
|
|
||||||
"del_sign": false,
|
|
||||||
"id_value": "est",
|
|
||||||
"etalon_id": "eiusmod",
|
|
||||||
"ext_upd_date": "1991-08-07T21:35:33.740Z",
|
|
||||||
"temporary_id": "veniam",
|
|
||||||
"last_update_dt": "1976-08-30T11:08:08.825Z",
|
|
||||||
"is_confirmed_offline": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"enabled": true,
|
|
||||||
"id_type": "xren",
|
|
||||||
"del_sign": false,
|
|
||||||
"id_value": "ex non eu",
|
|
||||||
"etalon_id": "cillum adipisicing Lorem",
|
|
||||||
"ext_upd_date": "1999-07-12T13:23:14.040Z",
|
|
||||||
"temporary_id": "nulla ea deserunt",
|
|
||||||
"last_update_dt": "1989-09-01T09:35:37.822Z",
|
|
||||||
"is_confirmed_offline": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"gkupays": [
|
|
||||||
{
|
|
||||||
"epd": "occaecat et dolor",
|
|
||||||
"phone": "culpa aliquip commodo et laborum",
|
|
||||||
"del_sign": false,
|
|
||||||
"mesmeter": "co",
|
|
||||||
"etalon_id": "ipsum magna ut id in",
|
|
||||||
"mesaccount": "consequat fugiat id commodo in",
|
|
||||||
"epd_comment": "voluptate ut tempor",
|
|
||||||
"chronicle_id": "culpa",
|
|
||||||
"temporary_id": "et pariatur dolore in",
|
|
||||||
"last_update_dt": "1988-05-21T14:00:47.065Z",
|
|
||||||
"entity_active_ind": false,
|
|
||||||
"gkupay_address_rel": "L"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"epd": "et Excepteur aute exercitation fugiat",
|
|
||||||
"phone": "id do officia nostru",
|
|
||||||
"del_sign": false,
|
|
||||||
"mesmeter": "adipisicing",
|
|
||||||
"etalon_id": "nostrud in sit",
|
|
||||||
"mesaccount": "adipisicing proident irure Ut",
|
|
||||||
"epd_comment": "officia",
|
|
||||||
"chronicle_id": "anim irure sed",
|
|
||||||
"temporary_id": "est Lorem",
|
|
||||||
"last_update_dt": "2013-01-10T23:37:54.506Z",
|
|
||||||
"entity_active_ind": false,
|
|
||||||
"gkupay_address_rel": "eiusmod tempor adipisici"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"epd": "cillum occaecat aliquip nostrud",
|
|
||||||
"phone": "laboris ipsum Ut quis",
|
|
||||||
"del_sign": true,
|
|
||||||
"mesmeter": "incididunt in sed nostrud",
|
|
||||||
"etalon_id": "consectetur dolor",
|
|
||||||
"mesaccount": "aute velit labore tempor",
|
|
||||||
"epd_comment": "tempor veniam in Ut amet",
|
|
||||||
"chronicle_id": "ipsum ut deserunt",
|
|
||||||
"temporary_id": "et veniam",
|
|
||||||
"last_update_dt": "1975-10-06T03:55:16.662Z",
|
|
||||||
"entity_active_ind": false,
|
|
||||||
"gkupay_address_rel": "non pariatur consectetur do"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"epd": "dolore pariatur incididunt irure et",
|
|
||||||
"phone": "dolor cillum",
|
|
||||||
"del_sign": false,
|
|
||||||
"mesmeter": "sit cupidatat laborum culpa repr",
|
|
||||||
"etalon_id": "sint esse culpa",
|
|
||||||
"mesaccount": "ipsum",
|
|
||||||
"epd_comment": "elit et",
|
|
||||||
"chronicle_id": "magna elit consequat minim Duis",
|
|
||||||
"temporary_id": "enim tempor deserunt eu",
|
|
||||||
"last_update_dt": "1984-12-05T04:43:33.615Z",
|
|
||||||
"entity_active_ind": true,
|
|
||||||
"gkupay_address_rel": "in dolore"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pending": false,
|
|
||||||
"birth_dt": "1999-01-18T10:06:31.551Z",
|
|
||||||
"contacts": [
|
|
||||||
{
|
|
||||||
"ref_num": "amet",
|
|
||||||
"del_sign": true,
|
|
||||||
"etalon_id": "adipisicing nulla",
|
|
||||||
"external_id": "fugiat minim nisi Ut D",
|
|
||||||
"temporary_id": "sunt irure laborum in dolor",
|
|
||||||
"last_update_dt": "1960-12-21T20:41:27.500Z",
|
|
||||||
"cont_meth_cat_cd": "3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ref_num": "culpa tempo",
|
|
||||||
"del_sign": false,
|
|
||||||
"etalon_id": "culpa nostrud dolore aute in",
|
|
||||||
"external_id": "consectetur occaecat minim in",
|
|
||||||
"temporary_id": "non magna",
|
|
||||||
"last_update_dt": "1981-07-15T18:31:55.887Z",
|
|
||||||
"cont_meth_cat_cd": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ref_num": "occaecat consequat",
|
|
||||||
"del_sign": false,
|
|
||||||
"etalon_id": "incididunt",
|
|
||||||
"external_id": "aliqua ut deserunt anim",
|
|
||||||
"temporary_id": "consequat ut aliqua adipisicing",
|
|
||||||
"last_update_dt": "1941-12-21T15:44:54.495Z",
|
|
||||||
"cont_meth_cat_cd": "3"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"del_sign": false,
|
|
||||||
"rip_date": "1995-07-20T07:01:57.462Z",
|
|
||||||
"start_dt": "1944-03-27T02:20:36.565Z",
|
|
||||||
"vehicles": [
|
|
||||||
{
|
|
||||||
"del_sign": true,
|
|
||||||
"etalon_id": "incididunt",
|
|
||||||
"pts_number": "commodo velit ipsum sint",
|
|
||||||
"reg_number": "incididunt irure e",
|
|
||||||
"sts_number": "deserunt amet reprehenderit ips",
|
|
||||||
"vin_number": "occaecat",
|
|
||||||
"description": "exercitation cillum dolore",
|
|
||||||
"chronicle_id": "pariatur ess",
|
|
||||||
"temporary_id": "ad elit eu velit ex",
|
|
||||||
"last_update_dt": "1992-05-07T15:07:41.385Z",
|
|
||||||
"vehicles_docs_rel": [
|
|
||||||
{
|
|
||||||
"document_id": "officia labore irure nisi fugiat"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"document_id": "est et"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"document_id": "proident"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"document_id": "minim"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"del_sign": true,
|
|
||||||
"etalon_id": "qui",
|
|
||||||
"pts_number": "elit pariatur exe",
|
|
||||||
"reg_number": "velit dolor sit commodo",
|
|
||||||
"sts_number": "anim Lorem ut",
|
|
||||||
"vin_number": "enim pariatur",
|
|
||||||
"description": "ut minim ullamco voluptate fugiat",
|
|
||||||
"chronicle_id": "inc",
|
|
||||||
"temporary_id": "adipisicing",
|
|
||||||
"last_update_dt": "2010-06-21T07:56:24.680Z",
|
|
||||||
"vehicles_docs_rel": [
|
|
||||||
{
|
|
||||||
"document_id": "deserunt sunt tempor"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"document_id": "cupidatat Duis mollit"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"document_id": "quis voluptate amet occaecat sint"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"addresses": [
|
|
||||||
{
|
|
||||||
"unad": "dolor qui sed adipisicing magna",
|
|
||||||
"unom": "eiusmod laboris et",
|
|
||||||
"end_dt": "1972-07-19T15:28:10.522Z",
|
|
||||||
"region": "do eu",
|
|
||||||
"room_no": "magna adipisicing ipsum",
|
|
||||||
"del_sign": false,
|
|
||||||
"house_no": "aute dolor sint",
|
|
||||||
"kladr_id": "in ut consectetur Duis nulla",
|
|
||||||
"city_name": "occaecat",
|
|
||||||
"corpus_no": "est",
|
|
||||||
"etalon_id": "labore adipisicing",
|
|
||||||
"street_id": "occaecat ad dolore",
|
|
||||||
"street_omk": "ut culpa",
|
|
||||||
"external_id": "ut q",
|
|
||||||
"postal_code": "proident officia consectetur",
|
|
||||||
"stroenie_no": "do culpa cupidatat fu",
|
|
||||||
"temporary_id": "v",
|
|
||||||
"addr_line_one": "nulla",
|
|
||||||
"addr_line_two": "sunt",
|
|
||||||
"building_name": "laborum cillum",
|
|
||||||
"residence_num": "pariatur ex",
|
|
||||||
"last_update_dt": "1978-09-14T08:28:25.830Z",
|
|
||||||
"street_name_ex": "id non mollit minim",
|
|
||||||
"addr_line_three": "in esse",
|
|
||||||
"addr_usage_tp_cd": "7",
|
|
||||||
"moscow_area_name": "sunt",
|
|
||||||
"last_verified_date": "1991-03-21T21:03:44.972Z",
|
|
||||||
"moscow_area_ext_id": "ad laboris exercitation Duis",
|
|
||||||
"moscow_district_id": "nostrud",
|
|
||||||
"moscow_district_name": "adipisicing fugiat id veniam ut"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"unad": "deserunt est culpa minim",
|
|
||||||
"unom": "ut c",
|
|
||||||
"end_dt": "1950-12-20T10:27:39.133Z",
|
|
||||||
"region": "occaecat dolor Excepteur",
|
|
||||||
"room_no": "Excepteur consectetur elit",
|
|
||||||
"del_sign": false,
|
|
||||||
"house_no": "cillum non in cupidatat",
|
|
||||||
"kladr_id": "et",
|
|
||||||
"city_name": "velit laborum Duis",
|
|
||||||
"corpus_no": "eu pariatur culpa incididunt",
|
|
||||||
"etalon_id": "fugiat",
|
|
||||||
"street_id": "ex labore cillum s",
|
|
||||||
"street_omk": "minim Duis magna sunt",
|
|
||||||
"external_id": "officia anim labore voluptate",
|
|
||||||
"postal_code": "voluptate qui Ut ut eiusmod",
|
|
||||||
"stroenie_no": "fugiat ea dolore aliqua",
|
|
||||||
"temporary_id": "nulla",
|
|
||||||
"addr_line_one": "non laboris in",
|
|
||||||
"addr_line_two": "anim Duis sint Excepteur fugiat",
|
|
||||||
"building_name": "aliqua voluptate consequa",
|
|
||||||
"residence_num": "dolor ad",
|
|
||||||
"last_update_dt": "2016-10-19T02:07:03.171Z",
|
|
||||||
"street_name_ex": "cupidatat aliquip",
|
|
||||||
"addr_line_three": "qui sint Ut mollit",
|
|
||||||
"addr_usage_tp_cd": "7",
|
|
||||||
"moscow_area_name": "irure ",
|
|
||||||
"last_verified_date": "1953-07-17T11:15:50.670Z",
|
|
||||||
"moscow_area_ext_id": "cillum",
|
|
||||||
"moscow_district_id": "in",
|
|
||||||
"moscow_district_name": "occaecat est nulla velit"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"unad": "elit cillum",
|
|
||||||
"unom": "sit dese",
|
|
||||||
"end_dt": "1990-09-01T15:32:25.158Z",
|
|
||||||
"region": "in laborum ex",
|
|
||||||
"room_no": "cillum dolore proident ex enim",
|
|
||||||
"del_sign": false,
|
|
||||||
"house_no": "minim Excepteur magna",
|
|
||||||
"kladr_id": "enim fugiat est deserunt",
|
|
||||||
"city_name": "velit adipisicing et",
|
|
||||||
"corpus_no": "proid",
|
|
||||||
"etalon_id": "mollit",
|
|
||||||
"street_id": "laboris cil",
|
|
||||||
"street_omk": "ad",
|
|
||||||
"external_id": "incid",
|
|
||||||
"postal_code": "magna dolor ut adipisicing pariatur",
|
|
||||||
"stroenie_no": "velit anim ea",
|
|
||||||
"temporary_id": "minim",
|
|
||||||
"addr_line_one": "fugiat pariatur ve",
|
|
||||||
"addr_line_two": "dolor incididunt laboris id do",
|
|
||||||
"building_name": "nisi sit ut",
|
|
||||||
"residence_num": "enim",
|
|
||||||
"last_update_dt": "2016-06-26T14:00:52.484Z",
|
|
||||||
"street_name_ex": "quis nulla",
|
|
||||||
"addr_line_three": "occaecat sunt eiusmod ex",
|
|
||||||
"addr_usage_tp_cd": "1000009",
|
|
||||||
"moscow_area_name": "anim consequat et voluptate cillum",
|
|
||||||
"last_verified_date": "1999-04-24T19:45:03.295Z",
|
|
||||||
"moscow_area_ext_id": "fugia",
|
|
||||||
"moscow_district_id": "adipisicing irure dolore Lorem",
|
|
||||||
"moscow_district_name": "sit ex nulla enim esse"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"documents": [
|
|
||||||
{
|
|
||||||
"code": "sit cupidatat",
|
|
||||||
"end_dt": "1966-10-22T18:29:56.676Z",
|
|
||||||
"comment": "consequat",
|
|
||||||
"ref_num": "velit in",
|
|
||||||
"del_sign": true,
|
|
||||||
"id_tp_cd": "1000016",
|
|
||||||
"start_dt": "1955-01-30T08:05:56.936Z",
|
|
||||||
"etalon_id": "ut minim occaecat aute",
|
|
||||||
"expiry_dt": "1990-02-16T02:15:23.983Z",
|
|
||||||
"assigned_by": "ad",
|
|
||||||
"ext_upd_date": "1965-09-10T09:11:11.105Z",
|
|
||||||
"origin_block": "Duis in culpa dolor",
|
|
||||||
"temporary_id": "minim aute elit",
|
|
||||||
"last_update_dt": "1981-11-02T09:27:09.843Z",
|
|
||||||
"last_verified_dt": "2007-05-28T18:43:52.237Z",
|
|
||||||
"identification_issuer": "Excepteur consequat labore ad",
|
|
||||||
"identification_series": "cillum dolore commodo in",
|
|
||||||
"identification_issuer_code": "laboris do",
|
|
||||||
"identification_passport_birth_place": "quis Lorem id"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"code": "deserunt",
|
|
||||||
"end_dt": "1998-08-27T16:49:23.384Z",
|
|
||||||
"comment": "culpa commodo ea laborum eiusmod",
|
|
||||||
"ref_num": "sunt au",
|
|
||||||
"del_sign": false,
|
|
||||||
"id_tp_cd": "1000016",
|
|
||||||
"start_dt": "1984-10-13T07:56:38.795Z",
|
|
||||||
"etalon_id": "laborum culpa in id moll",
|
|
||||||
"expiry_dt": "1992-05-24T05:24:37.553Z",
|
|
||||||
"assigned_by": "culpa id ut",
|
|
||||||
"ext_upd_date": "1977-11-11T00:30:31.264Z",
|
|
||||||
"origin_block": "dese",
|
|
||||||
"temporary_id": "quis Duis dolor",
|
|
||||||
"last_update_dt": "1989-12-13T10:26:13.769Z",
|
|
||||||
"last_verified_dt": "1976-02-19T23:52:57.661Z",
|
|
||||||
"identification_issuer": "quis reprehenderit aliquip",
|
|
||||||
"identification_series": "laborum nisi",
|
|
||||||
"identification_issuer_code": "fugiat laborum quis in",
|
|
||||||
"identification_passport_birth_place": "nostrud Excepteur laboris commodo exercitation"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"code": "exercitati",
|
|
||||||
"end_dt": "1999-09-28T17:36:55.089Z",
|
|
||||||
"comment": "anim minim laboris sed sint",
|
|
||||||
"ref_num": "dol",
|
|
||||||
"del_sign": true,
|
|
||||||
"id_tp_cd": "1000015",
|
|
||||||
"start_dt": "2016-03-11T05:23:23.660Z",
|
|
||||||
"etalon_id": "adipisicing sint ",
|
|
||||||
"expiry_dt": "2010-06-28T18:43:40.390Z",
|
|
||||||
"assigned_by": "aliqua mollit nulla sunt ea",
|
|
||||||
"ext_upd_date": "1942-01-09T01:00:21.701Z",
|
|
||||||
"origin_block": "qui velit laborum exercitation in",
|
|
||||||
"temporary_id": "sed dolore anim cillum",
|
|
||||||
"last_update_dt": "1957-03-12T19:44:52.824Z",
|
|
||||||
"last_verified_dt": "1945-01-13T03:50:45.058Z",
|
|
||||||
"identification_issuer": "consectetur",
|
|
||||||
"identification_series": "elit incididunt aliquip anim",
|
|
||||||
"identification_issuer_code": "pariatur occaecat ",
|
|
||||||
"identification_passport_birth_place": "a"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"etalon_id": "03858028-acfd-41fc-a60b-706381ad5f97",
|
|
||||||
"last_name": "ut sint incididunt",
|
|
||||||
"spec_type": -21052272,
|
|
||||||
"dirtystage": 26762308,
|
|
||||||
"failedmask": 13752861,
|
|
||||||
"ext_upd_date": "1946-12-30T21:42:45.842Z",
|
|
||||||
"temporary_id": "eu pariatur occaecat enim",
|
|
||||||
"escredentials": [
|
|
||||||
{
|
|
||||||
"login": "nulla Ut esse",
|
|
||||||
"del_sign": true,
|
|
||||||
"password": "nisi",
|
|
||||||
"etalon_id": "ea labore in sunt eu",
|
|
||||||
"doc_number": "cillum Duis ullamco ea",
|
|
||||||
"description": "dolor quis",
|
|
||||||
"chronicle_id": "laborum reprehenderit",
|
|
||||||
"escred_tp_cd": "1000003",
|
|
||||||
"temporary_id": "veniam elit dolore",
|
|
||||||
"last_update_dt": "1996-12-15T12:38:08.170Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"login": "commodo nostr",
|
|
||||||
"del_sign": true,
|
|
||||||
"password": "aute irure reprehenderit nost",
|
|
||||||
"etalon_id": "Duis ipsum ex in",
|
|
||||||
"doc_number": "amet",
|
|
||||||
"description": "cillum",
|
|
||||||
"chronicle_id": "cillum nisi",
|
|
||||||
"escred_tp_cd": "1000003",
|
|
||||||
"temporary_id": "irure nulla non amet Ex",
|
|
||||||
"last_update_dt": "1975-01-13T11:44:56.206Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"login": "reprehender",
|
|
||||||
"del_sign": false,
|
|
||||||
"password": "anim aliquip incididunt proident in",
|
|
||||||
"etalon_id": "sed",
|
|
||||||
"doc_number": "est aute ipsum laboris",
|
|
||||||
"description": "sint incididunt",
|
|
||||||
"chronicle_id": "nisi do proi",
|
|
||||||
"escred_tp_cd": "1000003",
|
|
||||||
"temporary_id": "in in quis labor",
|
|
||||||
"last_update_dt": "1952-10-20T07:16:01.749Z"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"has_privilege": true,
|
|
||||||
"sourcechannel": -63705052,
|
|
||||||
"gender_tp_code": "in Duis",
|
|
||||||
"given_name_one": "Duis ullamco fugiat deserunt in",
|
|
||||||
"given_name_two": "aute in sunt",
|
|
||||||
"last_update_dt": "2001-03-28T18:16:41.797Z",
|
|
||||||
"validationmask": 57083008,
|
|
||||||
"citizen_relatives": [
|
|
||||||
{
|
|
||||||
"del_sign": true,
|
|
||||||
"start_dt": "1994-12-25T20:12:12.443Z",
|
|
||||||
"etalon_id": "mollit",
|
|
||||||
"rel_tp_cd": "1000005",
|
|
||||||
"access_level": -21446337,
|
|
||||||
"last_update_dt": "1965-05-29T18:37:36.964Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"del_sign": false,
|
|
||||||
"start_dt": "1994-06-16T08:27:07.295Z",
|
|
||||||
"etalon_id": "elit veniam Lorem eu",
|
|
||||||
"rel_tp_cd": "1000003",
|
|
||||||
"access_level": -92154103,
|
|
||||||
"last_update_dt": "2006-03-22T20:31:16.708Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"del_sign": false,
|
|
||||||
"start_dt": "2002-11-27T11:36:31.446Z",
|
|
||||||
"etalon_id": "laboris et id veniam exercitation",
|
|
||||||
"rel_tp_cd": "1000005",
|
|
||||||
"access_level": 22481228,
|
|
||||||
"last_update_dt": "1939-03-17T18:54:57.991Z"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"last_update_tx_id": "magna ut aliquip",
|
|
||||||
"privilege_control": false,
|
|
||||||
"pname_ext_upd_date": "2004-12-04T04:11:57.630Z",
|
|
||||||
"birth_place_line_one": "sunt ad quis culpa"
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
// nolint:wrapcheck
|
||||||
|
package assembly
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/txix-open/isp-kit/app"
|
||||||
|
"github.com/txix-open/isp-kit/bootstrap"
|
||||||
|
"github.com/txix-open/isp-kit/cluster"
|
||||||
|
"github.com/txix-open/isp-kit/grpc"
|
||||||
|
"github.com/txix-open/isp-kit/grpc/client"
|
||||||
|
"github.com/txix-open/isp-kit/log"
|
||||||
|
"isp-script-service/conf"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Assembly struct {
|
||||||
|
boot *bootstrap.Bootstrap
|
||||||
|
server *grpc.Server
|
||||||
|
logger *log.Adapter
|
||||||
|
router *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(boot *bootstrap.Bootstrap) (*Assembly, error) {
|
||||||
|
server := grpc.DefaultServer()
|
||||||
|
router, err := client.Default()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithMessage(err, "create repository client")
|
||||||
|
}
|
||||||
|
return &Assembly{
|
||||||
|
boot: boot,
|
||||||
|
server: server,
|
||||||
|
logger: boot.App.Logger(),
|
||||||
|
router: router,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Assembly) ReceiveConfig(ctx context.Context, remoteConfig []byte) error {
|
||||||
|
var (
|
||||||
|
newCfg conf.Remote
|
||||||
|
prevCfg conf.Remote
|
||||||
|
)
|
||||||
|
err := a.boot.RemoteConfig.Upgrade(remoteConfig, &newCfg, &prevCfg)
|
||||||
|
if err != nil {
|
||||||
|
a.logger.Fatal(ctx, errors.WithMessage(err, "upgrade remote config"))
|
||||||
|
}
|
||||||
|
|
||||||
|
a.logger.SetLevel(newCfg.LogLevel)
|
||||||
|
|
||||||
|
locator := NewLocator(a.logger, a.router)
|
||||||
|
handler, err := locator.Handler(newCfg)
|
||||||
|
if err != nil {
|
||||||
|
a.logger.Fatal(ctx, errors.WithMessage(err, "new handler"))
|
||||||
|
}
|
||||||
|
|
||||||
|
a.server.Upgrade(handler)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Assembly) Runners() []app.Runner {
|
||||||
|
eventHandler := cluster.NewEventHandler().
|
||||||
|
RequireModule("router", a.router).
|
||||||
|
RemoteConfigReceiver(a)
|
||||||
|
return []app.Runner{
|
||||||
|
app.RunnerFunc(func(ctx context.Context) error {
|
||||||
|
return a.server.ListenAndServe(a.boot.BindingAddress)
|
||||||
|
}),
|
||||||
|
app.RunnerFunc(func(ctx context.Context) error {
|
||||||
|
return a.boot.ClusterCli.Run(ctx, eventHandler)
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Assembly) Closers() []app.Closer {
|
||||||
|
return []app.Closer{
|
||||||
|
a.boot.ClusterCli,
|
||||||
|
app.CloserFunc(func() error {
|
||||||
|
a.server.Shutdown()
|
||||||
|
return nil
|
||||||
|
}),
|
||||||
|
a.router,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
// nolint:ireturn
|
||||||
|
package assembly
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/txix-open/isp-kit/grpc"
|
||||||
|
"github.com/txix-open/isp-kit/grpc/client"
|
||||||
|
"github.com/txix-open/isp-kit/grpc/endpoint"
|
||||||
|
"github.com/txix-open/isp-kit/grpc/endpoint/grpclog"
|
||||||
|
"github.com/txix-open/isp-kit/log"
|
||||||
|
"isp-script-service/conf"
|
||||||
|
"isp-script-service/controller"
|
||||||
|
"isp-script-service/domain"
|
||||||
|
"isp-script-service/repository"
|
||||||
|
"isp-script-service/routes"
|
||||||
|
"isp-script-service/service"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Locator struct {
|
||||||
|
logger log.Logger
|
||||||
|
grpcCli *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLocator(logger log.Logger, grpcCli *client.Client) Locator {
|
||||||
|
return Locator{
|
||||||
|
logger: logger,
|
||||||
|
grpcCli: grpcCli,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l Locator) Handler(cfg conf.Remote) (*grpc.Mux, error) {
|
||||||
|
scripts, err := MergeScripts(cfg.Scripts, cfg.CustomScripts)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithMessage(err, "merge scripts")
|
||||||
|
}
|
||||||
|
|
||||||
|
router := repository.NewRouter(l.grpcCli)
|
||||||
|
scriptService := service.NewScript(router, l.logger, scripts, cfg.SharedScript, cfg.ScriptExecutionTimeoutMs)
|
||||||
|
scriptController := controller.NewScript(scriptService)
|
||||||
|
|
||||||
|
c := routes.Controllers{
|
||||||
|
Script: scriptController,
|
||||||
|
}
|
||||||
|
mapper := endpoint.DefaultWrapper(l.logger, grpclog.Log(l.logger, true))
|
||||||
|
handler := routes.Handler(mapper, c)
|
||||||
|
return handler, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func MergeScripts(scripts []conf.ScriptDefinition, customScripts []conf.ScriptDefinition) ([]conf.ScriptDefinition, error) {
|
||||||
|
uniqueScripts := make(map[string]conf.ScriptDefinition)
|
||||||
|
|
||||||
|
for _, script := range scripts {
|
||||||
|
if _, exists := uniqueScripts[script.Id]; exists {
|
||||||
|
return nil, domain.ErrDuplicateScriptId
|
||||||
|
}
|
||||||
|
uniqueScripts[script.Id] = script
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, customScript := range customScripts {
|
||||||
|
if _, exists := uniqueScripts[customScript.Id]; exists {
|
||||||
|
return nil, domain.ErrDuplicateScriptId
|
||||||
|
}
|
||||||
|
uniqueScripts[customScript.Id] = customScript
|
||||||
|
}
|
||||||
|
|
||||||
|
mergedScripts := make([]conf.ScriptDefinition, 0, len(uniqueScripts))
|
||||||
|
for _, script := range uniqueScripts {
|
||||||
|
mergedScripts = append(mergedScripts, script)
|
||||||
|
}
|
||||||
|
|
||||||
|
return mergedScripts, nil
|
||||||
|
}
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package codes
|
|
||||||
|
|
||||||
const (
|
|
||||||
InvokeRouterServiceError = 1234 //todo
|
|
||||||
)
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package compile
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"github.com/integration-system/isp-lib/config"
|
|
||||||
"github.com/integration-system/isp-lib/logger"
|
|
||||||
"isp-script-service/conf"
|
|
||||||
"isp-script-service/script"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
Script compileScript
|
|
||||||
remoteScripts = make(map[string]script.Script)
|
|
||||||
)
|
|
||||||
|
|
||||||
type compileScript struct{}
|
|
||||||
|
|
||||||
func (compileScript) GetById(id string) script.Script {
|
|
||||||
return remoteScripts[id]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (compileScript) Init(scriptDef []conf.ScriptDefinition) {
|
|
||||||
for _, value := range scriptDef {
|
|
||||||
prog, err := Script.Create(value.Script)
|
|
||||||
if err != nil {
|
|
||||||
logger.Error(err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
remoteScripts[value.Id] = prog
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (compileScript) Create(scr string) (script.Script, error) {
|
|
||||||
cfg := config.GetRemote().(*conf.RemoteConfig)
|
|
||||||
scr = fmt.Sprintf("%s%s%s%s", cfg.SharedScript, "(function() {", scr, "})();")
|
|
||||||
return script.Default().Compile(scr)
|
|
||||||
}
|
|
||||||
+7
-1
@@ -8,4 +8,10 @@ grpcInnerAddress:
|
|||||||
ip: 0.0.0.0
|
ip: 0.0.0.0
|
||||||
port: 9024
|
port: 9024
|
||||||
moduleName: script
|
moduleName: script
|
||||||
instanceUuid: ec183598-746a-425f-b5e5-27b7fa8bc6af
|
infraServerPort: 9574
|
||||||
|
|
||||||
|
logfile:
|
||||||
|
path: /var/log/isp-script-service/runtime.log
|
||||||
|
maxSizeMb: 512
|
||||||
|
maxBackups: 4
|
||||||
|
compress: true
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package conf
|
|
||||||
|
|
||||||
import "github.com/integration-system/isp-lib/structure"
|
|
||||||
|
|
||||||
type Configuration struct {
|
|
||||||
ConfigServiceAddress structure.AddressConfiguration
|
|
||||||
GrpcOuterAddress structure.AddressConfiguration `valid:"required~Required" json:"grpcOuterAddress"`
|
|
||||||
GrpcInnerAddress structure.AddressConfiguration `valid:"required~Required" json:"grpcInnerAddress"`
|
|
||||||
ModuleName string
|
|
||||||
InstanceUuid string
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"scripts": [
|
"logLevel": "debug",
|
||||||
],
|
"scripts": [],
|
||||||
|
"customScripts": [],
|
||||||
"sharedScript": "",
|
"sharedScript": "",
|
||||||
"scriptExecutionTimeoutMs": 1000
|
"scriptExecutionTimeoutMs": 1000
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package conf
|
||||||
|
|
||||||
|
import (
|
||||||
|
"reflect"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/log"
|
||||||
|
"github.com/txix-open/isp-kit/rc/schema"
|
||||||
|
"github.com/txix-open/jsonschema"
|
||||||
|
)
|
||||||
|
|
||||||
|
// nolint:gochecknoinits
|
||||||
|
func init() {
|
||||||
|
schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Schema) {
|
||||||
|
t.Type = "string"
|
||||||
|
t.Enum = []interface{}{"debug", "info", "error", "fatal"}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
type Remote struct {
|
||||||
|
LogLevel log.Level `schemaGen:"logLevel" schema:"Уровень логирования"`
|
||||||
|
Scripts []ScriptDefinition `schema:"Скрипты"`
|
||||||
|
CustomScripts []ScriptDefinition `schema:"Кастомные скрипты"`
|
||||||
|
SharedScript string `schema:"Общий скрипт"`
|
||||||
|
ScriptExecutionTimeoutMs int `validate:"required" schema:"Время выполнения скрипта"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ScriptDefinition struct {
|
||||||
|
Id string `validate:"required"`
|
||||||
|
Script string `validate:"required"`
|
||||||
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package conf
|
|
||||||
|
|
||||||
type RemoteConfig struct {
|
|
||||||
Scripts []ScriptDefinition
|
|
||||||
SharedScript string
|
|
||||||
ScriptExecutionTimeoutMs int `valid:"required~Required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ScriptDefinition struct {
|
|
||||||
Id string `valid:"required~Required"`
|
|
||||||
Script string `valid:"required~Required"`
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package conf_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/test/rct"
|
||||||
|
"isp-script-service/conf"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestDefaultRemoteConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
rct.Test(t, "default_remote_config.json", conf.Remote{})
|
||||||
|
}
|
||||||
+70
-38
@@ -1,53 +1,85 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"github.com/pkg/errors"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
"isp-script-service/compile"
|
|
||||||
"isp-script-service/domain"
|
"isp-script-service/domain"
|
||||||
"isp-script-service/script"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var Script scriptController
|
type scriptService interface {
|
||||||
|
Execute(req domain.ExecuteRequest) *domain.ScriptResp
|
||||||
|
ExecuteById(req domain.ExecuteByIdRequest) (*domain.ScriptResp, error)
|
||||||
|
BatchExecute(req []domain.ExecuteByIdRequest) []domain.ScriptResp
|
||||||
|
BatchExecuteById(req domain.BatchExecuteByIdsRequest) []domain.ScriptResp
|
||||||
|
}
|
||||||
|
|
||||||
type scriptController struct{}
|
type Script struct {
|
||||||
|
service scriptService
|
||||||
|
}
|
||||||
|
|
||||||
func (c scriptController) ExecuteById(req domain.ExecuteByIdRequest) (*domain.ScriptResp, error) {
|
func NewScript(service scriptService) Script {
|
||||||
scr := compile.Script.GetById(req.Id)
|
return Script{service: service}
|
||||||
if scr == nil {
|
}
|
||||||
|
|
||||||
|
// ExecuteById
|
||||||
|
// @Tags script
|
||||||
|
// @Summary Выполнить скрипт под конкретным ID
|
||||||
|
// @Description Возвращает результат выполнения скрипта и ошибку (если есть)
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Param body body domain.ExecuteByIdRequest true "идентификатор скрипта"
|
||||||
|
// @Success 200 {object} domain.ScriptResp
|
||||||
|
// @Failure 404 {object} domain.GrpcError
|
||||||
|
// @Router /script/execute_by_id [POST].
|
||||||
|
func (c Script) ExecuteById(req domain.ExecuteByIdRequest) (*domain.ScriptResp, error) {
|
||||||
|
data, err := c.service.ExecuteById(req)
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case errors.Is(err, domain.ErrScriptNotFound):
|
||||||
return nil, status.Errorf(codes.NotFound, "not defined script for id %s", req.Id)
|
return nil, status.Errorf(codes.NotFound, "not defined script for id %s", req.Id)
|
||||||
}
|
case err != nil:
|
||||||
return c.executeScript(scr, req.Arg), nil
|
return nil, err
|
||||||
}
|
default:
|
||||||
|
return data, nil
|
||||||
func (c scriptController) Execute(req domain.ExecuteRequest) *domain.ScriptResp {
|
|
||||||
scr, err := compile.Script.Create(req.Script)
|
|
||||||
if err != nil {
|
|
||||||
return c.respError(err, domain.ErrorCompile)
|
|
||||||
}
|
|
||||||
return c.executeScript(scr, req.Arg)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c scriptController) executeScript(scr script.Script, arg interface{}) *domain.ScriptResp {
|
|
||||||
response, err := script.Default().Execute(scr, arg)
|
|
||||||
if err != nil {
|
|
||||||
return c.respError(err, domain.ErrorRunTime)
|
|
||||||
}
|
|
||||||
if response == nil {
|
|
||||||
return c.respError(errors.New("empty answer, maybe lost return"), domain.ErrorRunTime)
|
|
||||||
}
|
|
||||||
return &domain.ScriptResp{
|
|
||||||
Result: response,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c scriptController) respError(err error, errorType string) *domain.ScriptResp {
|
// Execute
|
||||||
respError := domain.Error{
|
// @Tags script
|
||||||
Type: errorType,
|
// @Summary Выполнить скрипт без учёта идентификатора
|
||||||
Description: err.Error(),
|
// @Description Возвращает результат выполнения скрипта и ошибку (если есть)
|
||||||
}
|
// @Accept json
|
||||||
return &domain.ScriptResp{
|
// @Produce json
|
||||||
Error: &respError,
|
// @Param body body domain.ExecuteRequest true "Скрипт необходимый к выполнению"
|
||||||
}
|
// @Success 200 {object} domain.ScriptResp
|
||||||
|
// @Router /script/execute [POST].
|
||||||
|
func (c Script) Execute(req domain.ExecuteRequest) *domain.ScriptResp {
|
||||||
|
return c.service.Execute(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// BatchExecute
|
||||||
|
// @Tags script
|
||||||
|
// @Summary Выполнить набор скриптов под конкретными ID
|
||||||
|
// @Description Возвращает результат выполнения скриптов и ошибок (если есть)
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Param body body []domain.ExecuteByIdRequest true "Набор идентификаторов и аргументов"
|
||||||
|
// @Success 200 {array} domain.ScriptResp
|
||||||
|
// @Router /script/batch_execute [POST].
|
||||||
|
func (c Script) BatchExecute(req []domain.ExecuteByIdRequest) []domain.ScriptResp {
|
||||||
|
return c.service.BatchExecute(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// BatchExecuteById
|
||||||
|
// @Tags script
|
||||||
|
// @Summary Выполнить набор скриптов под конкретными ID с идентичным аргументом для всех
|
||||||
|
// @Description Возвращает результат выполнения скриптов и ошибок (если есть)
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Param body body domain.BatchExecuteByIdsRequest true "Набор идентификаторов и единый аргумент"
|
||||||
|
// @Success 200 {array} domain.ScriptResp
|
||||||
|
// @Router /script/batch_execute_by_ids [POST].
|
||||||
|
func (c Script) BatchExecuteById(req domain.BatchExecuteByIdsRequest) []domain.ScriptResp {
|
||||||
|
return c.service.BatchExecuteById(req)
|
||||||
}
|
}
|
||||||
+267
@@ -0,0 +1,267 @@
|
|||||||
|
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||||||
|
package docs
|
||||||
|
|
||||||
|
import "github.com/txix-open/swag"
|
||||||
|
|
||||||
|
const docTemplate = `{
|
||||||
|
"schemes": {{ marshal .Schemes }},
|
||||||
|
"swagger": "2.0",
|
||||||
|
"info": {
|
||||||
|
"description": "{{escape .Description}}",
|
||||||
|
"title": "{{.Title}}",
|
||||||
|
"contact": {},
|
||||||
|
"license": {
|
||||||
|
"name": "GNU GPL v3.0"
|
||||||
|
},
|
||||||
|
"version": "{{.Version}}"
|
||||||
|
},
|
||||||
|
"host": "{{.Host}}",
|
||||||
|
"basePath": "{{.BasePath}}",
|
||||||
|
"paths": {
|
||||||
|
"/script/batch_execute": {
|
||||||
|
"post": {
|
||||||
|
"description": "Возвращает результат выполнения скриптов и ошибок (если есть)",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"script"
|
||||||
|
],
|
||||||
|
"summary": "Выполнить набор скриптов под конкретными ID",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Набор идентификаторов и аргументов",
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/domain.ExecuteByIdRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/domain.ScriptResp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/script/batch_execute_by_ids": {
|
||||||
|
"post": {
|
||||||
|
"description": "Возвращает результат выполнения скриптов и ошибок (если есть)",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"script"
|
||||||
|
],
|
||||||
|
"summary": "Выполнить набор скриптов под конкретными ID с идентичным аргументом для всех",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Набор идентификаторов и единый аргумент",
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/domain.BatchExecuteByIdsRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/domain.ScriptResp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/script/execute": {
|
||||||
|
"post": {
|
||||||
|
"description": "Возвращает результат выполнения скрипта и ошибку (если есть)",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"script"
|
||||||
|
],
|
||||||
|
"summary": "Выполнить скрипт без учёта идентификатора",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Скрипт необходимый к выполнению",
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/domain.ExecuteRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/domain.ScriptResp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/script/execute_by_id": {
|
||||||
|
"post": {
|
||||||
|
"description": "Возвращает результат выполнения скрипта и ошибку (если есть)",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"script"
|
||||||
|
],
|
||||||
|
"summary": "Выполнить скрипт под конкретным ID",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "идентификатор скрипта",
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/domain.ExecuteByIdRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/domain.ScriptResp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Not Found",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/domain.GrpcError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"definitions": {
|
||||||
|
"domain.BatchExecuteByIdsRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"ids"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"arg": {},
|
||||||
|
"ids": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domain.Error": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domain.ExecuteByIdRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"arg": {},
|
||||||
|
"id": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domain.ExecuteRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"script"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"arg": {},
|
||||||
|
"script": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domain.GrpcError": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"details": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {}
|
||||||
|
},
|
||||||
|
"errorCode": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"errorMessage": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domain.ScriptResp": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"error": {
|
||||||
|
"$ref": "#/definitions/domain.Error"
|
||||||
|
},
|
||||||
|
"result": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`
|
||||||
|
|
||||||
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||||
|
var SwaggerInfo = &swag.Spec{
|
||||||
|
Version: "1.0.0",
|
||||||
|
Host: "localhost:9000",
|
||||||
|
BasePath: "/api/script",
|
||||||
|
Schemes: []string{},
|
||||||
|
Title: "isp-script-service",
|
||||||
|
Description: "Сервис для обработки и выполнения JavaScript скриптов",
|
||||||
|
InfoInstanceName: "swagger",
|
||||||
|
SwaggerTemplate: docTemplate,
|
||||||
|
LeftDelim: "{{",
|
||||||
|
RightDelim: "}}",
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||||
|
}
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
basePath: /api/script
|
||||||
|
definitions:
|
||||||
|
domain.BatchExecuteByIdsRequest:
|
||||||
|
properties:
|
||||||
|
arg: {}
|
||||||
|
ids:
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
|
required:
|
||||||
|
- ids
|
||||||
|
type: object
|
||||||
|
domain.Error:
|
||||||
|
properties:
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
domain.ExecuteByIdRequest:
|
||||||
|
properties:
|
||||||
|
arg: {}
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
type: object
|
||||||
|
domain.ExecuteRequest:
|
||||||
|
properties:
|
||||||
|
arg: {}
|
||||||
|
script:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- script
|
||||||
|
type: object
|
||||||
|
domain.GrpcError:
|
||||||
|
properties:
|
||||||
|
details:
|
||||||
|
items: {}
|
||||||
|
type: array
|
||||||
|
errorCode:
|
||||||
|
type: string
|
||||||
|
errorMessage:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
domain.ScriptResp:
|
||||||
|
properties:
|
||||||
|
error:
|
||||||
|
$ref: '#/definitions/domain.Error'
|
||||||
|
result: {}
|
||||||
|
type: object
|
||||||
|
host: localhost:9000
|
||||||
|
info:
|
||||||
|
contact: {}
|
||||||
|
description: Сервис для обработки и выполнения JavaScript скриптов
|
||||||
|
license:
|
||||||
|
name: GNU GPL v3.0
|
||||||
|
title: isp-script-service
|
||||||
|
version: 1.0.0
|
||||||
|
paths:
|
||||||
|
/script/batch_execute:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Возвращает результат выполнения скриптов и ошибок (если есть)
|
||||||
|
parameters:
|
||||||
|
- description: Набор идентификаторов и аргументов
|
||||||
|
in: body
|
||||||
|
name: body
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/domain.ExecuteByIdRequest'
|
||||||
|
type: array
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/domain.ScriptResp'
|
||||||
|
type: array
|
||||||
|
summary: Выполнить набор скриптов под конкретными ID
|
||||||
|
tags:
|
||||||
|
- script
|
||||||
|
/script/batch_execute_by_ids:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Возвращает результат выполнения скриптов и ошибок (если есть)
|
||||||
|
parameters:
|
||||||
|
- description: Набор идентификаторов и единый аргумент
|
||||||
|
in: body
|
||||||
|
name: body
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/domain.BatchExecuteByIdsRequest'
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/domain.ScriptResp'
|
||||||
|
type: array
|
||||||
|
summary: Выполнить набор скриптов под конкретными ID с идентичным аргументом
|
||||||
|
для всех
|
||||||
|
tags:
|
||||||
|
- script
|
||||||
|
/script/execute:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Возвращает результат выполнения скрипта и ошибку (если есть)
|
||||||
|
parameters:
|
||||||
|
- description: Скрипт необходимый к выполнению
|
||||||
|
in: body
|
||||||
|
name: body
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/domain.ExecuteRequest'
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/domain.ScriptResp'
|
||||||
|
summary: Выполнить скрипт без учёта идентификатора
|
||||||
|
tags:
|
||||||
|
- script
|
||||||
|
/script/execute_by_id:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Возвращает результат выполнения скрипта и ошибку (если есть)
|
||||||
|
parameters:
|
||||||
|
- description: идентификатор скрипта
|
||||||
|
in: body
|
||||||
|
name: body
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/domain.ExecuteByIdRequest'
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/domain.ScriptResp'
|
||||||
|
"404":
|
||||||
|
description: Not Found
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/domain.GrpcError'
|
||||||
|
summary: Выполнить скрипт под конкретным ID
|
||||||
|
tags:
|
||||||
|
- script
|
||||||
|
swagger: "2.0"
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrScriptNotFound = errors.New("script not found")
|
||||||
|
ErrDuplicateScriptId = errors.New("duplicate script id")
|
||||||
|
)
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
type GrpcError struct {
|
||||||
|
ErrorMessage string
|
||||||
|
ErrorCode string
|
||||||
|
Details []interface{}
|
||||||
|
}
|
||||||
+7
-2
@@ -1,11 +1,16 @@
|
|||||||
package domain
|
package domain
|
||||||
|
|
||||||
type ExecuteByIdRequest struct {
|
type ExecuteByIdRequest struct {
|
||||||
Id string `valid:"required~Required"`
|
Id string `validate:"required"`
|
||||||
Arg interface{}
|
Arg interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ExecuteRequest struct {
|
type ExecuteRequest struct {
|
||||||
Script string `valid:"required~Required"`
|
Script string `validate:"required"`
|
||||||
Arg interface{}
|
Arg interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type BatchExecuteByIdsRequest struct {
|
||||||
|
Ids []string `validate:"required"`
|
||||||
|
Arg interface{}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
module isp-script-service
|
||||||
|
|
||||||
|
go 1.24
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/dop251/goja v0.0.0-20250624190929-4d26883d182a
|
||||||
|
github.com/google/uuid v1.6.0
|
||||||
|
github.com/pkg/errors v0.9.1
|
||||||
|
github.com/robertkrimen/otto v0.5.1
|
||||||
|
github.com/stretchr/testify v1.10.0
|
||||||
|
github.com/txix-open/isp-kit v1.54.1
|
||||||
|
github.com/txix-open/isp-script v1.3.0
|
||||||
|
github.com/txix-open/jsonschema v1.3.0
|
||||||
|
github.com/txix-open/swag v0.0.0-20250507150849-9c1ff3ea9714
|
||||||
|
github.com/yuin/gopher-lua v1.1.1
|
||||||
|
google.golang.org/grpc v1.74.2
|
||||||
|
layeh.com/gopher-json v0.0.0-20201124131017-552bb3c4c3bf
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/KyleBanks/depth v1.2.1 // indirect
|
||||||
|
github.com/PuerkitoBio/purell v1.1.1 // indirect
|
||||||
|
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
||||||
|
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||||
|
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
||||||
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
|
github.com/buger/jsonparser v1.1.1 // indirect
|
||||||
|
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||||
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
|
github.com/coder/websocket v1.8.13 // indirect
|
||||||
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/dlclark/regexp2 v1.11.5 // indirect
|
||||||
|
github.com/dop251/goja_nodejs v0.0.0-20240221231712-27eeffc9c235 // indirect
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
|
||||||
|
github.com/getsentry/sentry-go v0.35.1 // indirect
|
||||||
|
github.com/go-logr/logr v1.4.3 // indirect
|
||||||
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
|
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||||
|
github.com/go-openapi/jsonreference v0.19.6 // indirect
|
||||||
|
github.com/go-openapi/spec v0.20.4 // indirect
|
||||||
|
github.com/go-openapi/swag v0.19.15 // indirect
|
||||||
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
|
github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect
|
||||||
|
github.com/google/pprof v0.0.0-20250607225305-033d6d78b36a // indirect
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect
|
||||||
|
github.com/josharian/intern v1.0.0 // indirect
|
||||||
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
|
github.com/mailru/easyjson v0.9.0 // indirect
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
|
github.com/prometheus/client_golang v1.23.0 // indirect
|
||||||
|
github.com/prometheus/client_model v0.6.2 // indirect
|
||||||
|
github.com/prometheus/common v0.65.0 // indirect
|
||||||
|
github.com/prometheus/procfs v0.17.0 // indirect
|
||||||
|
github.com/txix-open/bellows v1.2.0 // indirect
|
||||||
|
github.com/txix-open/etp/v4 v4.0.1 // indirect
|
||||||
|
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb // indirect
|
||||||
|
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
|
||||||
|
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||||
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||||
|
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||||
|
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||||
|
go.opentelemetry.io/otel v1.37.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/metric v1.37.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/trace v1.37.0 // indirect
|
||||||
|
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
|
||||||
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
|
go.uber.org/zap v1.27.0 // indirect
|
||||||
|
golang.org/x/crypto v0.41.0 // indirect
|
||||||
|
golang.org/x/mod v0.26.0 // indirect
|
||||||
|
golang.org/x/net v0.43.0 // indirect
|
||||||
|
golang.org/x/sync v0.16.0 // indirect
|
||||||
|
golang.org/x/sys v0.35.0 // indirect
|
||||||
|
golang.org/x/text v0.28.0 // indirect
|
||||||
|
golang.org/x/tools v0.35.0 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250811230008-5f3141c8851a // indirect
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a // indirect
|
||||||
|
google.golang.org/protobuf v1.36.7 // indirect
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||||
|
gopkg.in/sourcemap.v1 v1.0.5 // indirect
|
||||||
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
|
)
|
||||||
@@ -0,0 +1,238 @@
|
|||||||
|
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
||||||
|
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
||||||
|
github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
|
||||||
|
github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
|
||||||
|
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
|
||||||
|
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||||
|
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
|
||||||
|
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||||
|
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||||
|
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||||
|
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
|
||||||
|
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
|
||||||
|
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||||
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
|
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
|
||||||
|
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
||||||
|
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
|
||||||
|
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
|
||||||
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
github.com/coder/websocket v1.8.13 h1:f3QZdXy7uGVz+4uCJy2nTZyM0yTBj8yANEHhqlXZ9FE=
|
||||||
|
github.com/coder/websocket v1.8.13/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
|
||||||
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ=
|
||||||
|
github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||||
|
github.com/dop251/goja v0.0.0-20250624190929-4d26883d182a h1:QIWJoaD2+zxUjN28l8zixmbuvtYqqcxj49Iwzw7mDpk=
|
||||||
|
github.com/dop251/goja v0.0.0-20250624190929-4d26883d182a/go.mod h1:MxLav0peU43GgvwVgNbLAj1s/bSGboKkhuULvq/7hx4=
|
||||||
|
github.com/dop251/goja_nodejs v0.0.0-20240221231712-27eeffc9c235 h1:5870ijWGCGCw7Ty4IGCquT6EfTck6f5zriYzFpPwOJ0=
|
||||||
|
github.com/dop251/goja_nodejs v0.0.0-20240221231712-27eeffc9c235/go.mod h1:bhGPmCgCCTSRfiMYWjpS46IDo9EUZXlsuUaPXSWGbv0=
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY=
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok=
|
||||||
|
github.com/getsentry/sentry-go v0.35.1 h1:iopow6UVLE2aXu46xKVIs8Z9D/YZkJrHkgozrxa+tOQ=
|
||||||
|
github.com/getsentry/sentry-go v0.35.1/go.mod h1:C55omcY9ChRQIUcVcGcs+Zdy4ZpQGvNJ7JYHIoSWOtE=
|
||||||
|
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||||
|
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||||
|
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
|
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||||
|
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
|
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||||
|
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||||
|
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||||
|
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
|
||||||
|
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||||
|
github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs=
|
||||||
|
github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns=
|
||||||
|
github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M=
|
||||||
|
github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I=
|
||||||
|
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||||
|
github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
|
||||||
|
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
||||||
|
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||||
|
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||||
|
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||||
|
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||||
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||||
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
|
github.com/go-sourcemap/sourcemap v2.1.4+incompatible h1:a+iTbH5auLKxaNwQFg0B+TCYl6lbukKPc7b5x0n1s6Q=
|
||||||
|
github.com/go-sourcemap/sourcemap v2.1.4+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
|
||||||
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
github.com/google/pprof v0.0.0-20250607225305-033d6d78b36a h1://KbezygeMJZCSHH+HgUZiTeSoiuFspbMg1ge+eFj18=
|
||||||
|
github.com/google/pprof v0.0.0-20250607225305-033d6d78b36a/go.mod h1:5hDyRhoBCxViHszMt12TnOpEI4VVi+U8Gm9iphldiMA=
|
||||||
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90=
|
||||||
|
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||||
|
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||||
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
|
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||||
|
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
|
||||||
|
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
||||||
|
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
||||||
|
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
|
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||||
|
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||||
|
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||||
|
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||||
|
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||||
|
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||||
|
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||||
|
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
|
||||||
|
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||||
|
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||||
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
||||||
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||||
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
|
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
|
||||||
|
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
|
||||||
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/prometheus/client_golang v1.23.0 h1:ust4zpdl9r4trLY/gSjlm07PuiBq2ynaXXlptpfy8Uc=
|
||||||
|
github.com/prometheus/client_golang v1.23.0/go.mod h1:i/o0R9ByOnHX0McrTMTyhYvKE4haaf2mW08I+jGAjEE=
|
||||||
|
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
|
||||||
|
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
|
||||||
|
github.com/prometheus/common v0.65.0 h1:QDwzd+G1twt//Kwj/Ww6E9FQq1iVMmODnILtW1t2VzE=
|
||||||
|
github.com/prometheus/common v0.65.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8=
|
||||||
|
github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0=
|
||||||
|
github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw=
|
||||||
|
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
|
||||||
|
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
|
||||||
|
github.com/robertkrimen/otto v0.5.1 h1:avDI4ToRk8k1hppLdYFTuuzND41n37vPGJU7547dGf0=
|
||||||
|
github.com/robertkrimen/otto v0.5.1/go.mod h1:bS433I4Q9p+E5pZLu7r17vP6FkE6/wLxBdmKjoqJXF8=
|
||||||
|
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
|
||||||
|
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
|
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
|
github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY=
|
||||||
|
github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o=
|
||||||
|
github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA=
|
||||||
|
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8=
|
||||||
|
github.com/txix-open/grmq v1.9.0 h1:ArDbJJcFX9zXKEcPf49rp9nYiRyGMJxGKJAxdbSsfaM=
|
||||||
|
github.com/txix-open/grmq v1.9.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po=
|
||||||
|
github.com/txix-open/isp-kit v1.54.1 h1:OY4dQgvhHpRicwpemnoHxs+w2/rMkc19Jf0Nj8QPIeI=
|
||||||
|
github.com/txix-open/isp-kit v1.54.1/go.mod h1:sVUjen989u4yz5SYAZ4LRCQzRfwlU/uJ5ogiU31zmks=
|
||||||
|
github.com/txix-open/isp-script v1.3.0 h1:hQ29e+aAwlLxgjKpMheo4Sici9t87V/9VQkKwYvJoag=
|
||||||
|
github.com/txix-open/isp-script v1.3.0/go.mod h1:DjQ6T6yAjdWCR6SxAN63fE6mS37+NLUKUDS85GTAhlQ=
|
||||||
|
github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4=
|
||||||
|
github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
|
||||||
|
github.com/txix-open/swag v0.0.0-20250507150849-9c1ff3ea9714 h1:MlG8DNOw9y+Yi9V5aAda+T+FWYsIqm+yrfFRN0ZKVhE=
|
||||||
|
github.com/txix-open/swag v0.0.0-20250507150849-9c1ff3ea9714/go.mod h1:VeVLWAE7hf6MXhWoE8lX7ua1RPswGs43KzTms8CKGFI=
|
||||||
|
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0=
|
||||||
|
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb/go.mod h1:0biAFE0bgbcKeBBAwgEDhbZz6uT1vuSETCrFQlv2RiA=
|
||||||
|
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
|
||||||
|
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
|
||||||
|
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||||
|
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
|
||||||
|
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||||
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
|
||||||
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
|
||||||
|
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
|
||||||
|
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
||||||
|
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
|
||||||
|
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
|
||||||
|
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||||
|
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||||
|
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.62.0 h1:wCeciVlAfb5DC8MQl/DlmAv/FVPNpQgFvI/71+hatuc=
|
||||||
|
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.62.0/go.mod h1:WfEApdZDMlLUAev/0QQpr8EJ/z0VWDKYZ5tF5RH5T1U=
|
||||||
|
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
|
||||||
|
go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 h1:Ahq7pZmv87yiyn3jeFz/LekZmPLLdKejuO3NcK9MssM=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0/go.mod h1:MJTqhM0im3mRLw1i8uGHnCvUEeS7VwRyxlLC78PA18M=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0 h1:bDMKF3RUSxshZ5OjOTi8rsHGaPKsAt76FaqgvIUySLc=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0/go.mod h1:dDT67G/IkA46Mr2l9Uj7HsQVwsjASyV9SjGofsiUZDA=
|
||||||
|
go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE=
|
||||||
|
go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.36.0 h1:r0ntwwGosWGaa0CrSt8cuNuTcccMXERFwHX4dThiPis=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.36.0/go.mod h1:qTNOhFDfKRwX0yXOqJYegL5WRaW376QbB7P4Pb0qva4=
|
||||||
|
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
|
||||||
|
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
|
||||||
|
go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4=
|
||||||
|
go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE=
|
||||||
|
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||||
|
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||||
|
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||||
|
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
|
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||||
|
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||||
|
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
|
||||||
|
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
|
||||||
|
golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg=
|
||||||
|
golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ=
|
||||||
|
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
|
||||||
|
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
|
||||||
|
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
|
||||||
|
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
|
||||||
|
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
||||||
|
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
|
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
||||||
|
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0=
|
||||||
|
golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250811230008-5f3141c8851a h1:DMCgtIAIQGZqJXMVzJF4MV8BlWoJh2ZuFiRdAleyr58=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250811230008-5f3141c8851a/go.mod h1:y2yVLIE/CSMCPXaHnSKXxu1spLPnglFLegmgdY23uuE=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a h1:tPE/Kp+x9dMSwUm/uM0JKK0IfdiJkwAbSMSeZBXXJXc=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a/go.mod h1:gw1tLEfykwDz2ET4a12jcXt4couGAm7IwsVaTy0Sflo=
|
||||||
|
google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4=
|
||||||
|
google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM=
|
||||||
|
google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A=
|
||||||
|
google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||||
|
gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI=
|
||||||
|
gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
layeh.com/gopher-json v0.0.0-20201124131017-552bb3c4c3bf h1:rRz0YsF7VXj9fXRF6yQgFI7DzST+hsI3TeFSGupntu0=
|
||||||
|
layeh.com/gopher-json v0.0.0-20201124131017-552bb3c4c3bf/go.mod h1:ivKkcY8Zxw5ba0jldhZCYYQfGdb2K6u9tbYK1AwMIBc=
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package helper
|
|
||||||
|
|
||||||
import (
|
|
||||||
"isp-script-service/controller"
|
|
||||||
"isp-script-service/domain"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ScriptHandlers struct {
|
|
||||||
ExecuteById func(request domain.ExecuteByIdRequest) (*domain.ScriptResp, error) `method:"execute_by_id" group:"script"`
|
|
||||||
Execute func(request domain.ExecuteRequest) *domain.ScriptResp `method:"execute" group:"script"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetTaskHandler() *ScriptHandlers {
|
|
||||||
return &ScriptHandlers{
|
|
||||||
ExecuteById: controller.Script.ExecuteById,
|
|
||||||
Execute: controller.Script.Execute,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetAllHandlers() []interface{} {
|
|
||||||
return []interface{}{
|
|
||||||
GetTaskHandler(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,85 +1,48 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"github.com/txix-open/isp-kit/bootstrap"
|
||||||
"github.com/integration-system/isp-lib/backend"
|
"github.com/txix-open/isp-kit/shutdown"
|
||||||
"github.com/integration-system/isp-lib/bootstrap"
|
"isp-script-service/assembly"
|
||||||
"github.com/integration-system/isp-lib/config/schema"
|
|
||||||
"github.com/integration-system/isp-lib/logger"
|
|
||||||
"github.com/integration-system/isp-lib/structure"
|
|
||||||
"google.golang.org/grpc"
|
|
||||||
"isp-script-service/compile"
|
|
||||||
"isp-script-service/conf"
|
"isp-script-service/conf"
|
||||||
"isp-script-service/helper"
|
"isp-script-service/routes"
|
||||||
"isp-script-service/router"
|
|
||||||
"os"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var version = "1.0.0"
|
||||||
version = "1.0.0"
|
|
||||||
)
|
// @title isp-script-service
|
||||||
|
// @version 1.0.0
|
||||||
|
// @description Сервис для обработки и выполнения JavaScript скриптов
|
||||||
|
|
||||||
|
// @license.name GNU GPL v3.0
|
||||||
|
|
||||||
|
// @host localhost:9000
|
||||||
|
// @BasePath /api/script
|
||||||
|
|
||||||
|
//go:generate swag init --parseDependency
|
||||||
|
//go:generate rm -f docs/swagger.json
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
bootstrap.
|
boot := bootstrap.New(version, conf.Remote{}, routes.EndpointDescriptors())
|
||||||
ServiceBootstrap(&conf.Configuration{}, &conf.RemoteConfig{}).
|
app := boot.App
|
||||||
OnLocalConfigLoad(onLocalConfigLoad).
|
logger := app.Logger()
|
||||||
SocketConfiguration(socketConfiguration).
|
|
||||||
DefaultRemoteConfigPath(schema.ResolveDefaultConfigPath("default_remote_config.json")).
|
|
||||||
OnSocketErrorReceive(onRemoteErrorReceive).
|
|
||||||
OnConfigErrorReceive(onRemoteConfigErrorReceive).
|
|
||||||
DeclareMe(routesData).
|
|
||||||
RequireModule("router", router.Client.ReceiveAddressList, true).
|
|
||||||
OnRemoteConfigReceive(onRemoteConfigReceive).
|
|
||||||
OnShutdown(onShutdown).
|
|
||||||
Run()
|
|
||||||
}
|
|
||||||
|
|
||||||
func socketConfiguration(cfg interface{}) structure.SocketConfiguration {
|
assembly, err := assembly.New(boot)
|
||||||
appConfig := cfg.(*conf.Configuration)
|
if err != nil {
|
||||||
return structure.SocketConfiguration{
|
logger.Fatal(app.Context(), err)
|
||||||
Host: appConfig.ConfigServiceAddress.IP,
|
}
|
||||||
Port: appConfig.ConfigServiceAddress.Port,
|
app.AddRunners(assembly.Runners()...)
|
||||||
Secure: false,
|
app.AddClosers(assembly.Closers()...)
|
||||||
UrlParams: map[string]string{
|
|
||||||
"module_name": appConfig.ModuleName,
|
shutdown.On(func() {
|
||||||
"instance_uuid": appConfig.InstanceUuid,
|
logger.Info(app.Context(), "starting shutdown")
|
||||||
},
|
app.Shutdown()
|
||||||
|
logger.Info(app.Context(), "shutdown completed")
|
||||||
|
})
|
||||||
|
|
||||||
|
err = app.Run()
|
||||||
|
if err != nil {
|
||||||
|
app.Shutdown()
|
||||||
|
logger.Fatal(app.Context(), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func onShutdown(_ context.Context, _ os.Signal) {
|
|
||||||
backend.StopGrpcServer()
|
|
||||||
}
|
|
||||||
|
|
||||||
func onRemoteConfigReceive(remoteConfig, oldRemoteConfig *conf.RemoteConfig) {
|
|
||||||
compile.Script.Init(remoteConfig.Scripts)
|
|
||||||
}
|
|
||||||
|
|
||||||
func onLocalConfigLoad(cfg *conf.Configuration) {
|
|
||||||
handlers := helper.GetAllHandlers()
|
|
||||||
service := backend.GetDefaultService(cfg.ModuleName, handlers...)
|
|
||||||
backend.StartBackendGrpcServer(
|
|
||||||
cfg.GrpcInnerAddress, service,
|
|
||||||
grpc.MaxRecvMsgSize(1024*1024*512),
|
|
||||||
grpc.MaxSendMsgSize(1024*1024*512),
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func routesData(localConfig interface{}) bootstrap.ModuleInfo {
|
|
||||||
cfg := localConfig.(*conf.Configuration)
|
|
||||||
return bootstrap.ModuleInfo{
|
|
||||||
ModuleName: cfg.ModuleName,
|
|
||||||
ModuleVersion: version,
|
|
||||||
GrpcOuterAddress: cfg.GrpcOuterAddress,
|
|
||||||
Handlers: helper.GetAllHandlers(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func onRemoteErrorReceive(errorMessage map[string]interface{}) {
|
|
||||||
logger.Warn(errorMessage)
|
|
||||||
}
|
|
||||||
|
|
||||||
func onRemoteConfigErrorReceive(errorMessage string) {
|
|
||||||
logger.Error(errorMessage)
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/txix-open/isp-kit/grpc/client"
|
||||||
|
md "google.golang.org/grpc/metadata"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Router struct {
|
||||||
|
cli *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRouter(cli *client.Client) Router {
|
||||||
|
return Router{
|
||||||
|
cli: cli,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i Router) Invoke(methodPath string, request interface{}, metadata map[string]interface{}) (interface{}, error) {
|
||||||
|
ctx := context.Background()
|
||||||
|
newMd := md.New(nil)
|
||||||
|
for key, val := range metadata {
|
||||||
|
newMd.Set(key, fmt.Sprint(val))
|
||||||
|
}
|
||||||
|
ctx = md.NewOutgoingContext(ctx, newMd)
|
||||||
|
|
||||||
|
var response interface{}
|
||||||
|
|
||||||
|
err := i.cli.Invoke(methodPath).JsonRequestBody(request).JsonResponseBody(&response).Do(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithMessage(err, "invoke")
|
||||||
|
}
|
||||||
|
|
||||||
|
return response, nil
|
||||||
|
}
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package router
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"github.com/integration-system/isp-lib/backend"
|
|
||||||
"github.com/integration-system/isp-lib/modules"
|
|
||||||
log "github.com/integration-system/isp-log"
|
|
||||||
"google.golang.org/grpc"
|
|
||||||
md "google.golang.org/grpc/metadata"
|
|
||||||
"isp-script-service/codes"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
Client = backend.NewRxGrpcClient(
|
|
||||||
backend.WithDialOptions(grpc.WithInsecure(), grpc.WithBlock()),
|
|
||||||
backend.WithDialingErrorHandler(func(err error) {
|
|
||||||
log.Warnf(codes.InvokeRouterServiceError, "Router client dialing err: %v", err)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
func Invoke(methodPath string, request interface{}, metadata map[string]interface{}) (interface{}, error) {
|
|
||||||
newMd := md.New(map[string]string{})
|
|
||||||
for key, info := range metadata {
|
|
||||||
newMd.Set(key, fmt.Sprintf("%v", info))
|
|
||||||
} //todo metadata
|
|
||||||
|
|
||||||
var response interface{}
|
|
||||||
if err := Client.Visit(func(c *backend.InternalGrpcClient) error {
|
|
||||||
resp, err := c.InvokeWithDynamicStruct(
|
|
||||||
methodPath,
|
|
||||||
modules.RouterModuleId,
|
|
||||||
request,
|
|
||||||
//todo metadata
|
|
||||||
)
|
|
||||||
response = resp
|
|
||||||
return err
|
|
||||||
}); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return response, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
// nolint:ireturn
|
||||||
|
package routes
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/txix-open/isp-kit/cluster"
|
||||||
|
"github.com/txix-open/isp-kit/grpc"
|
||||||
|
"github.com/txix-open/isp-kit/grpc/endpoint"
|
||||||
|
"isp-script-service/controller"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Controllers struct {
|
||||||
|
Script controller.Script
|
||||||
|
}
|
||||||
|
|
||||||
|
func EndpointDescriptors() []cluster.EndpointDescriptor {
|
||||||
|
return endpointDescriptors(Controllers{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func Handler(wrapper endpoint.Wrapper, c Controllers) *grpc.Mux {
|
||||||
|
muxer := grpc.NewMux()
|
||||||
|
for _, descriptor := range endpointDescriptors(c) {
|
||||||
|
muxer.Handle(descriptor.Path, wrapper.Endpoint(descriptor.Handler))
|
||||||
|
}
|
||||||
|
return muxer
|
||||||
|
}
|
||||||
|
|
||||||
|
func endpointDescriptors(c Controllers) []cluster.EndpointDescriptor {
|
||||||
|
return []cluster.EndpointDescriptor{
|
||||||
|
{
|
||||||
|
Path: "script/script/execute",
|
||||||
|
Inner: true,
|
||||||
|
UserAuthRequired: false,
|
||||||
|
Handler: c.Script.Execute,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Path: "script/script/batch_execute",
|
||||||
|
Inner: true,
|
||||||
|
UserAuthRequired: false,
|
||||||
|
Handler: c.Script.BatchExecute,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Path: "script/script/execute_by_id",
|
||||||
|
Inner: true,
|
||||||
|
UserAuthRequired: false,
|
||||||
|
Handler: c.Script.ExecuteById,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Path: "script/script/batch_execute_by_ids",
|
||||||
|
Inner: true,
|
||||||
|
UserAuthRequired: false,
|
||||||
|
Handler: c.Script.BatchExecuteById,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
package script
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"github.com/dop251/goja"
|
|
||||||
"github.com/integration-system/isp-lib/config"
|
|
||||||
"isp-script-service/conf"
|
|
||||||
"isp-script-service/router"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var pool = &sync.Pool{
|
|
||||||
New: func() interface{} {
|
|
||||||
return initVm()
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
func initVm() *goja.Runtime {
|
|
||||||
vm := goja.New()
|
|
||||||
vm.Set("invoke", router.Invoke)
|
|
||||||
return vm
|
|
||||||
}
|
|
||||||
|
|
||||||
type Goja struct{}
|
|
||||||
|
|
||||||
func (*Goja) Compile(script string) (Script, error) {
|
|
||||||
prog, err := goja.Compile("script", script, false)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &GojaProgram{prog: prog}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*Goja) Execute(program Script, arg interface{}) (interface{}, error) {
|
|
||||||
value, ok := program.Src().(*goja.Program)
|
|
||||||
if !ok {
|
|
||||||
return nil, errors.New("unknown engine")
|
|
||||||
}
|
|
||||||
|
|
||||||
vm := pool.Get().(*goja.Runtime)
|
|
||||||
cfg := config.GetRemote().(*conf.RemoteConfig)
|
|
||||||
awaitTime := time.Duration(cfg.ScriptExecutionTimeoutMs) * time.Millisecond
|
|
||||||
t := time.AfterFunc(awaitTime, func() {
|
|
||||||
vm.Interrupt("execution timeout")
|
|
||||||
})
|
|
||||||
defer func() {
|
|
||||||
t.Stop()
|
|
||||||
pool.Put(vm)
|
|
||||||
}()
|
|
||||||
|
|
||||||
vm.Set("arg", arg)
|
|
||||||
res, err := vm.RunProgram(value)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return res.Export(), nil
|
|
||||||
/*go func() {
|
|
||||||
result, err := vm.RunProgram(value)
|
|
||||||
if err != nil {
|
|
||||||
errorCh <- err
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resultCh <- result.Export()
|
|
||||||
}()
|
|
||||||
select {
|
|
||||||
case result := <-resultCh:
|
|
||||||
return result, nil
|
|
||||||
case err := <-errorCh:
|
|
||||||
return nil, err
|
|
||||||
case <-time.After(awaitTime):
|
|
||||||
vm.Interrupt("time exceeded")
|
|
||||||
return nil, errors.New("time exceeded")
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
type GojaProgram struct {
|
|
||||||
prog *goja.Program
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *GojaProgram) Src() interface{} {
|
|
||||||
return a.prog
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
package script
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"github.com/dop251/goja"
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestGoja_AddFunction(t *testing.T) {
|
|
||||||
a := assert.New(t)
|
|
||||||
|
|
||||||
const SCRIPT = `
|
|
||||||
var response = {};
|
|
||||||
try {
|
|
||||||
response["test"] = f("string", "unknown", "test");
|
|
||||||
} catch (e) {
|
|
||||||
if (!(e instanceof GoError)) {
|
|
||||||
throw(e);
|
|
||||||
}
|
|
||||||
if (e.value.Error() !== "TEST") {
|
|
||||||
throw("Unexpected value: " + e.value.Error());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
`
|
|
||||||
|
|
||||||
f := func(varchar string, integer int, object string) (interface{}, error) {
|
|
||||||
a.Equal("string", varchar)
|
|
||||||
a.Equal(0, integer)
|
|
||||||
a.Equal("test", object)
|
|
||||||
return "test", nil
|
|
||||||
}
|
|
||||||
vm := goja.New()
|
|
||||||
vm.Set("f", f)
|
|
||||||
resp, err := vm.RunString(fmt.Sprintf("(function() { %s })();", SCRIPT))
|
|
||||||
a.NoError(err)
|
|
||||||
a.Equal(resp.Export(), map[string]interface{}{"test": "test"})
|
|
||||||
|
|
||||||
f2 := func(varchar string, integer int, object string) (interface{}, error) {
|
|
||||||
a.Equal("string", varchar)
|
|
||||||
a.Equal(0, integer)
|
|
||||||
a.Equal("test", object)
|
|
||||||
return "test", errors.New("TEST")
|
|
||||||
}
|
|
||||||
vm = goja.New()
|
|
||||||
vm.Set("f", f2)
|
|
||||||
resp, err = vm.RunString(fmt.Sprintf("(function() { %s })();", SCRIPT))
|
|
||||||
a.NoError(err)
|
|
||||||
a.NoError(err)
|
|
||||||
a.Equal(resp.Export(), map[string]interface{}{})
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package script
|
|
||||||
|
|
||||||
var scriptEngine = &Goja{}
|
|
||||||
|
|
||||||
func Default() Engine {
|
|
||||||
return scriptEngine
|
|
||||||
}
|
|
||||||
|
|
||||||
type Engine interface {
|
|
||||||
Compile(string) (Script, error)
|
|
||||||
Execute(Script, interface{}) (interface{}, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type Script interface {
|
|
||||||
Src() interface{}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,203 @@
|
|||||||
|
// nolint:wrapcheck
|
||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"crypto/sha256"
|
||||||
|
"crypto/sha512"
|
||||||
|
"encoding/hex"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/txix-open/isp-kit/log"
|
||||||
|
"github.com/txix-open/isp-script"
|
||||||
|
"isp-script-service/conf"
|
||||||
|
"isp-script-service/domain"
|
||||||
|
)
|
||||||
|
|
||||||
|
type scriptServiceCfg struct {
|
||||||
|
Scripts map[string]CompiledScript
|
||||||
|
ExecutionTimeout time.Duration
|
||||||
|
SharedScript string
|
||||||
|
}
|
||||||
|
|
||||||
|
type CompiledScript struct {
|
||||||
|
scripts.Script
|
||||||
|
Compiled bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type Router interface {
|
||||||
|
Invoke(methodPath string, request interface{}, metadata map[string]interface{}) (interface{}, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Script struct {
|
||||||
|
store scriptServiceCfg
|
||||||
|
scriptEngine *scripts.Engine
|
||||||
|
logger log.Logger
|
||||||
|
router Router
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewScript(invoker Router, logger log.Logger, sd []conf.ScriptDefinition, shared string, timeout int) *Script {
|
||||||
|
scr := scriptsFromConfig(context.Background(), logger, sd, shared, timeout)
|
||||||
|
scriptInstance := Script{
|
||||||
|
store: scr,
|
||||||
|
scriptEngine: scripts.NewEngine(),
|
||||||
|
logger: logger,
|
||||||
|
router: invoker,
|
||||||
|
}
|
||||||
|
|
||||||
|
return &scriptInstance
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Script) Execute(req domain.ExecuteRequest) *domain.ScriptResp {
|
||||||
|
cfg := s.store
|
||||||
|
scr, err := createScript(req.Script, cfg.SharedScript)
|
||||||
|
if err != nil {
|
||||||
|
return s.respError(err, domain.ErrorCompile)
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.executeScript(CompiledScript{scr, true}, req.Arg, cfg.ExecutionTimeout)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Script) ExecuteById(req domain.ExecuteByIdRequest) (*domain.ScriptResp, error) {
|
||||||
|
cfg := s.store
|
||||||
|
scr, ok := cfg.Scripts[req.Id]
|
||||||
|
if !ok {
|
||||||
|
return nil, domain.ErrScriptNotFound
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.executeScript(scr, req.Arg, cfg.ExecutionTimeout), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Script) BatchExecute(req []domain.ExecuteByIdRequest) []domain.ScriptResp {
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
cfg := s.store
|
||||||
|
response := make([]domain.ScriptResp, len(req))
|
||||||
|
for i := range req {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(i int) {
|
||||||
|
defer wg.Done()
|
||||||
|
if scr, ok := cfg.Scripts[req[i].Id]; !ok {
|
||||||
|
response[i] = *s.respError(errors.Errorf("not defined script for id %s", req[i].Id), domain.ErrorCompile)
|
||||||
|
} else {
|
||||||
|
response[i] = *s.executeScript(scr, req[i].Arg, cfg.ExecutionTimeout)
|
||||||
|
}
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Script) BatchExecuteById(req domain.BatchExecuteByIdsRequest) []domain.ScriptResp {
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
cfg := s.store
|
||||||
|
response := make([]domain.ScriptResp, len(req.Ids))
|
||||||
|
for i := range req.Ids {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(i int) {
|
||||||
|
defer wg.Done()
|
||||||
|
if scr, ok := cfg.Scripts[req.Ids[i]]; !ok {
|
||||||
|
response[i] = *s.respError(errors.Errorf("not defined script for id %s", req.Ids[i]), domain.ErrorCompile)
|
||||||
|
} else {
|
||||||
|
response[i] = *s.executeScript(scr, req.Arg, cfg.ExecutionTimeout)
|
||||||
|
}
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
|
||||||
|
var errEmpty = errors.New("empty answer, maybe lost return")
|
||||||
|
|
||||||
|
func (s *Script) executeScript(scr CompiledScript, arg interface{}, timeout time.Duration) *domain.ScriptResp {
|
||||||
|
if !scr.Compiled {
|
||||||
|
return s.respError(errors.New("invalid script configuration"), domain.ErrorCompile)
|
||||||
|
}
|
||||||
|
|
||||||
|
response, err := s.scriptEngine.Execute(scr.Script, arg,
|
||||||
|
scripts.WithTimeout(timeout),
|
||||||
|
scripts.WithDefaultToolkit(),
|
||||||
|
scripts.WithSet("external", map[string]interface{}{
|
||||||
|
"invoke": s.router.Invoke,
|
||||||
|
"hashSha256": Sha256,
|
||||||
|
"hashSha512": Sha512,
|
||||||
|
"generateUUIDv4": UUIDv4,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return s.respError(err, domain.ErrorRunTime)
|
||||||
|
}
|
||||||
|
if response == nil {
|
||||||
|
return s.respError(errEmpty, domain.ErrorRunTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &domain.ScriptResp{
|
||||||
|
Result: response,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Script) respError(err error, errorType string) *domain.ScriptResp {
|
||||||
|
respError := domain.Error{
|
||||||
|
Type: errorType,
|
||||||
|
Description: err.Error(),
|
||||||
|
}
|
||||||
|
|
||||||
|
return &domain.ScriptResp{
|
||||||
|
Error: &respError,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Sha256(value string) string {
|
||||||
|
sum := sha256.Sum256([]byte(value))
|
||||||
|
return hex.EncodeToString(sum[:])
|
||||||
|
}
|
||||||
|
|
||||||
|
func Sha512(value string) string {
|
||||||
|
sum := sha512.Sum512([]byte(value))
|
||||||
|
return hex.EncodeToString(sum[:])
|
||||||
|
}
|
||||||
|
|
||||||
|
func UUIDv4() string {
|
||||||
|
randomUUID, err := uuid.NewRandom()
|
||||||
|
if err != nil {
|
||||||
|
// will be handled as exception in js
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return randomUUID.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func scriptsFromConfig(
|
||||||
|
ctx context.Context,
|
||||||
|
logger log.Logger,
|
||||||
|
scriptDef []conf.ScriptDefinition,
|
||||||
|
sharedScript string,
|
||||||
|
executionTimeoutMs int,
|
||||||
|
) scriptServiceCfg {
|
||||||
|
var compiled bool
|
||||||
|
cfg := scriptServiceCfg{
|
||||||
|
Scripts: make(map[string]CompiledScript),
|
||||||
|
ExecutionTimeout: time.Duration(executionTimeoutMs) * time.Millisecond,
|
||||||
|
SharedScript: sharedScript,
|
||||||
|
}
|
||||||
|
for _, value := range scriptDef {
|
||||||
|
compiled = true
|
||||||
|
scr, err := createScript(value.Script, sharedScript)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(ctx, errors.WithMessage(err, "create script from config"),
|
||||||
|
log.String("scriptId", value.Id))
|
||||||
|
compiled = false
|
||||||
|
}
|
||||||
|
cfg.Scripts[value.Id] = CompiledScript{scr, compiled}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
func createScript(script, sharedScript string) (scripts.Script, error) {
|
||||||
|
return scripts.NewScript([]byte(sharedScript),
|
||||||
|
[]byte("(function() {\n"), []byte(script), []byte("\n})();"))
|
||||||
|
}
|
||||||
@@ -0,0 +1,193 @@
|
|||||||
|
package tests_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
"github.com/stretchr/testify/suite"
|
||||||
|
"github.com/txix-open/isp-kit/grpc/client"
|
||||||
|
"github.com/txix-open/isp-kit/test"
|
||||||
|
"github.com/txix-open/isp-kit/test/grpct"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
"isp-script-service/assembly"
|
||||||
|
"isp-script-service/conf"
|
||||||
|
"isp-script-service/domain"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestApiScriptTestSuite(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
suite.Run(t, &ApiScript{})
|
||||||
|
}
|
||||||
|
|
||||||
|
type ApiScript struct {
|
||||||
|
suite.Suite
|
||||||
|
test *test.Test
|
||||||
|
require *require.Assertions
|
||||||
|
apiCli *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ApiScript) SetupSuite() {
|
||||||
|
s.test, s.require = test.New(s.T())
|
||||||
|
|
||||||
|
cli := s.initMockServer()
|
||||||
|
|
||||||
|
cfg := conf.Remote{
|
||||||
|
ScriptExecutionTimeoutMs: 10000,
|
||||||
|
Scripts: []conf.ScriptDefinition{
|
||||||
|
{
|
||||||
|
Id: "1",
|
||||||
|
Script: "return true",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Id: "2",
|
||||||
|
Script: "return false",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
CustomScripts: []conf.ScriptDefinition{},
|
||||||
|
}
|
||||||
|
|
||||||
|
locator := assembly.NewLocator(s.test.Logger(), cli)
|
||||||
|
handler, _ := locator.Handler(cfg)
|
||||||
|
|
||||||
|
_, s.apiCli = grpct.TestServer(s.test, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ApiScript) TestExternalInvoke() {
|
||||||
|
req := domain.ExecuteRequest{
|
||||||
|
Script: "return external.invoke('mock', true, {})",
|
||||||
|
Arg: struct{}{},
|
||||||
|
}
|
||||||
|
res := domain.ScriptResp{}
|
||||||
|
err := s.apiCli.Invoke("script/script/execute").
|
||||||
|
JsonRequestBody(req).
|
||||||
|
JsonResponseBody(&res).
|
||||||
|
Do(context.Background())
|
||||||
|
s.Require().NoError(err)
|
||||||
|
s.Require().Equal(true, res.Result)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ApiScript) TestExecuteHappyPath() {
|
||||||
|
req := domain.ExecuteRequest{
|
||||||
|
Script: "return arg.a",
|
||||||
|
Arg: map[string]bool{
|
||||||
|
"a": true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
res := domain.ScriptResp{}
|
||||||
|
err := s.apiCli.Invoke("script/script/execute").
|
||||||
|
JsonRequestBody(req).
|
||||||
|
JsonResponseBody(&res).
|
||||||
|
Do(context.Background())
|
||||||
|
s.Require().NoError(err)
|
||||||
|
s.Require().Equal(true, res.Result)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ApiScript) TestExecuteByIdHappyPath() {
|
||||||
|
req := domain.ExecuteByIdRequest{
|
||||||
|
Id: "1",
|
||||||
|
Arg: struct{}{},
|
||||||
|
}
|
||||||
|
res := domain.ScriptResp{}
|
||||||
|
err := s.apiCli.Invoke("script/script/execute_by_id").
|
||||||
|
JsonRequestBody(req).
|
||||||
|
JsonResponseBody(&res).
|
||||||
|
Do(context.Background())
|
||||||
|
s.Require().NoError(err)
|
||||||
|
s.Require().Equal(true, res.Result)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ApiScript) TestExecuteByIdNotFound() {
|
||||||
|
req := domain.ExecuteByIdRequest{
|
||||||
|
Id: "unknown",
|
||||||
|
Arg: struct{}{},
|
||||||
|
}
|
||||||
|
res := domain.ScriptResp{}
|
||||||
|
err := s.apiCli.Invoke("script/script/execute_by_id").
|
||||||
|
JsonRequestBody(req).
|
||||||
|
JsonResponseBody(&res).
|
||||||
|
Do(context.Background())
|
||||||
|
s.Require().Error(err)
|
||||||
|
st, ok := status.FromError(err)
|
||||||
|
s.Require().True(ok)
|
||||||
|
s.Require().Equal(codes.NotFound, st.Code())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ApiScript) TestBatchExecuteHappyPath() {
|
||||||
|
req := []domain.ExecuteByIdRequest{
|
||||||
|
{
|
||||||
|
Id: "1",
|
||||||
|
Arg: struct{}{},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Id: "2",
|
||||||
|
Arg: struct{}{},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
res := make([]domain.ScriptResp, 0)
|
||||||
|
err := s.apiCli.Invoke("script/script/batch_execute").
|
||||||
|
JsonRequestBody(req).
|
||||||
|
JsonResponseBody(&res).
|
||||||
|
Do(context.Background())
|
||||||
|
s.Require().NoError(err)
|
||||||
|
expected := []domain.ScriptResp{
|
||||||
|
{Result: true, Error: nil},
|
||||||
|
{Result: false, Error: nil},
|
||||||
|
}
|
||||||
|
s.Require().ElementsMatch(expected, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ApiScript) TestBatchExecuteMixedNotFound() {
|
||||||
|
req := []domain.ExecuteByIdRequest{
|
||||||
|
{
|
||||||
|
Id: "1",
|
||||||
|
Arg: struct{}{},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Id: "unknown",
|
||||||
|
Arg: struct{}{},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
res := make([]domain.ScriptResp, 0)
|
||||||
|
err := s.apiCli.Invoke("script/script/batch_execute").
|
||||||
|
JsonRequestBody(req).
|
||||||
|
JsonResponseBody(&res).
|
||||||
|
Do(context.Background())
|
||||||
|
s.Require().NoError(err)
|
||||||
|
expected := []domain.ScriptResp{
|
||||||
|
{Result: true, Error: nil},
|
||||||
|
{Result: nil, Error: &domain.Error{
|
||||||
|
Type: domain.ErrorCompile,
|
||||||
|
Description: "not defined script for id unknown",
|
||||||
|
}},
|
||||||
|
}
|
||||||
|
s.Require().ElementsMatch(expected, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ApiScript) TestBatchExecuteByIdHappyPath() {
|
||||||
|
req := domain.BatchExecuteByIdsRequest{
|
||||||
|
Ids: []string{"1", "2"},
|
||||||
|
Arg: struct{}{},
|
||||||
|
}
|
||||||
|
res := make([]domain.ScriptResp, 0)
|
||||||
|
err := s.apiCli.Invoke("script/script/batch_execute_by_ids").
|
||||||
|
JsonRequestBody(req).
|
||||||
|
JsonResponseBody(&res).
|
||||||
|
Do(context.Background())
|
||||||
|
s.Require().NoError(err)
|
||||||
|
expected := []domain.ScriptResp{
|
||||||
|
{Result: true, Error: nil},
|
||||||
|
{Result: false, Error: nil},
|
||||||
|
}
|
||||||
|
s.Require().ElementsMatch(expected, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ApiScript) initMockServer() *client.Client {
|
||||||
|
server, cli := grpct.NewMock(s.test)
|
||||||
|
server.Mock("mock", func(req bool) bool {
|
||||||
|
return req
|
||||||
|
})
|
||||||
|
|
||||||
|
return cli
|
||||||
|
}
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
package main
|
// nolint:gochecknoglobals
|
||||||
|
package tests_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
json2 "encoding/json"
|
"strings"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
json2 "github.com/txix-open/isp-kit/json"
|
||||||
|
|
||||||
"github.com/dop251/goja"
|
"github.com/dop251/goja"
|
||||||
"github.com/robertkrimen/otto"
|
"github.com/robertkrimen/otto"
|
||||||
"github.com/robertkrimen/otto/parser"
|
"github.com/robertkrimen/otto/parser"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/yuin/gopher-lua"
|
lua "github.com/yuin/gopher-lua"
|
||||||
"github.com/yuin/gopher-lua/parse"
|
"github.com/yuin/gopher-lua/parse"
|
||||||
"layeh.com/gopher-json"
|
json "layeh.com/gopher-json"
|
||||||
"strings"
|
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -57,12 +60,13 @@ var (
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
srcString []byte
|
srcString []byte
|
||||||
expecting = make(map[string]interface{}, 0)
|
expecting = make(map[string]interface{})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint:gochecknoinits
|
||||||
func init() {
|
func init() {
|
||||||
for _, v := range recordsExample {
|
for _, v := range recordsExample {
|
||||||
expecting[v["id_tp_cd"].(string)] = v
|
expecting[v["id_tp_cd"].(string)] = v // nolint:forcetypeassert
|
||||||
}
|
}
|
||||||
if bytes, err := json2.Marshal(recordsExample); err != nil {
|
if bytes, err := json2.Marshal(recordsExample); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@@ -72,81 +76,70 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestOtto(t *testing.T) {
|
func TestOtto(t *testing.T) {
|
||||||
assert := assert.New(t)
|
t.Parallel()
|
||||||
|
require := require.New(t)
|
||||||
|
|
||||||
prog, err := parser.ParseFile(nil, "example", jsScript, 0)
|
prog, err := parser.ParseFile(nil, "example", jsScript, 0)
|
||||||
if !assert.NoError(err) {
|
require.NoError(err)
|
||||||
return
|
|
||||||
}
|
|
||||||
//
|
|
||||||
runTime := otto.New()
|
runTime := otto.New()
|
||||||
err = runTime.Set("b", recordsExample)
|
err = runTime.Set("b", recordsExample)
|
||||||
if !assert.NoError(err) {
|
require.NoError(err)
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = runTime.Run(prog)
|
_, err = runTime.Run(prog)
|
||||||
if !assert.NoError(err) {
|
require.NoError(err)
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
res, err := runTime.Get("a")
|
res, err := runTime.Get("a")
|
||||||
if !assert.NoError(err) {
|
require.NoError(err)
|
||||||
return
|
|
||||||
}
|
|
||||||
_, err = res.Export()
|
_, err = res.Export()
|
||||||
if !assert.NoError(err) {
|
require.NoError(err)
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGoja(t *testing.T) {
|
func TestGoja(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
require := require.New(t)
|
||||||
|
|
||||||
prog := goja.MustCompile("test.js", jsScript, false)
|
prog := goja.MustCompile("test.js", jsScript, false)
|
||||||
//
|
|
||||||
runTime := goja.New()
|
runTime := goja.New()
|
||||||
runTime.Set("b", recordsExample)
|
err := runTime.Set("b", recordsExample)
|
||||||
_, err := runTime.RunProgram(prog)
|
require.NoError(err)
|
||||||
|
|
||||||
|
_, err = runTime.RunProgram(prog)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
a := runTime.Get("a")
|
a := runTime.Get("a")
|
||||||
_ = a.Export()
|
_ = a.Export()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGopherLua(t *testing.T) {
|
func TestGopherLua(t *testing.T) {
|
||||||
assert := assert.New(t)
|
t.Parallel()
|
||||||
|
require := require.New(t)
|
||||||
|
|
||||||
l := lua.NewState()
|
l := lua.NewState()
|
||||||
defer l.Close()
|
defer l.Close()
|
||||||
|
|
||||||
/*f, err := l.LoadString(`
|
b, err := json2.Marshal(recordsExample)
|
||||||
println(src)
|
require.NoError(err)
|
||||||
dst = src
|
|
||||||
`)
|
|
||||||
if !assert.NoError(err) {
|
|
||||||
return
|
|
||||||
}*/
|
|
||||||
b, _ := json2.Marshal(recordsExample)
|
|
||||||
val, err := json.Decode(l, b)
|
val, err := json.Decode(l, b)
|
||||||
if !assert.NoError(err) {
|
require.NoError(err)
|
||||||
return
|
|
||||||
}
|
|
||||||
l.SetGlobal("src", val)
|
l.SetGlobal("src", val)
|
||||||
|
|
||||||
//
|
|
||||||
err = l.DoString(luaScript)
|
err = l.DoString(luaScript)
|
||||||
if !assert.NoError(err) {
|
require.NoError(err)
|
||||||
return
|
|
||||||
}
|
|
||||||
dst := l.GetGlobal("dst")
|
dst := l.GetGlobal("dst")
|
||||||
b, err = json.Encode(dst)
|
b, err = json.Encode(dst)
|
||||||
m := make(map[string]interface{}, 0)
|
require.NoError(err)
|
||||||
|
|
||||||
|
m := make(map[string]interface{})
|
||||||
err = json2.Unmarshal(b, &m)
|
err = json2.Unmarshal(b, &m)
|
||||||
if !assert.NoError(err) {
|
require.NoError(err)
|
||||||
return
|
|
||||||
}
|
require.EqualValues(expecting, m)
|
||||||
assert.EqualValues(expecting, m)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkOtto(b *testing.B) {
|
func BenchmarkOtto(b *testing.B) {
|
||||||
@@ -155,7 +148,7 @@ func BenchmarkOtto(b *testing.B) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < b.N; i++ {
|
for range b.N {
|
||||||
runTime := otto.New()
|
runTime := otto.New()
|
||||||
err = runTime.Set("b", recordsExample)
|
err = runTime.Set("b", recordsExample)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -181,14 +174,18 @@ func BenchmarkOtto(b *testing.B) {
|
|||||||
func BenchmarkGoja(b *testing.B) {
|
func BenchmarkGoja(b *testing.B) {
|
||||||
prog := goja.MustCompile("test.js", jsScript, false)
|
prog := goja.MustCompile("test.js", jsScript, false)
|
||||||
|
|
||||||
for i := 0; i < b.N; i++ {
|
for range b.N {
|
||||||
runTime := goja.New()
|
runTime := goja.New()
|
||||||
runTime.Set("b", recordsExample)
|
err := runTime.Set("b", recordsExample)
|
||||||
_, err := runTime.RunProgram(prog)
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, err = runTime.RunProgram(prog)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
a := runTime.Get("a")
|
a := runTime.Get("a")
|
||||||
_ = a.Export()
|
_ = a.Export()
|
||||||
}
|
}
|
||||||
@@ -204,7 +201,7 @@ func BenchmarkGopherLua(b *testing.B) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < b.N; i++ {
|
for range b.N {
|
||||||
l := lua.NewState()
|
l := lua.NewState()
|
||||||
|
|
||||||
val, err := json.Decode(l, srcString)
|
val, err := json.Decode(l, srcString)
|
||||||
@@ -222,12 +219,14 @@ func BenchmarkGopherLua(b *testing.B) {
|
|||||||
|
|
||||||
dst := l.GetGlobal("dst")
|
dst := l.GetGlobal("dst")
|
||||||
c, err := json.Encode(dst)
|
c, err := json.Encode(dst)
|
||||||
m := make(map[string]interface{}, 0)
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
m := make(map[string]interface{})
|
||||||
err = json2.Unmarshal(c, &m)
|
err = json2.Unmarshal(c, &m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
l.Close()
|
l.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package tests_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
"github.com/stretchr/testify/suite"
|
||||||
|
"github.com/txix-open/isp-kit/grpc/client"
|
||||||
|
"github.com/txix-open/isp-kit/test"
|
||||||
|
"github.com/txix-open/isp-kit/test/grpct"
|
||||||
|
"isp-script-service/assembly"
|
||||||
|
"isp-script-service/conf"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestMergeScriptTestSuite(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
suite.Run(t, &MergeScript{})
|
||||||
|
}
|
||||||
|
|
||||||
|
type MergeScript struct {
|
||||||
|
suite.Suite
|
||||||
|
test *test.Test
|
||||||
|
require *require.Assertions
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *MergeScript) TestMergeScriptsDuplicateId() {
|
||||||
|
s.test, s.require = test.New(s.T())
|
||||||
|
|
||||||
|
cli := s.initMockServer()
|
||||||
|
|
||||||
|
cfg := conf.Remote{
|
||||||
|
ScriptExecutionTimeoutMs: 10000,
|
||||||
|
Scripts: []conf.ScriptDefinition{
|
||||||
|
{
|
||||||
|
Id: "1",
|
||||||
|
Script: "return true",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
CustomScripts: []conf.ScriptDefinition{
|
||||||
|
{
|
||||||
|
Id: "1",
|
||||||
|
Script: "return false",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
locator := assembly.NewLocator(s.test.Logger(), cli)
|
||||||
|
_, err := locator.Handler(cfg)
|
||||||
|
|
||||||
|
s.Require().Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *MergeScript) TestMergeScriptsHappyPath() {
|
||||||
|
s.test, s.require = test.New(s.T())
|
||||||
|
|
||||||
|
cli := s.initMockServer()
|
||||||
|
|
||||||
|
cfg := conf.Remote{
|
||||||
|
ScriptExecutionTimeoutMs: 10000,
|
||||||
|
Scripts: []conf.ScriptDefinition{
|
||||||
|
{
|
||||||
|
Id: "1",
|
||||||
|
Script: "return true",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Id: "2",
|
||||||
|
Script: "return true",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
CustomScripts: []conf.ScriptDefinition{
|
||||||
|
{
|
||||||
|
Id: "3",
|
||||||
|
Script: "return false",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
locator := assembly.NewLocator(s.test.Logger(), cli)
|
||||||
|
_, err := locator.Handler(cfg)
|
||||||
|
|
||||||
|
s.Require().NoError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *MergeScript) initMockServer() *client.Client {
|
||||||
|
server, cli := grpct.NewMock(s.test)
|
||||||
|
server.Mock("mock", func(req bool) bool {
|
||||||
|
return req
|
||||||
|
})
|
||||||
|
|
||||||
|
return cli
|
||||||
|
}
|
||||||
Reference in new issue
Block a user