typia 5.0.0-dev.20230818 → 5.0.0-dev.20230820

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.
Files changed (83) hide show
  1. package/lib/factories/ExpressionFactory.d.ts +2 -0
  2. package/lib/factories/ExpressionFactory.js +8 -0
  3. package/lib/factories/ExpressionFactory.js.map +1 -1
  4. package/lib/factories/MetadataTagFactory.js +3 -0
  5. package/lib/factories/MetadataTagFactory.js.map +1 -1
  6. package/lib/functional/$ProtobufReader.js +1 -1
  7. package/lib/functional/$ProtobufReader.js.map +1 -1
  8. package/lib/module.d.ts +0 -53
  9. package/lib/module.js +1 -11
  10. package/lib/module.js.map +1 -1
  11. package/lib/programmers/CheckerProgrammer.js +2 -2
  12. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  13. package/lib/programmers/RandomProgrammer.js +1 -1
  14. package/lib/programmers/RandomProgrammer.js.map +1 -1
  15. package/lib/programmers/helpers/FunctionImporeter.d.ts +2 -1
  16. package/lib/programmers/helpers/FunctionImporeter.js +12 -3
  17. package/lib/programmers/helpers/FunctionImporeter.js.map +1 -1
  18. package/lib/programmers/helpers/UnionExplorer.js +26 -27
  19. package/lib/programmers/helpers/UnionExplorer.js.map +1 -1
  20. package/lib/programmers/helpers/disable_function_importer_declare.js +1 -0
  21. package/lib/programmers/helpers/disable_function_importer_declare.js.map +1 -1
  22. package/lib/programmers/internal/check_bigint.js +7 -1
  23. package/lib/programmers/internal/check_bigint.js.map +1 -1
  24. package/lib/programmers/internal/check_number.js +28 -5
  25. package/lib/programmers/internal/check_number.js.map +1 -1
  26. package/lib/programmers/internal/decode_union_object.js +12 -30
  27. package/lib/programmers/internal/decode_union_object.js.map +1 -1
  28. package/lib/programmers/misc/MiscLiteralsProgrammer.js +2 -1
  29. package/lib/programmers/misc/MiscLiteralsProgrammer.js.map +1 -1
  30. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js +66 -25
  31. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
  32. package/lib/programmers/protobuf/ProtobufMessageProgrammer.js +3 -1
  33. package/lib/programmers/protobuf/ProtobufMessageProgrammer.js.map +1 -1
  34. package/lib/protobuf.d.ts +4 -4
  35. package/lib/protobuf.js +6 -6
  36. package/lib/protobuf.js.map +1 -1
  37. package/lib/schemas/metadata/MetadataTuple.js.map +1 -1
  38. package/package.json +2 -2
  39. package/src/factories/ExpressionFactory.ts +25 -0
  40. package/src/factories/MetadataTagFactory.ts +3 -0
  41. package/src/functional/$ProtobufReader.ts +1 -2
  42. package/src/module.ts +0 -73
  43. package/src/programmers/CheckerProgrammer.ts +4 -4
  44. package/src/programmers/RandomProgrammer.ts +1 -1
  45. package/src/programmers/helpers/FunctionImporeter.ts +15 -4
  46. package/src/programmers/helpers/UnionExplorer.ts +36 -27
  47. package/src/programmers/helpers/disable_function_importer_declare.ts +1 -0
  48. package/src/programmers/internal/check_bigint.ts +11 -1
  49. package/src/programmers/internal/check_number.ts +64 -11
  50. package/src/programmers/internal/decode_union_object.ts +17 -6
  51. package/src/programmers/misc/MiscLiteralsProgrammer.ts +2 -1
  52. package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +169 -68
  53. package/src/programmers/protobuf/ProtobufMessageProgrammer.ts +6 -1
  54. package/src/protobuf.ts +16 -10
  55. package/src/schemas/metadata/MetadataTuple.ts +5 -0
  56. package/lib/functional/$proto_bytes.d.ts +0 -2
  57. package/lib/functional/$proto_bytes.js +0 -37
  58. package/lib/functional/$proto_bytes.js.map +0 -1
  59. package/lib/functional/$proto_field.d.ts +0 -10
  60. package/lib/functional/$proto_field.js +0 -42
  61. package/lib/functional/$proto_field.js.map +0 -1
  62. package/lib/functional/$proto_float.d.ts +0 -4
  63. package/lib/functional/$proto_float.js +0 -28
  64. package/lib/functional/$proto_float.js.map +0 -1
  65. package/lib/functional/$proto_i32.d.ts +0 -2
  66. package/lib/functional/$proto_i32.js +0 -23
  67. package/lib/functional/$proto_i32.js.map +0 -1
  68. package/lib/functional/$proto_i64.d.ts +0 -2
  69. package/lib/functional/$proto_i64.js +0 -31
  70. package/lib/functional/$proto_i64.js.map +0 -1
  71. package/lib/functional/$proto_size.d.ts +0 -6
  72. package/lib/functional/$proto_size.js +0 -76
  73. package/lib/functional/$proto_size.js.map +0 -1
  74. package/lib/functional/$proto_string.d.ts +0 -2
  75. package/lib/functional/$proto_string.js +0 -34
  76. package/lib/functional/$proto_string.js.map +0 -1
  77. package/src/functional/$proto_bytes.ts +0 -25
  78. package/src/functional/$proto_field.ts +0 -30
  79. package/src/functional/$proto_float.ts +0 -37
  80. package/src/functional/$proto_i32.ts +0 -29
  81. package/src/functional/$proto_i64.ts +0 -37
  82. package/src/functional/$proto_size.ts +0 -82
  83. package/src/functional/$proto_string.ts +0 -24
