@deveye/types 0.21.5 → 0.21.7

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.5",
3
+ "version": "0.21.7",
4
4
  "description": "Shared contracts (types + zod schemas) for DevEye apps",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -61,11 +61,11 @@ export interface FeatureDescriptor {
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
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
+ * l'échelle de la fonctionnalité. Un avis qui concerne plusieurs éléments
65
+ * à la fois suit leurs canaux, chacun une fois (`notify.send(alert,
66
+ * { itemIds })`) : il n'a pas de route à lui.
67
67
  */
68
- notifications?: { hint: string; perItem?: boolean; feature?: string };
68
+ notifications?: { hint: string; perItem?: boolean };
69
69
  /**
70
70
  * Un de ses éléments peut-il être rendu visible depuis un autre espace ?
71
71
  * Décidé par le chiffrement : un élément partagé reste chiffré sous la clé
@@ -207,9 +207,7 @@ export const FEATURE_REGISTRY: readonly (FeatureDescriptor & { id: WorkspaceFeat
207
207
  icon: 'rocket',
208
208
  notifies: true,
209
209
  notifications: {
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.'
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. Et quand le lien avec l’instance d’un accès se perd, puis revient : un seul avis, vers les canaux de toutes les cibles qu’il dessert.'
213
211
  },
214
212
  hasItems: true,
215
213
  itemNoun: 'cible',
@@ -392,6 +390,16 @@ export function maybeFeatureDescriptor(id: FeatureId): FeatureDescriptor | undef
392
390
  }
393
391
 
394
392
  /** L'intitulé seul : le besoin de très loin le plus courant. */
393
+ /**
394
+ * Does this feature send notifications in its own name, by the route with no
395
+ * item (`item_id = 0`)? True without items, and when nothing goes out per item
396
+ * (`notifications.perItem: false`). The shell shows that route's checkboxes,
397
+ * and the server accepts its selection, on exactly this rule.
398
+ */
399
+ export function featureNotifiesItself(descriptor: FeatureDescriptor): boolean {
400
+ return !descriptor.hasItems || descriptor.notifications?.perItem === false;
401
+ }
402
+
395
403
  export function featureLabel(id: FeatureId): string {
396
404
  return featureDescriptor(id).label;
397
405
  }
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,13 @@ 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), told once.
253
255
  */
254
256
  send(
255
257
  alert: SdkAlert,
256
- opts?: { itemId?: number; except?: readonly number[] }
258
+ opts?: { itemId?: number; itemIds?: readonly number[]; except?: readonly number[] }
257
259
  ): Promise<boolean>;
258
260
  /**
259
261
  * 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
  });