@deveye/types 0.21.4 → 0.21.6

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": "@deveye/types",
3
- "version": "0.21.4",
3
+ "version": "0.21.6",
4
4
  "description": "Shared contracts (types + zod schemas) for DevEye apps",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -60,9 +60,12 @@ export interface FeatureDescriptor {
60
60
  * prévient. Sans elle, l'onglet liste des canaux sans dire à quoi ils
61
61
  * servent. Exigée dès que `notifies` est vrai. `perItem: false` quand rien
62
62
  * ne part jamais au nom d'un élément : ses réglages n'ont alors pas
63
- * d'onglet Notifications qui ne recevrait rien.
63
+ * d'onglet Notifications qui ne recevrait rien, et la route se coche à
64
+ * l'échelle de la fonctionnalité. `feature` quand la fonctionnalité prévient
65
+ * AUSSI en son nom propre, à côté de ses éléments : ce qui part par cette
66
+ * route, dit en une phrase au-dessus des cases de son onglet.
64
67
  */
65
- notifications?: { hint: string; perItem?: boolean };
68
+ notifications?: { hint: string; perItem?: boolean; feature?: string };
66
69
  /**
67
70
  * Un de ses éléments peut-il être rendu visible depuis un autre espace ?
68
71
  * Décidé par le chiffrement : un élément partagé reste chiffré sous la clé
@@ -204,7 +207,9 @@ export const FEATURE_REGISTRY: readonly (FeatureDescriptor & { id: WorkspaceFeat
204
207
  icon: 'rocket',
205
208
  notifies: true,
206
209
  notifications: {
207
- hint: 'Envoyées à l’atterrissage d’un déploiement, échec comme succès, y compris ceux lancés ailleurs : depuis Dokploy, une CI ou un push git. Et quand le lien avec l’instance d’un accès se perd, puis revient.'
210
+ hint: 'Envoyées à l’atterrissage d’un déploiement, échec comme succès, y compris ceux lancés ailleurs : depuis Dokploy, une CI ou un push git.',
211
+ feature:
212
+ 'Quand le lien avec l’instance d’un accès se perd, puis revient : un seul avis pour toutes les cibles qu’il dessert.'
208
213
  },
209
214
  hasItems: true,
210
215
  itemNoun: 'cible',
@@ -387,6 +392,22 @@ export function maybeFeatureDescriptor(id: FeatureId): FeatureDescriptor | undef
387
392
  }
388
393
 
389
394
  /** L'intitulé seul : le besoin de très loin le plus courant. */
395
+ /**
396
+ * Does this feature send notifications in its own name, by the route with no
397
+ * item (`item_id = 0`)? True without items, when nothing goes out per item
398
+ * (`notifications.perItem: false`) and when it speaks for itself next to its
399
+ * items (`notifications.feature`). The shell shows that route's checkboxes,
400
+ * and the server accepts its selection, on exactly this rule.
401
+ */
402
+ export function featureNotifiesItself(descriptor: FeatureDescriptor): boolean {
403
+ const notifications = descriptor.notifications;
404
+ return (
405
+ !descriptor.hasItems ||
406
+ notifications?.perItem === false ||
407
+ notifications?.feature !== undefined
408
+ );
409
+ }
410
+
390
411
  export function featureLabel(id: FeatureId): string {
391
412
  return featureDescriptor(id).label;
392
413
  }
package/src/index.ts CHANGED
@@ -759,6 +759,7 @@ export {
759
759
  NOTIFYING_FEATURES,
760
760
  allFeatureDescriptors,
761
761
  featureDescriptor,
762
+ featureNotifiesItself,
762
763
  featureLabel,
763
764
  itemNounForms,
764
765
  maybeFeatureDescriptor,
package/src/sdk/server.ts CHANGED
@@ -249,11 +249,14 @@ export interface DevEyeFacade {
249
249
  * Delivers to the configured channels. Resolves `true` if at least one
250
250
  * accepted. `except`: channel ids to skip, those a live message
251
251
  * (`postLive`) already concluded on, so a channel never hears the
252
- * same news twice.
252
+ * same news twice. `itemIds`: the channels routed to ANY of these
253
+ * items, each channel once: for news that concerns several items at
254
+ * a time (the instance they share went down) when the feature's own
255
+ * route (`hasRoute()` with no item) has nothing checked.
253
256
  */
254
257
  send(
255
258
  alert: SdkAlert,
256
- opts?: { itemId?: number; except?: readonly number[] }
259
+ opts?: { itemId?: number; itemIds?: readonly number[]; except?: readonly number[] }
257
260
  ): Promise<boolean>;
258
261
  /**
259
262
  * The routed channels able to carry a LIVE message: a rich message
@@ -119,6 +119,7 @@ export interface RecordedCalls {
119
119
  subject: string;
120
120
  body: string;
121
121
  itemId?: number;
122
+ itemIds?: readonly number[];
122
123
  embeds?: number;
123
124
  except?: readonly number[];
124
125
  }[];
@@ -158,6 +159,7 @@ function recordingNotify(
158
159
  itemId: opts?.itemId,
159
160
  // Only when the alert carries a layout: a test that
160
161
  // deep-equals the plain record must not see the key appear.
162
+ ...(opts?.itemIds ? { itemIds: opts.itemIds } : {}),
161
163
  ...(alert.embeds ? { embeds: alert.embeds.length } : {}),
162
164
  ...(opts?.except ? { except: opts.except } : {})
163
165
  });