@kernhq/module-inventory 0.2.0 → 0.3.0

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 (193) hide show
  1. package/README.md +104 -25
  2. package/dist/contract/capabilities.d.ts +4 -4
  3. package/dist/contract/capabilities.d.ts.map +1 -1
  4. package/dist/contract/capabilities.js +51 -9
  5. package/dist/contract/capabilities.js.map +1 -1
  6. package/dist/contract/events.d.ts +43 -0
  7. package/dist/contract/events.d.ts.map +1 -1
  8. package/dist/contract/events.js +40 -0
  9. package/dist/contract/events.js.map +1 -1
  10. package/dist/contract/index.d.ts +1 -0
  11. package/dist/contract/index.d.ts.map +1 -1
  12. package/dist/contract/index.js +1 -0
  13. package/dist/contract/index.js.map +1 -1
  14. package/dist/contract/models.d.ts +322 -0
  15. package/dist/contract/models.d.ts.map +1 -1
  16. package/dist/contract/models.js +213 -0
  17. package/dist/contract/models.js.map +1 -1
  18. package/dist/contract/notifications.d.ts +24 -0
  19. package/dist/contract/notifications.d.ts.map +1 -0
  20. package/dist/contract/notifications.js +72 -0
  21. package/dist/contract/notifications.js.map +1 -0
  22. package/dist/contract/permissions.d.ts +52 -2
  23. package/dist/contract/permissions.d.ts.map +1 -1
  24. package/dist/contract/permissions.js +55 -2
  25. package/dist/contract/permissions.js.map +1 -1
  26. package/dist/contract/router.d.ts +1052 -0
  27. package/dist/contract/router.d.ts.map +1 -1
  28. package/dist/contract/router.js +225 -1
  29. package/dist/contract/router.js.map +1 -1
  30. package/dist/contract/settings.d.ts +2 -0
  31. package/dist/contract/settings.d.ts.map +1 -1
  32. package/dist/contract/settings.js +24 -4
  33. package/dist/contract/settings.js.map +1 -1
  34. package/dist/server/index.d.ts +8 -4
  35. package/dist/server/index.d.ts.map +1 -1
  36. package/dist/server/index.js +289 -5
  37. package/dist/server/index.js.map +1 -1
  38. package/dist/server/jobs.d.ts +48 -0
  39. package/dist/server/jobs.d.ts.map +1 -0
  40. package/dist/server/jobs.js +358 -0
  41. package/dist/server/jobs.js.map +1 -0
  42. package/dist/server/router.d.ts +1337 -0
  43. package/dist/server/router.d.ts.map +1 -1
  44. package/dist/server/router.js +363 -7
  45. package/dist/server/router.js.map +1 -1
  46. package/dist/server/schema.d.ts +134 -1
  47. package/dist/server/schema.d.ts.map +1 -1
  48. package/dist/server/schema.js +158 -4
  49. package/dist/server/schema.js.map +1 -1
  50. package/dist/server/services/assets.d.ts +69 -3
  51. package/dist/server/services/assets.d.ts.map +1 -1
  52. package/dist/server/services/assets.js +199 -31
  53. package/dist/server/services/assets.js.map +1 -1
  54. package/dist/server/services/attachments.d.ts +80 -0
  55. package/dist/server/services/attachments.d.ts.map +1 -0
  56. package/dist/server/services/attachments.js +182 -0
  57. package/dist/server/services/attachments.js.map +1 -0
  58. package/dist/server/services/audience.d.ts +15 -0
  59. package/dist/server/services/audience.d.ts.map +1 -0
  60. package/dist/server/services/audience.js +64 -0
  61. package/dist/server/services/audience.js.map +1 -0
  62. package/dist/server/services/categories.d.ts +57 -0
  63. package/dist/server/services/categories.d.ts.map +1 -0
  64. package/dist/server/services/categories.js +124 -0
  65. package/dist/server/services/categories.js.map +1 -0
  66. package/dist/server/services/cursor.d.ts +68 -0
  67. package/dist/server/services/cursor.d.ts.map +1 -0
  68. package/dist/server/services/cursor.js +39 -0
  69. package/dist/server/services/cursor.js.map +1 -0
  70. package/dist/server/services/custody.d.ts +175 -0
  71. package/dist/server/services/custody.d.ts.map +1 -0
  72. package/dist/server/services/custody.js +367 -0
  73. package/dist/server/services/custody.js.map +1 -0
  74. package/dist/server/services/db-errors.d.ts +7 -0
  75. package/dist/server/services/db-errors.d.ts.map +1 -0
  76. package/dist/server/services/db-errors.js +32 -0
  77. package/dist/server/services/db-errors.js.map +1 -0
  78. package/dist/server/services/index.d.ts +16 -0
  79. package/dist/server/services/index.d.ts.map +1 -1
  80. package/dist/server/services/index.js +25 -1
  81. package/dist/server/services/index.js.map +1 -1
  82. package/dist/server/services/members.d.ts +27 -0
  83. package/dist/server/services/members.d.ts.map +1 -0
  84. package/dist/server/services/members.js +39 -0
  85. package/dist/server/services/members.js.map +1 -0
  86. package/dist/server/services/notify.d.ts +43 -1
  87. package/dist/server/services/notify.d.ts.map +1 -1
  88. package/dist/server/services/notify.js +47 -5
  89. package/dist/server/services/notify.js.map +1 -1
  90. package/dist/server/services/offboarding.d.ts +70 -0
  91. package/dist/server/services/offboarding.d.ts.map +1 -0
  92. package/dist/server/services/offboarding.js +116 -0
  93. package/dist/server/services/offboarding.js.map +1 -0
  94. package/dist/server/services/repairs.d.ts +204 -0
  95. package/dist/server/services/repairs.d.ts.map +1 -0
  96. package/dist/server/services/repairs.js +476 -0
  97. package/dist/server/services/repairs.js.map +1 -0
  98. package/dist/server/services/search.d.ts +85 -0
  99. package/dist/server/services/search.d.ts.map +1 -0
  100. package/dist/server/services/search.js +142 -0
  101. package/dist/server/services/search.js.map +1 -0
  102. package/dist/server/services/stats.d.ts +42 -0
  103. package/dist/server/services/stats.d.ts.map +1 -0
  104. package/dist/server/services/stats.js +80 -0
  105. package/dist/server/services/stats.js.map +1 -0
  106. package/dist/server/services/status.d.ts +102 -0
  107. package/dist/server/services/status.d.ts.map +1 -0
  108. package/dist/server/services/status.js +71 -0
  109. package/dist/server/services/status.js.map +1 -0
  110. package/migrations/0002_custody_and_categories.sql +23 -0
  111. package/migrations/0003_repairs.sql +23 -0
  112. package/migrations/0004_platform_surfaces.sql +51 -0
  113. package/migrations/0005_repair_dates.sql +35 -0
  114. package/migrations/0006_workspace_registry_read.sql +50 -0
  115. package/migrations/0007_history_sequence.sql +83 -0
  116. package/migrations/meta/0002_snapshot.json +1054 -0
  117. package/migrations/meta/0003_snapshot.json +1070 -0
  118. package/migrations/meta/0004_snapshot.json +1130 -0
  119. package/migrations/meta/0005_snapshot.json +1135 -0
  120. package/migrations/meta/_journal.json +42 -0
  121. package/package.json +1 -1
  122. package/src/client/api-instance.ts +27 -2
  123. package/src/client/bidi.test.ts +148 -0
  124. package/src/client/bidi.ts +85 -0
  125. package/src/client/components/AssetDetailPanel.svelte +614 -0
  126. package/src/client/components/AssetFormDialog.svelte +71 -22
  127. package/src/client/components/AssetPhoto.svelte +178 -0
  128. package/src/client/components/AttachmentsSection.svelte +327 -0
  129. package/src/client/components/CustodyDialog.svelte +201 -0
  130. package/src/client/components/RepairDialog.svelte +271 -0
  131. package/src/client/components/RepairsSection.svelte +318 -0
  132. package/src/client/components/Timeline.svelte +347 -0
  133. package/src/client/components/TimelineText.svelte +124 -0
  134. package/src/client/core-api.ts +71 -0
  135. package/src/client/custody.test.ts +31 -0
  136. package/src/client/custody.ts +34 -0
  137. package/src/client/errors.test.ts +365 -0
  138. package/src/client/errors.ts +201 -0
  139. package/src/client/links.test.ts +74 -0
  140. package/src/client/links.ts +44 -0
  141. package/src/client/members.test.ts +132 -0
  142. package/src/client/members.ts +116 -0
  143. package/src/client/messages.test.ts +127 -0
  144. package/src/client/messages.ts +1043 -18
  145. package/src/client/mock.test.ts +395 -1
  146. package/src/client/mock.ts +1066 -79
  147. package/src/client/module.ts +54 -0
  148. package/src/client/pages/AssetsPage.svelte +317 -45
  149. package/src/client/permissions.ts +7 -0
  150. package/src/client/price.test.ts +151 -3
  151. package/src/client/price.ts +155 -11
  152. package/src/client/query.ts +36 -0
  153. package/src/client/repairs.test.ts +38 -0
  154. package/src/client/repairs.ts +38 -0
  155. package/src/client/settings/CategoriesSettings.svelte +421 -0
  156. package/src/client/settings/GeneralSettings.svelte +0 -0
  157. package/src/client/status.ts +29 -0
  158. package/src/client/timeline.test.ts +175 -0
  159. package/src/client/timeline.ts +206 -0
  160. package/src/client/widgets/OverviewWidget.svelte +127 -26
  161. package/src/client/widgets/RepairsWidget.svelte +124 -0
  162. package/src/contract/capabilities.ts +53 -9
  163. package/src/contract/events.ts +49 -0
  164. package/src/contract/index.ts +1 -0
  165. package/src/contract/models.ts +237 -0
  166. package/src/contract/notifications.ts +73 -0
  167. package/src/contract/permissions.ts +55 -2
  168. package/src/contract/router.ts +255 -1
  169. package/src/contract/settings.ts +24 -4
  170. package/src/module.test.ts +194 -4
  171. package/src/server/index.ts +311 -4
  172. package/src/server/inventory.int.test.ts +3573 -18
  173. package/src/server/jobs.ts +444 -0
  174. package/src/server/migrations.test.ts +113 -0
  175. package/src/server/router.ts +462 -6
  176. package/src/server/schema.ts +160 -3
  177. package/src/server/services/assets.ts +214 -54
  178. package/src/server/services/attachments.ts +215 -0
  179. package/src/server/services/audience.ts +77 -0
  180. package/src/server/services/categories.ts +136 -0
  181. package/src/server/services/cursor.ts +104 -0
  182. package/src/server/services/custody.ts +471 -0
  183. package/src/server/services/db-errors.ts +42 -0
  184. package/src/server/services/index.ts +34 -1
  185. package/src/server/services/members.ts +54 -0
  186. package/src/server/services/notify.ts +52 -7
  187. package/src/server/services/offboarding.ts +150 -0
  188. package/src/server/services/repairs.ts +567 -0
  189. package/src/server/services/search.ts +166 -0
  190. package/src/server/services/stats.ts +88 -0
  191. package/src/server/services/status.test.ts +34 -0
  192. package/src/server/services/status.ts +143 -0
  193. package/src/client/settings/core-api.ts +0 -32
