@reboot-dev/reboot 0.41.0 → 0.43.0

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/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const REBOOT_VERSION = "0.41.0";
1
+ export declare const REBOOT_VERSION = "0.43.0";
package/version.js CHANGED
@@ -1 +1 @@
1
- export const REBOOT_VERSION = "0.41.0";
1
+ export const REBOOT_VERSION = "0.43.0";
package/zod-to-proto.js CHANGED
@@ -262,85 +262,85 @@ const generate = (proto, { schema, path, name, state = false, }) => {
262
262
  proto.write(`map <string, ${typeName}> record = 1;`);
263
263
  }
264
264
  else if (schema instanceof z.ZodArray) {
265
- const element = schema.element;
266
- if (element instanceof z.ZodOptional) {
267
- console.error(chalk.stderr.bold.red(`Array at '${path}' has _optional_ element type which is not supported`));
265
+ const item = schema.element;
266
+ if (item instanceof z.ZodOptional) {
267
+ console.error(chalk.stderr.bold.red(`Array at '${path}' has _optional_ item type which is not supported`));
268
268
  process.exit(-1);
269
269
  }
270
- else if (element instanceof z.ZodDefault) {
271
- console.error(chalk.stderr.bold.red(`Array at '${path}' has _default_ element type which is not supported`));
270
+ else if (item instanceof z.ZodDefault) {
271
+ console.error(chalk.stderr.bold.red(`Array at '${path}' has _default_ item type which is not supported`));
272
272
  process.exit(-1);
273
273
  }
274
274
  const typeName = (() => {
275
275
  // To account for all possible "string" types in Zod, e.g.,
276
276
  // `z.uuid()`, `z.email()`, etc, we can't use `instanceof`.
277
- if (element._zod.def.type === "string") {
277
+ if (item._zod.def.type === "string") {
278
278
  return "string";
279
279
  }
280
- else if (element instanceof z.ZodNumber) {
280
+ else if (item instanceof z.ZodNumber) {
281
281
  return "double";
282
282
  }
283
- else if (element instanceof z.ZodBigInt) {
283
+ else if (item instanceof z.ZodBigInt) {
284
284
  return "int64";
285
285
  }
286
- else if (element instanceof z.ZodBoolean) {
286
+ else if (item instanceof z.ZodBoolean) {
287
287
  return "bool";
288
288
  }
289
- else if (element instanceof z.ZodObject) {
290
- return "Element";
289
+ else if (item instanceof z.ZodObject) {
290
+ return "Item";
291
291
  }
292
- else if (element instanceof z.ZodRecord) {
293
- return "Element";
292
+ else if (item instanceof z.ZodRecord) {
293
+ return "Item";
294
294
  }
295
- else if (element instanceof z.ZodArray) {
296
- return "Element";
295
+ else if (item instanceof z.ZodArray) {
296
+ return "Item";
297
297
  }
298
- else if (element instanceof z.ZodDiscriminatedUnion) {
299
- return "Element";
298
+ else if (item instanceof z.ZodDiscriminatedUnion) {
299
+ return "Item";
300
300
  }
301
- else if (element instanceof z.ZodCustom) {
302
- const meta = element.meta();
303
- if (element instanceof z.ZodCustom && "protobuf" in meta) {
301
+ else if (item instanceof z.ZodCustom) {
302
+ const meta = item.meta();
303
+ if (item instanceof z.ZodCustom && "protobuf" in meta) {
304
304
  return meta.protobuf;
305
305
  }
306
306
  }
307
- else if (iszjson(element)) {
307
+ else if (iszjson(item)) {
308
308
  return "google.protobuf.Value";
309
309
  }
310
- console.error(chalk.stderr.bold.red(`Array at '${path}' has element type '${element._zod.def.type}' which is not (yet) supported`));
310
+ console.error(chalk.stderr.bold.red(`Array at '${path}' has item type '${item._zod.def.type}' which is not (yet) supported`));
311
311
  process.exit(-1);
312
312
  })();
313
- if (element instanceof z.ZodObject) {
313
+ if (item instanceof z.ZodObject) {
314
314
  generate(proto, {
315
- schema: element,
316
- path: `${path}.[element]`,
315
+ schema: item,
316
+ path: `${path}.[item]`,
317
317
  name: typeName,
318
318
  });
319
319
  }
320
- else if (element instanceof z.ZodRecord) {
320
+ else if (item instanceof z.ZodRecord) {
321
321
  proto.write(`message ${typeName} {`);
322
322
  generate(proto, {
323
- schema: element,
324
- path: `${path}.[element]`,
323
+ schema: item,
324
+ path: `${path}.[item]`,
325
325
  });
326
326
  proto.write(`}`);
327
327
  }
328
- else if (element instanceof z.ZodArray) {
328
+ else if (item instanceof z.ZodArray) {
329
329
  proto.write(`message ${typeName} {`);
330
330
  generate(proto, {
331
- schema: element,
332
- path: `${path}.[element]`,
331
+ schema: item,
332
+ path: `${path}.[item]`,
333
333
  });
334
334
  proto.write(`}`);
335
335
  }
336
- else if (element instanceof z.ZodDiscriminatedUnion) {
336
+ else if (item instanceof z.ZodDiscriminatedUnion) {
337
337
  generate(proto, {
338
- schema: element,
339
- path: `${path}.[element]`,
338
+ schema: item,
339
+ path: `${path}.[item]`,
340
340
  name: typeName,
341
341
  });
342
342
  }
343
- proto.write(`repeated ${typeName} elements = 1;`);
343
+ proto.write(`repeated ${typeName} items = 1;`);
344
344
  }
345
345
  else if (schema instanceof z.ZodDiscriminatedUnion) {
346
346
  assert(name !== undefined);