@arrirpc/codegen-ts 0.81.4 → 0.82.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/dist/index.cjs CHANGED
@@ -89,8 +89,7 @@ function tsArrayFromSchema(schema, context) {
89
89
  discriminatorValue: "",
90
90
  versionNumber: context.versionNumber,
91
91
  usedFeatures: context.usedFeatures,
92
- rpcGenerators: context.rpcGenerators,
93
- coerceBigInts: context.coerceBigInts
92
+ rpcGenerators: context.rpcGenerators
94
93
  });
95
94
  const typeName = `(${innerType.typeName})[]`;
96
95
  const defaultValue = schema.isNullable ? "null" : "[]";
@@ -228,8 +227,7 @@ function tsObjectFromSchema(schema, context) {
228
227
  discriminatorValue: "",
229
228
  versionNumber: context.versionNumber,
230
229
  usedFeatures: context.usedFeatures,
231
- rpcGenerators: context.rpcGenerators,
232
- coerceBigInts: context.coerceBigInts
230
+ rpcGenerators: context.rpcGenerators
233
231
  });
234
232
  if (prop.content) subContentParts.push(prop.content);
235
233
  const fieldName = validVarName(codegenUtils.camelCase(key, { normalize: true }));
@@ -272,8 +270,7 @@ function tsObjectFromSchema(schema, context) {
272
270
  discriminatorValue: "",
273
271
  versionNumber: context.versionNumber,
274
272
  usedFeatures: context.usedFeatures,
275
- rpcGenerators: context.rpcGenerators,
276
- coerceBigInts: context.coerceBigInts
273
+ rpcGenerators: context.rpcGenerators
277
274
  });
278
275
  if (prop.content) subContentParts.push(prop.content);
279
276
  const fieldName = validVarName(codegenUtils.camelCase(key, { normalize: true }));
@@ -400,8 +397,7 @@ function tsTaggedUnionFromSchema(schema, context) {
400
397
  discriminatorValue: key,
401
398
  versionNumber: context.versionNumber,
402
399
  usedFeatures: context.usedFeatures,
403
- rpcGenerators: context.rpcGenerators,
404
- coerceBigInts: context.coerceBigInts
400
+ rpcGenerators: context.rpcGenerators
405
401
  });
406
402
  subTypes.push({ value: key, data: subType });
407
403
  }
@@ -511,8 +507,16 @@ function tsEnumFromSchema(schema, context) {
511
507
  }
512
508
  const name = `${context.typePrefix}${enumName}`;
513
509
  const valuesName = `$$${name}Values`;
