@acequants/aegis-contracts 0.1.53 → 0.1.55

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.53",
3
+ "version": "0.1.55",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -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,122 @@ 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
+ // Relation references by public_id. Mirrors the structure of aegis
165
+ // `GeoDivision.timezone` / `.currency` — subscribers can hold either
166
+ // an opaque string ref or layer their own mirror table on top. We
167
+ // ship public_ids (not internal ids) so the contract stays portable.
168
+ string timezone_public_id = 16;
169
+ string currency_public_id = 17;
169
170
 
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;
171
+ google.protobuf.Timestamp created_at = 18;
172
+ google.protobuf.Timestamp updated_at = 19;
173
+ google.protobuf.Timestamp deleted_at = 20;
178
174
  }
179
175
 
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;
176
+ message GrpcDtoGeoDivisionsPage {
177
+ repeated GrpcDtoGeoDivision items = 1;
178
+ // Empty string when there is no next page.
179
+ string next_cursor = 2;
188
180
  }
189
181
 
190
- message GrpcDtoClients {
191
- repeated GrpcDtoClient items = 1;
192
- GrpcDtoPagination meta = 2;
182
+ message GrpcDtoGeoDivisions {
183
+ repeated GrpcDtoGeoDivision items = 1;
193
184
  }
194
185
 
195
- message GrpcDtoFeaturesAdd {
196
- repeated GrpcDtoFeature features = 1;
186
+ // ---- GEO INPUTS ----
187
+ message GrpcInputGeoDivisionsListAll {
188
+ // Empty string means "from the beginning".
189
+ string cursor = 1;
190
+ // 0 means "use server default". Server clamps to its max.
191
+ int32 limit = 2;
197
192
  }
198
193
 
199
- message GrpcDtoClientFeature {
200
- string public_id = 1;
201
- GrpcDtoFeature feature = 2;
202
- optional GrpcDtoClient client = 3;
194
+ message GrpcInputGeoDivisionsGetByPublicIds {
195
+ repeated string public_ids = 1;
203
196
  }
204
197
 
205
- message GrpcDtoClientFeatures {
206
- repeated GrpcDtoClientFeature clientFeatures = 1;
198
+ message GrpcInputGeoDivisionsListChangedSince {
199
+ // Strict `>` comparison server-side. Subscriber should record its
200
+ // "last seen updated_at" and pass it back here unchanged.
201
+ google.protobuf.Timestamp since = 1;
202
+ string cursor = 2;
203
+ int32 limit = 3;
207
204
  }
208
205
 
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);
206
+ // ---- GEO SERVICE ----
207
+ service GeoService {
208
+ // Full sync (used on first mirror boot). Paged by public_id cursor.
209
+ rpc GeoDivisionsListAll (GrpcInputGeoDivisionsListAll) returns (GrpcDtoGeoDivisionsPage);
210
+
211
+ // Batch fetch by public_id (used by live Redis event consumers).
212
+ rpc GeoDivisionsGetByPublicIds (GrpcInputGeoDivisionsGetByPublicIds) returns (GrpcDtoGeoDivisions);
222
213
 
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);
214
+ // Hourly safety-net reconciler. Catches anything the Redis publisher
215
+ // dropped due to restart races.
216
+ rpc GeoDivisionsListChangedSince (GrpcInputGeoDivisionsListChangedSince) returns (GrpcDtoGeoDivisionsPage);
231
217
  }