FIN-29: Init commit (#1)

This commit is contained in:
Baikov Dmitrii 2024-04-26 16:51:21 +03:00 committed by GitHub
parent f1b5ed8ced
commit 0d48f13102
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 5633 additions and 0 deletions

2
.github/settings.yml vendored Normal file
View File

@ -0,0 +1,2 @@
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
_extends: .github

10
.github/workflows/basic-linters.yml vendored Normal file
View File

@ -0,0 +1,10 @@
name: Vality basic linters
on:
pull_request:
branches:
- "*"
jobs:
lint:
uses: valitydev/base-workflows/.github/workflows/basic-linters.yml@v1

17
.github/workflows/erlang-pr.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: Erlang build
on:
pull_request:
branches:
- "*"
jobs:
build:
uses: valitydev/erlang-workflows/.github/workflows/erlang-simple-build.yml@v1
with:
otp-version: 24
rebar-version: 3
use-thrift: true
thrift-version: 0.14.2.3
run-eunit: false
run-common-test: false

21
.github/workflows/frontend-pr.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: 'Frontend: PR'
on:
pull_request:
branches: ['*']
jobs:
configured:
uses: valitydev/action-frontend/.github/workflows/configured.yml@v0.1
check:
name: Check
runs-on: ubuntu-latest
needs: configured
if: needs.configured.outputs.exists == 'true'
steps:
- uses: actions/checkout@v3
- uses: valitydev/action-frontend/setup@v1
- uses: valitydev/action-setup-thrift@v1.0.2
- run: npm i # protocols don't always update the package-lock.json, so installing from package.json
- name: Codegen
run: npm run codegen

24
.github/workflows/frontend-publish.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: 'Frontend: Publish'
on:
push:
branches: ['master', 'main']
jobs:
configured:
uses: valitydev/action-frontend/.github/workflows/configured.yml@v0.1
publish:
name: Publish
runs-on: ubuntu-latest
needs: configured
if: needs.configured.outputs.exists == 'true'
steps:
- uses: actions/checkout@v3
- uses: valitydev/action-frontend/setup@v1
- uses: valitydev/action-setup-thrift@v1.0.2
- run: npm i # protocols don't always update the package-lock.json, so installing from package.json
- name: Build
run: npm run codegen
- uses: valitydev/action-frontend/publish@v1
with:
npm-token: ${{ secrets.NPM_TOKEN }}

17
.github/workflows/java-deploy.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: Java deploy
on:
push:
branches:
- "master"
- "main"
jobs:
deploy:
uses: valitydev/java-workflow/.github/workflows/maven-thrift-deploy.yml@v1
secrets:
server-username: ${{ secrets.OSSRH_USERNAME }}
server-password: ${{ secrets.OSSRH_TOKEN }}
deploy-secret-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
deploy-secret-key-password: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
mm-webhook-url: ${{ secrets.MATTERMOST_WEBHOOK_URL }}

10
.github/workflows/java-pr.yml vendored Normal file
View File

@ -0,0 +1,10 @@
name: Java build
on:
pull_request:
branches:
- "*"
jobs:
build:
uses: valitydev/java-workflow/.github/workflows/maven-thrift-build.yml@v1

86
.gitignore vendored Normal file
View File

@ -0,0 +1,86 @@
# Created by .ignore support plugin (hsz.mobi)
.eunit
deps
*.o
*.beam
*.plt
erl_crash.dump
ebin/*.beam
rel/example_project
.concrete/DEV_MODE
.rebar
include/*.hrl
src/*.erl
_build/
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
# Gradle:
.idea/gradle.xml
.idea/libraries
# Mongo Explorer plugin:
.idea/mongoSettings.xml
*.iws
*.ipr
*.iml
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
env.list
# frontend
node_modules
clients
dist

5085
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

39
package.json Normal file
View File

@ -0,0 +1,39 @@
{
"name": "@valitydev/dominator-proto",
"version": "1.0.0",
"scripts": {
"codegen": "thrift-codegen --i ./proto ./node_modules/@vality/domain-proto --n dominator"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"exports": {
".": "./dist/thrift-codegen.bundle.js",
"./metadata.json": "./dist/metadata.json",
"./package.json": "./package.json"
},
"repository": {
"type": "git",
"url": "git+https://github.com/valitydev/dominator-proto.git"
},
"license": "Apache-2.0",
"homepage": "https://github.com/valitydev/dominator-proto#readme",
"files": [
"dist/**/*.{js,d.ts,json,map}",
"**/*.thrift"
],
"main": "./dist/thrift-codegen.bundle.js",
"types": "index.d.ts",
"typesVersions": {
">=4.6": {
"*": [
"dist/types/*"
]
}
},
"devDependencies": {
"@vality/domain-proto": "2.0.1-45b0719.0",
"@vality/thrift-codegen": "2.3.2"
}
}

