@acequants/aegis-contracts 0.1.55 → 0.1.56

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,35 +1,35 @@
1
- {
2
- "name": "@acequants/aegis-contracts",
3
- "version": "0.1.55",
4
- "private": false,
5
- "license": "MIT",
6
- "type": "module",
7
- "main": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "files": [
10
- "dist/",
11
- "proto/"
12
- ],
13
- "scripts": {
14
- "clean": "rimraf dist src/gen",
15
- "gen": "mkdirp ./src/gen && node ./scripts/generate.cjs",
16
- "build": "tsc -p tsconfig.build.json",
17
- "prepublish": "npm run clean && npm run gen && npm run build"
18
- },
19
- "peerDependencies": {
20
- "@grpc/grpc-js": "^1.10.0",
21
- "protobufjs": "^7.2.0"
22
- },
23
- "devDependencies": {
24
- "@types/node": "^20.19.11",
25
- "mkdirp": "^3.0.1",
26
- "rimraf": "^6.0.0",
27
- "ts-node": "^10.9.2",
28
- "ts-proto": "^1.181.2",
29
- "typescript": "^5.5.0"
30
- },
31
- "dependencies": {
32
- "@nestjs/microservices": "^11.1.6",
33
- "rxjs": "^7.8.2"
34
- }
35
- }
1
+ {
2
+ "name": "@acequants/aegis-contracts",
3
+ "version": "0.1.56",
4
+ "private": false,
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist/",
11
+ "proto/"
12
+ ],
13
+ "scripts": {
14
+ "clean": "rimraf dist src/gen",
15
+ "gen": "mkdirp ./src/gen && node ./scripts/generate.cjs",
16
+ "build": "tsc -p tsconfig.build.json",
17
+ "prepublish": "npm run clean && npm run gen && npm run build"
18
+ },
19
+ "peerDependencies": {
20
+ "@grpc/grpc-js": "^1.10.0",
21
+ "protobufjs": "^7.2.0"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "^20.19.11",
25
+ "mkdirp": "^3.0.1",
26
+ "rimraf": "^6.0.0",
27
+ "ts-node": "^10.9.2",
28
+ "ts-proto": "^1.181.2",
29
+ "typescript": "^5.5.0"
30
+ },
31
+ "dependencies": {
32
+ "@nestjs/microservices": "^11.1.6",
33
+ "rxjs": "^7.8.2"
34
+ }
35
+ }
@@ -31,6 +31,44 @@ 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
+
34
72
  // ---- FEATURES ----
35
73
  message GrpcInputFeatureSeed {
36
74
  string name = 1;
@@ -96,122 +134,100 @@ message GrpcDtoFeaturePermissions {
96
134
  repeated GrpcDtoFeaturePermission featurePermissions = 1;
97
135
  }
98
136
 
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);
137
+ // ---- CLIENT ----
138
+ message GrpcInputClientCreate {
139
+ string clientTypePublicId=1;
140
+ string name = 2;
141
+ optional string managerPublicId=3;
142
+ optional string description = 4;
107
143
  }
108
144
 
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;
136
-
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;
145
-
146
- string name = 7;
147
- string iso2 = 8;
148
- string iso3 = 9;
149
- string phone_code = 10;
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
+ }
150
152
 
151
- bool is_capital = 11;
152
- bool is_active = 12;
153
+ message GrpcInputClientFeaturesAdd {
154
+ string publicId=1;
155
+ repeated string featureIds=2;
156
+ }
153
157
 
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
+ message GrpcInputClientFeaturesRemove {
159
+ repeated string publicClientFeatureIds=1;
160
+ }
158
161
 
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;
162
+ message GrpcInputClient {
163
+ string publicId = 1;
164
+ }
163
165
 
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;
166
+ message GrpcInputClientFeatures {
167
+ string clientPublicId = 1;
168
+ }
170
169
 
171
- google.protobuf.Timestamp created_at = 18;
172
- google.protobuf.Timestamp updated_at = 19;
173
- google.protobuf.Timestamp deleted_at = 20;
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;
174
178
  }
175
179
 
176
- message GrpcDtoGeoDivisionsPage {
177
- repeated GrpcDtoGeoDivision items = 1;
178
- // Empty string when there is no next page.
179
- string next_cursor = 2;
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;
180
188
  }
181
189
 
182
- message GrpcDtoGeoDivisions {
183
- repeated GrpcDtoGeoDivision items = 1;
190
+ message GrpcDtoClients {
191
+ repeated GrpcDtoClient items = 1;
192
+ GrpcDtoPagination meta = 2;
184
193
  }
185
194
 
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;
195
+ message GrpcDtoFeaturesAdd {
196
+ repeated GrpcDtoFeature features = 1;
192
197
  }
193
198
 
194
- message GrpcInputGeoDivisionsGetByPublicIds {
195
- repeated string public_ids = 1;
199
+ message GrpcDtoClientFeature {
200
+ string public_id = 1;
201
+ GrpcDtoFeature feature = 2;
202
+ optional GrpcDtoClient client = 3;
196
203
  }
197
204
 
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;
205
+ message GrpcDtoClientFeatures {
206
+ repeated GrpcDtoClientFeature clientFeatures = 1;
204
207
  }
205
208
 
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);
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);
210
222
 
211
- // Batch fetch by public_id (used by live Redis event consumers).
212
- rpc GeoDivisionsGetByPublicIds (GrpcInputGeoDivisionsGetByPublicIds) returns (GrpcDtoGeoDivisions);
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);
213
231
 
214
- // Hourly safety-net reconciler. Catches anything the Redis publisher
215
- // dropped due to restart races.
216
- rpc GeoDivisionsListChangedSince (GrpcInputGeoDivisionsListChangedSince) returns (GrpcDtoGeoDivisionsPage);
232
+ rpc Client_TO_DELETE (GrpcInputClientFeatures) returns (GrpcDtoClientFeatures);
217
233
  }