514
- result.content = `${getJsDocComment(schema.metadata)}export type ${name} = (typeof ${valuesName})[number];
515
- const ${valuesName} = [${schema.enum.map((val) => `"${val}"`).join(", ")}] as const;
510
+ result.content = `${getJsDocComment(schema.metadata)}export type ${name} = ${schema.enum.map((val) => `'${val}'`).join(" | ")};
511
+ export const ${name} = {
512
+ ${schema.enum.map((val) => {
513
+ let str = " ";
514
+ str += `${codegenUtils.pascalCase(validVarName(val), { normalize: true })}:`;
515
+ str += ` '${val}',`;
516
+ return str;
517
+ }).join("\n")}
518
+ } as const;
519
+ const ${valuesName} = [${schema.enum.map((val) => `'${val}'`).join(", ")}] as const;
516
520
  export const $$${name}: ArriEnumValidator<${name}> = {
517
521
  new(): ${name} {
518
522
  return ${valuesName}[0];
@@ -555,11 +559,10 @@ function tsStringFromSchema(schema, _context) {
555
559
  return `typeof ${input} === 'string'`;
556
560
  },
557
561
  fromJsonTemplate(input, target) {
558
- return `if (typeof ${input} === 'string') {
559
- ${target} = ${input};
560
- } else {
561
- ${target} = ${defaultValue};
562
- }`;
562
+ if (schema.isNullable) {
563
+ return `${target} = parseNullableString(${input});`;
564
+ }
565
+ return `${target} = parseString(${input});`;
563
566
  },
564
567
  toJsonTemplate(input, target) {
565
568
  if (schema.isNullable) {
@@ -590,11 +593,10 @@ function tsBooleanFromSchema(schema, _context) {
590
593
  return `typeof ${input} === 'boolean'`;
591
594
  },
592
595
  fromJsonTemplate(input, target) {
593
- return `if (typeof ${input} === 'boolean') {
594
- ${target} = ${input};
595
- } else {
596
- ${target} = ${defaultValue};
597
- }`;
596
+ if (schema.isNullable) {
597
+ return `${target} = parseNullableBoolean(${input});`;
598
+ }
599
+ return `${target} = parseBoolean(${input});`;
598
600
  },
599
601
  toJsonTemplate(input, target) {
600
602
  return `${target} += \`\${${input}}\`;`;
@@ -618,13 +620,10 @@ function tsDateFromSchema(schema, _context) {
618
620
  return `${input} instanceof Date`;
619
621
  },
620
622
  fromJsonTemplate(input, target) {
621
- return `if (typeof ${input} === 'string') {
622
- ${target} = new Date(${input});
623
- } else if (${input} instanceof Date) {
624
- ${target} = ${input};
625
- } else {
626
- ${target} = ${defaultValue}
627
- }`;
623
+ if (schema.isNullable) {
624
+ return `${target} = parseNullableTimestamp(${input});`;
625
+ }
626
+ return `${target} = parseTimestamp(${input});`;
628
627
  },
629
628
  toJsonTemplate(input, target) {
630
629
  if (schema.isNullable) {
@@ -658,11 +657,10 @@ function tsFloatFromSchema(schema, _context) {
658
657
  return `typeof ${input} === 'number'`;
659
658
  },
660
659
  fromJsonTemplate(input, target) {
661
- return `if (typeof ${input} === 'number') {
662
- ${target} = ${input};
663
- } else {
664
- ${target} = ${defaultValue};
665
- }`;
660
+ if (schema.isNullable) {
661
+ return `${target} = parseNullableNumberFloat(${input});`;
662
+ }
663
+ return `${target} = parseNumberFloat(${input});`;
666
664
  },
667
665
  toJsonTemplate(input, target) {
668
666
  return `${target} += \`\${${input}}\``;
@@ -715,16 +713,10 @@ function tsIntFromSchema(schema, intType, _context) {
715
713
  return mainPart;
716
714
  },
717
715
  fromJsonTemplate(input, target) {
718
- return `if (
719
- typeof ${input} === 'number' &&
720
- Number.isInteger(${input}) &&
721
- ${input} >= ${min} &&
722
- ${input} <= ${max}
723
- ) {
724
- ${target} = ${input};
725
- } else {
726
- ${target} = ${defaultValue};
727
- }`;
716
+ if (schema.isNullable) {
717
+ return `${target} = parseNullableNumberInt(${input}, ${min}, ${max});`;
718
+ }
719
+ return `${target} = parseNumberInt(${input}, ${min}, ${max});`;
728
720
  },
729
721
  toJsonTemplate(input, target) {
730
722
  return `${target} += \`\${${input}}\``;
@@ -735,7 +727,7 @@ function tsIntFromSchema(schema, intType, _context) {
735
727
  content: ""
736
728
  };
737
729
  }
738
- function tsBigIntFromSchema(schema, isUnsigned, context) {
730
+ function tsBigIntFromSchema(schema, isUnsigned, _context) {
739
731
  const typeName = schema.isNullable ? `bigint | null` : `bigint`;
740
732
  const defaultValue = schema.isNullable ? `null` : "BigInt(0)";
741
733
  return {
@@ -750,37 +742,15 @@ function tsBigIntFromSchema(schema, isUnsigned, context) {
750
742
  },
751
743
  fromJsonTemplate(input, target) {
752
744
  if (isUnsigned) {
753
- let content2 = `if (typeof ${input} === 'string' && BigInt(${input}) >= BigInt(0)) {
754
- ${target} = BigInt(${input});
755
- } else if (typeof ${input} === 'bigint' && ${input} >= BigInt(0)) {
756
- ${target} = ${input};
757
- }`;
758
- if (context.coerceBigInts) {
759
- content2 += ` else if (typeof ${input} === 'number' && ${input} >= BigInt(0)) {
760
- console.warn("[arri] Expected a BigInt string at ${context.instancePath} but got a raw number. This could lead to precision loss.")
761
- ${target} = BigInt(${input});
762
- }`;
745
+ if (schema.isNullable) {
746
+ return `${target} = parseNullableNumberUnsignedBigInt(${input});`;
763
747
  }
764
- content2 += ` else {
765
- ${target} = ${defaultValue};
766
- }`;
767
- return content2;
748
+ return `${target} = parseNumberUnsignedBigInt(${input});`;
768
749
  }
769
- let content = `if (typeof ${input} === 'string') {
770
- ${target} = BigInt(${input});
771
- } else if (typeof ${input} === 'bigint') {
772
- ${target} = ${input};
773
- }`;
774
- if (context.coerceBigInts) {
775
- content += ` else if (typeof ${input} === 'number') {
776
- console.warn("[arri] Expected a BigInt string at ${context.instancePath} but got a raw number. This could lead to precision loss.")
777
- ${target} = BigInt(${input});
778
- } `;
750
+ if (schema.isNullable) {
751
+ return `${target} = parseNullableNumberBigInt(${input});`;
779
752
  }
780
- content += ` else {
781
- ${target} = ${defaultValue};
782
- }`;
783
- return content;
753
+ return `${target} = parseNumberBigInt(${input});`;
784
754
  },
785
755
  toJsonTemplate(input, target) {
786
756
  if (schema.isNullable) {
@@ -811,8 +781,7 @@ function tsRecordFromSchema(schema, context) {
811
781
  discriminatorValue: "",
812
782
  versionNumber: context.versionNumber,
813
783
  usedFeatures: context.usedFeatures,
814
- rpcGenerators: context.rpcGenerators,
815
- coerceBigInts: context.coerceBigInts
784
+ rpcGenerators: context.rpcGenerators
816
785
  });
817
786
  const typeName = `Record<string, ${innerType.typeName}>`;
818
787
  const defaultValue = schema.isNullable ? "null" : "{}";
@@ -1026,8 +995,7 @@ function tsServiceFromDefinition(def, context) {
1026
995
  schemaPath: `${context.instancePath}.${key2}`,
1027
996
  versionNumber: context.versionNumber,
1028
997
  usedFeatures: context.usedFeatures,
1029
- rpcGenerators: context.rpcGenerators,
1030
- coerceBigInts: context.coerceBigInts
998
+ rpcGenerators: context.rpcGenerators
1031
999
  });
1032
1000
  if (subService.content) {
1033
1001
  subServices.push(subService);
@@ -1046,8 +1014,7 @@ function tsServiceFromDefinition(def, context) {
1046
1014
  discriminatorValue: "",
1047
1015
  versionNumber: context.versionNumber,
1048
1016
  usedFeatures: context.usedFeatures,
1049
- rpcGenerators: context.rpcGenerators,
1050
- coerceBigInts: context.coerceBigInts
1017
+ rpcGenerators: context.rpcGenerators
1051
1018
  });
1052
1019
  if (rpc) {
1053
1020
  rpcParts.push(rpc);
@@ -1146,8 +1113,7 @@ async function createTypescriptClient(def, options) {
1146
1113
  sse: false,
1147
1114
  ws: false
1148
1115
  },
1149
- rpcGenerators: options.rpcGenerators ?? {},
1150
- coerceBigInts: options.coerceBigInts ?? false
1116
+ rpcGenerators: options.rpcGenerators ?? {}
1151
1117
  };
1152
1118
  const serviceDefinitions = codegenUtils.unflattenProcedures(
1153
1119
  def.procedures,
@@ -1167,8 +1133,7 @@ async function createTypescriptClient(def, options) {
1167
1133
  discriminatorValue: "",
1168
1134
  versionNumber: context.versionNumber,
1169
1135
  usedFeatures: context.usedFeatures,
1170
- rpcGenerators: context.rpcGenerators,
1171
- coerceBigInts: context.coerceBigInts
1136
+ rpcGenerators: context.rpcGenerators
1172
1137
  });
1173
1138
  if (result2.content) {
1174
1139
  types.push(result2.content);
@@ -1196,6 +1161,21 @@ import {
1196
1161
  INT64_MAX,
1197
1162
  INT64_MIN,
1198
1163
  isObject,
1164
+ parseString,
1165
+ parseBoolean,
1166
+ parseNumber,
1167
+ parseTimestamp,
1168
+ parseNumberInt,
1169
+ parseNumberBigInt,
1170
+ parseNumberUnsignedBigInt,
1171
+ parseNumberFloat,
1172
+ parseNullableString,
1173
+ parseNullableBoolean,
1174
+ parseNullableTimestamp,
1175
+ parseNullableNumberFloat,
1176
+ parseNullableNumberInt,
1177
+ parseNullableNumberBigInt,
1178
+ parseNullableNumberUnsignedBigInt,
1199
1179
  serializeString,
1200
1180
  ${context.usedFeatures.sse ? "type SseOptions," : ""}
1201
1181
  UINT8_MAX,
@@ -1253,9 +1233,9 @@ function tsTypeFromSchema(schema, context) {
1253
1233
  case "uint32":
1254
1234
  return tsIntFromSchema(schema, "uint32");
1255
1235
  case "int64":
1256
- return tsBigIntFromSchema(schema, false, context);
1236
+ return tsBigIntFromSchema(schema, false);
1257
1237
  case "uint64":
1258
- return tsBigIntFromSchema(schema, true, context);
1238
+ return tsBigIntFromSchema(schema, true);
1259
1239
  }
1260
1240
  }
1261
1241
  if (codegenUtils.isSchemaFormEnum(schema)) {
package/dist/index.d.cts CHANGED
@@ -33,7 +33,6 @@ interface CodegenContext {
33
33
  ws: boolean;
34
34
  };
35
35
  rpcGenerators: Partial<Record<string, RpcGenerator>>;
36
- coerceBigInts: boolean;
37
36
  }
38
37
  declare function getJsDocComment(metadata: Schema['metadata']): string;
39
38
  declare function validVarName(name: string): string;
package/dist/index.d.mts CHANGED
@@ -33,7 +33,6 @@ interface CodegenContext {
33
33
  ws: boolean;
34
34
  };
35
35
  rpcGenerators: Partial<Record<string, RpcGenerator>>;
36
- coerceBigInts: boolean;
37
36
  }
38
37
  declare function getJsDocComment(metadata: Schema['metadata']): string;
39
38
  declare function validVarName(name: string): string;
package/dist/index.d.ts CHANGED
@@ -33,7 +33,6 @@ interface CodegenContext {
33
33
  ws: boolean;
34
34
  };
35
35
  rpcGenerators: Partial<Record<string, RpcGenerator>>;
36
- coerceBigInts: boolean;
37
36
  }
38
37
  declare function getJsDocComment(metadata: Schema['metadata']): string;
39
38
  declare function validVarName(name: string): string;
package/dist/index.mjs CHANGED
@@ -83,8 +83,7 @@ function tsArrayFromSchema(schema, context) {
83
83
  discriminatorValue: "",
84
84
  versionNumber: context.versionNumber,
85
85
  usedFeatures: context.usedFeatures,
86
- rpcGenerators: context.rpcGenerators,
87
- coerceBigInts: context.coerceBigInts
86
+ rpcGenerators: context.rpcGenerators
88
87
  });
89
88
  const typeName = `(${innerType.typeName})[]`;
90
89
  const defaultValue = schema.isNullable ? "null" : "[]";
@@ -222,8 +221,7 @@ function tsObjectFromSchema(schema, context) {
222
221
  discriminatorValue: "",
223
222
  versionNumber: context.versionNumber,
224
223
  usedFeatures: context.usedFeatures,
225
- rpcGenerators: context.rpcGenerators,
226
- coerceBigInts: context.coerceBigInts
224
+ rpcGenerators: context.rpcGenerators
227
225
  });
228
226
  if (prop.content) subContentParts.push(prop.content);
229
227
  const fieldName = validVarName(camelCase(key, { normalize: true }));
@@ -266,8 +264,7 @@ function tsObjectFromSchema(schema, context) {
266
264
  discriminatorValue: "",
267
265
  versionNumber: context.versionNumber,
268
266
  usedFeatures: context.usedFeatures,
269
- rpcGenerators: context.rpcGenerators,
270
- coerceBigInts: context.coerceBigInts
267
+ rpcGenerators: context.rpcGenerators
271
268
  });
272
269
  if (prop.content) subContentParts.push(prop.content);
273
270
  const fieldName = validVarName(camelCase(key, { normalize: true }));
@@ -394,8 +391,7 @@ function tsTaggedUnionFromSchema(schema, context) {
394
391
  discriminatorValue: key,
395
392
  versionNumber: context.versionNumber,
396
393
  usedFeatures: context.usedFeatures,
397
- rpcGenerators: context.rpcGenerators,
398
- coerceBigInts: context.coerceBigInts
394
+ rpcGenerators: context.rpcGenerators
399
395
  });
400
396
  subTypes.push({ value: key, data: subType });
401
397
  }
@@ -505,8 +501,16 @@ function tsEnumFromSchema(schema, context) {
505
501
  }
506
502
  const name = `${context.typePrefix}${enumName}`;
507
503
  const valuesName = `$$${name}Values`;
508
- result.content = `${getJsDocComment(schema.metadata)}export type ${name} = (typeof ${valuesName})[number];
509
- const ${valuesName} = [${schema.enum.map((val) => `"${val}"`).join(", ")}] as const;
504
+ result.content = `${getJsDocComment(schema.metadata)}export type ${name} = ${schema.enum.map((val) => `'${val}'`).join(" | ")};
505
+ export const ${name} = {
506
+ ${schema.enum.map((val) => {
507
+ let str = " ";
508
+ str += `${pascalCase(validVarName(val), { normalize: true })}:`;
509
+ str += ` '${val}',`;
510
+ return str;
511
+ }).join("\n")}
512
+ } as const;
513
+ const ${valuesName} = [${schema.enum.map((val) => `'${val}'`).join(", ")}] as const;
510
514
  export const $$${name}: ArriEnumValidator<${name}> = {
511
515
  new(): ${name} {
512
516
  return ${valuesName}[0];
@@ -549,11 +553,10 @@ function tsStringFromSchema(schema, _context) {
549
553
  return `typeof ${input} === 'string'`;
550
554
  },
551
555
  fromJsonTemplate(input, target) {
552
- return `if (typeof ${input} === 'string') {
553
- ${target} = ${input};
554
- } else {
555
- ${target} = ${defaultValue};
556
- }`;
556
+ if (schema.isNullable) {
557
+ return `${target} = parseNullableString(${input});`;
558
+ }
559
+ return `${target} = parseString(${input});`;
557
560
  },
558
561
  toJsonTemplate(input, target) {
559
562
  if (schema.isNullable) {
@@ -584,11 +587,10 @@ function tsBooleanFromSchema(schema, _context) {
584
587
  return `typeof ${input} === 'boolean'`;
585
588
  },
586
589
  fromJsonTemplate(input, target) {
587
- return `if (typeof ${input} === 'boolean') {
588
- ${target} = ${input};
589
- } else {
590
- ${target} = ${defaultValue};
591
- }`;
590
+ if (schema.isNullable) {
591
+ return `${target} = parseNullableBoolean(${input});`;
592
+ }
593
+ return `${target} = parseBoolean(${input});`;
592
594
  },
593
595
  toJsonTemplate(input, target) {
594
596
  return `${target} += \`\${${input}}\`;`;
@@ -612,13 +614,10 @@ function tsDateFromSchema(schema, _context) {
612
614
  return `${input} instanceof Date`;
613
615
  },
614
616
  fromJsonTemplate(input, target) {
615
- return `if (typeof ${input} === 'string') {
616
- ${target} = new Date(${input});
617
- } else if (${input} instanceof Date) {
618
- ${target} = ${input};
619
- } else {
620
- ${target} = ${defaultValue}
621
- }`;
617
+ if (schema.isNullable) {
618
+ return `${target} = parseNullableTimestamp(${input});`;
619
+ }
620
+ return `${target} = parseTimestamp(${input});`;
622
621
  },
623
622
  toJsonTemplate(input, target) {
624
623
  if (schema.isNullable) {
@@ -652,11 +651,10 @@ function tsFloatFromSchema(schema, _context) {
652
651
  return `typeof ${input} === 'number'`;
653
652
  },
654
653
  fromJsonTemplate(input, target) {
655
- return `if (typeof ${input} === 'number') {
656
- ${target} = ${input};
657
- } else {
658
- ${target} = ${defaultValue};
659
- }`;
654
+ if (schema.isNullable) {
655
+ return `${target} = parseNullableNumberFloat(${input});`;
656
+ }
657
+ return `${target} = parseNumberFloat(${input});`;
660
658
  },
661
659
  toJsonTemplate(input, target) {
662
660
  return `${target} += \`\${${input}}\``;
@@ -709,16 +707,10 @@ function tsIntFromSchema(schema, intType, _context) {
709
707
  return mainPart;
710
708
  },
711
709
  fromJsonTemplate(input, target) {
712
- return `if (
713
- typeof ${input} === 'number' &&
714
- Number.isInteger(${input}) &&
715
- ${input} >= ${min} &&
716
- ${input} <= ${max}
717
- ) {
718
- ${target} = ${input};
719
- } else {
720
- ${target} = ${defaultValue};
721
- }`;
710
+ if (schema.isNullable) {
711
+ return `${target} = parseNullableNumberInt(${input}, ${min}, ${max});`;
712
+ }
713
+ return `${target} = parseNumberInt(${input}, ${min}, ${max});`;
722
714
  },
723
715
  toJsonTemplate(input, target) {
724
716
  return `${target} += \`\${${input}}\``;
@@ -729,7 +721,7 @@ function tsIntFromSchema(schema, intType, _context) {
729
721
  content: ""
730
722
  };
731
723
  }
732
- function tsBigIntFromSchema(schema, isUnsigned, context) {
724
+ function tsBigIntFromSchema(schema, isUnsigned, _context) {
733
725
  const typeName = schema.isNullable ? `bigint | null` : `bigint`;
734
726
  const defaultValue = schema.isNullable ? `null` : "BigInt(0)";
735
727
  return {
@@ -744,37 +736,15 @@ function tsBigIntFromSchema(schema, isUnsigned, context) {
744
736
  },
745
737
  fromJsonTemplate(input, target) {
746
738
  if (isUnsigned) {
747
- let content2 = `if (typeof ${input} === 'string' && BigInt(${input}) >= BigInt(0)) {
748
- ${target} = BigInt(${input});
749
- } else if (typeof ${input} === 'bigint' && ${input} >= BigInt(0)) {
750
- ${target} = ${input};
751
- }`;
752
- if (context.coerceBigInts) {
753
- content2 += ` else if (typeof ${input} === 'number' && ${input} >= BigInt(0)) {
754
- console.warn("[arri] Expected a BigInt string at ${context.instancePath} but got a raw number. This could lead to precision loss.")
755
- ${target} = BigInt(${input});
756
- }`;
739
+ if (schema.isNullable) {
740
+ return `${target} = parseNullableNumberUnsignedBigInt(${input});`;
757
741
  }
758
- content2 += ` else {
759
- ${target} = ${defaultValue};
760
- }`;
761
- return content2;
742
+ return `${target} = parseNumberUnsignedBigInt(${input});`;
762
743
  }
763
- let content = `if (typeof ${input} === 'string') {
764
- ${target} = BigInt(${input});
765
- } else if (typeof ${input} === 'bigint') {
766
- ${target} = ${input};
767
- }`;
768
- if (context.coerceBigInts) {
769
- content += ` else if (typeof ${input} === 'number') {
770
- console.warn("[arri] Expected a BigInt string at ${context.instancePath} but got a raw number. This could lead to precision loss.")
771
- ${target} = BigInt(${input});
772
- } `;
744
+ if (schema.isNullable) {
745
+ return `${target} = parseNullableNumberBigInt(${input});`;
773
746
  }
774
- content += ` else {
775
- ${target} = ${defaultValue};
776
- }`;
777
- return content;
747
+ return `${target} = parseNumberBigInt(${input});`;
778
748
  },
779
749
  toJsonTemplate(input, target) {
780
750
  if (schema.isNullable) {
@@ -805,8 +775,7 @@ function tsRecordFromSchema(schema, context) {
805
775
  discriminatorValue: "",
806
776
  versionNumber: context.versionNumber,
807
777
  usedFeatures: context.usedFeatures,
808
- rpcGenerators: context.rpcGenerators,
809
- coerceBigInts: context.coerceBigInts
778
+ rpcGenerators: context.rpcGenerators
810
779
  });
811
780
  const typeName = `Record<string, ${innerType.typeName}>`;
812
781
  const defaultValue = schema.isNullable ? "null" : "{}";
@@ -1020,8 +989,7 @@ function tsServiceFromDefinition(def, context) {
1020
989
  schemaPath: `${context.instancePath}.${key2}`,
1021
990
  versionNumber: context.versionNumber,
1022
991
  usedFeatures: context.usedFeatures,
1023
- rpcGenerators: context.rpcGenerators,
1024
- coerceBigInts: context.coerceBigInts
992
+ rpcGenerators: context.rpcGenerators
1025
993
  });
1026
994
  if (subService.content) {
1027
995
  subServices.push(subService);
@@ -1040,8 +1008,7 @@ function tsServiceFromDefinition(def, context) {
1040
1008
  discriminatorValue: "",
1041
1009
  versionNumber: context.versionNumber,
1042
1010
  usedFeatures: context.usedFeatures,
1043
- rpcGenerators: context.rpcGenerators,
1044
- coerceBigInts: context.coerceBigInts
1011
+ rpcGenerators: context.rpcGenerators
1045
1012
  });
1046
1013
  if (rpc) {
1047
1014
  rpcParts.push(rpc);
@@ -1140,8 +1107,7 @@ async function createTypescriptClient(def, options) {
1140
1107
  sse: false,
1141
1108
  ws: false
1142
1109
  },
1143
- rpcGenerators: options.rpcGenerators ?? {},
1144
- coerceBigInts: options.coerceBigInts ?? false
1110
+ rpcGenerators: options.rpcGenerators ?? {}
1145
1111
  };
1146
1112
  const serviceDefinitions = unflattenProcedures(
1147
1113
  def.procedures,
@@ -1161,8 +1127,7 @@ async function createTypescriptClient(def, options) {
1161
1127
  discriminatorValue: "",
1162
1128
  versionNumber: context.versionNumber,
1163
1129
  usedFeatures: context.usedFeatures,
1164
- rpcGenerators: context.rpcGenerators,
1165
- coerceBigInts: context.coerceBigInts
1130
+ rpcGenerators: context.rpcGenerators
1166
1131
  });
1167
1132
  if (result2.content) {
1168
1133
  types.push(result2.content);
@@ -1190,6 +1155,21 @@ import {
1190
1155
  INT64_MAX,
1191
1156
  INT64_MIN,
1192
1157
  isObject,
1158
+ parseString,
1159
+ parseBoolean,
1160
+ parseNumber,
1161
+ parseTimestamp,
1162
+ parseNumberInt,
1163
+ parseNumberBigInt,
1164
+ parseNumberUnsignedBigInt,
1165
+ parseNumberFloat,
1166
+ parseNullableString,
1167
+ parseNullableBoolean,
1168
+ parseNullableTimestamp,
1169
+ parseNullableNumberFloat,
1170
+ parseNullableNumberInt,
1171
+ parseNullableNumberBigInt,
1172
+ parseNullableNumberUnsignedBigInt,
1193
1173
  serializeString,
1194
1174
  ${context.usedFeatures.sse ? "type SseOptions," : ""}
1195
1175
  UINT8_MAX,
@@ -1247,9 +1227,9 @@ function tsTypeFromSchema(schema, context) {
1247
1227
  case "uint32":
1248
1228
  return tsIntFromSchema(schema, "uint32");
1249
1229
  case "int64":
1250
- return tsBigIntFromSchema(schema, false, context);
1230
+ return tsBigIntFromSchema(schema, false);
1251
1231
  case "uint64":
1252
- return tsBigIntFromSchema(schema, true, context);
1232
+ return tsBigIntFromSchema(schema, true);
1253
1233
  }
1254
1234
  }
1255
1235
  if (isSchemaFormEnum(schema)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/codegen-ts",
3
- "version": "0.81.4",
3
+ "version": "0.82.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -23,6 +23,6 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "prettier": "^3.8.1",
26
- "@arrirpc/codegen-utils": "0.81.4"
26
+ "@arrirpc/codegen-utils": "0.82.0"
27
27
  }
28
28
  }