@heavybit/ecommerce-contracts 0.0.0-stage → 0.2.2

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.
Files changed (130) hide show
  1. package/README.md +158 -2
  2. package/dist/cjs/app.js +38 -0
  3. package/dist/cjs/app.js.map +1 -0
  4. package/dist/cjs/bindings.js +127 -0
  5. package/dist/cjs/bindings.js.map +1 -0
  6. package/dist/cjs/events/audit.js +26 -0
  7. package/dist/cjs/events/audit.js.map +1 -0
  8. package/dist/cjs/events/auth.js +68 -0
  9. package/dist/cjs/events/auth.js.map +1 -0
  10. package/dist/cjs/events/base.js +99 -0
  11. package/dist/cjs/events/base.js.map +1 -0
  12. package/dist/cjs/events/cart.js +15 -0
  13. package/dist/cjs/events/cart.js.map +1 -0
  14. package/dist/cjs/events/catalog.js +24 -0
  15. package/dist/cjs/events/catalog.js.map +1 -0
  16. package/dist/cjs/events/gateway.js +24 -0
  17. package/dist/cjs/events/gateway.js.map +1 -0
  18. package/dist/cjs/events/index.js +131 -0
  19. package/dist/cjs/events/index.js.map +1 -0
  20. package/dist/cjs/events/media.js +17 -0
  21. package/dist/cjs/events/media.js.map +1 -0
  22. package/dist/cjs/events/notification.js +43 -0
  23. package/dist/cjs/events/notification.js.map +1 -0
  24. package/dist/cjs/events/order.js +45 -0
  25. package/dist/cjs/events/order.js.map +1 -0
  26. package/dist/cjs/events/payment.js +34 -0
  27. package/dist/cjs/events/payment.js.map +1 -0
  28. package/dist/cjs/events/security.js +36 -0
  29. package/dist/cjs/events/security.js.map +1 -0
  30. package/dist/cjs/events/shipping.js +25 -0
  31. package/dist/cjs/events/shipping.js.map +1 -0
  32. package/dist/cjs/events/store.js +25 -0
  33. package/dist/cjs/events/store.js.map +1 -0
  34. package/dist/cjs/events/usage.js +17 -0
  35. package/dist/cjs/events/usage.js.map +1 -0
  36. package/dist/cjs/identity.js +52 -0
  37. package/dist/cjs/identity.js.map +1 -0
  38. package/dist/cjs/index.js +27 -0
  39. package/dist/cjs/index.js.map +1 -0
  40. package/dist/cjs/package.json +1 -0
  41. package/dist/cjs/permissions.js +10 -0
  42. package/dist/cjs/permissions.js.map +1 -0
  43. package/dist/cjs/scopes.js +57 -0
  44. package/dist/cjs/scopes.js.map +1 -0
  45. package/dist/esm/app.js +35 -0
  46. package/dist/esm/app.js.map +1 -0
  47. package/dist/esm/bindings.js +115 -0
  48. package/dist/esm/bindings.js.map +1 -0
  49. package/dist/esm/events/audit.js +23 -0
  50. package/dist/esm/events/audit.js.map +1 -0
  51. package/dist/esm/events/auth.js +65 -0
  52. package/dist/esm/events/auth.js.map +1 -0
  53. package/dist/esm/events/base.js +90 -0
  54. package/dist/esm/events/base.js.map +1 -0
  55. package/dist/esm/events/cart.js +12 -0
  56. package/dist/esm/events/cart.js.map +1 -0
  57. package/dist/esm/events/catalog.js +21 -0
  58. package/dist/esm/events/catalog.js.map +1 -0
  59. package/dist/esm/events/gateway.js +21 -0
  60. package/dist/esm/events/gateway.js.map +1 -0
  61. package/dist/esm/events/index.js +100 -0
  62. package/dist/esm/events/index.js.map +1 -0
  63. package/dist/esm/events/media.js +14 -0
  64. package/dist/esm/events/media.js.map +1 -0
  65. package/dist/esm/events/notification.js +40 -0
  66. package/dist/esm/events/notification.js.map +1 -0
  67. package/dist/esm/events/order.js +42 -0
  68. package/dist/esm/events/order.js.map +1 -0
  69. package/dist/esm/events/payment.js +31 -0
  70. package/dist/esm/events/payment.js.map +1 -0
  71. package/dist/esm/events/security.js +33 -0
  72. package/dist/esm/events/security.js.map +1 -0
  73. package/dist/esm/events/shipping.js +22 -0
  74. package/dist/esm/events/shipping.js.map +1 -0
  75. package/dist/esm/events/store.js +22 -0
  76. package/dist/esm/events/store.js.map +1 -0
  77. package/dist/esm/events/usage.js +14 -0
  78. package/dist/esm/events/usage.js.map +1 -0
  79. package/dist/esm/identity.js +49 -0
  80. package/dist/esm/identity.js.map +1 -0
  81. package/dist/esm/index.js +11 -0
  82. package/dist/esm/index.js.map +1 -0
  83. package/dist/esm/package.json +1 -0
  84. package/dist/esm/permissions.js +7 -0
  85. package/dist/esm/permissions.js.map +1 -0
  86. package/dist/esm/scopes.js +52 -0
  87. package/dist/esm/scopes.js.map +1 -0
  88. package/dist/types/app.d.ts +40 -0
  89. package/dist/types/app.d.ts.map +1 -0
  90. package/dist/types/bindings.d.ts +88 -0
  91. package/dist/types/bindings.d.ts.map +1 -0
  92. package/dist/types/events/audit.d.ts +86 -0
  93. package/dist/types/events/audit.d.ts.map +1 -0
  94. package/dist/types/events/auth.d.ts +357 -0
  95. package/dist/types/events/auth.d.ts.map +1 -0
  96. package/dist/types/events/base.d.ts +108 -0
  97. package/dist/types/events/base.d.ts.map +1 -0
  98. package/dist/types/events/cart.d.ts +37 -0
  99. package/dist/types/events/cart.d.ts.map +1 -0
  100. package/dist/types/events/catalog.d.ts +126 -0
  101. package/dist/types/events/catalog.d.ts.map +1 -0
  102. package/dist/types/events/gateway.d.ts +77 -0
  103. package/dist/types/events/gateway.d.ts.map +1 -0
  104. package/dist/types/events/index.d.ts +4333 -0
  105. package/dist/types/events/index.d.ts.map +1 -0
  106. package/dist/types/events/media.d.ts +51 -0
  107. package/dist/types/events/media.d.ts.map +1 -0
  108. package/dist/types/events/notification.d.ts +270 -0
  109. package/dist/types/events/notification.d.ts.map +1 -0
  110. package/dist/types/events/order.d.ts +289 -0
  111. package/dist/types/events/order.d.ts.map +1 -0
  112. package/dist/types/events/payment.d.ts +228 -0
  113. package/dist/types/events/payment.d.ts.map +1 -0
  114. package/dist/types/events/security.d.ts +201 -0
  115. package/dist/types/events/security.d.ts.map +1 -0
  116. package/dist/types/events/shipping.d.ts +91 -0
  117. package/dist/types/events/shipping.d.ts.map +1 -0
  118. package/dist/types/events/store.d.ts +134 -0
  119. package/dist/types/events/store.d.ts.map +1 -0
  120. package/dist/types/events/usage.d.ts +59 -0
  121. package/dist/types/events/usage.d.ts.map +1 -0
  122. package/dist/types/identity.d.ts +24 -0
  123. package/dist/types/identity.d.ts.map +1 -0
  124. package/dist/types/index.d.ts +11 -0
  125. package/dist/types/index.d.ts.map +1 -0
  126. package/dist/types/permissions.d.ts +7 -0
  127. package/dist/types/permissions.d.ts.map +1 -0
  128. package/dist/types/scopes.d.ts +57 -0
  129. package/dist/types/scopes.d.ts.map +1 -0
  130. package/package.json +44 -4
