@kernhq/module-inventory 0.2.0 → 0.4.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 (198) hide show
  1. package/README.md +106 -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 +345 -0
  15. package/dist/contract/models.d.ts.map +1 -1
  16. package/dist/contract/models.js +245 -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 +1108 -0
  27. package/dist/contract/router.d.ts.map +1 -1
  28. package/dist/contract/router.js +253 -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 +1392 -0
  43. package/dist/server/router.d.ts.map +1 -1
  44. package/dist/server/router.js +385 -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 +169 -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 +157 -0
  63. package/dist/server/services/categories.d.ts.map +1 -0
  64. package/dist/server/services/categories.js +309 -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/0008_category_order_unique.sql +71 -0
  117. package/migrations/meta/0002_snapshot.json +1054 -0
  118. package/migrations/meta/0003_snapshot.json +1070 -0
  119. package/migrations/meta/0004_snapshot.json +1130 -0
  120. package/migrations/meta/0005_snapshot.json +1135 -0
  121. package/migrations/meta/_journal.json +49 -0
  122. package/package.json +2 -1
  123. package/src/client/api-instance.ts +27 -2
  124. package/src/client/bidi.test.ts +148 -0
  125. package/src/client/bidi.ts +85 -0
  126. package/src/client/components/AssetDetailPanel.svelte +614 -0
  127. package/src/client/components/AssetFormDialog.svelte +71 -22
  128. package/src/client/components/AssetPhoto.svelte +178 -0
  129. package/src/client/components/AttachmentsSection.svelte +327 -0
  130. package/src/client/components/CustodyDialog.svelte +201 -0
  131. package/src/client/components/RepairDialog.svelte +271 -0
  132. package/src/client/components/RepairsSection.svelte +318 -0
  133. package/src/client/components/Timeline.svelte +347 -0
  134. package/src/client/components/TimelineText.svelte +124 -0
  135. package/src/client/core-api.ts +71 -0
  136. package/src/client/custody.test.ts +31 -0
  137. package/src/client/custody.ts +34 -0
  138. package/src/client/errors.test.ts +395 -0
  139. package/src/client/errors.ts +229 -0
  140. package/src/client/links.test.ts +74 -0
  141. package/src/client/links.ts +44 -0
  142. package/src/client/members.test.ts +132 -0
  143. package/src/client/members.ts +116 -0
  144. package/src/client/messages.test.ts +127 -0
  145. package/src/client/messages.ts +1106 -18
  146. package/src/client/mock.test.ts +465 -1
  147. package/src/client/mock.ts +1105 -79
  148. package/src/client/module.ts +73 -1
  149. package/src/client/pages/AssetsPage.svelte +317 -45
  150. package/src/client/permissions.ts +7 -0
  151. package/src/client/price.test.ts +151 -3
  152. package/src/client/price.ts +155 -11
  153. package/src/client/query.ts +36 -0
  154. package/src/client/reorder.test.ts +100 -0
  155. package/src/client/reorder.ts +79 -0
  156. package/src/client/repairs.test.ts +38 -0
  157. package/src/client/repairs.ts +38 -0
  158. package/src/client/sequence.test.ts +248 -0
  159. package/src/client/sequence.ts +185 -0
  160. package/src/client/settings/CategoriesSettings.svelte +746 -0
  161. package/src/client/settings/GeneralSettings.svelte +0 -0
  162. package/src/client/status.ts +29 -0
  163. package/src/client/timeline.test.ts +175 -0
  164. package/src/client/timeline.ts +206 -0
  165. package/src/client/widgets/OverviewWidget.svelte +127 -26
  166. package/src/client/widgets/RepairsWidget.svelte +124 -0
  167. package/src/contract/capabilities.ts +53 -9
  168. package/src/contract/events.ts +49 -0
  169. package/src/contract/index.ts +1 -0
  170. package/src/contract/models.ts +270 -0
  171. package/src/contract/notifications.ts +73 -0
  172. package/src/contract/permissions.ts +55 -2
  173. package/src/contract/router.ts +284 -1
  174. package/src/contract/settings.ts +24 -4
  175. package/src/module.test.ts +217 -4
  176. package/src/server/index.ts +311 -4
  177. package/src/server/inventory.int.test.ts +4109 -19
  178. package/src/server/jobs.ts +444 -0
  179. package/src/server/migrations.test.ts +253 -2
  180. package/src/server/router.ts +486 -6
  181. package/src/server/schema.ts +171 -3
  182. package/src/server/services/assets.ts +214 -54
  183. package/src/server/services/attachments.ts +215 -0
  184. package/src/server/services/audience.ts +77 -0
  185. package/src/server/services/categories.ts +337 -0
  186. package/src/server/services/cursor.ts +104 -0
  187. package/src/server/services/custody.ts +471 -0
  188. package/src/server/services/db-errors.ts +42 -0
  189. package/src/server/services/index.ts +34 -1
  190. package/src/server/services/members.ts +54 -0
  191. package/src/server/services/notify.ts +52 -7
  192. package/src/server/services/offboarding.ts +150 -0
  193. package/src/server/services/repairs.ts +567 -0
  194. package/src/server/services/search.ts +166 -0
  195. package/src/server/services/stats.ts +88 -0
  196. package/src/server/services/status.test.ts +34 -0
  197. package/src/server/services/status.ts +143 -0
  198. package/src/client/settings/core-api.ts +0 -32
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/server/router.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,KAAK,MAAM,EACX,cAAc,EACd,KAAK,cAAc,EAIpB,MAAM,gBAAgB,CAAA;AAMvB;;;;;;;;;;GAUG;AACH,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAA;AAI3D,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgjB7C"}
@@ -1,8 +1,13 @@
1
- import { defineModule, defineServerModule, packageVersion, requires, workspaceScoped, } from '@kernhq/kernel';
1
+ import { defineModule, defineServerModule, packageVersion, requires, requiresCapability, workspaceScoped, } from '@kernhq/kernel';
2
2
  import { implement } from '@orpc/server';
