@things-factory/notification 10.1.104 → 10.1.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/notification",
3
- "version": "10.1.104",
3
+ "version": "10.1.105",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -32,13 +32,13 @@
32
32
  "@operato/styles": "^10.0.0",
33
33
  "@things-factory/auth-base": "^10.1.79",
34
34
  "@things-factory/i18n-base": "^10.1.104",
35
- "@things-factory/organization": "^10.1.104",
36
- "@things-factory/setting-base": "^10.1.79",
35
+ "@things-factory/organization": "^10.1.105",
36
+ "@things-factory/setting-base": "^10.1.105",
37
37
  "@things-factory/shell": "^10.1.79",
38
38
  "clipboard": "^2.0.6",
39
39
  "firebase": "^9.14.0",
40
40
  "firebase-admin": "^11.3.0",
41
41
  "google": "^2.1.0"
42
42
  },
43
- "gitHead": "0d05c7573220c6da2dec2654a4b86d7bd8e3c4fb"
43
+ "gitHead": "c8ad9b40d57709beefd5e3d6167fd9cab6efea3a"
44
44
  }
@@ -0,0 +1,54 @@
1
+ /*
2
+ * Every mutation of notification declares a privilege, and the domain owner may call it.
3
+ *
4
+ * Until 2026-10-01 no mutation of notification declared anything: any member of a domain could call them. Notification rules ask for `notification-rule:mutation`.
5
+ * The queries are not gated yet and are not measured here.
6
+ */
7
+ import { gatesOf, openFields } from '../../../test/helpers/open-doors'
8
+
9
+ /** The category each mutation asks for; anything not named here asks for `notification-rule`. */
10
+ const CATEGORY: Record<string, string> = {}
11
+
12
+ /*
13
+ * A notification is one person's inbox entry, so a privilege category is not what guards it: these doors
14
+ * have to keep a caller to the notifications they own, and they do not yet (domain only). Left open
15
+ * until that owner check is written.
16
+ */
17
+ const NOT_DECIDED = 'an inbox entry - needs an owner check, not a category; domain-scoped only for now'
18
+
19
+ /** Open on purpose or not decided yet, each with its reason. */
20
+ const OPEN: Record<string, string> = {
21
+ createNotification: NOT_DECIDED,
22
+ updateNotification: NOT_DECIDED,
23
+ updateMultipleNotification: NOT_DECIDED,
24
+ deleteNotification: NOT_DECIDED,
25
+ deleteNotificationes: NOT_DECIDED
26
+ }
27
+
28
+ let gates: Awaited<ReturnType<typeof gatesOf>>
29
+
30
+ beforeAll(async () => {
31
+ gates = await gatesOf('notification')
32
+ })
33
+
34
+ it('every open mutation has a written reason', () => {
35
+ expect(openFields(gates.Mutation)).toEqual(Object.keys(OPEN).sort())
36
+ })
37
+
38
+ it('every declared mutation asks for its category and admits the domain owner', () => {
39
+ for (const [field, gate] of Object.entries(gates.Mutation)) {
40
+ if (field in OPEN) continue
41
+ expect({ field, ...gate }).toEqual({
42
+ field,
43
+ category: CATEGORY[field] ?? 'notification-rule',
44
+ privilege: 'mutation',
45
+ owner: true,
46
+ super: false
47
+ })
48
+ }
49
+ })
50
+
51
+ it('the walk reaches every mutation', () => {
52
+ /* If the resolver list shrank, the checks above would pass by having nothing to look at. */
53
+ expect(Object.keys(gates.Mutation)).toHaveLength(11)
54
+ })