@paybuy/config-client 0.0.0-stage → 1.2.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/.eslintrc.js +52 -0
  2. package/.gitlab-ci.yml +29 -0
  3. package/.prettierrc +6 -0
  4. package/dist/decorator/index.d.ts +1 -0
  5. package/dist/decorator/index.js +18 -0
  6. package/dist/decorator/index.js.map +1 -0
  7. package/dist/decorator/inject-dynamic-config.decorator.d.ts +1 -0
  8. package/dist/decorator/inject-dynamic-config.decorator.js +10 -0
  9. package/dist/decorator/inject-dynamic-config.decorator.js.map +1 -0
  10. package/dist/dynamic-config/constants/dynamic-config-client-key.constants.d.ts +4 -0
  11. package/dist/dynamic-config/constants/dynamic-config-client-key.constants.js +8 -0
  12. package/dist/dynamic-config/constants/dynamic-config-client-key.constants.js.map +1 -0
  13. package/dist/dynamic-config/decorator/dynamic-config.decorator.d.ts +7 -0
  14. package/dist/dynamic-config/decorator/dynamic-config.decorator.js +16 -0
  15. package/dist/dynamic-config/decorator/dynamic-config.decorator.js.map +1 -0
  16. package/dist/dynamic-config/decorator/index.d.ts +1 -0
  17. package/dist/dynamic-config/decorator/index.js +18 -0
  18. package/dist/dynamic-config/decorator/index.js.map +1 -0
  19. package/dist/dynamic-config/dynamic-config.module.d.ts +7 -0
  20. package/dist/dynamic-config/dynamic-config.module.js +92 -0
  21. package/dist/dynamic-config/dynamic-config.module.js.map +1 -0
  22. package/dist/dynamic-config/enum/dynamic-config-meta-data.enum.d.ts +8 -0
  23. package/dist/dynamic-config/enum/dynamic-config-meta-data.enum.js +12 -0
  24. package/dist/dynamic-config/enum/dynamic-config-meta-data.enum.js.map +1 -0
  25. package/dist/dynamic-config/index.d.ts +3 -0
  26. package/dist/dynamic-config/index.js +20 -0
  27. package/dist/dynamic-config/index.js.map +1 -0
  28. package/dist/dynamic-config/model/dynamic-config-model.d.ts +11 -0
  29. package/dist/dynamic-config/model/dynamic-config-model.js +70 -0
  30. package/dist/dynamic-config/model/dynamic-config-model.js.map +1 -0
  31. package/dist/dynamic-config/model/index.d.ts +1 -0
  32. package/dist/dynamic-config/model/index.js +18 -0
  33. package/dist/dynamic-config/model/index.js.map +1 -0
  34. package/dist/dynamic-config/provider/dynamic-config.provider.d.ts +4 -0
  35. package/dist/dynamic-config/provider/dynamic-config.provider.js +37 -0
  36. package/dist/dynamic-config/provider/dynamic-config.provider.js.map +1 -0
  37. package/dist/dynamic-config/service/dynamic-config-cache.service.d.ts +16 -0
  38. package/dist/dynamic-config/service/dynamic-config-cache.service.js +50 -0
  39. package/dist/dynamic-config/service/dynamic-config-cache.service.js.map +1 -0
  40. package/dist/dynamic-config/service/dynamic-config.service.d.ts +8 -0
  41. package/dist/dynamic-config/service/dynamic-config.service.js +37 -0
  42. package/dist/dynamic-config/service/dynamic-config.service.js.map +1 -0
  43. package/dist/dynamic-config/types/dynamic-config.type.d.ts +3 -0
  44. package/dist/dynamic-config/types/dynamic-config.type.js +3 -0
  45. package/dist/dynamic-config/types/dynamic-config.type.js.map +1 -0
  46. package/dist/index.d.ts +2 -0
  47. package/dist/index.js +19 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/tsconfig.build.tsbuildinfo +1 -0
  50. package/dist/types/crud_request.d.ts +18 -0
  51. package/dist/types/crud_request.js +6 -0
  52. package/dist/types/crud_request.js.map +1 -0
  53. package/dist/types/dynamic-config/dynamic-config.d.ts +44 -0
  54. package/dist/types/dynamic-config/dynamic-config.js +6 -0
  55. package/dist/types/dynamic-config/dynamic-config.js.map +1 -0
  56. package/dist/types/filter_option.d.ts +30 -0
  57. package/dist/types/filter_option.js +30 -0
  58. package/dist/types/filter_option.js.map +1 -0
  59. package/dist/types/google/protobuf/any.d.ts +6 -0
  60. package/dist/types/google/protobuf/any.js +6 -0
  61. package/dist/types/google/protobuf/any.js.map +1 -0
  62. package/dist/types/google/protobuf/struct.d.ts +28 -0
  63. package/dist/types/google/protobuf/struct.js +11 -0
  64. package/dist/types/google/protobuf/struct.js.map +1 -0
  65. package/dist/types/owner.d.ts +5 -0
  66. package/dist/types/owner.js +6 -0
  67. package/dist/types/owner.js.map +1 -0
  68. package/dist/types/paybuy-config.d.ts +26 -0
  69. package/dist/types/paybuy-config.js +31 -0
  70. package/dist/types/paybuy-config.js.map +1 -0
  71. package/dist/types/paybuy-health-check.d.ts +15 -0
  72. package/dist/types/paybuy-health-check.js +12 -0
  73. package/dist/types/paybuy-health-check.js.map +1 -0
  74. package/package.json +54 -4
  75. package/proto/dynamic-config/dynamic-config.proto +52 -0
  76. package/proto/paybuy-config.proto +17 -0
  77. package/proto/paybuy-health-check.proto +19 -0
  78. package/src/decorator/index.ts +1 -0
  79. package/src/decorator/inject-dynamic-config.decorator.ts +10 -0
  80. package/src/dynamic-config/constants/dynamic-config-client-key.constants.ts +5 -0
  81. package/src/dynamic-config/decorator/dynamic-config.decorator.ts +45 -0
  82. package/src/dynamic-config/decorator/index.ts +1 -0
  83. package/src/dynamic-config/dynamic-config.module.ts +109 -0
  84. package/src/dynamic-config/enum/dynamic-config-meta-data.enum.ts +8 -0
  85. package/src/dynamic-config/index.ts +3 -0
  86. package/src/dynamic-config/model/dynamic-config-model.ts +96 -0
  87. package/src/dynamic-config/model/index.ts +1 -0
  88. package/src/dynamic-config/provider/dynamic-config.provider.ts +53 -0
  89. package/src/dynamic-config/service/dynamic-config-cache.service.ts +64 -0
  90. package/src/dynamic-config/types/dynamic-config.type.ts +1 -0
  91. package/src/index.ts +2 -0
  92. package/src/types/crud_request.ts +24 -0
  93. package/src/types/dynamic-config/dynamic-config.ts +54 -0
  94. package/src/types/filter_option.ts +35 -0
  95. package/src/types/google/protobuf/any.ts +123 -0
  96. package/src/types/google/protobuf/struct.ts +70 -0
  97. package/src/types/owner.ts +9 -0
  98. package/src/types/paybuy-config.ts +119 -0
  99. package/src/types/paybuy-health-check.ts +22 -0
  100. package/test/dyanimc-config-client.unit.spec.ts +57 -0
  101. package/test/jest.json +32 -0
  102. package/test/mock/grpc-client-service.mock.ts +48 -0
  103. package/test/test-client.ts +27 -0
  104. package/tsconfig.build.json +4 -0
  105. package/tsconfig.json +17 -0
  106. package/README.md +0 -3