127
pom.xml Normal file
View File

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.vality</groupId>
<artifactId>library-parent-pom</artifactId>
<version>1.0.3</version>
</parent>
<artifactId>dominator-proto</artifactId>
<version>${revision}</version>
<packaging>jar</packaging>
<name>dominator-proto</name>
<description>Generates jar artifact containing compiled thrift classes based on generated thrift IDL files
</description>
<url>https://github.com/valitydev/dominator-proto</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<email>devs@vality.dev</email>
<organization>Vality</organization>
<organizationUrl>https://vality.dev</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/valitydev/dominator-proto</connection>
<developerConnection>scm:git:ssh://github.com/valitydev/dominator-proto</developerConnection>
<url>https://github.com/valitydev/dominator-proto/tree/master</url>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>SNAPSHOT</revision>
</properties>
<dependencies>
<dependency>
<groupId>dev.vality.woody</groupId>
<artifactId>woody-thrift</artifactId>
<version>1.0.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>dev.vality</groupId>
<artifactId>damsel</artifactId>
<version>1.597-bfedcb9</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<resources>
<resource>
<directory>${project.basedir}/proto</directory>
<targetPath>${project.build.outputDirectory}/proto</targetPath>
<includes>
<include>*.thrift</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<!-- THRIFT -->
<plugin>
<groupId>org.apache.thrift</groupId>
<artifactId>thrift-maven-plugin</artifactId>
<version>0.10.0</version>
<configuration>
<generator>java:fullcamel</generator>
<thriftSourceRoot>${project.basedir}/proto</thriftSourceRoot>
<thriftExecutable>${path_to_thrift}</thriftExecutable>
</configuration>
<executions>
<execution>
<id>thrift-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>com.empayre.dominator</pattern>
<shadedPattern>com.empayre.dominator.v${commit.number}</shadedPattern>
</relocation>
</relocations>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>v${commit.number}</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

108
proto/dominator.thrift Normal file
View File