3
3
  import { inventoryContract, inventoryEvents, MODULE_ID } from '../contract/index.js';
4
4
  import { toAsset } from './services/assets.js';
5
+ import { toAttachment } from './services/attachments.js';
6
+ import { toCategory } from './services/categories.js';
7
+ import { toCustodyPeriod } from './services/custody.js';
5
8
  import { inventoryServices } from './services/index.js';
9
+ import { requireWorkspaceMember } from './services/members.js';
10
+ import { toRepair } from './services/repairs.js';
6
11
  /**
7
12
  * oRPC router for `/api/inventory`.
8
13
  *
@@ -19,14 +24,28 @@ const os = implement(inventoryContract).$context();
19
24
  export function inventoryRouter(kernel) {
20
25
  const svc = inventoryServices(kernel);
21
26
  const scoped = os.use(workspaceScoped(MODULE_ID));
27
+ /**
28
+ * The capability gate, between the workspace gate and the permission check.
29
+ *
30
+ * That order is the whole point: a workspace with Inventory switched off is refused before
31
+ * anything reveals which capabilities it would have had, and a workspace with `repairs` off
32
+ * answers **404** rather than 403 — the surface is not part of its API, so it answers like
33
+ * anything else that is not there. `module.test.ts` checks the identity and the position of all
34
+ * three, because a missing one is invisible to `tsc`.
35
+ */
36
+ const cap = (id) => requiresCapability(MODULE_ID, id);
22
37
  /**
23
38
  * Everything a write announces, once the transaction that wrote it has actually committed.
24
39
  *
25
- * Three things, and all three are after the commit on purpose: the core activity feed's copy of
26
- * the history row, the event for whatever reacts later, and the realtime change that redraws a
27
- * screen somebody is looking at now. A mutation that skips them leaves the product believing the
28
- * old answer; a mutation that fires them *inside* the transaction tells the rest of the instance
29
- * about a row a rollback then took away, which is worse — it cannot be retracted.
40
+ * Four things, and all four are after the commit on purpose: the core activity feed's copy of the
41
+ * history row, the event for whatever reacts later, the realtime change that redraws a screen
42
+ * somebody is looking at now, and the search index. A mutation that skips them leaves the product
43
+ * believing the old answer; a mutation that fires them *inside* the transaction tells the rest of
44
+ * the instance about a row a rollback then took away, which is worse — it cannot be retracted.
45
+ *
46
+ * `reindex` needs no direction argument: it re-reads the row, and an archived one comes back as
47
+ * `null`, which is what takes it out of the index. So archive and restore are the same call here,
48
+ * exactly as they are the same procedure.
30
49
  */
31
50
  const announce = async (workspaceId, written, event, op, actorId) => {
32
51
  const assetId = written.row.id;
@@ -34,9 +53,105 @@ export function inventoryRouter(kernel) {
34
53
  await svc.notify.activity(written.activity);
35
54
  await kernel.emit(event, { assetId, workspaceId }, { workspaceId, actorId: actorId ?? undefined });
36
55
  await svc.notify.change(workspaceId, 'asset', assetId, op);
56
+ await svc.search.reindex(workspaceId, assetId);
57
+ };
58
+ /**
59
+ * The same three, plus the one interruption this module makes.
60
+ *
61
+ * Custody is announced as a change to the **asset** rather than to a custody entity, and that is
62
+ * deliberate: `src/client/query.ts` keys the timeline and the period list under the asset's own
63
+ * prefix, so one `entity: 'asset'` invalidates the row, the list, the panel and both of its tabs.
64
+ * A second entity name would need a second subscription for no gain.
65
+ */
66
+ const announceCustody = async (workspaceId, written, actorId) => {
67
+ const assetId = written.asset.id;
68
+ await svc.notify.activity(written.activity);
69
+ await kernel.emit(inventoryEvents.custodyChanged, {
70
+ assetId,
71
+ workspaceId,
72
+ userId: written.userId,
73
+ previousUserId: written.previousUserId,
74
+ }, { workspaceId, actorId: actorId ?? undefined });
75
+ await svc.notify.change(workspaceId, 'asset', assetId, 'updated');
76
+ // The document carries `custodianUserId` and `status`, and both just moved.
77
+ await svc.search.reindex(workspaceId, assetId);
78
+ if (written.notifyUserId)
79
+ await svc.notify.notify({
80
+ workspaceId,
81
+ userIds: [written.notifyUserId],
82
+ type: 'inventory.custody.assigned',
83
+ // The tag first, because that is what is printed on the sticker the person is looking for.
84
+ title: `${written.asset.code} was handed to you`,
85
+ body: written.asset.name,
86
+ object: { module: MODULE_ID, type: 'asset', id: assetId },
87
+ url: `/inventory?asset=${assetId}`,
88
+ groupKey: assetId,
89
+ actorId,
90
+ exclude: [actorId],
91
+ });
92
+ };
93
+ /**
94
+ * A repair's three, and the second entity it has to invalidate.
95
+ *
96
+ * `entity: 'asset'` refreshes the panel, the row and the list — the query keys hang the asset's
97
+ * repairs one segment under the asset's own key for exactly that reason. The workspace-wide
98
+ * repair list (the *what is away* card) cannot hang there, because it belongs to no single asset,
99
+ * so it is keyed under `['inventory', 'repair', …]` and needs its own change. Two changes for one
100
+ * write is the honest cost of one entity being asked about at two scopes.
101
+ */
102
+ const announceRepair = async (workspaceId, written, event, op, actorId) => {
103
+ if (written.activity)
104
+ await svc.notify.activity(written.activity);
105
+ if (event)
106
+ await kernel.emit(event, { assetId: written.asset.id, repairId: written.repair.id, workspaceId }, { workspaceId, actorId: actorId ?? undefined });
107
+ await svc.notify.change(workspaceId, 'asset', written.asset.id, 'updated');
108
+ await svc.notify.change(workspaceId, 'repair', written.repair.id, op);
109
+ // Sending an item away and logging it back both move `assets.status`, which the document
110
+ // carries. An edit does not, and reindexing anyway is one cheap call rather than a fourth
111
+ // branch that has to stay right.
112
+ await svc.search.reindex(workspaceId, written.asset.id);
37
113
  };
38
114
  /** Every handler is this: a workspace-bound transaction, tagged with who is asking, and a service. */
39
115
  const run = (context, workspaceId, fn) => kernel.database.withWorkspace(workspaceId, fn, { userId: context.principal.userId });
116
+ /**
117
+ * A file id in a request is a claim about somebody else's row, and it is checked before it is
118
+ * stored.
119
+ *
120
+ * `attachments.add` has always asked core whose file an id belongs to; `assets.create` and
121
+ * `assets.update` did not, so `photoFileId` was the one file id this module accepted on trust —
122
+ * and a member of one workspace could point an asset at another workspace's file and read its
123
+ * name and size back out through the panel. The module boundary is no help: core answers this
124
+ * module as a service, so the id is the only thing standing between the two workspaces.
125
+ *
126
+ * The same check, deliberately, rather than a second one that might drift: `describe` is what
127
+ * refuses a foreign file and an upload that never finished, and it is called **before** the
128
+ * transaction opens for the reason its own docblock gives — a broker round trip while holding a
129
+ * pooled connection starves the pool and fails the write whenever core is briefly away.
130
+ *
131
+ * `undefined` means the request never mentioned a photo and `null` means "take it off", and
132
+ * neither is a file to check.
133
+ */
134
+ const checkPhoto = async (workspaceId, photoFileId) => {
135
+ if (typeof photoFileId === 'string')
136
+ await svc.attachments.describe(workspaceId, [photoFileId]);
137
+ };
138
+ /**
139
+ * Does this workspace record repairs? Asked by the procedures that are **not** behind the
140
+ * capability but whose answer depends on it.
141
+ *
142
+ * `under_repair` is a status the `repairs` capability owns, and custody and archiving both decide
143
+ * it — custody because `deriveStatus` reads the open repair, archiving because it refuses an item
144
+ * that is away. With the capability off both of those were reading a fact the workspace can no
145
+ * longer act on: `repairs.complete` answers 404, so an asset went `under_repair` and stayed there,
146
+ * behind an archive that refused it and told the person to complete a repair they cannot reach.
147
+ *
148
+ * Read **before** the transaction opens, like every other settings lookup in this module and for
149
+ * the reason `AssetService.codeFormat` gives — `kernel.capabilities` resolves module settings over
150
+ * the broker, and awaiting one while holding a pooled connection starves the pool and fails the
151
+ * write whenever core is briefly away. The result is cached by the kernel for fifteen seconds, so
152
+ * this is not a round trip per request.
153
+ */
154
+ const recordsRepairs = async (workspaceId) => (await kernel.capabilities(workspaceId, MODULE_ID)).has('repairs');
40
155
  return os.router({
41
156
  assets: {
42
157
  list: scoped.assets.list
@@ -45,6 +160,9 @@ export function inventoryRouter(kernel) {
45
160
  get: scoped.assets.get
46
161
  .use(requires('inventory.asset.view'))
47
162
  .handler(({ input, context }) => run(context, input.workspaceId, async (tx) => toAsset(await svc.assets.get(tx, input.workspaceId, input.assetId)))),
163
+ history: scoped.assets.history
164
+ .use(requires('inventory.asset.view'))
165
+ .handler(({ input, context }) => run(context, input.workspaceId, (tx) => svc.assets.history(tx, input.workspaceId, input.assetId, input))),
48
166
  create: scoped.assets.create
49
167
  .use(requires('inventory.asset.manage'))
50
168
  .handler(async ({ input, context }) => {
@@ -52,6 +170,7 @@ export function inventoryRouter(kernel) {
52
170
  // Module settings are read *before* the transaction opens. They come from core over the
53
171
  // broker, and awaiting that inside the transaction holds a pooled connection and the
54
172
  // counter row lock across a network call to another service.
173
+ await checkPhoto(input.workspaceId, input.photoFileId);
55
174
  const format = await svc.assets.codeFormat(input.workspaceId);
56
175
  const written = await run(context, input.workspaceId, (tx) => svc.assets.create(tx, input.workspaceId, actorId, input, format));
57
176
  await announce(input.workspaceId, written, inventoryEvents.assetCreated, 'created', actorId);
@@ -61,6 +180,7 @@ export function inventoryRouter(kernel) {
61
180
  .use(requires('inventory.asset.manage'))
62
181
  .handler(async ({ input, context }) => {
63
182
  const actorId = context.principal.userId;
183
+ await checkPhoto(input.workspaceId, input.photoFileId);
64
184
  const written = await run(context, input.workspaceId, (tx) => svc.assets.update(tx, input.workspaceId, actorId, input.assetId, input));
65
185
  await announce(input.workspaceId, written, inventoryEvents.assetUpdated, 'updated', actorId);
66
186
  return toAsset(written.row);
@@ -69,7 +189,8 @@ export function inventoryRouter(kernel) {
69
189
  .use(requires('inventory.asset.manage'))
70
190
  .handler(async ({ input, context }) => {
71
191
  const actorId = context.principal.userId;
72
- const written = await run(context, input.workspaceId, (tx) => svc.assets.archive(tx, input.workspaceId, actorId, input.assetId, input.archived));
192
+ const repairsOn = await recordsRepairs(input.workspaceId);
193
+ const written = await run(context, input.workspaceId, (tx) => svc.assets.archive(tx, input.workspaceId, actorId, input.assetId, input.archived, repairsOn));
73
194
  // This procedure is the restore path too, and it used to announce `archived` either way —
74
195
  // telling every subscriber that a restored item had just been retired, while the module's
75
196
  // own history row beside it said `restored`.
@@ -78,6 +199,263 @@ export function inventoryRouter(kernel) {
78
199
  return toAsset(written.row);
79
200
  }),
80
201
  },
202
+ custody: {
203
+ /**
204
+ * Reads ride `inventory.asset.view`, writes take `inventory.custody.manage`.
205
+ *
206
+ * The split is argued where the keys are declared: `custodianUserId` is already a field of
207
+ * `Asset` under `asset.view`, so gating the timeline behind a second key would refuse the
208
+ * history while the row above it named the same person.
209
+ */
210
+ history: scoped.custody.history.use(requires('inventory.asset.view')).handler(({ input, context }) => run(context, input.workspaceId, async (tx) => {
211
+ // 404 first: a timeline for an asset in another workspace must answer "not yours"
212
+ // rather than an empty list, which reads as "nothing has ever happened to it".
213
+ await svc.assets.get(tx, input.workspaceId, input.assetId);
214
+ const rows = await svc.custody.history(tx, input.workspaceId, input.assetId, input.limit);
215
+ return rows.map(toCustodyPeriod);
216
+ })),
217
+ /**
218
+ * What one person holds, answered by the asset list with the custodian filter fixed.
219
+ *
220
+ * One query path rather than two: `assets.list` already has the filter, the index and the
221
+ * keyset cursor, and a second query answering the same question is a second query to keep in
222
+ * step. Archived rows are out, because an item somebody still holds cannot be archived at
223
+ * all — `assets.archive` refuses it — so an archived row here would be one this module has
224
+ * already made impossible.
225
+ */
226
+ byUser: scoped.custody.byUser.use(requires('inventory.asset.view')).handler(({ input, context }) => run(context, input.workspaceId, (tx) => svc.assets.list(tx, {
227
+ workspaceId: input.workspaceId,
228
+ limit: input.limit,
229
+ ...(input.cursor ? { cursor: input.cursor } : {}),
230
+ custodianUserId: input.userId,
231
+ archived: false,
232
+ sort: 'recent',
233
+ }))),
234
+ assign: scoped.custody.assign
235
+ .use(requires('inventory.custody.manage'))
236
+ .handler(async ({ input, context }) => {
237
+ const actorId = context.principal.userId;
238
+ // Core is asked whether this person is really a member **before** the transaction opens,
239
+ // for the reason `AssetService.codeFormat` documents — and because writing the row first
240
+ // and checking afterwards would mean rolling back a handover somebody has already been
241
+ // notified about. `requireWorkspaceMember` argues what it refuses and why it refuses
242
+ // rather than swallowing a failure.
243
+ await requireWorkspaceMember(kernel, input.workspaceId, input.userId);
244
+ const repairsOn = await recordsRepairs(input.workspaceId);
245
+ const written = await run(context, input.workspaceId, (tx) => svc.custody.assign(tx, input.workspaceId, actorId, input.assetId, input.userId, input.note ?? null, repairsOn));
246
+ await announceCustody(input.workspaceId, written, actorId);
247
+ return { asset: toAsset(written.asset), period: written.period && toCustodyPeriod(written.period) };
248
+ }),
249
+ transfer: scoped.custody.transfer
250
+ .use(requires('inventory.custody.manage'))
251
+ .handler(async ({ input, context }) => {
252
+ const actorId = context.principal.userId;
253
+ // The same check as `assign`, for the same reason: this is the other verb that writes a
254
+ // person into `custody_periods.user_id` and then sends them a notification.
255
+ await requireWorkspaceMember(kernel, input.workspaceId, input.userId);
256
+ const repairsOn = await recordsRepairs(input.workspaceId);
257
+ const written = await run(context, input.workspaceId, (tx) => svc.custody.transfer(tx, input.workspaceId, actorId, input.assetId, input.userId, input.note ?? null, repairsOn));
258
+ await announceCustody(input.workspaceId, written, actorId);
259
+ return { asset: toAsset(written.asset), period: written.period && toCustodyPeriod(written.period) };
260
+ }),
261
+ return: scoped.custody.return
262
+ .use(requires('inventory.custody.manage'))
263
+ .handler(async ({ input, context }) => {
264
+ const actorId = context.principal.userId;
265
+ const repairsOn = await recordsRepairs(input.workspaceId);
266
+ const written = await run(context, input.workspaceId, (tx) => svc.custody.return(tx, input.workspaceId, actorId, input.assetId, input.note ?? null, repairsOn));
267
+ await announceCustody(input.workspaceId, written, actorId);
268
+ return { asset: toAsset(written.asset), period: null };
269
+ }),
270
+ },
271
+ /**
272
+ * A workspace's own filing, and the one entity name every change here carries.
273
+ *
274
+ * **`update` and `archive` used to announce a second change as `entity: 'asset'` carrying the
275
+ * category's id.** No asset has that id, so the change described a row that does not exist: a
276
+ * subscriber that acts on `{entity, id}` — patching a cached row, logging what moved, deciding
277
+ * what to refetch — is acting on a lie, and the client's own
278
+ * `invalidateQueries(['inventory', 'asset', id])` matched nothing, because the segment after
279
+ * the entity in this module's keys is the *workspace*. What it did was work by accident: the
280
+ * blunter `['inventory', 'asset']` invalidation fires on any asset change whatever its id.
281
+ *
282
+ * It is not needed either, and that is why it is gone rather than corrected. A category's name
283
+ * is resolved on the client from the categories query itself — `AssetsPage` and
284
+ * `AssetDetailPanel` both build their `id → name` map from `inventoryKeys.categories(ws, true)`
285
+ * — so refreshing that one query is what makes every asset row on screen say the new name. The
286
+ * asset rows themselves did not change: archiving a category leaves `assets.category_id`
287
+ * exactly where it was, which is the whole reason categories archive rather than delete.
288
+ */
289
+ categories: {
290
+ /**
291
+ * Reading rides `inventory.asset.view` because the picker on the asset form needs it — a
292
+ * `category.manage` on the read would leave everybody who may edit an asset unable to see
293
+ * what to file it under.
294
+ */
295
+ list: scoped.categories.list
296
+ .use(requires('inventory.asset.view'))
297
+ .handler(({ input, context }) => run(context, input.workspaceId, (tx) => svc.categories.list(tx, input.workspaceId, input.archived))),
298
+ create: scoped.categories.create
299
+ .use(requires('inventory.category.manage'))
300
+ .handler(async ({ input, context }) => {
301
+ const row = await run(context, input.workspaceId, (tx) => svc.categories.create(tx, input.workspaceId, input.name));
302
+ // No event: nothing outside this module has an opinion about a workspace's own filing.
303
+ // The realtime change is what the settings page, the filter and the form picker need.
304
+ await svc.notify.change(input.workspaceId, 'category', row.id, 'created');
305
+ return toCategory(row);
306
+ }),
307
+ update: scoped.categories.update
308
+ .use(requires('inventory.category.manage'))
309
+ .handler(async ({ input, context }) => {
310
+ const row = await run(context, input.workspaceId, (tx) => svc.categories.update(tx, input.workspaceId, input.categoryId, input));
311
+ // One change, naming the row that actually moved. Every screen that prints a category's
312
+ // name resolves it from the categories query, so this is what re-renders the asset list,
313
+ // the filter and the picker as well as the settings page.
314
+ await svc.notify.change(input.workspaceId, 'category', row.id, 'updated');
315
+ return toCategory(row);
316
+ }),
317
+ archive: scoped.categories.archive
318
+ .use(requires('inventory.category.manage'))
319
+ .handler(async ({ input, context }) => {
320
+ const row = await run(context, input.workspaceId, (tx) => svc.categories.archive(tx, input.workspaceId, input.categoryId, input.archived));
321
+ // Archiving takes the category out of every picker and every filter and leaves each asset
322
+ // still filed under it — so the row that changed is the category, and only the category.
323
+ await svc.notify.change(input.workspaceId, 'category', row.id, 'updated');
324
+ return toCategory(row);
325
+ }),
326
+ /**
327
+ * The sequence, rewritten from the ids somebody dragged it into.
328
+ *
329
+ * **One change per row that actually moved, and no kernel event** — the same two decisions
330
+ * the three procedures above make, for the same two reasons. Moving one category down a list
331
+ * of ten renumbers the handful between where it was and where it went, and each of those rows
332
+ * really did change; announcing the ones that did not would tell every open screen in the
333
+ * workspace about a write nobody performed. And nothing outside this module has an opinion
334
+ * about the order a workspace keeps its own filing in, so there is nothing to emit an event
335
+ * to: `inventoryEvents` stays the set of things another module could plausibly react to.
336
+ *
337
+ * After the commit, like everything else here. A change announced from inside the transaction
338
+ * describes rows a rollback then takes away, and it cannot be retracted.
339
+ */
340
+ reorder: scoped.categories.reorder
341
+ .use(requires('inventory.category.manage'))
342
+ .handler(async ({ input, context }) => {
343
+ const { rows, moved } = await run(context, input.workspaceId, (tx) => svc.categories.reorder(tx, input.workspaceId, input.categoryIds));
344
+ for (const id of moved)
345
+ await svc.notify.change(input.workspaceId, 'category', id, 'updated');
346
+ return rows.map(toCategory);
347
+ }),
348
+ },
349
+ /**
350
+ * Repairs, behind the `repairs` capability.
351
+ *
352
+ * Every one of these carries three middlewares in this order — `workspaceScoped`, `cap`,
353
+ * `requires` — so a workspace that does not record repairs gets 404 from all four, which is
354
+ * what makes the hidden tab and the API agree.
355
+ */
356
+ repairs: {
357
+ list: scoped.repairs.list
358
+ .use(cap('repairs'))
359
+ .use(requires('inventory.asset.view'))
360
+ .handler(({ input, context }) => run(context, input.workspaceId, async (tx) => {
361
+ // 404 first when the question is about one asset: a repair list for an asset in another
362
+ // workspace must answer "not yours" rather than an empty list, which reads as "it has
363
+ // never been repaired". The same reasoning `custody.history` gives.
364
+ if (input.assetId)
365
+ await svc.assets.get(tx, input.workspaceId, input.assetId);
366
+ return svc.repairs.list(tx, input.workspaceId, input);
367
+ })),
368
+ create: scoped.repairs.create
369
+ .use(cap('repairs'))
370
+ .use(requires('inventory.repair.manage'))
371
+ .handler(async ({ input, context }) => {
372
+ const actorId = context.principal.userId;
373
+ const written = await run(context, input.workspaceId, (tx) => svc.repairs.create(tx, input.workspaceId, actorId, input.assetId, input));
374
+ await announceRepair(input.workspaceId, written, inventoryEvents.repairOpened, 'created', actorId);
375
+ return { repair: toRepair(written.repair), asset: toAsset(written.asset) };
376
+ }),
377
+ update: scoped.repairs.update
378
+ .use(cap('repairs'))
379
+ .use(requires('inventory.repair.manage'))
380
+ .handler(async ({ input, context }) => {
381
+ const actorId = context.principal.userId;
382
+ const written = await run(context, input.workspaceId, (tx) => svc.repairs.update(tx, input.workspaceId, input.repairId, input));
383
+ // No event: correcting a vendor or a cost is not a fact anything outside this module
384
+ // reacts to. The realtime change is what the panel and the card need.
385
+ await announceRepair(input.workspaceId, written, null, 'updated', actorId);
386
+ return { repair: toRepair(written.repair), asset: toAsset(written.asset) };
387
+ }),
388
+ complete: scoped.repairs.complete
389
+ .use(cap('repairs'))
390
+ .use(requires('inventory.repair.manage'))
391
+ .handler(async ({ input, context }) => {
392
+ const actorId = context.principal.userId;
393
+ const written = await run(context, input.workspaceId, (tx) => svc.repairs.complete(tx, input.workspaceId, actorId, input.repairId, input));
394
+ await announceRepair(input.workspaceId, written, inventoryEvents.repairCompleted, 'updated', actorId);
395
+ return { repair: toRepair(written.repair), asset: toAsset(written.asset) };
396
+ }),
397
+ },
398
+ /**
399
+ * Files, behind the `attachments` capability.
400
+ *
401
+ * Writing takes `inventory.asset.manage` rather than a key of its own: filing a receipt against
402
+ * an asset is editing the asset's record, and a workspace that lets somebody correct a serial
403
+ * number lets them attach the warranty card it came with.
404
+ */
405
+ attachments: {
406
+ list: scoped.attachments.list
407
+ .use(cap('attachments'))
408
+ .use(requires('inventory.asset.view'))
409
+ .handler(({ input, context }) => run(context, input.workspaceId, async (tx) => {
410
+ await svc.assets.get(tx, input.workspaceId, input.assetId);
411
+ return svc.attachments.list(tx, input.workspaceId, input.assetId);
412
+ })),
413
+ add: scoped.attachments.add
414
+ .use(cap('attachments'))
415
+ .use(requires('inventory.asset.manage'))
416
+ .handler(async ({ input, context }) => {
417
+ const actorId = context.principal.userId;
418
+ // Core is asked what these files are **before** the transaction opens. It is a call over
419
+ // the broker, and awaiting one while holding a pooled connection is the failure
420
+ // `AssetService.codeFormat` documents — the pool starves under concurrent writes, and an
421
+ // attach fails outright whenever core is briefly away.
422
+ const files = await svc.attachments.describe(input.workspaceId, input.fileIds);
423
+ const written = await run(context, input.workspaceId, (tx) => svc.attachments.add(tx, input.workspaceId, actorId, input.assetId, input.repairId ?? null, files));
424
+ for (const activity of written.activities)
425
+ await svc.notify.activity(activity);
426
+ // No event and no notification: a filed receipt is not something outside this module
427
+ // reacts to, and it is certainly not worth interrupting anybody about.
428
+ if (written.rows.length)
429
+ await svc.notify.change(input.workspaceId, 'asset', input.assetId, 'updated');
430
+ return written.rows.map(toAttachment);
431
+ }),
432
+ remove: scoped.attachments.remove
433
+ .use(cap('attachments'))
434
+ .use(requires('inventory.asset.manage'))
435
+ .handler(async ({ input, context }) => {
436
+ const actorId = context.principal.userId;
437
+ const removed = await run(context, input.workspaceId, (tx) => svc.attachments.remove(tx, input.workspaceId, actorId, input.attachmentId));
438
+ await svc.notify.activity(removed.activity);
439
+ await svc.notify.change(input.workspaceId, 'asset', removed.row.assetId, 'updated');
440
+ return { id: removed.row.id };
441
+ }),
442
+ },
443
+ stats: {
444
+ /**
445
+ * Not behind a capability: it counts assets, which is `core`.
446
+ *
447
+ * The capability it does read is `repairs`, and it reads it here rather than as middleware —
448
+ * `outForRepair` comes back **null** for a workspace that does not track repairs, where 404
449
+ * would take the whole count line and the dashboard card away because a *different* feature
450
+ * is off. Read before the transaction opens, like every other settings lookup in this module.
451
+ */
452
+ summary: scoped.stats.summary
453
+ .use(requires('inventory.asset.view'))
454
+ .handler(async ({ input, context }) => {
455
+ const on = await kernel.capabilities(input.workspaceId, MODULE_ID);
456
+ return run(context, input.workspaceId, (tx) => svc.stats.summary(tx, input.workspaceId, on.has('repairs')));
457
+ }),
458
+ },
81
459
  });
82
460
  }
83
461
  //# sourceMappingURL=router.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/server/router.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAElB,cAAc,EAEd,QAAQ,EAER,eAAe,GAChB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACpF,OAAO,EAAE,OAAO,EAAgB,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD;;;;;;;;;;GAUG;AACH,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAA;AAE3D,MAAM,EAAE,GAAG,SAAS,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAkB,CAAA;AAElE,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,GAAG,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAA;IACrC,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAA;IAEjD;;;;;;;;OAQG;IACH,MAAM,QAAQ,GAAG,KAAK,EACpB,WAAwB,EACxB,OAAgB,EAChB,KAA6D,EAC7D,EAAqC,EACrC,OAAsB,EACtB,EAAE;Q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