@@ -14,6 +14,12 @@ export declare const MODULE_ID = "inventory";
14
14
  *
15
15
  * Stored rather than derived, because every list filter asks for it — and kept in step inside the
16
16
  * same transaction that writes the row it derives from, never by a job afterwards.
17
+ *
18
+ * **`under_repair` belongs to the `repairs` capability**, so a workspace with that switch off never
19
+ * has an asset in it: the procedure that ends a repair answers 404 there, and a status nothing can
20
+ * move an item out of is a register the workspace cannot correct. The one thing a job does here is
21
+ * bring the rows *nobody touches* back into step after that switch moves, in both directions —
22
+ * `deriveStatus` in `src/server/services/status.ts` argues it, and nothing is destroyed either way.
17
23
  */
18
24
  export declare const AssetStatus: z.ZodEnum<{
19
25
  in_stock: "in_stock";
@@ -33,6 +39,76 @@ export type AssetStatus = z.infer<typeof AssetStatus>;
33
39
  */
34
40
  export declare const CustomValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
35
41
  export type CustomValues = z.infer<typeof CustomValues>;
42
+ /**
43
+ * A workspace's own grouping of what it owns — Laptops, Furniture, Cameras.
44
+ *
45
+ * Archived rather than deleted, and `archivedAt` is the whole reason: `assets.category_id` is a
46
+ * plain uuid with no foreign key, so a deleted category leaves every asset filed under it pointing
47
+ * at a row that is not there. The list column goes blank and the timeline entry that recorded the
48
+ * move loses the name it recorded. Archiving takes it out of every picker and every filter and
49
+ * leaves each asset able to say what it is.
50
+ */
51
+ export declare const Category: z.ZodObject<{
52
+ id: z.ZodUUID;
53
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
54
+ name: z.ZodString;
55
+ order: z.ZodNumber;
56
+ createdAt: z.ZodString;
57
+ updatedAt: z.ZodString;
58
+ archivedAt: z.ZodNullable<z.ZodString>;
59
+ }, z.core.$strip>;
60
+ export type Category = z.infer<typeof Category>;
61
+ export declare const CategoryInput: z.ZodObject<{
62
+ name: z.ZodString;
63
+ order: z.ZodOptional<z.ZodNumber>;
64
+ }, z.core.$strip>;
65
+ export type CategoryInput = z.infer<typeof CategoryInput>;
66
+ /**
67
+ * One stretch of time during which one person held one asset.
68
+ *
69
+ * Effective-dated, exactly as HR keeps employments: nothing is ever updated in place, a change
70
+ * closes the open row and inserts a new one. `effectiveTo === null` means "still holding it", and
71
+ * `inventory_custody_no_overlap` — a GiST exclusion constraint on
72
+ * `(asset_id =, tstzrange(effective_from, effective_to, '[)') &&)` — makes two of those for one
73
+ * asset impossible in the database rather than merely unlikely in the service.
74
+ */
75
+ export declare const CustodyPeriod: z.ZodObject<{
76
+ id: z.ZodUUID;
77
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
78
+ assetId: z.ZodUUID;
79
+ userId: z.ZodUUID;
80
+ note: z.ZodNullable<z.ZodString>;
81
+ effectiveFrom: z.ZodString;
82
+ effectiveTo: z.ZodNullable<z.ZodString>;
83
+ createdBy: z.ZodNullable<z.ZodUUID>;
84
+ createdAt: z.ZodString;
85
+ }, z.core.$strip>;
86
+ export type CustodyPeriod = z.infer<typeof CustodyPeriod>;
87
+ /**
88
+ * One entry in an asset's timeline.
89
+ *
90
+ * `action` is a **plain string, deliberately not an enum**. The rows are append-only and outlive
91
+ * the image that wrote them: an instance rolled back to a previous release would fail to parse its
92
+ * own history the moment a newer image had written an action the older enum does not list — a
93
+ * timeline that 500s rather than one that says a little less. The client renders a sentence per
94
+ * action it knows and a neutral one for anything else. What is written today is `created`,
95
+ * `updated`, `assigned`, `transferred`, `returned`, `retired`, `restored`, `repair_logged`,
96
+ * `repair_completed`, `attachment_added` and `attachment_removed`.
97
+ */
98
+ export declare const AssetHistoryEntry: z.ZodObject<{
99
+ id: z.ZodUUID;
100
+ assetId: z.ZodUUID;
101
+ actorId: z.ZodNullable<z.ZodUUID>;
102
+ action: z.ZodString;
103
+ changes: z.ZodArray<z.ZodObject<{
104
+ field: z.ZodString;
105
+ from: z.ZodUnknown;
106
+ to: z.ZodUnknown;
107
+ }, z.core.$strip>>;
108
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
109
+ occurredAt: z.ZodString;
110
+ }, z.core.$strip>;
111
+ export type AssetHistoryEntry = z.infer<typeof AssetHistoryEntry>;
36
112
  export declare const Asset: z.ZodObject<{
37
113
  id: z.ZodUUID;
38
114
  workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
@@ -64,6 +140,252 @@ export declare const Asset: z.ZodObject<{
64
140
  archivedAt: z.ZodNullable<z.ZodString>;
65
141
  }, z.core.$strip>;
66
142
  export type Asset = z.infer<typeof Asset>;
143
+ /**
144
+ * What a custody procedure answers with: the asset as it now stands, and the period this call
145
+ * opened.
146
+ *
147
+ * Both, because a screen needs both and fetching the asset again afterwards is a second round trip
148
+ * that can read a row somebody else has changed in between — the panel would then show a handover
149
+ * that has already been undone. `period` is null on a return: something closed, nothing opened.
150
+ */
151
+ export declare const CustodyResult: z.ZodObject<{
152
+ asset: z.ZodObject<{
153
+ id: z.ZodUUID;
154
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
155
+ code: z.ZodString;
156
+ name: z.ZodString;
157
+ description: z.ZodString;
158
+ categoryId: z.ZodNullable<z.ZodUUID>;
159
+ status: z.ZodEnum<{
160
+ in_stock: "in_stock";
161
+ assigned: "assigned";
162
+ reserved: "reserved";
163
+ under_repair: "under_repair";
164
+ lost: "lost";
165
+ retired: "retired";
166
+ }>;
167
+ custodianUserId: z.ZodNullable<z.ZodUUID>;
168
+ custodySince: z.ZodNullable<z.ZodString>;
169
+ serialNumber: z.ZodNullable<z.ZodString>;
170
+ location: z.ZodNullable<z.ZodString>;
171
+ purchasedOn: z.ZodNullable<z.ZodString>;
172
+ purchasedFrom: z.ZodNullable<z.ZodString>;
173
+ priceMinor: z.ZodNullable<z.ZodNumber>;
174
+ currency: z.ZodNullable<z.ZodString>;
175
+ warrantyUntil: z.ZodNullable<z.ZodString>;
176
+ photoFileId: z.ZodNullable<z.ZodUUID>;
177
+ custom: z.ZodRecord<z.ZodString, z.ZodUnknown>;
178
+ createdAt: z.ZodString;
179
+ updatedAt: z.ZodString;
180
+ archivedAt: z.ZodNullable<z.ZodString>;
181
+ }, z.core.$strip>;
182
+ period: z.ZodNullable<z.ZodObject<{
183
+ id: z.ZodUUID;
184
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
185
+ assetId: z.ZodUUID;
186
+ userId: z.ZodUUID;
187
+ note: z.ZodNullable<z.ZodString>;
188
+ effectiveFrom: z.ZodString;
189
+ effectiveTo: z.ZodNullable<z.ZodString>;
190
+ createdBy: z.ZodNullable<z.ZodUUID>;
191
+ createdAt: z.ZodString;
192
+ }, z.core.$strip>>;
193
+ }, z.core.$strip>;
194
+ export type CustodyResult = z.infer<typeof CustodyResult>;
195
+ /**
196
+ * One trip an item made to a repairer.
197
+ *
198
+ * `returnedOn === null` means it is still away, and that single fact is what puts the asset in
199
+ * `under_repair` — see `deriveStatus` in `src/server/services/status.ts`, which is the only place
200
+ * the three columns that drive a status are read together.
201
+ *
202
+ * **A repair is not custody, and neither one cancels the other.** A laptop assigned to Dan that goes
203
+ * to the repairer is still Dan's responsibility: the custody period stays open, `custodianUserId`
204
+ * stays set, and only `status` moves. That is why a repair does not touch custody and custody does
205
+ * not refuse a repaired item — the two answer different questions ("who is answerable for it" and
206
+ * "where is it"), and collapsing them would mean an item could not come back to the person who sent
207
+ * it.
208
+ */
209
+ export declare const Repair: z.ZodObject<{
210
+ id: z.ZodUUID;
211
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
212
+ assetId: z.ZodUUID;
213
+ summary: z.ZodString;
214
+ detail: z.ZodNullable<z.ZodString>;
215
+ vendor: z.ZodNullable<z.ZodString>;
216
+ costMinor: z.ZodNullable<z.ZodNumber>;
217
+ currency: z.ZodNullable<z.ZodString>;
218
+ sentOn: z.ZodString;
219
+ returnedOn: z.ZodNullable<z.ZodString>;
220
+ createdBy: z.ZodNullable<z.ZodUUID>;
221
+ createdAt: z.ZodString;
222
+ updatedAt: z.ZodString;
223
+ }, z.core.$strip>;
224
+ export type Repair = z.infer<typeof Repair>;
225
+ /**
226
+ * A repair in a list, with the two things a reader needs to know *which item* it is about.
227
+ *
228
+ * **Joined at read time, never stored here.** `mod_inventory.repairs` holds no asset name, so
229
+ * renaming an asset renames it everywhere at once — a copied label is a label that goes stale, and
230
+ * this module already refuses to copy a person's name for the same reason. The join is inside one
231
+ * schema, which is the kind a module is allowed to make; the kind it is not is a join across the
232
+ * boundary into another module's tables.
233
+ *
234
+ * It extends `Repair` rather than replacing it, so a component that renders a repair renders one of
235
+ * these without knowing the difference. `create`, `update` and `complete` answer with a plain
236
+ * `Repair`: the caller of those already knows which asset it asked about.
237
+ */
238
+ export declare const RepairListItem: z.ZodObject<{
239
+ id: z.ZodUUID;
240
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
241
+ assetId: z.ZodUUID;
242
+ summary: z.ZodString;
243
+ detail: z.ZodNullable<z.ZodString>;
244
+ vendor: z.ZodNullable<z.ZodString>;
245
+ costMinor: z.ZodNullable<z.ZodNumber>;
246
+ currency: z.ZodNullable<z.ZodString>;
247
+ sentOn: z.ZodString;
248
+ returnedOn: z.ZodNullable<z.ZodString>;
249
+ createdBy: z.ZodNullable<z.ZodUUID>;
250
+ createdAt: z.ZodString;
251
+ updatedAt: z.ZodString;
252
+ assetCode: z.ZodString;
253
+ assetName: z.ZodString;
254
+ }, z.core.$strip>;
255
+ export type RepairListItem = z.infer<typeof RepairListItem>;
256
+ /**
257
+ * Everything a person can say about a repair.
258
+ *
259
+ * **No field here carries `.default()`, for the reason `AssetInput` spells out**: `update` is built
260
+ * from `.partial()`, and `.partial()` does not strip a default — zod still substitutes it for a key
261
+ * the request never sent, so a patch that renames a repair would silently re-date it. `sentOn` is
262
+ * optional rather than defaulted for the same reason; `repairs.create` fills today's date on the
263
+ * server, which is the only clock this module trusts.
264
+ */
265
+ export declare const RepairInput: z.ZodObject<{
266
+ summary: z.ZodString;
267
+ detail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
268
+ vendor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
269
+ costMinor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
270
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
271
+ sentOn: z.ZodOptional<z.ZodISODate>;
272
+ }, z.core.$strip>;
273
+ export type RepairInput = z.infer<typeof RepairInput>;
274
+ export declare const RepairPatchInput: z.ZodObject<{
275
+ summary: z.ZodOptional<z.ZodString>;
276
+ detail: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
277
+ vendor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
278
+ costMinor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
279
+ currency: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
280
+ sentOn: z.ZodOptional<z.ZodOptional<z.ZodISODate>>;
281
+ }, z.core.$strip>;
282
+ export type RepairPatchInput = z.infer<typeof RepairPatchInput>;
283
+ /**
284
+ * What a repair mutation answers with: the repair, and the asset as it now stands.
285
+ *
286
+ * Both, for the reason `CustodyResult` carries both — sending an item away moves `assets.status`,
287
+ * and a screen that had to fetch the asset again afterwards would be reading a row somebody else
288
+ * may have changed in between.
289
+ */
290
+ export declare const RepairResult: z.ZodObject<{
291
+ repair: z.ZodObject<{
292
+ id: z.ZodUUID;
293
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
294
+ assetId: z.ZodUUID;
295
+ summary: z.ZodString;
296
+ detail: z.ZodNullable<z.ZodString>;
297
+ vendor: z.ZodNullable<z.ZodString>;
298
+ costMinor: z.ZodNullable<z.ZodNumber>;
299
+ currency: z.ZodNullable<z.ZodString>;
300
+ sentOn: z.ZodString;
301
+ returnedOn: z.ZodNullable<z.ZodString>;
302
+ createdBy: z.ZodNullable<z.ZodUUID>;
303
+ createdAt: z.ZodString;
304
+ updatedAt: z.ZodString;
305
+ }, z.core.$strip>;
306
+ asset: z.ZodObject<{
307
+ id: z.ZodUUID;
308
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
309
+ code: z.ZodString;
310
+ name: z.ZodString;
311
+ description: z.ZodString;
312
+ categoryId: z.ZodNullable<z.ZodUUID>;
313
+ status: z.ZodEnum<{
314
+ in_stock: "in_stock";
315
+ assigned: "assigned";
316
+ reserved: "reserved";
317
+ under_repair: "under_repair";
318
+ lost: "lost";
319
+ retired: "retired";
320
+ }>;
321
+ custodianUserId: z.ZodNullable<z.ZodUUID>;
322
+ custodySince: z.ZodNullable<z.ZodString>;
323
+ serialNumber: z.ZodNullable<z.ZodString>;
324
+ location: z.ZodNullable<z.ZodString>;
325
+ purchasedOn: z.ZodNullable<z.ZodString>;
326
+ purchasedFrom: z.ZodNullable<z.ZodString>;
327
+ priceMinor: z.ZodNullable<z.ZodNumber>;
328
+ currency: z.ZodNullable<z.ZodString>;
329
+ warrantyUntil: z.ZodNullable<z.ZodString>;
330
+ photoFileId: z.ZodNullable<z.ZodUUID>;
331
+ custom: z.ZodRecord<z.ZodString, z.ZodUnknown>;
332
+ createdAt: z.ZodString;
333
+ updatedAt: z.ZodString;
334
+ archivedAt: z.ZodNullable<z.ZodString>;
335
+ }, z.core.$strip>;
336
+ }, z.core.$strip>;
337
+ export type RepairResult = z.infer<typeof RepairResult>;
338
+ /**
339
+ * A file recorded against an asset — a receipt, a warranty card, a manual.
340
+ *
341
+ * **The bytes are core's, not this module's.** A module does not upload: the browser uploads through
342
+ * core's file service and hands this module the id it was given, and reading one back is a download
343
+ * URL core signs. All that lives here is the fact that this asset has that file, plus the name and
344
+ * size copied at attach time so a list can be drawn without asking core once per row.
345
+ *
346
+ * `repairId` is what separates "the invoice for the screen replacement" from "the purchase receipt":
347
+ * null means it belongs to the asset itself.
348
+ */
349
+ export declare const Attachment: z.ZodObject<{
350
+ id: z.ZodUUID;
351
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
352
+ assetId: z.ZodUUID;
353
+ repairId: z.ZodNullable<z.ZodUUID>;
354
+ fileId: z.ZodUUID;
355
+ name: z.ZodString;
356
+ mimeType: z.ZodNullable<z.ZodString>;
357
+ size: z.ZodNullable<z.ZodNumber>;
358
+ uploadedBy: z.ZodNullable<z.ZodUUID>;
359
+ createdAt: z.ZodString;
360
+ }, z.core.$strip>;
361
+ export type Attachment = z.infer<typeof Attachment>;
362
+ /**
363
+ * The register in numbers: what a page's count line and a dashboard card need in one request.
364
+ *
365
+ * `total` counts what the list shows by default — live rows — and `archived` is beside it rather
366
+ * than inside it, because a count line that silently included archived rows would disagree with the
367
+ * list under it.
368
+ *
369
+ * **`outForRepair` is null when the workspace does not track repairs.** Zero would be a claim
370
+ * ("nothing is away"), and a workspace with the `repairs` capability off has not made that claim —
371
+ * it has no opinion at all. The screens show the tile only when a number arrives, which is the same
372
+ * rule as hiding the Repairs tab, expressed in the data instead of in a second capability lookup.
373
+ */
374
+ export declare const InventoryStats: z.ZodObject<{
375
+ total: z.ZodNumber;
376
+ archived: z.ZodNumber;
377
+ byStatus: z.ZodRecord<z.ZodEnum<{
378
+ in_stock: "in_stock";
379
+ assigned: "assigned";
380
+ reserved: "reserved";
381
+ under_repair: "under_repair";
382
+ lost: "lost";
383
+ retired: "retired";
384
+ }>, z.ZodNumber>;
385
+ outForRepair: z.ZodNullable<z.ZodNumber>;
386
+ unassigned: z.ZodNumber;
387
+ }, z.core.$strip>;
388
+ export type InventoryStats = z.infer<typeof InventoryStats>;
67
389
  /**
68
390
  * How a list is ordered, and therefore what a page cursor is a bookmark *into*.
69
391
  *
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/contract/models.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;GAKG;AAEH,wGAAwG;AACxG,eAAO,MAAM,SAAS,cAAc,CAAA;AAEpC;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;;;;;;EAAkF,CAAA;AAC1G,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AAErD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,wCAAoC,CAAA;AAC7D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAEvD,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BhB,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAA;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,SAAS;;;;EAAqC,CAAA;AAC3D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAEjD;;;;;;;;;;;GAWG;AACH,eAAO,M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AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGvB,CAAA;AACF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAEvD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;iBAYrB,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAA;AAEnD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;iBAQzB,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAE3D;;;;;;GAMG;AACH,eAAO,MAAM,SAAS;;;;EAAqC,CAAA;AAC3D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAEjD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;iBAerB,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAA;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;iBAE3B,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE/D,6FAA6F;AAC7F,eAAO,MAAM,eAAe;;;;;;;;;;;;iBAAuB,CAAA;AACnD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAE7D,wEAAwE;AACxE,eAAO,MAAM,EAAE;;iBAAyC,CAAA"}
@@ -15,6 +15,12 @@ export const MODULE_ID = 'inventory';
15
15
  *
16
16
  * Stored rather than derived, because every list filter asks for it — and kept in step inside the
17
17
  * same transaction that writes the row it derives from, never by a job afterwards.
18
+ *
19
+ * **`under_repair` belongs to the `repairs` capability**, so a workspace with that switch off never
20
+ * has an asset in it: the procedure that ends a repair answers 404 there, and a status nothing can
21
+ * move an item out of is a register the workspace cannot correct. The one thing a job does here is
22
+ * bring the rows *nobody touches* back into step after that switch moves, in both directions —
23
+ * `deriveStatus` in `src/server/services/status.ts` argues it, and nothing is destroyed either way.
18
24
  */
19
25
  export const AssetStatus = z.enum(['in_stock', 'assigned', 'reserved', 'under_repair', 'lost', 'retired']);
20
26
  /**
@@ -25,6 +31,78 @@ export const AssetStatus = z.enum(['in_stock', 'assigned', 'reserved', 'under_re
25
31
  * it against `field_defs` before writing.
26
32
  */
27
33
  export const CustomValues = z.record(z.string(), z.unknown());
34
+ /**
35
+ * A workspace's own grouping of what it owns — Laptops, Furniture, Cameras.
36
+ *
37
+ * Archived rather than deleted, and `archivedAt` is the whole reason: `assets.category_id` is a
38
+ * plain uuid with no foreign key, so a deleted category leaves every asset filed under it pointing
39
+ * at a row that is not there. The list column goes blank and the timeline entry that recorded the
40
+ * move loses the name it recorded. Archiving takes it out of every picker and every filter and
41
+ * leaves each asset able to say what it is.
42
+ */
43
+ export const Category = z.object({
44
+ id: z.uuid(),
45
+ workspaceId: WorkspaceId,
46
+ name: z.string().min(1).max(120),
47
+ /** Where it sits in a picker. Equal orders fall back to the name, so a workspace that never
48
+ * reorders anything still gets an alphabetical list rather than an arbitrary one. */
49
+ order: z.number().int(),
50
+ createdAt: z.string(),
51
+ updatedAt: z.string(),
52
+ archivedAt: z.string().nullable(),
53
+ });
54
+ export const CategoryInput = z.object({
55
+ name: z.string().trim().min(1).max(120),
56
+ order: z.number().int().min(0).max(9999).optional(),
57
+ });
58
+ /**
59
+ * One stretch of time during which one person held one asset.
60
+ *
61
+ * Effective-dated, exactly as HR keeps employments: nothing is ever updated in place, a change
62
+ * closes the open row and inserts a new one. `effectiveTo === null` means "still holding it", and
63
+ * `inventory_custody_no_overlap` — a GiST exclusion constraint on
64
+ * `(asset_id =, tstzrange(effective_from, effective_to, '[)') &&)` — makes two of those for one
65
+ * asset impossible in the database rather than merely unlikely in the service.
66
+ */
67
+ export const CustodyPeriod = z.object({
68
+ id: z.uuid(),
69
+ workspaceId: WorkspaceId,
70
+ assetId: z.uuid(),
71
+ /**
72
+ * The member who held it. A plain uuid — a cross-schema foreign key is what the module boundary
73
+ * exists to prevent — resolved against core membership at read time, which is also why a person
74
+ * who has since left the workspace still has readable history.
75
+ */
76
+ userId: z.uuid(),
77
+ note: z.string().max(500).nullable(),
78
+ effectiveFrom: z.string(),
79
+ effectiveTo: z.string().nullable(),
80
+ /** Who did the handing over, which is not always who received it. */
81
+ createdBy: z.uuid().nullable(),
82
+ createdAt: z.string(),
83
+ });
84
+ /**
85
+ * One entry in an asset's timeline.
86
+ *
87
+ * `action` is a **plain string, deliberately not an enum**. The rows are append-only and outlive
88
+ * the image that wrote them: an instance rolled back to a previous release would fail to parse its
89
+ * own history the moment a newer image had written an action the older enum does not list — a
90
+ * timeline that 500s rather than one that says a little less. The client renders a sentence per
91
+ * action it knows and a neutral one for anything else. What is written today is `created`,
92
+ * `updated`, `assigned`, `transferred`, `returned`, `retired`, `restored`, `repair_logged`,
93
+ * `repair_completed`, `attachment_added` and `attachment_removed`.
94
+ */
95
+ export const AssetHistoryEntry = z.object({
96
+ id: z.uuid(),
97
+ assetId: z.uuid(),
98
+ /** Null for anything the platform did rather than a person. */
99
+ actorId: z.uuid().nullable(),
100
+ action: z.string().max(40),
101
+ changes: z.array(z.object({ field: z.string(), from: z.unknown(), to: z.unknown() })),
102
+ /** Action-specific ids — who received an item, who handed it over. Never a row. */
103
+ data: z.record(z.string(), z.unknown()),
104
+ occurredAt: z.string(),
105
+ });
28
106
  export const Asset = z.object({
29
107
  id: z.uuid(),
30
108
  workspaceId: WorkspaceId,
@@ -54,6 +132,141 @@ export const Asset = z.object({
54
132
  updatedAt: z.string(),
55
133
  archivedAt: z.string().nullable(),
56
134
  });
135
+ /**
136
+ * What a custody procedure answers with: the asset as it now stands, and the period this call
137
+ * opened.
138
+ *
139
+ * Both, because a screen needs both and fetching the asset again afterwards is a second round trip
140
+ * that can read a row somebody else has changed in between — the panel would then show a handover
141
+ * that has already been undone. `period` is null on a return: something closed, nothing opened.
142
+ */
143
+ export const CustodyResult = z.object({
144
+ asset: Asset,
145
+ period: CustodyPeriod.nullable(),
146
+ });
147
+ /**
148
+ * One trip an item made to a repairer.
149
+ *
150
+ * `returnedOn === null` means it is still away, and that single fact is what puts the asset in
151
+ * `under_repair` — see `deriveStatus` in `src/server/services/status.ts`, which is the only place
152
+ * the three columns that drive a status are read together.
153
+ *
154
+ * **A repair is not custody, and neither one cancels the other.** A laptop assigned to Dan that goes
155
+ * to the repairer is still Dan's responsibility: the custody period stays open, `custodianUserId`
156
+ * stays set, and only `status` moves. That is why a repair does not touch custody and custody does
157
+ * not refuse a repaired item — the two answer different questions ("who is answerable for it" and
158
+ * "where is it"), and collapsing them would mean an item could not come back to the person who sent
159
+ * it.
160
+ */
161
+ export const Repair = z.object({
162
+ id: z.uuid(),
163
+ workspaceId: WorkspaceId,
164
+ assetId: z.uuid(),
165
+ summary: z.string().min(1).max(200),
166
+ detail: z.string().max(4000).nullable(),
167
+ vendor: z.string().max(200).nullable(),
168
+ /** Minor units, like `Asset.priceMinor` — one convention for money across the module. */
169
+ costMinor: z.number().int().nullable(),
170
+ currency: z.string().length(3).nullable(),
171
+ sentOn: z.string(),
172
+ /** Null while it is still away. Set by `repairs.complete` and by nothing else. */
173
+ returnedOn: z.string().nullable(),
174
+ createdBy: z.uuid().nullable(),
175
+ createdAt: z.string(),
176
+ updatedAt: z.string(),
177
+ });
178
+ /**
179
+ * A repair in a list, with the two things a reader needs to know *which item* it is about.
180
+ *
181
+ * **Joined at read time, never stored here.** `mod_inventory.repairs` holds no asset name, so
182
+ * renaming an asset renames it everywhere at once — a copied label is a label that goes stale, and
183
+ * this module already refuses to copy a person's name for the same reason. The join is inside one
184
+ * schema, which is the kind a module is allowed to make; the kind it is not is a join across the
185
+ * boundary into another module's tables.
186
+ *
187
+ * It extends `Repair` rather than replacing it, so a component that renders a repair renders one of
188
+ * these without knowing the difference. `create`, `update` and `complete` answer with a plain
189
+ * `Repair`: the caller of those already knows which asset it asked about.
190
+ */
191
+ export const RepairListItem = Repair.extend({
192
+ assetCode: z.string().min(1).max(40),
193
+ assetName: z.string().min(1).max(200),
194
+ });
195
+ /**
196
+ * Everything a person can say about a repair.
197
+ *
198
+ * **No field here carries `.default()`, for the reason `AssetInput` spells out**: `update` is built
199
+ * from `.partial()`, and `.partial()` does not strip a default — zod still substitutes it for a key
200
+ * the request never sent, so a patch that renames a repair would silently re-date it. `sentOn` is
201
+ * optional rather than defaulted for the same reason; `repairs.create` fills today's date on the
202
+ * server, which is the only clock this module trusts.
203
+ */
204
+ export const RepairInput = z.object({
205
+ summary: z.string().trim().min(1).max(200),
206
+ detail: z.string().max(4000).nullish(),
207
+ vendor: z.string().max(200).nullish(),
208
+ costMinor: z.number().int().min(0).nullish(),
209
+ currency: z.string().length(3).nullish(),
210
+ /** `sent_on` is `not null` in the database, so this is optional but never nullable. */
211
+ sentOn: z.iso.date().optional(),
212
+ });
213
+ export const RepairPatchInput = RepairInput.partial();
214
+ /**
215
+ * What a repair mutation answers with: the repair, and the asset as it now stands.
216
+ *
217
+ * Both, for the reason `CustodyResult` carries both — sending an item away moves `assets.status`,
218
+ * and a screen that had to fetch the asset again afterwards would be reading a row somebody else
219
+ * may have changed in between.
220
+ */
221
+ export const RepairResult = z.object({
222
+ repair: Repair,
223
+ asset: Asset,
224
+ });
225
+ /**
226
+ * A file recorded against an asset — a receipt, a warranty card, a manual.
227
+ *
228
+ * **The bytes are core's, not this module's.** A module does not upload: the browser uploads through
229
+ * core's file service and hands this module the id it was given, and reading one back is a download
230
+ * URL core signs. All that lives here is the fact that this asset has that file, plus the name and
231
+ * size copied at attach time so a list can be drawn without asking core once per row.
232
+ *
233
+ * `repairId` is what separates "the invoice for the screen replacement" from "the purchase receipt":
234
+ * null means it belongs to the asset itself.
235
+ */
236
+ export const Attachment = z.object({
237
+ id: z.uuid(),
238
+ workspaceId: WorkspaceId,
239
+ assetId: z.uuid(),
240
+ repairId: z.uuid().nullable(),
241
+ fileId: z.uuid(),
242
+ name: z.string().max(300),
243
+ mimeType: z.string().max(200).nullable(),
244
+ /** Bytes, as core reported them when the file was attached. */
245
+ size: z.number().int().nullable(),
246
+ uploadedBy: z.uuid().nullable(),
247
+ createdAt: z.string(),
248
+ });
249
+ /**
250
+ * The register in numbers: what a page's count line and a dashboard card need in one request.
251
+ *
252
+ * `total` counts what the list shows by default — live rows — and `archived` is beside it rather
253
+ * than inside it, because a count line that silently included archived rows would disagree with the
254
+ * list under it.
255
+ *
256
+ * **`outForRepair` is null when the workspace does not track repairs.** Zero would be a claim
257
+ * ("nothing is away"), and a workspace with the `repairs` capability off has not made that claim —
258
+ * it has no opinion at all. The screens show the tile only when a number arrives, which is the same
259
+ * rule as hiding the Repairs tab, expressed in the data instead of in a second capability lookup.
260
+ */
261
+ export const InventoryStats = z.object({
262
+ total: z.number().int().nonnegative(),
263
+ archived: z.number().int().nonnegative(),
264
+ /** Every status, zero-filled, so a screen can render the set without knowing which exist. */
265
+ byStatus: z.record(AssetStatus, z.number().int().nonnegative()),
266
+ outForRepair: z.number().int().nonnegative().nullable(),
267
+ /** Live assets nobody is holding — what is actually available to hand out. */
268
+ unassigned: z.number().int().nonnegative(),
269
+ });
57
270
  /**
58
271
  * How a list is ordered, and therefore what a page cursor is a bookmark *into*.
59
272
  *
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/contract/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;GAKG;AAEH,wGAAwG;AACxG,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAA;AAEpC;;;;;;;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FAA4F;IAC5F,0FAA0F;CAC3F,CAAC,CAAA;AAGF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAC;IAChD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAC9C,CAAC,CAAA;AAGF,6FAA6F;AAC7F,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,EAAE,CAAA;AAGnD,wEAAwE;AACxE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAA"}
@@ -0,0 +1,24 @@
1
+ import type { core } from '@kernhq/contracts';
2
+ /**
3
+ * What Inventory will interrupt somebody about.
4
+ *
5
+ * Four things, and each of them changes what somebody has to *do*. That is the test: a rename, a new
6
+ * category, an item coming back — those are facts a screen shows when somebody looks, and a
7
+ * notification type nobody wants is a notification type everybody switches off along with the one
8
+ * that mattered.
9
+ *
10
+ * A type declared here and never sent is the same lie as a permission nothing checks. Each of these
11
+ * names its sender, and every one of them exists:
12
+ *
13
+ * - `custody.assigned` — `CustodyService`, on `assign` and `transfer`.
14
+ * - `warranty.expiring` — the `warranty-sweep` job, once per asset.
15
+ * - `repair.overdue` — the `repair-overdue` job, once per repair.
16
+ * - `custody.return_due` — the offboarding subscription, when HR says somebody has left or core says
17
+ * they have been removed from the workspace.
18
+ *
19
+ * The keys keep their `inventory.custody.*` spelling rather than being renamed to
20
+ * `inventory.asset.*`: a notification type is the key a person's own preferences are stored under,
21
+ * so renaming one silently resets everybody who had switched it off.
22
+ */
23
+ export declare const inventoryNotificationTypes: core.NotificationTypeDef[];
24
+ //# sourceMappingURL=notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/contract/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,0BAA0B,EAAE,IAAI,CAAC,mBAAmB,EAiDhE,CAAA"}