rescript-relay 0.0.0-version-3-3504d777 → 0.0.0-version-3-8b552902

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/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@ Dedicated tooling for migrating is coming, as well as docs.
8
8
 
9
9
  ## Breaking changes
10
10
 
11
+ - Unions are now represented as regular variants. Commit showing how this is migrated to in the tests: https://github.com/zth/rescript-relay/commit/3b5df51b80a0e1222b376fcfc730bb5dd0de099a
12
+
13
+ # 0.0.0-version-3-3504d777
14
+
15
+ ## Breaking changes
16
+
11
17
  - All trailing unit arguments are removed. Commit showing how this is migrated to in the tests: https://github.com/zth/rescript-relay/commit/2a16791268afb29d106362d0cf17915f69d5b4ff
12
18
 
13
19
  # 0.0.0-version-3-aeebeaab
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rescript-relay",
3
- "version": "0.0.0-version-3-3504d777",
3
+ "version": "0.0.0-version-3-8b552902",
4
4
  "main": "src/RescriptRelay.res",
5
5
  "license": "MIT",
6
6
  "author": "Gabriel Nordeborn",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -68,8 +68,22 @@ function internal_nullableToOptionalExnHandler(x) {
68
68
 
69
69
  }
70
70
 
71
+ var unwrapUnion = (function unwrapUnion(union, members) {
72
+ if (union != null && members.indexOf(union.__typename) === -1) {
73
+ return Object.assign({}, union, {__typename: "__unselected"});
74
+ }
75
+
76
+ return union;
77
+ });
78
+
79
+ function wrapUnion(union) {
80
+ return union;
81
+ }
82
+
71
83
  exports.internal_useConvertedValue = internal_useConvertedValue;
72
84
  exports.internal_cleanObjectFromUndefinedRaw = internal_cleanObjectFromUndefinedRaw;
73
85
  exports.internal_removeUndefinedAndConvertNullsRaw = internal_removeUndefinedAndConvertNullsRaw;
74
86
  exports.internal_nullableToOptionalExnHandler = internal_nullableToOptionalExnHandler;
87
+ exports.unwrapUnion = unwrapUnion;
88
+ exports.wrapUnion = wrapUnion;
75
89
  /* react Not a pure module */
@@ -35,3 +35,15 @@ let internal_nullableToOptionalExnHandler = x =>
35
35
  }
36
36
 
37
37
  @live @unboxed type rec arg = Arg(_): arg
38
+
39
+ let unwrapUnion: ('a, array<string>) => 'a = %raw(`
40
+ function unwrapUnion(union, members) {
41
+ if (union != null && members.indexOf(union.__typename) === -1) {
42
+ return Object.assign({}, union, {__typename: "__unselected"});
43
+ }
44
+
45
+ return union;
46
+ }
47
+ `)
48
+
49
+ let wrapUnion = union => union
@@ -5,3 +5,6 @@ let internal_nullableToOptionalExnHandler: option<option<'b> => 'a> => option<
5
5
  Js.Nullable.t<'b> => 'a,
6
6
  >
7
7
  @live @unboxed type rec arg = Arg(_): arg
8
+
9
+ let unwrapUnion: ('a, array<string>) => 'a
10
+ let wrapUnion: 'a => 'a