@acequants/aegis-contracts 0.1.54 → 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.54",
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,119 +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
- // Flattened relation scalars — subscribers don't need our internal ids.
165
- string timezone_iana = 16;
166
- string currency_code = 17;
166
+ message GrpcInputClientFeatures {
167
+ string clientPublicId = 1;
168
+ }
167
169
 
168
- google.protobuf.Timestamp created_at = 18;
169
- google.protobuf.Timestamp updated_at = 19;
170
- 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;
171
178
  }
172
179
 
173
- message GrpcDtoGeoDivisionsPage {
174
- repeated GrpcDtoGeoDivision items = 1;
175
- // Empty string when there is no next page.
176
- 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;
177
188
  }
178
189
 
179
- message GrpcDtoGeoDivisions {
180
- repeated GrpcDtoGeoDivision items = 1;
190
+ message GrpcDtoClients {
191
+ repeated GrpcDtoClient items = 1;
192
+ GrpcDtoPagination meta = 2;
181
193
  }
182
194
 
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;
195
+ message GrpcDtoFeaturesAdd {
196
+ repeated GrpcDtoFeature features = 1;
189
197
  }
190
198
 
191
- message GrpcInputGeoDivisionsGetByPublicIds {
192
- repeated string public_ids = 1;
199
+ message GrpcDtoClientFeature {
200
+ string public_id = 1;
201
+ GrpcDtoFeature feature = 2;
202
+ optional GrpcDtoClient client = 3;
193
203
  }
194
204
 
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;
205
+ message GrpcDtoClientFeatures {
206
+ repeated GrpcDtoClientFeature clientFeatures = 1;
201
207
  }
202
208
 
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);
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);
207
222
 
208
- // Batch fetch by public_id (used by live Redis event consumers).
209
- 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);
210
231
 
211
- // Hourly safety-net reconciler. Catches anything the Redis publisher
212
- // dropped due to restart races.
213
- rpc GeoDivisionsListChangedSince (GrpcInputGeoDivisionsListChangedSince) returns (GrpcDtoGeoDivisionsPage);
232
+ rpc Client_TO_DELETE (GrpcInputClientFeatures) returns (GrpcDtoClientFeatures);
214
233
  }