@reventlessdev/trait-notification 1.0.0-alpha.50 → 1.0.0-alpha.51
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": "@reventlessdev/trait-notification",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.51",
|
|
4
4
|
"description": "Notification domain trait: rules, host contract, conformance suite and emitter for a per-recipient contact directory, a kind x channel subscription matrix, and the decision to send, suppress or record a message as undeliverable",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": [
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"sury": "11.0.0",
|
|
15
15
|
"sury-ppx": "11.0.0",
|
|
16
|
-
"@reventlessdev/reventless-gwt": "1.0.0-alpha.
|
|
17
|
-
"@reventlessdev/reventless-spec": "3.0.0-alpha.
|
|
16
|
+
"@reventlessdev/reventless-gwt": "1.0.0-alpha.249",
|
|
17
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.170"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"rescript": "12.3.1"
|
package/src/Notification.res
CHANGED
|
@@ -63,8 +63,8 @@ module type Binding = {
|
|
|
63
63
|
let transactional: category
|
|
64
64
|
let optional: category
|
|
65
65
|
|
|
66
|
-
module Spec: ReventlessGwt.
|
|
67
|
-
module
|
|
66
|
+
module Spec: ReventlessGwt.Decision_GWT.DecisionSpec
|
|
67
|
+
module Decision: ReventlessGwt.Decision_GWT.Decision with module Spec = Spec
|
|
68
68
|
|
|
69
69
|
/** The same facts as the slice **consumes** them, for building history.
|
|
70
70
|
|
|
@@ -13,7 +13,7 @@ to send nothing stay three different facts.
|
|
|
13
13
|
let suiteName = (host: string) => `${host} conforms to the notification trait`
|
|
14
14
|
|
|
15
15
|
module Make = (B: Notification.Binding) => {
|
|
16
|
-
module G = ReventlessGwt.
|
|
16
|
+
module G = ReventlessGwt.Decision_GWT.Make(B.Spec, B.Decision)
|
|
17
17
|
module R = Notification_Rules
|
|
18
18
|
|
|
19
19
|
let announced = Array.concat(B.Consumed.created, [B.Consumed.announced(B.addressA)])
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Decision_GWT$ReventlessGwt from "@reventlessdev/reventless-gwt/src/Decision_GWT.res.mjs";
|
|
4
4
|
|
|
5
5
|
function suiteName(host) {
|
|
6
6
|
return host + ` conforms to the notification trait`;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function Make(B) {
|
|
10
|
-
let $$let = B.
|
|
11
|
-
let G =
|
|
10
|
+
let $$let = B.Decision;
|
|
11
|
+
let G = Decision_GWT$ReventlessGwt.Make(B.Spec)({
|
|
12
12
|
initialState: $$let.initialState,
|
|
13
13
|
evolve: $$let.evolve,
|
|
14
14
|
decide: $$let.decide
|
|
@@ -56,4 +56,4 @@ export {
|
|
|
56
56
|
suiteName,
|
|
57
57
|
Make,
|
|
58
58
|
}
|
|
59
|
-
/*
|
|
59
|
+
/* Decision_GWT-ReventlessGwt Not a pure module */
|
|
@@ -349,7 +349,7 @@ let postureArms = (c: config) => {
|
|
|
349
349
|
Array.concat(transactional, [` | _ => false`])
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
let
|
|
352
|
+
let sliceDecision = (c: config): string => {
|
|
353
353
|
let n = namesOf(c)
|
|
354
354
|
let id = n.recipientId
|
|
355
355
|
let first = c.categories->Array.get(0)->Option.getOr("Transactional")
|
|
@@ -357,7 +357,7 @@ let sliceBehavior = (c: config): string => {
|
|
|
357
357
|
Array.flatMap(
|
|
358
358
|
[
|
|
359
359
|
[
|
|
360
|
-
`@@reventless.
|
|
360
|
+
`@@reventless.decision`,
|
|
361
361
|
``,
|
|
362
362
|
`// The directory, the matrix and the dispatch decision are the trait's; this file`,
|
|
363
363
|
`// is the mapping onto them, plus the one thing the trait has no opinion about —`,
|
|
@@ -622,10 +622,10 @@ let claimsSpec = (c: config): string => {
|
|
|
622
622
|
])
|
|
623
623
|
}
|
|
624
624
|
|
|
625
|
-
let
|
|
625
|
+
let claimsDecision = (c: config): string => {
|
|
626
626
|
let n = namesOf(c)
|
|
627
627
|
lines([
|
|
628
|
-
`@@reventless.
|
|
628
|
+
`@@reventless.decision`,
|
|
629
629
|
``,
|
|
630
630
|
`// The claim set is the trait's, folded through the same value the preferences`,
|
|
631
631
|
`// slice folds. Only the claim half is ever populated here.`,
|
|
@@ -861,7 +861,7 @@ let conformanceBinding = (c: config): string => {
|
|
|
861
861
|
` let optional: category = ${optional}`,
|
|
862
862
|
``,
|
|
863
863
|
` module Spec = ${n.slice}`,
|
|
864
|
-
` module
|
|
864
|
+
` module Decision = ${n.slice}_Decision`,
|
|
865
865
|
``,
|
|
866
866
|
` let ${id} = "${c.noun->String.toLowerCase}-1"`,
|
|
867
867
|
``,
|
|
@@ -875,9 +875,9 @@ let conformanceBinding = (c: config): string => {
|
|
|
875
875
|
` let announced = (${c.contactField}): Spec.consumedEvent =>`,
|
|
876
876
|
` ${n.announced}({${id}: ${id}, ${c.contactField}: ${c.contactField}})`,
|
|
877
877
|
` let subscribed = (category, channel): Spec.consumedEvent =>`,
|
|
878
|
-
` ${n.subscribed}({${id}: ${id}, category, channel:
|
|
878
|
+
` ${n.subscribed}({${id}: ${id}, category, channel: Decision.channelOf(channel)})`,
|
|
879
879
|
` let unsubscribed = (category, channel): Spec.consumedEvent =>`,
|
|
880
|
-
` ${n.unsubscribed}({${id}: ${id}, category, channel:
|
|
880
|
+
` ${n.unsubscribed}({${id}: ${id}, category, channel: Decision.channelOf(channel)})`,
|
|
881
881
|
` // Written by ${n.claims} and read here across partitions — this slice`,
|
|
882
882
|
` // consumes them and produces neither.`,
|
|
883
883
|
` let claimed = (source, by): Spec.consumedEvent =>`,
|
|
@@ -888,9 +888,9 @@ let conformanceBinding = (c: config): string => {
|
|
|
888
888
|
` let announce = ${c.contactField} =>`,
|
|
889
889
|
` Spec.${n.announceCmd}({${id}: ${id}, ${c.contactField}: ${c.contactField}})`,
|
|
890
890
|
` let subscribe = (category, channel) =>`,
|
|
891
|
-
` Spec.${n.subscribeCmd}({${id}: ${id}, category, channel:
|
|
891
|
+
` Spec.${n.subscribeCmd}({${id}: ${id}, category, channel: Decision.channelOf(channel)})`,
|
|
892
892
|
` let unsubscribe = (category, channel) =>`,
|
|
893
|
-
` Spec.${n.unsubscribeCmd}({${id}: ${id}, category, channel:
|
|
893
|
+
` Spec.${n.unsubscribeCmd}({${id}: ${id}, category, channel: Decision.channelOf(channel)})`,
|
|
894
894
|
` // The wording and the subject are this host's and the trait carries neither, so`,
|
|
895
895
|
` // the suite supplies whatever it likes and asserts nothing about them.`,
|
|
896
896
|
` //`,
|
|
@@ -920,15 +920,15 @@ let conformanceBinding = (c: config): string => {
|
|
|
920
920
|
` let announced = ${c.contactField} =>`,
|
|
921
921
|
` Spec.${n.announced}({${id}: ${id}, ${c.contactField}: ${c.contactField}})`,
|
|
922
922
|
` let subscribed = (category, channel) =>`,
|
|
923
|
-
` Spec.${n.subscribed}({${id}: ${id}, category, channel:
|
|
923
|
+
` Spec.${n.subscribed}({${id}: ${id}, category, channel: Decision.channelOf(channel)})`,
|
|
924
924
|
` let unsubscribed = (category, channel) =>`,
|
|
925
|
-
` Spec.${n.unsubscribed}({${id}: ${id}, category, channel:
|
|
925
|
+
` Spec.${n.unsubscribed}({${id}: ${id}, category, channel: Decision.channelOf(channel)})`,
|
|
926
926
|
` let requestedWith = (category, reference, channel, address, origin) =>`,
|
|
927
927
|
` Spec.${n.requested}({`,
|
|
928
928
|
` ${id}: ${id},`,
|
|
929
929
|
` category,`,
|
|
930
930
|
` reference,`,
|
|
931
|
-
` channel:
|
|
931
|
+
` channel: Decision.channelOf(channel),`,
|
|
932
932
|
` address,`,
|
|
933
933
|
` subjectType: "${subjectTypeOf(c)}",`,
|
|
934
934
|
` subjectRef: "subject-1",`,
|
|
@@ -1224,7 +1224,7 @@ let intakeRelayPatch = (c: config): patch => {
|
|
|
1224
1224
|
` ${id},`,
|
|
1225
1225
|
` ${n.intake}.${n.requestCmd}({`,
|
|
1226
1226
|
` ${id}: ${id},`,
|
|
1227
|
-
` category: ${n.slice}
|
|
1227
|
+
` category: ${n.slice}_Decision.categoryOf(rule.category),`,
|
|
1228
1228
|
` reference: id,`,
|
|
1229
1229
|
` subjectType: rule.subjectType,`,
|
|
1230
1230
|
` subjectRef: Rule.subjectOf(rule, ~payload),`,
|
|
@@ -1261,11 +1261,11 @@ let emit = (~config: config, ~into: string, ~tests: string): output => {
|
|
|
1261
1261
|
{
|
|
1262
1262
|
files: [
|
|
1263
1263
|
{path: `${into}/StateChange/${n.slice}.res`, contents: sliceSpec(config)},
|
|
1264
|
-
{path: `${into}/StateChange/${n.slice}
|
|
1264
|
+
{path: `${into}/StateChange/${n.slice}_Decision.res`, contents: sliceDecision(config)},
|
|
1265
1265
|
{path: `${into}/StateChange/${n.claims}.res`, contents: claimsSpec(config)},
|
|
1266
1266
|
{
|
|
1267
|
-
path: `${into}/StateChange/${n.claims}
|
|
1268
|
-
contents:
|
|
1267
|
+
path: `${into}/StateChange/${n.claims}_Decision.res`,
|
|
1268
|
+
contents: claimsDecision(config),
|
|
1269
1269
|
},
|
|
1270
1270
|
{path: `${into}/OutboundTranslation/${n.send}.res`, contents: sendSpec(config)},
|
|
1271
1271
|
{
|
|
@@ -254,13 +254,13 @@ function postureArms(c) {
|
|
|
254
254
|
return transactional.concat([` | _ => false`]);
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
function
|
|
257
|
+
function sliceDecision(c) {
|
|
258
258
|
let n = namesOf(c);
|
|
259
259
|
let id = n.recipientId;
|
|
260
260
|
let first = Stdlib_Option.getOr(c.categories[0], "Transactional");
|
|
261
261
|
return [
|
|
262
262
|
[
|
|
263
|
-
`@@reventless.
|
|
263
|
+
`@@reventless.decision`,
|
|
264
264
|
``,
|
|
265
265
|
`// The directory, the matrix and the dispatch decision are the trait's; this file`,
|
|
266
266
|
`// is the mapping onto them, plus the one thing the trait has no opinion about —`,
|
|
@@ -521,10 +521,10 @@ function claimsSpec(c) {
|
|
|
521
521
|
].join("\n");
|
|
522
522
|
}
|
|
523
523
|
|
|
524
|
-
function
|
|
524
|
+
function claimsDecision(c) {
|
|
525
525
|
let n = namesOf(c);
|
|
526
526
|
return [
|
|
527
|
-
`@@reventless.
|
|
527
|
+
`@@reventless.decision`,
|
|
528
528
|
``,
|
|
529
529
|
`// The claim set is the trait's, folded through the same value the preferences`,
|
|
530
530
|
`// slice folds. Only the claim half is ever populated here.`,
|
|
@@ -753,7 +753,7 @@ function conformanceBinding(c) {
|
|
|
753
753
|
` let optional: category = ` + optional,
|
|
754
754
|
``,
|
|
755
755
|
` module Spec = ` + n.slice,
|
|
756
|
-
` module
|
|
756
|
+
` module Decision = ` + n.slice + `_Decision`,
|
|
757
757
|
``,
|
|
758
758
|
` let ` + id + ` = "` + c.noun.toLowerCase() + `-1"`,
|
|
759
759
|
``,
|
|
@@ -767,9 +767,9 @@ function conformanceBinding(c) {
|
|
|
767
767
|
` let announced = (` + c.contactField + `): Spec.consumedEvent =>`,
|
|
768
768
|
` ` + n.announced + `({` + id + `: ` + id + `, ` + c.contactField + `: ` + c.contactField + `})`,
|
|
769
769
|
` let subscribed = (category, channel): Spec.consumedEvent =>`,
|
|
770
|
-
` ` + n.subscribed + `({` + id + `: ` + id + `, category, channel:
|
|
770
|
+
` ` + n.subscribed + `({` + id + `: ` + id + `, category, channel: Decision.channelOf(channel)})`,
|
|
771
771
|
` let unsubscribed = (category, channel): Spec.consumedEvent =>`,
|
|
772
|
-
` ` + n.unsubscribed + `({` + id + `: ` + id + `, category, channel:
|
|
772
|
+
` ` + n.unsubscribed + `({` + id + `: ` + id + `, category, channel: Decision.channelOf(channel)})`,
|
|
773
773
|
` // Written by ` + n.claims + ` and read here across partitions — this slice`,
|
|
774
774
|
` // consumes them and produces neither.`,
|
|
775
775
|
` let claimed = (source, by): Spec.consumedEvent =>`,
|
|
@@ -780,9 +780,9 @@ function conformanceBinding(c) {
|
|
|
780
780
|
` let announce = ` + c.contactField + ` =>`,
|
|
781
781
|
` Spec.` + n.announceCmd + `({` + id + `: ` + id + `, ` + c.contactField + `: ` + c.contactField + `})`,
|
|
782
782
|
` let subscribe = (category, channel) =>`,
|
|
783
|
-
` Spec.` + n.subscribeCmd + `({` + id + `: ` + id + `, category, channel:
|
|
783
|
+
` Spec.` + n.subscribeCmd + `({` + id + `: ` + id + `, category, channel: Decision.channelOf(channel)})`,
|
|
784
784
|
` let unsubscribe = (category, channel) =>`,
|
|
785
|
-
` Spec.` + n.unsubscribeCmd + `({` + id + `: ` + id + `, category, channel:
|
|
785
|
+
` Spec.` + n.unsubscribeCmd + `({` + id + `: ` + id + `, category, channel: Decision.channelOf(channel)})`,
|
|
786
786
|
` // The wording and the subject are this host's and the trait carries neither, so`,
|
|
787
787
|
` // the suite supplies whatever it likes and asserts nothing about them.`,
|
|
788
788
|
` //`,
|
|
@@ -812,15 +812,15 @@ function conformanceBinding(c) {
|
|
|
812
812
|
` let announced = ` + c.contactField + ` =>`,
|
|
813
813
|
` Spec.` + n.announced + `({` + id + `: ` + id + `, ` + c.contactField + `: ` + c.contactField + `})`,
|
|
814
814
|
` let subscribed = (category, channel) =>`,
|
|
815
|
-
` Spec.` + n.subscribed + `({` + id + `: ` + id + `, category, channel:
|
|
815
|
+
` Spec.` + n.subscribed + `({` + id + `: ` + id + `, category, channel: Decision.channelOf(channel)})`,
|
|
816
816
|
` let unsubscribed = (category, channel) =>`,
|
|
817
|
-
` Spec.` + n.unsubscribed + `({` + id + `: ` + id + `, category, channel:
|
|
817
|
+
` Spec.` + n.unsubscribed + `({` + id + `: ` + id + `, category, channel: Decision.channelOf(channel)})`,
|
|
818
818
|
` let requestedWith = (category, reference, channel, address, origin) =>`,
|
|
819
819
|
` Spec.` + n.requested + `({`,
|
|
820
820
|
` ` + id + `: ` + id + `,`,
|
|
821
821
|
` category,`,
|
|
822
822
|
` reference,`,
|
|
823
|
-
` channel:
|
|
823
|
+
` channel: Decision.channelOf(channel),`,
|
|
824
824
|
` address,`,
|
|
825
825
|
` subjectType: "` + subjectTypeOf(c) + `",`,
|
|
826
826
|
` subjectRef: "subject-1",`,
|
|
@@ -1101,7 +1101,7 @@ function intakeRelayPatch(c) {
|
|
|
1101
1101
|
` ` + id + `,`,
|
|
1102
1102
|
` ` + n.intake + `.` + n.requestCmd + `({`,
|
|
1103
1103
|
` ` + id + `: ` + id + `,`,
|
|
1104
|
-
` category: ` + n.slice + `
|
|
1104
|
+
` category: ` + n.slice + `_Decision.categoryOf(rule.category),`,
|
|
1105
1105
|
` reference: id,`,
|
|
1106
1106
|
` subjectType: rule.subjectType,`,
|
|
1107
1107
|
` subjectRef: Rule.subjectOf(rule, ~payload),`,
|
|
@@ -1136,16 +1136,16 @@ function emit(config, into, tests) {
|
|
|
1136
1136
|
contents: sliceSpec(config)
|
|
1137
1137
|
},
|
|
1138
1138
|
{
|
|
1139
|
-
path: into + `/StateChange/` + n.slice + `
|
|
1140
|
-
contents:
|
|
1139
|
+
path: into + `/StateChange/` + n.slice + `_Decision.res`,
|
|
1140
|
+
contents: sliceDecision(config)
|
|
1141
1141
|
},
|
|
1142
1142
|
{
|
|
1143
1143
|
path: into + `/StateChange/` + n.claims + `.res`,
|
|
1144
1144
|
contents: claimsSpec(config)
|
|
1145
1145
|
},
|
|
1146
1146
|
{
|
|
1147
|
-
path: into + `/StateChange/` + n.claims + `
|
|
1148
|
-
contents:
|
|
1147
|
+
path: into + `/StateChange/` + n.claims + `_Decision.res`,
|
|
1148
|
+
contents: claimsDecision(config)
|
|
1149
1149
|
},
|
|
1150
1150
|
{
|
|
1151
1151
|
path: into + `/OutboundTranslation/` + n.send + `.res`,
|
|
@@ -1178,9 +1178,9 @@ export {
|
|
|
1178
1178
|
categoryArms,
|
|
1179
1179
|
sliceSpec,
|
|
1180
1180
|
postureArms,
|
|
1181
|
-
|
|
1181
|
+
sliceDecision,
|
|
1182
1182
|
claimsSpec,
|
|
1183
|
-
|
|
1183
|
+
claimsDecision,
|
|
1184
1184
|
sendSpec,
|
|
1185
1185
|
sendTranslation,
|
|
1186
1186
|
conformanceBinding,
|