@valbuild/shared 0.76.1 → 0.77.1

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.
@@ -2044,7 +2044,7 @@ export declare const Api: {
2044
2044
  patches: z.ZodArray<z.ZodObject<{
2045
2045
  path: z.ZodEffects<z.ZodString, ModuleFilePath, string>;
2046
2046
  patchId: z.ZodEffects<z.ZodString, PatchIdT, string>;
2047
- patch: z.ZodType<PatchT, z.ZodTypeDef, PatchT>;
2047
+ patch: z.ZodAny;
2048
2048
  }, "strip", z.ZodTypeAny, {
2049
2049
  path?: any;
2050
2050
  patch?: any;
@@ -1097,29 +1097,28 @@ function _asyncToGenerator(n) {
1097
1097
  };
1098
1098
  }
1099
1099
 
1100
- var JSONValueT = zod.z.lazy(function () {
1101
- return zod.z.union([zod.z.string(), zod.z.number(), zod.z["boolean"](), zod.z["null"](), zod.z.array(JSONValueT), zod.z.record(JSONValueT)]);
1100
+ var JSONValue = zod.z.lazy(function () {
1101
+ return zod.z.union([zod.z.string(), zod.z.number(), zod.z["boolean"](), zod.z["null"](), zod.z.array(JSONValue), zod.z.record(JSONValue)]);
1102
1102
  });
1103
1103
  var FileOperation = function FileOperation(path) {
1104
1104
  return zod.z.object({
1105
1105
  op: zod.z.literal("file"),
1106
1106
  path: path,
1107
1107
  filePath: zod.z.string(),
1108
- value: JSONValueT,
1109
- // TODO: this should be string, but we believe we have a bug in Zod where setting this to z.string(), means that other types of patches also ends up requiring a string after we deploy a version
1108
+ value: zod.z.string(),
1110
1109
  remote: zod.z["boolean"](),
1111
1110
  nestedFilePath: zod.z.array(zod.z.string()).optional(),
1112
- metadata: JSONValueT.optional() // TODO: remove optional
1111
+ metadata: JSONValue.optional() // TODO: remove optional
1113
1112
  });
1114
1113
  };
1115
1114
 
1116
1115
  /**
1117
1116
  * Raw JSON patch operation.
1118
1117
  */
1119
- var OperationJSONT = zod.z.discriminatedUnion("op", [zod.z.object({
1118
+ var OperationJSON = zod.z.discriminatedUnion("op", [zod.z.object({
1120
1119
  op: zod.z.literal("add"),
1121
1120
  path: zod.z.string(),
1122
- value: JSONValueT
1121
+ value: JSONValue
1123
1122
  }).strict(), zod.z.object({
1124
1123
  op: zod.z.literal("remove"),
1125
1124
  /**
@@ -1129,7 +1128,7 @@ var OperationJSONT = zod.z.discriminatedUnion("op", [zod.z.object({
1129
1128
  }).strict(), zod.z.object({
1130
1129
  op: zod.z.literal("replace"),
1131
1130
  path: zod.z.string(),
1132
- value: JSONValueT
1131
+ value: JSONValue
1133
1132
  }).strict(), zod.z.object({
1134
1133
  op: zod.z.literal("move"),
1135
1134
  /**
@@ -1144,23 +1143,23 @@ var OperationJSONT = zod.z.discriminatedUnion("op", [zod.z.object({
1144
1143
  }).strict(), zod.z.object({
1145
1144
  op: zod.z.literal("test"),
1146
1145
  path: zod.z.string(),
1147
- value: JSONValueT
1146
+ value: JSONValue
1148
1147
  }).strict(), FileOperation(zod.z.string()).strict()]);
1149
- var PatchJSON = zod.z.array(OperationJSONT);
1148
+ var PatchJSON = zod.z.array(OperationJSON);
1150
1149
  /**
1151
1150
  * Raw JSON patch operation.
1152
1151
  */
1153
- var OperationT = zod.z.discriminatedUnion("op", [zod.z.object({
1152
+ var Operation = zod.z.discriminatedUnion("op", [zod.z.object({
1154
1153
  op: zod.z.literal("add"),
1155
1154
  path: zod.z.array(zod.z.string()),
1156
- value: JSONValueT
1155
+ value: JSONValue
1157
1156
  }).strict(), zod.z.object({
1158
1157
  op: zod.z.literal("remove"),
1159
1158
  path: zod.z.array(zod.z.string()).nonempty()
1160
1159
  }).strict(), zod.z.object({
1161
1160
  op: zod.z.literal("replace"),
1162
1161
  path: zod.z.array(zod.z.string()),
1163
- value: JSONValueT
1162
+ value: JSONValue
1164
1163
  }).strict(), zod.z.object({
1165
1164
  op: zod.z.literal("move"),
1166
1165
  from: zod.z.array(zod.z.string()).nonempty(),
@@ -1172,9 +1171,9 @@ var OperationT = zod.z.discriminatedUnion("op", [zod.z.object({
1172
1171
  }).strict(), zod.z.object({
1173
1172
  op: zod.z.literal("test"),
1174
1173
  path: zod.z.array(zod.z.string()),
1175
- value: JSONValueT
1174
+ value: JSONValue
1176
1175
  }).strict(), FileOperation(zod.z.array(zod.z.string())).strict()]);
1177
- var Patch = zod.z.array(OperationT);
1176
+ var Patch = zod.z.array(Operation);
1178
1177
  var PatchId = zod.z.string().refine(function (_id) {
1179
1178
  return true;
1180
1179
  } // TODO: validation
@@ -1826,7 +1825,7 @@ var Api = {
1826
1825
  patches: zod.z.array(zod.z.object({
1827
1826
  path: ModuleFilePath,
1828
1827
  patchId: PatchId,
1829
- patch: Patch
1828
+ patch: zod.z.any() // TODO: this should be Patch instead - we got a weird validation error: although input looks good, it still does not accept objects as values... Which it should do via the z.record(JSONValue) type
1830
1829
  }))
1831
1830
  }),
1832
1831
  cookies: {
@@ -2184,7 +2183,7 @@ var createValClient = function createValClient(host, config // We want to use th
2184
2183
  return _context2.abrupt("return", {
2185
2184
  status: null,
2186
2185
  json: {
2187
- message: "Invalid request body. This is most likely a Val bug.",
2186
+ message: "There was an issue validating your data. This is most likely a Val bug.",
2188
2187
  type: "client_side_validation_error",
2189
2188
  details: {
2190
2189
  validationError: zodValidationError.fromZodError(reqBodyResult.error).toString(),
@@ -1097,29 +1097,28 @@ function _asyncToGenerator(n) {
1097
1097
  };
1098
1098
  }
1099
1099
 
1100
- var JSONValueT = zod.z.lazy(function () {
1101
- return zod.z.union([zod.z.string(), zod.z.number(), zod.z["boolean"](), zod.z["null"](), zod.z.array(JSONValueT), zod.z.record(JSONValueT)]);
1100
+ var JSONValue = zod.z.lazy(function () {
1101
+ return zod.z.union([zod.z.string(), zod.z.number(), zod.z["boolean"](), zod.z["null"](), zod.z.array(JSONValue), zod.z.record(JSONValue)]);
1102
1102
  });
1103
1103
  var FileOperation = function FileOperation(path) {
1104
1104
  return zod.z.object({
1105
1105
  op: zod.z.literal("file"),
1106
1106
  path: path,
1107
1107
  filePath: zod.z.string(),
1108
- value: JSONValueT,
1109
- // TODO: this should be string, but we believe we have a bug in Zod where setting this to z.string(), means that other types of patches also ends up requiring a string after we deploy a version
1108
+ value: zod.z.string(),
1110
1109
  remote: zod.z["boolean"](),
1111
1110
  nestedFilePath: zod.z.array(zod.z.string()).optional(),
1112
- metadata: JSONValueT.optional() // TODO: remove optional
1111
+ metadata: JSONValue.optional() // TODO: remove optional
1113
1112
  });
1114
1113
  };
1115
1114
 
1116
1115
  /**
1117
1116
  * Raw JSON patch operation.
1118
1117
  */
1119
- var OperationJSONT = zod.z.discriminatedUnion("op", [zod.z.object({
1118
+ var OperationJSON = zod.z.discriminatedUnion("op", [zod.z.object({
1120
1119
  op: zod.z.literal("add"),
1121
1120
  path: zod.z.string(),
1122
- value: JSONValueT
1121
+ value: JSONValue
1123
1122
  }).strict(), zod.z.object({
1124
1123
  op: zod.z.literal("remove"),
1125
1124
  /**
@@ -1129,7 +1128,7 @@ var OperationJSONT = zod.z.discriminatedUnion("op", [zod.z.object({
1129
1128
  }).strict(), zod.z.object({
1130
1129
  op: zod.z.literal("replace"),
1131
1130
  path: zod.z.string(),
1132
- value: JSONValueT
1131
+ value: JSONValue
1133
1132
  }).strict(), zod.z.object({
1134
1133
  op: zod.z.literal("move"),
1135
1134
  /**
@@ -1144,23 +1143,23 @@ var OperationJSONT = zod.z.discriminatedUnion("op", [zod.z.object({
1144
1143
  }).strict(), zod.z.object({
1145
1144
  op: zod.z.literal("test"),
1146
1145
  path: zod.z.string(),
1147
- value: JSONValueT
1146
+ value: JSONValue
1148
1147
  }).strict(), FileOperation(zod.z.string()).strict()]);
1149
- var PatchJSON = zod.z.array(OperationJSONT);
1148
+ var PatchJSON = zod.z.array(OperationJSON);
1150
1149
  /**
1151
1150
  * Raw JSON patch operation.
1152
1151
  */
1153
- var OperationT = zod.z.discriminatedUnion("op", [zod.z.object({
1152
+ var Operation = zod.z.discriminatedUnion("op", [zod.z.object({
1154
1153
  op: zod.z.literal("add"),
1155
1154
  path: zod.z.array(zod.z.string()),
1156
- value: JSONValueT
1155
+ value: JSONValue
1157
1156
  }).strict(), zod.z.object({
1158
1157
  op: zod.z.literal("remove"),
1159
1158
  path: zod.z.array(zod.z.string()).nonempty()
1160
1159
  }).strict(), zod.z.object({
1161
1160
  op: zod.z.literal("replace"),
1162
1161
  path: zod.z.array(zod.z.string()),
1163
- value: JSONValueT
1162
+ value: JSONValue
1164
1163
  }).strict(), zod.z.object({
1165
1164
  op: zod.z.literal("move"),
1166
1165
  from: zod.z.array(zod.z.string()).nonempty(),
@@ -1172,9 +1171,9 @@ var OperationT = zod.z.discriminatedUnion("op", [zod.z.object({
1172
1171
  }).strict(), zod.z.object({
1173
1172
  op: zod.z.literal("test"),
1174
1173
  path: zod.z.array(zod.z.string()),
1175
- value: JSONValueT
1174
+ value: JSONValue
1176
1175
  }).strict(), FileOperation(zod.z.array(zod.z.string())).strict()]);
1177
- var Patch = zod.z.array(OperationT);
1176
+ var Patch = zod.z.array(Operation);
1178
1177
  var PatchId = zod.z.string().refine(function (_id) {
1179
1178
  return true;
1180
1179
  } // TODO: validation
@@ -1826,7 +1825,7 @@ var Api = {
1826
1825
  patches: zod.z.array(zod.z.object({
1827
1826
  path: ModuleFilePath,
1828
1827
  patchId: PatchId,
1829
- patch: Patch
1828
+ patch: zod.z.any() // TODO: this should be Patch instead - we got a weird validation error: although input looks good, it still does not accept objects as values... Which it should do via the z.record(JSONValue) type
1830
1829
  }))
1831
1830
  }),
1832
1831
  cookies: {
@@ -2184,7 +2183,7 @@ var createValClient = function createValClient(host, config // We want to use th
2184
2183
  return _context2.abrupt("return", {
2185
2184
  status: null,
2186
2185
  json: {
2187
- message: "Invalid request body. This is most likely a Val bug.",
2186
+ message: "There was an issue validating your data. This is most likely a Val bug.",
2188
2187
  type: "client_side_validation_error",
2189
2188
  details: {
2190
2189
  validationError: zodValidationError.fromZodError(reqBodyResult.error).toString(),
@@ -1093,29 +1093,28 @@ function _asyncToGenerator(n) {
1093
1093
  };
1094
1094
  }
1095
1095
 
1096
- var JSONValueT = z.lazy(function () {
1097
- return z.union([z.string(), z.number(), z["boolean"](), z["null"](), z.array(JSONValueT), z.record(JSONValueT)]);
1096
+ var JSONValue = z.lazy(function () {
1097
+ return z.union([z.string(), z.number(), z["boolean"](), z["null"](), z.array(JSONValue), z.record(JSONValue)]);
1098
1098
  });
1099
1099
  var FileOperation = function FileOperation(path) {
1100
1100
  return z.object({
1101
1101
  op: z.literal("file"),
1102
1102
  path: path,
1103
1103
  filePath: z.string(),
1104
- value: JSONValueT,
1105
- // TODO: this should be string, but we believe we have a bug in Zod where setting this to z.string(), means that other types of patches also ends up requiring a string after we deploy a version
1104
+ value: z.string(),
1106
1105
  remote: z["boolean"](),
1107
1106
  nestedFilePath: z.array(z.string()).optional(),
1108
- metadata: JSONValueT.optional() // TODO: remove optional
1107
+ metadata: JSONValue.optional() // TODO: remove optional
1109
1108
  });
1110
1109
  };
1111
1110
 
1112
1111
  /**
1113
1112
  * Raw JSON patch operation.
1114
1113
  */
1115
- var OperationJSONT = z.discriminatedUnion("op", [z.object({
1114
+ var OperationJSON = z.discriminatedUnion("op", [z.object({
1116
1115
  op: z.literal("add"),
1117
1116
  path: z.string(),
1118
- value: JSONValueT
1117
+ value: JSONValue
1119
1118
  }).strict(), z.object({
1120
1119
  op: z.literal("remove"),
1121
1120
  /**
@@ -1125,7 +1124,7 @@ var OperationJSONT = z.discriminatedUnion("op", [z.object({
1125
1124
  }).strict(), z.object({
1126
1125
  op: z.literal("replace"),
1127
1126
  path: z.string(),
1128
- value: JSONValueT
1127
+ value: JSONValue
1129
1128
  }).strict(), z.object({
1130
1129
  op: z.literal("move"),
1131
1130
  /**
@@ -1140,23 +1139,23 @@ var OperationJSONT = z.discriminatedUnion("op", [z.object({
1140
1139
  }).strict(), z.object({
1141
1140
  op: z.literal("test"),
1142
1141
  path: z.string(),
1143
- value: JSONValueT
1142
+ value: JSONValue
1144
1143
  }).strict(), FileOperation(z.string()).strict()]);
1145
- var PatchJSON = z.array(OperationJSONT);
1144
+ var PatchJSON = z.array(OperationJSON);
1146
1145
  /**
1147
1146
  * Raw JSON patch operation.
1148
1147
  */
1149
- var OperationT = z.discriminatedUnion("op", [z.object({
1148
+ var Operation = z.discriminatedUnion("op", [z.object({
1150
1149
  op: z.literal("add"),
1151
1150
  path: z.array(z.string()),
1152
- value: JSONValueT
1151
+ value: JSONValue
1153
1152
  }).strict(), z.object({
1154
1153
  op: z.literal("remove"),
1155
1154
  path: z.array(z.string()).nonempty()
1156
1155
  }).strict(), z.object({
1157
1156
  op: z.literal("replace"),
1158
1157
  path: z.array(z.string()),
1159
- value: JSONValueT
1158
+ value: JSONValue
1160
1159
  }).strict(), z.object({
1161
1160
  op: z.literal("move"),
1162
1161
  from: z.array(z.string()).nonempty(),
@@ -1168,9 +1167,9 @@ var OperationT = z.discriminatedUnion("op", [z.object({
1168
1167
  }).strict(), z.object({
1169
1168
  op: z.literal("test"),
1170
1169
  path: z.array(z.string()),
1171
- value: JSONValueT
1170
+ value: JSONValue
1172
1171
  }).strict(), FileOperation(z.array(z.string())).strict()]);
1173
- var Patch = z.array(OperationT);
1172
+ var Patch = z.array(Operation);
1174
1173
  var PatchId = z.string().refine(function (_id) {
1175
1174
  return true;
1176
1175
  } // TODO: validation
@@ -1822,7 +1821,7 @@ var Api = {
1822
1821
  patches: z.array(z.object({
1823
1822
  path: ModuleFilePath,
1824
1823
  patchId: PatchId,
1825
- patch: Patch
1824
+ patch: z.any() // TODO: this should be Patch instead - we got a weird validation error: although input looks good, it still does not accept objects as values... Which it should do via the z.record(JSONValue) type
1826
1825
  }))
1827
1826
  }),
1828
1827
  cookies: {
@@ -2180,7 +2179,7 @@ var createValClient = function createValClient(host, config // We want to use th
2180
2179
  return _context2.abrupt("return", {
2181
2180
  status: null,
2182
2181
  json: {
2183
- message: "Invalid request body. This is most likely a Val bug.",
2182
+ message: "There was an issue validating your data. This is most likely a Val bug.",
2184
2183
  type: "client_side_validation_error",
2185
2184
  details: {
2186
2185
  validationError: fromZodError(reqBodyResult.error).toString(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/shared",
3
- "version": "0.76.1",
3
+ "version": "0.77.1",
4
4
  "private": false,
5
5
  "description": "Val shared types and utilities",
6
6
  "scripts": {
@@ -29,7 +29,7 @@
29
29
  "exports": true
30
30
  },
31
31
  "dependencies": {
32
- "@valbuild/core": "~0.76.1",
32
+ "@valbuild/core": "~0.77.1",
33
33
  "zod": "^3.22.4",
34
34
  "zod-validation-error": "^3.3.0"
35
35
  },