@acequants/aegis-contracts 0.1.57 → 0.1.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/gen/service_sync/v1/service_sync.d.ts +88 -0
- package/dist/src/gen/service_sync/v1/service_sync.d.ts.map +1 -0
- package/dist/src/gen/service_sync/v1/service_sync.js +149 -0
- package/package.json +1 -1
- package/proto/auth/v1/auth.proto +8 -1
- package/proto/service_sync/v1/service_sync.proto +69 -0
- package/proto/system/v1/system.proto +2 -2
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { handleUnaryCall, UntypedServiceImplementation } from "@grpc/grpc-js";
|
|
2
|
+
import _m0 from "protobufjs/minimal";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
export declare const protobufPackage = "aegis.service_sync.v1";
|
|
5
|
+
/**
|
|
6
|
+
* Single request — "give me these N rows of this resource".
|
|
7
|
+
*
|
|
8
|
+
* `resource` → the namespace registered by the publisher (e.g. "user",
|
|
9
|
+
* "role", "invoice"). Must match a `defineSyncSource.name`.
|
|
10
|
+
* `keys` → opaque string keys (typically publicId / cuid). The publisher
|
|
11
|
+
* decides what "key" means via `defineSyncSource.keyOf`.
|
|
12
|
+
*
|
|
13
|
+
* Limits — the consumer batches per-request, so 100–1000 keys per call is
|
|
14
|
+
* the expected shape. Above ~5000, split into chunks at the consumer.
|
|
15
|
+
*/
|
|
16
|
+
export interface ServiceSyncFetchRequest {
|
|
17
|
+
resource: string;
|
|
18
|
+
keys: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Single response — "here are the rows I found".
|
|
22
|
+
*
|
|
23
|
+
* Missing keys are simply absent from `rows`. Consumers map by key and
|
|
24
|
+
* surface `null` for any key not returned (e.g. soft-deleted upstream).
|
|
25
|
+
*/
|
|
26
|
+
export interface ServiceSyncFetchResponse {
|
|
27
|
+
rows: ServiceSyncFetchRow[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* One row of result data.
|
|
31
|
+
*
|
|
32
|
+
* `payload_json` is a UTF-8 JSON string of the publisher's projection for
|
|
33
|
+
* this resource. The consumer parses it into a typed `T` at the boundary.
|
|
34
|
+
* Keep the projection LEAN — only the display fields the consumer needs.
|
|
35
|
+
*/
|
|
36
|
+
export interface ServiceSyncFetchRow {
|
|
37
|
+
key: string;
|
|
38
|
+
payloadJson: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const AEGIS_SERVICE_SYNC_V1_PACKAGE_NAME = "aegis.service_sync.v1";
|
|
41
|
+
export declare const ServiceSyncFetchRequest: {
|
|
42
|
+
encode(message: ServiceSyncFetchRequest, writer?: _m0.Writer): _m0.Writer;
|
|
43
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): ServiceSyncFetchRequest;
|
|
44
|
+
};
|
|
45
|
+
export declare const ServiceSyncFetchResponse: {
|
|
46
|
+
encode(message: ServiceSyncFetchResponse, writer?: _m0.Writer): _m0.Writer;
|
|
47
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): ServiceSyncFetchResponse;
|
|
48
|
+
};
|
|
49
|
+
export declare const ServiceSyncFetchRow: {
|
|
50
|
+
encode(message: ServiceSyncFetchRow, writer?: _m0.Writer): _m0.Writer;
|
|
51
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): ServiceSyncFetchRow;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* The only service. Add new resources by registering them on each side, not
|
|
55
|
+
* by editing this proto.
|
|
56
|
+
*/
|
|
57
|
+
export interface ServiceSyncClient {
|
|
58
|
+
fetch(request: ServiceSyncFetchRequest): Observable<ServiceSyncFetchResponse>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The only service. Add new resources by registering them on each side, not
|
|
62
|
+
* by editing this proto.
|
|
63
|
+
*/
|
|
64
|
+
export interface ServiceSyncController {
|
|
65
|
+
fetch(request: ServiceSyncFetchRequest): Promise<ServiceSyncFetchResponse> | Observable<ServiceSyncFetchResponse> | ServiceSyncFetchResponse;
|
|
66
|
+
}
|
|
67
|
+
export declare function ServiceSyncControllerMethods(): (constructor: Function) => void;
|
|
68
|
+
export declare const SERVICE_SYNC_SERVICE_NAME = "ServiceSync";
|
|
69
|
+
/**
|
|
70
|
+
* The only service. Add new resources by registering them on each side, not
|
|
71
|
+
* by editing this proto.
|
|
72
|
+
*/
|
|
73
|
+
export type ServiceSyncService = typeof ServiceSyncService;
|
|
74
|
+
export declare const ServiceSyncService: {
|
|
75
|
+
readonly fetch: {
|
|
76
|
+
readonly path: "/aegis.service_sync.v1.ServiceSync/Fetch";
|
|
77
|
+
readonly requestStream: false;
|
|
78
|
+
readonly responseStream: false;
|
|
79
|
+
readonly requestSerialize: (value: ServiceSyncFetchRequest) => Buffer<ArrayBuffer>;
|
|
80
|
+
readonly requestDeserialize: (value: Buffer) => ServiceSyncFetchRequest;
|
|
81
|
+
readonly responseSerialize: (value: ServiceSyncFetchResponse) => Buffer<ArrayBuffer>;
|
|
82
|
+
readonly responseDeserialize: (value: Buffer) => ServiceSyncFetchResponse;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export interface ServiceSyncServer extends UntypedServiceImplementation {
|
|
86
|
+
fetch: handleUnaryCall<ServiceSyncFetchRequest, ServiceSyncFetchResponse>;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=service_sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service_sync.d.ts","sourceRoot":"","sources":["../../../../../src/gen/service_sync/v1/service_sync.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAEnF,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,eAAO,MAAM,eAAe,0BAA0B,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,uBAAuB;IACt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kBAAkB,GAAG,OAAO,kBAAkB,CAAC;AAC3D,eAAO,MAAM,kBAAkB;;;;;2CAKD,uBAAuB;6CACrB,MAAM;4CACP,wBAAwB;8CAEtB,MAAM;;CAE7B,CAAC;AAEX,MAAM,WAAW,iBAAkB,SAAQ,4BAA4B;IACrE,KAAK,EAAE,eAAe,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,CAAC;CAC3E"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v1.181.2
|
|
4
|
+
// protoc v6.32.0
|
|
5
|
+
// source: service_sync/v1/service_sync.proto
|
|
6
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
7
|
+
import _m0 from "protobufjs/minimal";
|
|
8
|
+
export const protobufPackage = "aegis.service_sync.v1";
|
|
9
|
+
export const AEGIS_SERVICE_SYNC_V1_PACKAGE_NAME = "aegis.service_sync.v1";
|
|
10
|
+
function createBaseServiceSyncFetchRequest() {
|
|
11
|
+
return { resource: "", keys: [] };
|
|
12
|
+
}
|
|
13
|
+
export const ServiceSyncFetchRequest = {
|
|
14
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
15
|
+
if (message.resource !== "") {
|
|
16
|
+
writer.uint32(10).string(message.resource);
|
|
17
|
+
}
|
|
18
|
+
for (const v of message.keys) {
|
|
19
|
+
writer.uint32(18).string(v);
|
|
20
|
+
}
|
|
21
|
+
return writer;
|
|
22
|
+
},
|
|
23
|
+
decode(input, length) {
|
|
24
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
25
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
26
|
+
const message = createBaseServiceSyncFetchRequest();
|
|
27
|
+
while (reader.pos < end) {
|
|
28
|
+
const tag = reader.uint32();
|
|
29
|
+
switch (tag >>> 3) {
|
|
30
|
+
case 1:
|
|
31
|
+
if (tag !== 10) {
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
message.resource = reader.string();
|
|
35
|
+
continue;
|
|
36
|
+
case 2:
|
|
37
|
+
if (tag !== 18) {
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
message.keys.push(reader.string());
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
reader.skipType(tag & 7);
|
|
47
|
+
}
|
|
48
|
+
return message;
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
function createBaseServiceSyncFetchResponse() {
|
|
52
|
+
return { rows: [] };
|
|
53
|
+
}
|
|
54
|
+
export const ServiceSyncFetchResponse = {
|
|
55
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
56
|
+
for (const v of message.rows) {
|
|
57
|
+
ServiceSyncFetchRow.encode(v, writer.uint32(10).fork()).ldelim();
|
|
58
|
+
}
|
|
59
|
+
return writer;
|
|
60
|
+
},
|
|
61
|
+
decode(input, length) {
|
|
62
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
63
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
64
|
+
const message = createBaseServiceSyncFetchResponse();
|
|
65
|
+
while (reader.pos < end) {
|
|
66
|
+
const tag = reader.uint32();
|
|
67
|
+
switch (tag >>> 3) {
|
|
68
|
+
case 1:
|
|
69
|
+
if (tag !== 10) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
message.rows.push(ServiceSyncFetchRow.decode(reader, reader.uint32()));
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
reader.skipType(tag & 7);
|
|
79
|
+
}
|
|
80
|
+
return message;
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
function createBaseServiceSyncFetchRow() {
|
|
84
|
+
return { key: "", payloadJson: "" };
|
|
85
|
+
}
|
|
86
|
+
export const ServiceSyncFetchRow = {
|
|
87
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
88
|
+
if (message.key !== "") {
|
|
89
|
+
writer.uint32(10).string(message.key);
|
|
90
|
+
}
|
|
91
|
+
if (message.payloadJson !== "") {
|
|
92
|
+
writer.uint32(18).string(message.payloadJson);
|
|
93
|
+
}
|
|
94
|
+
return writer;
|
|
95
|
+
},
|
|
96
|
+
decode(input, length) {
|
|
97
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
98
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
99
|
+
const message = createBaseServiceSyncFetchRow();
|
|
100
|
+
while (reader.pos < end) {
|
|
101
|
+
const tag = reader.uint32();
|
|
102
|
+
switch (tag >>> 3) {
|
|
103
|
+
case 1:
|
|
104
|
+
if (tag !== 10) {
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
message.key = reader.string();
|
|
108
|
+
continue;
|
|
109
|
+
case 2:
|
|
110
|
+
if (tag !== 18) {
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
message.payloadJson = reader.string();
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
reader.skipType(tag & 7);
|
|
120
|
+
}
|
|
121
|
+
return message;
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
export function ServiceSyncControllerMethods() {
|
|
125
|
+
return function (constructor) {
|
|
126
|
+
const grpcMethods = ["fetch"];
|
|
127
|
+
for (const method of grpcMethods) {
|
|
128
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
129
|
+
GrpcMethod("ServiceSync", method)(constructor.prototype[method], method, descriptor);
|
|
130
|
+
}
|
|
131
|
+
const grpcStreamMethods = [];
|
|
132
|
+
for (const method of grpcStreamMethods) {
|
|
133
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
134
|
+
GrpcStreamMethod("ServiceSync", method)(constructor.prototype[method], method, descriptor);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export const SERVICE_SYNC_SERVICE_NAME = "ServiceSync";
|
|
139
|
+
export const ServiceSyncService = {
|
|
140
|
+
fetch: {
|
|
141
|
+
path: "/aegis.service_sync.v1.ServiceSync/Fetch",
|
|
142
|
+
requestStream: false,
|
|
143
|
+
responseStream: false,
|
|
144
|
+
requestSerialize: (value) => Buffer.from(ServiceSyncFetchRequest.encode(value).finish()),
|
|
145
|
+
requestDeserialize: (value) => ServiceSyncFetchRequest.decode(value),
|
|
146
|
+
responseSerialize: (value) => Buffer.from(ServiceSyncFetchResponse.encode(value).finish()),
|
|
147
|
+
responseDeserialize: (value) => ServiceSyncFetchResponse.decode(value),
|
|
148
|
+
},
|
|
149
|
+
};
|
package/package.json
CHANGED
package/proto/auth/v1/auth.proto
CHANGED
|
@@ -5,7 +5,14 @@ package aegis.auth.v1;
|
|
|
5
5
|
option java_multiple_files = true;
|
|
6
6
|
|
|
7
7
|
import "google/protobuf/timestamp.proto";
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
// -------------------------------------
|
|
10
|
+
// USER INTERSERVICE SYNC (AEGIS-GTMS)
|
|
11
|
+
// -------------------------------------
|
|
12
|
+
|
|
13
|
+
// -------------------------------------
|
|
14
|
+
// USER INTERSERVICE SYNC (AEGIS-GTMS)
|
|
15
|
+
// -------------------------------------
|
|
9
16
|
|
|
10
17
|
message GrpcDtoMessage {
|
|
11
18
|
string message = 1;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package aegis.service_sync.v1;
|
|
4
|
+
|
|
5
|
+
option java_multiple_files = true;
|
|
6
|
+
|
|
7
|
+
// =============================================================================
|
|
8
|
+
// service-sync — generic cross-service entity hydration contract
|
|
9
|
+
// -----------------------------------------------------------------------------
|
|
10
|
+
// One RPC, forever. To expose a NEW entity (User, Role, Invoice, anything) you
|
|
11
|
+
// do NOT edit this file. You register a SyncSource on the publisher side
|
|
12
|
+
// (aegis/src/common/service-sync) and a SyncResource on the consumer side
|
|
13
|
+
// (gtms/src/shared/v1/service-sync). The wire envelope here stays unchanged.
|
|
14
|
+
//
|
|
15
|
+
// The payload is intentionally `string payload_json` (not a typed `Any` or
|
|
16
|
+
// per-resource message). That trade-off is deliberate:
|
|
17
|
+
//
|
|
18
|
+
// PROS
|
|
19
|
+
// • Zero proto churn when onboarding new resources.
|
|
20
|
+
// • Publisher controls projection at the source — the wire just transports
|
|
21
|
+
// what `defineSyncSource.fetch()` returns.
|
|
22
|
+
// • Consumer regains end-to-end type safety via
|
|
23
|
+
// `defineSyncResource<T>()` — the generic <T> describes what JSON to
|
|
24
|
+
// expect, and is enforced at every consumer call-site.
|
|
25
|
+
//
|
|
26
|
+
// CONS / DO NOT
|
|
27
|
+
// • DO NOT put binary blobs in `payload_json` — base64 inflates payloads.
|
|
28
|
+
// • DO NOT use this contract for streaming or pub/sub. It is a request /
|
|
29
|
+
// response read path for batched hydration. Anything else belongs in
|
|
30
|
+
// a domain-specific RPC.
|
|
31
|
+
// =============================================================================
|
|
32
|
+
|
|
33
|
+
// Single request — "give me these N rows of this resource".
|
|
34
|
+
//
|
|
35
|
+
// `resource` → the namespace registered by the publisher (e.g. "user",
|
|
36
|
+
// "role", "invoice"). Must match a `defineSyncSource.name`.
|
|
37
|
+
// `keys` → opaque string keys (typically publicId / cuid). The publisher
|
|
38
|
+
// decides what "key" means via `defineSyncSource.keyOf`.
|
|
39
|
+
//
|
|
40
|
+
// Limits — the consumer batches per-request, so 100–1000 keys per call is
|
|
41
|
+
// the expected shape. Above ~5000, split into chunks at the consumer.
|
|
42
|
+
message ServiceSyncFetchRequest {
|
|
43
|
+
string resource = 1;
|
|
44
|
+
repeated string keys = 2;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Single response — "here are the rows I found".
|
|
48
|
+
//
|
|
49
|
+
// Missing keys are simply absent from `rows`. Consumers map by key and
|
|
50
|
+
// surface `null` for any key not returned (e.g. soft-deleted upstream).
|
|
51
|
+
message ServiceSyncFetchResponse {
|
|
52
|
+
repeated ServiceSyncFetchRow rows = 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// One row of result data.
|
|
56
|
+
//
|
|
57
|
+
// `payload_json` is a UTF-8 JSON string of the publisher's projection for
|
|
58
|
+
// this resource. The consumer parses it into a typed `T` at the boundary.
|
|
59
|
+
// Keep the projection LEAN — only the display fields the consumer needs.
|
|
60
|
+
message ServiceSyncFetchRow {
|
|
61
|
+
string key = 1;
|
|
62
|
+
string payload_json = 2;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// The only service. Add new resources by registering them on each side, not
|
|
66
|
+
// by editing this proto.
|
|
67
|
+
service ServiceSync {
|
|
68
|
+
rpc Fetch(ServiceSyncFetchRequest) returns (ServiceSyncFetchResponse);
|
|
69
|
+
}
|
|
@@ -55,8 +55,8 @@ message GrpcDtoGeoCurrency {
|
|
|
55
55
|
|
|
56
56
|
message GrpcDtoGeoLanguage {
|
|
57
57
|
string public_id = 1;
|
|
58
|
-
string
|
|
59
|
-
string
|
|
58
|
+
string iso6391 = 2; // LANGUAGE enum as string
|
|
59
|
+
string iso6392 = 3; // nullable
|
|
60
60
|
string name = 4;
|
|
61
61
|
bool is_active = 5;
|
|
62
62
|
google.protobuf.Timestamp updated_at = 6;
|