@@ -0,0 +1,357 @@
1
+ /** auth-admin-service events: users, companies, staff, memberships, roles, approvals, security (§7). */
2
+ import { z } from '@heavybit/shared-lib';
3
+ /** Routing keys published by auth-admin-service. */
4
+ export declare const AUTH_KEYS: {
5
+ readonly user: {
6
+ readonly registered: "auth.user.registered";
7
+ readonly verified: "auth.user.verified";
8
+ readonly passwordResetRequested: "auth.user.password_reset_requested";
9
+ readonly passwordChanged: "auth.user.password_changed";
10
+ readonly emailChanged: "auth.user.email_changed";
11
+ readonly deleted: "auth.user.deleted";
12
+ readonly authzChanged: "auth.user.authz_changed";
13
+ };
14
+ readonly company: {
15
+ readonly created: "auth.company.created";
16
+ readonly updated: "auth.company.updated";
17
+ readonly suspended: "auth.company.suspended";
18
+ readonly reactivated: "auth.company.reactivated";
19
+ readonly closed: "auth.company.closed";
20
+ };
21
+ readonly staff: {
22
+ readonly invited: "auth.staff.invited";
23
+ readonly joined: "auth.staff.joined";
24
+ readonly removed: "auth.staff.removed";
25
+ };
26
+ readonly membership: {
27
+ readonly changed: "auth.membership.changed";
28
+ };
29
+ readonly role: {
30
+ readonly changed: "auth.role.changed";
31
+ };
32
+ readonly approval: {
33
+ readonly requested: "auth.approval.requested";
34
+ readonly approved: "auth.approval.approved";
35
+ readonly rejected: "auth.approval.rejected";
36
+ readonly expired: "auth.approval.expired";
37
+ readonly executed: "auth.approval.executed";
38
+ readonly failed: "auth.approval.failed";
39
+ };
40
+ };
41
+ /** v1 payload schemas of the auth user/company/staff/role/approval events. */
42
+ export declare const AUTH_EVENTS: {
43
+ readonly "auth.user.registered": z.ZodObject<{
44
+ userId: z.ZodString;
45
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
46
+ userId: z.ZodString;
47
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
48
+ userId: z.ZodString;
49
+ }, z.ZodTypeAny, "passthrough">>;
50
+ readonly "auth.user.verified": z.ZodObject<{
51
+ userId: z.ZodString;
52
+ channel: z.ZodEnum<["email", "phone"]>;
53
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
54
+ userId: z.ZodString;
55
+ channel: z.ZodEnum<["email", "phone"]>;
56
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
57
+ userId: z.ZodString;
58
+ channel: z.ZodEnum<["email", "phone"]>;
59
+ }, z.ZodTypeAny, "passthrough">>;
60
+ readonly "auth.user.password_reset_requested": z.ZodObject<{
61
+ userId: z.ZodString;
62
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
63
+ userId: z.ZodString;
64
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
65
+ userId: z.ZodString;
66
+ }, z.ZodTypeAny, "passthrough">>;
67
+ readonly "auth.user.password_changed": z.ZodObject<{
68
+ userId: z.ZodString;
69
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
70
+ userId: z.ZodString;
71
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
72
+ userId: z.ZodString;
73
+ }, z.ZodTypeAny, "passthrough">>;
74
+ readonly "auth.user.email_changed": z.ZodObject<{
75
+ userId: z.ZodString;
76
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
77
+ userId: z.ZodString;
78
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
79
+ userId: z.ZodString;
80
+ }, z.ZodTypeAny, "passthrough">>;
81
+ readonly "auth.user.deleted": z.ZodObject<{
82
+ userId: z.ZodString;
83
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
84
+ userId: z.ZodString;
85
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
86
+ userId: z.ZodString;
87
+ }, z.ZodTypeAny, "passthrough">>;
88
+ /** Roles, permissions or memberships changed: drop cached permissions for this user (and company, when given). */
89
+ readonly "auth.user.authz_changed": z.ZodObject<{
90
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
91
+ } & {
92
+ userId: z.ZodString;
93
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
94
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
95
+ } & {
96
+ userId: z.ZodString;
97
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
98
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
99
+ } & {
100
+ userId: z.ZodString;
101
+ }, z.ZodTypeAny, "passthrough">>;
102
+ readonly "auth.company.created": z.ZodObject<{
103
+ companyId: z.ZodString;
104
+ } & {
105
+ ownerUserId: z.ZodString;
106
+ slug: z.ZodString;
107
+ name: z.ZodString;
108
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
109
+ companyId: z.ZodString;
110
+ } & {
111
+ ownerUserId: z.ZodString;
112
+ slug: z.ZodString;
113
+ name: z.ZodString;
114
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
115
+ companyId: z.ZodString;
116
+ } & {
117
+ ownerUserId: z.ZodString;
118
+ slug: z.ZodString;
119
+ name: z.ZodString;
120
+ }, z.ZodTypeAny, "passthrough">>;
121
+ readonly "auth.company.updated": z.ZodObject<{
122
+ companyId: z.ZodString;
123
+ } & {
124
+ changedFields: z.ZodArray<z.ZodString, "many">;
125
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
126
+ companyId: z.ZodString;
127
+ } & {
128
+ changedFields: z.ZodArray<z.ZodString, "many">;
129
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
130
+ companyId: z.ZodString;
131
+ } & {
132
+ changedFields: z.ZodArray<z.ZodString, "many">;
133
+ }, z.ZodTypeAny, "passthrough">>;
134
+ readonly "auth.company.suspended": z.ZodObject<{
135
+ companyId: z.ZodString;
136
+ } & {
137
+ reason: z.ZodString;
138
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
139
+ companyId: z.ZodString;
140
+ } & {
141
+ reason: z.ZodString;
142
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
143
+ companyId: z.ZodString;
144
+ } & {
145
+ reason: z.ZodString;
146
+ }, z.ZodTypeAny, "passthrough">>;
147
+ readonly "auth.company.reactivated": z.ZodObject<{
148
+ companyId: z.ZodString;
149
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
150
+ companyId: z.ZodString;
151
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
152
+ companyId: z.ZodString;
153
+ }, z.ZodTypeAny, "passthrough">>;
154
+ readonly "auth.company.closed": z.ZodObject<{
155
+ companyId: z.ZodString;
156
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
157
+ companyId: z.ZodString;
158
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
159
+ companyId: z.ZodString;
160
+ }, z.ZodTypeAny, "passthrough">>;
161
+ readonly "auth.staff.invited": z.ZodObject<{
162
+ companyId: z.ZodString;
163
+ } & {
164
+ invitationId: z.ZodString;
165
+ roleId: z.ZodString;
166
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
167
+ companyId: z.ZodString;
168
+ } & {
169
+ invitationId: z.ZodString;
170
+ roleId: z.ZodString;
171
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
172
+ companyId: z.ZodString;
173
+ } & {
174
+ invitationId: z.ZodString;
175
+ roleId: z.ZodString;
176
+ }, z.ZodTypeAny, "passthrough">>;
177
+ readonly "auth.staff.joined": z.ZodObject<{
178
+ companyId: z.ZodString;
179
+ } & {
180
+ userId: z.ZodString;
181
+ membershipId: z.ZodString;
182
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
183
+ companyId: z.ZodString;
184
+ } & {
185
+ userId: z.ZodString;
186
+ membershipId: z.ZodString;
187
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
188
+ companyId: z.ZodString;
189
+ } & {
190
+ userId: z.ZodString;
191
+ membershipId: z.ZodString;
192
+ }, z.ZodTypeAny, "passthrough">>;
193
+ readonly "auth.staff.removed": z.ZodObject<{
194
+ companyId: z.ZodString;
195
+ } & {
196
+ userId: z.ZodString;
197
+ membershipId: z.ZodString;
198
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
199
+ companyId: z.ZodString;
200
+ } & {
201
+ userId: z.ZodString;
202
+ membershipId: z.ZodString;
203
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
204
+ companyId: z.ZodString;
205
+ } & {
206
+ userId: z.ZodString;
207
+ membershipId: z.ZodString;
208
+ }, z.ZodTypeAny, "passthrough">>;
209
+ readonly "auth.membership.changed": z.ZodObject<{
210
+ companyId: z.ZodString;
211
+ } & {
212
+ membershipId: z.ZodString;
213
+ userId: z.ZodString;
214
+ roleIds: z.ZodArray<z.ZodString, "many">;
215
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
216
+ companyId: z.ZodString;
217
+ } & {
218
+ membershipId: z.ZodString;
219
+ userId: z.ZodString;
220
+ roleIds: z.ZodArray<z.ZodString, "many">;
221
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
222
+ companyId: z.ZodString;
223
+ } & {
224
+ membershipId: z.ZodString;
225
+ userId: z.ZodString;
226
+ roleIds: z.ZodArray<z.ZodString, "many">;
227
+ }, z.ZodTypeAny, "passthrough">>;
228
+ /** Company roles carry a company; platform roles do not. */
229
+ readonly "auth.role.changed": z.ZodObject<{
230
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
231
+ } & {
232
+ roleId: z.ZodString;
233
+ change: z.ZodEnum<["created", "updated", "deleted", "permissions_changed"]>;
234
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
235
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
236
+ } & {
237
+ roleId: z.ZodString;
238
+ change: z.ZodEnum<["created", "updated", "deleted", "permissions_changed"]>;
239
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
240
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
241
+ } & {
242
+ roleId: z.ZodString;
243
+ change: z.ZodEnum<["created", "updated", "deleted", "permissions_changed"]>;
244
+ }, z.ZodTypeAny, "passthrough">>;
245
+ readonly "auth.approval.requested": z.ZodObject<{
246
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
247
+ } & {
248
+ approvalId: z.ZodString;
249
+ action: z.ZodString;
250
+ requestedBy: z.ZodString;
251
+ expiresAt: z.ZodString;
252
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
253
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
254
+ } & {
255
+ approvalId: z.ZodString;
256
+ action: z.ZodString;
257
+ requestedBy: z.ZodString;
258
+ expiresAt: z.ZodString;
259
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
260
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
261
+ } & {
262
+ approvalId: z.ZodString;
263
+ action: z.ZodString;
264
+ requestedBy: z.ZodString;
265
+ expiresAt: z.ZodString;
266
+ }, z.ZodTypeAny, "passthrough">>;
267
+ readonly "auth.approval.approved": z.ZodObject<{
268
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
269
+ } & {
270
+ approvalId: z.ZodString;
271
+ action: z.ZodString;
272
+ decidedBy: z.ZodString;
273
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
274
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
275
+ } & {
276
+ approvalId: z.ZodString;
277
+ action: z.ZodString;
278
+ decidedBy: z.ZodString;
279
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
280
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
281
+ } & {
282
+ approvalId: z.ZodString;
283
+ action: z.ZodString;
284
+ decidedBy: z.ZodString;
285
+ }, z.ZodTypeAny, "passthrough">>;
286
+ readonly "auth.approval.rejected": z.ZodObject<{
287
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
288
+ } & {
289
+ approvalId: z.ZodString;
290
+ action: z.ZodString;
291
+ decidedBy: z.ZodString;
292
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
293
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
294
+ } & {
295
+ approvalId: z.ZodString;
296
+ action: z.ZodString;
297
+ decidedBy: z.ZodString;
298
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
299
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
300
+ } & {
301
+ approvalId: z.ZodString;
302
+ action: z.ZodString;
303
+ decidedBy: z.ZodString;
304
+ }, z.ZodTypeAny, "passthrough">>;
305
+ readonly "auth.approval.expired": z.ZodObject<{
306
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
307
+ } & {
308
+ approvalId: z.ZodString;
309
+ action: z.ZodString;
310
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
311
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
312
+ } & {
313
+ approvalId: z.ZodString;
314
+ action: z.ZodString;
315
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
316
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
317
+ } & {
318
+ approvalId: z.ZodString;
319
+ action: z.ZodString;
320
+ }, z.ZodTypeAny, "passthrough">>;
321
+ readonly "auth.approval.executed": z.ZodObject<{
322
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
323
+ } & {
324
+ approvalId: z.ZodString;
325
+ action: z.ZodString;
326
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
327
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
328
+ } & {
329
+ approvalId: z.ZodString;
330
+ action: z.ZodString;
331
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
332
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
333
+ } & {
334
+ approvalId: z.ZodString;
335
+ action: z.ZodString;
336
+ }, z.ZodTypeAny, "passthrough">>;
337
+ readonly "auth.approval.failed": z.ZodObject<{
338
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
339
+ } & {
340
+ approvalId: z.ZodString;
341
+ action: z.ZodString;
342
+ reason: z.ZodString;
343
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
344
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
345
+ } & {
346
+ approvalId: z.ZodString;
347
+ action: z.ZodString;
348
+ reason: z.ZodString;
349
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
350
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
351
+ } & {
352
+ approvalId: z.ZodString;
353
+ action: z.ZodString;
354
+ reason: z.ZodString;
355
+ }, z.ZodTypeAny, "passthrough">>;
356
+ };
357
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/events/auth.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAC;AAGzC,oDAAoD;AACpD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BZ,CAAC;AAOX,8EAA8E;AAC9E,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAOtB,kHAAkH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWlH,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQpD,CAAC"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Building blocks for v1 event payload schemas.
3
+ *
4
+ * A payload schema describes the envelope `data` **without** the reserved fields (`eventId`, `version`,
5
+ * `actorUserId`), because shared-lib's `enqueueOutbox` adds them and `MessageConsumer` strips them before
6
+ * validating. {@link withEventMeta} adds them back for checks of a complete `data` object.
7
+ *
8
+ * Every payload is `.passthrough()` (MSG-3): a consumer on an older version keeps fields it does not know.
9
+ * Payloads carry ids and small facts only — never an email, phone or address when a user id will do.
10
+ */
11
+ import { z } from '@heavybit/shared-lib';
12
+ /** Payload schema version for every event in this catalogue. */
13
+ export declare const EVENT_VERSION: 1;
14
+ /** Canonical ULID (D7). */
15
+ export declare const id: z.ZodString;
16
+ /** Money amount as a decimal string with exactly 2 dp, as `DECIMAL(12,2)` stores it (D5), e.g. `"1250.00"`. */
17
+ export declare const amount: z.ZodString;
18
+ /** The currency code that travels with every amount. */
19
+ export declare const currency: z.ZodLiteral<"KES">;
20
+ /** ISO-8601 timestamp with an offset (`toISOString()` output). */
21
+ export declare const timestamp: z.ZodString;
22
+ /** Short machine reason, e.g. `insufficient_funds`. */
23
+ export declare const reason: z.ZodString;
24
+ /** Names of the fields that changed (never their values). */
25
+ export declare const changedFields: z.ZodArray<z.ZodString, "many">;
26
+ /** Small string-to-scalar map for facts that do not deserve their own field (never secrets or PII). */
27
+ export declare const facts: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
28
+ /**
29
+ * Payload of an event about one company's data: `companyId` is required (TEN-7).
30
+ *
31
+ * @example tenantPayload({ orderId: id })
32
+ */
33
+ export declare function tenantPayload<S extends z.ZodRawShape>(shape: S): z.ZodObject<{
34
+ companyId: z.ZodString;
35
+ } & S, "passthrough", z.ZodTypeAny, z.objectOutputType<{
36
+ companyId: z.ZodString;
37
+ } & S, z.ZodTypeAny, "passthrough">, z.objectInputType<{
38
+ companyId: z.ZodString;
39
+ } & S, z.ZodTypeAny, "passthrough">>;
40
+ /**
41
+ * Payload of an event that may or may not concern a company (e.g. a platform-level approval or a
42
+ * security event before a company is chosen): `companyId` is a ULID or null.
43
+ *
44
+ * @example optionalTenantPayload({ approvalId: id })
45
+ */
46
+ export declare function optionalTenantPayload<S extends z.ZodRawShape>(shape: S): z.ZodObject<{
47
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
+ } & S, "passthrough", z.ZodTypeAny, z.objectOutputType<{
49
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ } & S, z.ZodTypeAny, "passthrough">, z.objectInputType<{
51
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ } & S, z.ZodTypeAny, "passthrough">>;
53
+ /**
54
+ * Payload of an event about a user account, not a company (e.g. `auth.user.registered`).
55
+ *
56
+ * @example userPayload({ userId: id })
57
+ */
58
+ export declare function userPayload<S extends z.ZodRawShape>(shape: S): z.ZodObject<S, "passthrough", z.ZodTypeAny, z.objectOutputType<S, z.ZodTypeAny, "passthrough">, z.objectInputType<S, z.ZodTypeAny, "passthrough">>;
59
+ /** The reserved envelope fields as validated in a complete `data` object. */
60
+ export declare const eventMetaShape: {
61
+ eventId: z.ZodString;
62
+ version: z.ZodLiteral<1>;
63
+ /** The acting user; `null` for the system. Producers in this app always pass it. */
64
+ actorUserId: z.ZodNullable<z.ZodString>;
65
+ };
66
+ /**
67
+ * Adds the reserved envelope fields to a payload schema, for validating a complete envelope `data`.
68
+ *
69
+ * @example withEventMeta(schema).parse(envelope.data)
70
+ */
71
+ export declare function withEventMeta<S extends z.ZodTypeAny>(schema: S): z.ZodIntersection<S, z.ZodObject<{
72
+ eventId: z.ZodString;
73
+ version: z.ZodLiteral<1>;
74
+ /** The acting user; `null` for the system. Producers in this app always pass it. */
75
+ actorUserId: z.ZodNullable<z.ZodString>;
76
+ }, "strip", z.ZodTypeAny, {
77
+ eventId: string;
78
+ version: 1;
79
+ actorUserId: string | null;
80
+ }, {
81
+ eventId: string;
82
+ version: 1;
83
+ actorUserId: string | null;
84
+ }>>;
85
+ /**
86
+ * Services that publish the per-publisher families `{publisher}.audit.recorded` and
87
+ * `{publisher}.security.socket_rejected` (the first routing-key segment of each service).
88
+ */
89
+ export declare const EVENT_PUBLISHERS: readonly ["auth", "gateway", "store", "catalog", "media", "cart", "order", "payment", "shipping", "notification", "reporting"];
90
+ /** One publishing service. */
91
+ export type EventPublisher = (typeof EVENT_PUBLISHERS)[number];
92
+ /**
93
+ * Builds one routing key per publisher for a per-publisher family, e.g. `order.audit.recorded`.
94
+ *
95
+ * @example perPublisher('audit.recorded').order === 'order.audit.recorded'
96
+ */
97
+ export declare function perPublisher<const S extends string>(suffix: S): {
98
+ readonly [P in EventPublisher]: `${P}.${S}`;
99
+ };
100
+ /**
101
+ * The same schema under every key of a per-publisher family.
102
+ *
103
+ * @example forEachKey(AUDIT_RECORDED_KEYS, auditRecordedSchema)
104
+ */
105
+ export declare function forEachKey<K extends string, S>(keys: {
106
+ readonly [P in EventPublisher]: K;
107
+ }, schema: S): Record<K, S>;
108
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/events/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAY,CAAC,EAAE,MAAM,sBAAsB,CAAC;AAGnD,gEAAgE;AAChE,eAAO,MAAM,aAAa,EAAG,CAAU,CAAC;AAExC,2BAA2B;AAC3B,eAAO,MAAM,EAAE,aAAW,CAAC;AAE3B,+GAA+G;AAC/G,eAAO,MAAM,MAAM,aAAwF,CAAC;AAE5G,wDAAwD;AACxD,eAAO,MAAM,QAAQ,qBAAsB,CAAC;AAE5C,kEAAkE;AAClE,eAAO,MAAM,SAAS,aAAwC,CAAC;AAE/D,uDAAuD;AACvD,eAAO,MAAM,MAAM,aAA6B,CAAC;AAEjD,6DAA6D;AAC7D,eAAO,MAAM,aAAa,iCAAsC,CAAC;AAEjE,uGAAuG;AACvG,eAAO,MAAM,KAAK,2FAAkG,CAAC;AAErH;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC;;;;;;qCAE9D;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC;;;;;;qCAEtE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC,sJAE5D;AAED,6EAA6E;AAC7E,eAAO,MAAM,cAAc;;;IAGzB,oFAAoF;;CAErF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;;;IAT7D,oFAAoF;;;;;;;;;;IAWrF;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,gIAAiI,CAAC;AAE/J,8BAA8B;AAC9B,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,cAAc,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE;CAAE,CAE/G;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE;IAAE,QAAQ,EAAE,CAAC,IAAI,cAAc,GAAG,CAAC;CAAE,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAEpH"}
@@ -0,0 +1,37 @@
1
+ /** cart-service events. */
2
+ import { z } from '@heavybit/shared-lib';
3
+ /** Routing keys published by cart-service. */
4
+ export declare const CART_KEYS: {
5
+ readonly cart: {
6
+ readonly updated: "cart.cart.updated";
7
+ };
8
+ };
9
+ /** v1 payload schemas of the cart events. `userId` is null for a guest cart. */
10
+ export declare const CART_EVENTS: {
11
+ readonly "cart.cart.updated": z.ZodObject<{
12
+ companyId: z.ZodString;
13
+ } & {
14
+ cartId: z.ZodString;
15
+ userId: z.ZodNullable<z.ZodString>;
16
+ itemCount: z.ZodNumber;
17
+ subtotal: z.ZodString;
18
+ currency: z.ZodLiteral<"KES">;
19
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
20
+ companyId: z.ZodString;
21
+ } & {
22
+ cartId: z.ZodString;
23
+ userId: z.ZodNullable<z.ZodString>;
24
+ itemCount: z.ZodNumber;
25
+ subtotal: z.ZodString;
26
+ currency: z.ZodLiteral<"KES">;
27
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
28
+ companyId: z.ZodString;
29
+ } & {
30
+ cartId: z.ZodString;
31
+ userId: z.ZodNullable<z.ZodString>;
32
+ itemCount: z.ZodNumber;
33
+ subtotal: z.ZodString;
34
+ currency: z.ZodLiteral<"KES">;
35
+ }, z.ZodTypeAny, "passthrough">>;
36
+ };
37
+ //# sourceMappingURL=cart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../../../src/events/cart.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAC;AAGzC,8CAA8C;AAC9C,eAAO,MAAM,SAAS;;;;CAEZ,CAAC;AAEX,gFAAgF;AAChF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;CAEd,CAAC"}
@@ -0,0 +1,126 @@
1
+ /** catalog-service events: products, categories, inventory. */
2
+ import { z } from '@heavybit/shared-lib';
3
+ /** Routing keys published by catalog-service. */
4
+ export declare const CATALOG_KEYS: {
5
+ readonly product: {
6
+ readonly created: "catalog.product.created";
7
+ readonly updated: "catalog.product.updated";
8
+ readonly deleted: "catalog.product.deleted";
9
+ };
10
+ readonly category: {
11
+ readonly updated: "catalog.category.updated";
12
+ };
13
+ readonly inventory: {
14
+ readonly adjusted: "catalog.inventory.adjusted";
15
+ readonly lowStock: "catalog.inventory.low_stock";
16
+ };
17
+ };
18
+ /** v1 payload schemas of the catalog events. */
19
+ export declare const CATALOG_EVENTS: {
20
+ readonly "catalog.product.created": z.ZodObject<{
21
+ companyId: z.ZodString;
22
+ } & {
23
+ productId: z.ZodString;
24
+ status: z.ZodString;
25
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
26
+ companyId: z.ZodString;
27
+ } & {
28
+ productId: z.ZodString;
29
+ status: z.ZodString;
30
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
31
+ companyId: z.ZodString;
32
+ } & {
33
+ productId: z.ZodString;
34
+ status: z.ZodString;
35
+ }, z.ZodTypeAny, "passthrough">>;
36
+ readonly "catalog.product.updated": z.ZodObject<{
37
+ companyId: z.ZodString;
38
+ } & {
39
+ productId: z.ZodString;
40
+ changedFields: z.ZodArray<z.ZodString, "many">;
41
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
42
+ companyId: z.ZodString;
43
+ } & {
44
+ productId: z.ZodString;
45
+ changedFields: z.ZodArray<z.ZodString, "many">;
46
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
47
+ companyId: z.ZodString;
48
+ } & {
49
+ productId: z.ZodString;
50
+ changedFields: z.ZodArray<z.ZodString, "many">;
51
+ }, z.ZodTypeAny, "passthrough">>;
52
+ readonly "catalog.product.deleted": z.ZodObject<{
53
+ companyId: z.ZodString;
54
+ } & {
55
+ productId: z.ZodString;
56
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
57
+ companyId: z.ZodString;
58
+ } & {
59
+ productId: z.ZodString;
60
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
61
+ companyId: z.ZodString;
62
+ } & {
63
+ productId: z.ZodString;
64
+ }, z.ZodTypeAny, "passthrough">>;
65
+ readonly "catalog.category.updated": z.ZodObject<{
66
+ companyId: z.ZodString;
67
+ } & {
68
+ categoryId: z.ZodString;
69
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
70
+ companyId: z.ZodString;
71
+ } & {
72
+ categoryId: z.ZodString;
73
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
74
+ companyId: z.ZodString;
75
+ } & {
76
+ categoryId: z.ZodString;
77
+ }, z.ZodTypeAny, "passthrough">>;
78
+ readonly "catalog.inventory.adjusted": z.ZodObject<{
79
+ companyId: z.ZodString;
80
+ } & {
81
+ productId: z.ZodString;
82
+ variantId: z.ZodNullable<z.ZodString>;
83
+ delta: z.ZodNumber;
84
+ onHand: z.ZodNumber;
85
+ reason: z.ZodString;
86
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
87
+ companyId: z.ZodString;
88
+ } & {
89
+ productId: z.ZodString;
90
+ variantId: z.ZodNullable<z.ZodString>;
91
+ delta: z.ZodNumber;
92
+ onHand: z.ZodNumber;
93
+ reason: z.ZodString;
94
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
95
+ companyId: z.ZodString;
96
+ } & {
97
+ productId: z.ZodString;
98
+ variantId: z.ZodNullable<z.ZodString>;
99
+ delta: z.ZodNumber;
100
+ onHand: z.ZodNumber;
101
+ reason: z.ZodString;
102
+ }, z.ZodTypeAny, "passthrough">>;
103
+ readonly "catalog.inventory.low_stock": z.ZodObject<{
104
+ companyId: z.ZodString;
105
+ } & {
106
+ productId: z.ZodString;
107
+ variantId: z.ZodNullable<z.ZodString>;
108
+ onHand: z.ZodNumber;
109
+ threshold: z.ZodNumber;
110
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
111
+ companyId: z.ZodString;
112
+ } & {
113
+ productId: z.ZodString;
114
+ variantId: z.ZodNullable<z.ZodString>;
115
+ onHand: z.ZodNumber;
116
+ threshold: z.ZodNumber;
117
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
118
+ companyId: z.ZodString;
119
+ } & {
120
+ productId: z.ZodString;
121
+ variantId: z.ZodNullable<z.ZodString>;
122
+ onHand: z.ZodNumber;
123
+ threshold: z.ZodNumber;
124
+ }, z.ZodTypeAny, "passthrough">>;
125
+ };
126
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/events/catalog.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAC;AAGzC,iDAAiD;AACjD,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAIf,CAAC;AAKX,gDAAgD;AAChD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOjB,CAAC"}