@@ -22,18 +22,32 @@ export const check_number =
22
22
  const entries: [IMetadataTag, ts.Expression][] = [];
23
23
  for (const tag of metaTags)
24
24
  if (tag.kind === "type") {
25
- entries.push([
26
- tag,
27
- ts.factory.createStrictEquality(
28
- ts.factory.createCallExpression(
29
- ts.factory.createIdentifier("parseInt"),
30
- undefined,
31
- [input],
25
+ // MUST BE INTEGER
26
+ if (
27
+ tag.value === "int" ||
28
+ tag.value === "uint" ||
29
+ tag.value === "int32" ||
30
+ tag.value === "uint32" ||
31
+ tag.value === "int64" ||
32
+ tag.value === "uint64"
33
+ )
34
+ entries.push([
35
+ tag,
36
+ ts.factory.createStrictEquality(
37
+ ts.factory.createCallExpression(
38
+ ts.factory.createIdentifier("Math.floor"),
39
+ undefined,
40
+ [input],
41
+ ),
42
+ input,
32
43
  ),
33
- input,
34
- ),
35
- ]);
36
- if (tag.value === "uint")
44
+ ]);
45
+ // GREATER THAN OR EQUAL TO ZERO
46
+ if (
47
+ tag.value === "uint" ||
48
+ tag.value === "uint32" ||
49
+ tag.value === "uint64"
50
+ )
37
51
  entries.push([
38
52
  tag,
39
53
  ts.factory.createLessThanEquals(
@@ -41,6 +55,45 @@ export const check_number =
41
55
  input,
42
56
  ),
43
57
  ]);
58
+ // RANGE LIMIT
59
+ if (tag.value === "uint32")
60
+ entries.push([
61
+ tag,
62
+ ts.factory.createLessThanEquals(
63
+ input,
64
+ ts.factory.createNumericLiteral(4294967295),
65
+ ),
66
+ ]);
67
+ else if (tag.value === "int32")
68
+ entries.push([
69
+ tag,
70
+ ts.factory.createLogicalAnd(
71
+ ts.factory.createLessThanEquals(
72
+ ts.factory.createNumericLiteral(-2147483648),
73
+ input,
74
+ ),
75
+ ts.factory.createLessThanEquals(
76
+ input,
77
+ ts.factory.createNumericLiteral(2147483647),
78
+ ),
79
+ ),
80
+ ]);
81
+ else if (tag.value === "float")
82
+ entries.push([
83
+ tag,
84
+ ts.factory.createLogicalAnd(
85
+ ts.factory.createLessThanEquals(
86
+ ts.factory.createNumericLiteral(
87
+ -1.175494351e38,
88
+ ),
89
+ input,
90
+ ),
91
+ ts.factory.createLessThanEquals(
92
+ input,
93
+ ts.factory.createNumericLiteral(3.4028235e38),
94
+ ),
95
+ ),
96
+ ]);
44
97
  } else if (tag.kind === "multipleOf")
45
98
  entries.push([
46
99
  tag,
@@ -55,13 +55,24 @@ const iterate =
55
55
  (input: ts.Expression, unions: IUnion[], expected: string) =>
56
56
  ts.factory.createBlock(
57
57
  [
58
- ...unions.map((u) =>
59
- ts.factory.createIfStatement(
60
- u.is(),
61
- ts.factory.createReturnStatement(u.value()),
58
+ unions
59
+ .map((u, i) =>
60
+ ts.factory.createIfStatement(
61
+ u.is(),
62
+ ts.factory.createReturnStatement(u.value()),
63
+ i === unions.length - 1
64
+ ? escaper(input, expected)
65
+ : undefined,
66
+ ),
67
+ )
68
+ .reverse()
69
+ .reduce((a, b) =>
70
+ ts.factory.createIfStatement(
71
+ b.expression,
72
+ b.thenStatement,
73
+ a,
74
+ ),
62
75
  ),
63
- ),
64
- escaper(input, expected),
65
76
  ],
66
77
  true,
67
78
  );
@@ -1,5 +1,6 @@
1
1
  import ts from "typescript";
2
2
 
3
+ import { ExpressionFactory } from "../../factories/ExpressionFactory";
3
4
  import { MetadataCollection } from "../../factories/MetadataCollection";
4
5
  import { MetadataFactory } from "../../factories/MetadataFactory";
5
6
 
@@ -47,7 +48,7 @@ export namespace MiscLiteralsProgrammer {
47
48
  : typeof v === "number"
48
49
  ? ts.factory.createNumericLiteral(v)
49
50
  : typeof v === "bigint"
50
- ? ts.factory.createBigIntLiteral(v.toString())
51
+ ? ExpressionFactory.bigint(Number(v))
51
52
  : ts.factory.createStringLiteral(v),
52
53
  ),
53
54
  true,
@@ -25,6 +25,8 @@ import { FunctionImporter } from "../helpers/FunctionImporeter";
25
25
  import { ProtobufUtil } from "../helpers/ProtobufUtil";
26
26
  import { ProtobufWire } from "../helpers/ProtobufWire";
27
27
  import { UnionExplorer } from "../helpers/UnionExplorer";
28
+ import { UnionPredicator } from "../helpers/UnionPredicator";
29
+ import { decode_union_object } from "../internal/decode_union_object";
28
30
 
29
31
  export namespace ProtobufEncodeProgrammer {
30
32
  export const write =
@@ -92,7 +94,7 @@ export namespace ProtobufEncodeProgrammer {
92
94
  ts.factory.createTypeReferenceNode("Uint8Array"),
93
95
  undefined,
94
96
  ts.factory.createBlock(
95
- [...importer.declare(modulo), ...block],
97
+ [...importer.declare(modulo, false), ...block],
96
98
  true,
97
99
  ),
98
100
  );
@@ -102,8 +104,37 @@ export namespace ProtobufEncodeProgrammer {
102
104
  (project: IProject) =>
103
105
  (importer: FunctionImporter) =>
104
106
  (collection: MetadataCollection) =>
105
- (meta: Metadata): ts.ArrowFunction =>
106
- ts.factory.createArrowFunction(
107
+ (meta: Metadata): ts.ArrowFunction => {
108
+ const functors = collection
109
+ .objects()
110
+ .filter((obj) => obj._Messagable())
111
+ .map((obj) =>
112
+ StatementFactory.constant(
113
+ `${PREFIX}o${obj.index}`,
114
+ write_object_function(project)(importer)(
115
+ ts.factory.createIdentifier("input"),
116
+ obj,
117
+ {
118
+ source: "function",
119
+ from: "object",
120
+ tracable: false,
121
+ postfix: "",
122
+ },
123
+ ),
124
+ ),
125
+ );
126
+ const main = decode(project)(importer)(null)(
127
+ ts.factory.createIdentifier("input"),
128
+ meta,
129
+ {
130
+ source: "top",
131
+ from: "top",
132
+ tracable: false,
133
+ postfix: "",
134
+ },
135
+ [],
136
+ );
137
+ return ts.factory.createArrowFunction(
107
138
  undefined,
108
139
  undefined,
109
140
  [IdentifierFactory.parameter("writer")],
@@ -111,35 +142,12 @@ export namespace ProtobufEncodeProgrammer {
111
142
  undefined,
112
143
  ts.factory.createBlock(
113
144
  [
114
- ...collection
115
- .objects()
116
- .filter((obj) => obj._Messagable())
117
- .map((obj) =>
118
- StatementFactory.constant(
119
- `${PREFIX}o${obj.index}`,
120
- write_object_function(project)(importer)(
121
- ts.factory.createIdentifier("input"),
122
- obj,
123
- {
124
- source: "function",
125
- from: "object",
126
- tracable: false,
127
- postfix: "",
128
- },
129
- ),
130
- ),
131
- ),
132
- ...decode(project)(importer)(null)(
133
- ts.factory.createIdentifier("input"),
134
- meta,
135
- {
136
- source: "top",
137
- from: "top",
138
- tracable: false,
139
- postfix: "",
140
- },
141
- [],
142
- ).statements,
145
+ ...importer.declareUnions(),
146
+ ...functors,
147
+ ...IsProgrammer.write_function_statements(project)(
148
+ importer,
149
+ )(collection),
150
+ ...main.statements,
143
151
  ts.factory.createReturnStatement(
144
152
  ts.factory.createIdentifier("writer"),
145
153
  ),
@@ -147,6 +155,7 @@ export namespace ProtobufEncodeProgrammer {
147
155
  true,
148
156
  ),
149
157
  );
158
+ };
150
159
 
151
160
  const write_object_function =
152
161
  (project: IProject) =>
@@ -266,7 +275,7 @@ export namespace ProtobufEncodeProgrammer {
266
275
  ts.factory.createStringLiteral(type),
267
276
  ts.factory.createTypeOfExpression(input),
268
277
  ),
269
- value: () => decode_atomic(index!)(input, type, tags),
278
+ value: (index) => decode_atomic(index!)(input, type, tags),
270
279
  }));
271
280
 
272
281
  // CONSIDER BYTES
@@ -275,7 +284,7 @@ export namespace ProtobufEncodeProgrammer {
275
284
  type: "bytes",
276
285
  is: () =>
277
286
  ExpressionFactory.isInstanceOf("Uint8Array")(input),
278
- value: () => decode_bytes("bytes")(index!)(input),
287
+ value: (index) => decode_bytes("bytes")(index!)(input),
279
288
  });
280
289
 
281
290
  // CONSIDER MAPS
@@ -283,7 +292,7 @@ export namespace ProtobufEncodeProgrammer {
283
292
  unions.push({
284
293
  type: "map",
285
294
  is: () => ExpressionFactory.isInstanceOf("Map")(input),
286
- value: () =>
295
+ value: (index) =>
287
296
  decode_map(project)(importer)(index!)(
288
297
  input,
289
298
  meta.maps[0]!,
@@ -300,7 +309,7 @@ export namespace ProtobufEncodeProgrammer {
300
309
  unions.push({
301
310
  type: "array",
302
311
  is: () => ExpressionFactory.isArray(input),
303
- value: () =>
312
+ value: (index) =>
304
313
  explore_arrays(project)(importer)(index!)(
305
314
  input,
306
315
  meta.arrays,
@@ -321,10 +330,10 @@ export namespace ProtobufEncodeProgrammer {
321
330
  checkNull: true,
322
331
  checkArray: false,
323
332
  })(input),
324
- value: () =>
325
- explore_objects(project)(index)(importer)(
333
+ value: (index) =>
334
+ explore_objects(project)(importer)(0)(index)(
326
335
  input,
327
- meta,
336
+ meta.objects,
328
337
  {
329
338
  ...explore,
330
339
  from: "object",
@@ -349,10 +358,26 @@ export namespace ProtobufEncodeProgrammer {
349
358
  (input: ts.Expression) =>
350
359
  ts.factory.createBlock(
351
360
  [
352
- ...unions.map((u) =>
353
- ts.factory.createIfStatement(u.is(), u.value(index)),
354
- ),
355
- create_throw_error(importer)(expected)(input),
361
+ unions
362
+ .map((u, i) =>
363
+ ts.factory.createIfStatement(
364
+ u.is(),
365
+ u.value(index ? index + i : null),
366
+ i === unions.length - 1
367
+ ? create_throw_error(importer)(expected)(
368
+ input,
369
+ )
370
+ : undefined,
371
+ ),
372
+ )
373
+ .reverse()
374
+ .reduce((a, b) =>
375
+ ts.factory.createIfStatement(
376
+ b.expression,
377
+ b.thenStatement,
378
+ a,
379
+ ),
380
+ ),
356
381
  ],
357
382
  true,
358
383
  );
@@ -424,7 +449,11 @@ export namespace ProtobufEncodeProgrammer {
424
449
  const top: MetadataProperty = object.properties[0]!;
425
450
  if (top.key.isSoleLiteral() === false)
426
451
  return decode_map(project)(importer)(index!)(
427
- input,
452
+ ts.factory.createCallExpression(
453
+ ts.factory.createIdentifier("Object.entries"),
454
+ [],
455
+ [input],
456
+ ),
428
457
  top,
429
458
  explore,
430
459
  tags,
@@ -637,35 +666,107 @@ export namespace ProtobufEncodeProgrammer {
637
666
  ----------------------------------------------------------- */
638
667
  const explore_objects =
639
668
  (project: IProject) =>
640
- (index: number | null) =>
641
669
  (importer: FunctionImporter) =>
670
+ (level: number) =>
671
+ (index: number | null) =>
642
672
  (
643
673
  input: ts.Expression,
644
- meta: Metadata,
674
+ targets: MetadataObject[],
645
675
  explore: FeatureProgrammer.IExplore,
646
676
  tags: IMetadataTag[],
647
- ): ts.Block =>
648
- meta.objects.length === 1
649
- ? decode_object(project)(importer)(index)(
650
- input,
651
- meta.objects[0]!,
652
- explore,
653
- tags,
654
- )
655
- : StatementFactory.block(
656
- ts.factory.createCallExpression(
657
- ts.factory.createIdentifier(
658
- importer.useLocal(
659
- `${PREFIX}u${meta.union_index!}`,
660
- ),
661
- ),
662
- undefined,
663
- FeatureProgrammer.argumentsArray({
664
- trace: false,
665
- path: false,
666
- })(explore)(input),
667
- ),
668
- );
677
+ ): ts.Block => {
678
+ if (targets.length === 1)
679
+ return decode_object(project)(importer)(index)(
680
+ input,
681
+ targets[0]!,
682
+ explore,
683
+ tags,
684
+ );
685
+
686
+ const expected: string = `(${targets
687
+ .map((t) => t.name)
688
+ .join(" | ")})`;
689
+
690
+ // POSSIBLE TO SPECIALIZE?
691
+ const specList = UnionPredicator.object(targets);
692
+ if (specList.length === 0) {
693
+ const condition: ts.Expression = decode_union_object(
694
+ IsProgrammer.decode_object(importer),
695
+ )((i, o, e) =>
696
+ ExpressionFactory.selfCall(
697
+ decode_object(project)(importer)(index)(i, o, e, tags),
698
+ ),
699
+ )((expr) => expr)((value, expected) =>
700
+ create_throw_error(importer)(expected)(value),
701
+ )(input, targets, explore);
702
+ return StatementFactory.block(condition);
703
+ }
704
+ const remained: MetadataObject[] = targets.filter(
705
+ (t) => specList.find((s) => s.object === t) === undefined,
706
+ );
707
+
708
+ // DO SPECIALIZE
709
+ const condition: ts.IfStatement = specList
710
+ .filter((spec) => spec.property.key.getSoleLiteral() !== null)
711
+ .map((spec, i, array) => {
712
+ const key: string = spec.property.key.getSoleLiteral()!;
713
+ const accessor: ts.Expression =
714
+ IdentifierFactory.access(input)(key);
715
+ const pred: ts.Expression = spec.neighbour
716
+ ? IsProgrammer.decode(project)(importer)(
717
+ accessor,
718
+ spec.property.value,
719
+ {
720
+ ...explore,
721
+ tracable: false,
722
+ postfix: IdentifierFactory.postfix(key),
723
+ },
724
+ tags,
725
+ [],
726
+ )
727
+ : ExpressionFactory.isRequired(accessor);
728
+ return ts.factory.createIfStatement(
729
+ pred,
730
+ ts.factory.createReturnStatement(
731
+ ExpressionFactory.selfCall(
732
+ decode_object(project)(importer)(index)(
733
+ input,
734
+ spec.object,
735
+ explore,
736
+ tags,
737
+ ),
738
+ ),
739
+ ),
740
+ i === array.length - 1
741
+ ? remained.length
742
+ ? ts.factory.createReturnStatement(
743
+ ExpressionFactory.selfCall(
744
+ explore_objects(project)(importer)(
745
+ level + 1,
746
+ )(index)(
747
+ input,
748
+ remained,
749
+ explore,
750
+ tags,
751
+ ),
752
+ ),
753
+ )
754
+ : create_throw_error(importer)(expected)(input)
755
+ : undefined,
756
+ );
757
+ })
758
+ .reverse()
759
+ .reduce((a, b) =>
760
+ ts.factory.createIfStatement(
761
+ b.expression,
762
+ b.thenStatement,
763
+ a,
764
+ ),
765
+ );
766
+
767
+ // RETURNS WITH CONDITIONS
768
+ return ts.factory.createBlock([condition], true);
769
+ };
669
770
 
670
771
  const explore_arrays =
671
772
  (project: IProject) =>
@@ -138,7 +138,12 @@ export namespace ProtobufMessageProgrammer {
138
138
  (tags: IMetadataTag[]) =>
139
139
  (literal: Atomic.Literal): string => {
140
140
  if (literal === "boolean") return "bool";
141
- else if (literal === "bigint") return "int64";
141
+ else if (literal === "bigint")
142
+ return tags.find(
143
+ (t) => t.kind === "type" && t.value === "uint64",
144
+ )
145
+ ? "uint64"
146
+ : "int64";
142
147
  else if (literal === "number") {
143
148
  const type = tags.find((t) => t.kind === "type") as
144
149
  | IMetadataTag.INumberType
package/src/protobuf.ts CHANGED
@@ -80,7 +80,7 @@ Object.assign(validateDecode, Namespace.protobuf.decode("validateDecode"));
80
80
  /* -----------------------------------------------------------
81
81
  ENCODE
82
82
  ----------------------------------------------------------- */
83
- export function encode<T>(input: T): Uint16Array;
83
+ export function encode<T>(input: T): Uint8Array;
84
84
 
85
85
  /**
86
86
  * @internal
@@ -90,7 +90,7 @@ export function encode(): never {
90
90
  }
91
91
  Object.assign(encode, Namespace.protobuf.encode("encode"));
92
92
 
93
- export function isEncode<T>(input: T): Uint16Array | null;
93
+ export function isEncode<T>(input: T): Uint8Array | null;
94
94
 
95
95
  /**
96
96
  * @internal
@@ -101,7 +101,7 @@ export function isEncode(): never {
101
101
  Object.assign(isEncode, Namespace.is());
102
102
  Object.assign(isEncode, Namespace.protobuf.encode("isEncode"));
103
103
 
104
- export function assertEncode<T>(input: T): Uint16Array;
104
+ export function assertEncode<T>(input: T): Uint8Array;
105
105
 
106
106
  /**
107
107
  * @internal
@@ -112,7 +112,7 @@ export function assertEncode(): never {
112
112
  Object.assign(assertEncode, Namespace.assert("assertEncode"));
113
113
  Object.assign(assertEncode, Namespace.protobuf.encode("assertEncode"));
114
114
 
115
- export function validateEncode<T>(input: T): IValidation<Uint16Array>;
115
+ export function validateEncode<T>(input: T): IValidation<Uint8Array>;
116
116
 
117
117
  /**
118
118
  * @internal
@@ -192,8 +192,8 @@ export function createIsEncode<T>(): (input: T) => Uint8Array | null;
192
192
  export function createIsEncode<T>(): (input: T) => Uint8Array | null {
193
193
  halt("createIsEncode");
194
194
  }
195
- Object.assign(createIsEncode, Namespace.is);
196
- Object.assign(createIsEncode, Namespace.protobuf.encode);
195
+ Object.assign(createIsEncode, Namespace.is());
196
+ Object.assign(createIsEncode, Namespace.protobuf.encode("createIsEncode"));
197
197
 
198
198
  export function createAssertEncode(): never;
199
199
  export function createAssertEncode<T>(): (input: T) => Uint8Array;
@@ -204,8 +204,11 @@ export function createAssertEncode<T>(): (input: T) => Uint8Array;
204
204
  export function createAssertEncode<T>(): (input: T) => Uint8Array {
205
205
  halt("createAssertEncode");
206
206
  }
207
- Object.assign(createAssertEncode, Namespace.assert);
208
- Object.assign(createAssertEncode, Namespace.protobuf.encode);
207
+ Object.assign(createAssertEncode, Namespace.assert("createAssertEncode"));
208
+ Object.assign(
209
+ createAssertEncode,
210
+ Namespace.protobuf.encode("createAssertEncode"),
211
+ );
209
212
 
210
213
  export function createValidateEncode(): never;
211
214
  export function createValidateEncode<T>(): (
@@ -220,8 +223,11 @@ export function createValidateEncode<T>(): (
220
223
  ) => IValidation<Uint8Array> {
221
224
  halt("createValidateEncode");
222
225
  }
223
- Object.assign(createValidateEncode, Namespace.validate);
224
- Object.assign(createValidateEncode, Namespace.protobuf.encode);
226
+ Object.assign(createValidateEncode, Namespace.validate());
227
+ Object.assign(
228
+ createValidateEncode,
229
+ Namespace.protobuf.encode("createValidateEncode"),
230
+ );
225
231
 
226
232
  /**
227
233
  * @internal
@@ -11,6 +11,11 @@ export class MetadataTuple {
11
11
  public readonly recursive: boolean;
12
12
  public readonly nullables: boolean[];
13
13
 
14
+ /**
15
+ * @internal
16
+ */
17
+ public of_map?: boolean;
18
+
14
19
  /**
15
20
  * @internal
16
21
  */
@@ -1,2 +0,0 @@
1
- export declare function $proto_bytes_encode(dst: Uint8Array, offset: number, value: Uint8Array): number;
2
- export declare function $proto_bytes_decode(src: Uint8Array, offset: number): [value: Uint8Array, offset: number];
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.$proto_bytes_decode = exports.$proto_bytes_encode = void 0;
20
- var _varint_1 = require("./$varint");
21
- function $proto_bytes_encode(dst, offset, value) {
22
- offset = (0, _varint_1.$varint_encode)(dst, offset, value.length);
23
- dst.set(value, offset);
24
- offset += value.length;
25
- return offset;
26
- }
27
- exports.$proto_bytes_encode = $proto_bytes_encode;
28
- function $proto_bytes_decode(src, offset) {
29
- var _a;
30
- var length = 0;
31
- _a = __read((0, _varint_1.$varint_decode_i32)(src, offset), 2), length = _a[0], offset = _a[1];
32
- var value = src.subarray(offset, offset + length);
33
- offset += length;
34
- return [value, offset];
35
- }
36
- exports.$proto_bytes_decode = $proto_bytes_decode;
37
- //# sourceMappingURL=$proto_bytes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"$proto_bytes.js","sourceRoot":"","sources":["../../src/functional/$proto_bytes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,qCAA+D;AAE/D,SAAgB,mBAAmB,CAC/B,GAAe,EACf,MAAc,EACd,KAAiB;IAEjB,MAAM,GAAG,IAAA,wBAAc,EAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnD,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;IACvB,OAAO,MAAM,CAAC;AAClB,CAAC;AATD,kDASC;AAED,SAAgB,mBAAmB,CAC/B,GAAe,EACf,MAAc;;IAEd,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,KAAA,OAAmB,IAAA,4BAAkB,EAAC,GAAG,EAAE,MAAM,CAAC,IAAA,EAAjD,MAAM,QAAA,EAAE,MAAM,QAAA,CAAoC;IACnD,IAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACpD,MAAM,IAAI,MAAM,CAAC;IAEjB,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC;AAXD,kDAWC"}
@@ -1,10 +0,0 @@
1
- export declare enum $proto_field_wiretype {
2
- VARINT = 0,
3
- I64 = 1,
4
- LEN = 2,
5
- SGROUP = 3,
6
- EGROUP = 4,
7
- I32 = 5
8
- }
9
- export declare function $proto_field_encode(dst: Uint8Array, offset: number, fieldNumber: number, wireType: $proto_field_wiretype): number;
10
- export declare function $proto_field_decode(buf: Uint8Array, offset: number): [fieldNumber: number, wireType: $proto_field_wiretype, offset: number];
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.$proto_field_decode = exports.$proto_field_encode = exports.$proto_field_wiretype = void 0;
20
- var _varint_1 = require("./$varint");
21
- var $proto_field_wiretype;
22
- (function ($proto_field_wiretype) {
23
- $proto_field_wiretype[$proto_field_wiretype["VARINT"] = 0] = "VARINT";
24
- $proto_field_wiretype[$proto_field_wiretype["I64"] = 1] = "I64";
25
- $proto_field_wiretype[$proto_field_wiretype["LEN"] = 2] = "LEN";
26
- $proto_field_wiretype[$proto_field_wiretype["SGROUP"] = 3] = "SGROUP";
27
- $proto_field_wiretype[$proto_field_wiretype["EGROUP"] = 4] = "EGROUP";
28
- $proto_field_wiretype[$proto_field_wiretype["I32"] = 5] = "I32";
29
- })($proto_field_wiretype || (exports.$proto_field_wiretype = $proto_field_wiretype = {}));
30
- function $proto_field_encode(dst, offset, fieldNumber, wireType) {
31
- var tag = (fieldNumber << 3) | Number(wireType);
32
- return (0, _varint_1.$varint_encode)(dst, offset, tag);
33
- }
34
- exports.$proto_field_encode = $proto_field_encode;
35
- function $proto_field_decode(buf, offset) {
36
- var _a = __read((0, _varint_1.$varint_decode_i32)(buf, offset), 2), tag = _a[0], o = _a[1];
37
- var fieldNumber = tag >>> 3;
38
- var wireType = tag & 7;
39
- return [fieldNumber, wireType, o];
40
- }
41
- exports.$proto_field_decode = $proto_field_decode;
42
- //# sourceMappingURL=$proto_field.js.map