@deveye/types 0.21.5 → 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 +1 -1
- package/src/domain/featureRegistry.ts +16 -0
- package/src/index.ts +1 -0
- package/src/sdk/server.ts +5 -2
- package/src/sdk/testing.ts +2 -0
package/package.json
CHANGED
|
@@ -392,6 +392,22 @@ export function maybeFeatureDescriptor(id: FeatureId): FeatureDescriptor | undef
|
|
|
392
392
|
}
|
|
393
393
|
|
|
394
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
|
+
|
|
395
411
|
export function featureLabel(id: FeatureId): string {
|
|
396
412
|
return featureDescriptor(id).label;
|
|
397
413
|
}
|
package/src/index.ts
CHANGED
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
|
package/src/sdk/testing.ts
CHANGED
|
@@ -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
|
});
|