@acequants/aegis-contracts 0.1.58 → 0.1.60
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_provisioning/v1/service_provisioning.d.ts +122 -0
- package/dist/src/gen/service_provisioning/v1/service_provisioning.d.ts.map +1 -0
- package/dist/src/gen/service_provisioning/v1/service_provisioning.js +117 -0
- 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_provisioning/v1/service_provisioning.proto +86 -0
- package/proto/service_sync/v1/service_sync.proto +69 -0
|
@@ -0,0 +1,122 @@
|
|
|
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_provisioning.v1";
|
|
5
|
+
/**
|
|
6
|
+
* Single request — "create / upsert this row on the downstream service".
|
|
7
|
+
*
|
|
8
|
+
* `resource` → the namespace registered by the consumer (e.g. "agent").
|
|
9
|
+
* Must match a `defineProvisioningHandler.name` registered
|
|
10
|
+
* via `ServiceProvisioningModule.forFeature([...])`.
|
|
11
|
+
*
|
|
12
|
+
* `idempotency_key` → producer-chosen stable identifier for this logical
|
|
13
|
+
* operation. The consumer is REQUIRED to be idempotent
|
|
14
|
+
* under this key — typically by upserting on a unique
|
|
15
|
+
* column derived from the payload (e.g. `userPublicId`).
|
|
16
|
+
* The producer also uses this as the BullMQ `jobId` so
|
|
17
|
+
* replays at the queue layer are dropped before they
|
|
18
|
+
* reach the wire.
|
|
19
|
+
*
|
|
20
|
+
* `payload_json` → UTF-8 JSON string of the producer's request projection
|
|
21
|
+
* for this resource. The consumer's handler parses it
|
|
22
|
+
* into a typed `T` at the boundary. Keep it LEAN — only
|
|
23
|
+
* the fields the consumer actually needs to perform the
|
|
24
|
+
* write.
|
|
25
|
+
*/
|
|
26
|
+
export interface ServiceProvisioningRequest {
|
|
27
|
+
resource: string;
|
|
28
|
+
idempotencyKey: string;
|
|
29
|
+
payloadJson: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Single response — "I am done; here is whatever the handler chose to ack".
|
|
33
|
+
*
|
|
34
|
+
* `ack_json` is a UTF-8 JSON string. It is OPTIONAL — handlers may return
|
|
35
|
+
* `"{}"` if they have nothing useful to say. Producers MUST NOT depend on a
|
|
36
|
+
* specific shape unless their target definition says so. The success of the
|
|
37
|
+
* RPC itself (no error status) is the primary signal.
|
|
38
|
+
*/
|
|
39
|
+
export interface ServiceProvisioningResponse {
|
|
40
|
+
ackJson: string;
|
|
41
|
+
}
|
|
42
|
+
export declare const AEGIS_SERVICE_PROVISIONING_V1_PACKAGE_NAME = "aegis.service_provisioning.v1";
|
|
43
|
+
export declare const ServiceProvisioningRequest: {
|
|
44
|
+
encode(message: ServiceProvisioningRequest, writer?: _m0.Writer): _m0.Writer;
|
|
45
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): ServiceProvisioningRequest;
|
|
46
|
+
};
|
|
47
|
+
export declare const ServiceProvisioningResponse: {
|
|
48
|
+
encode(message: ServiceProvisioningResponse, writer?: _m0.Writer): _m0.Writer;
|
|
49
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): ServiceProvisioningResponse;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The only service. Add new flows by registering them on each side, not by
|
|
53
|
+
* editing this proto.
|
|
54
|
+
*
|
|
55
|
+
* Error semantics (mapped via @grpc/grpc-js `status` codes):
|
|
56
|
+
*
|
|
57
|
+
* • OK — write committed (or already existed; see ALREADY_EXISTS).
|
|
58
|
+
* • ALREADY_EXISTS — clean duplicate; producer should treat as success.
|
|
59
|
+
* • NOT_FOUND — `resource` is not registered on the consumer.
|
|
60
|
+
* • INVALID_ARGUMENT — `payload_json` failed the handler's `parse(...)`.
|
|
61
|
+
* • UNAUTHENTICATED — internal shared-secret metadata missing or wrong.
|
|
62
|
+
* • INTERNAL — handler threw an unexpected error.
|
|
63
|
+
*
|
|
64
|
+
* Anything other than OK / ALREADY_EXISTS is retryable from the producer's
|
|
65
|
+
* BullMQ processor with exponential backoff.
|
|
66
|
+
*/
|
|
67
|
+
export interface ServiceProvisioningClient {
|
|
68
|
+
provision(request: ServiceProvisioningRequest): Observable<ServiceProvisioningResponse>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The only service. Add new flows by registering them on each side, not by
|
|
72
|
+
* editing this proto.
|
|
73
|
+
*
|
|
74
|
+
* Error semantics (mapped via @grpc/grpc-js `status` codes):
|
|
75
|
+
*
|
|
76
|
+
* • OK — write committed (or already existed; see ALREADY_EXISTS).
|
|
77
|
+
* • ALREADY_EXISTS — clean duplicate; producer should treat as success.
|
|
78
|
+
* • NOT_FOUND — `resource` is not registered on the consumer.
|
|
79
|
+
* • INVALID_ARGUMENT — `payload_json` failed the handler's `parse(...)`.
|
|
80
|
+
* • UNAUTHENTICATED — internal shared-secret metadata missing or wrong.
|
|
81
|
+
* • INTERNAL — handler threw an unexpected error.
|
|
82
|
+
*
|
|
83
|
+
* Anything other than OK / ALREADY_EXISTS is retryable from the producer's
|
|
84
|
+
* BullMQ processor with exponential backoff.
|
|
85
|
+
*/
|
|
86
|
+
export interface ServiceProvisioningController {
|
|
87
|
+
provision(request: ServiceProvisioningRequest): Promise<ServiceProvisioningResponse> | Observable<ServiceProvisioningResponse> | ServiceProvisioningResponse;
|
|
88
|
+
}
|
|
89
|
+
export declare function ServiceProvisioningControllerMethods(): (constructor: Function) => void;
|
|
90
|
+
export declare const SERVICE_PROVISIONING_SERVICE_NAME = "ServiceProvisioning";
|
|
91
|
+
/**
|
|
92
|
+
* The only service. Add new flows by registering them on each side, not by
|
|
93
|
+
* editing this proto.
|
|
94
|
+
*
|
|
95
|
+
* Error semantics (mapped via @grpc/grpc-js `status` codes):
|
|
96
|
+
*
|
|
97
|
+
* • OK — write committed (or already existed; see ALREADY_EXISTS).
|
|
98
|
+
* • ALREADY_EXISTS — clean duplicate; producer should treat as success.
|
|
99
|
+
* • NOT_FOUND — `resource` is not registered on the consumer.
|
|
100
|
+
* • INVALID_ARGUMENT — `payload_json` failed the handler's `parse(...)`.
|
|
101
|
+
* • UNAUTHENTICATED — internal shared-secret metadata missing or wrong.
|
|
102
|
+
* • INTERNAL — handler threw an unexpected error.
|
|
103
|
+
*
|
|
104
|
+
* Anything other than OK / ALREADY_EXISTS is retryable from the producer's
|
|
105
|
+
* BullMQ processor with exponential backoff.
|
|
106
|
+
*/
|
|
107
|
+
export type ServiceProvisioningService = typeof ServiceProvisioningService;
|
|
108
|
+
export declare const ServiceProvisioningService: {
|
|
109
|
+
readonly provision: {
|
|
110
|
+
readonly path: "/aegis.service_provisioning.v1.ServiceProvisioning/Provision";
|
|
111
|
+
readonly requestStream: false;
|
|
112
|
+
readonly responseStream: false;
|
|
113
|
+
readonly requestSerialize: (value: ServiceProvisioningRequest) => Buffer<ArrayBuffer>;
|
|
114
|
+
readonly requestDeserialize: (value: Buffer) => ServiceProvisioningRequest;
|
|
115
|
+
readonly responseSerialize: (value: ServiceProvisioningResponse) => Buffer<ArrayBuffer>;
|
|
116
|
+
readonly responseDeserialize: (value: Buffer) => ServiceProvisioningResponse;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
export interface ServiceProvisioningServer extends UntypedServiceImplementation {
|
|
120
|
+
provision: handleUnaryCall<ServiceProvisioningRequest, ServiceProvisioningResponse>;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=service_provisioning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service_provisioning.d.ts","sourceRoot":"","sources":["../../../../../src/gen/service_provisioning/v1/service_provisioning.ts"],"names":[],"mappings":"AAOA,OAAO,KA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;;;;GAeG;AACH,MAAM,MAAM,0BAA0B,GAAG,OAAO,0BAA0B,CAAC;AAC3E,eAAO,MAAM,0BAA0B;;;;;2CAKT,0BAA0B;6CAExB,MAAM;4CACP,2BAA2B;8CAEzB,MAAM;;CAE7B,CAAC;AAEX,MAAM,WAAW,yBAA0B,SAAQ,4BAA4B;IAC7E,SAAS,EAAE,eAAe,CAAC,0BAA0B,EAAE,2BAA2B,CAAC,CAAC;CACrF"}
|
|
@@ -0,0 +1,117 @@
|
|
|
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_provisioning/v1/service_provisioning.proto
|
|
6
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
7
|
+
import _m0 from "protobufjs/minimal";
|
|
8
|
+
export const protobufPackage = "aegis.service_provisioning.v1";
|
|
9
|
+
export const AEGIS_SERVICE_PROVISIONING_V1_PACKAGE_NAME = "aegis.service_provisioning.v1";
|
|
10
|
+
function createBaseServiceProvisioningRequest() {
|
|
11
|
+
return { resource: "", idempotencyKey: "", payloadJson: "" };
|
|
12
|
+
}
|
|
13
|
+
export const ServiceProvisioningRequest = {
|
|
14
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
15
|
+
if (message.resource !== "") {
|
|
16
|
+
writer.uint32(10).string(message.resource);
|
|
17
|
+
}
|
|
18
|
+
if (message.idempotencyKey !== "") {
|
|
19
|
+
writer.uint32(18).string(message.idempotencyKey);
|
|
20
|
+
}
|
|
21
|
+
if (message.payloadJson !== "") {
|
|
22
|
+
writer.uint32(26).string(message.payloadJson);
|
|
23
|
+
}
|
|
24
|
+
return writer;
|
|
25
|
+
},
|
|
26
|
+
decode(input, length) {
|
|
27
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
28
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
29
|
+
const message = createBaseServiceProvisioningRequest();
|
|
30
|
+
while (reader.pos < end) {
|
|
31
|
+
const tag = reader.uint32();
|
|
32
|
+
switch (tag >>> 3) {
|
|
33
|
+
case 1:
|
|
34
|
+
if (tag !== 10) {
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
message.resource = reader.string();
|
|
38
|
+
continue;
|
|
39
|
+
case 2:
|
|
40
|
+
if (tag !== 18) {
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
message.idempotencyKey = reader.string();
|
|
44
|
+
continue;
|
|
45
|
+
case 3:
|
|
46
|
+
if (tag !== 26) {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
message.payloadJson = reader.string();
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
reader.skipType(tag & 7);
|
|
56
|
+
}
|
|
57
|
+
return message;
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
function createBaseServiceProvisioningResponse() {
|
|
61
|
+
return { ackJson: "" };
|
|
62
|
+
}
|
|
63
|
+
export const ServiceProvisioningResponse = {
|
|
64
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
65
|
+
if (message.ackJson !== "") {
|
|
66
|
+
writer.uint32(10).string(message.ackJson);
|
|
67
|
+
}
|
|
68
|
+
return writer;
|
|
69
|
+
},
|
|
70
|
+
decode(input, length) {
|
|
71
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
72
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
73
|
+
const message = createBaseServiceProvisioningResponse();
|
|
74
|
+
while (reader.pos < end) {
|
|
75
|
+
const tag = reader.uint32();
|
|
76
|
+
switch (tag >>> 3) {
|
|
77
|
+
case 1:
|
|
78
|
+
if (tag !== 10) {
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
message.ackJson = reader.string();
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
reader.skipType(tag & 7);
|
|
88
|
+
}
|
|
89
|
+
return message;
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
export function ServiceProvisioningControllerMethods() {
|
|
93
|
+
return function (constructor) {
|
|
94
|
+
const grpcMethods = ["provision"];
|
|
95
|
+
for (const method of grpcMethods) {
|
|
96
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
97
|
+
GrpcMethod("ServiceProvisioning", method)(constructor.prototype[method], method, descriptor);
|
|
98
|
+
}
|
|
99
|
+
const grpcStreamMethods = [];
|
|
100
|
+
for (const method of grpcStreamMethods) {
|
|
101
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
102
|
+
GrpcStreamMethod("ServiceProvisioning", method)(constructor.prototype[method], method, descriptor);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export const SERVICE_PROVISIONING_SERVICE_NAME = "ServiceProvisioning";
|
|
107
|
+
export const ServiceProvisioningService = {
|
|
108
|
+
provision: {
|
|
109
|
+
path: "/aegis.service_provisioning.v1.ServiceProvisioning/Provision",
|
|
110
|
+
requestStream: false,
|
|
111
|
+
responseStream: false,
|
|
112
|
+
requestSerialize: (value) => Buffer.from(ServiceProvisioningRequest.encode(value).finish()),
|
|
113
|
+
requestDeserialize: (value) => ServiceProvisioningRequest.decode(value),
|
|
114
|
+
responseSerialize: (value) => Buffer.from(ServiceProvisioningResponse.encode(value).finish()),
|
|
115
|
+
responseDeserialize: (value) => ServiceProvisioningResponse.decode(value),
|
|
116
|
+
},
|
|
117
|
+
};
|
|
@@ -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;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,mBAAmB,EAAE,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,kCAAkC,0BAA0B,CAAC;AAM1E,eAAO,MAAM,uBAAuB;oBAClB,uBAAuB,WAAU,GAAG,CAAC,MAAM,GAAyB,GAAG,CAAC,MAAM;kBAUhF,GAAG,CAAC,MAAM,GAAG,UAAU,WAAW,MAAM,GAAG,uB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
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,86 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package aegis.service_provisioning.v1;
|
|
4
|
+
|
|
5
|
+
option java_multiple_files = true;
|
|
6
|
+
|
|
7
|
+
// =============================================================================
|
|
8
|
+
// service-provisioning — generic cross-service WRITE replication contract
|
|
9
|
+
// -----------------------------------------------------------------------------
|
|
10
|
+
// The write-direction sibling of service-sync. One RPC, forever. To onboard a
|
|
11
|
+
// NEW provisioning flow (Agent, Vendor, NotificationPreference, anything) you
|
|
12
|
+
// do NOT edit this file. You register:
|
|
13
|
+
//
|
|
14
|
+
// • on the PRODUCER (caller, e.g. aegis) — a `defineProvisioningTarget`
|
|
15
|
+
// under aegis/src/common/service-provisioning.
|
|
16
|
+
// • on the CONSUMER (callee, e.g. gtms ) — a `defineProvisioningHandler`
|
|
17
|
+
// under gtms/src/shared/v1/service-provisioning.
|
|
18
|
+
//
|
|
19
|
+
// Why a single generic RPC?
|
|
20
|
+
//
|
|
21
|
+
// PROS
|
|
22
|
+
// • Zero proto churn when onboarding new flows.
|
|
23
|
+
// • One controller on the consumer side, dispatching by `resource`.
|
|
24
|
+
// • Producer feature modules contribute one target file + one forFeature
|
|
25
|
+
// line, mirroring the service-sync convention developers already know.
|
|
26
|
+
//
|
|
27
|
+
// CONS / DO NOT
|
|
28
|
+
// • DO NOT use this for high-throughput data ingestion. It is request /
|
|
29
|
+
// response and per-call. Bulk ingest belongs in a streaming RPC or
|
|
30
|
+
// a queue topic.
|
|
31
|
+
// • DO NOT put binary blobs in `payload_json` — base64 inflates payloads.
|
|
32
|
+
// • DO NOT use this for read paths — that's what service-sync is for.
|
|
33
|
+
// =============================================================================
|
|
34
|
+
|
|
35
|
+
// Single request — "create / upsert this row on the downstream service".
|
|
36
|
+
//
|
|
37
|
+
// `resource` → the namespace registered by the consumer (e.g. "agent").
|
|
38
|
+
// Must match a `defineProvisioningHandler.name` registered
|
|
39
|
+
// via `ServiceProvisioningModule.forFeature([...])`.
|
|
40
|
+
//
|
|
41
|
+
// `idempotency_key` → producer-chosen stable identifier for this logical
|
|
42
|
+
// operation. The consumer is REQUIRED to be idempotent
|
|
43
|
+
// under this key — typically by upserting on a unique
|
|
44
|
+
// column derived from the payload (e.g. `userPublicId`).
|
|
45
|
+
// The producer also uses this as the BullMQ `jobId` so
|
|
46
|
+
// replays at the queue layer are dropped before they
|
|
47
|
+
// reach the wire.
|
|
48
|
+
//
|
|
49
|
+
// `payload_json` → UTF-8 JSON string of the producer's request projection
|
|
50
|
+
// for this resource. The consumer's handler parses it
|
|
51
|
+
// into a typed `T` at the boundary. Keep it LEAN — only
|
|
52
|
+
// the fields the consumer actually needs to perform the
|
|
53
|
+
// write.
|
|
54
|
+
message ServiceProvisioningRequest {
|
|
55
|
+
string resource = 1;
|
|
56
|
+
string idempotency_key = 2;
|
|
57
|
+
string payload_json = 3;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Single response — "I am done; here is whatever the handler chose to ack".
|
|
61
|
+
//
|
|
62
|
+
// `ack_json` is a UTF-8 JSON string. It is OPTIONAL — handlers may return
|
|
63
|
+
// `"{}"` if they have nothing useful to say. Producers MUST NOT depend on a
|
|
64
|
+
// specific shape unless their target definition says so. The success of the
|
|
65
|
+
// RPC itself (no error status) is the primary signal.
|
|
66
|
+
message ServiceProvisioningResponse {
|
|
67
|
+
string ack_json = 1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// The only service. Add new flows by registering them on each side, not by
|
|
71
|
+
// editing this proto.
|
|
72
|
+
//
|
|
73
|
+
// Error semantics (mapped via @grpc/grpc-js `status` codes):
|
|
74
|
+
//
|
|
75
|
+
// • OK — write committed (or already existed; see ALREADY_EXISTS).
|
|
76
|
+
// • ALREADY_EXISTS — clean duplicate; producer should treat as success.
|
|
77
|
+
// • NOT_FOUND — `resource` is not registered on the consumer.
|
|
78
|
+
// • INVALID_ARGUMENT — `payload_json` failed the handler's `parse(...)`.
|
|
79
|
+
// • UNAUTHENTICATED — internal shared-secret metadata missing or wrong.
|
|
80
|
+
// • INTERNAL — handler threw an unexpected error.
|
|
81
|
+
//
|
|
82
|
+
// Anything other than OK / ALREADY_EXISTS is retryable from the producer's
|
|
83
|
+
// BullMQ processor with exponential backoff.
|
|
84
|
+
service ServiceProvisioning {
|
|
85
|
+
rpc Provision(ServiceProvisioningRequest) returns (ServiceProvisioningResponse);
|
|
86
|
+
}
|
|
@@ -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
|
+
}
|