@@ -0,0 +1,3 @@
1
+ export * from './decorator';
2
+ export * from './model';
3
+ export * from './dynamic-config.module';
@@ -0,0 +1,96 @@
1
+ import { plainToInstance } from 'class-transformer';
2
+ import { ValidationError, validateOrReject } from 'class-validator';
3
+ import { lastValueFrom } from 'rxjs';
4
+ import { DynamicConfigServiceClient } from '../../types/paybuy-config';
5
+ import { DYNAMIC_CONFIG_METADATA_KEYS } from '../enum/dynamic-config-meta-data.enum';
6
+ import * as memoize from 'memoizee';
7
+ import { NotFoundException } from '@nestjs/common';
8
+
9
+ export class DynamicConfigModel {
10
+ get key(): string {
11
+ return Reflect.getMetadata(
12
+ `${DYNAMIC_CONFIG_METADATA_KEYS.prefix}:${DYNAMIC_CONFIG_METADATA_KEYS.key}`,
13
+ this.constructor,
14
+ ) as string;
15
+ }
16
+
17
+ get dynamicConfigType(): string {
18
+ return Reflect.getMetadata(
19
+ `${DYNAMIC_CONFIG_METADATA_KEYS.prefix}:${DYNAMIC_CONFIG_METADATA_KEYS.dynamicConfigType}`,
20
+ this.constructor,
21
+ );
22
+ }
23
+
24
+ get fallBackValue(): Omit<
25
+ this,
26
+ 'fallBackValue' | 'key' | 'dynamicConfigType'
27
+ > {
28
+ return Reflect.getMetadata(
29
+ `${DYNAMIC_CONFIG_METADATA_KEYS.prefix}:${DYNAMIC_CONFIG_METADATA_KEYS.fallBackValue}`,
30
+ this.constructor,
31
+ ) as Omit<this, 'fallBackValue' | 'key' | 'dynamicConfigType'>;
32
+ }
33
+
34
+ get retry(): number {
35
+ return Reflect.getMetadata(
36
+ `${DYNAMIC_CONFIG_METADATA_KEYS.prefix}:${DYNAMIC_CONFIG_METADATA_KEYS.retry}`,
37
+ this.constructor,
38
+ );
39
+ }
40
+
41
+ get cacheTTL(): number {
42
+ return Reflect.getMetadata(
43
+ `${DYNAMIC_CONFIG_METADATA_KEYS.prefix}:${DYNAMIC_CONFIG_METADATA_KEYS.cacheTTL}`,
44
+ this.constructor,
45
+ );
46
+ }
47
+
48
+ get = memoize(this._get, {
49
+ normalizer: () => {
50
+ return JSON.stringify({
51
+ key: this.key,
52
+ type: this.dynamicConfigType,
53
+ });
54
+ },
55
+ maxAge: this.cacheTTL,
56
+ });
57
+
58
+ async _get(dynamicConfigService: DynamicConfigServiceClient) {
59
+ for (let i = 0; i < this.retry + 1; i++) {
60
+ try {
61
+ if (i !== 0) {
62
+ console.log(`${this.constructor.name} ==> Retry ${i}`);
63
+ }
64
+
65
+ const value = await lastValueFrom(
66
+ dynamicConfigService.getRaw({
67
+ key: this.key,
68
+ type: this.dynamicConfigType,
69
+ }),
70
+ );
71
+ const parsedValue = plainToInstance(
72
+ (this as any).constructor,
73
+ JSON.parse(value.result) ?? {},
74
+ ) as any;
75
+
76
+ if (parsedValue instanceof Object)
77
+ await validateOrReject(parsedValue, {});
78
+ return parsedValue;
79
+ } catch (error) {
80
+ if (
81
+ error instanceof Array &&
82
+ error.find((item) => item instanceof ValidationError)
83
+ ) {
84
+ console.log(`${this.constructor.name} => ValidationError`);
85
+ console.log(error);
86
+ } else if (this.retry && this.retry !== i) continue;
87
+ else if (this.fallBackValue) return this.fallBackValue;
88
+ else {
89
+ console.log(`${this.constructor.name} => fallBackValue is undefined`);
90
+ }
91
+
92
+ throw error;
93
+ }
94
+ }
95
+ }
96
+ }
@@ -0,0 +1 @@
1
+ export * from './dynamic-config-model';
@@ -0,0 +1,53 @@
1
+ /* Import */
2
+ import { ConfigurableModuleAsyncOptions, Provider } from '@nestjs/common';
3
+ import { ClientGrpc } from '@nestjs/microservices';
4
+ // Service
5
+ import { DynamicConfigCacheService } from '../service/dynamic-config-cache.service';
6
+ // Constant
7
+ import {
8
+ DYNAMIC_CONFIG_CLIENT_NAME,
9
+ DYNAMIC_CONFIG_CLIENT_SERVICE_NAME,
10
+ DYNAMIC_CONFIG_OPTIONS_KEY,
11
+ DYNAMIC_CONFIG_SERVICE_KEY,
12
+ } from '../constants/dynamic-config-client-key.constants';
13
+ // Type
14
+ import { DynamicConfigModuleOption } from '../types/dynamic-config.type';
15
+ import {
16
+ DYNAMIC_CONFIG_SERVICE_NAME,
17
+ DynamicConfigServiceClient,
18
+ } from '../../types/paybuy-config';
19
+
20
+ export function createAsyncOptionsProvider(
21
+ options: ConfigurableModuleAsyncOptions<DynamicConfigModuleOption>,
22
+ ): Provider {
23
+ if (options.useFactory) {
24
+ return {
25
+ provide: DYNAMIC_CONFIG_OPTIONS_KEY,
26
+ useFactory: options.useFactory,
27
+ inject: options.inject,
28
+ };
29
+ }
30
+
31
+ return {
32
+ provide: DYNAMIC_CONFIG_OPTIONS_KEY,
33
+ useValue: {},
34
+ };
35
+ }
36
+
37
+ export function CreateDynamicConfigServiceProvider(): Provider[] {
38
+ return [
39
+ {
40
+ provide: DYNAMIC_CONFIG_SERVICE_KEY,
41
+ useClass: DynamicConfigCacheService,
42
+ },
43
+ {
44
+ provide: DYNAMIC_CONFIG_CLIENT_SERVICE_NAME,
45
+ useFactory: (client: ClientGrpc): DynamicConfigServiceClient => {
46
+ return client.getService<DynamicConfigServiceClient>(
47
+ DYNAMIC_CONFIG_SERVICE_NAME,
48
+ );
49
+ },
50
+ inject: [DYNAMIC_CONFIG_CLIENT_NAME],
51
+ },
52
+ ];
53
+ }
@@ -0,0 +1,64 @@
1
+ /* Import */
2
+ import { Inject, Injectable } from '@nestjs/common';
3
+ import { Observable } from 'rxjs';
4
+ // Constant
5
+ import { DYNAMIC_CONFIG_CLIENT_SERVICE_NAME } from '../constants/dynamic-config-client-key.constants';
6
+ // Type
7
+ import { DynamicConfigServiceClient } from '../../types/paybuy-config';
8
+ import {
9
+ DeleteEntityById,
10
+ FindEntityById,
11
+ FindEntityPagination,
12
+ } from '../../types/crud_request';
13
+ import {
14
+ CreateDynamicConfigRequest,
15
+ DynamicConfig,
16
+ DynamicConfigPaginationResponse,
17
+ GetRawDynamicConfigRequest,
18
+ GetRawDynamicConfigResponse,
19
+ UpdateDynamicConfigRequest,
20
+ } from '../../types/dynamic-config/dynamic-config';
21
+ import {
22
+ HealthCheckEmpty,
23
+ HealthCheckResponse,
24
+ } from '../../types/paybuy-health-check';
25
+
26
+ @Injectable()
27
+ export class DynamicConfigCacheService implements DynamicConfigServiceClient {
28
+ constructor(
29
+ @Inject(DYNAMIC_CONFIG_CLIENT_SERVICE_NAME)
30
+ private readonly clientService: DynamicConfigServiceClient,
31
+ ) {}
32
+
33
+ findPaginate(
34
+ request: FindEntityPagination,
35
+ ): Observable<DynamicConfigPaginationResponse> {
36
+ return this.clientService.findPaginate(request);
37
+ }
38
+
39
+ findById(request: FindEntityById): Observable<DynamicConfig> {
40
+ return this.clientService.findById(request);
41
+ }
42
+
43
+ getRaw(
44
+ request: GetRawDynamicConfigRequest,
45
+ ): Observable<GetRawDynamicConfigResponse> {
46
+ return this.clientService.getRaw(request);
47
+ }
48
+
49
+ create(request: CreateDynamicConfigRequest): Observable<DynamicConfig> {
50
+ return this.clientService.create(request);
51
+ }
52
+
53
+ update(request: UpdateDynamicConfigRequest): Observable<DynamicConfig> {
54
+ return this.clientService.update(request);
55
+ }
56
+
57
+ delete(request: DeleteEntityById): Observable<DynamicConfig> {
58
+ return this.clientService.delete(request);
59
+ }
60
+
61
+ healthCheck(request: HealthCheckEmpty): Observable<HealthCheckResponse> {
62
+ return this.clientService.healthCheck(request);
63
+ }
64
+ }
@@ -0,0 +1 @@
1
+ export type DynamicConfigModuleOption = { url: string };
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './decorator';
2
+ export * from './dynamic-config';
@@ -0,0 +1,24 @@
1
+ /* eslint-disable */
2
+ import { FilterOption } from './filter_option';
3
+ import { Owner } from './owner';
4
+
5
+ export const protobufPackage = 'paybuy.common';
6
+
7
+ export interface FindEntityPagination {
8
+ limit?: number | undefined;
9
+ page?: number | undefined;
10
+ sortBy: string[];
11
+ filter: FilterOption[];
12
+ search: FilterOption[];
13
+ }
14
+
15
+ export interface FindEntityById {
16
+ id: string;
17
+ }
18
+
19
+ export interface DeleteEntityById {
20
+ id: string;
21
+ deletedBy: Owner | undefined;
22
+ }
23
+
24
+ export const PAYBUY_COMMON_PACKAGE_NAME = 'paybuy.common';
@@ -0,0 +1,54 @@
1
+ /* eslint-disable */
2
+ import { Owner } from '../owner';
3
+
4
+ export const protobufPackage = 'paybuy.config.dynamicConfig';
5
+
6
+ export interface DynamicConfig {
7
+ id: string;
8
+ owner: Owner | undefined;
9
+ createdAt: string;
10
+ updatedAt: string;
11
+ deletedAt: string;
12
+ updatedBy: Owner | undefined;
13
+ deletedBy: Owner | undefined;
14
+ isDeleted: boolean;
15
+ type: string;
16
+ key: string;
17
+ value: string;
18
+ }
19
+
20
+ export interface DynamicConfigPaginationResponse {
21
+ limit: number;
22
+ page: number;
23
+ sortBy: string[];
24
+ items: DynamicConfig[];
25
+ itemCount: number;
26
+ pageCount?: number | undefined;
27
+ }
28
+
29
+ export interface GetRawDynamicConfigRequest {
30
+ key: string;
31
+ type: string;
32
+ }
33
+
34
+ export interface GetRawDynamicConfigResponse {
35
+ result: string;
36
+ }
37
+
38
+ export interface CreateDynamicConfigRequest {
39
+ owner: Owner | undefined;
40
+ type: string;
41
+ key: string;
42
+ value: string;
43
+ }
44
+
45
+ export interface UpdateDynamicConfigRequest {
46
+ id: string;
47
+ type?: string | undefined;
48
+ key?: string | undefined;
49
+ value?: string | undefined;
50
+ updatedBy: Owner | undefined;
51
+ }
52
+
53
+ export const PAYBUY_CONFIG_DYNAMIC_CONFIG_PACKAGE_NAME =
54
+ 'paybuy.config.dynamicConfig';
@@ -0,0 +1,35 @@
1
+ /* eslint-disable */
2
+
3
+ export const protobufPackage = 'paybuy.common';
4
+
5
+ export enum FilterOperation {
6
+ FILTER_OPERATION_IN = 'FILTER_OPERATION_IN',
7
+ FILTER_OPERATION_NOT_IN = 'FILTER_OPERATION_NOT_IN',
8
+ FILTER_OPERATION_BETWEEN = 'FILTER_OPERATION_BETWEEN',
9
+ FILTER_OPERATION_NOT_BETWEEN = 'FILTER_OPERATION_NOT_BETWEEN',
10
+ FILTER_OPERATION_EQ = 'FILTER_OPERATION_EQ',
11
+ FILTER_OPERATION_GT = 'FILTER_OPERATION_GT',
12
+ FILTER_OPERATION_GTE = 'FILTER_OPERATION_GTE',
13
+ FILTER_OPERATION_LT = 'FILTER_OPERATION_LT',
14
+ FILTER_OPERATION_LTE = 'FILTER_OPERATION_LTE',
15
+ FILTER_OPERATION_NE = 'FILTER_OPERATION_NE',
16
+ FILTER_OPERATION_LIKE = 'FILTER_OPERATION_LIKE',
17
+ FILTER_OPERATION_ILIKE = 'FILTER_OPERATION_ILIKE',
18
+ FILTER_OPERATION_IREGEXP = 'FILTER_OPERATION_IREGEXP',
19
+ FILTER_OPERATION_NOT_ILIKE = 'FILTER_OPERATION_NOT_ILIKE',
20
+ FILTER_OPERATION_NOT_IREGEXP = 'FILTER_OPERATION_NOT_IREGEXP',
21
+ FILTER_OPERATION_NOT_LIKE = 'FILTER_OPERATION_NOT_LIKE',
22
+ FILTER_OPERATION_REGEXP = 'FILTER_OPERATION_REGEXP',
23
+ FILTER_OPERATION_NOT_REGEXP = 'FILTER_OPERATION_NOT_REGEXP',
24
+ FILTER_OPERATION_IS = 'FILTER_OPERATION_IS',
25
+ FILTER_OPERATION_NOT = 'FILTER_OPERATION_NOT',
26
+ FILTER_OPERATION_ELM_MTC = 'FILTER_OPERATION_ELM_MTC',
27
+ }
28
+
29
+ export interface FilterOption {
30
+ field: string;
31
+ operation: FilterOperation;
32
+ value: string;
33
+ }
34
+
35
+ export const PAYBUY_COMMON_PACKAGE_NAME = 'paybuy.common';
@@ -0,0 +1,123 @@
1
+ /* eslint-disable */
2
+
3
+ export const protobufPackage = 'google.protobuf';
4
+
5
+ /**
6
+ * `Any` contains an arbitrary serialized protocol buffer message along with a
7
+ * URL that describes the type of the serialized message.
8
+ *
9
+ * Protobuf library provides support to pack/unpack Any values in the form
10
+ * of utility functions or additional generated methods of the Any type.
11
+ *
12
+ * Example 1: Pack and unpack a message in C++.
13
+ *
14
+ * Foo foo = ...;
15
+ * Any any;
16
+ * any.PackFrom(foo);
17
+ * ...
18
+ * if (any.UnpackTo(&foo)) {
19
+ * ...
20
+ * }
21
+ *
22
+ * Example 2: Pack and unpack a message in Java.
23
+ *
24
+ * Foo foo = ...;
25
+ * Any any = Any.pack(foo);
26
+ * ...
27
+ * if (any.is(Foo.class)) {
28
+ * foo = any.unpack(Foo.class);
29
+ * }
30
+ *
31
+ * Example 3: Pack and unpack a message in Python.
32
+ *
33
+ * foo = Foo(...)
34
+ * any = Any()
35
+ * any.Pack(foo)
36
+ * ...
37
+ * if any.Is(Foo.DESCRIPTOR):
38
+ * any.Unpack(foo)
39
+ * ...
40
+ *
41
+ * Example 4: Pack and unpack a message in Go
42
+ *
43
+ * foo := &pb.Foo{...}
44
+ * any, err := anypb.New(foo)
45
+ * if err != nil {
46
+ * ...
47
+ * }
48
+ * ...
49
+ * foo := &pb.Foo{}
50
+ * if err := any.UnmarshalTo(foo); err != nil {
51
+ * ...
52
+ * }
53
+ *
54
+ * The pack methods provided by protobuf library will by default use
55
+ * 'type.googleapis.com/full.type.name' as the type URL and the unpack
56
+ * methods only use the fully qualified type name after the last '/'
57
+ * in the type URL, for example "foo.bar.com/x/y.z" will yield type
58
+ * name "y.z".
59
+ *
60
+ * JSON
61
+ *
62
+ * The JSON representation of an `Any` value uses the regular
63
+ * representation of the deserialized, embedded message, with an
64
+ * additional field `@type` which contains the type URL. Example:
65
+ *
66
+ * package google.profile;
67
+ * message Person {
68
+ * string first_name = 1;
69
+ * string last_name = 2;
70
+ * }
71
+ *
72
+ * {
73
+ * "@type": "type.googleapis.com/google.profile.Person",
74
+ * "firstName": <string>,
75
+ * "lastName": <string>
76
+ * }
77
+ *
78
+ * If the embedded message type is well-known and has a custom JSON
79
+ * representation, that representation will be embedded adding a field
80
+ * `value` which holds the custom JSON in addition to the `@type`
81
+ * field. Example (for message [google.protobuf.Duration][]):
82
+ *
83
+ * {
84
+ * "@type": "type.googleapis.com/google.protobuf.Duration",
85
+ * "value": "1.212s"
86
+ * }
87
+ */
88
+ export interface Any {
89
+ /**
90
+ * A URL/resource name that uniquely identifies the type of the serialized
91
+ * protocol buffer message. This string must contain at least
92
+ * one "/" character. The last segment of the URL's path must represent
93
+ * the fully qualified name of the type (as in
94
+ * `path/google.protobuf.Duration`). The name should be in a canonical form
95
+ * (e.g., leading "." is not accepted).
96
+ *
97
+ * In practice, teams usually precompile into the binary all types that they
98
+ * expect it to use in the context of Any. However, for URLs which use the
99
+ * scheme `http`, `https`, or no scheme, one can optionally set up a type
100
+ * server that maps type URLs to message definitions as follows:
101
+ *
102
+ * * If no scheme is provided, `https` is assumed.
103
+ * * An HTTP GET on the URL must yield a [google.protobuf.Type][]
104
+ * value in binary format, or produce an error.
105
+ * * Applications are allowed to cache lookup results based on the
106
+ * URL, or have them precompiled into a binary to avoid any
107
+ * lookup. Therefore, binary compatibility needs to be preserved
108
+ * on changes to types. (Use versioned type names to manage
109
+ * breaking changes.)
110
+ *
111
+ * Note: this functionality is not currently available in the official
112
+ * protobuf release, and it is not used for type URLs beginning with
113
+ * type.googleapis.com.
114
+ *
115
+ * Schemes other than `http`, `https` (or the empty scheme) might be
116
+ * used with implementation specific semantics.
117
+ */
118
+ typeUrl: string;
119
+ /** Must be a valid serialized protocol buffer of the above specified type. */
120
+ value: Uint8Array;
121
+ }
122
+
123
+ export const GOOGLE_PROTOBUF_PACKAGE_NAME = 'google.protobuf';
@@ -0,0 +1,70 @@
1
+ /* eslint-disable */
2
+
3
+ export const protobufPackage = 'google.protobuf';
4
+
5
+ /**
6
+ * `NullValue` is a singleton enumeration to represent the null value for the
7
+ * `Value` type union.
8
+ *
9
+ * The JSON representation for `NullValue` is JSON `null`.
10
+ */
11
+ export enum NullValue {
12
+ /** NULL_VALUE - Null value. */
13
+ NULL_VALUE = 'NULL_VALUE',
14
+ UNRECOGNIZED = 'UNRECOGNIZED',
15
+ }
16
+
17
+ /**
18
+ * `Struct` represents a structured data value, consisting of fields
19
+ * which map to dynamically typed values. In some languages, `Struct`
20
+ * might be supported by a native representation. For example, in
21
+ * scripting languages like JS a struct is represented as an
22
+ * object. The details of that representation are described together
23
+ * with the proto support for the language.
24
+ *
25
+ * The JSON representation for `Struct` is JSON object.
26
+ */
27
+ export interface Struct {
28
+ /** Unordered map of dynamically typed values. */
29
+ fields: { [key: string]: any | undefined };
30
+ }
31
+
32
+ export interface Struct_FieldsEntry {
33
+ key: string;
34
+ value: any | undefined;
35
+ }
36
+
37
+ /**
38
+ * `Value` represents a dynamically typed value which can be either
39
+ * null, a number, a string, a boolean, a recursive struct value, or a
40
+ * list of values. A producer of value is expected to set one of these
41
+ * variants. Absence of any variant indicates an error.
42
+ *
43
+ * The JSON representation for `Value` is JSON value.
44
+ */
45
+ export interface Value {
46
+ /** Represents a null value. */
47
+ nullValue?: NullValue | undefined;
48
+ /** Represents a double value. */
49
+ numberValue?: number | undefined;
50
+ /** Represents a string value. */
51
+ stringValue?: string | undefined;
52
+ /** Represents a boolean value. */
53
+ boolValue?: boolean | undefined;
54
+ /** Represents a structured value. */
55
+ structValue?: { [key: string]: any } | undefined;
56
+ /** Represents a repeated `Value`. */
57
+ listValue?: Array<any> | undefined;
58
+ }
59
+
60
+ /**
61
+ * `ListValue` is a wrapper around a repeated field of values.
62
+ *
63
+ * The JSON representation for `ListValue` is JSON array.
64
+ */
65
+ export interface ListValue {
66
+ /** Repeated field of dynamically typed values. */
67
+ values: any[];
68
+ }
69
+
70
+ export const GOOGLE_PROTOBUF_PACKAGE_NAME = 'google.protobuf';
@@ -0,0 +1,9 @@
1
+ /* eslint-disable */
2
+
3
+ export const protobufPackage = 'paybuy.common';
4
+
5
+ export interface Owner {
6
+ id: string;
7
+ }
8
+
9
+ export const PAYBUY_COMMON_PACKAGE_NAME = 'paybuy.common';
@@ -0,0 +1,119 @@
1
+ /* eslint-disable */
2
+ import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices';
3
+ import { Observable } from 'rxjs';
4
+ import {
5
+ DeleteEntityById,
6
+ FindEntityById,
7
+ FindEntityPagination,
8
+ } from './crud_request';
9
+ import {
10
+ CreateDynamicConfigRequest,
11
+ DynamicConfig,
12
+ DynamicConfigPaginationResponse,
13
+ GetRawDynamicConfigRequest,
14
+ GetRawDynamicConfigResponse,
15
+ UpdateDynamicConfigRequest,
16
+ } from './dynamic-config/dynamic-config';
17
+ import { HealthCheckEmpty, HealthCheckResponse } from './paybuy-health-check';
18
+
19
+ export const protobufPackage = 'paybuy.config';
20
+
21
+ export const PAYBUY_CONFIG_PACKAGE_NAME = 'paybuy.config';
22
+
23
+ export interface DynamicConfigServiceClient {
24
+ findPaginate(
25
+ request: FindEntityPagination,
26
+ ): Observable<DynamicConfigPaginationResponse>;
27
+
28
+ findById(request: FindEntityById): Observable<DynamicConfig>;
29
+
30
+ getRaw(
31
+ request: GetRawDynamicConfigRequest,
32
+ ): Observable<GetRawDynamicConfigResponse>;
33
+
34
+ create(request: CreateDynamicConfigRequest): Observable<DynamicConfig>;
35
+
36
+ delete(request: DeleteEntityById): Observable<DynamicConfig>;
37
+
38
+ update(request: UpdateDynamicConfigRequest): Observable<DynamicConfig>;
39
+
40
+ healthCheck(request: HealthCheckEmpty): Observable<HealthCheckResponse>;
41
+ }
42
+
43
+ export interface DynamicConfigServiceController {
44
+ findPaginate(
45
+ request: FindEntityPagination,
46
+ ):
47
+ | Promise<DynamicConfigPaginationResponse>
48
+ | Observable<DynamicConfigPaginationResponse>
49
+ | DynamicConfigPaginationResponse;
50
+
51
+ findById(
52
+ request: FindEntityById,
53
+ ): Promise<DynamicConfig> | Observable<DynamicConfig> | DynamicConfig;
54
+
55
+ getRaw(
56
+ request: GetRawDynamicConfigRequest,
57
+ ):
58
+ | Promise<GetRawDynamicConfigResponse>
59
+ | Observable<GetRawDynamicConfigResponse>
60
+ | GetRawDynamicConfigResponse;
61
+
62
+ create(
63
+ request: CreateDynamicConfigRequest,
64
+ ): Promise<DynamicConfig> | Observable<DynamicConfig> | DynamicConfig;
65
+
66
+ delete(
67
+ request: DeleteEntityById,
68
+ ): Promise<DynamicConfig> | Observable<DynamicConfig> | DynamicConfig;
69
+
70
+ update(
71
+ request: UpdateDynamicConfigRequest,
72
+ ): Promise<DynamicConfig> | Observable<DynamicConfig> | DynamicConfig;
73
+
74
+ healthCheck(
75
+ request: HealthCheckEmpty,
76
+ ):
77
+ | Promise<HealthCheckResponse>
78
+ | Observable<HealthCheckResponse>
79
+ | HealthCheckResponse;
80
+ }
81
+
82
+ export function DynamicConfigServiceControllerMethods() {
83
+ return function (constructor: Function) {
84
+ const grpcMethods: string[] = [
85
+ 'findPaginate',
86
+ 'findById',
87
+ 'getRaw',
88
+ 'create',
89
+ 'delete',
90
+ 'update',
91
+ 'healthCheck',
92
+ ];
93
+ for (const method of grpcMethods) {
94
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(
95
+ constructor.prototype,
96
+ method,
97
+ );
98
+ GrpcMethod('DynamicConfigService', method)(
99
+ constructor.prototype[method],
100
+ method,
101
+ descriptor,
102
+ );
103
+ }
104
+ const grpcStreamMethods: string[] = [];
105
+ for (const method of grpcStreamMethods) {
106
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(
107
+ constructor.prototype,
108
+ method,
109
+ );
110
+ GrpcStreamMethod('DynamicConfigService', method)(
111
+ constructor.prototype[method],
112
+ method,
113
+ descriptor,
114
+ );
115
+ }
116
+ };
117
+ }
118
+
119
+ export const DYNAMIC_CONFIG_SERVICE_NAME = 'DynamicConfigService';
@@ -0,0 +1,22 @@
1
+ /* eslint-disable */
2
+
3
+ export const protobufPackage = 'paybuy.healthCheck';
4
+
5
+ /** Enums */
6
+ export enum HealthCheckStatus {
7
+ HEALTH_CHECK_STATUS_ERROR = 'HEALTH_CHECK_STATUS_ERROR',
8
+ HEALTH_CHECK_STATUS_OK = 'HEALTH_CHECK_STATUS_OK',
9
+ HEALTH_CHECK_STATUS_SHUTTING_DOWN = 'HEALTH_CHECK_STATUS_SHUTTING_DOWN',
10
+ }
11
+
12
+ /** HealthCheck */
13
+ export interface HealthCheckResponse {
14
+ status: HealthCheckStatus;
15
+ info: string;
16
+ error: string;
17
+ details: string;
18
+ }
19
+
20
+ export interface HealthCheckEmpty {}
21
+
22
+ export const PAYBUY_HEALTH_CHECK_PACKAGE_NAME = 'paybuy.healthCheck';