@acequants/aegis-contracts 0.1.59 → 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/package.json +1 -1
- package/proto/service_provisioning/v1/service_provisioning.proto +86 -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,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,kCAAkC,CAAC;A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AW,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
|
+
};
|
package/package.json
CHANGED
|
@@ -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
|
+
}
|