@acequants/aegis-contracts 0.1.52 → 0.1.54

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acequants/aegis-contracts",
3
- "version": "0.1.52",
3
+ "version": "0.1.54",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -432,7 +432,7 @@ message GrpcDtoIdentityAgent {
432
432
 
433
433
  message GrpcDtoIdentityClient {
434
434
  string public_id = 1;
435
- string name = 2;
435
+ string nameLegal = 2;
436
436
  string type = 3;
437
437
 
438
438
  optional bool is_independent_vendor = 4;
@@ -31,44 +31,6 @@ message GrpcDtoPermissionsAdd {
31
31
  repeated GrpcDtoPermission permissions = 1;
32
32
  }
33
33
 
34
- // ---- CLIENT TYPE ----
35
- message GrpcInputClientTypeSeed {
36
- string name = 1;
37
- }
38
-
39
- message GrpcInputClientTypesSeed {
40
- repeated GrpcInputClientTypeSeed client_types = 1;
41
- }
42
-
43
- message GrpcInputClientType {
44
- string publicId = 1;
45
- }
46
-
47
- message GrpcInputClientTypes {
48
- optional string search = 1;
49
- optional int32 page = 2;
50
- optional int32 page_size = 3;
51
- optional string sort_by = 4;
52
- optional string sort_order = 5;
53
- }
54
-
55
- message GrpcDtoClientType {
56
- string public_id = 1;
57
- string name = 2;
58
- google.protobuf.Timestamp created_at = 3;
59
- google.protobuf.Timestamp updated_at = 4;
60
- google.protobuf.Timestamp deleted_at = 5;
61
- }
62
-
63
- message GrpcDtoClientTypesSeed {
64
- repeated GrpcDtoClientType client_types = 1;
65
- }
66
-
67
- message GrpcDtoClientTypes {
68
- repeated GrpcDtoClientType items = 1;
69
- GrpcDtoPagination meta = 2;
70
- }
71
-
72
34
  // ---- FEATURES ----
73
35
  message GrpcInputFeatureSeed {
74
36
  string name = 1;
@@ -134,98 +96,119 @@ message GrpcDtoFeaturePermissions {
134
96
  repeated GrpcDtoFeaturePermission featurePermissions = 1;
135
97
  }
136
98
 
137
- // ---- CLIENT ----
138
- message GrpcInputClientCreate {
139
- string clientTypePublicId=1;
140
- string name = 2;
141
- optional string managerPublicId=3;
142
- optional string description = 4;
99
+ service SystemService {
100
+ // --- Features ---
101
+ rpc FeaturesSeed (GrpcInputFeaturesSeed) returns (GrpcDtoFeaturesSeed);
102
+ rpc Features (GrpcInputFeatures) returns (GrpcDtoFeatures);
103
+ rpc Feature (GrpcInputFeature) returns (GrpcDtoFeature);
104
+ rpc FeaturePermissions (GrpcInputFeaturePermissions) returns (GrpcDtoFeaturePermissions);
105
+ rpc FeaturePermissionsAdd (GrpcInputFeaturePermissionsAdd) returns (GrpcDtoPermissionsAdd);
106
+ rpc FeaturePermissionsRemove (GrpcInputFeaturePermissionsRemove) returns (GrpcDtoMessage);
143
107
  }
144
108
 
145
- message GrpcInputClientUpdate {
146
- string publicId = 1;
147
- optional string name = 2;
148
- optional string description = 3;
149
- optional string clientTypePublicId=4;
150
- optional string managerPublicId=5;
151
- }
109
+ // ============================================================================
110
+ // GEO REPLICATION CONTRACT
111
+ // ============================================================================
112
+ //
113
+ // Used by aegis (authoritative) to ship GeoDivision rows to subscriber
114
+ // services (today: gtms) so they can maintain a local read-only mirror.
115
+ //
116
+ // RULES
117
+ // - Keyed by public_id only. NEVER add internal numeric ids.
118
+ // - Soft-deleted rows ARE returned so subscribers can mark them deleted.
119
+ // - Ordering is part of the contract: level ASC, public_id ASC. Parents
120
+ // arrive before children so the subscriber can satisfy its self-FK.
121
+ //
122
+ // DO
123
+ // - Add new fields at the END of a message with a new field number.
124
+ // - Bump to a v2 file for removals/renames or breaking semantics.
125
+ //
126
+ // DON'T
127
+ // - Don't reuse field numbers. Ever.
128
+ // - Don't add user/auth context to these payloads — geo is public data.
129
+ // ============================================================================
130
+
131
+ // ---- GEO MESSAGES ----
132
+ message GrpcDtoGeoDivision {
133
+ string public_id = 1;
134
+ // Parent's public_id; empty string when this is a root division (level 0).
135
+ string parent_public_id = 2;
152
136
 
153
- message GrpcInputClientFeaturesAdd {
154
- string publicId=1;
155
- repeated string featureIds=2;
156
- }
137
+ // Enum name as string (e.g. "COUNTRY", "REGION") — matches Prisma enum
138
+ // GEO_DIVISION. Kept as string so adding new levels doesn't require a
139
+ // proto bump on the subscriber.
140
+ string type = 3;
141
+ int32 level = 4;
142
+ string code = 5;
143
+ // Immutable hierarchy path (e.g. "KE", "KE.47", "KE.47.001").
144
+ string path = 6;
157
145
 
158
- message GrpcInputClientFeaturesRemove {
159
- repeated string publicClientFeatureIds=1;
160
- }
146
+ string name = 7;
147
+ string iso2 = 8;
148
+ string iso3 = 9;
149
+ string phone_code = 10;
161
150
 
162
- message GrpcInputClient {
163
- string publicId = 1;
164
- }
151
+ bool is_capital = 11;
152
+ bool is_active = 12;
165
153
 
166
- message GrpcInputClientFeatures {
167
- string clientPublicId = 1;
168
- }
154
+ // Optional centroid. Sent as wrapped/optional so 0,0 stays distinguishable
155
+ // from "no value". Using `optional` keyword (proto3 field presence).
156
+ optional double lat = 13;
157
+ optional double lng = 14;
158
+
159
+ // JSON-encoded geometry (GeoJSON). Empty string when not set.
160
+ // Kept as string to avoid pulling in google.protobuf.Struct here and to
161
+ // stay lossless for arbitrary GeoJSON shapes.
162
+ string geo_json = 15;
163
+
164
+ // Flattened relation scalars — subscribers don't need our internal ids.
165
+ string timezone_iana = 16;
166
+ string currency_code = 17;
169
167
 
170
- message GrpcInputClients {
171
- optional string clientTypePublicId=1;
172
- optional string managerPublicId=2;
173
- optional string search = 3;
174
- optional int32 page = 4;
175
- optional int32 pageSize = 5;
176
- optional string sortBy = 6;
177
- optional string sortOrder = 7;
168
+ google.protobuf.Timestamp created_at = 18;
169
+ google.protobuf.Timestamp updated_at = 19;
170
+ google.protobuf.Timestamp deleted_at = 20;
178
171
  }
179
172
 
180
- message GrpcDtoClient {
181
- string publicId = 1;
182
- string name = 2;
183
- optional string description = 3;
184
- optional GrpcDtoClientType clientType = 4;
185
- google.protobuf.Timestamp createdAt = 5;
186
- google.protobuf.Timestamp updatedAt = 6;
187
- google.protobuf.Timestamp deletedAt = 7;
173
+ message GrpcDtoGeoDivisionsPage {
174
+ repeated GrpcDtoGeoDivision items = 1;
175
+ // Empty string when there is no next page.
176
+ string next_cursor = 2;
188
177
  }
189
178
 
190
- message GrpcDtoClients {
191
- repeated GrpcDtoClient items = 1;
192
- GrpcDtoPagination meta = 2;
179
+ message GrpcDtoGeoDivisions {
180
+ repeated GrpcDtoGeoDivision items = 1;
193
181
  }
194
182
 
195
- message GrpcDtoFeaturesAdd {
196
- repeated GrpcDtoFeature features = 1;
183
+ // ---- GEO INPUTS ----
184
+ message GrpcInputGeoDivisionsListAll {
185
+ // Empty string means "from the beginning".
186
+ string cursor = 1;
187
+ // 0 means "use server default". Server clamps to its max.
188
+ int32 limit = 2;
197
189
  }
198
190
 
199
- message GrpcDtoClientFeature {
200
- string public_id = 1;
201
- GrpcDtoFeature feature = 2;
202
- optional GrpcDtoClient client = 3;
191
+ message GrpcInputGeoDivisionsGetByPublicIds {
192
+ repeated string public_ids = 1;
203
193
  }
204
194
 
205
- message GrpcDtoClientFeatures {
206
- repeated GrpcDtoClientFeature clientFeatures = 1;
195
+ message GrpcInputGeoDivisionsListChangedSince {
196
+ // Strict `>` comparison server-side. Subscriber should record its
197
+ // "last seen updated_at" and pass it back here unchanged.
198
+ google.protobuf.Timestamp since = 1;
199
+ string cursor = 2;
200
+ int32 limit = 3;
207
201
  }
208
202
 
209
- service SystemService {
210
- // --- Client Types ---
211
- rpc ClientTypesSeed (GrpcInputClientTypesSeed) returns (GrpcDtoClientTypesSeed);
212
- rpc ClientTypes (GrpcInputClientTypes) returns (GrpcDtoClientTypes);
213
- rpc ClientType (GrpcInputClientType) returns (GrpcDtoClientType);
214
-
215
- // --- Features ---
216
- rpc FeaturesSeed (GrpcInputFeaturesSeed) returns (GrpcDtoFeaturesSeed);
217
- rpc Features (GrpcInputFeatures) returns (GrpcDtoFeatures);
218
- rpc Feature (GrpcInputFeature) returns (GrpcDtoFeature);
219
- rpc FeaturePermissions (GrpcInputFeaturePermissions) returns (GrpcDtoFeaturePermissions);
220
- rpc FeaturePermissionsAdd (GrpcInputFeaturePermissionsAdd) returns (GrpcDtoPermissionsAdd);
221
- rpc FeaturePermissionsRemove (GrpcInputFeaturePermissionsRemove) returns (GrpcDtoMessage);
203
+ // ---- GEO SERVICE ----
204
+ service GeoService {
205
+ // Full sync (used on first mirror boot). Paged by public_id cursor.
206
+ rpc GeoDivisionsListAll (GrpcInputGeoDivisionsListAll) returns (GrpcDtoGeoDivisionsPage);
207
+
208
+ // Batch fetch by public_id (used by live Redis event consumers).
209
+ rpc GeoDivisionsGetByPublicIds (GrpcInputGeoDivisionsGetByPublicIds) returns (GrpcDtoGeoDivisions);
222
210
 
223
- // --- Clients ---
224
- rpc ClientCreate (GrpcInputClientCreate) returns (GrpcDtoClient);
225
- rpc ClientUpdate (GrpcInputClientUpdate) returns (GrpcDtoClient);
226
- rpc Clients (GrpcInputClients) returns (GrpcDtoClients);
227
- rpc Client (GrpcInputClient) returns (GrpcDtoClient);
228
- rpc ClientFeaturesAdd (GrpcInputClientFeaturesAdd) returns (GrpcDtoFeaturesAdd);
229
- rpc ClientFeaturesRemove (GrpcInputClientFeaturesRemove) returns (GrpcDtoMessage);
230
- rpc ClientFeatures (GrpcInputClientFeatures) returns (GrpcDtoClientFeatures);
211
+ // Hourly safety-net reconciler. Catches anything the Redis publisher
212
+ // dropped due to restart races.
213
+ rpc GeoDivisionsListChangedSince (GrpcInputGeoDivisionsListChangedSince) returns (GrpcDtoGeoDivisionsPage);
231
214
  }