@diagonal-hq/cli 0.30.1 → 0.30.2
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/README.md +2 -1
- package/dist/cli.mjs +15 -7
- package/dist/index.d.ts +9 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -685,10 +685,11 @@ This sends the Standard welcome 7 days after each active member's `joined_on`.
|
|
|
685
685
|
- `offsets` holds one to 30 distinct ISO 8601 durations in days, hours, or minutes: `'-P30D'` is 30 days before, `'P0D'` is the day, `'-PT2H'` is 2 hours before in exact timing. A duration without a sign counts after the date, so `'P7D'` and `'+P7D'` are the same offset.
|
|
686
686
|
- `timing` defaults to `'day'`, which sends at 8 a.m. in the workspace timezone on the day, so `'-PT2H'` sends at 6 a.m. `'exact'` sends at the time of a datetime field or the start of an event schedule field, plus the offset.
|
|
687
687
|
- `filters` is optional. It is a filter tree, `{ operator, conditions }`, with the shape of a policy `filter`. See [Policies](#policies).
|
|
688
|
+
- `automaticFilters` is optional and has the shape of `filters`. Of the records that match `filters`, the schedule makes and sends notifications on its own only for the records that also match `automaticFilters`. Staff can still send to the other records from the schedule page. Leave it out to send on its own to every record that matches `filters`. For example, `automaticFilters: { operator: 'and', conditions: [{ field: 'renewal_notice_mode', operator: '=', value: 'automatic' }] }` sends on its own only to the members who chose automatic renewal notices.
|
|
688
689
|
- `recipient` is the path of single-record relations from the source record to the type's recipient, for example `'member'` on a `memberships` source. Leave it out when the source resource is the recipient, as here.
|
|
689
690
|
- `variables` maps each variable of the type to a field path on the source record. A record variable maps to a record's `id`.
|
|
690
691
|
|
|
691
|
-
A deployed schedule is a System Notification. It sends with no staff identity, and `
|
|
692
|
+
A deployed schedule is a System Notification. It sends with no staff identity. `filters` decides who gets it, and `automaticFilters` decides who gets it without a staff action. A file cannot name a person to send as. Staff actions on one generated notification, such as **Send now** or an edit, still act as the person who clicks.
|
|
692
693
|
|
|
693
694
|
A deploy writes the schedule into the workspace and makes its upcoming notifications. A later deploy updates the same schedule. An offset that stays in the list keeps its notifications, with their edits and holds. When the file is gone, the publish deletes the schedule, as **Delete** on the schedule page does: the notifications that were not sent are archived, and the send history stays. A publish never pauses or enables a schedule. Staff can still pause it on the schedule page, which shows the other fields as read-only, with the path of the file.
|
|
694
695
|
|
package/dist/cli.mjs
CHANGED
|
@@ -317379,6 +317379,7 @@ var SCHEDULE_PROPERTIES = [
|
|
|
317379
317379
|
"timing",
|
|
317380
317380
|
"offsets",
|
|
317381
317381
|
"filters",
|
|
317382
|
+
"automaticFilters",
|
|
317382
317383
|
"recipient",
|
|
317383
317384
|
"variables"
|
|
317384
317385
|
];
|
|
@@ -317449,6 +317450,16 @@ function readVariablePaths(value, node, report) {
|
|
|
317449
317450
|
}
|
|
317450
317451
|
return Object.keys(variables).length === entries.length ? variables : null;
|
|
317451
317452
|
}
|
|
317453
|
+
function readFilters(value, key, node, report) {
|
|
317454
|
+
const filters = value[key] ?? null;
|
|
317455
|
+
if (filters !== null) {
|
|
317456
|
+
const problem2 = filterGroupProblem(filters, key, nodeAt(node, key));
|
|
317457
|
+
if (problem2 !== null) {
|
|
317458
|
+
report(problem2.node, problem2.message);
|
|
317459
|
+
}
|
|
317460
|
+
}
|
|
317461
|
+
return filters;
|
|
317462
|
+
}
|
|
317452
317463
|
function buildSchedule(file2, value, node, report, context) {
|
|
317453
317464
|
const timing = value.timing ?? "day";
|
|
317454
317465
|
if (!TIMINGS.includes(timing)) {
|
|
@@ -317465,13 +317476,8 @@ function buildSchedule(file2, value, node, report, context) {
|
|
|
317465
317476
|
} else {
|
|
317466
317477
|
dateField = value.dateField;
|
|
317467
317478
|
}
|
|
317468
|
-
const filters = value
|
|
317469
|
-
|
|
317470
|
-
const problem2 = filterGroupProblem(filters, "filters", nodeAt(node, "filters"));
|
|
317471
|
-
if (problem2 !== null) {
|
|
317472
|
-
report(problem2.node, problem2.message);
|
|
317473
|
-
}
|
|
317474
|
-
}
|
|
317479
|
+
const filters = readFilters(value, "filters", node, report);
|
|
317480
|
+
const automaticFilters = readFilters(value, "automaticFilters", node, report);
|
|
317475
317481
|
const recipient = value.recipient ?? "";
|
|
317476
317482
|
if (typeof recipient !== "string" || recipient !== "" && (!RELATION_PATH_PATTERN.test(recipient) || recipient.length > RECIPIENT_MAX_LENGTH)) {
|
|
317477
317483
|
report(
|
|
@@ -317495,6 +317501,7 @@ function buildSchedule(file2, value, node, report, context) {
|
|
|
317495
317501
|
unsignedAfter: true
|
|
317496
317502
|
}),
|
|
317497
317503
|
filters,
|
|
317504
|
+
automaticFilters,
|
|
317498
317505
|
recipient,
|
|
317499
317506
|
variables: readVariablePaths(value, node, report),
|
|
317500
317507
|
node
|
|
@@ -317682,6 +317689,7 @@ function resolveSchedules(schedules, definitions, context, diagnostics) {
|
|
|
317682
317689
|
timing: schedule.timing,
|
|
317683
317690
|
offsets: schedule.offsets,
|
|
317684
317691
|
filters: schedule.filters,
|
|
317692
|
+
automatic_filters: schedule.automaticFilters,
|
|
317685
317693
|
recipient_path: schedule.recipient,
|
|
317686
317694
|
variables: schedule.variables
|
|
317687
317695
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1177,7 +1177,8 @@ export type NotificationScheduleTiming = 'day' | 'exact';
|
|
|
1177
1177
|
* `notifications/<folder>/<handle>.schedule.ts` file. A schedule sends one
|
|
1178
1178
|
* template of its type on dates of a resource, for example 7 days after each
|
|
1179
1179
|
* member's `joined_on`. The deployed schedule is a System Notification: it
|
|
1180
|
-
* sends with no staff identity
|
|
1180
|
+
* sends with no staff identity. `filters` decides who gets it, and
|
|
1181
|
+
* `automaticFilters` decides who gets it without a staff action. The file
|
|
1181
1182
|
* holds the rule. The workspace keeps the generated notifications, their edits
|
|
1182
1183
|
* and holds, and the pause state. `diagonal check` writes a missing `uid`. No
|
|
1183
1184
|
* file refers to a schedule, so a schedule has a uid but no slug.
|
|
@@ -1200,8 +1201,14 @@ export type NotificationScheduleDefinition = UidOption & {
|
|
|
1200
1201
|
* before in exact timing). A duration without a sign counts after the date.
|
|
1201
1202
|
*/
|
|
1202
1203
|
offsets: readonly string[];
|
|
1203
|
-
/** Only the source records that match. */
|
|
1204
|
+
/** Only the source records that match, for automatic and staff sends. */
|
|
1204
1205
|
filters?: FilterGroup;
|
|
1206
|
+
/**
|
|
1207
|
+
* Of the records that match `filters`, the ones whose notifications the
|
|
1208
|
+
* schedule makes and sends on its own. Staff can still send to the other
|
|
1209
|
+
* records. Leave it out to send to every record that matches `filters`.
|
|
1210
|
+
*/
|
|
1211
|
+
automaticFilters?: FilterGroup;
|
|
1205
1212
|
/**
|
|
1206
1213
|
* The path of single-record relations from the source record to the type's
|
|
1207
1214
|
* recipient, for example `'member'` on a `memberships` source. Leave it out
|