@ -0,0 +1,108 @@
include "proto/base.thrift"
include "proto/domain.thrift"
namespace java com.empayre.dominator
namespace erlang dominator.dominator
typedef string ContinuationToken
exception BadContinuationToken { 1: string reason }
exception LimitExceeded {}
struct CommonSearchQueryParams {
1: optional list<string> currencies
2: optional ContinuationToken continuation_token
3: optional i32 limit
}
/* Набор параметров для поиска условий магазинов */
struct ShopSearchQuery {
1: required CommonSearchQueryParams common_search_query_params
2: optional domain.PartyID party_id
3: optional list<domain.ShopID> shop_ids
4: optional list<string> term_sets_names
5: optional list<domain.TermSetHierarchyRef> term_sets_ids
}
/* Набор параметров для поиска условий кошельков */
struct WalletSearchQuery {
1: required CommonSearchQueryParams common_search_query_params
2: optional domain.PartyID party_id
3: optional list<domain.IdentityProviderRef> identity_ids
4: optional list<domain.WalletID> wallet_ids
5: optional list<string> term_sets_names
6: optional list<domain.TermSetHierarchyRef> term_sets_ids
}
/* Набор параметров для поиска условий терминалов */
struct TerminalSearchQuery {
1: required CommonSearchQueryParams common_search_query_params
2: optional list<domain.ProviderRef> provider_ids
3: optional list<domain.TerminalRef> terminal_ids
}
/* Набор условий для магазина */
struct ShopTermSet {
1: required domain.PartyID owner_id
2: optional domain.ShopID shop_id
3: required domain.ContractID contract_id
4: required string shop_name
5: required string term_set_name
6: required string currency
7: required domain.TermSetHierarchyObject current_term_set
8: optional list<domain.TermSetHierarchyObject> term_set_history
}
/* Набор условий для кошелька */
struct WalletTermSet {
1: required domain.PartyID owner_id
2: optional domain.IdentityProviderRef identity_id
3: required domain.ContractID contract_id
4: required domain.WalletID wallet_id
5: required string wallet_name
6: required string term_set_name
7: required string currency
8: required domain.TermSetHierarchyObject current_term_set
9: optional list<domain.TermSetHierarchyObject> term_set_history
}
/* Набор условий для терминала */
struct TerminalTermSet {
1: required domain.TerminalRef terminal_id
2: required string terminal_name
3: required domain.ProviderRef provider_id
4: required string provider_name
5: required string currency
6: required domain.ProvisionTermSet current_term_set
7: optional list<domain.ProvisionTermSet> term_set_history
}
struct ShopTermSetsResponse {
1: required list<ShopTermSet> terms
2: optional string continuation_token
}
struct WalletTermSetsResponse {
1: required list<WalletTermSet> terms
2: optional string continuation_token
}
struct TerminalTermSetsResponse {
1: required list<TerminalTermSet> terms
2: optional string continuation_token
}
service DominatorService {
/* Поиск условий для магаизнов */
ShopTermSetsResponse SearchShopTermSets (1: ShopSearchQuery shop_search_query)
throws (1: BadContinuationToken ex1, 2: LimitExceeded ex2, 3: base.InvalidRequest ex3)
/* Поиск условий для кошельков */
WalletTermSetsResponse SearchWalletTermSets (1: WalletSearchQuery wallet_search_query)
throws (1: BadContinuationToken ex1, 2: LimitExceeded ex2, 3: base.InvalidRequest ex3)
/* Поиск условий для терминалов */
TerminalTermSetsResponse SearchTerminalTermSets (1: TerminalSearchQuery terminal_search_query)
throws (1: BadContinuationToken ex1, 2: LimitExceeded ex2, 3: base.InvalidRequest ex3)
}

70
rebar.config Normal file
View File

@ -0,0 +1,70 @@
%% Common project erlang options.
{erl_opts, [
% mandatory
debug_info,
warnings_as_errors,
warn_export_all,
warn_missing_spec,
warn_untyped_record,
warn_export_vars,
% by default
warn_unused_record,
warn_bif_clash,
warn_obsolete_guard,
warn_unused_vars,
warn_shadow_vars,
warn_unused_import,
warn_unused_function,
warn_deprecated_function,
% at will
% bin_opt_info
% no_auto_import,
warn_missing_spec_all
]}.
{deps, [
{damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "master"}}}
]}.
%% XRef checks
{xref_checks, [
undefined_function_calls,
undefined_functions,
deprecated_functions_calls,
deprecated_functions
]}.
%% Tests
{cover_enabled, true}.
%% Dialyzer static analyzing
{dialyzer, [
{warnings, [
% mandatory
unmatched_returns,
error_handling,
race_conditions,
unknown
]},
{plt_apps, all_deps}
]}.
{plugins, [
{rebar3_thrift_compiler,
{git, "https://github.com/valitydev/rebar3-thrift-compiler.git", {tag, "0.4"}}}
]}.
{provider_hooks, [
{pre, [
{compile, {thrift, compile}},
{clean, {thrift, clean}}
]}
]}.
{thrift_compiler_opts, [
{in_dir, "proto"},
{in_files, all},
{gen, "erlang:app_namespaces"}
]}.

4
rebar.lock Normal file
View File

@ -0,0 +1,4 @@
[{<<"damsel">>,
{git,"https://github.com/valitydev/damsel.git",
{ref,"dac2cb599499cc0701e60856f4092c9ab283eedf"}},
0}].

4
renovate.json Normal file
View File

@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["local>valitydev/.github:renovate-config"]
}

View File

@ -0,0 +1,9 @@
{application, dominator_proto, [
{description, "Thrift proto for the dominator setvice"},
{vsn, "1.0.0"},
{applications, [
kernel,
stdlib,
damsel
]}
]}.