Created
May 21, 2023 20:02
-
-
Save vigoo/57424d59ca610527e2a6b502eee3ed88 to your computer and use it in GitHub Desktop.
zio-flow serialization example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Fold": { | |
"value": { | |
"Input": {} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "244cdfef-1c83-4ea1-99ce-f683138ef78f" | |
}, | |
"result": { | |
"Flow": { | |
"Fold": { | |
"value": { | |
"Fork": { | |
"Fold": { | |
"value": { | |
"Return": { | |
"Ignore": {} | |
} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "e0fc8239-911f-4d2d-8c98-c6eb19f3b111" | |
}, | |
"result": { | |
"Flow": { | |
"Fold": { | |
"value": { | |
"Fold": { | |
"value": { | |
"Now": {} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "f61748c9-43a9-4d98-bde1-5d2cdc16d0c3" | |
}, | |
"result": { | |
"Flow": { | |
"Return": { | |
"Bind": { | |
"unbound": { | |
"identifier": "af12cc1b-89af-4a18-804d-ab251afbc3d3" | |
}, | |
"value": { | |
"Unary": { | |
"value": { | |
"Tuple2": [ | |
{ | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"Unbound": { | |
"identifier": "f61748c9-43a9-4d98-bde1-5d2cdc16d0c3" | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Bind": { | |
"unbound": { | |
"identifier": "66d19d1a-afd3-4c6f-9bfa-d09ad32a84d5" | |
}, | |
"value": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "FOREVER" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"Unary": { | |
"value": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 9223372036854775807 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToBigDecimal": { | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 9223372036854775807 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToBigDecimal": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"BigDecimal": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Div", | |
"numeric": { | |
"NumericBigDecimal": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericBigDecimal": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 999999999 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToBigDecimal": { | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 999999999 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToBigDecimal": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"BigDecimal": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Div", | |
"numeric": { | |
"NumericBigDecimal": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericBigDecimal": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericBigDecimal": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"BigDecimalToDuration": {} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "ERAS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 31556952000000000 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "MILLENNIA" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 31556952000 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "CENTURIES" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 3155695200 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "DECADES" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 315569520 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "YEARS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 31556952 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "MONTHS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 2629746 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "WEEKS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 604800 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "DAYS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 86400 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "HALF_DAYS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 43200 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 3600 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "MINUTES" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 60 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 1 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "MILLIS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 1000000 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "MICROS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 1000 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 1 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Fail": "Unsupported ChronoUnit" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"inner": { | |
"Branch": { | |
"predicate": { | |
"Unary": { | |
"value": { | |
"Binary": { | |
"left": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "66d19d1a-afd3-4c6f-9bfa-d09ad32a84d5" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 86400 | |
} | |
}, | |
"operator": { | |
"LessThanEqual": { | |
"schema": { | |
"Value": { | |
"valueType": "long", | |
"path": [], | |
"optional": false | |
} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Bool": { | |
"operator": "Not" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"Fail": "Unit is too large to be used for truncation" | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Bind": { | |
"unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
}, | |
"value": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "66d19d1a-afd3-4c6f-9bfa-d09ad32a84d5" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mul", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "66d19d1a-afd3-4c6f-9bfa-d09ad32a84d5" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"inner": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Literal": { | |
"Long": 86400000000000 | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mod", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 0 | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"Bind": { | |
"unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
}, | |
"value": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "f61748c9-43a9-4d98-bde1-5d2cdc16d0c3" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 86400 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mod", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mul", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "f61748c9-43a9-4d98-bde1-5d2cdc16d0c3" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"inner": { | |
"Unary": { | |
"value": { | |
"Tuple2": [ | |
{ | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "f61748c9-43a9-4d98-bde1-5d2cdc16d0c3" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"right": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "FloorDiv", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mul", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Sub", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "AddExact", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "FloorDiv", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mul", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Sub", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Div", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "AddExact", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"Unary": { | |
"value": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "f61748c9-43a9-4d98-bde1-5d2cdc16d0c3" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "FloorDiv", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mul", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Sub", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mod", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToInt": { | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
] | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"TupleToInstant": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Fail": "Unit must divide into a standard day without remainder" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"right": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"Literal": { | |
"Int": 10 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 60 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mul", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unary": { | |
"value": { | |
"Literal": { | |
"Int": 0 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "AddExact", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"Literal": { | |
"Int": 10 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 60 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mul", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unary": { | |
"value": { | |
"Literal": { | |
"Int": 0 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Div", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "AddExact", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"Unary": { | |
"value": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"Unbound": { | |
"identifier": "f61748c9-43a9-4d98-bde1-5d2cdc16d0c3" | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Bind": { | |
"unbound": { | |
"identifier": "66d19d1a-afd3-4c6f-9bfa-d09ad32a84d5" | |
}, | |
"value": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "FOREVER" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"Unary": { | |
"value": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 9223372036854775807 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToBigDecimal": { | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 9223372036854775807 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToBigDecimal": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"BigDecimal": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Div", | |
"numeric": { | |
"NumericBigDecimal": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericBigDecimal": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 999999999 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToBigDecimal": { | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 999999999 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToBigDecimal": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"BigDecimal": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Div", | |
"numeric": { | |
"NumericBigDecimal": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericBigDecimal": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericBigDecimal": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"BigDecimalToDuration": {} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "ERAS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 31556952000000000 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "MILLENNIA" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 31556952000 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "CENTURIES" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 3155695200 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "DECADES" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 315569520 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "YEARS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 31556952 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "MONTHS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 2629746 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "WEEKS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 604800 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "DAYS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 86400 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "HALF_DAYS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 43200 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 3600 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "MINUTES" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 60 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 1 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "MILLIS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 1000000 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "MICROS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 1000 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
}, | |
"right": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 1 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Fail": "Unsupported ChronoUnit" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"inner": { | |
"Branch": { | |
"predicate": { | |
"Unary": { | |
"value": { | |
"Binary": { | |
"left": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "66d19d1a-afd3-4c6f-9bfa-d09ad32a84d5" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 86400 | |
} | |
}, | |
"operator": { | |
"LessThanEqual": { | |
"schema": { | |
"Value": { | |
"valueType": "long", | |
"path": [], | |
"optional": false | |
} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Bool": { | |
"operator": "Not" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"Fail": "Unit is too large to be used for truncation" | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Bind": { | |
"unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
}, | |
"value": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "66d19d1a-afd3-4c6f-9bfa-d09ad32a84d5" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mul", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "66d19d1a-afd3-4c6f-9bfa-d09ad32a84d5" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"inner": { | |
"Branch": { | |
"predicate": { | |
"Equal": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Literal": { | |
"Long": 86400000000000 | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mod", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 0 | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"Bind": { | |
"unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
}, | |
"value": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "f61748c9-43a9-4d98-bde1-5d2cdc16d0c3" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 86400 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mod", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mul", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "f61748c9-43a9-4d98-bde1-5d2cdc16d0c3" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"inner": { | |
"Unary": { | |
"value": { | |
"Tuple2": [ | |
{ | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "f61748c9-43a9-4d98-bde1-5d2cdc16d0c3" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"right": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "FloorDiv", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mul", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Sub", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "AddExact", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "FloorDiv", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mul", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Sub", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Div", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "AddExact", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"Unary": { | |
"value": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "f61748c9-43a9-4d98-bde1-5d2cdc16d0c3" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "FloorDiv", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "7ce31d8a-9d4c-4c12-8075-149f042a7d76" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mul", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unbound": { | |
"identifier": "79a2bf68-c7e7-440c-a83c-a4b5da3c9f5a" | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Sub", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "NANOS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mod", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToInt": { | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
] | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"TupleToInstant": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Fail": "Unit must divide into a standard day without remainder" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"Literal": { | |
"Int": 10 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 60 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mul", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Unary": { | |
"value": { | |
"Literal": { | |
"Int": 0 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "SECONDS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mod", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToInt": { | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
] | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"TupleToInstant": {} | |
} | |
} | |
} | |
} | |
}, | |
"inner": { | |
"Branch": { | |
"predicate": { | |
"Unary": { | |
"value": { | |
"Binary": { | |
"left": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "af12cc1b-89af-4a18-804d-ab251afbc3d3" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"right": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "f61748c9-43a9-4d98-bde1-5d2cdc16d0c3" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"LessThanEqual": { | |
"schema": { | |
"Value": { | |
"valueType": "long", | |
"path": [], | |
"optional": false | |
} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Bool": { | |
"operator": "Not" | |
} | |
} | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"RemoteSome": { | |
"Unbound": { | |
"identifier": "af12cc1b-89af-4a18-804d-ab251afbc3d3" | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"RemoteSome": { | |
"Unary": { | |
"value": { | |
"Tuple2": [ | |
{ | |
"Binary": { | |
"left": { | |
"Binary": { | |
"left": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "af12cc1b-89af-4a18-804d-ab251afbc3d3" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"right": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 1 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 0, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "AddExact", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 1 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Div", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Integral": { | |
"operator": "AddExact", | |
"integral": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"Unary": { | |
"value": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"Unbound": { | |
"identifier": "af12cc1b-89af-4a18-804d-ab251afbc3d3" | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"InstantToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Binary": { | |
"left": { | |
"Unary": { | |
"value": { | |
"TupleAccess": { | |
"tuple": { | |
"Unary": { | |
"value": { | |
"DurationFromAmount": { | |
"amount": { | |
"Literal": { | |
"Long": 1 | |
} | |
}, | |
"temporalUnit": { | |
"Literal": { | |
"String": "HOURS" | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"DurationToTuple": {} | |
} | |
} | |
} | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToLong": { | |
"numeric": { | |
"NumericInt": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"Long": 1000000000 | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Mod", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Numeric": { | |
"operator": "Add", | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"NumericToInt": { | |
"numeric": { | |
"NumericLong": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
] | |
}, | |
"operator": { | |
"Conversion": { | |
"conversion": { | |
"TupleToInstant": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "3b7aa600-4dbc-428d-abbe-694ba4124d0e" | |
}, | |
"result": { | |
"Flow": { | |
"Unwrap": { | |
"remote": { | |
"FoldOption": { | |
"option": { | |
"Unbound": { | |
"identifier": "3b7aa600-4dbc-428d-abbe-694ba4124d0e" | |
} | |
}, | |
"ifEmpty": { | |
"Flow": { | |
"Return": { | |
"Literal": { | |
"NoneValue": {} | |
} | |
} | |
} | |
}, | |
"ifNonEmpty": { | |
"input": { | |
"identifier": "6a956144-47c6-4079-83db-5ac2d2ad9e06" | |
}, | |
"result": { | |
"Flow": { | |
"Fold": { | |
"value": { | |
"Fold": { | |
"value": { | |
"WaitTill": { | |
"Unbound": { | |
"identifier": "6a956144-47c6-4079-83db-5ac2d2ad9e06" | |
} | |
} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "08aae83b-cf95-4214-be14-9bc68b0b9195" | |
}, | |
"result": { | |
"Flow": { | |
"Fold": { | |
"value": { | |
"Fold": { | |
"value": { | |
"Fold": { | |
"value": { | |
"RunActivity": { | |
"input": { | |
"Unbound": { | |
"identifier": "244cdfef-1c83-4ea1-99ce-f683138ef78f" | |
} | |
}, | |
"activity": { | |
"name": "checkAccountExpiration", | |
"description": "Checks if the given account is expired", | |
"operation": { | |
"ContraMap": { | |
"inner": { | |
"Http": { | |
"host": "localhost", | |
"api": { | |
"method": "GET", | |
"requestInput": { | |
"Path": { | |
"ZipWith": { | |
"left": { | |
"ZipWith": { | |
"left": { | |
"Literal": { | |
"string": "/users" | |
} | |
}, | |
"right": { | |
"Match": { | |
"schema": { | |
"Value": { | |
"valueType": "int", | |
"path": [], | |
"optional": false | |
} | |
} | |
} | |
}, | |
"zipper": { | |
"leftIdentity": {} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"string": "/expired" | |
} | |
}, | |
"zipper": { | |
"rightIdentity": {} | |
} | |
} | |
} | |
}, | |
"outputSchema": { | |
"Value": { | |
"valueType": "boolean", | |
"path": [], | |
"optional": false | |
} | |
} | |
} | |
} | |
}, | |
"f": { | |
"input": { | |
"identifier": "b9426448-b469-4009-8830-9121e734c5d6" | |
}, | |
"result": { | |
"OpticGet": { | |
"optic": { | |
"Lens": { | |
"fieldName": "id" | |
} | |
}, | |
"value": { | |
"Unbound": { | |
"identifier": "b9426448-b469-4009-8830-9121e734c5d6" | |
} | |
} | |
} | |
} | |
}, | |
"inputSchema": { | |
"Product": { | |
"id": "zio.flow.server.Examples.UserId", | |
"path": [], | |
"fields": [ | |
[ | |
"id", | |
{ | |
"Value": { | |
"valueType": "int", | |
"path": [ | |
"id" | |
], | |
"optional": false | |
} | |
} | |
] | |
], | |
"optional": false | |
} | |
} | |
} | |
}, | |
"check": { | |
"Fold": { | |
"value": { | |
"Fold": { | |
"value": { | |
"Input": {} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "732cc9f6-0e37-4269-a80c-586c963da60e" | |
}, | |
"result": { | |
"Flow": { | |
"Return": { | |
"OpticGet": { | |
"optic": { | |
"Lens": { | |
"fieldName": "id" | |
} | |
}, | |
"value": { | |
"Unbound": { | |
"identifier": "732cc9f6-0e37-4269-a80c-586c963da60e" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "06d11bf1-fc2e-4865-b8d2-ad1b80f03579" | |
}, | |
"result": { | |
"Flow": { | |
"Provide": { | |
"value": { | |
"Unbound": { | |
"identifier": "06d11bf1-fc2e-4865-b8d2-ad1b80f03579" | |
} | |
}, | |
"flow": { | |
"Fail": { | |
"Literal": { | |
"Record": { | |
"id": "zio.flow.ActivityError", | |
"values": [ | |
[ | |
"failure", | |
{ | |
"String": "Check is not supported for this Activity" | |
} | |
], | |
[ | |
"details", | |
{ | |
"NoneValue": {} | |
} | |
] | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"compensate": { | |
"Return": { | |
"Ignore": {} | |
} | |
} | |
} | |
} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "dee3191a-eea7-425a-833f-5c005f6ea9e2" | |
}, | |
"result": { | |
"Flow": { | |
"Fold": { | |
"value": { | |
"Unwrap": { | |
"remote": { | |
"Branch": { | |
"predicate": { | |
"Unbound": { | |
"identifier": "dee3191a-eea7-425a-833f-5c005f6ea9e2" | |
} | |
}, | |
"ifTrue": { | |
"Lazy": { | |
"Flow": { | |
"Fold": { | |
"value": { | |
"RunActivity": { | |
"input": { | |
"Unbound": { | |
"identifier": "244cdfef-1c83-4ea1-99ce-f683138ef78f" | |
} | |
}, | |
"activity": { | |
"name": "sendWarningEmail", | |
"description": "Sends a warning email to the given user", | |
"operation": { | |
"ContraMap": { | |
"inner": { | |
"Http": { | |
"host": "localhost", | |
"api": { | |
"method": "POST", | |
"requestInput": { | |
"Path": { | |
"ZipWith": { | |
"left": { | |
"ZipWith": { | |
"left": { | |
"Literal": { | |
"string": "/users" | |
} | |
}, | |
"right": { | |
"Match": { | |
"schema": { | |
"Value": { | |
"valueType": "int", | |
"path": [], | |
"optional": false | |
} | |
} | |
} | |
}, | |
"zipper": { | |
"leftIdentity": {} | |
} | |
} | |
}, | |
"right": { | |
"Literal": { | |
"string": "/warning" | |
} | |
}, | |
"zipper": { | |
"rightIdentity": {} | |
} | |
} | |
} | |
}, | |
"outputSchema": { | |
"Value": { | |
"valueType": "unit", | |
"path": [], | |
"optional": false | |
} | |
} | |
} | |
} | |
}, | |
"f": { | |
"input": { | |
"identifier": "817e65f2-a413-4aaf-91ef-ae7fe6a166b7" | |
}, | |
"result": { | |
"OpticGet": { | |
"optic": { | |
"Lens": { | |
"fieldName": "id" | |
} | |
}, | |
"value": { | |
"Unbound": { | |
"identifier": "817e65f2-a413-4aaf-91ef-ae7fe6a166b7" | |
} | |
} | |
} | |
} | |
}, | |
"inputSchema": { | |
"Product": { | |
"id": "zio.flow.server.Examples.UserId", | |
"path": [], | |
"fields": [ | |
[ | |
"id", | |
{ | |
"Value": { | |
"valueType": "int", | |
"path": [ | |
"id" | |
], | |
"optional": false | |
} | |
} | |
] | |
], | |
"optional": false | |
} | |
} | |
} | |
}, | |
"check": { | |
"Fold": { | |
"value": { | |
"Fold": { | |
"value": { | |
"Input": {} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "d526a791-b1ce-4eae-9e5e-6cbde38ce7de" | |
}, | |
"result": { | |
"Flow": { | |
"Return": { | |
"OpticGet": { | |
"optic": { | |
"Lens": { | |
"fieldName": "id" | |
} | |
}, | |
"value": { | |
"Unbound": { | |
"identifier": "d526a791-b1ce-4eae-9e5e-6cbde38ce7de" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "28ff5cff-da78-4480-8f87-c3f9d1f854e5" | |
}, | |
"result": { | |
"Flow": { | |
"Provide": { | |
"value": { | |
"Unbound": { | |
"identifier": "28ff5cff-da78-4480-8f87-c3f9d1f854e5" | |
} | |
}, | |
"flow": { | |
"Fail": { | |
"Literal": { | |
"Record": { | |
"id": "zio.flow.ActivityError", | |
"values": [ | |
[ | |
"failure", | |
{ | |
"String": "Check is not supported for this Activity" | |
} | |
], | |
[ | |
"details", | |
{ | |
"NoneValue": {} | |
} | |
] | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"compensate": { | |
"Return": { | |
"Ignore": {} | |
} | |
} | |
} | |
} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "23d3af20-88dd-42a7-ad48-fc2bdc14293b" | |
}, | |
"result": { | |
"Flow": { | |
"Return": { | |
"Literal": { | |
"Unit": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"ifFalse": { | |
"Lazy": { | |
"Flow": { | |
"Return": { | |
"Ignore": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "4ba8c425-e3d8-4d06-a464-f8e9d520b87a" | |
}, | |
"result": { | |
"Flow": { | |
"Return": { | |
"Literal": { | |
"Unit": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "a89e75c7-cdd7-4e43-8611-07476eb39584" | |
}, | |
"result": { | |
"Flow": { | |
"Return": { | |
"RemoteSome": { | |
"Unbound": { | |
"identifier": "a89e75c7-cdd7-4e43-8611-07476eb39584" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "fd44a49f-701d-4c7c-828d-daceda4c9dd4" | |
}, | |
"result": { | |
"Flow": { | |
"Return": { | |
"Tuple2": [ | |
{ | |
"Unbound": { | |
"identifier": "08aae83b-cf95-4214-be14-9bc68b0b9195" | |
} | |
}, | |
{ | |
"Unbound": { | |
"identifier": "fd44a49f-701d-4c7c-828d-daceda4c9dd4" | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "05c449ea-cfa3-4e31-a617-7a830d5fe234" | |
}, | |
"result": { | |
"Flow": { | |
"Return": { | |
"TupleAccess": { | |
"tuple": { | |
"Unbound": { | |
"identifier": "05c449ea-cfa3-4e31-a617-7a830d5fe234" | |
} | |
}, | |
"n": 1, | |
"arity": 2 | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"successCase": { | |
"input": { | |
"identifier": "ebbc9448-5e7f-4e85-9632-4c880856424d" | |
}, | |
"result": { | |
"Flow": { | |
"Return": { | |
"Literal": { | |
"Unit": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zio.ZNothing | |
import zio.flow.operation.http._ | |
import zio.schema._ | |
import zio.schema.codec.JsonCodec | |
object Examples extends App { | |
import zio.flow._ | |
final case class UserId(id: Int) extends AnyVal | |
object UserId { | |
implicit val schema = DeriveSchema.gen[UserId] | |
val (id) = Remote.makeAccessors[UserId] | |
} | |
val checkAccountExpiration: Activity[UserId, Boolean] = | |
Activity( | |
"checkAccountExpiration", | |
"Checks if the given account is expired", | |
Operation.Http( | |
"localhost", | |
API | |
.get("users" / int / "expired") | |
.output[Boolean] | |
), | |
check = Activity.checkNotSupported, | |
compensate = Activity.compensateNotSupported | |
).contramap[UserId](userId => UserId.id.get(userId)) | |
val sendWarningEmail: Activity[UserId, Unit] = | |
Activity( | |
"sendWarningEmail", | |
"Sends a warning email to the given user", | |
Operation.Http( | |
"localhost", | |
API | |
.post("users" / int / "warning") | |
.output[Unit] | |
), | |
check = Activity.checkNotSupported, | |
compensate = Activity.compensateNotSupported | |
).contramap[UserId](userId => UserId.id.get(userId)) | |
val flow: ZFlow[UserId, ZNothing, Unit] = | |
ZFlow.input[UserId].flatMap { userId: Remote[UserId] => | |
val loop = for { | |
isExpired <- checkAccountExpiration(userId) | |
_ <- ZFlow.when(isExpired)(sendWarningEmail(userId)) | |
} yield () | |
loop | |
.schedule(ZFlowSchedule.everyHourAt(minute = 10, second = 0)) | |
.fork | |
.unit | |
} | |
val json = JsonCodec.jsonCodec(ZFlow.schema[UserId, ZNothing, Unit]).encodeJson(flow, Some(2)) | |
println(json) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment