@reventlessdev/reventless-core 3.0.0-alpha.181 → 3.0.0-alpha.182

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
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 3.0.0-alpha.182 (2026-07-26)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **api:** commit regenerated SchemaType output for nullable optional enums ([6d48f53](https://github.com/ReventlessDev/reventless-core/commit/6d48f53c31489b8cb312c4bc63dac3b927145bd4))
11
+ * **api:** preserve nullability for optional enum fields in generated GraphQL ([3110a4a](https://github.com/ReventlessDev/reventless-core/commit/3110a4af032440ba2639519f61f221960ac78fba))
12
+
13
+
6
14
  # 3.0.0-alpha.181 (2026-07-26)
7
15
 
8
16
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-core",
3
- "version": "3.0.0-alpha.181",
3
+ "version": "3.0.0-alpha.182",
4
4
  "description": "Core package for Reventless framework",
5
5
  "license": "Apache-2.0",
6
6
  "jest": {
@@ -28,17 +28,17 @@
28
28
  "dependencies": {
29
29
  "sury": "11.0.0-alpha.4",
30
30
  "uuid": "^13.0.0",
31
+ "@reventlessdev/rescript-effect": "0.1.0-alpha.31",
31
32
  "@reventlessdev/rescript-fast-csv": "1.2.0-alpha.14",
32
33
  "@reventlessdev/rescript-hash-object": "1.2.0-alpha.13",
33
34
  "@reventlessdev/rescript-jest": "1.0.0-alpha.9",
34
35
  "@reventlessdev/rescript-node-streams": "1.1.0-alpha.13",
35
- "@reventlessdev/rescript-effect": "0.1.0-alpha.31",
36
36
  "@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.17",
37
37
  "@reventlessdev/rescript-ssh2": "1.1.0-alpha.14",
38
38
  "@reventlessdev/rescript-uuid": "1.1.0-alpha.17",
39
- "@reventlessdev/reventless-infra": "3.0.0-alpha.105",
40
39
  "@reventlessdev/reventless-interop": "3.0.0-alpha.29",
41
- "@reventlessdev/reventless-spec": "3.0.0-alpha.81"
40
+ "@reventlessdev/reventless-spec": "3.0.0-alpha.81",
41
+ "@reventlessdev/reventless-infra": "3.0.0-alpha.105"
42
42
  },
43
43
  "devDependencies": {
44
44
  "rescript": "12.3.0",
@@ -82,6 +82,7 @@ let rec fromSury = (~parentName: string, ~fieldName: string, schema: S.t<unknown
82
82
  | _ => true
83
83
  }
84
84
  )
85
+ let isOptional = nonNullVariants->Array.length < anyOf->Array.length
85
86
  if nonNullVariants->Array.length == 1 {
86
87
  Nullable(
87
88
  fromSury(
@@ -102,7 +103,8 @@ let rec fromSury = (~parentName: string, ~fieldName: string, schema: S.t<unknown
102
103
  parentName ++
103
104
  fieldName->String.charAt(0)->String.toUpperCase ++
104
105
  fieldName->String.slice(~start=1, ~end=fieldName->String.length)
105
- Enum(enumName, constValues)
106
+ let enum = Enum(enumName, constValues)
107
+ isOptional ? Nullable(enum) : enum
106
108
  } else {
107
109
  Unknown
108
110
  }
@@ -83,7 +83,8 @@ function fromSury(parentName, fieldName, schema) {
83
83
  };
84
84
  }
85
85
  case "union" :
86
- let nonNullVariants = schema.anyOf.filter(v => {
86
+ let anyOf = schema.anyOf;
87
+ let nonNullVariants = anyOf.filter(v => {
87
88
  switch (v.type) {
88
89
  case "null" :
89
90
  case "undefined" :
@@ -92,6 +93,7 @@ function fromSury(parentName, fieldName, schema) {
92
93
  return true;
93
94
  }
94
95
  });
96
+ let isOptional = nonNullVariants.length < anyOf.length;
95
97
  if (nonNullVariants.length === 1) {
96
98
  return {
97
99
  TAG: "Nullable",
@@ -111,11 +113,19 @@ function fromSury(parentName, fieldName, schema) {
111
113
  return "Unknown";
112
114
  }
113
115
  let enumName = parentName + fieldName.charAt(0).toUpperCase() + fieldName.slice(1, fieldName.length);
114
- return {
116
+ let $$enum = {
115
117
  TAG: "Enum",
116
118
  _0: enumName,
117
119
  _1: constValues
118
120
  };
121
+ if (isOptional) {
122
+ return {
123
+ TAG: "Nullable",
124
+ _0: $$enum
125
+ };
126
+ } else {
127
+ return $$enum;
128
+ }
119
129
  default:
120
130
  return "Unknown";
121
131
  }